softable-pixels-web 1.0.0 → 1.0.2
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/TabSwitch-bxVgCnTw.js +126 -0
- package/dist/TabSwitch-bxVgCnTw.js.map +1 -0
- package/dist/{ThemeContext-CRXby8a0.js → ThemeContext-DiQ-_KUr.js} +56 -83
- package/dist/ThemeContext-DiQ-_KUr.js.map +1 -0
- package/dist/Typography-Dn1vnPBy.js +528 -0
- package/dist/Typography-Dn1vnPBy.js.map +1 -0
- package/dist/index--nD5Wzza.d.ts +32 -0
- package/dist/{index-jFi4YRO5.d.ts → index-B0CCFNqx.d.ts} +4 -4
- package/dist/index-C_T04IuG.d.ts +27 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/tab-switch.d.ts +1 -1
- package/dist/tab-switch.js +2 -1
- package/dist/theme-context.d.ts +1 -1
- package/dist/theme-context.js +1 -1
- package/dist/typography.d.ts +2 -0
- package/dist/typography.js +3 -0
- package/dist/useThemedStyles-DyrejrCM.d.ts +91 -0
- package/package.json +20 -8
- package/dist/TabSwitch-D6OPAUjC.js +0 -304
- package/dist/TabSwitch-D6OPAUjC.js.map +0 -1
- package/dist/ThemeContext-CRXby8a0.js.map +0 -1
- package/dist/index-CZOu4S--.d.ts +0 -69
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { t as Typography } from "./Typography-Dn1vnPBy.js";
|
|
2
|
+
import { t as TabSwitch } from "./TabSwitch-bxVgCnTw.js";
|
|
3
|
+
import { n as useTheme, t as ThemeProvider } from "./ThemeContext-DiQ-_KUr.js";
|
|
3
4
|
|
|
4
|
-
export { TabSwitch, ThemeProvider, useTheme };
|
|
5
|
+
export { TabSwitch, ThemeProvider, Typography, useTheme };
|
package/dist/tab-switch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index
|
|
1
|
+
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index--nD5Wzza.js";
|
|
2
2
|
export { SwitchOption, TabSwitch, TabSwitchProps };
|
package/dist/tab-switch.js
CHANGED
package/dist/theme-context.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-
|
|
1
|
+
import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-B0CCFNqx.js";
|
|
2
2
|
export { ThemeContextData, ThemeMode, ThemeName, ThemePersistence, ThemeProvider, ThemeProviderProps, ThemeRegistry, ThemeTokens, useTheme };
|
package/dist/theme-context.js
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//#region src/hooks/useThemedStyles/types/styleProps.d.ts
|
|
2
|
+
type Space = number | string;
|
|
3
|
+
type Size = number | string;
|
|
4
|
+
interface MarginProps {
|
|
5
|
+
m?: Space;
|
|
6
|
+
mx?: Space;
|
|
7
|
+
my?: Space;
|
|
8
|
+
mt?: Space;
|
|
9
|
+
mr?: Space;
|
|
10
|
+
mb?: Space;
|
|
11
|
+
ml?: Space;
|
|
12
|
+
}
|
|
13
|
+
interface PaddingProps {
|
|
14
|
+
p?: Space;
|
|
15
|
+
px?: Space;
|
|
16
|
+
py?: Space;
|
|
17
|
+
pt?: Space;
|
|
18
|
+
pr?: Space;
|
|
19
|
+
pb?: Space;
|
|
20
|
+
pl?: Space;
|
|
21
|
+
}
|
|
22
|
+
interface TextProps {
|
|
23
|
+
fontSize?: number | string;
|
|
24
|
+
fontWeight?: React.CSSProperties['fontWeight'];
|
|
25
|
+
lineHeight?: number | string;
|
|
26
|
+
textAlign?: React.CSSProperties['textAlign'];
|
|
27
|
+
}
|
|
28
|
+
interface LayoutProps {
|
|
29
|
+
w?: Size;
|
|
30
|
+
h?: Size;
|
|
31
|
+
minW?: Size;
|
|
32
|
+
maxW?: Size;
|
|
33
|
+
minH?: Size;
|
|
34
|
+
maxH?: Size;
|
|
35
|
+
}
|
|
36
|
+
type CommonStyleProps = MarginProps & PaddingProps & TextProps & LayoutProps;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/hooks/useThemedStyles/types/useThemedStyles.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* Allows CSS Variables to be used in inline styles.
|
|
41
|
+
*
|
|
42
|
+
* Example:
|
|
43
|
+
* ```ts
|
|
44
|
+
* const style: CSSVars = { "--btn-bg": "#111", background: "var(--btn-bg)" }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
type CSSVars = React.CSSProperties & Record<`--${string}`, string | number>;
|
|
48
|
+
/**
|
|
49
|
+
* A rule declaration is like CSSProperties, but also supports CSS variables.
|
|
50
|
+
* Used inside `__rules`.
|
|
51
|
+
*/
|
|
52
|
+
type RuleDecl = React.CSSProperties & Record<`--${string}`, string | number>;
|
|
53
|
+
/**
|
|
54
|
+
* Map of selectors to declarations.
|
|
55
|
+
*
|
|
56
|
+
* Key examples:
|
|
57
|
+
* - "&:hover"
|
|
58
|
+
* - "& > p"
|
|
59
|
+
* - ":focus-visible" (auto-scoped to the slot class)
|
|
60
|
+
* - "::before" (auto-scoped)
|
|
61
|
+
* - "span" (scoped as descendant)
|
|
62
|
+
* - "&::-webkit-scrollbar" (scoped)
|
|
63
|
+
*/
|
|
64
|
+
type RuleMap = Record<string, RuleDecl>;
|
|
65
|
+
/**
|
|
66
|
+
* Slot style supports a reserved `__rules` key.
|
|
67
|
+
*
|
|
68
|
+
* - Everything EXCEPT `__rules` is applied as inline style.
|
|
69
|
+
* - `__rules` is converted into runtime CSS and injected into a <style> tag.
|
|
70
|
+
*
|
|
71
|
+
* This enables hover, pseudo-elements, descendant selectors, and vendor selectors.
|
|
72
|
+
*/
|
|
73
|
+
type SlotStyle = (React.CSSProperties | CSSVars) & {
|
|
74
|
+
__rules?: RuleMap;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A map of "slots" to styles.
|
|
78
|
+
*
|
|
79
|
+
* Example:
|
|
80
|
+
* ```ts
|
|
81
|
+
* {
|
|
82
|
+
* container: { ... },
|
|
83
|
+
* label: { ... },
|
|
84
|
+
* icon: { ... }
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
type StyleMap = Record<string, SlotStyle>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { CommonStyleProps as n, TextProps as r, StyleMap as t };
|
|
91
|
+
//# sourceMappingURL=useThemedStyles-DyrejrCM.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "softable-pixels-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "softable",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
19
|
-
"build": "rm -rf dist && tsdown"
|
|
19
|
+
"build": "pnpm generate:icons:node && rm -rf dist && tsdown",
|
|
20
|
+
"generate:icons": "chmod +x ./scripts/generate-icons.sh && ./scripts/generate-icons.sh",
|
|
21
|
+
"generate:icons:node": "node ./scripts/generate-icons.mjs"
|
|
20
22
|
},
|
|
21
23
|
"exports": {
|
|
22
24
|
".": {
|
|
@@ -31,24 +33,31 @@
|
|
|
31
33
|
"types": "./dist/tab-switch.d.ts",
|
|
32
34
|
"import": "./dist/tab-switch.js"
|
|
33
35
|
},
|
|
36
|
+
"./typography": {
|
|
37
|
+
"types": "./dist/typography.d.ts",
|
|
38
|
+
"import": "./dist/typography.js"
|
|
39
|
+
},
|
|
34
40
|
"./theme-context": {
|
|
35
41
|
"types": "./dist/theme-context.d.ts",
|
|
36
42
|
"import": "./dist/theme-context.js"
|
|
37
43
|
}
|
|
38
44
|
},
|
|
39
|
-
"
|
|
40
|
-
"react": "
|
|
41
|
-
"
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"radix-ui": "^1.4.3",
|
|
48
|
+
"react-dom": "^18.2.0",
|
|
42
49
|
"framer-motion": "^11.0.3"
|
|
43
50
|
},
|
|
44
51
|
"devDependencies": {
|
|
45
|
-
"tsdown": "^0.18.3",
|
|
46
|
-
"typescript": "^5.9.3",
|
|
47
52
|
"@biomejs/biome": "2.0.6",
|
|
53
|
+
"@svgr/cli": "^8.1.0",
|
|
54
|
+
"@svgr/webpack": "^8.1.0",
|
|
48
55
|
"@types/node": "^18.18.3",
|
|
49
56
|
"@types/react": "^19.2.7",
|
|
57
|
+
"@types/react-dom": "^19.2.3",
|
|
50
58
|
"framer-motion": "^11.0.3",
|
|
51
|
-
"
|
|
59
|
+
"tsdown": "^0.18.3",
|
|
60
|
+
"typescript": "^5.9.3"
|
|
52
61
|
},
|
|
53
62
|
"typesVersions": {
|
|
54
63
|
"*": {
|
|
@@ -58,6 +67,9 @@
|
|
|
58
67
|
"tab-switch": [
|
|
59
68
|
"dist/tab-switch/index.d.ts"
|
|
60
69
|
],
|
|
70
|
+
"typography": [
|
|
71
|
+
"dist/typography/index.d.ts"
|
|
72
|
+
],
|
|
61
73
|
"theme-context": [
|
|
62
74
|
"dist/theme-context/index.d.ts"
|
|
63
75
|
]
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { motion } from "framer-motion";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/hooks/useThemedStyles/utils/resolveCommonStyleProps.ts
|
|
6
|
-
function toCss(v) {
|
|
7
|
-
return typeof v === "number" ? `${v}px` : v;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Source of truth: common prop -> how it maps into CSSProperties.
|
|
11
|
-
* Add new common props ONLY here.
|
|
12
|
-
*/
|
|
13
|
-
const COMMON_MAP = {
|
|
14
|
-
m: (v, o) => {
|
|
15
|
-
o.margin = toCss(v);
|
|
16
|
-
},
|
|
17
|
-
mx: (v, o) => {
|
|
18
|
-
o.marginLeft = toCss(v);
|
|
19
|
-
o.marginRight = toCss(v);
|
|
20
|
-
},
|
|
21
|
-
my: (v, o) => {
|
|
22
|
-
o.marginTop = toCss(v);
|
|
23
|
-
o.marginBottom = toCss(v);
|
|
24
|
-
},
|
|
25
|
-
mt: (v, o) => {
|
|
26
|
-
o.marginTop = toCss(v);
|
|
27
|
-
},
|
|
28
|
-
mr: (v, o) => {
|
|
29
|
-
o.marginRight = toCss(v);
|
|
30
|
-
},
|
|
31
|
-
mb: (v, o) => {
|
|
32
|
-
o.marginBottom = toCss(v);
|
|
33
|
-
},
|
|
34
|
-
ml: (v, o) => {
|
|
35
|
-
o.marginLeft = toCss(v);
|
|
36
|
-
},
|
|
37
|
-
p: (v, o) => {
|
|
38
|
-
o.padding = toCss(v);
|
|
39
|
-
},
|
|
40
|
-
px: (v, o) => {
|
|
41
|
-
o.paddingLeft = toCss(v);
|
|
42
|
-
o.paddingRight = toCss(v);
|
|
43
|
-
},
|
|
44
|
-
py: (v, o) => {
|
|
45
|
-
o.paddingTop = toCss(v);
|
|
46
|
-
o.paddingBottom = toCss(v);
|
|
47
|
-
},
|
|
48
|
-
pt: (v, o) => {
|
|
49
|
-
o.paddingTop = toCss(v);
|
|
50
|
-
},
|
|
51
|
-
pr: (v, o) => {
|
|
52
|
-
o.paddingRight = toCss(v);
|
|
53
|
-
},
|
|
54
|
-
pb: (v, o) => {
|
|
55
|
-
o.paddingBottom = toCss(v);
|
|
56
|
-
},
|
|
57
|
-
pl: (v, o) => {
|
|
58
|
-
o.paddingLeft = toCss(v);
|
|
59
|
-
},
|
|
60
|
-
fontSize: (v, o) => {
|
|
61
|
-
o.fontSize = toCss(v);
|
|
62
|
-
},
|
|
63
|
-
fontWeight: (v, o) => {
|
|
64
|
-
o.fontWeight = v;
|
|
65
|
-
},
|
|
66
|
-
lineHeight: (v, o) => {
|
|
67
|
-
o.lineHeight = toCss(v);
|
|
68
|
-
},
|
|
69
|
-
textAlign: (v, o) => {
|
|
70
|
-
o.textAlign = v;
|
|
71
|
-
},
|
|
72
|
-
w: (v, o) => {
|
|
73
|
-
o.width = toCss(v);
|
|
74
|
-
},
|
|
75
|
-
h: (v, o) => {
|
|
76
|
-
o.height = toCss(v);
|
|
77
|
-
},
|
|
78
|
-
minW: (v, o) => {
|
|
79
|
-
o.minWidth = toCss(v);
|
|
80
|
-
},
|
|
81
|
-
maxW: (v, o) => {
|
|
82
|
-
o.maxWidth = toCss(v);
|
|
83
|
-
},
|
|
84
|
-
minH: (v, o) => {
|
|
85
|
-
o.minHeight = toCss(v);
|
|
86
|
-
},
|
|
87
|
-
maxH: (v, o) => {
|
|
88
|
-
o.maxHeight = toCss(v);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const COMMON_KEYS = Object.keys(COMMON_MAP);
|
|
92
|
-
function hasAnyCommonStyleProps(props) {
|
|
93
|
-
for (const k of COMMON_KEYS) if (props[k] != null) return true;
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
function resolveCommonStyleProps(props) {
|
|
97
|
-
const out = {};
|
|
98
|
-
for (const k of COMMON_KEYS) {
|
|
99
|
-
const value = props[k];
|
|
100
|
-
if (value != null) COMMON_MAP[k](value, out);
|
|
101
|
-
}
|
|
102
|
-
return out;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/hooks/useThemedStyles/utils/stripCommonProps.ts
|
|
107
|
-
const COMMON_KEY_SET = new Set(COMMON_KEYS);
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/hooks/useThemedStyles/index.ts
|
|
111
|
-
/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */
|
|
112
|
-
/**
|
|
113
|
-
* Shallow-merge style maps slot-by-slot.
|
|
114
|
-
* - warns when override contains unknown slots (dev UX)
|
|
115
|
-
* - merges each slot object shallowly
|
|
116
|
-
*/
|
|
117
|
-
function mergeStyleMaps(base, override) {
|
|
118
|
-
if (!override) return base;
|
|
119
|
-
const out = { ...base };
|
|
120
|
-
for (const key in override) {
|
|
121
|
-
if (!(key in base)) console.warn(`[useThemedStyles] Unknown style slot "${key}". Available slots: ${Object.keys(base).join(", ")}`);
|
|
122
|
-
out[key] = {
|
|
123
|
-
...base[key] ?? {},
|
|
124
|
-
...override[key] ?? {}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return out;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Applies common style props (if present) to a chosen slot of the styles map.
|
|
131
|
-
* Common props are resolved by `resolveCommonStyleProps`.
|
|
132
|
-
*/
|
|
133
|
-
function applyCommonsToStyles(styles, props, slotOverride) {
|
|
134
|
-
if (!hasAnyCommonStyleProps(props)) return styles;
|
|
135
|
-
const keys = Object.keys(styles);
|
|
136
|
-
if (keys.length === 0) return styles;
|
|
137
|
-
const slot = slotOverride ?? ("container" in styles ? "container" : keys[0]);
|
|
138
|
-
const common = resolveCommonStyleProps(props);
|
|
139
|
-
return {
|
|
140
|
-
...styles,
|
|
141
|
-
[slot]: {
|
|
142
|
-
...styles[slot] ?? {},
|
|
143
|
-
...common
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* useThemedStyles
|
|
149
|
-
*
|
|
150
|
-
* React-Native-like style factory hook for React web.
|
|
151
|
-
*
|
|
152
|
-
* Features:
|
|
153
|
-
* - Slot-based styles: factory returns { container, text, icon, ... }
|
|
154
|
-
* - Memoization control: `deps` > `pick(props)` > `[props]`
|
|
155
|
-
* - Optional per-slot overrides for customization
|
|
156
|
-
* - Optional auto-application of "common style props"
|
|
157
|
-
* - Supports CSS variables in inline styles
|
|
158
|
-
*
|
|
159
|
-
* Typical usage:
|
|
160
|
-
* @example
|
|
161
|
-
* const styles = useThemedStyles(props, createButtonStyles, {
|
|
162
|
-
* pick: pickButtonStyleProps,
|
|
163
|
-
* override: props.styles,
|
|
164
|
-
* applyCommonProps: true,
|
|
165
|
-
* });
|
|
166
|
-
*
|
|
167
|
-
* return (
|
|
168
|
-
* <button style={styles.container}>
|
|
169
|
-
* <span style={styles.text}>Hello</span>
|
|
170
|
-
* </button>
|
|
171
|
-
* );
|
|
172
|
-
*/
|
|
173
|
-
function useThemedStyles(props, factory, options) {
|
|
174
|
-
const base = useMemo(() => factory(props), [factory, ...options?.deps ?? (options?.pick ? options.pick(props) : [props])]);
|
|
175
|
-
const merged = useMemo(() => mergeStyleMaps(base, options?.override), [base, options?.override]);
|
|
176
|
-
return useMemo(() => {
|
|
177
|
-
if (!options?.applyCommonProps) return merged;
|
|
178
|
-
return applyCommonsToStyles(merged, props, options.commonSlot);
|
|
179
|
-
}, [
|
|
180
|
-
merged,
|
|
181
|
-
props,
|
|
182
|
-
options?.applyCommonProps,
|
|
183
|
-
options?.commonSlot
|
|
184
|
-
]);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/components/toolkit/TabSwitch/components/TabSwitchItem/styles.ts
|
|
189
|
-
function createTabSwitchItemStyles({ variant, disabled, selected, selectedColor, selectedLabelColor }) {
|
|
190
|
-
const labelColor = selected ? selectedLabelColor ?? "var(--px-text-primary)" : "var(--px-text-secondary)";
|
|
191
|
-
const accent = selectedColor ?? "var(--px-color-primary)";
|
|
192
|
-
return {
|
|
193
|
-
item: {
|
|
194
|
-
position: "relative",
|
|
195
|
-
display: "inline-flex",
|
|
196
|
-
alignItems: "center",
|
|
197
|
-
justifyContent: "center",
|
|
198
|
-
gap: 4,
|
|
199
|
-
background: "transparent",
|
|
200
|
-
border: 0,
|
|
201
|
-
padding: "8px 10px",
|
|
202
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
203
|
-
opacity: disabled ? .5 : 1,
|
|
204
|
-
userSelect: "none",
|
|
205
|
-
whiteSpace: "nowrap"
|
|
206
|
-
},
|
|
207
|
-
label: {
|
|
208
|
-
zIndex: 1,
|
|
209
|
-
fontSize: 14,
|
|
210
|
-
fontWeight: 700,
|
|
211
|
-
color: labelColor
|
|
212
|
-
},
|
|
213
|
-
selectedBg: variant === "default" ? {
|
|
214
|
-
position: "absolute",
|
|
215
|
-
inset: 0,
|
|
216
|
-
borderRadius: 6,
|
|
217
|
-
border: "1px solid var(--px-border-primary)",
|
|
218
|
-
background: selected ? accent : "transparent"
|
|
219
|
-
} : {
|
|
220
|
-
position: "absolute",
|
|
221
|
-
left: 0,
|
|
222
|
-
right: 0,
|
|
223
|
-
bottom: -2,
|
|
224
|
-
height: 2,
|
|
225
|
-
background: selected ? accent : "transparent"
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
//#endregion
|
|
231
|
-
//#region src/components/toolkit/TabSwitch/components/TabSwitchItem/index.tsx
|
|
232
|
-
function SwitchItem(props) {
|
|
233
|
-
const { option, disabled, selected, layoutId, onClick } = props;
|
|
234
|
-
const styles = useThemedStyles(props, createTabSwitchItemStyles, { pick: (p) => [
|
|
235
|
-
p.variant,
|
|
236
|
-
p.selectedColor,
|
|
237
|
-
p.selected
|
|
238
|
-
] });
|
|
239
|
-
const isDisabled = disabled || option.disabled;
|
|
240
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
241
|
-
type: "button",
|
|
242
|
-
style: styles.item,
|
|
243
|
-
tabIndex: isDisabled ? -1 : 0,
|
|
244
|
-
onClick: () => !isDisabled && onClick(option.value),
|
|
245
|
-
children: [
|
|
246
|
-
selected ? /* @__PURE__ */ jsx(motion.div, {
|
|
247
|
-
layoutId: layoutId || "pixel-tabswitch-selected",
|
|
248
|
-
style: styles.selectedBg
|
|
249
|
-
}) : null,
|
|
250
|
-
option.icon ? /* @__PURE__ */ jsx("span", {
|
|
251
|
-
style: { display: "inline-flex" },
|
|
252
|
-
children: option.icon
|
|
253
|
-
}) : null,
|
|
254
|
-
/* @__PURE__ */ jsx("span", {
|
|
255
|
-
style: styles.label,
|
|
256
|
-
children: option.label
|
|
257
|
-
})
|
|
258
|
-
]
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/components/toolkit/TabSwitch/styles.ts
|
|
264
|
-
function createTabSwitchStyles(props) {
|
|
265
|
-
const { fitContent } = props;
|
|
266
|
-
return { container: {
|
|
267
|
-
display: "flex",
|
|
268
|
-
flexDirection: "row",
|
|
269
|
-
alignItems: "center",
|
|
270
|
-
width: fitContent ? "fit-content" : "100%",
|
|
271
|
-
borderBottom: "1px solid var(--pixel-border, #e5e7eb)",
|
|
272
|
-
gap: 0
|
|
273
|
-
} };
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/components/toolkit/TabSwitch/index.tsx
|
|
278
|
-
function TabSwitch(props) {
|
|
279
|
-
const { options, disabled, layoutId, currentValue, variant = "default", onChange } = props;
|
|
280
|
-
return /* @__PURE__ */ jsx("div", {
|
|
281
|
-
style: useThemedStyles(props, createTabSwitchStyles, {
|
|
282
|
-
pick: (p) => [
|
|
283
|
-
p.fitContent,
|
|
284
|
-
p.selectedLabelColor,
|
|
285
|
-
p.variant
|
|
286
|
-
],
|
|
287
|
-
override: props.styles,
|
|
288
|
-
applyCommonProps: true
|
|
289
|
-
}).container,
|
|
290
|
-
children: options.map((opt) => /* @__PURE__ */ jsx(SwitchItem, {
|
|
291
|
-
option: opt,
|
|
292
|
-
variant,
|
|
293
|
-
layoutId,
|
|
294
|
-
disabled,
|
|
295
|
-
selected: currentValue === opt.value,
|
|
296
|
-
selectedColor: props.selectedLabelColor,
|
|
297
|
-
onClick: onChange
|
|
298
|
-
}, String(opt.value)))
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
//#endregion
|
|
303
|
-
export { TabSwitch as t };
|
|
304
|
-
//# sourceMappingURL=TabSwitch-D6OPAUjC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabSwitch-D6OPAUjC.js","names":["COMMON_MAP: Record<\n keyof CommonStyleProps,\n (value: any, out: React.CSSProperties) => void\n>","out: React.CSSProperties"],"sources":["../src/hooks/useThemedStyles/utils/resolveCommonStyleProps.ts","../src/hooks/useThemedStyles/utils/stripCommonProps.ts","../src/hooks/useThemedStyles/index.ts","../src/components/toolkit/TabSwitch/components/TabSwitchItem/styles.ts","../src/components/toolkit/TabSwitch/components/TabSwitchItem/index.tsx","../src/components/toolkit/TabSwitch/styles.ts","../src/components/toolkit/TabSwitch/index.tsx"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// Types\nimport type { CommonStyleProps } from '../types'\n\nfunction toCss(v: number | string | undefined) {\n return typeof v === 'number' ? `${v}px` : v\n}\n\n/**\n * Source of truth: common prop -> how it maps into CSSProperties.\n * Add new common props ONLY here.\n */\nconst COMMON_MAP: Record<\n keyof CommonStyleProps,\n (value: any, out: React.CSSProperties) => void\n> = {\n // margin\n m: (v, o) => {\n o.margin = toCss(v)\n },\n mx: (v, o) => {\n o.marginLeft = toCss(v)\n o.marginRight = toCss(v)\n },\n my: (v, o) => {\n o.marginTop = toCss(v)\n o.marginBottom = toCss(v)\n },\n mt: (v, o) => {\n o.marginTop = toCss(v)\n },\n mr: (v, o) => {\n o.marginRight = toCss(v)\n },\n mb: (v, o) => {\n o.marginBottom = toCss(v)\n },\n ml: (v, o) => {\n o.marginLeft = toCss(v)\n },\n\n // padding\n p: (v, o) => {\n o.padding = toCss(v)\n },\n px: (v, o) => {\n o.paddingLeft = toCss(v)\n o.paddingRight = toCss(v)\n },\n py: (v, o) => {\n o.paddingTop = toCss(v)\n o.paddingBottom = toCss(v)\n },\n pt: (v, o) => {\n o.paddingTop = toCss(v)\n },\n pr: (v, o) => {\n o.paddingRight = toCss(v)\n },\n pb: (v, o) => {\n o.paddingBottom = toCss(v)\n },\n pl: (v, o) => {\n o.paddingLeft = toCss(v)\n },\n\n // text\n fontSize: (v, o) => {\n o.fontSize = toCss(v)\n },\n fontWeight: (v, o) => {\n o.fontWeight = v\n },\n lineHeight: (v, o) => {\n o.lineHeight = toCss(v)\n },\n textAlign: (v, o) => {\n o.textAlign = v\n },\n\n // layout\n w: (v, o) => {\n o.width = toCss(v)\n },\n h: (v, o) => {\n o.height = toCss(v)\n },\n minW: (v, o) => {\n o.minWidth = toCss(v)\n },\n maxW: (v, o) => {\n o.maxWidth = toCss(v)\n },\n minH: (v, o) => {\n o.minHeight = toCss(v)\n },\n maxH: (v, o) => {\n o.maxHeight = toCss(v)\n }\n}\n\nexport const COMMON_KEYS = Object.keys(COMMON_MAP) as Array<\n keyof CommonStyleProps\n>\n\nexport function hasAnyCommonStyleProps(props: Partial<CommonStyleProps>) {\n for (const k of COMMON_KEYS) {\n if (props[k] != null) return true\n }\n return false\n}\n\nexport function resolveCommonStyleProps(\n props: Partial<CommonStyleProps>\n): React.CSSProperties {\n const out: React.CSSProperties = {}\n\n for (const k of COMMON_KEYS) {\n const value = props[k]\n if (value != null) COMMON_MAP[k](value, out)\n }\n\n return out\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\nimport type { CommonStyleProps } from '../types'\n\nimport { COMMON_KEYS } from './resolveCommonStyleProps'\n\nconst COMMON_KEY_SET = new Set<string>(COMMON_KEYS as readonly string[])\n\nexport function stripCommonProps<T extends object>(\n props: T\n): Omit<T, keyof CommonStyleProps> {\n const out: Record<string, unknown> = {}\n\n for (const key of Object.keys(props as any)) {\n if (!COMMON_KEY_SET.has(key)) {\n out[key] = (props as any)[key]\n }\n }\n\n return out as Omit<T, keyof CommonStyleProps>\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// External Libraries\nimport { useMemo } from 'react'\n\n// Utils\nimport { hasAnyCommonStyleProps, resolveCommonStyleProps } from './utils'\n\n// Types\nimport type { CommonStyleProps } from './types'\n\n/**\n * Allows CSS Variables to be used in inline styles:\n * { \"--btn-bg\": \"#111\" }\n */\nexport type CSSVars = React.CSSProperties &\n Record<`--${string}`, string | number>\n\n/** A style object can be regular CSSProperties or CSSProperties + CSS Variables */\nexport type StyleObject = React.CSSProperties | CSSVars\n\n/**\n * Map of \"slots\" to style objects.\n * Example slots: { container, text, icon }\n */\nexport type StyleMap = Record<string, StyleObject>\n\n/**\n * A style factory receives component props and returns a map of slot styles.\n */\nexport type StylesFactory<TProps, TStyles extends StyleMap> = (\n props: TProps\n) => TStyles\n\nexport type UseThemedStylesOptions<TProps, TStyles extends StyleMap> = {\n /**\n * Optional optimization.\n * When provided, the hook memoizes using the returned values instead of depending\n * on the entire `props` object reference.\n *\n * Recommended pattern: create a `pickXStyleProps` per component.\n *\n * @example\n * pick: (p) => [p.variant, p.size, p.disabled, p.color]\n */\n pick?: (props: TProps) => readonly unknown[]\n\n /**\n * Optional manual dependencies (highest priority).\n * If provided, `deps` is used instead of `pick` or `props`.\n *\n * Use this if you want full control over memoization.\n */\n deps?: readonly unknown[]\n\n /**\n * Optional per-slot override. Useful to allow consumers to tweak styles\n * without creating wrapper components or duplicating the style factory.\n *\n * The override is shallow-merged per slot:\n * mergedSlot = { ...baseSlot, ...overrideSlot }\n *\n * @example\n * override: { container: { padding: \"0 24px\" } }\n */\n override?: Partial<TStyles>\n\n /**\n * When true, reads \"common style props\" from `props` (spacing, layout, typography...)\n * and applies them on top of the chosen slot (default: \"container\").\n *\n * This enables a consistent set of props like `px`, `mt`, `fontSize`, `w`, etc.\n * across multiple components.\n *\n * NOTE: You'll typically also want to remove these props before spreading props\n * to DOM elements (to avoid invalid attributes). Use a `stripCommonProps`/`splitProps`\n * helper for that.\n */\n applyCommonProps?: boolean\n\n /**\n * Where to apply common style props.\n * Defaults to:\n * - \"container\" if that slot exists\n * - otherwise the first slot key returned by the style factory\n */\n commonSlot?: keyof TStyles\n}\n\n/**\n * Shallow-merge style maps slot-by-slot.\n * - warns when override contains unknown slots (dev UX)\n * - merges each slot object shallowly\n */\nfunction mergeStyleMaps<T extends StyleMap>(base: T, override?: Partial<T>): T {\n if (!override) return base\n const out = { ...base } as T\n\n for (const key in override) {\n if (!(key in base)) {\n console.warn(\n `[useThemedStyles] Unknown style slot \"${key}\". Available slots: ${Object.keys(base).join(', ')}`\n )\n }\n\n out[key] = { ...(base[key] ?? {}), ...(override[key] ?? {}) } as any\n }\n return out\n}\n\n/**\n * Applies common style props (if present) to a chosen slot of the styles map.\n * Common props are resolved by `resolveCommonStyleProps`.\n */\nfunction applyCommonsToStyles<TStyles extends StyleMap>(\n styles: TStyles,\n props: Partial<CommonStyleProps>,\n slotOverride?: keyof TStyles\n): TStyles {\n if (!hasAnyCommonStyleProps(props)) return styles\n\n const keys = Object.keys(styles)\n if (keys.length === 0) return styles\n\n const slot =\n slotOverride ??\n (('container' in styles ? 'container' : keys[0]) as keyof TStyles)\n\n const common = resolveCommonStyleProps(props)\n\n return {\n ...styles,\n [slot]: { ...(styles[slot] ?? {}), ...common }\n } as TStyles\n}\n\n/**\n * useThemedStyles\n *\n * React-Native-like style factory hook for React web.\n *\n * Features:\n * - Slot-based styles: factory returns { container, text, icon, ... }\n * - Memoization control: `deps` > `pick(props)` > `[props]`\n * - Optional per-slot overrides for customization\n * - Optional auto-application of \"common style props\"\n * - Supports CSS variables in inline styles\n *\n * Typical usage:\n * @example\n * const styles = useThemedStyles(props, createButtonStyles, {\n * pick: pickButtonStyleProps,\n * override: props.styles,\n * applyCommonProps: true,\n * });\n *\n * return (\n * <button style={styles.container}>\n * <span style={styles.text}>Hello</span>\n * </button>\n * );\n */\nexport function useThemedStyles<TProps, TStyles extends StyleMap>(\n props: TProps,\n factory: StylesFactory<TProps, TStyles>,\n options?: UseThemedStylesOptions<TProps, TStyles>\n): TStyles {\n // Memoization priority:\n // 1) deps (manual)\n // 2) pick(props) (recommended)\n // 3) props reference (default behavior)\n const memoKey =\n options?.deps ?? (options?.pick ? options.pick(props) : [props])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally controlled by the hook API (optional `deps`)\n const base = useMemo(() => factory(props), [factory, ...memoKey])\n\n // Apply per-slot overrides (if any)\n const merged = useMemo(\n () => mergeStyleMaps(base, options?.override),\n [base, options?.override]\n )\n\n // Optionally apply common style props on top of a slot\n const withCommons = useMemo(() => {\n if (!options?.applyCommonProps) return merged\n return applyCommonsToStyles(merged, props as any, options.commonSlot)\n }, [merged, props, options?.applyCommonProps, options?.commonSlot])\n\n return withCommons\n}\n","// External Libraries\nimport type { CSSProperties } from 'react'\n\ninterface Params {\n disabled?: boolean\n selected?: boolean\n selectedColor?: string\n variant: 'default' | 'underline'\n selectedLabelColor?: string\n}\n\nexport function createTabSwitchItemStyles({\n variant,\n disabled,\n selected,\n selectedColor,\n selectedLabelColor\n}: Params) {\n const labelColor = selected\n ? (selectedLabelColor ?? 'var(--px-text-primary)')\n : 'var(--px-text-secondary)'\n\n const accent = selectedColor ?? 'var(--px-color-primary)'\n\n return {\n item: {\n position: 'relative',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n background: 'transparent',\n border: 0,\n padding: '8px 10px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap'\n } as CSSProperties,\n\n label: {\n zIndex: 1,\n fontSize: 14,\n fontWeight: 700,\n color: labelColor\n } as CSSProperties,\n\n selectedBg:\n variant === 'default'\n ? ({\n position: 'absolute',\n inset: 0,\n borderRadius: 6,\n border: '1px solid var(--px-border-primary)',\n background: selected ? accent : 'transparent'\n } as CSSProperties)\n : ({\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: -2,\n height: 2,\n background: selected ? accent : 'transparent'\n } as CSSProperties)\n }\n}\n","// External Libraries\nimport { motion } from 'framer-motion'\n\n// Types\nimport type { SwitchOption } from '../../types'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\nimport { createTabSwitchItemStyles } from './styles'\n\ntype Props<T> = {\n option: SwitchOption<T>\n selected: boolean\n disabled?: boolean\n layoutId?: string\n selectedColor?: string\n variant: 'default' | 'underline'\n onClick: (value: T) => void\n}\n\nexport function SwitchItem<T>(props: Props<T>) {\n const { option, disabled, selected, layoutId, onClick } = props\n\n const styles = useThemedStyles(props, createTabSwitchItemStyles, {\n pick: p => [p.variant, p.selectedColor, p.selected]\n })\n\n const isDisabled = disabled || option.disabled\n\n return (\n <button\n type=\"button\"\n style={styles.item}\n tabIndex={isDisabled ? -1 : 0}\n onClick={() => !isDisabled && onClick(option.value)}\n >\n {selected ? (\n <motion.div\n layoutId={layoutId || 'pixel-tabswitch-selected'}\n style={styles.selectedBg}\n />\n ) : null}\n\n {option.icon ? (\n <span style={{ display: 'inline-flex' }}>{option.icon}</span>\n ) : null}\n\n <span style={styles.label}>{option.label}</span>\n </button>\n )\n}\n","// External Libraries\nimport type { CSSProperties } from 'react'\n\nimport type { TabSwitchProps } from './types'\n\nexport function createTabSwitchStyles<T>(props: TabSwitchProps<T>) {\n const { fitContent } = props\n\n return {\n container: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n width: fitContent ? 'fit-content' : '100%',\n borderBottom: '1px solid var(--pixel-border, #e5e7eb)',\n gap: 0\n } as CSSProperties\n }\n}\n","// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Components\nimport { SwitchItem } from './components/TabSwitchItem'\n\n// Types\nimport type { TabSwitchProps } from './types'\n\n// Styles\nimport { createTabSwitchStyles } from './styles'\n\nexport * from './types'\n\nexport function TabSwitch<T>(props: TabSwitchProps<T>) {\n const {\n options,\n disabled,\n layoutId,\n currentValue,\n variant = 'default',\n onChange\n } = props\n\n const styles = useThemedStyles(props, createTabSwitchStyles, {\n pick: p => [p.fitContent, p.selectedLabelColor, p.variant],\n override: props.styles,\n applyCommonProps: true\n })\n\n return (\n <div style={styles.container}>\n {options.map(opt => (\n <SwitchItem\n key={String(opt.value)}\n option={opt}\n variant={variant}\n layoutId={layoutId}\n disabled={disabled}\n selected={currentValue === opt.value}\n selectedColor={props.selectedLabelColor}\n onClick={onChange}\n />\n ))}\n </div>\n )\n}\n"],"mappings":";;;;;AAKA,SAAS,MAAM,GAAgC;AAC7C,QAAO,OAAO,MAAM,WAAW,GAAG,EAAE,MAAM;;;;;;AAO5C,MAAMA,aAGF;CAEF,IAAI,GAAG,MAAM;AACX,IAAE,SAAS,MAAM,EAAE;;CAErB,KAAK,GAAG,MAAM;AACZ,IAAE,aAAa,MAAM,EAAE;AACvB,IAAE,cAAc,MAAM,EAAE;;CAE1B,KAAK,GAAG,MAAM;AACZ,IAAE,YAAY,MAAM,EAAE;AACtB,IAAE,eAAe,MAAM,EAAE;;CAE3B,KAAK,GAAG,MAAM;AACZ,IAAE,YAAY,MAAM,EAAE;;CAExB,KAAK,GAAG,MAAM;AACZ,IAAE,cAAc,MAAM,EAAE;;CAE1B,KAAK,GAAG,MAAM;AACZ,IAAE,eAAe,MAAM,EAAE;;CAE3B,KAAK,GAAG,MAAM;AACZ,IAAE,aAAa,MAAM,EAAE;;CAIzB,IAAI,GAAG,MAAM;AACX,IAAE,UAAU,MAAM,EAAE;;CAEtB,KAAK,GAAG,MAAM;AACZ,IAAE,cAAc,MAAM,EAAE;AACxB,IAAE,eAAe,MAAM,EAAE;;CAE3B,KAAK,GAAG,MAAM;AACZ,IAAE,aAAa,MAAM,EAAE;AACvB,IAAE,gBAAgB,MAAM,EAAE;;CAE5B,KAAK,GAAG,MAAM;AACZ,IAAE,aAAa,MAAM,EAAE;;CAEzB,KAAK,GAAG,MAAM;AACZ,IAAE,eAAe,MAAM,EAAE;;CAE3B,KAAK,GAAG,MAAM;AAC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BAAC;GAEC,QAAQ;GACC;GACC;GACA;GACV,UAAU,iBAAiB,IAAI;GAC/B,eAAe,MAAM;GACrB,SAAS;KAPJ,OAAO,IAAI,MAAM,CAQtB,CACF;GACE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeContext-CRXby8a0.js","names":["result: any","out: any","defaultThemes: ThemeRegistry","ThemeProvider: React.FC<ThemeProviderProps>"],"sources":["../src/utils/functions/deepMerge.ts","../src/contexts/ThemeContext/constants.ts","../src/contexts/ThemeContext/utils/general.ts","../src/contexts/ThemeContext/utils/themeToCSSVars.ts","../src/contexts/ThemeContext/index.tsx"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T[P] extends object\n ? DeepPartial<T[P]>\n : T[P]\n}\n\nexport function deepMerge<T>(base: T, override?: DeepPartial<T>): T {\n if (override === undefined) return clone(base)\n\n if (!isPlainObject(base) || !isPlainObject(override)) {\n return clone(override as T)\n }\n\n const result: any = Array.isArray(base) ? [] : {}\n\n const baseKeys = Object.keys(base as any) as (keyof T)[]\n const overrideKeys = Object.keys(override as any) as (keyof T)[]\n\n const allKeys = Array.from(new Set([...baseKeys, ...overrideKeys]))\n\n for (const k of allKeys) {\n const baseVal = (base as any)[k]\n const overrideVal = (override as any)[k]\n\n if (overrideVal === undefined) {\n result[k] = clone(baseVal)\n continue\n }\n\n if (isPlainObject(baseVal) && isPlainObject(overrideVal)) {\n result[k] = deepMerge(baseVal, overrideVal)\n continue\n }\n\n result[k] = clone(overrideVal)\n }\n\n return result as T\n}\n\nfunction isPlainObject(x: any): x is Record<string, any> {\n return !!x && typeof x === 'object' && !Array.isArray(x)\n}\n\nfunction clone<T>(v: T): T {\n if (v === undefined || v === null) return v\n if (Array.isArray(v)) return v.map(item => clone(item)) as unknown as T\n if (isPlainObject(v)) {\n const out: any = {}\n for (const k of Object.keys(v)) out[k] = clone((v as any)[k])\n return out\n }\n return v\n}\n","// theme/defaultThemes.ts\nimport type { ThemeRegistry } from './types'\n\nexport const defaultThemes: ThemeRegistry = {\n light: {\n colors: {\n primary: '#0EB24C', // --color-brand-primary\n secondary: '#6C6C6C', // foreground-secondary\n success: '#0EB24C',\n warning: '#f59e0b',\n error: '#ef4444',\n info: '#06b6d4',\n\n background: '#FFFFFF', // --background\n surface: '#FBFBFB', // --background-secondary\n border: {\n primary: '#E8E8E9',\n secondary: '#E8E8E9'\n }, // --border-primary\n\n text: {\n primary: '#222222', // --foreground-primary\n secondary: '#6C6C6C', // --foreground-secondary\n disabled: '#A0A0A0',\n inverse: '#FFFFFF'\n }\n },\n\n spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32, '2xl': 48 },\n borderRadius: { none: 0, sm: 4, md: 6, lg: 8, full: 9999 },\n fontSize: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20, '2xl': 24 },\n fontWeight: { normal: 400, medium: 500, semibold: 600, bold: 700 },\n shadows: {\n sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',\n md: '0 4px 6px -1px rgba(0, 0, 0, 0.10)',\n lg: '0 10px 15px -3px rgba(0, 0, 0, 0.10)',\n xl: '0 20px 25px -5px rgba(0, 0, 0, 0.10)'\n }\n },\n\n dark: {\n colors: {\n primary: '#0EB24C', // brand se mantém (ou pode clarear depois)\n secondary: '#C7CFD8', // foreground-secondary dark\n success: '#0EB24C',\n warning: '#f59e0b',\n error: '#ef4444',\n info: '#06b6d4',\n\n background: '#090909', // --background dark\n surface: '#090909', // --background-secondary dark\n border: {\n primary: '#27282D',\n secondary: '#27282D'\n }, // --border-primary dark\n\n text: {\n primary: '#ECECEC', // --foreground-primary dark\n secondary: '#C7CFD8', // --foreground-secondary dark\n disabled: '#8B93A0',\n inverse: '#090909'\n }\n },\n\n spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32, '2xl': 48 },\n borderRadius: { none: 0, sm: 4, md: 6, lg: 8, full: 9999 },\n fontSize: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20, '2xl': 24 },\n fontWeight: { normal: 400, medium: 500, semibold: 600, bold: 700 },\n shadows: {\n sm: '0 1px 2px 0 rgba(0, 0, 0, 0.35)',\n md: '0 4px 6px -1px rgba(0, 0, 0, 0.45)',\n lg: '0 10px 15px -3px rgba(0, 0, 0, 0.50)',\n xl: '0 20px 25px -5px rgba(0, 0, 0, 0.55)'\n }\n }\n}\n","// Utils\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nimport { deepMerge } from '@utils/functions'\nimport { defaultThemes } from '../constants'\n\n// Types\nimport type { ThemeMode, ThemeRegistry, ThemeTokens } from '../types'\n\n/**\n * Theme Utilities\n * ===============\n * Small DOM utilities used by the ThemeProvider to:\n * - toggle dark mode class for Tailwind compatibility\n * - inject CSS variables (`--px-*`) into the document root\n * - read/watch the OS/browser theme preference (`prefers-color-scheme`)\n *\n * These helpers are:\n * - **client-safe** (guarded for SSR)\n * - **framework-agnostic** (only touch `documentElement`)\n * - **tiny** (no dependencies)\n */\n\n/**\n * CSSVarMap\n * ---------\n * A map of CSS custom properties to be applied on the document root.\n *\n * Notes:\n * - Keys must be valid CSS variable names (e.g. `\"--px-bg\"`, `\"--px-text-primary\"`).\n * - Values can be strings or numbers.\n * - If you store numbers (e.g. 16), you decide at consumption time whether it means px.\n *\n * You can keep it generic:\n * Record<`--${string}`, string | number>\n *\n * Or restrict to your library prefix:\n * Record<`--px-${string}`, string | number>\n */\nexport type CSSVarMap = Partial<Record<`--${string}`, string | number>>\n\n/**\n * applyThemeClass(themeName)\n * -------------------------\n * Applies the light/dark mode class to the `<html>` element.\n *\n * Tailwind’s dark mode (in the common \"class\" strategy) typically relies on a\n * `.dark` class. This function toggles ONLY the `dark` class:\n *\n * - themeName `\"dark\"` => adds `.dark`\n * - themeName `\"light\"` => removes `.dark`\n *\n * SSR:\n * - No-op on the server (when `document` is undefined).\n */\nexport function applyThemeClass(themeName: 'light' | 'dark') {\n if (typeof document === 'undefined') return\n const root = document.documentElement\n root.classList.toggle('dark', themeName === 'dark')\n}\n\n/**\n * applyCssVars(vars)\n * ------------------\n * Injects CSS variables into the document root (`<html>`).\n *\n * This is how the library exposes theme tokens as CSS variables.\n * Components can then use `var(--px-...)` in styles.\n *\n * Example:\n * ```ts\n * applyCssVars({ '--px-bg': '#fff', '--px-text-primary': '#111' })\n * ```\n *\n * Behavior:\n * - Ignores `null` / `undefined` values.\n * - Converts all values to string before applying.\n *\n * SSR:\n * - No-op on the server (when `document` is undefined).\n */\nexport function applyCssVars(vars: CSSVarMap) {\n if (typeof document === 'undefined') return\n const root = document.documentElement\n\n for (const [key, value] of Object.entries(vars)) {\n if (value == null) continue\n root.style.setProperty(key, String(value))\n }\n}\n\n/**\n * getSystemThemeName()\n * --------------------\n * Returns the current OS/browser color scheme preference.\n *\n * It reads `prefers-color-scheme: dark` using `window.matchMedia`.\n *\n * Returns:\n * - `\"dark\"` if the user prefers dark mode\n * - `\"light\"` otherwise\n *\n * SSR:\n * - Returns `\"light\"` on the server (safe default).\n */\nexport function getSystemThemeName(): 'light' | 'dark' {\n if (typeof window === 'undefined') return 'light'\n const prefersDark =\n window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false\n return prefersDark ? 'dark' : 'light'\n}\n\n/**\n * watchSystemTheme(onChange)\n * --------------------------\n * Subscribes to changes in OS/browser theme preference.\n *\n * Use this when your selected mode is `\"system\"` so the app immediately reacts\n * when the user changes their OS theme.\n *\n * - Calls `onChange('light' | 'dark')` whenever the preference changes.\n * - Returns an `unsubscribe()` function.\n *\n * Implementation details:\n * - Uses `matchMedia('(prefers-color-scheme: dark)')`.\n * - Supports both modern `addEventListener('change', ...)` and legacy Safari\n * `addListener(...)` APIs.\n *\n * SSR:\n * - Returns a no-op unsubscribe function on the server.\n */\nexport function watchSystemTheme(onChange: (name: 'light' | 'dark') => void) {\n if (typeof window === 'undefined') return () => {}\n\n const mq = window.matchMedia('(prefers-color-scheme: dark)')\n\n const handler = () => onChange(mq.matches ? 'dark' : 'light')\n\n // Optional: sync immediately on subscribe\n handler()\n\n // Modern browsers\n if (mq.addEventListener) {\n mq.addEventListener('change', handler)\n return () => mq.removeEventListener('change', handler)\n }\n\n // Legacy Safari\n mq.addListener(handler as any)\n return () => mq.removeListener(handler as any)\n}\n\n/**\n * Resolves an effective theme name from a mode.\n */\nexport function resolveName(mode: ThemeMode): string {\n if (mode !== 'system') return mode\n return getSystemThemeName()\n}\n\n/**\n * Builds a registry of user theme patches.\n */\nexport function buildRegistry(\n userThemes?: Partial<ThemeRegistry>\n): ThemeRegistry {\n return {\n light: {},\n dark: {},\n ...(userThemes ?? {})\n } as ThemeRegistry\n}\n\n/**\n * Builds the final resolved theme tokens.\n */\nexport function buildTheme(\n registry: ThemeRegistry,\n resolvedName: string,\n override?: Partial<ThemeTokens>\n): ThemeTokens {\n const base: ThemeTokens =\n resolvedName === 'dark'\n ? (defaultThemes.dark as ThemeTokens)\n : (defaultThemes.light as ThemeTokens)\n\n const selectedPatch = (registry[resolvedName] ?? registry.light) as any\n\n const merged = deepMerge(base, selectedPatch)\n return deepMerge(merged, override)\n}\n\nexport function isThemeMode(value: unknown): value is ThemeMode {\n return typeof value === 'string' && value.length > 0\n}\n\nexport function getLocalStorageSafe(): Storage | null {\n if (typeof window === 'undefined') return null\n try {\n return window.localStorage\n } catch {\n return null\n }\n}\n","// Types\nimport type { CSSVarMap } from './general'\nimport type { ThemeTokens } from '../types'\n\n/**\n * themeToCssVars(theme)\n * ---------------------\n * Converts a resolved `ThemeTokens` object into a CSS variable map (`CSSVarMap`).\n *\n * The ThemeProvider uses this function to inject `--px-*` variables into the\n * document root (`<html>`). Components can then rely on stable CSS variables,\n * making them framework-agnostic and compatible with Tailwind (via `.dark`).\n *\n * Why CSS variables?\n * - They are fast (native to the browser)\n * - They work across any styling strategy (inline styles, CSS modules, Tailwind, etc.)\n * - They enable dynamic theme switching without rerendering every component\n *\n * Requirements / Assumptions:\n * - The input `theme` must be **fully resolved** (i.e. complete `ThemeTokens`).\n * The ThemeProvider is responsible for merging partial theme patches on top\n * of a complete base theme (light/dark defaults).\n *\n * Variable naming:\n * - All variables are prefixed with `--px-` to avoid collisions.\n * - Tokens are grouped by category (colors, surfaces, borders, text, spacing, radius, typography, shadows).\n *\n * Notes:\n * - Spacing/radius/fontSize tokens are stored as numbers (e.g. `16`), which is valid\n * for CSS variables. When consuming them, you can:\n * - append `px` in JS (`${var}px`), or\n * - store them as strings here (e.g. `\"16px\"`) if you prefer.\n *\n * Example usage (component styles):\n * ```ts\n * const styles = {\n * background: 'var(--px-bg)',\n * color: 'var(--px-text-primary)',\n * borderColor: 'var(--px-border-primary)',\n * }\n * ```\n *\n * Example usage (Tailwind config / CSS):\n * ```css\n * .card {\n * background: var(--px-surface);\n * color: var(--px-text-primary);\n * border: 1px solid var(--px-border-primary);\n * }\n * ```\n */\nexport function themeToCssVars(theme: ThemeTokens): CSSVarMap {\n return {\n /**\n * Colors (semantic)\n * -----------------\n * Brand + intent colors. Prefer using these instead of raw palette values.\n */\n '--px-color-primary': theme.colors.primary,\n '--px-color-secondary': theme.colors.secondary,\n '--px-color-success': theme.colors.success,\n '--px-color-warning': theme.colors.warning,\n '--px-color-error': theme.colors.error,\n '--px-color-info': theme.colors.info,\n\n /**\n * Surfaces\n * --------\n * Neutral surfaces for layouts and elevated containers.\n */\n '--px-bg': theme.colors.background,\n '--px-surface': theme.colors.surface,\n\n /**\n * Borders\n * -------\n * Divider and outline colors.\n */\n '--px-border-primary': theme.colors.border.primary,\n '--px-border-secondary': theme.colors.border.secondary,\n\n /**\n * Text\n * ----\n * Text colors for different emphasis levels.\n */\n '--px-text-primary': theme.colors.text.primary,\n '--px-text-secondary': theme.colors.text.secondary,\n '--px-text-disabled': theme.colors.text.disabled,\n '--px-text-inverse': theme.colors.text.inverse,\n\n /**\n * Spacing scale\n * -------------\n * Numeric spacing tokens (commonly used as px in the component factories).\n */\n '--px-space-xs': theme.spacing.xs,\n '--px-space-sm': theme.spacing.sm,\n '--px-space-md': theme.spacing.md,\n '--px-space-lg': theme.spacing.lg,\n '--px-space-xl': theme.spacing.xl,\n '--px-space-2xl': theme.spacing['2xl'],\n\n /**\n * Border radius scale\n * -------------------\n * Numeric radius tokens (commonly used as px).\n */\n '--px-radius-none': theme.borderRadius.none,\n '--px-radius-sm': theme.borderRadius.sm,\n '--px-radius-md': theme.borderRadius.md,\n '--px-radius-lg': theme.borderRadius.lg,\n '--px-radius-full': theme.borderRadius.full,\n\n /**\n * Typography scale\n * ----------------\n * Font sizes and font weights.\n */\n '--px-fs-xs': theme.fontSize.xs,\n '--px-fs-sm': theme.fontSize.sm,\n '--px-fs-md': theme.fontSize.md,\n '--px-fs-lg': theme.fontSize.lg,\n '--px-fs-xl': theme.fontSize.xl,\n '--px-fs-2xl': theme.fontSize['2xl'],\n\n '--px-fw-normal': theme.fontWeight.normal,\n '--px-fw-medium': theme.fontWeight.medium,\n '--px-fw-semibold': theme.fontWeight.semibold,\n '--px-fw-bold': theme.fontWeight.bold,\n\n /**\n * Shadows\n * -------\n * CSS shadow strings for elevation.\n */\n '--px-shadow-sm': theme.shadows.sm,\n '--px-shadow-md': theme.shadows.md,\n '--px-shadow-lg': theme.shadows.lg,\n '--px-shadow-xl': theme.shadows.xl\n }\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// External Libraries\nimport { useMemo, useState, useEffect, useContext, createContext } from 'react'\n\n// Utils\nimport {\n buildTheme,\n isThemeMode,\n resolveName,\n applyCssVars,\n buildRegistry,\n themeToCssVars,\n applyThemeClass,\n watchSystemTheme,\n getLocalStorageSafe\n} from './utils'\n\n// Types\nimport type { ThemeMode, ThemeContextData, ThemeProviderProps } from './types'\n\nexport * from './types'\n\n/**\n * Theme Context\n * -------------\n * Internal context used by `ThemeProvider` and consumed by `useTheme()`.\n *\n * The value is always non-null inside a `<ThemeProvider />`.\n */\nconst ThemeContext = createContext<ThemeContextData | null>(null)\n\n/**\n * ThemeProvider\n * -------------\n * Provides theme state + resolved theme tokens to your app.\n */\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n themes,\n children,\n override,\n persistence,\n persist = false,\n defaultMode = 'system',\n storageKey = 'px-theme'\n}) => {\n /**\n * Registry of user patches (stable unless `themes` changes).\n */\n const registry = useMemo(() => buildRegistry(themes), [themes])\n\n /**\n * Selected mode (with optional persistence).\n *\n * Priority:\n * 1) `persistence` adapter (advanced)\n * 2) `persist === true` + localStorage (quick)\n * 3) `defaultMode`\n */\n const [mode, setMode] = useState<ThemeMode>(() => {\n // 1) advanced adapter\n if (persistence) {\n try {\n const saved = persistence.get()\n return (saved ?? defaultMode) as ThemeMode\n } catch {\n return defaultMode\n }\n }\n\n // 2) quick localStorage mode\n if (persist) {\n const ls = getLocalStorageSafe()\n if (!ls) return defaultMode\n const raw = ls.getItem(storageKey)\n return isThemeMode(raw) ? raw : defaultMode\n }\n\n // 3) fallback\n return defaultMode\n })\n\n /**\n * Loading flag (mainly useful if consumers want to wait for first mount).\n */\n const [isLoading, setLoading] = useState(true)\n\n useEffect(() => {\n setLoading(false)\n }, [])\n\n /**\n * Resolved name is the actual currently applied theme name.\n * If `mode === \"system\"`, it becomes \"light\" or \"dark\".\n */\n const resolvedName = useMemo(() => {\n if (typeof window === 'undefined') return mode === 'system' ? 'light' : mode\n return resolveName(mode)\n }, [mode])\n\n /**\n * Build final resolved theme tokens (always complete).\n */\n const theme = useMemo(\n () => buildTheme(registry, resolvedName, override),\n [registry, resolvedName, override]\n )\n\n /**\n * Keep in sync with OS when mode === \"system\".\n */\n useEffect(() => {\n if (typeof window === 'undefined') return\n if (mode !== 'system') return\n\n return watchSystemTheme(() => {\n setMode('system')\n })\n }, [mode])\n\n /**\n * Apply theme effects:\n * - toggles `.dark` class on <html> (Tailwind)\n * - injects --px-* variables on <html>\n */\n useEffect(() => {\n if (typeof window === 'undefined') return\n applyThemeClass(resolvedName === 'dark' ? 'dark' : 'light')\n applyCssVars(themeToCssVars(theme))\n }, [resolvedName, theme])\n\n /**\n * Persist mode changes (optional).\n *\n * We persist the selected `mode` (including \"system\"), not the resolvedName.\n *\n * Priority:\n * - If `persistence` exists, use it.\n * - Else if `persist === true`, use localStorage.\n */\n useEffect(() => {\n // advanced adapter\n if (persistence) {\n try {\n persistence.set(mode)\n } catch {\n // ignore\n }\n return\n }\n\n // quick localStorage mode\n if (!persist) return\n const ls = getLocalStorageSafe()\n if (!ls) return\n\n try {\n ls.setItem(storageKey, mode)\n } catch {\n // ignore\n }\n }, [mode, persist, storageKey, persistence])\n\n /**\n * Sets the selected theme mode.\n */\n function setTheme(next: ThemeMode) {\n setMode(next)\n }\n\n /**\n * Toggles between two theme names (defaults to \"light\" and \"dark\").\n */\n function toggleTheme(a: string = 'light', b: string = 'dark') {\n setMode(resolvedName === a ? b : a)\n }\n\n return (\n <ThemeContext.Provider\n value={{ mode, resolvedName, theme, isLoading, setTheme, toggleTheme }}\n >\n {children}\n </ThemeContext.Provider>\n )\n}\n\n/**\n * useTheme()\n *\n * Returns the current theme context.\n *\n * @throws If called outside of `<ThemeProvider />`.\n */\nexport function useTheme(): ThemeContextData {\n const ctx = useContext(ThemeContext)\n if (!ctx) throw new Error('useTheme must be used within a ThemeProvider')\n return ctx\n}\n"],"mappings":";;;;AASA,SAAgB,UAAa,MAAS,UAA8B;AAClE,KAAI,aAAa,OAAW,QAAO,MAAM,KAAK;AAE9C,KAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,SAAS,CAClD,QAAO,MAAM,SAAc;CAG7B,MAAMA,SAAc,MAAM,QAAQ,KAAK,GAAG,EAAE,GAAG,EAAE;CAEjD,MAAM,WAAW,OAAO,KAAK,KAAY;CACzC,MAAM,eAAe,OAAO,KAAK,SAAgB;CAEjD,MAAM,UAAU,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,aAAa,CAAC,CAAC;AAEnE,MAAK,MAAM,KAAK,SAAS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