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,20 @@
|
|
|
1
|
+
import { b as XyneTheme, a as ColorSchemeContextValue } from '../colorScheme.types-CqDRrNL0.cjs';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
/** Access the resolved theme object from the nearest ThemeProvider. */
|
|
5
|
+
declare function useTheme(): XyneTheme;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Access and control the current color scheme.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { resolvedColorScheme, toggleColorScheme } = useColorScheme()
|
|
13
|
+
* <button onClick={toggleColorScheme}>
|
|
14
|
+
* Current: {resolvedColorScheme}
|
|
15
|
+
* </button>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function useColorScheme(): ColorSchemeContextValue;
|
|
19
|
+
|
|
20
|
+
export { useColorScheme, useTheme };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { b as XyneTheme, a as ColorSchemeContextValue } from '../colorScheme.types-CqDRrNL0.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
/** Access the resolved theme object from the nearest ThemeProvider. */
|
|
5
|
+
declare function useTheme(): XyneTheme;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Access and control the current color scheme.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { resolvedColorScheme, toggleColorScheme } = useColorScheme()
|
|
13
|
+
* <button onClick={toggleColorScheme}>
|
|
14
|
+
* Current: {resolvedColorScheme}
|
|
15
|
+
* </button>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function useColorScheme(): ColorSchemeContextValue;
|
|
19
|
+
|
|
20
|
+
export { useColorScheme, useTheme };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,576 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
29
2
|
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
Badge: () => Badge,
|
|
34
|
-
ColorSchemeProvider: () => ColorSchemeProvider,
|
|
35
|
-
DEFAULT_THEME: () => DEFAULT_THEME,
|
|
36
|
-
Directory: () => Directory,
|
|
37
|
-
Label: () => Label,
|
|
38
|
-
ListItem: () => ListItem,
|
|
39
|
-
ThemeProvider: () => ThemeProvider,
|
|
40
|
-
createTheme: () => createTheme,
|
|
41
|
-
useColorScheme: () => useColorScheme,
|
|
42
|
-
useTheme: () => useTheme
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(index_exports);
|
|
45
3
|
|
|
46
|
-
|
|
47
|
-
var import_react = __toESM(require("react"), 1);
|
|
48
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
-
var ListItem = import_react.default.forwardRef(
|
|
50
|
-
({
|
|
51
|
-
label,
|
|
52
|
-
subtext,
|
|
53
|
-
selected,
|
|
54
|
-
active,
|
|
55
|
-
showBar = true,
|
|
56
|
-
leading,
|
|
57
|
-
trailing,
|
|
58
|
-
disabled,
|
|
59
|
-
className,
|
|
60
|
-
...rest
|
|
61
|
-
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
62
|
-
"button",
|
|
63
|
-
{
|
|
64
|
-
ref,
|
|
65
|
-
type: "button",
|
|
66
|
-
...rest,
|
|
67
|
-
className: `xc-list-item${className ? ` ${className}` : ""}`,
|
|
68
|
-
disabled,
|
|
69
|
-
"data-selected": selected || void 0,
|
|
70
|
-
"data-active": active || void 0,
|
|
71
|
-
"data-disabled": disabled || void 0,
|
|
72
|
-
children: [
|
|
73
|
-
showBar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "xc-list-item__bar", "aria-hidden": "true" }),
|
|
74
|
-
leading != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "xc-list-item__leading", "aria-hidden": "true", children: leading }),
|
|
75
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "xc-list-item__text", children: [
|
|
76
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "xc-list-item__label", children: label }),
|
|
77
|
-
subtext != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "xc-list-item__subtext", children: subtext })
|
|
78
|
-
] }),
|
|
79
|
-
trailing != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "xc-list-item__trailing", "aria-hidden": "true", children: trailing })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
);
|
|
84
|
-
ListItem.displayName = "ListItem";
|
|
4
|
+
var _chunkJKYZDOSJcjs = require('./chunk-JKYZDOSJ.cjs');
|
|
85
5
|
|
|
86
|
-
// src/Badge/Badge.tsx
|
|
87
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
88
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
89
|
-
var Badge = import_react2.default.forwardRef(
|
|
90
|
-
({ children, variant = "badge", icon, className, style, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
91
|
-
"span",
|
|
92
|
-
{
|
|
93
|
-
ref,
|
|
94
|
-
...rest,
|
|
95
|
-
className: `xc-badge${className ? ` ${className}` : ""}`,
|
|
96
|
-
"data-variant": variant,
|
|
97
|
-
style,
|
|
98
|
-
children: [
|
|
99
|
-
variant === "badge" && icon != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "xc-badge__icon", "aria-hidden": "true", children: icon }),
|
|
100
|
-
variant === "badge" && children
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
Badge.displayName = "Badge";
|
|
106
6
|
|
|
107
|
-
|
|
108
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
109
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
110
|
-
var Label = import_react3.default.forwardRef(
|
|
111
|
-
({ children, variant = "closed", leading, trailing, className, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
112
|
-
"button",
|
|
113
|
-
{
|
|
114
|
-
ref,
|
|
115
|
-
type: "button",
|
|
116
|
-
...rest,
|
|
117
|
-
className: `xc-label${className ? ` ${className}` : ""}`,
|
|
118
|
-
"data-variant": variant,
|
|
119
|
-
children: [
|
|
120
|
-
leading != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "xc-label__leading", "aria-hidden": "true", children: leading }),
|
|
121
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "xc-label__text", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "xc-label__content", children }) }),
|
|
122
|
-
trailing != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "xc-label__trailing", "aria-hidden": "true", children: trailing })
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
);
|
|
127
|
-
Label.displayName = "Label";
|
|
7
|
+
var _chunkRXHOBQUJcjs = require('./chunk-RXHOBQUJ.cjs');
|
|
128
8
|
|
|
129
|
-
// src/Directory/Directory.tsx
|
|
130
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
131
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
132
|
-
var Directory = import_react4.default.forwardRef(
|
|
133
|
-
({
|
|
134
|
-
label,
|
|
135
|
-
variant = "closed",
|
|
136
|
-
leading,
|
|
137
|
-
trailing,
|
|
138
|
-
onHeaderClick,
|
|
139
|
-
children,
|
|
140
|
-
className,
|
|
141
|
-
...rest
|
|
142
|
-
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
143
|
-
"div",
|
|
144
|
-
{
|
|
145
|
-
ref,
|
|
146
|
-
...rest,
|
|
147
|
-
className: `xc-directory${className ? ` ${className}` : ""}`,
|
|
148
|
-
"data-variant": variant,
|
|
149
|
-
children: [
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
151
|
-
"button",
|
|
152
|
-
{
|
|
153
|
-
type: "button",
|
|
154
|
-
className: "xc-directory__header",
|
|
155
|
-
onClick: onHeaderClick,
|
|
156
|
-
children: [
|
|
157
|
-
leading != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "xc-directory__leading", "aria-hidden": "true", children: leading }),
|
|
158
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "xc-directory__text", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "xc-directory__label", children: label }) }),
|
|
159
|
-
trailing != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "xc-directory__trailing", "aria-hidden": "true", children: trailing })
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
variant === "opened" && children != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "xc-directory__content", children })
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
);
|
|
168
|
-
Directory.displayName = "Directory";
|
|
169
9
|
|
|
170
|
-
|
|
171
|
-
var DEFAULT_THEME = {
|
|
172
|
-
colors: {
|
|
173
|
-
orange: {
|
|
174
|
-
"50": "#fff7ed",
|
|
175
|
-
"100": "#ffedd4",
|
|
176
|
-
"200": "#ffd6a8",
|
|
177
|
-
"300": "#ffb86a",
|
|
178
|
-
"400": "#ff8904",
|
|
179
|
-
"500": "#fe6d36",
|
|
180
|
-
"600": "#ea580c",
|
|
181
|
-
"700": "#c2410c"
|
|
182
|
-
},
|
|
183
|
-
gray: {
|
|
184
|
-
"25": "#f6f8fa",
|
|
185
|
-
"50": "#f9fafb",
|
|
186
|
-
"100": "#f2f4f7",
|
|
187
|
-
"200": "#e4e7ec",
|
|
188
|
-
"300": "#d0d5dd",
|
|
189
|
-
"400": "#98a2b3",
|
|
190
|
-
"500": "#667085",
|
|
191
|
-
"600": "#475467",
|
|
192
|
-
"700": "#344054",
|
|
193
|
-
"800": "#1d2939",
|
|
194
|
-
"900": "#101828"
|
|
195
|
-
},
|
|
196
|
-
red: {
|
|
197
|
-
"50": "#fef3f2",
|
|
198
|
-
"500": "#f04438",
|
|
199
|
-
"600": "#d92d20",
|
|
200
|
-
"700": "#b42318"
|
|
201
|
-
},
|
|
202
|
-
green: {
|
|
203
|
-
"50": "#ecfdf3",
|
|
204
|
-
"500": "#12b76a",
|
|
205
|
-
"600": "#039855",
|
|
206
|
-
"700": "#027a48"
|
|
207
|
-
},
|
|
208
|
-
yellow: {
|
|
209
|
-
"50": "#fffaeb",
|
|
210
|
-
"500": "#f79009",
|
|
211
|
-
"600": "#dc6803",
|
|
212
|
-
"700": "#b54708"
|
|
213
|
-
},
|
|
214
|
-
blue: {
|
|
215
|
-
"50": "#eff8ff",
|
|
216
|
-
"500": "#2e90fa",
|
|
217
|
-
"600": "#1570ef",
|
|
218
|
-
"700": "#175cd3"
|
|
219
|
-
},
|
|
220
|
-
purple: {
|
|
221
|
-
"50": "#f9f5ff",
|
|
222
|
-
"500": "#9e77ed",
|
|
223
|
-
"600": "#7f56d9",
|
|
224
|
-
"700": "#6941c6"
|
|
225
|
-
},
|
|
226
|
-
teal: {
|
|
227
|
-
"50": "#f0fdf9",
|
|
228
|
-
"500": "#15b79e",
|
|
229
|
-
"600": "#0e9384",
|
|
230
|
-
"700": "#107569"
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
text: {
|
|
234
|
-
primary: "#101828",
|
|
235
|
-
secondary: "#475467",
|
|
236
|
-
tertiary: "#667085",
|
|
237
|
-
disabled: "#c9d0db",
|
|
238
|
-
brand: "#e8601a",
|
|
239
|
-
inverse: "#f1f5f9",
|
|
240
|
-
error: "#d92d20",
|
|
241
|
-
success: "#039855",
|
|
242
|
-
warning: "#b54708"
|
|
243
|
-
},
|
|
244
|
-
bg: {
|
|
245
|
-
white: "#ffffff",
|
|
246
|
-
subtle: "#f9fafb",
|
|
247
|
-
surfaceHover: "#f1f5f9",
|
|
248
|
-
brand: "#fff4ee",
|
|
249
|
-
error: "#fef3f2",
|
|
250
|
-
success: "#ecfdf3",
|
|
251
|
-
warning: "#fffaeb",
|
|
252
|
-
neutral: "#f9fafb",
|
|
253
|
-
purple: "#f9f5ff",
|
|
254
|
-
blue: "#eff8ff",
|
|
255
|
-
teal: "#f0fdf9"
|
|
256
|
-
},
|
|
257
|
-
border: {
|
|
258
|
-
default: "#d6dce6",
|
|
259
|
-
subtle: "#f1f5f9",
|
|
260
|
-
strong: "#98a2b3",
|
|
261
|
-
brand: "#fe6d36",
|
|
262
|
-
error: "#fda29b"
|
|
263
|
-
},
|
|
264
|
-
shadow: {
|
|
265
|
-
xs: "0 1px 2px 0 rgba(16, 24, 40, 0.05)",
|
|
266
|
-
sm: "0 1px 3px 0 rgba(16, 24, 40, 0.1), 0 1px 2px -1px rgba(16, 24, 40, 0.1)",
|
|
267
|
-
md: "0 4px 6px -1px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.1)",
|
|
268
|
-
pressed: "inset 0 0 4px 0 rgba(0, 0, 0, 0.15)"
|
|
269
|
-
},
|
|
270
|
-
radius: {
|
|
271
|
-
xs: "2px",
|
|
272
|
-
sm: "4px",
|
|
273
|
-
md: "8px",
|
|
274
|
-
lg: "12px",
|
|
275
|
-
xl: "16px",
|
|
276
|
-
full: "9999px"
|
|
277
|
-
},
|
|
278
|
-
spacing: {
|
|
279
|
-
"0": "0px",
|
|
280
|
-
"1": "2px",
|
|
281
|
-
"2": "4px",
|
|
282
|
-
"3": "6px",
|
|
283
|
-
"4": "8px",
|
|
284
|
-
"5": "10px",
|
|
285
|
-
"6": "12px",
|
|
286
|
-
"7": "14px",
|
|
287
|
-
"8": "16px",
|
|
288
|
-
"9": "18px",
|
|
289
|
-
"10": "20px",
|
|
290
|
-
"12": "24px",
|
|
291
|
-
"16": "32px"
|
|
292
|
-
},
|
|
293
|
-
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
294
|
-
fontWeight: {
|
|
295
|
-
regular: "400",
|
|
296
|
-
medium: "500",
|
|
297
|
-
semibold: "600",
|
|
298
|
-
bold: "700"
|
|
299
|
-
},
|
|
300
|
-
fontSize: {
|
|
301
|
-
"2xs": "10px",
|
|
302
|
-
xs: "11px",
|
|
303
|
-
sm: "12px",
|
|
304
|
-
md: "14px",
|
|
305
|
-
lg: "16px",
|
|
306
|
-
xl: "18px"
|
|
307
|
-
},
|
|
308
|
-
lineHeight: {
|
|
309
|
-
"2xs": "14px",
|
|
310
|
-
xs: "16px",
|
|
311
|
-
sm: "18px",
|
|
312
|
-
md: "20px",
|
|
313
|
-
lg: "24px",
|
|
314
|
-
xl: "28px"
|
|
315
|
-
},
|
|
316
|
-
other: {},
|
|
317
|
-
components: {}
|
|
318
|
-
};
|
|
10
|
+
var _chunkXF7A3MNWcjs = require('./chunk-XF7A3MNW.cjs');
|
|
319
11
|
|
|
320
|
-
// src/theme/createTheme.ts
|
|
321
|
-
function isPlainObject(value) {
|
|
322
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
323
|
-
}
|
|
324
|
-
function deepMerge(target, source) {
|
|
325
|
-
const result = { ...target };
|
|
326
|
-
for (const key of Object.keys(source)) {
|
|
327
|
-
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
328
|
-
result[key] = deepMerge(
|
|
329
|
-
target[key],
|
|
330
|
-
source[key]
|
|
331
|
-
);
|
|
332
|
-
} else {
|
|
333
|
-
result[key] = source[key];
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return result;
|
|
337
|
-
}
|
|
338
|
-
function createTheme(override) {
|
|
339
|
-
return deepMerge(
|
|
340
|
-
DEFAULT_THEME,
|
|
341
|
-
override
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
12
|
|
|
345
|
-
|
|
346
|
-
var import_react8 = require("react");
|
|
13
|
+
var _chunkHAG5EYQ5cjs = require('./chunk-HAG5EYQ5.cjs');
|
|
347
14
|
|
|
348
|
-
// src/theme/ThemeContext.ts
|
|
349
|
-
var import_react5 = require("react");
|
|
350
|
-
var ThemeContext = (0, import_react5.createContext)(DEFAULT_THEME);
|
|
351
15
|
|
|
352
|
-
// src/theme/ColorSchemeProvider.tsx
|
|
353
|
-
var import_react7 = require("react");
|
|
354
16
|
|
|
355
|
-
// src/theme/ColorSchemeContext.ts
|
|
356
|
-
var import_react6 = require("react");
|
|
357
|
-
var ColorSchemeContext = (0, import_react6.createContext)({
|
|
358
|
-
colorScheme: "light",
|
|
359
|
-
resolvedColorScheme: "light",
|
|
360
|
-
setColorScheme: () => {
|
|
361
|
-
},
|
|
362
|
-
toggleColorScheme: () => {
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
17
|
|
|
366
|
-
|
|
367
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
368
|
-
var STORAGE_KEY = "xc-color-scheme";
|
|
369
|
-
function getSystemPreference() {
|
|
370
|
-
if (typeof window === "undefined") return "light";
|
|
371
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
372
|
-
}
|
|
373
|
-
function readStorage() {
|
|
374
|
-
if (typeof window === "undefined") return null;
|
|
375
|
-
try {
|
|
376
|
-
const stored = window.localStorage.getItem(STORAGE_KEY);
|
|
377
|
-
if (stored === "light" || stored === "dark" || stored === "auto") return stored;
|
|
378
|
-
} catch {
|
|
379
|
-
}
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
function applyToDOM(resolved, getRootElement) {
|
|
383
|
-
if (typeof document === "undefined") return;
|
|
384
|
-
const root = getRootElement ? getRootElement() : document.documentElement;
|
|
385
|
-
if (root) root.setAttribute("data-theme", resolved);
|
|
386
|
-
}
|
|
387
|
-
function ColorSchemeProvider({
|
|
388
|
-
defaultColorScheme = "light",
|
|
389
|
-
forceColorScheme,
|
|
390
|
-
storageKey = STORAGE_KEY,
|
|
391
|
-
getRootElement,
|
|
392
|
-
children
|
|
393
|
-
}) {
|
|
394
|
-
const [colorScheme, setColorSchemeRaw] = (0, import_react7.useState)(() => {
|
|
395
|
-
if (forceColorScheme) return forceColorScheme;
|
|
396
|
-
if (typeof window !== "undefined" && storageKey !== STORAGE_KEY) {
|
|
397
|
-
try {
|
|
398
|
-
const v = window.localStorage.getItem(storageKey);
|
|
399
|
-
if (v === "light" || v === "dark" || v === "auto") return v;
|
|
400
|
-
} catch {
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return readStorage() ?? defaultColorScheme;
|
|
404
|
-
});
|
|
405
|
-
const [systemPreference, setSystemPreference] = (0, import_react7.useState)(getSystemPreference);
|
|
406
|
-
const resolvedColorScheme = forceColorScheme ?? (colorScheme === "auto" ? systemPreference : colorScheme);
|
|
407
|
-
(0, import_react7.useEffect)(() => {
|
|
408
|
-
if (typeof window === "undefined") return;
|
|
409
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
410
|
-
const handler = (e) => {
|
|
411
|
-
setSystemPreference(e.matches ? "dark" : "light");
|
|
412
|
-
};
|
|
413
|
-
mq.addEventListener("change", handler);
|
|
414
|
-
return () => mq.removeEventListener("change", handler);
|
|
415
|
-
}, []);
|
|
416
|
-
(0, import_react7.useEffect)(() => {
|
|
417
|
-
if (typeof window === "undefined") return;
|
|
418
|
-
const handler = (e) => {
|
|
419
|
-
if (e.key !== storageKey) return;
|
|
420
|
-
const val = e.newValue;
|
|
421
|
-
if (val === "light" || val === "dark" || val === "auto") {
|
|
422
|
-
setColorSchemeRaw(val);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
window.addEventListener("storage", handler);
|
|
426
|
-
return () => window.removeEventListener("storage", handler);
|
|
427
|
-
}, [storageKey]);
|
|
428
|
-
(0, import_react7.useEffect)(() => {
|
|
429
|
-
applyToDOM(resolvedColorScheme, getRootElement);
|
|
430
|
-
}, [resolvedColorScheme, getRootElement]);
|
|
431
|
-
const setColorScheme = (0, import_react7.useCallback)((scheme) => {
|
|
432
|
-
if (forceColorScheme) return;
|
|
433
|
-
setColorSchemeRaw(scheme);
|
|
434
|
-
try {
|
|
435
|
-
window.localStorage.setItem(storageKey, scheme);
|
|
436
|
-
} catch {
|
|
437
|
-
}
|
|
438
|
-
}, [forceColorScheme, storageKey]);
|
|
439
|
-
const toggleColorScheme = (0, import_react7.useCallback)(() => {
|
|
440
|
-
setColorScheme(resolvedColorScheme === "dark" ? "light" : "dark");
|
|
441
|
-
}, [resolvedColorScheme, setColorScheme]);
|
|
442
|
-
const value = (0, import_react7.useMemo)(() => ({
|
|
443
|
-
colorScheme,
|
|
444
|
-
resolvedColorScheme,
|
|
445
|
-
setColorScheme,
|
|
446
|
-
toggleColorScheme
|
|
447
|
-
}), [colorScheme, resolvedColorScheme, setColorScheme, toggleColorScheme]);
|
|
448
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ColorSchemeContext.Provider, { value, children });
|
|
449
|
-
}
|
|
18
|
+
var _chunk2JYR6C3Lcjs = require('./chunk-2JYR6C3L.cjs');
|
|
450
19
|
|
|
451
|
-
// src/theme/ThemeProvider.tsx
|
|
452
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
453
|
-
function camelToKebab(str) {
|
|
454
|
-
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
455
|
-
}
|
|
456
|
-
function themeOverrideToCssVars(override) {
|
|
457
|
-
const vars = {};
|
|
458
|
-
if (override.colors) {
|
|
459
|
-
for (const [scale, shades] of Object.entries(override.colors)) {
|
|
460
|
-
for (const [shade, value] of Object.entries(shades)) {
|
|
461
|
-
vars[`--xc-color-${camelToKebab(scale)}-${shade}`] = value;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
if (override.text) {
|
|
466
|
-
for (const [key, value] of Object.entries(override.text)) {
|
|
467
|
-
vars[`--xc-color-text-${camelToKebab(key)}`] = value;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
if (override.bg) {
|
|
471
|
-
for (const [key, value] of Object.entries(override.bg)) {
|
|
472
|
-
vars[`--xc-color-bg-${camelToKebab(key)}`] = value;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
if (override.border) {
|
|
476
|
-
for (const [key, value] of Object.entries(override.border)) {
|
|
477
|
-
vars[`--xc-color-border-${camelToKebab(key)}`] = value;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (override.shadow) {
|
|
481
|
-
for (const [key, value] of Object.entries(override.shadow)) {
|
|
482
|
-
vars[`--xc-shadow-${camelToKebab(key)}`] = value;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
if (override.radius) {
|
|
486
|
-
for (const [key, value] of Object.entries(override.radius)) {
|
|
487
|
-
vars[`--xc-radius-${camelToKebab(key)}`] = value;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
if (override.spacing) {
|
|
491
|
-
for (const [key, value] of Object.entries(override.spacing)) {
|
|
492
|
-
vars[`--xc-space-${key}`] = value;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
if (override.fontFamily) {
|
|
496
|
-
vars["--xc-font-family"] = override.fontFamily;
|
|
497
|
-
}
|
|
498
|
-
if (override.fontWeight) {
|
|
499
|
-
for (const [key, value] of Object.entries(override.fontWeight)) {
|
|
500
|
-
vars[`--xc-font-weight-${camelToKebab(key)}`] = value;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (override.fontSize) {
|
|
504
|
-
for (const [key, value] of Object.entries(override.fontSize)) {
|
|
505
|
-
vars[`--xc-font-size-${key}`] = value;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if (override.lineHeight) {
|
|
509
|
-
for (const [key, value] of Object.entries(override.lineHeight)) {
|
|
510
|
-
vars[`--xc-line-height-${key}`] = value;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return vars;
|
|
514
|
-
}
|
|
515
|
-
function ThemeProvider({
|
|
516
|
-
theme: themeOverride = {},
|
|
517
|
-
cssVariablesSelector = ":root",
|
|
518
|
-
defaultColorScheme = "light",
|
|
519
|
-
forceColorScheme,
|
|
520
|
-
colorSchemeStorageKey,
|
|
521
|
-
getRootElement,
|
|
522
|
-
children
|
|
523
|
-
}) {
|
|
524
|
-
const resolvedTheme = (0, import_react8.useMemo)(
|
|
525
|
-
() => createTheme(themeOverride),
|
|
526
|
-
[themeOverride]
|
|
527
|
-
);
|
|
528
|
-
const cssText = (0, import_react8.useMemo)(() => {
|
|
529
|
-
const vars = themeOverrideToCssVars(themeOverride);
|
|
530
|
-
const entries = Object.entries(vars);
|
|
531
|
-
if (entries.length === 0) return "";
|
|
532
|
-
const declarations = entries.map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
533
|
-
return `${cssVariablesSelector} {
|
|
534
|
-
${declarations}
|
|
535
|
-
}`;
|
|
536
|
-
}, [themeOverride, cssVariablesSelector]);
|
|
537
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
538
|
-
ColorSchemeProvider,
|
|
539
|
-
{
|
|
540
|
-
defaultColorScheme,
|
|
541
|
-
forceColorScheme,
|
|
542
|
-
storageKey: colorSchemeStorageKey,
|
|
543
|
-
getRootElement,
|
|
544
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ThemeContext.Provider, { value: resolvedTheme, children: [
|
|
545
|
-
cssText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("style", { "data-xc-theme": "", children: cssText }),
|
|
546
|
-
children
|
|
547
|
-
] })
|
|
548
|
-
}
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
20
|
|
|
552
|
-
// src/theme/useTheme.ts
|
|
553
|
-
var import_react9 = require("react");
|
|
554
|
-
function useTheme() {
|
|
555
|
-
return (0, import_react9.useContext)(ThemeContext);
|
|
556
|
-
}
|
|
557
21
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
22
|
+
var _chunk73U3B3WXcjs = require('./chunk-73U3B3WX.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkWUV742E6cjs = require('./chunk-WUV742E6.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunkSRXGVBJ5cjs = require('./chunk-SRXGVBJ5.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.Badge = _chunkJKYZDOSJcjs.Badge; exports.ColorSchemeProvider = _chunk2JYR6C3Lcjs.ColorSchemeProvider; exports.DEFAULT_THEME = _chunkWUV742E6cjs.DEFAULT_THEME; exports.Directory = _chunkXF7A3MNWcjs.Directory; exports.Label = _chunkRXHOBQUJcjs.Label; exports.ListItem = _chunkHAG5EYQ5cjs.ListItem; exports.ThemeProvider = _chunk2JYR6C3Lcjs.ThemeProvider; exports.createTheme = _chunk2JYR6C3Lcjs.createTheme; exports.resolveSx = _chunkSRXGVBJ5cjs.resolveSx; exports.useColorScheme = _chunk73U3B3WXcjs.useColorScheme; exports.useTheme = _chunk73U3B3WXcjs.useTheme;
|
|
576
42
|
//# sourceMappingURL=index.cjs.map
|