Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 06cc6b0

Browse files
committed
fix: update CLightMode and CDarkMode component names
1 parent 1f1521d commit 06cc6b0

File tree

14 files changed

+88
-45
lines changed

14 files changed

+88
-45
lines changed

.changeset/great-brooms-add.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
"@chakra-ui/c-visually-hidden": minor
3+
"@chakra-ui/c-theme-provider": minor
4+
"@chakra-ui/vue-composables": minor
5+
"@chakra-ui/c-close-button": minor
6+
"@chakra-ui/c-form-control": minor
7+
"@chakra-ui/c-media-query": minor
8+
"@chakra-ui/c-scroll-lock": minor
9+
"@chakra-ui/c-breadcrumb": minor
10+
"@chakra-ui/c-color-mode": minor
11+
"@chakra-ui/c-focus-lock": minor
12+
"@chakra-ui/c-accordion": minor
13+
"@chakra-ui/c-pin-input": minor
14+
"@chakra-ui/c-checkbox": minor
15+
"@chakra-ui/c-skip-nav": minor
16+
"@chakra-ui/vue-test-utils": minor
17+
"@chakra-ui/vue-auto-import": minor
18+
"@chakra-ui/c-spinner": minor
19+
"@chakra-ui/c-avatar": minor
20+
"@chakra-ui/c-button": minor
21+
"@chakra-ui/c-motion": minor
22+
"@chakra-ui/c-popper": minor
23+
"@chakra-ui/c-portal": minor
24+
"@chakra-ui/vue-a11y": minor
25+
"@chakra-ui/c-alert": minor
26+
"@chakra-ui/c-image": minor
27+
"@chakra-ui/c-input": minor
28+
"@chakra-ui/c-modal": minor
29+
"@chakra-ui/c-reset": minor
30+
"@chakra-ui/c-code": minor
31+
"@chakra-ui/c-flex": minor
32+
"@chakra-ui/c-icon": minor
33+
"@chakra-ui/vue-layout": minor
34+
"@chakra-ui/vue-styled": minor
35+
"@chakra-ui/vue-system": minor
36+
"@chakra-ui/c-tag": minor
37+
"@chakra-ui/vue-utils": minor
38+
"@chakra-ui/vue-next": minor
39+
"@chakra-ui/nuxt-next": minor
40+
---
41+
42+
- Feat: Adds `colorModeManager` Storage entity to cache color mode from local
43+
env
44+
- Fix: adds semantic tokens support to theme
45+
- Feat: Add `CDarkMode` and `CLightMode` components
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
<template>
22
<c-alert> Base Alert </c-alert>
33
</template>
4-
5-
<script setup lang="ts">
6-
import { DarkMode } from "@chakra-ui/vue-next"
7-
</script>

packages/c-avatar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './src'
1+
export * from "./src"

packages/c-avatar/tests/c-avatar.cy.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ describe("CAvatar", () => {
4141

4242
it("renders default svg when name is not specified", () => {
4343
cy.mount(() =>
44-
h(() => <CAvatar src="https://avatars.githubusercontent.com/u/21237954?v=4" />)
44+
h(() => (
45+
<CAvatar src="https://avatars.githubusercontent.com/u/21237954?v=4" />
46+
))
4547
)
4648

4749
cy.get("svg")

packages/c-checkbox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './src'
1+
export * from "./src"

packages/c-color-mode/src/color-mode-provider.tsx

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { ColorMode, ColorModeRef, getColorModeUtils } from "./color-mode.utils"
1515
import { StorageManager } from "./storage-manager"
1616
import { createContext } from "@chakra-ui/vue-utils"
17-
import { mountColorModeScript } from './color-mode-script'
17+
import { mountColorModeScript } from "./color-mode-script"
1818

1919
export type { ColorModeRef }
2020

@@ -74,7 +74,6 @@ export function setupColorModeContext(
7474
initialColorMode,
7575
}: SetupColorModeContext
7676
) {
77-
7877
mountColorModeScript({
7978
initialColorMode: _colorMode.value,
8079
type: colorModeManager.type,
@@ -107,7 +106,6 @@ export function setupColorModeContext(
107106

108107
const resolvedColorMode = computed(() => getTheme(colorModeManager))
109108

110-
111109
function setColorMode(value: ColorMode | "system") {
112110
const { setClassName, setDataset, getSystemTheme } = utils.value
113111
const resolved = value === "system" ? getSystemTheme() : value
@@ -146,19 +144,21 @@ export function setupColorModeContext(
146144
})
147145
}
148146

149-
/**
147+
/**
150148
* Injects color mode into component instance
151149
*/
152150
export const useColorMode = () => {
153151
const context = inject<IColorModeContext>(AppColorModeContextSymbol, {
154152
colorMode: computed(() => "light" as Exclude<ColorMode, "system">),
155-
toggleColorMode: () => { },
153+
toggleColorMode: () => {},
156154
})
157155

158156
return {
159157
forced: context.forced,
160-
colorMode: computed(() => context.colorMode.value as Exclude<ColorMode, "system">),
161-
toggleColorMode: context.toggleColorMode
158+
colorMode: computed(
159+
() => context.colorMode.value as Exclude<ColorMode, "system">
160+
),
161+
toggleColorMode: context.toggleColorMode,
162162
}
163163
}
164164

@@ -188,31 +188,25 @@ export function useColorModeValue<TLight = unknown, TDark = unknown>(
188188
return modeValue
189189
}
190190

191-
192-
export const DarkMode = defineComponent((_, { slots, attrs }) => {
191+
export const CDarkMode = defineComponent((_, { slots, attrs }) => {
193192
provide(AppColorModeContextSymbol, {
194193
colorMode: computed(() => "dark" as Exclude<ColorMode, "system">),
195-
toggleColorMode: () => { },
196-
forced: true
194+
toggleColorMode: () => {},
195+
forced: true,
197196
})
198197

199-
return () => (
200-
<>
201-
{slots.default?.()}
202-
</>
203-
)
198+
return () => <>{slots.default?.()}</>
204199
})
200+
CDarkMode.name = "CDarkMode"
205201

206-
export const LightMode = defineComponent((_, { slots, attrs }) => {
202+
export const CLightMode = defineComponent((_, { slots, attrs }) => {
207203
provide(AppColorModeContextSymbol, {
208204
colorMode: computed(() => "light" as Exclude<ColorMode, "system">),
209-
toggleColorMode: () => { },
210-
forced: true
205+
toggleColorMode: () => {},
206+
forced: true,
211207
})
212208

213-
return () => (
214-
<>
215-
{slots.default?.()}
216-
</>
217-
)
209+
return () => <>{slots.default?.()}</>
218210
})
211+
212+
CLightMode.name = "CLightMode"

packages/c-image/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './src'
1+
export * from "./src"

packages/c-media-query/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './src'
1+
export * from "./src"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * as BaseCPinInput from "./base-c-pin-input.vue"
22
export * as WithClearButton from "./with-clear-button.vue"
3-
export * as WithEvents from "./with-events.vue"
3+
export * as WithEvents from "./with-events.vue"

packages/c-pin-input/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './src'
1+
export * from "./src"

0 commit comments

Comments
 (0)