pixelize-design-library 2.3.25 → 2.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/OrganizationDetails/OrganizationDetails.d.ts.map +1 -1
- package/dist/Components/OrganizationDetails/OrganizationDetails.js +4 -3
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +5 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/Assets/defaultLogo.tsx +0 -30
- package/dist/Components/Accordion/accordionColors.d.ts +0 -6
- package/dist/Components/Accordion/accordionColors.d.ts.map +0 -1
- package/dist/Components/Accordion/accordionColors.js +0 -20
- package/dist/Components/Editor/joditThemeVars.d.ts +0 -21
- package/dist/Components/Editor/joditThemeVars.d.ts.map +0 -1
- package/dist/Components/Editor/joditThemeVars.js +0 -70
- package/dist/Components/FilterSidebar/filterHoverStyle.d.ts +0 -12
- package/dist/Components/FilterSidebar/filterHoverStyle.d.ts.map +0 -1
- package/dist/Components/FilterSidebar/filterHoverStyle.js +0 -14
- package/dist/Components/SelectV2/SelectV2.d.ts +0 -3
- package/dist/Components/SelectV2/SelectV2.d.ts.map +0 -1
- package/dist/Components/SelectV2/SelectV2.js +0 -185
- package/dist/Components/SelectV2/SelectV2Props.d.ts +0 -67
- package/dist/Components/SelectV2/SelectV2Props.d.ts.map +0 -1
- package/dist/Components/SelectV2/SelectV2Props.js +0 -2
- package/dist/Components/SideBar/sidebarAccentColors.d.ts +0 -21
- package/dist/Components/SideBar/sidebarAccentColors.d.ts.map +0 -1
- package/dist/Components/SideBar/sidebarAccentColors.js +0 -36
- package/dist/Components/Table/components/tableRowHoverStyle.d.ts +0 -13
- package/dist/Components/Table/components/tableRowHoverStyle.d.ts.map +0 -1
- package/dist/Components/Table/components/tableRowHoverStyle.js +0 -26
- package/dist/Theme/chakra/Avatar.styles.d.ts +0 -33
- package/dist/Theme/chakra/Avatar.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Avatar.styles.js +0 -28
- package/dist/Theme/chakra/Drawer.styles.d.ts +0 -32
- package/dist/Theme/chakra/Drawer.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Drawer.styles.js +0 -26
- package/dist/Theme/chakra/Menu.styles.d.ts +0 -70
- package/dist/Theme/chakra/Menu.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Menu.styles.js +0 -50
- package/dist/Theme/chakra/Modal.styles.d.ts +0 -32
- package/dist/Theme/chakra/Modal.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Modal.styles.js +0 -26
- package/dist/Theme/chakra/Popover.styles.d.ts +0 -37
- package/dist/Theme/chakra/Popover.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Popover.styles.js +0 -30
- package/dist/Theme/chakra/Slider.styles.d.ts +0 -31
- package/dist/Theme/chakra/Slider.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Slider.styles.js +0 -25
- package/dist/Theme/chakra/Switch.styles.d.ts +0 -31
- package/dist/Theme/chakra/Switch.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Switch.styles.js +0 -24
- package/dist/Theme/chakra/Tabs.styles.d.ts +0 -43
- package/dist/Theme/chakra/Tabs.styles.d.ts.map +0 -1
- package/dist/Theme/chakra/Tabs.styles.js +0 -41
- package/dist/Theme/chakra/common.web.d.ts +0 -171
- package/dist/Theme/chakra/common.web.d.ts.map +0 -1
- package/dist/Theme/chakra/common.web.js +0 -21
- package/dist/Theme/chakra/componentStyles.d.ts +0 -240
- package/dist/Theme/chakra/componentStyles.d.ts.map +0 -1
- package/dist/Theme/chakra/componentStyles.js +0 -150
- package/dist/Theme/chakra/createBrandTheme.d.ts +0 -18
- package/dist/Theme/chakra/createBrandTheme.d.ts.map +0 -1
- package/dist/Theme/chakra/createBrandTheme.js +0 -78
- package/dist/Theme/chakra/fonts.web.d.ts +0 -42
- package/dist/Theme/chakra/fonts.web.d.ts.map +0 -1
- package/dist/Theme/chakra/fonts.web.js +0 -15
- package/dist/Theme/provider/PixelizeThemeProvider.d.ts +0 -46
- package/dist/Theme/provider/PixelizeThemeProvider.d.ts.map +0 -1
- package/dist/Theme/provider/PixelizeThemeProvider.js +0 -124
- package/dist/Theme/provider/ThemeSwitcher.d.ts +0 -8
- package/dist/Theme/provider/ThemeSwitcher.d.ts.map +0 -1
- package/dist/Theme/provider/ThemeSwitcher.js +0 -111
- package/dist/Theme/provider/colorModeStorage.d.ts +0 -10
- package/dist/Theme/provider/colorModeStorage.d.ts.map +0 -1
- package/dist/Theme/provider/colorModeStorage.js +0 -106
- package/dist/Theme/provider/index.d.ts +0 -6
- package/dist/Theme/provider/index.d.ts.map +0 -1
- package/dist/Theme/provider/index.js +0 -9
- package/dist/Theme/provider/useThemeMode.d.ts +0 -3
- package/dist/Theme/provider/useThemeMode.d.ts.map +0 -1
- package/dist/Theme/provider/useThemeMode.js +0 -13
- package/dist/Theme/tokens/brands/emerald/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/emerald/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/emerald/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/emerald/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/emerald/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/emerald/palette.light.js +0 -135
- package/dist/Theme/tokens/brands/index.d.ts +0 -28
- package/dist/Theme/tokens/brands/index.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/index.js +0 -93
- package/dist/Theme/tokens/brands/lavender/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/lavender/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/lavender/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/lavender/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/lavender/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/lavender/palette.light.js +0 -316
- package/dist/Theme/tokens/brands/meadow/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/meadow/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/meadow/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/meadow/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/meadow/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/meadow/palette.light.js +0 -133
- package/dist/Theme/tokens/brands/radiant/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/radiant/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/radiant/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/radiant/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/radiant/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/radiant/palette.light.js +0 -135
- package/dist/Theme/tokens/brands/rosewood/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/rosewood/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/rosewood/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/rosewood/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/rosewood/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/rosewood/palette.light.js +0 -139
- package/dist/Theme/tokens/brands/skyline/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/skyline/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/skyline/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/skyline/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/skyline/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/skyline/palette.light.js +0 -133
- package/dist/Theme/tokens/brands/slate/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/slate/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/slate/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/slate/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/slate/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/slate/palette.light.js +0 -137
- package/dist/Theme/tokens/brands/storefront/palette.dark.d.ts +0 -7
- package/dist/Theme/tokens/brands/storefront/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/storefront/palette.dark.js +0 -13
- package/dist/Theme/tokens/brands/storefront/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/storefront/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/storefront/palette.light.js +0 -127
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +0 -204
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/zinc/palette.dark.js +0 -204
- package/dist/Theme/tokens/brands/zinc/palette.light.d.ts +0 -375
- package/dist/Theme/tokens/brands/zinc/palette.light.d.ts.map +0 -1
- package/dist/Theme/tokens/brands/zinc/palette.light.js +0 -383
- package/dist/Theme/tokens/builders/accentText.d.ts +0 -56
- package/dist/Theme/tokens/builders/accentText.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/accentText.js +0 -92
- package/dist/Theme/tokens/builders/buildBrandTokens.d.ts +0 -16
- package/dist/Theme/tokens/builders/buildBrandTokens.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/buildBrandTokens.js +0 -33
- package/dist/Theme/tokens/builders/buildDarkPalette.d.ts +0 -23
- package/dist/Theme/tokens/builders/buildDarkPalette.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/buildDarkPalette.js +0 -282
- package/dist/Theme/tokens/builders/chartColorsFromTheme.d.ts +0 -17
- package/dist/Theme/tokens/builders/chartColorsFromTheme.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/chartColorsFromTheme.js +0 -26
- package/dist/Theme/tokens/builders/color.d.ts +0 -50
- package/dist/Theme/tokens/builders/color.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/color.js +0 -156
- package/dist/Theme/tokens/builders/index.d.ts +0 -6
- package/dist/Theme/tokens/builders/index.d.ts.map +0 -1
- package/dist/Theme/tokens/builders/index.js +0 -21
- package/dist/Theme/tokens/index.d.ts +0 -15
- package/dist/Theme/tokens/index.d.ts.map +0 -1
- package/dist/Theme/tokens/index.js +0 -30
- package/dist/Theme/tokens/primitives/breakpoints.d.ts +0 -9
- package/dist/Theme/tokens/primitives/breakpoints.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/breakpoints.js +0 -10
- package/dist/Theme/tokens/primitives/index.d.ts +0 -10
- package/dist/Theme/tokens/primitives/index.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/index.js +0 -27
- package/dist/Theme/tokens/primitives/letterSpacings.d.ts +0 -10
- package/dist/Theme/tokens/primitives/letterSpacings.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/letterSpacings.js +0 -11
- package/dist/Theme/tokens/primitives/lineHeights.d.ts +0 -19
- package/dist/Theme/tokens/primitives/lineHeights.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/lineHeights.js +0 -20
- package/dist/Theme/tokens/primitives/radii.d.ts +0 -13
- package/dist/Theme/tokens/primitives/radii.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/radii.js +0 -14
- package/dist/Theme/tokens/primitives/shadows.d.ts +0 -16
- package/dist/Theme/tokens/primitives/shadows.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/shadows.js +0 -17
- package/dist/Theme/tokens/primitives/sizes.d.ts +0 -63
- package/dist/Theme/tokens/primitives/sizes.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/sizes.js +0 -39
- package/dist/Theme/tokens/primitives/space.d.ts +0 -34
- package/dist/Theme/tokens/primitives/space.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/space.js +0 -35
- package/dist/Theme/tokens/primitives/typography.d.ts +0 -73
- package/dist/Theme/tokens/primitives/typography.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/typography.js +0 -43
- package/dist/Theme/tokens/primitives/zIndices.d.ts +0 -17
- package/dist/Theme/tokens/primitives/zIndices.d.ts.map +0 -1
- package/dist/Theme/tokens/primitives/zIndices.js +0 -18
- package/dist/Theme/tokens/types.d.ts +0 -116
- package/dist/Theme/tokens/types.d.ts.map +0 -1
- package/dist/Theme/tokens/types.js +0 -8
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { PaletteProps, ResolvedColorMode } from "../tokens/types";
|
|
2
|
-
export interface CreateBrandThemeOptions {
|
|
3
|
-
/** Which palette this theme represents. Defaults to `light`. */
|
|
4
|
-
colorMode?: ResolvedColorMode;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Builds a Chakra theme from a pure brand palette.
|
|
8
|
-
*
|
|
9
|
-
* Replaces the seven byte-identical `<Brand>/theme.ts` files — they differed only in
|
|
10
|
-
* which palette they imported.
|
|
11
|
-
*
|
|
12
|
-
* Dark mode works by swapping which palette the theme carries: `componentStyles` variants
|
|
13
|
-
* are functions of `({ theme })` and `useCustomTheme()` reads `theme.colors`, so both follow
|
|
14
|
-
* the palette automatically without any per-component `_dark` overrides.
|
|
15
|
-
*/
|
|
16
|
-
export declare const createBrandTheme: (palette: PaletteProps, options?: CreateBrandThemeOptions) => Record<string, any>;
|
|
17
|
-
export default createBrandTheme;
|
|
18
|
-
//# sourceMappingURL=createBrandTheme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBrandTheme.d.ts","sourceRoot":"","sources":["../../../src/Theme/chakra/createBrandTheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMvE,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,YAAY,EACrB,UAAS,uBAA4B,wBAwDtC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createBrandTheme = void 0;
|
|
7
|
-
const react_1 = require("@chakra-ui/react");
|
|
8
|
-
const common_web_1 = __importDefault(require("./common.web"));
|
|
9
|
-
const fonts_web_1 = __importDefault(require("./fonts.web"));
|
|
10
|
-
const componentStyles_1 = require("./componentStyles");
|
|
11
|
-
/**
|
|
12
|
-
* Builds a Chakra theme from a pure brand palette.
|
|
13
|
-
*
|
|
14
|
-
* Replaces the seven byte-identical `<Brand>/theme.ts` files — they differed only in
|
|
15
|
-
* which palette they imported.
|
|
16
|
-
*
|
|
17
|
-
* Dark mode works by swapping which palette the theme carries: `componentStyles` variants
|
|
18
|
-
* are functions of `({ theme })` and `useCustomTheme()` reads `theme.colors`, so both follow
|
|
19
|
-
* the palette automatically without any per-component `_dark` overrides.
|
|
20
|
-
*/
|
|
21
|
-
const createBrandTheme = (palette, options = {}) => {
|
|
22
|
-
var _a;
|
|
23
|
-
const colorMode = (_a = options.colorMode) !== null && _a !== void 0 ? _a : "light";
|
|
24
|
-
const brand = {
|
|
25
|
-
colors: palette,
|
|
26
|
-
...fonts_web_1.default,
|
|
27
|
-
...common_web_1.default,
|
|
28
|
-
};
|
|
29
|
-
return (0, react_1.extendTheme)({
|
|
30
|
-
...brand,
|
|
31
|
-
config: {
|
|
32
|
-
...common_web_1.default.config,
|
|
33
|
-
// Deliberately ALWAYS "light", even for the dark theme — this is not a bug.
|
|
34
|
-
//
|
|
35
|
-
// Dark works by swapping the palette, so the palette is ALREADY mode-adapted by the time
|
|
36
|
-
// Chakra sees it. Telling Chakra it is in dark mode makes it adapt a second time: its
|
|
37
|
-
// built-ins carry `_dark` blocks that reach for `gray.700`/`gray.800` assuming a scale where
|
|
38
|
-
// those rungs are dark. Our dark gray ramp runs dark -> light, so those rungs are LIGHT —
|
|
39
|
-
// producing a light Card/Skeleton/Menu on a dark canvas. Adapting twice cancels out.
|
|
40
|
-
//
|
|
41
|
-
// Keeping Chakra on its `_light` branch is what makes the swap work: those defaults are
|
|
42
|
-
// gray-RUNG references (`gray.100`, `gray.200`, `gray.600`), and our reversed ramp already
|
|
43
|
-
// maps each rung to the right value per mode. `semanticTokens` below patches the one default
|
|
44
|
-
// that hardcodes a literal color instead of a rung.
|
|
45
|
-
initialColorMode: "light",
|
|
46
|
-
useSystemColorMode: false,
|
|
47
|
-
},
|
|
48
|
-
// `chakra-body-bg` is the only stock semantic token that resolves to a LITERAL (`white`)
|
|
49
|
-
// rather than a gray rung, so it is the only one the palette swap cannot correct on its own —
|
|
50
|
-
// it is what paints a white Card/Modal/Menu on the dark canvas. `background[50]` is the
|
|
51
|
-
// canvas-following equivalent: byte-identical `#ffffff` in light, the canvas in dark.
|
|
52
|
-
// `chakra-inverse-text` is the same literal-`white` problem in text form.
|
|
53
|
-
semanticTokens: {
|
|
54
|
-
colors: {
|
|
55
|
-
"chakra-body-bg": palette.background[50],
|
|
56
|
-
"chakra-inverse-text": palette.background[50],
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
// Light themes intentionally declare no global styles — that is the pre-existing
|
|
60
|
-
// behavior, and adding any would shift every consuming app's light rendering.
|
|
61
|
-
// Dark needs a canvas, otherwise the page stays white behind the components.
|
|
62
|
-
...(colorMode === "dark"
|
|
63
|
-
? {
|
|
64
|
-
styles: {
|
|
65
|
-
global: {
|
|
66
|
-
body: {
|
|
67
|
-
bg: palette.backgroundColor.main,
|
|
68
|
-
color: palette.text[900],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
: {}),
|
|
74
|
-
components: componentStyles_1.componentStyles,
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
exports.createBrandTheme = createBrandTheme;
|
|
78
|
-
exports.default = exports.createBrandTheme;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/** Self-hosted Inter Variable (wght 100–900); required for theme fontWeights to render correctly. */
|
|
2
|
-
import "@fontsource-variable/inter/index.css";
|
|
3
|
-
/**
|
|
4
|
-
* Web font binding: loads the Inter font face (CSS side-effect) and re-exports the pure
|
|
5
|
-
* typography tokens. The CSS import lives here rather than in `tokens/` so the token
|
|
6
|
-
* layer stays portable to mobile.
|
|
7
|
-
*/
|
|
8
|
-
declare const fonts: {
|
|
9
|
-
fonts: {
|
|
10
|
-
body: string;
|
|
11
|
-
heading: string;
|
|
12
|
-
mono: string;
|
|
13
|
-
};
|
|
14
|
-
fontSizes: {
|
|
15
|
-
xs: string;
|
|
16
|
-
sm: string;
|
|
17
|
-
md: string;
|
|
18
|
-
lg: string;
|
|
19
|
-
xl: string;
|
|
20
|
-
"2xl": string;
|
|
21
|
-
"3xl": string;
|
|
22
|
-
"4xl": string;
|
|
23
|
-
"5xl": string;
|
|
24
|
-
"6xl": string;
|
|
25
|
-
"7xl": string;
|
|
26
|
-
"8xl": string;
|
|
27
|
-
"9xl": string;
|
|
28
|
-
};
|
|
29
|
-
fontWeights: {
|
|
30
|
-
hairline: number;
|
|
31
|
-
thin: number;
|
|
32
|
-
light: number;
|
|
33
|
-
normal: number;
|
|
34
|
-
medium: number;
|
|
35
|
-
semibold: number;
|
|
36
|
-
bold: number;
|
|
37
|
-
extrabold: number;
|
|
38
|
-
black: number;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export default fonts;
|
|
42
|
-
//# sourceMappingURL=fonts.web.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.web.d.ts","sourceRoot":"","sources":["../../../src/Theme/chakra/fonts.web.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,OAAO,sCAAsC,CAAC;AAG9C;;;;GAIG;AACH,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAEzB,eAAe,KAAK,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/** Self-hosted Inter Variable (wght 100–900); required for theme fontWeights to render correctly. */
|
|
7
|
-
require("@fontsource-variable/inter/index.css");
|
|
8
|
-
const typography_1 = __importDefault(require("../tokens/primitives/typography"));
|
|
9
|
-
/**
|
|
10
|
-
* Web font binding: loads the Inter font face (CSS side-effect) and re-exports the pure
|
|
11
|
-
* typography tokens. The CSS import lives here rather than in `tokens/` so the token
|
|
12
|
-
* layer stays portable to mobile.
|
|
13
|
-
*/
|
|
14
|
-
const fonts = typography_1.default;
|
|
15
|
-
exports.default = fonts;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { ColorMode, ResolvedColorMode, ThemeName } from "../tokens/types";
|
|
3
|
-
export type ThemeModeContextValue = {
|
|
4
|
-
mode: ColorMode;
|
|
5
|
-
resolvedMode: ResolvedColorMode;
|
|
6
|
-
setMode: (mode: ColorMode) => void;
|
|
7
|
-
toggle: () => void;
|
|
8
|
-
brand: ThemeName;
|
|
9
|
-
setBrand: (brand: ThemeName) => void;
|
|
10
|
-
};
|
|
11
|
-
export type PixelizeThemeProviderProps = {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
/** Initial brand. A persisted brand wins over this. */
|
|
14
|
-
brand?: ThemeName;
|
|
15
|
-
/** Initial color mode. A persisted mode wins over this. */
|
|
16
|
-
defaultMode?: ColorMode;
|
|
17
|
-
storageKey?: string;
|
|
18
|
-
disablePersistence?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* App-specific theme overrides (fonts, sizes, component defaultProps, zIndices, ...) merged
|
|
21
|
-
* onto the resolved `brandThemes[brand][resolvedMode]` via `extendTheme`. Re-evaluated whenever
|
|
22
|
-
* `brand`/`resolvedMode` change, so overrides always layer onto the CURRENT palette rather than
|
|
23
|
-
* a stale one. Safe to merge post-resolution: `createBrandTheme` already fixes
|
|
24
|
-
* `config.initialColorMode` to `"light"` on every palette, and `extendTheme` is a pure additive
|
|
25
|
-
* merge — it does not re-derive `_dark:` blocks or re-run color-mode resolution, so this cannot
|
|
26
|
-
* reintroduce the double-adaptation bug `forcedLightColorModeManager` avoids (see above).
|
|
27
|
-
*/
|
|
28
|
-
themeOverrides?: Record<string, unknown>;
|
|
29
|
-
};
|
|
30
|
-
export declare const ThemeModeContext: React.Context<ThemeModeContextValue | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* Chakra's own color mode is deliberately NOT synced to `resolvedMode`, and must not be.
|
|
33
|
-
*
|
|
34
|
-
* This provider adapts for dark by swapping the palette, so `theme.colors` is already correct for
|
|
35
|
-
* the active mode. Putting Chakra into dark mode on top of that adapts a second time: its built-in
|
|
36
|
-
* `_dark` blocks reach for `gray.700`/`gray.800` expecting those rungs to be dark, but our dark
|
|
37
|
-
* ramp runs dark -> light, so they resolve LIGHT — a white Card/Skeleton/Menu on a dark canvas.
|
|
38
|
-
* A previous revision synced it to keep `useColorModeValue()` working and shipped exactly that.
|
|
39
|
-
*
|
|
40
|
-
* Consequence for consumers: `useColorModeValue(light, dark)` always returns its LIGHT argument.
|
|
41
|
-
* That is correct here — the palette has already resolved the mode, so the "light" argument is
|
|
42
|
-
* whatever the active palette says. Read the mode from `useThemeMode()` instead. Existing apps are
|
|
43
|
-
* unaffected: they are light-only, where that argument was always the one returned anyway.
|
|
44
|
-
*/
|
|
45
|
-
export declare const PixelizeThemeProvider: ({ children, brand: brandProp, defaultMode, storageKey, disablePersistence, themeOverrides, }: PixelizeThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
//# sourceMappingURL=PixelizeThemeProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PixelizeThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/Theme/provider/PixelizeThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,uDAAuD;IACvD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C,CAAC;AA2BF,eAAO,MAAM,gBAAgB,kDAE5B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAAI,8FAOnC,0BAA0B,4CA8F5B,CAAC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PixelizeThemeProvider = exports.ThemeModeContext = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const react_2 = require("@chakra-ui/react");
|
|
10
|
-
const index_1 = require("../index");
|
|
11
|
-
const Toaster_1 = __importDefault(require("../../Components/Toaster/Toaster"));
|
|
12
|
-
const colorModeStorage_1 = require("./colorModeStorage");
|
|
13
|
-
const DEFAULT_BRAND = "lavender";
|
|
14
|
-
const DEFAULT_MODE = "system";
|
|
15
|
-
const DEFAULT_STORAGE_KEY = "pixelize-theme";
|
|
16
|
-
/**
|
|
17
|
-
* Chakra's default `colorModeManager` reads/writes its OWN `localStorage["chakra-ui-color-mode"]`
|
|
18
|
-
* key — entirely separate from this app's `storageKey` above — and that stored value wins over
|
|
19
|
-
* `theme.config.initialColorMode` on every load. `createBrandTheme` sets `initialColorMode: "light"`
|
|
20
|
-
* on every theme object specifically so Chakra's native dark mode (and every un-migrated built-in
|
|
21
|
-
* `_dark:` block — Card's "elevated" variant reaches for `gray.700`, which our reversed dark ramp
|
|
22
|
-
* makes LIGHT) never fires. But a stale `"dark"` value in that key — from Chakra's own toggle ever
|
|
23
|
-
* having been used on this origin, by this app or a prior version of it — silently overrides that
|
|
24
|
-
* default and reintroduces exactly the bug `initialColorMode: "light"` was meant to prevent: a
|
|
25
|
-
* washed-out light Card on an otherwise-correct dark canvas, while everything reading the palette
|
|
26
|
-
* directly (i.e. everything else) stays right. Forcing this manager to always report `"light"` and
|
|
27
|
-
* never persist removes Chakra's native color mode from the equation entirely, so no stray
|
|
28
|
-
* `_dark:` block anywhere (present or future) can ever fire, regardless of what's in storage.
|
|
29
|
-
*/
|
|
30
|
-
const forcedLightColorModeManager = {
|
|
31
|
-
type: "localStorage",
|
|
32
|
-
ssr: false,
|
|
33
|
-
get: () => "light",
|
|
34
|
-
set: () => { },
|
|
35
|
-
};
|
|
36
|
-
exports.ThemeModeContext = (0, react_1.createContext)(undefined);
|
|
37
|
-
/**
|
|
38
|
-
* Chakra's own color mode is deliberately NOT synced to `resolvedMode`, and must not be.
|
|
39
|
-
*
|
|
40
|
-
* This provider adapts for dark by swapping the palette, so `theme.colors` is already correct for
|
|
41
|
-
* the active mode. Putting Chakra into dark mode on top of that adapts a second time: its built-in
|
|
42
|
-
* `_dark` blocks reach for `gray.700`/`gray.800` expecting those rungs to be dark, but our dark
|
|
43
|
-
* ramp runs dark -> light, so they resolve LIGHT — a white Card/Skeleton/Menu on a dark canvas.
|
|
44
|
-
* A previous revision synced it to keep `useColorModeValue()` working and shipped exactly that.
|
|
45
|
-
*
|
|
46
|
-
* Consequence for consumers: `useColorModeValue(light, dark)` always returns its LIGHT argument.
|
|
47
|
-
* That is correct here — the palette has already resolved the mode, so the "light" argument is
|
|
48
|
-
* whatever the active palette says. Read the mode from `useThemeMode()` instead. Existing apps are
|
|
49
|
-
* unaffected: they are light-only, where that argument was always the one returned anyway.
|
|
50
|
-
*/
|
|
51
|
-
const PixelizeThemeProvider = ({ children, brand: brandProp = DEFAULT_BRAND, defaultMode = DEFAULT_MODE, storageKey = DEFAULT_STORAGE_KEY, disablePersistence = false, themeOverrides, }) => {
|
|
52
|
-
const [mode, setModeState] = (0, react_1.useState)(defaultMode);
|
|
53
|
-
const [brand, setBrandState] = (0, react_1.useState)(brandProp);
|
|
54
|
-
// Deterministic on the server and on the first client render — the real OS value lands in
|
|
55
|
-
// the effect below, so hydration always matches.
|
|
56
|
-
const [systemMode, setSystemMode] = (0, react_1.useState)("light");
|
|
57
|
-
(0, react_1.useEffect)(() => {
|
|
58
|
-
setSystemMode((0, colorModeStorage_1.getSystemColorMode)());
|
|
59
|
-
return (0, colorModeStorage_1.subscribeToSystemColorMode)(setSystemMode);
|
|
60
|
-
}, []);
|
|
61
|
-
(0, react_1.useEffect)(() => {
|
|
62
|
-
if (disablePersistence)
|
|
63
|
-
return;
|
|
64
|
-
const stored = (0, colorModeStorage_1.readStoredTheme)(storageKey);
|
|
65
|
-
if (stored.mode)
|
|
66
|
-
setModeState(stored.mode);
|
|
67
|
-
if (stored.brand)
|
|
68
|
-
setBrandState(stored.brand);
|
|
69
|
-
}, [disablePersistence, storageKey]);
|
|
70
|
-
// `brandProp` only seeds initial state above, so a consumer that re-renders with a new
|
|
71
|
-
// `brand` prop after mount (e.g. persisting the pick through its own store, like tickets'
|
|
72
|
-
// Settings page dispatching Redux instead of calling `setBrand`) would otherwise never see
|
|
73
|
-
// it applied — the same gap `colorMode` has, which callers work around with an effect
|
|
74
|
-
// mirroring `mode`. Sync it here instead so every consumer gets it for free.
|
|
75
|
-
const isFirstBrandPropRun = (0, react_1.useRef)(true);
|
|
76
|
-
(0, react_1.useEffect)(() => {
|
|
77
|
-
if (isFirstBrandPropRun.current) {
|
|
78
|
-
isFirstBrandPropRun.current = false;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
setBrandState(brandProp);
|
|
82
|
-
// Only re-sync when the prop itself changes — not on every local `setBrand` call (that
|
|
83
|
-
// would fight the user's own in-session brand picking, e.g. via ThemeSwitcher).
|
|
84
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
-
}, [brandProp]);
|
|
86
|
-
// Skipping the mount run keeps the defaults from being written over a stored value before
|
|
87
|
-
// the rehydrate effect above has applied it.
|
|
88
|
-
const isFirstPersistRun = (0, react_1.useRef)(true);
|
|
89
|
-
(0, react_1.useEffect)(() => {
|
|
90
|
-
if (isFirstPersistRun.current) {
|
|
91
|
-
isFirstPersistRun.current = false;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (disablePersistence)
|
|
95
|
-
return;
|
|
96
|
-
(0, colorModeStorage_1.writeStoredTheme)(storageKey, { mode, brand });
|
|
97
|
-
}, [mode, brand, disablePersistence, storageKey]);
|
|
98
|
-
const resolvedMode = mode === "system" ? systemMode : mode;
|
|
99
|
-
/**
|
|
100
|
-
* Native browser UI (the `<select>` dropdown popup chrome, the `<input type="date">` calendar
|
|
101
|
-
* picker) is painted by the browser's own UA stylesheet keyed off the CSS `color-scheme`
|
|
102
|
-
* property, entirely separate from Chakra/React theming — no component style or palette swap
|
|
103
|
-
* above can reach it. Without this, that chrome always renders light, even on an otherwise dark
|
|
104
|
-
* page. Scoped to this provider (not a global stylesheet) so `withTheme` consumers — deliberately
|
|
105
|
-
* light-only, see the module doc's "Key rules" — are untouched.
|
|
106
|
-
*/
|
|
107
|
-
(0, react_1.useEffect)(() => {
|
|
108
|
-
document.documentElement.style.colorScheme = resolvedMode;
|
|
109
|
-
}, [resolvedMode]);
|
|
110
|
-
const setMode = (0, react_1.useCallback)((next) => setModeState(next), []);
|
|
111
|
-
const setBrand = (0, react_1.useCallback)((next) => setBrandState(next), []);
|
|
112
|
-
// From "system", flip to the opposite of what the OS currently gives, so a click always
|
|
113
|
-
// visibly changes the UI.
|
|
114
|
-
const toggle = (0, react_1.useCallback)(() => setModeState(resolvedMode === "dark" ? "light" : "dark"), [resolvedMode]);
|
|
115
|
-
const value = (0, react_1.useMemo)(() => ({ mode, resolvedMode, setMode, toggle, brand, setBrand }), [mode, resolvedMode, setMode, toggle, brand, setBrand]);
|
|
116
|
-
const resolvedTheme = (0, react_1.useMemo)(() => {
|
|
117
|
-
const base = index_1.brandThemes[brand][resolvedMode];
|
|
118
|
-
return themeOverrides
|
|
119
|
-
? (0, react_2.extendTheme)(base, themeOverrides)
|
|
120
|
-
: base;
|
|
121
|
-
}, [brand, resolvedMode, themeOverrides]);
|
|
122
|
-
return ((0, jsx_runtime_1.jsx)(exports.ThemeModeContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(react_2.ChakraProvider, { theme: resolvedTheme, colorModeManager: forcedLightColorModeManager, children: (0, jsx_runtime_1.jsx)(Toaster_1.default, { children: children }) }) }));
|
|
123
|
-
};
|
|
124
|
-
exports.PixelizeThemeProvider = PixelizeThemeProvider;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type ThemeSwitcherProps = {
|
|
2
|
-
variant?: "icon" | "segmented" | "menu";
|
|
3
|
-
showBrandPicker?: boolean;
|
|
4
|
-
size?: "sm" | "md" | "lg";
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const ThemeSwitcher: ({ variant, showBrandPicker, size, "aria-label": ariaLabel, }: ThemeSwitcherProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
//# sourceMappingURL=ThemeSwitcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeSwitcher.d.ts","sourceRoot":"","sources":["../../../src/Theme/provider/ThemeSwitcher.tsx"],"names":[],"mappings":"AAqBA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAkSF,eAAO,MAAM,aAAa,GAAI,8DAK3B,kBAAkB,4CAuBpB,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThemeSwitcher = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_2 = require("@chakra-ui/react");
|
|
7
|
-
const lucide_react_1 = require("lucide-react");
|
|
8
|
-
const index_1 = require("../index");
|
|
9
|
-
const useCustomTheme_1 = require("../useCustomTheme");
|
|
10
|
-
const useThemeMode_1 = require("./useThemeMode");
|
|
11
|
-
const MODE_OPTIONS = [
|
|
12
|
-
{ value: "light", label: "Light", Icon: lucide_react_1.Sun },
|
|
13
|
-
{ value: "system", label: "System", Icon: lucide_react_1.Monitor },
|
|
14
|
-
{ value: "dark", label: "Dark", Icon: lucide_react_1.Moon },
|
|
15
|
-
];
|
|
16
|
-
const SIZES = {
|
|
17
|
-
sm: { control: "sm", icon: 14 },
|
|
18
|
-
md: { control: "md", icon: 16 },
|
|
19
|
-
lg: { control: "lg", icon: 18 },
|
|
20
|
-
};
|
|
21
|
-
const toBrandLabel = (brand) => brand.charAt(0).toUpperCase() + brand.slice(1);
|
|
22
|
-
/**
|
|
23
|
-
* Same swatch each brand's own theme carries at `colors.primary[500]` (the
|
|
24
|
-
* anchor a filled button reads) — resolved per brand from its OWN palette so
|
|
25
|
-
* the dot always matches what selecting that brand actually looks like,
|
|
26
|
-
* regardless of which brand/mode is currently active.
|
|
27
|
-
*/
|
|
28
|
-
const brandSwatchColor = (brand) => {
|
|
29
|
-
var _a, _b, _c, _d, _e;
|
|
30
|
-
return (_e = (_d = (_c = (_b = (_a = index_1.brandThemes[brand]) === null || _a === void 0 ? void 0 : _a.light) === null || _b === void 0 ? void 0 : _b.colors) === null || _c === void 0 ? void 0 : _c.primary) === null || _d === void 0 ? void 0 : _d[500]) !== null && _e !== void 0 ? _e : "gray.400";
|
|
31
|
-
};
|
|
32
|
-
const BrandSwatch = ({ brand }) => ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-block", w: "0.625rem", h: "0.625rem", borderRadius: "full", bg: brandSwatchColor(brand), border: "1px solid", borderColor: "whiteAlpha.300", flexShrink: 0 }));
|
|
33
|
-
/**
|
|
34
|
-
* Palette values already differ per color mode (`brandThemes[brand].light|dark`), so tokens
|
|
35
|
-
* are read straight from the active theme — no `useColorModeValue` pairing needed here.
|
|
36
|
-
* Fallbacks are Chakra token names, never literal colors, for themes without a brand palette.
|
|
37
|
-
*/
|
|
38
|
-
const useSwitcherColors = () => {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
40
|
-
const colors = (0, useCustomTheme_1.useCustomTheme)().colors;
|
|
41
|
-
return {
|
|
42
|
-
trackBg: (_d = (_b = (_a = colors === null || colors === void 0 ? void 0 : colors.backgroundColor) === null || _a === void 0 ? void 0 : _a.secondary) !== null && _b !== void 0 ? _b : (_c = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _c === void 0 ? void 0 : _c[100]) !== null && _d !== void 0 ? _d : "gray.100",
|
|
43
|
-
activeBg: (_g = (_f = (_e = colors === null || colors === void 0 ? void 0 : colors.backgroundColor) === null || _e === void 0 ? void 0 : _e.main) !== null && _f !== void 0 ? _f : colors === null || colors === void 0 ? void 0 : colors.white) !== null && _g !== void 0 ? _g : "white",
|
|
44
|
-
activeColor: (_l = (_j = (_h = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _h === void 0 ? void 0 : _h[500]) !== null && _j !== void 0 ? _j : (_k = colors === null || colors === void 0 ? void 0 : colors.text) === null || _k === void 0 ? void 0 : _k[900]) !== null && _l !== void 0 ? _l : "inherit",
|
|
45
|
-
mutedColor: (_q = (_o = (_m = colors === null || colors === void 0 ? void 0 : colors.text) === null || _m === void 0 ? void 0 : _m[600]) !== null && _o !== void 0 ? _o : (_p = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _p === void 0 ? void 0 : _p[600]) !== null && _q !== void 0 ? _q : "gray.600",
|
|
46
|
-
hoverBg: (_s = (_r = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _r === void 0 ? void 0 : _r[100]) !== null && _s !== void 0 ? _s : "gray.100",
|
|
47
|
-
borderColor: (_w = (_u = (_t = colors === null || colors === void 0 ? void 0 : colors.border) === null || _t === void 0 ? void 0 : _t[200]) !== null && _u !== void 0 ? _u : (_v = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _v === void 0 ? void 0 : _v[200]) !== null && _w !== void 0 ? _w : "gray.200",
|
|
48
|
-
// `--menu-bg` (and its hover/focus/active states) is now fixed centrally in the theme's
|
|
49
|
-
// Menu component style (Theme/chakra/Menu.styles.ts) — every MenuList gets it from there.
|
|
50
|
-
// Re-deriving it here too and pushing it back via `sx` on every render caused a redundant
|
|
51
|
-
// Emotion style recompute per render, which showed up as flicker while hovering/scrolling
|
|
52
|
-
// this list. Keep menuColor (Menu.styles.ts doesn't set list `color` per this component's
|
|
53
|
-
// needs) but stop duplicating menuBg.
|
|
54
|
-
menuColor: (_0 = (_y = (_x = colors === null || colors === void 0 ? void 0 : colors.text) === null || _x === void 0 ? void 0 : _x[900]) !== null && _y !== void 0 ? _y : (_z = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _z === void 0 ? void 0 : _z[900]) !== null && _0 !== void 0 ? _0 : "gray.900",
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const BrandMenu = ({ size }) => {
|
|
58
|
-
const { brand, setBrand } = (0, useThemeMode_1.useThemeMode)();
|
|
59
|
-
const { mutedColor, menuColor } = useSwitcherColors();
|
|
60
|
-
const brands = Object.keys(index_1.brandThemes);
|
|
61
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Menu, { children: [(0, jsx_runtime_1.jsx)(react_2.MenuButton, { as: react_2.Button, size: SIZES[size].control, variant: "ghost", color: mutedColor, borderRadius: "full", fontWeight: 500, "aria-label": `Brand theme, current ${toBrandLabel(brand)}`, _focusVisible: { boxShadow: "outline" }, children: (0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(BrandSwatch, { brand: brand }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", children: toBrandLabel(brand) })] }) }), (0, jsx_runtime_1.jsx)(react_2.MenuList, { minW: "9rem", color: menuColor, children: (0, jsx_runtime_1.jsx)(react_2.MenuOptionGroup, { title: "Brand", type: "radio", value: brand, onChange: (value) => setBrand(value), children: brands.map((option) => ((0, jsx_runtime_1.jsx)(react_2.MenuItemOption, { value: option, children: (0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(BrandSwatch, { brand: option }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", children: toBrandLabel(option) })] }) }, option))) }) })] }));
|
|
62
|
-
};
|
|
63
|
-
const IconVariant = ({ size, label, }) => {
|
|
64
|
-
const { resolvedMode, toggle } = (0, useThemeMode_1.useThemeMode)();
|
|
65
|
-
const { mutedColor, hoverBg } = useSwitcherColors();
|
|
66
|
-
const isDark = resolvedMode === "dark";
|
|
67
|
-
const Icon = isDark ? lucide_react_1.Moon : lucide_react_1.Sun;
|
|
68
|
-
const accessibleLabel = label !== null && label !== void 0 ? label : `Switch to ${isDark ? "light" : "dark"} mode`;
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Tooltip, { label: accessibleLabel, openDelay: 400, children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": accessibleLabel, "aria-pressed": isDark, icon: (0, jsx_runtime_1.jsx)(Icon, { size: SIZES[size].icon, "aria-hidden": true }), onClick: toggle, size: SIZES[size].control, variant: "ghost", color: mutedColor, borderRadius: "full", _hover: { bg: hoverBg }, _focusVisible: { boxShadow: "outline" } }) }));
|
|
70
|
-
};
|
|
71
|
-
const SegmentedVariant = ({ size, label, showBrandPicker, }) => {
|
|
72
|
-
const { mode, setMode } = (0, useThemeMode_1.useThemeMode)();
|
|
73
|
-
const { trackBg, activeBg, activeColor, mutedColor, borderColor } = useSwitcherColors();
|
|
74
|
-
const optionRefs = (0, react_1.useRef)([]);
|
|
75
|
-
// APG radiogroup behavior: arrows move focus and selection together.
|
|
76
|
-
const handleKeyDown = (event, index) => {
|
|
77
|
-
var _a;
|
|
78
|
-
const forward = event.key === "ArrowRight" || event.key === "ArrowDown";
|
|
79
|
-
const backward = event.key === "ArrowLeft" || event.key === "ArrowUp";
|
|
80
|
-
if (!forward && !backward)
|
|
81
|
-
return;
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
const next = (index + (forward ? 1 : -1) + MODE_OPTIONS.length) % MODE_OPTIONS.length;
|
|
84
|
-
setMode(MODE_OPTIONS[next].value);
|
|
85
|
-
(_a = optionRefs.current[next]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
86
|
-
};
|
|
87
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.HStack, { role: "radiogroup", "aria-label": label !== null && label !== void 0 ? label : "Color mode", display: "inline-flex", spacing: 1, p: "0.25rem", bg: trackBg, border: "0.063rem solid", borderColor: borderColor, borderRadius: "full", children: [MODE_OPTIONS.map(({ value, label: optionLabel, Icon }, index) => {
|
|
88
|
-
const isSelected = mode === value;
|
|
89
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Button, { ref: (node) => {
|
|
90
|
-
optionRefs.current[index] = node;
|
|
91
|
-
}, role: "radio", "aria-checked": isSelected, "aria-label": optionLabel, onClick: () => setMode(value), onKeyDown: (event) => handleKeyDown(event, index), size: SIZES[size].control, variant: "ghost", borderRadius: "full", bg: isSelected ? activeBg : "transparent", color: isSelected ? activeColor : mutedColor, boxShadow: isSelected ? "sm" : "none", _hover: { color: activeColor }, _focusVisible: { boxShadow: "outline" }, children: (0, jsx_runtime_1.jsx)(Icon, { size: SIZES[size].icon, "aria-hidden": true }) }, value));
|
|
92
|
-
}), showBrandPicker && (0, jsx_runtime_1.jsx)(BrandMenu, { size: size })] }));
|
|
93
|
-
};
|
|
94
|
-
const MenuVariant = ({ size, label, showBrandPicker, }) => {
|
|
95
|
-
var _a;
|
|
96
|
-
const { mode, brand, setMode, setBrand } = (0, useThemeMode_1.useThemeMode)();
|
|
97
|
-
const { mutedColor, hoverBg, menuColor } = useSwitcherColors();
|
|
98
|
-
const active = (_a = MODE_OPTIONS.find((option) => option.value === mode)) !== null && _a !== void 0 ? _a : MODE_OPTIONS[0];
|
|
99
|
-
const brands = Object.keys(index_1.brandThemes);
|
|
100
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Menu, { children: [(0, jsx_runtime_1.jsx)(react_2.MenuButton, { as: react_2.IconButton, "aria-label": label !== null && label !== void 0 ? label : `Color mode, current ${active.label}`, icon: (0, jsx_runtime_1.jsx)(active.Icon, { size: SIZES[size].icon, "aria-hidden": true }), size: SIZES[size].control, variant: "ghost", color: mutedColor, borderRadius: "full", _hover: { bg: hoverBg }, _focusVisible: { boxShadow: "outline" } }), (0, jsx_runtime_1.jsxs)(react_2.MenuList, { minW: "10rem", color: menuColor, children: [(0, jsx_runtime_1.jsx)(react_2.MenuOptionGroup, { title: "Appearance", type: "radio", value: mode, onChange: (value) => setMode(value), children: MODE_OPTIONS.map(({ value, label: optionLabel, Icon }) => ((0, jsx_runtime_1.jsx)(react_2.MenuItemOption, { value: value, children: (0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(Icon, { size: SIZES[size].icon, "aria-hidden": true }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", children: optionLabel })] }) }, value))) }), showBrandPicker && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.MenuDivider, {}), (0, jsx_runtime_1.jsx)(react_2.MenuOptionGroup, { title: "Brand", type: "radio", value: brand, onChange: (value) => setBrand(value), children: brands.map((option) => ((0, jsx_runtime_1.jsx)(react_2.MenuItemOption, { value: option, children: (0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(BrandSwatch, { brand: option }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", children: toBrandLabel(option) })] }) }, option))) })] }))] })] }));
|
|
101
|
-
};
|
|
102
|
-
const ThemeSwitcher = ({ variant = "icon", showBrandPicker = false, size = "md", "aria-label": ariaLabel, }) => {
|
|
103
|
-
if (variant === "segmented") {
|
|
104
|
-
return ((0, jsx_runtime_1.jsx)(SegmentedVariant, { size: size, label: ariaLabel, showBrandPicker: showBrandPicker }));
|
|
105
|
-
}
|
|
106
|
-
if (variant === "menu") {
|
|
107
|
-
return ((0, jsx_runtime_1.jsx)(MenuVariant, { size: size, label: ariaLabel, showBrandPicker: showBrandPicker }));
|
|
108
|
-
}
|
|
109
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 1, display: "inline-flex", children: [(0, jsx_runtime_1.jsx)(IconVariant, { size: size, label: ariaLabel }), showBrandPicker && (0, jsx_runtime_1.jsx)(BrandMenu, { size: size })] }));
|
|
110
|
-
};
|
|
111
|
-
exports.ThemeSwitcher = ThemeSwitcher;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ColorMode, ResolvedColorMode, ThemeName } from "../tokens/types";
|
|
2
|
-
export type StoredTheme = {
|
|
3
|
-
mode?: ColorMode;
|
|
4
|
-
brand?: ThemeName;
|
|
5
|
-
};
|
|
6
|
-
export declare const readStoredTheme: (storageKey: string) => StoredTheme;
|
|
7
|
-
export declare const writeStoredTheme: (storageKey: string, value: StoredTheme) => void;
|
|
8
|
-
export declare const getSystemColorMode: () => ResolvedColorMode;
|
|
9
|
-
export declare const subscribeToSystemColorMode: (callback: (mode: ResolvedColorMode) => void) => (() => void);
|
|
10
|
-
//# sourceMappingURL=colorModeStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colorModeStorage.d.ts","sourceRoot":"","sources":["../../../src/Theme/provider/colorModeStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAiCF,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,KAAG,WAmBpD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,YAAY,MAAM,EAAE,OAAO,WAAW,KAAG,IASzE,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,iBASrC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,UAAU,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,KAC1C,CAAC,MAAM,IAAI,CA0Bb,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscribeToSystemColorMode = exports.getSystemColorMode = exports.writeStoredTheme = exports.readStoredTheme = void 0;
|
|
4
|
-
const DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
5
|
-
/**
|
|
6
|
-
* Stored values are untrusted input — a stale or hand-edited entry must never reach
|
|
7
|
-
* `brandThemes[brand]` and hand Chakra an `undefined` theme.
|
|
8
|
-
*/
|
|
9
|
-
const VALID_MODES = ["light", "dark", "system"];
|
|
10
|
-
const VALID_BRANDS = [
|
|
11
|
-
"lavender",
|
|
12
|
-
"meadow",
|
|
13
|
-
"radiant",
|
|
14
|
-
"skyline",
|
|
15
|
-
"slate",
|
|
16
|
-
"emerald",
|
|
17
|
-
"rosewood",
|
|
18
|
-
"storefront",
|
|
19
|
-
"zinc",
|
|
20
|
-
];
|
|
21
|
-
const noop = () => { };
|
|
22
|
-
/** Safari private mode throws on `localStorage` access rather than returning null. */
|
|
23
|
-
const getStorage = () => {
|
|
24
|
-
var _a;
|
|
25
|
-
try {
|
|
26
|
-
if (typeof window === "undefined")
|
|
27
|
-
return null;
|
|
28
|
-
return (_a = window.localStorage) !== null && _a !== void 0 ? _a : null;
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const readStoredTheme = (storageKey) => {
|
|
35
|
-
const storage = getStorage();
|
|
36
|
-
if (!storage)
|
|
37
|
-
return {};
|
|
38
|
-
try {
|
|
39
|
-
const raw = storage.getItem(storageKey);
|
|
40
|
-
if (!raw)
|
|
41
|
-
return {};
|
|
42
|
-
const parsed = JSON.parse(raw);
|
|
43
|
-
if (!parsed || typeof parsed !== "object")
|
|
44
|
-
return {};
|
|
45
|
-
const { mode, brand } = parsed;
|
|
46
|
-
const stored = {};
|
|
47
|
-
if (mode && VALID_MODES.includes(mode))
|
|
48
|
-
stored.mode = mode;
|
|
49
|
-
if (brand && VALID_BRANDS.includes(brand))
|
|
50
|
-
stored.brand = brand;
|
|
51
|
-
return stored;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
exports.readStoredTheme = readStoredTheme;
|
|
58
|
-
const writeStoredTheme = (storageKey, value) => {
|
|
59
|
-
const storage = getStorage();
|
|
60
|
-
if (!storage)
|
|
61
|
-
return;
|
|
62
|
-
try {
|
|
63
|
-
storage.setItem(storageKey, JSON.stringify(value));
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// Quota / private mode. Persistence is best-effort — never break the app over it.
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
exports.writeStoredTheme = writeStoredTheme;
|
|
70
|
-
const getSystemColorMode = () => {
|
|
71
|
-
try {
|
|
72
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
73
|
-
return "light";
|
|
74
|
-
}
|
|
75
|
-
return window.matchMedia(DARK_QUERY).matches ? "dark" : "light";
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
return "light";
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
exports.getSystemColorMode = getSystemColorMode;
|
|
82
|
-
const subscribeToSystemColorMode = (callback) => {
|
|
83
|
-
try {
|
|
84
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
85
|
-
return noop;
|
|
86
|
-
}
|
|
87
|
-
const query = window.matchMedia(DARK_QUERY);
|
|
88
|
-
const handler = (event) => {
|
|
89
|
-
callback(event.matches ? "dark" : "light");
|
|
90
|
-
};
|
|
91
|
-
if (typeof query.addEventListener === "function") {
|
|
92
|
-
query.addEventListener("change", handler);
|
|
93
|
-
return () => query.removeEventListener("change", handler);
|
|
94
|
-
}
|
|
95
|
-
// Safari < 14 only has the deprecated listener API.
|
|
96
|
-
if (typeof query.addListener === "function") {
|
|
97
|
-
query.addListener(handler);
|
|
98
|
-
return () => query.removeListener(handler);
|
|
99
|
-
}
|
|
100
|
-
return noop;
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return noop;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
exports.subscribeToSystemColorMode = subscribeToSystemColorMode;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { PixelizeThemeProvider } from "./PixelizeThemeProvider";
|
|
2
|
-
export type { PixelizeThemeProviderProps, ThemeModeContextValue, } from "./PixelizeThemeProvider";
|
|
3
|
-
export { useThemeMode } from "./useThemeMode";
|
|
4
|
-
export { ThemeSwitcher } from "./ThemeSwitcher";
|
|
5
|
-
export type { ThemeSwitcherProps } from "./ThemeSwitcher";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Theme/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThemeSwitcher = exports.useThemeMode = exports.PixelizeThemeProvider = void 0;
|
|
4
|
-
var PixelizeThemeProvider_1 = require("./PixelizeThemeProvider");
|
|
5
|
-
Object.defineProperty(exports, "PixelizeThemeProvider", { enumerable: true, get: function () { return PixelizeThemeProvider_1.PixelizeThemeProvider; } });
|
|
6
|
-
var useThemeMode_1 = require("./useThemeMode");
|
|
7
|
-
Object.defineProperty(exports, "useThemeMode", { enumerable: true, get: function () { return useThemeMode_1.useThemeMode; } });
|
|
8
|
-
var ThemeSwitcher_1 = require("./ThemeSwitcher");
|
|
9
|
-
Object.defineProperty(exports, "ThemeSwitcher", { enumerable: true, get: function () { return ThemeSwitcher_1.ThemeSwitcher; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeMode.d.ts","sourceRoot":"","sources":["../../../src/Theme/provider/useThemeMode.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,eAAO,MAAM,YAAY,QAAO,qBAU/B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useThemeMode = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const PixelizeThemeProvider_1 = require("./PixelizeThemeProvider");
|
|
6
|
-
const useThemeMode = () => {
|
|
7
|
-
const context = (0, react_1.useContext)(PixelizeThemeProvider_1.ThemeModeContext);
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error("useThemeMode must be used inside <PixelizeThemeProvider>. Wrap your app (or at least the subtree that calls useThemeMode) in <PixelizeThemeProvider> from pixelize-design-library.");
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
exports.useThemeMode = useThemeMode;
|