xyne-components 0.1.0 → 0.1.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/Badge/index.cjs +9 -0
- package/dist/Badge/index.cjs.map +1 -0
- package/dist/Badge/index.d.cts +24 -0
- package/dist/Badge/index.d.ts +24 -0
- package/dist/Badge/index.js +9 -0
- package/dist/Badge/index.js.map +1 -0
- package/dist/Directory/index.cjs +9 -0
- package/dist/Directory/index.cjs.map +1 -0
- package/dist/Directory/index.d.cts +34 -0
- package/dist/Directory/index.d.ts +34 -0
- package/dist/Directory/index.js +9 -0
- package/dist/Directory/index.js.map +1 -0
- package/dist/Label/index.cjs +9 -0
- package/dist/Label/index.cjs.map +1 -0
- package/dist/Label/index.d.cts +28 -0
- package/dist/Label/index.d.ts +28 -0
- package/dist/Label/index.js +9 -0
- package/dist/Label/index.js.map +1 -0
- package/dist/ListItem/index.cjs +9 -0
- package/dist/ListItem/index.cjs.map +1 -0
- package/dist/ListItem/index.d.cts +34 -0
- package/dist/ListItem/index.d.ts +34 -0
- package/dist/ListItem/index.js +9 -0
- package/dist/ListItem/index.js.map +1 -0
- package/dist/chunk-2452BBK4.js +219 -0
- package/dist/chunk-2452BBK4.js.map +1 -0
- package/dist/chunk-2JYR6C3L.cjs +219 -0
- package/dist/chunk-2JYR6C3L.cjs.map +1 -0
- package/dist/chunk-54N4ZTTL.js +173 -0
- package/dist/chunk-54N4ZTTL.js.map +1 -0
- package/dist/chunk-73U3B3WX.cjs +23 -0
- package/dist/chunk-73U3B3WX.cjs.map +1 -0
- package/dist/chunk-CNEANQ6B.js +23 -0
- package/dist/chunk-CNEANQ6B.js.map +1 -0
- package/dist/chunk-EJ4BXCSG.js +55 -0
- package/dist/chunk-EJ4BXCSG.js.map +1 -0
- package/dist/chunk-HAG5EYQ5.cjs +87 -0
- package/dist/chunk-HAG5EYQ5.cjs.map +1 -0
- package/dist/chunk-JKYZDOSJ.cjs +55 -0
- package/dist/chunk-JKYZDOSJ.cjs.map +1 -0
- package/dist/chunk-RVNFEWBE.js +87 -0
- package/dist/chunk-RVNFEWBE.js.map +1 -0
- package/dist/chunk-RXHOBQUJ.cjs +65 -0
- package/dist/chunk-RXHOBQUJ.cjs.map +1 -0
- package/dist/chunk-SEFQF2DQ.js +91 -0
- package/dist/chunk-SEFQF2DQ.js.map +1 -0
- package/dist/chunk-SRXGVBJ5.cjs +133 -0
- package/dist/chunk-SRXGVBJ5.cjs.map +1 -0
- package/dist/chunk-WUV742E6.cjs +173 -0
- package/dist/chunk-WUV742E6.cjs.map +1 -0
- package/dist/chunk-XF7A3MNW.cjs +91 -0
- package/dist/chunk-XF7A3MNW.cjs.map +1 -0
- package/dist/chunk-ZJ3XTUYJ.js +65 -0
- package/dist/chunk-ZJ3XTUYJ.js.map +1 -0
- package/dist/chunk-ZS6WGFYT.js +133 -0
- package/dist/chunk-ZS6WGFYT.js.map +1 -0
- package/dist/colorScheme.types-CqDRrNL0.d.cts +54 -0
- package/dist/colorScheme.types-CqDRrNL0.d.ts +54 -0
- package/dist/hooks/index.cjs +11 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +20 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +26 -560
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -176
- package/dist/index.d.ts +10 -176
- package/dist/index.js +29 -517
- package/dist/index.js.map +1 -1
- package/dist/polymorphic-BpYm1AeE.d.cts +115 -0
- package/dist/polymorphic-BpYm1AeE.d.ts +115 -0
- package/dist/styles/index.css +23 -8
- package/dist/theme/index.cjs +16 -0
- package/dist/theme/index.cjs.map +1 -0
- package/dist/theme/index.d.cts +56 -0
- package/dist/theme/index.d.ts +56 -0
- package/dist/theme/index.js +16 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/utils/index.cjs +8 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +7 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +39 -3
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWUV742E6cjs = require('./chunk-WUV742E6.cjs');
|
|
7
|
+
|
|
8
|
+
// src/theme/createTheme.ts
|
|
9
|
+
function isPlainObject(value) {
|
|
10
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
function deepMerge(target, source) {
|
|
13
|
+
const result = { ...target };
|
|
14
|
+
for (const key of Object.keys(source)) {
|
|
15
|
+
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
16
|
+
result[key] = deepMerge(
|
|
17
|
+
target[key],
|
|
18
|
+
source[key]
|
|
19
|
+
);
|
|
20
|
+
} else {
|
|
21
|
+
result[key] = source[key];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
function createTheme(override) {
|
|
27
|
+
return deepMerge(
|
|
28
|
+
_chunkWUV742E6cjs.DEFAULT_THEME,
|
|
29
|
+
override
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/theme/ThemeProvider.tsx
|
|
34
|
+
var _react = require('react');
|
|
35
|
+
|
|
36
|
+
// src/theme/ColorSchemeProvider.tsx
|
|
37
|
+
|
|
38
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
39
|
+
var STORAGE_KEY = "xc-color-scheme";
|
|
40
|
+
function getSystemPreference() {
|
|
41
|
+
if (typeof window === "undefined") return "light";
|
|
42
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
43
|
+
}
|
|
44
|
+
function applyToDOM(resolved, getRootElement) {
|
|
45
|
+
if (typeof document === "undefined") return;
|
|
46
|
+
const root = getRootElement ? getRootElement() : document.documentElement;
|
|
47
|
+
if (root) root.setAttribute("data-theme", resolved);
|
|
48
|
+
}
|
|
49
|
+
function ColorSchemeProvider({
|
|
50
|
+
defaultColorScheme = "light",
|
|
51
|
+
forceColorScheme,
|
|
52
|
+
storageKey = STORAGE_KEY,
|
|
53
|
+
getRootElement,
|
|
54
|
+
children
|
|
55
|
+
}) {
|
|
56
|
+
const [colorScheme, setColorSchemeRaw] = _react.useState.call(void 0, () => {
|
|
57
|
+
if (forceColorScheme) return forceColorScheme;
|
|
58
|
+
try {
|
|
59
|
+
if (typeof window !== "undefined") {
|
|
60
|
+
const v = window.localStorage.getItem(storageKey);
|
|
61
|
+
if (v === "light" || v === "dark" || v === "auto") return v;
|
|
62
|
+
}
|
|
63
|
+
} catch (e2) {
|
|
64
|
+
}
|
|
65
|
+
return defaultColorScheme;
|
|
66
|
+
});
|
|
67
|
+
const [systemPreference, setSystemPreference] = _react.useState.call(void 0, getSystemPreference);
|
|
68
|
+
const resolvedColorScheme = _nullishCoalesce(forceColorScheme, () => ( (colorScheme === "auto" ? systemPreference : colorScheme)));
|
|
69
|
+
_react.useEffect.call(void 0, () => {
|
|
70
|
+
if (typeof window === "undefined") return;
|
|
71
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
72
|
+
const handler = (e) => {
|
|
73
|
+
setSystemPreference(e.matches ? "dark" : "light");
|
|
74
|
+
};
|
|
75
|
+
mq.addEventListener("change", handler);
|
|
76
|
+
return () => mq.removeEventListener("change", handler);
|
|
77
|
+
}, []);
|
|
78
|
+
_react.useEffect.call(void 0, () => {
|
|
79
|
+
if (typeof window === "undefined") return;
|
|
80
|
+
const handler = (e) => {
|
|
81
|
+
if (e.key !== storageKey) return;
|
|
82
|
+
const val = e.newValue;
|
|
83
|
+
if (val === "light" || val === "dark" || val === "auto") {
|
|
84
|
+
setColorSchemeRaw(val);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
window.addEventListener("storage", handler);
|
|
88
|
+
return () => window.removeEventListener("storage", handler);
|
|
89
|
+
}, [storageKey]);
|
|
90
|
+
_react.useEffect.call(void 0, () => {
|
|
91
|
+
applyToDOM(resolvedColorScheme, getRootElement);
|
|
92
|
+
}, [resolvedColorScheme, getRootElement]);
|
|
93
|
+
const setColorScheme = _react.useCallback.call(void 0, (scheme) => {
|
|
94
|
+
if (forceColorScheme) return;
|
|
95
|
+
setColorSchemeRaw(scheme);
|
|
96
|
+
try {
|
|
97
|
+
window.localStorage.setItem(storageKey, scheme);
|
|
98
|
+
} catch (e3) {
|
|
99
|
+
}
|
|
100
|
+
}, [forceColorScheme, storageKey]);
|
|
101
|
+
const toggleColorScheme = _react.useCallback.call(void 0, () => {
|
|
102
|
+
setColorScheme(resolvedColorScheme === "dark" ? "light" : "dark");
|
|
103
|
+
}, [resolvedColorScheme, setColorScheme]);
|
|
104
|
+
const value = _react.useMemo.call(void 0, () => ({
|
|
105
|
+
colorScheme,
|
|
106
|
+
resolvedColorScheme,
|
|
107
|
+
setColorScheme,
|
|
108
|
+
toggleColorScheme
|
|
109
|
+
}), [colorScheme, resolvedColorScheme, setColorScheme, toggleColorScheme]);
|
|
110
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWUV742E6cjs.ColorSchemeContext.Provider, { value, children });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/theme/ThemeProvider.tsx
|
|
114
|
+
|
|
115
|
+
function camelToKebab(str) {
|
|
116
|
+
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
117
|
+
}
|
|
118
|
+
function themeOverrideToCssVars(override) {
|
|
119
|
+
const vars = {};
|
|
120
|
+
if (override.colors) {
|
|
121
|
+
for (const [scale, shades] of Object.entries(override.colors)) {
|
|
122
|
+
for (const [shade, value] of Object.entries(shades)) {
|
|
123
|
+
vars[`--xc-color-${camelToKebab(scale)}-${shade}`] = value;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (override.text) {
|
|
128
|
+
for (const [key, value] of Object.entries(override.text)) {
|
|
129
|
+
vars[`--xc-color-text-${camelToKebab(key)}`] = value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (override.bg) {
|
|
133
|
+
for (const [key, value] of Object.entries(override.bg)) {
|
|
134
|
+
vars[`--xc-color-bg-${camelToKebab(key)}`] = value;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (override.border) {
|
|
138
|
+
for (const [key, value] of Object.entries(override.border)) {
|
|
139
|
+
vars[`--xc-color-border-${camelToKebab(key)}`] = value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (override.shadow) {
|
|
143
|
+
for (const [key, value] of Object.entries(override.shadow)) {
|
|
144
|
+
vars[`--xc-shadow-${camelToKebab(key)}`] = value;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (override.radius) {
|
|
148
|
+
for (const [key, value] of Object.entries(override.radius)) {
|
|
149
|
+
vars[`--xc-radius-${camelToKebab(key)}`] = value;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (override.spacing) {
|
|
153
|
+
for (const [key, value] of Object.entries(override.spacing)) {
|
|
154
|
+
vars[`--xc-space-${key}`] = value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (override.fontFamily) {
|
|
158
|
+
vars["--xc-font-family"] = override.fontFamily;
|
|
159
|
+
}
|
|
160
|
+
if (override.fontWeight) {
|
|
161
|
+
for (const [key, value] of Object.entries(override.fontWeight)) {
|
|
162
|
+
vars[`--xc-font-weight-${camelToKebab(key)}`] = value;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (override.fontSize) {
|
|
166
|
+
for (const [key, value] of Object.entries(override.fontSize)) {
|
|
167
|
+
vars[`--xc-font-size-${key}`] = value;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (override.lineHeight) {
|
|
171
|
+
for (const [key, value] of Object.entries(override.lineHeight)) {
|
|
172
|
+
vars[`--xc-line-height-${key}`] = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return vars;
|
|
176
|
+
}
|
|
177
|
+
function ThemeProvider({
|
|
178
|
+
theme: themeOverride = {},
|
|
179
|
+
cssVariablesSelector = ":root",
|
|
180
|
+
defaultColorScheme = "light",
|
|
181
|
+
forceColorScheme,
|
|
182
|
+
colorSchemeStorageKey,
|
|
183
|
+
getRootElement,
|
|
184
|
+
children
|
|
185
|
+
}) {
|
|
186
|
+
const resolvedTheme = _react.useMemo.call(void 0,
|
|
187
|
+
() => createTheme(themeOverride),
|
|
188
|
+
[themeOverride]
|
|
189
|
+
);
|
|
190
|
+
const cssText = _react.useMemo.call(void 0, () => {
|
|
191
|
+
const vars = themeOverrideToCssVars(themeOverride);
|
|
192
|
+
const entries = Object.entries(vars);
|
|
193
|
+
if (entries.length === 0) return "";
|
|
194
|
+
const declarations = entries.map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
195
|
+
return `${cssVariablesSelector} {
|
|
196
|
+
${declarations}
|
|
197
|
+
}`;
|
|
198
|
+
}, [themeOverride, cssVariablesSelector]);
|
|
199
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
200
|
+
ColorSchemeProvider,
|
|
201
|
+
{
|
|
202
|
+
defaultColorScheme,
|
|
203
|
+
forceColorScheme,
|
|
204
|
+
storageKey: colorSchemeStorageKey,
|
|
205
|
+
getRootElement,
|
|
206
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkWUV742E6cjs.ThemeContext.Provider, { value: resolvedTheme, children: [
|
|
207
|
+
cssText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { "data-xc-theme": "", children: cssText }),
|
|
208
|
+
children
|
|
209
|
+
] })
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
exports.createTheme = createTheme; exports.ColorSchemeProvider = ColorSchemeProvider; exports.ThemeProvider = ThemeProvider;
|
|
219
|
+
//# sourceMappingURL=chunk-2JYR6C3L.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/harshpreet.singh/Desktop/Juspay/xyne-spaces/components/dist/chunk-2JYR6C3L.cjs","../src/theme/createTheme.ts","../src/theme/ThemeProvider.tsx","../src/theme/ColorSchemeProvider.tsx"],"names":["useMemo","jsx"],"mappings":"AAAA,yLAAY;AACZ;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACJA,SAAS,aAAA,CAAc,KAAA,EAAkD;AACvE,EAAA,OAAO,MAAA,IAAU,KAAA,GAAQ,OAAO,MAAA,IAAU,SAAA,GAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAC5E;AAEA,SAAS,SAAA,CACP,MAAA,EACA,MAAA,EACyB;AACzB,EAAA,MAAM,OAAA,EAAkC,EAAE,GAAG,OAAO,CAAA;AACpD,EAAA,IAAA,CAAA,MAAW,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,MAAM,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,aAAA,CAAc,MAAA,CAAO,GAAG,CAAC,EAAA,GAAK,aAAA,CAAc,MAAA,CAAO,GAAG,CAAC,CAAA,EAAG;AAC5D,MAAA,MAAA,CAAO,GAAG,EAAA,EAAI,SAAA;AAAA,QACZ,MAAA,CAAO,GAAG,CAAA;AAAA,QACV,MAAA,CAAO,GAAG;AAAA,MACZ,CAAA;AAAA,IACF,EAAA,KAAO;AACL,MAAA,MAAA,CAAO,GAAG,EAAA,EAAI,MAAA,CAAO,GAAG,CAAA;AAAA,IAC1B;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAGO,SAA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,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;AFwD0D;AACA;AACA;AACA;AACA;AACA","file":"/Users/harshpreet.singh/Desktop/Juspay/xyne-spaces/components/dist/chunk-2JYR6C3L.cjs","sourcesContent":[null,"import type { XyneTheme, XyneThemeOverride } from './types'\nimport { DEFAULT_THEME } from './defaultTheme'\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nfunction deepMerge(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = { ...target }\n for (const key of Object.keys(source)) {\n if (isPlainObject(source[key]) && isPlainObject(target[key])) {\n result[key] = deepMerge(\n target[key] as Record<string, unknown>,\n source[key] as Record<string, unknown>,\n )\n } else {\n result[key] = source[key]\n }\n }\n return result\n}\n\n/** Deep-merge a partial override with DEFAULT_THEME to produce a full theme. */\nexport function createTheme(override: XyneThemeOverride): XyneTheme {\n return deepMerge(\n DEFAULT_THEME as unknown as Record<string, unknown>,\n override as Record<string, unknown>,\n ) as unknown as XyneTheme\n}\n","import React, { useMemo } from 'react'\nimport type { XyneThemeOverride } from './types'\nimport type { ColorScheme, ResolvedColorScheme } from './colorScheme.types'\nimport { ThemeContext } from './ThemeContext'\nimport { createTheme } from './createTheme'\nimport { ColorSchemeProvider } from './ColorSchemeProvider'\n\n/** Convert camelCase to kebab-case: \"surfaceHover\" → \"surface-hover\" */\nfunction camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)\n}\n\n/**\n * Generate CSS custom-property declarations from a theme override.\n * Only fields present in the override produce variables — tokens.css provides all defaults.\n */\nfunction themeOverrideToCssVars(override: XyneThemeOverride): Record<string, string> {\n const vars: Record<string, string> = {}\n\n if (override.colors) {\n for (const [scale, shades] of Object.entries(override.colors)) {\n for (const [shade, value] of Object.entries(shades)) {\n vars[`--xc-color-${camelToKebab(scale)}-${shade}`] = value\n }\n }\n }\n\n if (override.text) {\n for (const [key, value] of Object.entries(override.text)) {\n vars[`--xc-color-text-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.bg) {\n for (const [key, value] of Object.entries(override.bg)) {\n vars[`--xc-color-bg-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.border) {\n for (const [key, value] of Object.entries(override.border)) {\n vars[`--xc-color-border-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.shadow) {\n for (const [key, value] of Object.entries(override.shadow)) {\n vars[`--xc-shadow-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.radius) {\n for (const [key, value] of Object.entries(override.radius)) {\n vars[`--xc-radius-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.spacing) {\n for (const [key, value] of Object.entries(override.spacing)) {\n vars[`--xc-space-${key}`] = value\n }\n }\n\n if (override.fontFamily) {\n vars['--xc-font-family'] = override.fontFamily\n }\n\n if (override.fontWeight) {\n for (const [key, value] of Object.entries(override.fontWeight)) {\n vars[`--xc-font-weight-${camelToKebab(key)}`] = value\n }\n }\n\n if (override.fontSize) {\n for (const [key, value] of Object.entries(override.fontSize)) {\n vars[`--xc-font-size-${key}`] = value\n }\n }\n\n if (override.lineHeight) {\n for (const [key, value] of Object.entries(override.lineHeight)) {\n vars[`--xc-line-height-${key}`] = value\n }\n }\n\n return vars\n}\n\nexport interface ThemeProviderProps {\n /** Theme override — deep-merged with DEFAULT_THEME */\n theme?: XyneThemeOverride\n /** CSS selector for variable injection. @default ':root' */\n cssVariablesSelector?: string\n /** Initial color scheme if nothing is stored. @default 'light' */\n defaultColorScheme?: ColorScheme\n /** Force a specific color scheme — ignores storage and user toggle. */\n forceColorScheme?: ResolvedColorScheme\n /** localStorage key for color scheme persistence. @default 'xc-color-scheme' */\n colorSchemeStorageKey?: string\n /** Return the element to set `data-theme` on. @default () => document.documentElement */\n getRootElement?: () => HTMLElement | undefined\n children: React.ReactNode\n}\n\n/**\n * Provides theme context and injects CSS variable overrides via a <style> tag.\n * Wrap your app (or a subtree) to customise design tokens.\n *\n * @important Pass a stable reference (from `createTheme()` or `useMemo`) to the `theme` prop.\n * Inline object literals recreate a new reference every render, causing unnecessary CSS\n * recalculations. Example: `const theme = createTheme({ text: { brand: '#0066ff' } })` outside\n * your component, then `<ThemeProvider theme={theme}>`.\n *\n * @example\n * ```tsx\n * const theme = createTheme({ text: { brand: '#0066ff' } })\n * <ThemeProvider theme={theme}>{children}</ThemeProvider>\n * ```\n */\nexport function ThemeProvider({\n theme: themeOverride = {},\n cssVariablesSelector = ':root',\n defaultColorScheme = 'light',\n forceColorScheme,\n colorSchemeStorageKey,\n getRootElement,\n children,\n}: ThemeProviderProps) {\n const resolvedTheme = useMemo(\n () => createTheme(themeOverride),\n [themeOverride],\n )\n\n const cssText = useMemo(() => {\n const vars = themeOverrideToCssVars(themeOverride)\n const entries = Object.entries(vars)\n if (entries.length === 0) return ''\n const declarations = entries\n .map(([k, v]) => ` ${k}: ${v};`)\n .join('\\n')\n return `${cssVariablesSelector} {\\n${declarations}\\n}`\n }, [themeOverride, cssVariablesSelector])\n\n return (\n <ColorSchemeProvider\n defaultColorScheme={defaultColorScheme}\n forceColorScheme={forceColorScheme}\n storageKey={colorSchemeStorageKey}\n getRootElement={getRootElement}\n >\n <ThemeContext.Provider value={resolvedTheme}>\n {cssText && <style data-xc-theme=\"\">{cssText}</style>}\n {children}\n </ThemeContext.Provider>\n </ColorSchemeProvider>\n )\n}\n","import React, { useState, useEffect, useMemo, useCallback } from 'react'\nimport type { ColorScheme, ResolvedColorScheme, ColorSchemeContextValue } from './colorScheme.types'\nimport { ColorSchemeContext } from './ColorSchemeContext'\n\nconst STORAGE_KEY = 'xc-color-scheme'\n\nfunction getSystemPreference(): ResolvedColorScheme {\n if (typeof window === 'undefined') return 'light'\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n}\n\nfunction applyToDOM(resolved: ResolvedColorScheme, getRootElement?: () => HTMLElement | undefined) {\n if (typeof document === 'undefined') return\n const root = getRootElement ? getRootElement() : document.documentElement\n if (root) root.setAttribute('data-theme', resolved)\n}\n\nexport interface ColorSchemeProviderProps {\n defaultColorScheme?: ColorScheme\n forceColorScheme?: ResolvedColorScheme\n storageKey?: string\n getRootElement?: () => HTMLElement | undefined\n children: React.ReactNode\n}\n\nexport function ColorSchemeProvider({\n defaultColorScheme = 'light',\n forceColorScheme,\n storageKey = STORAGE_KEY,\n getRootElement,\n children,\n}: ColorSchemeProviderProps) {\n const [colorScheme, setColorSchemeRaw] = useState<ColorScheme>(() => {\n if (forceColorScheme) return forceColorScheme\n try {\n if (typeof window !== 'undefined') {\n const v = window.localStorage.getItem(storageKey)\n if (v === 'light' || v === 'dark' || v === 'auto') return v\n }\n } catch { /* noop */ }\n return defaultColorScheme\n })\n\n const [systemPreference, setSystemPreference] = useState<ResolvedColorScheme>(getSystemPreference)\n\n const resolvedColorScheme: ResolvedColorScheme = forceColorScheme\n ?? (colorScheme === 'auto' ? systemPreference : colorScheme)\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n const mq = window.matchMedia('(prefers-color-scheme: dark)')\n const handler = (e: MediaQueryListEvent) => {\n setSystemPreference(e.matches ? 'dark' : 'light')\n }\n mq.addEventListener('change', handler)\n return () => mq.removeEventListener('change', handler)\n }, [])\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n const handler = (e: StorageEvent) => {\n if (e.key !== storageKey) return\n const val = e.newValue\n if (val === 'light' || val === 'dark' || val === 'auto') {\n setColorSchemeRaw(val)\n }\n }\n window.addEventListener('storage', handler)\n return () => window.removeEventListener('storage', handler)\n }, [storageKey])\n\n useEffect(() => {\n applyToDOM(resolvedColorScheme, getRootElement)\n }, [resolvedColorScheme, getRootElement])\n\n const setColorScheme = useCallback((scheme: ColorScheme) => {\n if (forceColorScheme) return\n setColorSchemeRaw(scheme)\n try {\n window.localStorage.setItem(storageKey, scheme)\n } catch { /* noop */ }\n }, [forceColorScheme, storageKey])\n\n const toggleColorScheme = useCallback(() => {\n setColorScheme(resolvedColorScheme === 'dark' ? 'light' : 'dark')\n }, [resolvedColorScheme, setColorScheme])\n\n const value = useMemo<ColorSchemeContextValue>(() => ({\n colorScheme,\n resolvedColorScheme,\n setColorScheme,\n toggleColorScheme,\n }), [colorScheme, resolvedColorScheme, setColorScheme, toggleColorScheme])\n\n return (\n <ColorSchemeContext.Provider value={value}>\n {children}\n </ColorSchemeContext.Provider>\n )\n}\n"]}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/theme/defaultTheme.ts
|
|
4
|
+
var DEFAULT_THEME = {
|
|
5
|
+
colors: {
|
|
6
|
+
orange: {
|
|
7
|
+
"50": "#fff7ed",
|
|
8
|
+
"100": "#ffedd4",
|
|
9
|
+
"200": "#ffd6a8",
|
|
10
|
+
"300": "#ffb86a",
|
|
11
|
+
"400": "#ff8904",
|
|
12
|
+
"500": "#fe6d36",
|
|
13
|
+
"600": "#ea580c",
|
|
14
|
+
"700": "#c2410c"
|
|
15
|
+
},
|
|
16
|
+
gray: {
|
|
17
|
+
"25": "#f6f8fa",
|
|
18
|
+
"50": "#f9fafb",
|
|
19
|
+
"100": "#f2f4f7",
|
|
20
|
+
"200": "#e4e7ec",
|
|
21
|
+
"300": "#d0d5dd",
|
|
22
|
+
"400": "#98a2b3",
|
|
23
|
+
"500": "#667085",
|
|
24
|
+
"600": "#475467",
|
|
25
|
+
"700": "#344054",
|
|
26
|
+
"800": "#1d2939",
|
|
27
|
+
"900": "#101828"
|
|
28
|
+
},
|
|
29
|
+
red: {
|
|
30
|
+
"50": "#fef3f2",
|
|
31
|
+
"500": "#f04438",
|
|
32
|
+
"600": "#d92d20",
|
|
33
|
+
"700": "#b42318"
|
|
34
|
+
},
|
|
35
|
+
green: {
|
|
36
|
+
"50": "#ecfdf3",
|
|
37
|
+
"500": "#12b76a",
|
|
38
|
+
"600": "#039855",
|
|
39
|
+
"700": "#027a48"
|
|
40
|
+
},
|
|
41
|
+
yellow: {
|
|
42
|
+
"50": "#fffaeb",
|
|
43
|
+
"500": "#f79009",
|
|
44
|
+
"600": "#dc6803",
|
|
45
|
+
"700": "#b54708"
|
|
46
|
+
},
|
|
47
|
+
blue: {
|
|
48
|
+
"50": "#eff8ff",
|
|
49
|
+
"500": "#2e90fa",
|
|
50
|
+
"600": "#1570ef",
|
|
51
|
+
"700": "#175cd3"
|
|
52
|
+
},
|
|
53
|
+
purple: {
|
|
54
|
+
"50": "#f9f5ff",
|
|
55
|
+
"500": "#9e77ed",
|
|
56
|
+
"600": "#7f56d9",
|
|
57
|
+
"700": "#6941c6"
|
|
58
|
+
},
|
|
59
|
+
teal: {
|
|
60
|
+
"50": "#f0fdf9",
|
|
61
|
+
"500": "#15b79e",
|
|
62
|
+
"600": "#0e9384",
|
|
63
|
+
"700": "#107569"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
text: {
|
|
67
|
+
primary: "#101828",
|
|
68
|
+
secondary: "#475467",
|
|
69
|
+
tertiary: "#667085",
|
|
70
|
+
disabled: "#c9d0db",
|
|
71
|
+
brand: "#e8601a",
|
|
72
|
+
inverse: "#f1f5f9",
|
|
73
|
+
error: "#d92d20",
|
|
74
|
+
success: "#039855",
|
|
75
|
+
warning: "#b54708"
|
|
76
|
+
},
|
|
77
|
+
bg: {
|
|
78
|
+
white: "#ffffff",
|
|
79
|
+
subtle: "#f9fafb",
|
|
80
|
+
surfaceHover: "#f1f5f9",
|
|
81
|
+
brand: "#fff4ee",
|
|
82
|
+
error: "#fef3f2",
|
|
83
|
+
success: "#ecfdf3",
|
|
84
|
+
warning: "#fffaeb",
|
|
85
|
+
neutral: "#f9fafb",
|
|
86
|
+
purple: "#f9f5ff",
|
|
87
|
+
blue: "#eff8ff",
|
|
88
|
+
teal: "#f0fdf9"
|
|
89
|
+
},
|
|
90
|
+
border: {
|
|
91
|
+
default: "#d6dce6",
|
|
92
|
+
subtle: "#f1f5f9",
|
|
93
|
+
strong: "#98a2b3",
|
|
94
|
+
brand: "#fe6d36",
|
|
95
|
+
error: "#fda29b"
|
|
96
|
+
},
|
|
97
|
+
shadow: {
|
|
98
|
+
xs: "0 1px 2px 0 rgba(16, 24, 40, 0.05)",
|
|
99
|
+
sm: "0 1px 3px 0 rgba(16, 24, 40, 0.1), 0 1px 2px -1px rgba(16, 24, 40, 0.1)",
|
|
100
|
+
md: "0 4px 6px -1px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.1)",
|
|
101
|
+
pressed: "inset 0 0 4px 0 rgba(0, 0, 0, 0.15)"
|
|
102
|
+
},
|
|
103
|
+
radius: {
|
|
104
|
+
xs: "2px",
|
|
105
|
+
sm: "4px",
|
|
106
|
+
md: "8px",
|
|
107
|
+
lg: "12px",
|
|
108
|
+
xl: "16px",
|
|
109
|
+
full: "9999px"
|
|
110
|
+
},
|
|
111
|
+
spacing: {
|
|
112
|
+
"0": "0px",
|
|
113
|
+
"1": "2px",
|
|
114
|
+
"2": "4px",
|
|
115
|
+
"3": "6px",
|
|
116
|
+
"4": "8px",
|
|
117
|
+
"5": "10px",
|
|
118
|
+
"6": "12px",
|
|
119
|
+
"7": "14px",
|
|
120
|
+
"8": "16px",
|
|
121
|
+
"9": "18px",
|
|
122
|
+
"10": "20px",
|
|
123
|
+
"12": "24px",
|
|
124
|
+
"16": "32px"
|
|
125
|
+
},
|
|
126
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
127
|
+
fontWeight: {
|
|
128
|
+
regular: "400",
|
|
129
|
+
medium: "500",
|
|
130
|
+
semibold: "600",
|
|
131
|
+
bold: "700"
|
|
132
|
+
},
|
|
133
|
+
fontSize: {
|
|
134
|
+
"2xs": "10px",
|
|
135
|
+
xs: "11px",
|
|
136
|
+
sm: "12px",
|
|
137
|
+
md: "14px",
|
|
138
|
+
lg: "16px",
|
|
139
|
+
xl: "18px"
|
|
140
|
+
},
|
|
141
|
+
lineHeight: {
|
|
142
|
+
"2xs": "14px",
|
|
143
|
+
xs: "16px",
|
|
144
|
+
sm: "18px",
|
|
145
|
+
md: "20px",
|
|
146
|
+
lg: "24px",
|
|
147
|
+
xl: "28px"
|
|
148
|
+
},
|
|
149
|
+
other: {},
|
|
150
|
+
components: {}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/theme/ThemeContext.ts
|
|
154
|
+
import { createContext } from "react";
|
|
155
|
+
var ThemeContext = createContext(DEFAULT_THEME);
|
|
156
|
+
|
|
157
|
+
// src/theme/ColorSchemeContext.ts
|
|
158
|
+
import { createContext as createContext2 } from "react";
|
|
159
|
+
var ColorSchemeContext = createContext2({
|
|
160
|
+
colorScheme: "light",
|
|
161
|
+
resolvedColorScheme: "light",
|
|
162
|
+
setColorScheme: () => {
|
|
163
|
+
},
|
|
164
|
+
toggleColorScheme: () => {
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
DEFAULT_THEME,
|
|
170
|
+
ThemeContext,
|
|
171
|
+
ColorSchemeContext
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=chunk-54N4ZTTL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme/defaultTheme.ts","../src/theme/ThemeContext.ts","../src/theme/ColorSchemeContext.ts"],"sourcesContent":["import type { XyneTheme } from './types'\n\n/**\n * Default theme — values match tokens.css (light mode).\n * Used as the base for createTheme() deep-merge.\n */\nexport const DEFAULT_THEME: XyneTheme = {\n colors: {\n orange: {\n '50': '#fff7ed',\n '100': '#ffedd4',\n '200': '#ffd6a8',\n '300': '#ffb86a',\n '400': '#ff8904',\n '500': '#fe6d36',\n '600': '#ea580c',\n '700': '#c2410c',\n },\n gray: {\n '25': '#f6f8fa',\n '50': '#f9fafb',\n '100': '#f2f4f7',\n '200': '#e4e7ec',\n '300': '#d0d5dd',\n '400': '#98a2b3',\n '500': '#667085',\n '600': '#475467',\n '700': '#344054',\n '800': '#1d2939',\n '900': '#101828',\n },\n red: {\n '50': '#fef3f2',\n '500': '#f04438',\n '600': '#d92d20',\n '700': '#b42318',\n },\n green: {\n '50': '#ecfdf3',\n '500': '#12b76a',\n '600': '#039855',\n '700': '#027a48',\n },\n yellow: {\n '50': '#fffaeb',\n '500': '#f79009',\n '600': '#dc6803',\n '700': '#b54708',\n },\n blue: {\n '50': '#eff8ff',\n '500': '#2e90fa',\n '600': '#1570ef',\n '700': '#175cd3',\n },\n purple: {\n '50': '#f9f5ff',\n '500': '#9e77ed',\n '600': '#7f56d9',\n '700': '#6941c6',\n },\n teal: {\n '50': '#f0fdf9',\n '500': '#15b79e',\n '600': '#0e9384',\n '700': '#107569',\n },\n },\n\n text: {\n primary: '#101828',\n secondary: '#475467',\n tertiary: '#667085',\n disabled: '#c9d0db',\n brand: '#e8601a',\n inverse: '#f1f5f9',\n error: '#d92d20',\n success: '#039855',\n warning: '#b54708',\n },\n\n bg: {\n white: '#ffffff',\n subtle: '#f9fafb',\n surfaceHover: '#f1f5f9',\n brand: '#fff4ee',\n error: '#fef3f2',\n success: '#ecfdf3',\n warning: '#fffaeb',\n neutral: '#f9fafb',\n purple: '#f9f5ff',\n blue: '#eff8ff',\n teal: '#f0fdf9',\n },\n\n border: {\n default: '#d6dce6',\n subtle: '#f1f5f9',\n strong: '#98a2b3',\n brand: '#fe6d36',\n error: '#fda29b',\n },\n\n shadow: {\n xs: '0 1px 2px 0 rgba(16, 24, 40, 0.05)',\n sm: '0 1px 3px 0 rgba(16, 24, 40, 0.1), 0 1px 2px -1px rgba(16, 24, 40, 0.1)',\n md: '0 4px 6px -1px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.1)',\n pressed: 'inset 0 0 4px 0 rgba(0, 0, 0, 0.15)',\n },\n\n radius: {\n xs: '2px',\n sm: '4px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n full: '9999px',\n },\n\n spacing: {\n '0': '0px',\n '1': '2px',\n '2': '4px',\n '3': '6px',\n '4': '8px',\n '5': '10px',\n '6': '12px',\n '7': '14px',\n '8': '16px',\n '9': '18px',\n '10': '20px',\n '12': '24px',\n '16': '32px',\n },\n\n fontFamily: \"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n\n fontWeight: {\n regular: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n\n fontSize: {\n '2xs': '10px',\n xs: '11px',\n sm: '12px',\n md: '14px',\n lg: '16px',\n xl: '18px',\n },\n\n lineHeight: {\n '2xs': '14px',\n xs: '16px',\n sm: '18px',\n md: '20px',\n lg: '24px',\n xl: '28px',\n },\n\n other: {},\n components: {},\n}\n","import { createContext } from 'react'\nimport type { XyneTheme } from './types'\nimport { DEFAULT_THEME } from './defaultTheme'\n\nexport const ThemeContext = createContext<XyneTheme>(DEFAULT_THEME)\n","import { createContext } from 'react'\nimport type { ColorSchemeContextValue } from './colorScheme.types'\n\n/** Default (no-op) context — consumers outside a provider get static 'light'. */\nexport const ColorSchemeContext = createContext<ColorSchemeContextValue>({\n colorScheme: 'light',\n resolvedColorScheme: 'light',\n setColorScheme: () => {},\n toggleColorScheme: () => {},\n})\n"],"mappings":";;;AAMO,IAAM,gBAA2B;AAAA,EACtC,QAAQ;AAAA,IACN,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,KAAK;AAAA,MACH,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,I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AAM;AAAA,EACR;AAAA,EAEA,SAAS;AAAA,IACP,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EAEA,YAAY;AAAA,EAEZ,YAAY;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EAEA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAAA,EAEA,YAAY;AAAA,IACV,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAAA,EAEA,OAAO,CAAC;AAAA,EACR,YAAY,CAAC;AACf;;;ACpKA,SAAS,qBAAqB;AAIvB,IAAM,eAAe,cAAyB,aAAa;;;ACJlE,SAAS,iBAAAA,sBAAqB;AAIvB,IAAM,qBAAqBA,eAAuC;AAAA,EACvE,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,gBAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,mBAAmB,MAAM;AAAA,EAAC;AAC5B,CAAC;","names":["createContext"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkWUV742E6cjs = require('./chunk-WUV742E6.cjs');
|
|
6
|
+
|
|
7
|
+
// src/hooks/useTheme.ts
|
|
8
|
+
var _react = require('react');
|
|
9
|
+
function useTheme() {
|
|
10
|
+
return _react.useContext.call(void 0, _chunkWUV742E6cjs.ThemeContext);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/hooks/useColorScheme.ts
|
|
14
|
+
|
|
15
|
+
function useColorScheme() {
|
|
16
|
+
return _react.useContext.call(void 0, _chunkWUV742E6cjs.ColorSchemeContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.useTheme = useTheme; exports.useColorScheme = useColorScheme;
|
|
23
|
+
//# sourceMappingURL=chunk-73U3B3WX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/harshpreet.singh/Desktop/Juspay/xyne-spaces/components/dist/chunk-73U3B3WX.cjs","../src/hooks/useTheme.ts","../src/hooks/useColorScheme.ts"],"names":["useContext"],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACNA,8BAA2B;AAKpB,SAAS,QAAA,CAAA,EAAsB;AACpC,EAAA,OAAO,+BAAA,8BAAuB,CAAA;AAChC;ADIA;AACA;AEZA;AAeO,SAAS,cAAA,CAAA,EAA0C;AACxD,EAAA,OAAOA,+BAAAA,oCAA6B,CAAA;AACtC;AFAA;AACA;AACE;AACA;AACF,qEAAC","file":"/Users/harshpreet.singh/Desktop/Juspay/xyne-spaces/components/dist/chunk-73U3B3WX.cjs","sourcesContent":[null,"import { useContext } from 'react'\nimport type { XyneTheme } from '../theme/types'\nimport { ThemeContext } from '../theme/ThemeContext'\n\n/** Access the resolved theme object from the nearest ThemeProvider. */\nexport function useTheme(): XyneTheme {\n return useContext(ThemeContext)\n}\n","import { useContext } from 'react'\nimport type { ColorSchemeContextValue } from '../theme/colorScheme.types'\nimport { ColorSchemeContext } from '../theme/ColorSchemeContext'\n\n/**\n * Access and control the current color scheme.\n *\n * @example\n * ```tsx\n * const { resolvedColorScheme, toggleColorScheme } = useColorScheme()\n * <button onClick={toggleColorScheme}>\n * Current: {resolvedColorScheme}\n * </button>\n * ```\n */\nexport function useColorScheme(): ColorSchemeContextValue {\n return useContext(ColorSchemeContext)\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ColorSchemeContext,
|
|
4
|
+
ThemeContext
|
|
5
|
+
} from "./chunk-54N4ZTTL.js";
|
|
6
|
+
|
|
7
|
+
// src/hooks/useTheme.ts
|
|
8
|
+
import { useContext } from "react";
|
|
9
|
+
function useTheme() {
|
|
10
|
+
return useContext(ThemeContext);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/hooks/useColorScheme.ts
|
|
14
|
+
import { useContext as useContext2 } from "react";
|
|
15
|
+
function useColorScheme() {
|
|
16
|
+
return useContext2(ColorSchemeContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
useTheme,
|
|
21
|
+
useColorScheme
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-CNEANQ6B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useTheme.ts","../src/hooks/useColorScheme.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { XyneTheme } from '../theme/types'\nimport { ThemeContext } from '../theme/ThemeContext'\n\n/** Access the resolved theme object from the nearest ThemeProvider. */\nexport function useTheme(): XyneTheme {\n return useContext(ThemeContext)\n}\n","import { useContext } from 'react'\nimport type { ColorSchemeContextValue } from '../theme/colorScheme.types'\nimport { ColorSchemeContext } from '../theme/ColorSchemeContext'\n\n/**\n * Access and control the current color scheme.\n *\n * @example\n * ```tsx\n * const { resolvedColorScheme, toggleColorScheme } = useColorScheme()\n * <button onClick={toggleColorScheme}>\n * Current: {resolvedColorScheme}\n * </button>\n * ```\n */\nexport function useColorScheme(): ColorSchemeContextValue {\n return useContext(ColorSchemeContext)\n}\n"],"mappings":";;;;;;;AAAA,SAAS,kBAAkB;AAKpB,SAAS,WAAsB;AACpC,SAAO,WAAW,YAAY;AAChC;;;ACPA,SAAS,cAAAA,mBAAkB;AAepB,SAAS,iBAA0C;AACxD,SAAOC,YAAW,kBAAkB;AACtC;","names":["useContext","useContext"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
resolveSx
|
|
4
|
+
} from "./chunk-ZS6WGFYT.js";
|
|
5
|
+
|
|
6
|
+
// src/Badge/Badge.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var Badge = React.forwardRef(
|
|
10
|
+
function BadgeInner({
|
|
11
|
+
children,
|
|
12
|
+
variant = "badge",
|
|
13
|
+
icon,
|
|
14
|
+
slots,
|
|
15
|
+
slotProps,
|
|
16
|
+
sx,
|
|
17
|
+
className,
|
|
18
|
+
style,
|
|
19
|
+
component,
|
|
20
|
+
...rest
|
|
21
|
+
}, ref) {
|
|
22
|
+
const Root = slots?.root ?? component ?? "span";
|
|
23
|
+
const Icon = slots?.icon ?? "span";
|
|
24
|
+
const sxStyles = resolveSx(sx);
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
Root,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
...slotProps?.root,
|
|
30
|
+
...rest,
|
|
31
|
+
className: `xc-badge${className ? ` ${className}` : ""}`,
|
|
32
|
+
"data-variant": variant,
|
|
33
|
+
style: { ...slotProps?.root?.style, ...sxStyles, ...style },
|
|
34
|
+
children: [
|
|
35
|
+
variant === "badge" && icon != null && /* @__PURE__ */ jsx(
|
|
36
|
+
Icon,
|
|
37
|
+
{
|
|
38
|
+
...slotProps?.icon,
|
|
39
|
+
className: "xc-badge__icon",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: icon
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
variant === "badge" && children
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
Badge.displayName = "Badge";
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
Badge
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=chunk-EJ4BXCSG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Badge/Badge.tsx"],"sourcesContent":["import React from 'react'\nimport type { PolymorphicComponentPropsWithRef, SxProp } from '../utils'\nimport { resolveSx } from '../utils'\n\nexport type BadgeVariant = 'badge' | 'dot'\n\nexport type BadgeSlots = {\n root?: React.ElementType\n icon?: React.ElementType\n}\n\nexport type BadgeSlotProps = {\n root?: React.HTMLAttributes<HTMLElement>\n icon?: React.HTMLAttributes<HTMLSpanElement>\n}\n\ntype BadgeOwnProps = {\n variant?: BadgeVariant\n icon?: React.ReactNode\n slots?: BadgeSlots\n slotProps?: BadgeSlotProps\n sx?: SxProp\n}\n\nexport type BadgeProps<C extends React.ElementType = 'span'> =\n PolymorphicComponentPropsWithRef<C, BadgeOwnProps>\n\ntype BadgeComponent = <C extends React.ElementType = 'span'>(\n props: BadgeProps<C>,\n) => React.ReactElement | null\n\nexport const Badge: BadgeComponent = React.forwardRef(function BadgeInner(\n {\n children,\n variant = 'badge',\n icon,\n slots,\n slotProps,\n sx,\n className,\n style,\n component,\n ...rest\n }: BadgeProps<React.ElementType>,\n ref: React.Ref<Element>,\n) {\n const Root = (slots?.root ?? component ?? 'span') as React.ElementType\n const Icon = (slots?.icon ?? 'span') as React.ElementType\n\n const sxStyles = resolveSx(sx)\n\n return (\n <Root\n ref={ref}\n {...slotProps?.root}\n {...rest}\n className={`xc-badge${className ? ` ${className}` : ''}`}\n data-variant={variant}\n style={{ ...slotProps?.root?.style, ...sxStyles, ...style }}\n >\n {variant === 'badge' && icon != null && (\n <Icon\n {...slotProps?.icon}\n className=\"xc-badge__icon\"\n aria-hidden=\"true\"\n >\n {icon}\n </Icon>\n )}\n {variant === 'badge' && children}\n </Root>\n )\n },\n) as unknown as BadgeComponent\n\n;(Badge as { displayName?: string }).displayName = 'Badge'\n"],"mappings":";;;;;;AAAA,OAAO,WAAW;AAoDZ,SASI,KATJ;AArBC,IAAM,QAAwB,MAAM;AAAA,EAAW,SAAS,WAC7D;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,KACA;AACE,UAAM,OAAQ,OAAO,QAAQ,aAAa;AAC1C,UAAM,OAAQ,OAAO,QAAQ;AAE7B,UAAM,WAAW,UAAU,EAAE;AAE7B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG,WAAW;AAAA,QACd,GAAG;AAAA,QACJ,WAAW,WAAW,YAAY,IAAI,SAAS,KAAK,EAAE;AAAA,QACtD,gBAAc;AAAA,QACd,OAAO,EAAE,GAAG,WAAW,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM;AAAA,QAEzD;AAAA,sBAAY,WAAW,QAAQ,QAC9B;AAAA,YAAC;AAAA;AAAA,cACE,GAAG,WAAW;AAAA,cACf,WAAU;AAAA,cACV,eAAY;AAAA,cAEX;AAAA;AAAA,UACH;AAAA,UAED,YAAY,WAAW;AAAA;AAAA;AAAA,IAC1B;AAAA,EAEJ;AACF;AAEE,MAAmC,cAAc;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkSRXGVBJ5cjs = require('./chunk-SRXGVBJ5.cjs');
|
|
5
|
+
|
|
6
|
+
// src/ListItem/ListItem.tsx
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
9
|
+
var NATIVELY_DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset"]);
|
|
10
|
+
var ListItem = _react2.default.forwardRef(function ListItemInner({
|
|
11
|
+
label,
|
|
12
|
+
subtext,
|
|
13
|
+
selected,
|
|
14
|
+
active,
|
|
15
|
+
showBar = true,
|
|
16
|
+
leading,
|
|
17
|
+
trailing,
|
|
18
|
+
slots,
|
|
19
|
+
slotProps,
|
|
20
|
+
sx,
|
|
21
|
+
disabled,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
component,
|
|
25
|
+
...rest
|
|
26
|
+
}, ref) {
|
|
27
|
+
const Root = _nullishCoalesce(_nullishCoalesce(_optionalChain([slots, 'optionalAccess', _ => _.root]), () => ( component)), () => ( "button"));
|
|
28
|
+
const Bar = _nullishCoalesce(_optionalChain([slots, 'optionalAccess', _2 => _2.bar]), () => ( "span"));
|
|
29
|
+
const Leading = _nullishCoalesce(_optionalChain([slots, 'optionalAccess', _3 => _3.leading]), () => ( "span"));
|
|
30
|
+
const Trailing = _nullishCoalesce(_optionalChain([slots, 'optionalAccess', _4 => _4.trailing]), () => ( "span"));
|
|
31
|
+
const Text = _nullishCoalesce(_optionalChain([slots, 'optionalAccess', _5 => _5.text]), () => ( "span"));
|
|
32
|
+
const sxStyles = _chunkSRXGVBJ5cjs.resolveSx.call(void 0, sx);
|
|
33
|
+
const isNativelyDisableable = typeof Root === "string" && NATIVELY_DISABLEABLE.has(Root);
|
|
34
|
+
const rootProps = Root === "button" ? { type: "button", ..._optionalChain([slotProps, 'optionalAccess', _6 => _6.root]) } : _optionalChain([slotProps, 'optionalAccess', _7 => _7.root]);
|
|
35
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
36
|
+
Root,
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
...rootProps,
|
|
40
|
+
...rest,
|
|
41
|
+
className: `xc-list-item${className ? ` ${className}` : ""}`,
|
|
42
|
+
...isNativelyDisableable ? { disabled } : { "aria-disabled": disabled || void 0 },
|
|
43
|
+
"data-selected": selected || void 0,
|
|
44
|
+
"data-active": active || void 0,
|
|
45
|
+
"data-disabled": disabled || void 0,
|
|
46
|
+
style: { ..._optionalChain([slotProps, 'optionalAccess', _8 => _8.root, 'optionalAccess', _9 => _9.style]), ...sxStyles, ...style },
|
|
47
|
+
children: [
|
|
48
|
+
showBar && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
49
|
+
Bar,
|
|
50
|
+
{
|
|
51
|
+
..._optionalChain([slotProps, 'optionalAccess', _10 => _10.bar]),
|
|
52
|
+
className: "xc-list-item__bar",
|
|
53
|
+
"aria-hidden": "true"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
leading != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
57
|
+
Leading,
|
|
58
|
+
{
|
|
59
|
+
..._optionalChain([slotProps, 'optionalAccess', _11 => _11.leading]),
|
|
60
|
+
className: "xc-list-item__leading",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
children: leading
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Text, { ..._optionalChain([slotProps, 'optionalAccess', _12 => _12.text]), className: "xc-list-item__text", children: [
|
|
66
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "xc-list-item__label", children: label }),
|
|
67
|
+
subtext != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "xc-list-item__subtext", children: subtext })
|
|
68
|
+
] }),
|
|
69
|
+
trailing != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
70
|
+
Trailing,
|
|
71
|
+
{
|
|
72
|
+
..._optionalChain([slotProps, 'optionalAccess', _13 => _13.trailing]),
|
|
73
|
+
className: "xc-list-item__trailing",
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: trailing
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
ListItem.displayName = "ListItem";
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
exports.ListItem = ListItem;
|
|
87
|
+
//# sourceMappingURL=chunk-HAG5EYQ5.cjs.map
|