@abhir9/pd-design-system 0.1.0
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/index.cjs +1399 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1071 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1477 -0
- package/dist/index.d.ts +1477 -0
- package/dist/index.js +1331 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +38 -0
- package/package.json +140 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1399 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
5
|
+
var LucideIcons = require('lucide-react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
31
|
+
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
32
|
+
|
|
33
|
+
// src/theme/types.ts
|
|
34
|
+
var THEME_MODES = ["light", "dark"];
|
|
35
|
+
var THEME_NAMES = ["base", "brand"];
|
|
36
|
+
var ADAPTER_TYPES = ["shadcn", "material"];
|
|
37
|
+
|
|
38
|
+
// src/theme/config.ts
|
|
39
|
+
var [DEFAULT_ADAPTER] = ADAPTER_TYPES;
|
|
40
|
+
var [DEFAULT_THEME] = THEME_NAMES;
|
|
41
|
+
var [DEFAULT_MODE] = THEME_MODES;
|
|
42
|
+
var globalConfig = {
|
|
43
|
+
adapter: DEFAULT_ADAPTER,
|
|
44
|
+
theme: DEFAULT_THEME,
|
|
45
|
+
mode: DEFAULT_MODE
|
|
46
|
+
};
|
|
47
|
+
function setDesignSystemConfig(config) {
|
|
48
|
+
globalConfig = { ...globalConfig, ...config };
|
|
49
|
+
}
|
|
50
|
+
function getDesignSystemConfig() {
|
|
51
|
+
return { ...globalConfig };
|
|
52
|
+
}
|
|
53
|
+
function getAdapter() {
|
|
54
|
+
return globalConfig.adapter;
|
|
55
|
+
}
|
|
56
|
+
function getThemeName() {
|
|
57
|
+
return globalConfig.theme;
|
|
58
|
+
}
|
|
59
|
+
function getThemeMode() {
|
|
60
|
+
return globalConfig.mode;
|
|
61
|
+
}
|
|
62
|
+
function cn(...inputs) {
|
|
63
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
64
|
+
}
|
|
65
|
+
var ButtonPrimitive = React.forwardRef(
|
|
66
|
+
({ asChild = false, type = "button", children, ...props }, ref) => {
|
|
67
|
+
if (asChild && React__default.default.isValidElement(children)) {
|
|
68
|
+
return React__default.default.cloneElement(children, {
|
|
69
|
+
...props,
|
|
70
|
+
ref,
|
|
71
|
+
type
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
ref,
|
|
78
|
+
type,
|
|
79
|
+
...props,
|
|
80
|
+
children
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
ButtonPrimitive.displayName = "ButtonPrimitive";
|
|
86
|
+
var iconCache = /* @__PURE__ */ new Map();
|
|
87
|
+
var loggedIcons = /* @__PURE__ */ new Set();
|
|
88
|
+
function getIcon(iconName) {
|
|
89
|
+
if (!iconName || typeof iconName !== "string") {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (iconCache.has(iconName)) {
|
|
93
|
+
return iconCache.get(iconName) || null;
|
|
94
|
+
}
|
|
95
|
+
let IconComponent = null;
|
|
96
|
+
if (iconName in LucideIcons__namespace) {
|
|
97
|
+
IconComponent = LucideIcons__namespace[iconName];
|
|
98
|
+
} else {
|
|
99
|
+
const pascalCaseName = iconName.charAt(0).toUpperCase() + iconName.slice(1);
|
|
100
|
+
if (pascalCaseName in LucideIcons__namespace) {
|
|
101
|
+
IconComponent = LucideIcons__namespace[pascalCaseName];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (IconComponent) {
|
|
105
|
+
const isValidComponent = typeof IconComponent === "function" || typeof IconComponent === "object" && IconComponent !== null;
|
|
106
|
+
if (isValidComponent) {
|
|
107
|
+
iconCache.set(iconName, IconComponent);
|
|
108
|
+
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
109
|
+
if (!loggedIcons.has(iconName)) {
|
|
110
|
+
console.debug(`[pd-design] Icon "${iconName}" found and cached`);
|
|
111
|
+
loggedIcons.add(iconName);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return IconComponent;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (process.env.NODE_ENV !== "production") {
|
|
118
|
+
const availableIcons = Object.keys(LucideIcons__namespace).filter((k) => {
|
|
119
|
+
const icon = LucideIcons__namespace[k];
|
|
120
|
+
return !k.includes("Icon") && icon && (typeof icon === "function" || typeof icon === "object");
|
|
121
|
+
}).slice(0, 10);
|
|
122
|
+
console.warn(`[pd-design] Icon "${iconName}" not found in lucide-react. Available icons: ${availableIcons.join(", ")}...`);
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function renderIcon(iconName, size = "h-4 w-4", className) {
|
|
127
|
+
const IconComponent = getIcon(iconName);
|
|
128
|
+
if (!IconComponent) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return React__default.default.createElement(IconComponent, {
|
|
132
|
+
className: `${size} ${className || ""}`.trim()
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function iconExists(iconName) {
|
|
136
|
+
return getIcon(iconName) !== null;
|
|
137
|
+
}
|
|
138
|
+
function getAvailableIconNames() {
|
|
139
|
+
return Object.keys(LucideIcons__namespace).filter(
|
|
140
|
+
(name) => {
|
|
141
|
+
const icon = LucideIcons__namespace[name];
|
|
142
|
+
return icon && (typeof icon === "function" || typeof icon === "object") && !name.includes("Icon");
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
147
|
+
"inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pd-border-blue)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
148
|
+
{
|
|
149
|
+
variants: {
|
|
150
|
+
variant: {
|
|
151
|
+
primary: "",
|
|
152
|
+
secondary: "",
|
|
153
|
+
ghost: "",
|
|
154
|
+
outline: "border"
|
|
155
|
+
},
|
|
156
|
+
intent: {
|
|
157
|
+
primary: "",
|
|
158
|
+
success: "",
|
|
159
|
+
warning: "",
|
|
160
|
+
danger: "",
|
|
161
|
+
neutral: ""
|
|
162
|
+
},
|
|
163
|
+
size: {
|
|
164
|
+
sm: "h-8 px-3 text-sm",
|
|
165
|
+
md: "h-10 px-4 text-base",
|
|
166
|
+
lg: "h-12 px-6 text-lg"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
compoundVariants: [
|
|
170
|
+
// Primary variant - using new semantic tokens
|
|
171
|
+
{
|
|
172
|
+
variant: "primary",
|
|
173
|
+
intent: "primary",
|
|
174
|
+
class: "bg-[var(--pd-background-invert)] text-[var(--pd-content-onColor)] hover:bg-[var(--pd-background-invertLight)] active:bg-[var(--pd-background-invert)] disabled:bg-[var(--pd-background-secondary)] disabled:text-[var(--pd-content-subtle)]"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
variant: "primary",
|
|
178
|
+
intent: "success",
|
|
179
|
+
class: "bg-[var(--pd-background-green)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-greenOnHover)] active:bg-[var(--pd-background-green)] border-[var(--pd-border-green)]"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
variant: "primary",
|
|
183
|
+
intent: "warning",
|
|
184
|
+
class: "bg-[var(--pd-background-yellow)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-yellowOnHover)] active:bg-[var(--pd-background-yellow)] border-[var(--pd-border-yellow)]"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
variant: "primary",
|
|
188
|
+
intent: "danger",
|
|
189
|
+
class: "bg-[var(--pd-background-red)] text-[var(--pd-content-red)] hover:bg-[var(--pd-background-redOnHover)] hover:text-[var(--pd-content-redOnHover)] active:bg-[var(--pd-background-red)] border-[var(--pd-border-red)] disabled:bg-[var(--pd-background-red)] disabled:text-[var(--pd-content-subtle)]"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
variant: "primary",
|
|
193
|
+
intent: "neutral",
|
|
194
|
+
class: "bg-[var(--pd-background-secondary)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-lowOnHover)] active:bg-[var(--pd-background-tertiary)] border-[var(--pd-border-primary)]"
|
|
195
|
+
},
|
|
196
|
+
// Secondary variant - using new semantic tokens
|
|
197
|
+
{
|
|
198
|
+
variant: "secondary",
|
|
199
|
+
intent: "primary",
|
|
200
|
+
class: "bg-[var(--pd-background-secondary)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-lowOnHover)] active:bg-[var(--pd-background-secondary)] border border-[var(--pd-border-secondary)] disabled:bg-[var(--pd-background-tertiary)] disabled:text-[var(--pd-content-subtle)] disabled:border-[var(--pd-border-subtle)]"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
variant: "secondary",
|
|
204
|
+
intent: "success",
|
|
205
|
+
class: "bg-[var(--pd-background-green)] text-[var(--pd-content-green)] hover:bg-[var(--pd-background-greenOnHover)] active:bg-[var(--pd-background-green)] border-[var(--pd-border-greenSubtle)]"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
variant: "secondary",
|
|
209
|
+
intent: "warning",
|
|
210
|
+
class: "bg-[var(--pd-background-yellow)] text-[var(--pd-content-yellow)] hover:bg-[var(--pd-background-yellowOnHover)] active:bg-[var(--pd-background-yellow)] border-[var(--pd-border-yellowSubtle)]"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
variant: "secondary",
|
|
214
|
+
intent: "danger",
|
|
215
|
+
class: "bg-[var(--pd-background-red)] text-[var(--pd-content-red)] hover:bg-[var(--pd-background-redOnHover)] hover:text-[var(--pd-content-redOnHover)] active:bg-[var(--pd-background-red)] border border-[var(--pd-border-red)]"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
variant: "secondary",
|
|
219
|
+
intent: "neutral",
|
|
220
|
+
class: "bg-[var(--pd-background-low)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-lowOnHover)] active:bg-[var(--pd-background-tertiary)] border-[var(--pd-border-subtle)]"
|
|
221
|
+
},
|
|
222
|
+
// Ghost variant - using new semantic tokens
|
|
223
|
+
{
|
|
224
|
+
variant: "ghost",
|
|
225
|
+
intent: "primary",
|
|
226
|
+
class: "text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-low)] hover:text-[var(--pd-content-primary)] disabled:text-[var(--pd-content-subtle)]"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
variant: "ghost",
|
|
230
|
+
intent: "success",
|
|
231
|
+
class: "hover:bg-[var(--pd-background-green)] text-[var(--pd-content-green)] hover:text-[var(--pd-content-greenOnHover)]"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
variant: "ghost",
|
|
235
|
+
intent: "warning",
|
|
236
|
+
class: "hover:bg-[var(--pd-background-yellow)] text-[var(--pd-content-yellow)] hover:text-[var(--pd-content-yellowOnHover)]"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
variant: "ghost",
|
|
240
|
+
intent: "danger",
|
|
241
|
+
class: "text-[var(--pd-content-red)] hover:bg-[var(--pd-background-red)] hover:text-[var(--pd-content-redOnHover)]"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
variant: "ghost",
|
|
245
|
+
intent: "neutral",
|
|
246
|
+
class: "hover:bg-[var(--pd-background-low)] text-[var(--pd-content-secondary)] hover:text-[var(--pd-content-primary)]"
|
|
247
|
+
},
|
|
248
|
+
// Outline variant - using new semantic tokens
|
|
249
|
+
{
|
|
250
|
+
variant: "outline",
|
|
251
|
+
intent: "primary",
|
|
252
|
+
class: "border-[var(--pd-border-primary)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-low)] hover:border-[var(--pd-border-secondary)]"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
variant: "outline",
|
|
256
|
+
intent: "success",
|
|
257
|
+
class: "border-[var(--pd-border-green)] text-[var(--pd-content-green)] hover:bg-[var(--pd-background-green)] hover:border-[var(--pd-border-greenOnHover)]"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
variant: "outline",
|
|
261
|
+
intent: "warning",
|
|
262
|
+
class: "border-[var(--pd-border-yellow)] text-[var(--pd-content-yellow)] hover:bg-[var(--pd-background-yellow)] hover:border-[var(--pd-border-yellowOnHover)]"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
variant: "outline",
|
|
266
|
+
intent: "danger",
|
|
267
|
+
class: "border border-[var(--pd-border-red)] text-[var(--pd-content-red)] hover:bg-[var(--pd-background-red)] hover:text-[var(--pd-content-redOnHover)] hover:border-[var(--pd-border-redOnHover)]"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
variant: "outline",
|
|
271
|
+
intent: "neutral",
|
|
272
|
+
class: "border-[var(--pd-border-primary)] text-[var(--pd-content-primary)] hover:bg-[var(--pd-background-low)] hover:border-[var(--pd-border-secondary)]"
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
defaultVariants: {
|
|
276
|
+
variant: "primary",
|
|
277
|
+
intent: "primary",
|
|
278
|
+
size: "md"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
var ShadcnButton = React.forwardRef(
|
|
283
|
+
({
|
|
284
|
+
variant = "primary",
|
|
285
|
+
intent = "primary",
|
|
286
|
+
size = "md",
|
|
287
|
+
disabled,
|
|
288
|
+
loading,
|
|
289
|
+
fullWidth,
|
|
290
|
+
startIcon,
|
|
291
|
+
endIcon,
|
|
292
|
+
loadingText,
|
|
293
|
+
asChild,
|
|
294
|
+
href,
|
|
295
|
+
target,
|
|
296
|
+
children,
|
|
297
|
+
...props
|
|
298
|
+
}, ref) => {
|
|
299
|
+
if (process.env.NODE_ENV !== "production" && !children && (startIcon || endIcon) && !props["aria-label"]) {
|
|
300
|
+
console.warn(
|
|
301
|
+
"[pd-design] Icon-only buttons should have an aria-label for accessibility. Add aria-label prop to describe the button action."
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
const buttonClasses = cn(
|
|
305
|
+
buttonVariants({ variant, intent, size }),
|
|
306
|
+
fullWidth && "w-full"
|
|
307
|
+
);
|
|
308
|
+
if (href) {
|
|
309
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
ButtonPrimitive,
|
|
311
|
+
{
|
|
312
|
+
asChild: true,
|
|
313
|
+
...props,
|
|
314
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
315
|
+
"a",
|
|
316
|
+
{
|
|
317
|
+
href,
|
|
318
|
+
target,
|
|
319
|
+
rel: target === "_blank" ? "noopener noreferrer" : void 0,
|
|
320
|
+
className: buttonClasses,
|
|
321
|
+
"aria-disabled": disabled || loading,
|
|
322
|
+
style: { pointerEvents: disabled || loading ? "none" : void 0 },
|
|
323
|
+
children: renderButtonContent({ loading, loadingText, startIcon, endIcon, children, size })
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
+
ButtonPrimitive,
|
|
331
|
+
{
|
|
332
|
+
ref,
|
|
333
|
+
disabled: disabled || loading,
|
|
334
|
+
className: buttonClasses,
|
|
335
|
+
asChild,
|
|
336
|
+
...props,
|
|
337
|
+
children: renderButtonContent({ loading, loadingText, startIcon, endIcon, children, size })
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
function renderButtonContent({
|
|
343
|
+
loading,
|
|
344
|
+
loadingText,
|
|
345
|
+
startIcon,
|
|
346
|
+
endIcon,
|
|
347
|
+
children,
|
|
348
|
+
size
|
|
349
|
+
}) {
|
|
350
|
+
const iconSizeClass = size === "sm" ? "h-3 w-3" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
351
|
+
const spinnerSizeClass = size === "sm" ? "h-3 w-3" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
352
|
+
const iconSpacing = size === "sm" ? "mr-1.5" : size === "lg" ? "mr-2.5" : "mr-2";
|
|
353
|
+
const iconSpacingEnd = size === "sm" ? "ml-1.5" : size === "lg" ? "ml-2.5" : "ml-2";
|
|
354
|
+
if (loading) {
|
|
355
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
356
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
357
|
+
LucideIcons.Loader2,
|
|
358
|
+
{
|
|
359
|
+
"aria-hidden": "true",
|
|
360
|
+
className: `${spinnerSizeClass} ${iconSpacing} animate-spin text-[var(--pd-content-secondary)]`
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--pd-content-secondary)]", children: loadingText || children }),
|
|
364
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: loadingText ? `Loading: ${loadingText}` : "Loading" })
|
|
365
|
+
] });
|
|
366
|
+
}
|
|
367
|
+
const StartIconComponent = startIcon ? getIcon(startIcon) : null;
|
|
368
|
+
const EndIconComponent = endIcon ? getIcon(endIcon) : null;
|
|
369
|
+
const hasChildren = Boolean(children);
|
|
370
|
+
const startIconSpacing = hasChildren ? iconSpacing : "";
|
|
371
|
+
const endIconSpacing = hasChildren ? iconSpacingEnd : "";
|
|
372
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
373
|
+
StartIconComponent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${startIconSpacing} inline-flex items-center justify-center`, children: React__default.default.createElement(StartIconComponent, { className: iconSizeClass }) }),
|
|
374
|
+
children,
|
|
375
|
+
EndIconComponent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${endIconSpacing} inline-flex items-center justify-center`, children: React__default.default.createElement(EndIconComponent, { className: iconSizeClass }) })
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
ShadcnButton.displayName = "ShadcnButton";
|
|
379
|
+
var buttonGroupVariants = classVarianceAuthority.cva(
|
|
380
|
+
"inline-flex",
|
|
381
|
+
{
|
|
382
|
+
variants: {
|
|
383
|
+
orientation: {
|
|
384
|
+
horizontal: "flex-row",
|
|
385
|
+
vertical: "flex-col"
|
|
386
|
+
},
|
|
387
|
+
gap: {
|
|
388
|
+
sm: "gap-1",
|
|
389
|
+
md: "gap-2",
|
|
390
|
+
lg: "gap-3"
|
|
391
|
+
},
|
|
392
|
+
fullWidth: {
|
|
393
|
+
true: "w-full",
|
|
394
|
+
false: ""
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
defaultVariants: {
|
|
398
|
+
orientation: "horizontal",
|
|
399
|
+
gap: "md",
|
|
400
|
+
fullWidth: false
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
var ShadcnButtonGroup = React.forwardRef(
|
|
405
|
+
({
|
|
406
|
+
orientation = "horizontal",
|
|
407
|
+
gap = "md",
|
|
408
|
+
fullWidth = false,
|
|
409
|
+
children,
|
|
410
|
+
className,
|
|
411
|
+
...props
|
|
412
|
+
}, ref) => {
|
|
413
|
+
const groupClasses = cn(
|
|
414
|
+
buttonGroupVariants({ orientation, gap, fullWidth }),
|
|
415
|
+
className
|
|
416
|
+
);
|
|
417
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
418
|
+
"div",
|
|
419
|
+
{
|
|
420
|
+
ref,
|
|
421
|
+
className: groupClasses,
|
|
422
|
+
role: "group",
|
|
423
|
+
...props,
|
|
424
|
+
children
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
ShadcnButtonGroup.displayName = "ShadcnButtonGroup";
|
|
430
|
+
|
|
431
|
+
// src/adapters/index.ts
|
|
432
|
+
var [SHADCN_ADAPTER, MATERIAL_ADAPTER] = ADAPTER_TYPES;
|
|
433
|
+
function getButtonAdapter() {
|
|
434
|
+
const adapter = getAdapter();
|
|
435
|
+
switch (adapter) {
|
|
436
|
+
case SHADCN_ADAPTER:
|
|
437
|
+
return ShadcnButton;
|
|
438
|
+
case MATERIAL_ADAPTER:
|
|
439
|
+
console.warn("Material adapter not yet enabled. Install @mui/material to use it.");
|
|
440
|
+
return ShadcnButton;
|
|
441
|
+
default:
|
|
442
|
+
return ShadcnButton;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function getButtonGroupAdapter() {
|
|
446
|
+
const adapter = getAdapter();
|
|
447
|
+
switch (adapter) {
|
|
448
|
+
case SHADCN_ADAPTER:
|
|
449
|
+
return ShadcnButtonGroup;
|
|
450
|
+
case MATERIAL_ADAPTER:
|
|
451
|
+
return ShadcnButtonGroup;
|
|
452
|
+
default:
|
|
453
|
+
return ShadcnButtonGroup;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
var Button = React.forwardRef(
|
|
457
|
+
({
|
|
458
|
+
variant = "primary",
|
|
459
|
+
intent = "primary",
|
|
460
|
+
size = "md",
|
|
461
|
+
loading,
|
|
462
|
+
disabled,
|
|
463
|
+
fullWidth,
|
|
464
|
+
startIcon,
|
|
465
|
+
endIcon,
|
|
466
|
+
loadingText,
|
|
467
|
+
href,
|
|
468
|
+
target,
|
|
469
|
+
children,
|
|
470
|
+
...props
|
|
471
|
+
}, ref) => {
|
|
472
|
+
const AdapterButton = getButtonAdapter();
|
|
473
|
+
const { className, ...restProps } = props;
|
|
474
|
+
if (className) {
|
|
475
|
+
console.warn("Button component does not accept className prop. Use variant, intent, size, and other props for styling.");
|
|
476
|
+
}
|
|
477
|
+
const accessibilityProps = React.useMemo(() => {
|
|
478
|
+
const defaults = {};
|
|
479
|
+
if (disabled || loading) {
|
|
480
|
+
defaults["aria-disabled"] = true;
|
|
481
|
+
}
|
|
482
|
+
if (loading) {
|
|
483
|
+
defaults["aria-busy"] = true;
|
|
484
|
+
}
|
|
485
|
+
return defaults;
|
|
486
|
+
}, [disabled, loading]);
|
|
487
|
+
const mergedProps = {
|
|
488
|
+
...restProps,
|
|
489
|
+
...accessibilityProps
|
|
490
|
+
};
|
|
491
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
|
+
AdapterButton,
|
|
493
|
+
{
|
|
494
|
+
ref,
|
|
495
|
+
variant,
|
|
496
|
+
intent,
|
|
497
|
+
size,
|
|
498
|
+
disabled,
|
|
499
|
+
loading,
|
|
500
|
+
fullWidth,
|
|
501
|
+
startIcon,
|
|
502
|
+
endIcon,
|
|
503
|
+
loadingText,
|
|
504
|
+
href,
|
|
505
|
+
target,
|
|
506
|
+
...mergedProps,
|
|
507
|
+
children
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
Button.displayName = "Button";
|
|
513
|
+
var ButtonGroup = React.forwardRef(
|
|
514
|
+
({
|
|
515
|
+
orientation = "horizontal",
|
|
516
|
+
gap = "md",
|
|
517
|
+
fullWidth = false,
|
|
518
|
+
children,
|
|
519
|
+
...props
|
|
520
|
+
}, ref) => {
|
|
521
|
+
const AdapterButtonGroup = getButtonGroupAdapter();
|
|
522
|
+
const { className, ...restProps } = props;
|
|
523
|
+
if (className) {
|
|
524
|
+
console.warn("ButtonGroup component does not accept className prop. Use orientation, gap, fullWidth, and other props for styling.");
|
|
525
|
+
}
|
|
526
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
527
|
+
AdapterButtonGroup,
|
|
528
|
+
{
|
|
529
|
+
ref,
|
|
530
|
+
orientation,
|
|
531
|
+
gap,
|
|
532
|
+
fullWidth,
|
|
533
|
+
...restProps,
|
|
534
|
+
children
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
540
|
+
|
|
541
|
+
// src/tokens/base.ts
|
|
542
|
+
var neutral = {
|
|
543
|
+
100: "#FFFFFF",
|
|
544
|
+
200: "#EDEDED",
|
|
545
|
+
300: "#DFDFE2",
|
|
546
|
+
400: "#BEBEC1",
|
|
547
|
+
500: "#7E7E8B",
|
|
548
|
+
600: "#60606C",
|
|
549
|
+
700: "#4E4E5A",
|
|
550
|
+
800: "#2F2F37",
|
|
551
|
+
900: "#17171C",
|
|
552
|
+
950: "#09090B",
|
|
553
|
+
1e3: "#FAFAFA"
|
|
554
|
+
};
|
|
555
|
+
var blue = {
|
|
556
|
+
100: "#EBF1FF",
|
|
557
|
+
200: "#C2D4FF",
|
|
558
|
+
300: "#99B7FF",
|
|
559
|
+
400: "#709AFF",
|
|
560
|
+
500: "#3772FF",
|
|
561
|
+
600: "#004BFF",
|
|
562
|
+
700: "#003FD6",
|
|
563
|
+
800: "#002680",
|
|
564
|
+
900: "#001E66",
|
|
565
|
+
950: "#00123D"
|
|
566
|
+
};
|
|
567
|
+
var orange = {
|
|
568
|
+
100: "#FFF3EB",
|
|
569
|
+
200: "#FFE1CC",
|
|
570
|
+
300: "#FFC9A3",
|
|
571
|
+
400: "#EC9C64",
|
|
572
|
+
500: "#FF6800",
|
|
573
|
+
600: "#D65700",
|
|
574
|
+
700: "#AD4700",
|
|
575
|
+
800: "#7A3200",
|
|
576
|
+
900: "#5C2500",
|
|
577
|
+
950: "#331500"
|
|
578
|
+
};
|
|
579
|
+
var red = {
|
|
580
|
+
100: "#FDF2F4",
|
|
581
|
+
200: "#FADBE1",
|
|
582
|
+
300: "#F6C1CA",
|
|
583
|
+
400: "#E15C5C",
|
|
584
|
+
500: "#E12D4E",
|
|
585
|
+
600: "#C41C3B",
|
|
586
|
+
700: "#A11730",
|
|
587
|
+
800: "#7D1225",
|
|
588
|
+
900: "#4C0B17",
|
|
589
|
+
950: "#2D060D"
|
|
590
|
+
};
|
|
591
|
+
var green = {
|
|
592
|
+
100: "#E0FFEC",
|
|
593
|
+
200: "#BDFFD5",
|
|
594
|
+
300: "#8AFFB5",
|
|
595
|
+
400: "#5CFF98",
|
|
596
|
+
500: "#09FF63",
|
|
597
|
+
600: "#00E052",
|
|
598
|
+
700: "#00B241",
|
|
599
|
+
800: "#008A32",
|
|
600
|
+
900: "#006625",
|
|
601
|
+
950: "#00471A"
|
|
602
|
+
};
|
|
603
|
+
var yellow = {
|
|
604
|
+
100: "#FFF4E0",
|
|
605
|
+
200: "#FFE8C2",
|
|
606
|
+
300: "#FFD999",
|
|
607
|
+
400: "#FFCA70",
|
|
608
|
+
500: "#FFAD22",
|
|
609
|
+
600: "#F09700",
|
|
610
|
+
700: "#D68700",
|
|
611
|
+
800: "#7A4D00",
|
|
612
|
+
900: "#5C3A00",
|
|
613
|
+
950: "#3D2600"
|
|
614
|
+
};
|
|
615
|
+
var colorPrimitives = {
|
|
616
|
+
neutral,
|
|
617
|
+
blue,
|
|
618
|
+
orange,
|
|
619
|
+
red,
|
|
620
|
+
green,
|
|
621
|
+
yellow
|
|
622
|
+
};
|
|
623
|
+
var colors = {
|
|
624
|
+
// Neutral palette (mapped from new scale)
|
|
625
|
+
white: neutral[100],
|
|
626
|
+
black: neutral[950],
|
|
627
|
+
gray50: neutral[200],
|
|
628
|
+
gray100: neutral[300],
|
|
629
|
+
gray200: neutral[400],
|
|
630
|
+
gray300: neutral[500],
|
|
631
|
+
gray400: neutral[500],
|
|
632
|
+
gray500: neutral[500],
|
|
633
|
+
gray600: neutral[600],
|
|
634
|
+
gray700: neutral[700],
|
|
635
|
+
gray800: neutral[800],
|
|
636
|
+
gray900: neutral[900],
|
|
637
|
+
// Primary palette (mapped from blue)
|
|
638
|
+
blue50: blue[100],
|
|
639
|
+
blue100: blue[100],
|
|
640
|
+
blue200: blue[200],
|
|
641
|
+
blue300: blue[300],
|
|
642
|
+
blue400: blue[400],
|
|
643
|
+
blue500: blue[500],
|
|
644
|
+
blue600: blue[600],
|
|
645
|
+
blue700: blue[700],
|
|
646
|
+
blue800: blue[800],
|
|
647
|
+
blue900: blue[900],
|
|
648
|
+
// Success palette (mapped from green)
|
|
649
|
+
green50: green[100],
|
|
650
|
+
green100: green[100],
|
|
651
|
+
green200: green[200],
|
|
652
|
+
green300: green[300],
|
|
653
|
+
green400: green[400],
|
|
654
|
+
green500: green[500],
|
|
655
|
+
green600: green[600],
|
|
656
|
+
green700: green[700],
|
|
657
|
+
green800: green[800],
|
|
658
|
+
green900: green[900],
|
|
659
|
+
// Warning palette (mapped from yellow)
|
|
660
|
+
yellow50: yellow[100],
|
|
661
|
+
yellow100: yellow[100],
|
|
662
|
+
yellow200: yellow[200],
|
|
663
|
+
yellow300: yellow[300],
|
|
664
|
+
yellow400: yellow[400],
|
|
665
|
+
yellow500: yellow[500],
|
|
666
|
+
yellow600: yellow[600],
|
|
667
|
+
yellow700: yellow[700],
|
|
668
|
+
yellow800: yellow[800],
|
|
669
|
+
yellow900: yellow[900],
|
|
670
|
+
// Danger palette (mapped from red)
|
|
671
|
+
red50: red[100],
|
|
672
|
+
red100: red[100],
|
|
673
|
+
red200: red[200],
|
|
674
|
+
red300: red[300],
|
|
675
|
+
red400: red[400],
|
|
676
|
+
red500: red[500],
|
|
677
|
+
red600: red[600],
|
|
678
|
+
red700: red[700],
|
|
679
|
+
red800: red[800],
|
|
680
|
+
red900: red[900]
|
|
681
|
+
};
|
|
682
|
+
var typography = {
|
|
683
|
+
fontFamily: {
|
|
684
|
+
sans: ["Gist", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "sans-serif"],
|
|
685
|
+
mono: ["Gist Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", "monospace"]
|
|
686
|
+
},
|
|
687
|
+
fontSize: {
|
|
688
|
+
xs: "0.75rem",
|
|
689
|
+
// 12px
|
|
690
|
+
sm: "0.875rem",
|
|
691
|
+
// 14px
|
|
692
|
+
base: "1rem",
|
|
693
|
+
// 16px
|
|
694
|
+
lg: "1.125rem",
|
|
695
|
+
// 18px
|
|
696
|
+
xl: "1.25rem",
|
|
697
|
+
// 20px
|
|
698
|
+
"2xl": "1.5rem",
|
|
699
|
+
// 24px
|
|
700
|
+
"3xl": "1.875rem",
|
|
701
|
+
// 30px
|
|
702
|
+
"4xl": "2.25rem",
|
|
703
|
+
// 36px
|
|
704
|
+
"5xl": "3rem"
|
|
705
|
+
// 48px
|
|
706
|
+
},
|
|
707
|
+
fontWeight: {
|
|
708
|
+
normal: "400",
|
|
709
|
+
medium: "500",
|
|
710
|
+
semibold: "600",
|
|
711
|
+
bold: "700"
|
|
712
|
+
},
|
|
713
|
+
lineHeight: {
|
|
714
|
+
tight: "1.25",
|
|
715
|
+
normal: "1.5",
|
|
716
|
+
relaxed: "1.75"
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
var spacing = {
|
|
720
|
+
0: "0",
|
|
721
|
+
1: "0.25rem",
|
|
722
|
+
// 4px
|
|
723
|
+
2: "0.5rem",
|
|
724
|
+
// 8px
|
|
725
|
+
3: "0.75rem",
|
|
726
|
+
// 12px
|
|
727
|
+
4: "1rem",
|
|
728
|
+
// 16px
|
|
729
|
+
5: "1.25rem",
|
|
730
|
+
// 20px
|
|
731
|
+
6: "1.5rem",
|
|
732
|
+
// 24px
|
|
733
|
+
8: "2rem",
|
|
734
|
+
// 32px
|
|
735
|
+
10: "2.5rem",
|
|
736
|
+
// 40px
|
|
737
|
+
12: "3rem",
|
|
738
|
+
// 48px
|
|
739
|
+
16: "4rem",
|
|
740
|
+
// 64px
|
|
741
|
+
20: "5rem",
|
|
742
|
+
// 80px
|
|
743
|
+
24: "6rem"
|
|
744
|
+
// 96px
|
|
745
|
+
};
|
|
746
|
+
var radius = {
|
|
747
|
+
none: "0",
|
|
748
|
+
sm: "0.125rem",
|
|
749
|
+
// 2px
|
|
750
|
+
base: "0.25rem",
|
|
751
|
+
// 4px
|
|
752
|
+
md: "0.375rem",
|
|
753
|
+
// 6px
|
|
754
|
+
lg: "0.5rem",
|
|
755
|
+
// 8px
|
|
756
|
+
xl: "0.75rem",
|
|
757
|
+
// 12px
|
|
758
|
+
"2xl": "1rem",
|
|
759
|
+
// 16px
|
|
760
|
+
"3xl": "1.5rem",
|
|
761
|
+
// 24px
|
|
762
|
+
full: "9999px"
|
|
763
|
+
};
|
|
764
|
+
var shadows = {
|
|
765
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
766
|
+
base: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
767
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
768
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
769
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
770
|
+
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
|
|
771
|
+
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",
|
|
772
|
+
none: "none"
|
|
773
|
+
};
|
|
774
|
+
var zIndex = {
|
|
775
|
+
base: 0,
|
|
776
|
+
dropdown: 1e3,
|
|
777
|
+
sticky: 1020,
|
|
778
|
+
fixed: 1030,
|
|
779
|
+
modalBackdrop: 1040,
|
|
780
|
+
modal: 1050,
|
|
781
|
+
popover: 1060,
|
|
782
|
+
tooltip: 1070
|
|
783
|
+
};
|
|
784
|
+
var COLOR_SCALES = [100, 200, 300, 400, 500, 600, 700, 800, 900, 950, 1e3];
|
|
785
|
+
|
|
786
|
+
// src/tokens/semantic.ts
|
|
787
|
+
var borderTokens = {
|
|
788
|
+
dark: {
|
|
789
|
+
primary: neutral[700],
|
|
790
|
+
secondary: neutral[800],
|
|
791
|
+
subtle: neutral[800],
|
|
792
|
+
invert: neutral[100],
|
|
793
|
+
onColor: neutral[950],
|
|
794
|
+
blue: blue[400],
|
|
795
|
+
blueSubtle: blue[800],
|
|
796
|
+
blueOnHover: blue[500],
|
|
797
|
+
red: red[400],
|
|
798
|
+
redSubtle: red[900],
|
|
799
|
+
redOnHover: red[500],
|
|
800
|
+
orange: orange[400],
|
|
801
|
+
orangeSubtle: orange[900],
|
|
802
|
+
orangeOnHover: orange[500],
|
|
803
|
+
yellow: yellow[400],
|
|
804
|
+
yellowSubtle: yellow[900],
|
|
805
|
+
yellowOnHover: yellow[500],
|
|
806
|
+
green: green[600],
|
|
807
|
+
greenSubtle: green[900],
|
|
808
|
+
greenOnHover: green[700]
|
|
809
|
+
},
|
|
810
|
+
light: {
|
|
811
|
+
primary: neutral[400],
|
|
812
|
+
secondary: neutral[300],
|
|
813
|
+
subtle: neutral[300],
|
|
814
|
+
invert: neutral[950],
|
|
815
|
+
onColor: neutral[100],
|
|
816
|
+
blue: blue[500],
|
|
817
|
+
blueSubtle: blue[300],
|
|
818
|
+
blueOnHover: blue[700],
|
|
819
|
+
red: red[600],
|
|
820
|
+
redSubtle: red[300],
|
|
821
|
+
redOnHover: red[700],
|
|
822
|
+
orange: orange[600],
|
|
823
|
+
orangeSubtle: orange[300],
|
|
824
|
+
orangeOnHover: orange[700],
|
|
825
|
+
yellow: yellow[600],
|
|
826
|
+
yellowSubtle: yellow[300],
|
|
827
|
+
yellowOnHover: yellow[700],
|
|
828
|
+
green: green[600],
|
|
829
|
+
greenSubtle: green[300],
|
|
830
|
+
greenOnHover: green[700]
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
var contentTokens = {
|
|
834
|
+
dark: {
|
|
835
|
+
primary: neutral[300],
|
|
836
|
+
secondary: neutral[500],
|
|
837
|
+
subtle: neutral[700],
|
|
838
|
+
onColor: neutral[950],
|
|
839
|
+
alwaysWhite: neutral[100],
|
|
840
|
+
alwaysBlack: neutral[950],
|
|
841
|
+
onColorInverse: neutral[200],
|
|
842
|
+
blue: blue[400],
|
|
843
|
+
blueDisabled: blue[800],
|
|
844
|
+
blueOnHover: blue[500],
|
|
845
|
+
green: green[600],
|
|
846
|
+
greenDisabled: green[800],
|
|
847
|
+
greenOnHover: green[500],
|
|
848
|
+
red: red[400],
|
|
849
|
+
redDisabled: red[800],
|
|
850
|
+
redOnHover: red[300],
|
|
851
|
+
orange: orange[400],
|
|
852
|
+
orangeDisabled: orange[800],
|
|
853
|
+
orangeOnHover: orange[300],
|
|
854
|
+
yellow: yellow[400],
|
|
855
|
+
yellowDisabled: yellow[800],
|
|
856
|
+
yellowOnHover: yellow[300]
|
|
857
|
+
},
|
|
858
|
+
light: {
|
|
859
|
+
primary: neutral[900],
|
|
860
|
+
secondary: neutral[600],
|
|
861
|
+
subtle: neutral[400],
|
|
862
|
+
onColor: neutral[100],
|
|
863
|
+
alwaysWhite: neutral[100],
|
|
864
|
+
alwaysBlack: neutral[950],
|
|
865
|
+
onColorInverse: neutral[950],
|
|
866
|
+
blue: blue[500],
|
|
867
|
+
blueDisabled: blue[400],
|
|
868
|
+
blueOnHover: blue[600],
|
|
869
|
+
green: green[700],
|
|
870
|
+
greenDisabled: green[400],
|
|
871
|
+
greenOnHover: green[600],
|
|
872
|
+
red: red[600],
|
|
873
|
+
redDisabled: red[400],
|
|
874
|
+
redOnHover: red[700],
|
|
875
|
+
orange: orange[600],
|
|
876
|
+
orangeDisabled: orange[400],
|
|
877
|
+
orangeOnHover: orange[700],
|
|
878
|
+
yellow: yellow[600],
|
|
879
|
+
yellowDisabled: yellow[400],
|
|
880
|
+
yellowOnHover: yellow[700]
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
var backgroundTokens = {
|
|
884
|
+
dark: {
|
|
885
|
+
base: neutral[950],
|
|
886
|
+
primary: blue[950],
|
|
887
|
+
primaryOnHover: blue[900],
|
|
888
|
+
secondary: neutral[900],
|
|
889
|
+
tertiary: neutral[800],
|
|
890
|
+
invert: neutral[100],
|
|
891
|
+
invertLight: neutral[300],
|
|
892
|
+
green: green[950],
|
|
893
|
+
greenOnHover: green[900],
|
|
894
|
+
red: red[950],
|
|
895
|
+
redOnHover: red[900],
|
|
896
|
+
orange: orange[950],
|
|
897
|
+
orangeOnHover: orange[900],
|
|
898
|
+
yellow: yellow[950],
|
|
899
|
+
yellowOnHover: yellow[900],
|
|
900
|
+
low: neutral[900],
|
|
901
|
+
lowOnHover: neutral[800],
|
|
902
|
+
info: blue[950],
|
|
903
|
+
infoOnHover: blue[900]
|
|
904
|
+
},
|
|
905
|
+
light: {
|
|
906
|
+
base: neutral[100],
|
|
907
|
+
primary: blue[100],
|
|
908
|
+
primaryOnHover: blue[300],
|
|
909
|
+
secondary: neutral[200],
|
|
910
|
+
tertiary: neutral[300],
|
|
911
|
+
invert: neutral[950],
|
|
912
|
+
invertLight: neutral[900],
|
|
913
|
+
green: green[100],
|
|
914
|
+
greenOnHover: green[200],
|
|
915
|
+
red: red[100],
|
|
916
|
+
redOnHover: red[200],
|
|
917
|
+
orange: orange[100],
|
|
918
|
+
orangeOnHover: orange[200],
|
|
919
|
+
yellow: orange[100],
|
|
920
|
+
yellowOnHover: orange[200],
|
|
921
|
+
low: neutral[200],
|
|
922
|
+
lowOnHover: neutral[300],
|
|
923
|
+
info: blue[100],
|
|
924
|
+
infoOnHover: blue[300]
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
var semanticTokens = {
|
|
928
|
+
border: borderTokens,
|
|
929
|
+
content: contentTokens,
|
|
930
|
+
background: backgroundTokens
|
|
931
|
+
};
|
|
932
|
+
var VARIANTS = ["primary", "secondary", "ghost", "outline"];
|
|
933
|
+
var INTENTS = ["primary", "success", "warning", "danger", "neutral"];
|
|
934
|
+
var SIZES = ["sm", "md", "lg"];
|
|
935
|
+
var BUTTON_TYPES = ["button", "submit", "reset"];
|
|
936
|
+
var INPUT_TYPES = ["text", "email", "password", "number", "tel", "url", "search"];
|
|
937
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
938
|
+
var SURFACE_LEVELS = ["base", "elevated", "overlay"];
|
|
939
|
+
function createSemanticTokens(mode) {
|
|
940
|
+
const isLight = mode === "light";
|
|
941
|
+
const border = isLight ? borderTokens.light : borderTokens.dark;
|
|
942
|
+
const content = isLight ? contentTokens.light : contentTokens.dark;
|
|
943
|
+
const background = isLight ? backgroundTokens.light : backgroundTokens.dark;
|
|
944
|
+
return {
|
|
945
|
+
intent: {
|
|
946
|
+
primary: {
|
|
947
|
+
color: content.secondary,
|
|
948
|
+
colorHover: isLight ? neutral[700] : neutral[300],
|
|
949
|
+
colorActive: isLight ? neutral[800] : neutral[200],
|
|
950
|
+
background: background.secondary,
|
|
951
|
+
backgroundHover: background.lowOnHover,
|
|
952
|
+
backgroundActive: background.tertiary,
|
|
953
|
+
border: border.primary,
|
|
954
|
+
text: content.primary,
|
|
955
|
+
textMuted: content.subtle
|
|
956
|
+
},
|
|
957
|
+
success: {
|
|
958
|
+
color: isLight ? green[600] : green[600],
|
|
959
|
+
colorHover: isLight ? green[700] : green[500],
|
|
960
|
+
colorActive: isLight ? green[800] : green[700],
|
|
961
|
+
background: background.green,
|
|
962
|
+
backgroundHover: background.greenOnHover,
|
|
963
|
+
backgroundActive: isLight ? green[300] : green[800],
|
|
964
|
+
border: border.green,
|
|
965
|
+
text: content.green,
|
|
966
|
+
textMuted: isLight ? green[700] : green[300]
|
|
967
|
+
},
|
|
968
|
+
warning: {
|
|
969
|
+
color: isLight ? yellow[600] : yellow[400],
|
|
970
|
+
colorHover: isLight ? yellow[700] : yellow[300],
|
|
971
|
+
colorActive: isLight ? yellow[800] : yellow[500],
|
|
972
|
+
background: background.yellow,
|
|
973
|
+
backgroundHover: background.yellowOnHover,
|
|
974
|
+
backgroundActive: isLight ? yellow[200] : yellow[900],
|
|
975
|
+
border: border.yellow,
|
|
976
|
+
text: content.yellow,
|
|
977
|
+
textMuted: isLight ? yellow[700] : yellow[300]
|
|
978
|
+
},
|
|
979
|
+
danger: {
|
|
980
|
+
color: isLight ? red[600] : red[400],
|
|
981
|
+
colorHover: isLight ? red[700] : red[300],
|
|
982
|
+
colorActive: isLight ? red[800] : red[500],
|
|
983
|
+
background: background.red,
|
|
984
|
+
backgroundHover: background.redOnHover,
|
|
985
|
+
backgroundActive: isLight ? red[200] : red[900],
|
|
986
|
+
border: border.red,
|
|
987
|
+
text: content.red,
|
|
988
|
+
textMuted: isLight ? red[700] : red[300]
|
|
989
|
+
},
|
|
990
|
+
neutral: {
|
|
991
|
+
color: content.secondary,
|
|
992
|
+
colorHover: isLight ? neutral[700] : neutral[300],
|
|
993
|
+
colorActive: isLight ? neutral[800] : neutral[200],
|
|
994
|
+
background: background.secondary,
|
|
995
|
+
backgroundHover: background.lowOnHover,
|
|
996
|
+
backgroundActive: background.tertiary,
|
|
997
|
+
border: border.primary,
|
|
998
|
+
text: content.primary,
|
|
999
|
+
textMuted: content.subtle
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
surface: {
|
|
1003
|
+
base: {
|
|
1004
|
+
background: background.base,
|
|
1005
|
+
border: border.primary
|
|
1006
|
+
},
|
|
1007
|
+
elevated: {
|
|
1008
|
+
background: background.secondary,
|
|
1009
|
+
border: border.secondary
|
|
1010
|
+
},
|
|
1011
|
+
overlay: {
|
|
1012
|
+
background: isLight ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.7)",
|
|
1013
|
+
border: "transparent"
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
text: {
|
|
1017
|
+
heading: content.primary,
|
|
1018
|
+
body: content.primary,
|
|
1019
|
+
muted: content.subtle,
|
|
1020
|
+
disabled: isLight ? content.subtle : neutral[600]
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// src/theme/theme.ts
|
|
1026
|
+
function createTheme(name, mode) {
|
|
1027
|
+
const semantic = createSemanticTokens(mode);
|
|
1028
|
+
const isLight = mode === "light";
|
|
1029
|
+
const border = isLight ? borderTokens.light : borderTokens.dark;
|
|
1030
|
+
const content = isLight ? contentTokens.light : contentTokens.dark;
|
|
1031
|
+
const background = isLight ? backgroundTokens.light : backgroundTokens.dark;
|
|
1032
|
+
const cssVariables = {
|
|
1033
|
+
// Base colors
|
|
1034
|
+
"--pd-color-white": colors.white,
|
|
1035
|
+
"--pd-color-black": colors.black,
|
|
1036
|
+
// Intent colors
|
|
1037
|
+
"--pd-intent-primary": semantic.intent.primary.color,
|
|
1038
|
+
"--pd-intent-primary-hover": semantic.intent.primary.colorHover,
|
|
1039
|
+
"--pd-intent-primary-active": semantic.intent.primary.colorActive,
|
|
1040
|
+
"--pd-intent-primary-bg": semantic.intent.primary.background,
|
|
1041
|
+
"--pd-intent-primary-bg-hover": semantic.intent.primary.backgroundHover,
|
|
1042
|
+
"--pd-intent-primary-bg-active": semantic.intent.primary.backgroundActive,
|
|
1043
|
+
"--pd-intent-primary-border": semantic.intent.primary.border,
|
|
1044
|
+
"--pd-intent-primary-text": semantic.intent.primary.text,
|
|
1045
|
+
"--pd-intent-success": semantic.intent.success.color,
|
|
1046
|
+
"--pd-intent-success-hover": semantic.intent.success.colorHover,
|
|
1047
|
+
"--pd-intent-success-active": semantic.intent.success.colorActive,
|
|
1048
|
+
"--pd-intent-success-bg": semantic.intent.success.background,
|
|
1049
|
+
"--pd-intent-success-bg-hover": semantic.intent.success.backgroundHover,
|
|
1050
|
+
"--pd-intent-success-bg-active": semantic.intent.success.backgroundActive,
|
|
1051
|
+
"--pd-intent-success-border": semantic.intent.success.border,
|
|
1052
|
+
"--pd-intent-success-text": semantic.intent.success.text,
|
|
1053
|
+
"--pd-intent-warning": semantic.intent.warning.color,
|
|
1054
|
+
"--pd-intent-warning-hover": semantic.intent.warning.colorHover,
|
|
1055
|
+
"--pd-intent-warning-active": semantic.intent.warning.colorActive,
|
|
1056
|
+
"--pd-intent-warning-bg": semantic.intent.warning.background,
|
|
1057
|
+
"--pd-intent-warning-bg-hover": semantic.intent.warning.backgroundHover,
|
|
1058
|
+
"--pd-intent-warning-bg-active": semantic.intent.warning.backgroundActive,
|
|
1059
|
+
"--pd-intent-warning-border": semantic.intent.warning.border,
|
|
1060
|
+
"--pd-intent-warning-text": semantic.intent.warning.text,
|
|
1061
|
+
"--pd-intent-danger": semantic.intent.danger.color,
|
|
1062
|
+
"--pd-intent-danger-hover": semantic.intent.danger.colorHover,
|
|
1063
|
+
"--pd-intent-danger-active": semantic.intent.danger.colorActive,
|
|
1064
|
+
"--pd-intent-danger-bg": semantic.intent.danger.background,
|
|
1065
|
+
"--pd-intent-danger-bg-hover": semantic.intent.danger.backgroundHover,
|
|
1066
|
+
"--pd-intent-danger-bg-active": semantic.intent.danger.backgroundActive,
|
|
1067
|
+
"--pd-intent-danger-border": semantic.intent.danger.border,
|
|
1068
|
+
"--pd-intent-danger-text": semantic.intent.danger.text,
|
|
1069
|
+
"--pd-intent-neutral": semantic.intent.neutral.color,
|
|
1070
|
+
"--pd-intent-neutral-hover": semantic.intent.neutral.colorHover,
|
|
1071
|
+
"--pd-intent-neutral-active": semantic.intent.neutral.colorActive,
|
|
1072
|
+
"--pd-intent-neutral-bg": semantic.intent.neutral.background,
|
|
1073
|
+
"--pd-intent-neutral-bg-hover": semantic.intent.neutral.backgroundHover,
|
|
1074
|
+
"--pd-intent-neutral-bg-active": semantic.intent.neutral.backgroundActive,
|
|
1075
|
+
"--pd-intent-neutral-border": semantic.intent.neutral.border,
|
|
1076
|
+
"--pd-intent-neutral-text": semantic.intent.neutral.text,
|
|
1077
|
+
// Surface
|
|
1078
|
+
"--pd-surface-base": semantic.surface.base.background,
|
|
1079
|
+
"--pd-surface-base-border": semantic.surface.base.border,
|
|
1080
|
+
"--pd-surface-elevated": semantic.surface.elevated.background,
|
|
1081
|
+
"--pd-surface-elevated-border": semantic.surface.elevated.border,
|
|
1082
|
+
"--pd-surface-overlay": semantic.surface.overlay.background,
|
|
1083
|
+
// Text
|
|
1084
|
+
"--pd-text-heading": semantic.text.heading,
|
|
1085
|
+
"--pd-text-body": semantic.text.body,
|
|
1086
|
+
"--pd-text-muted": semantic.text.muted,
|
|
1087
|
+
"--pd-text-disabled": semantic.text.disabled,
|
|
1088
|
+
// Spacing
|
|
1089
|
+
"--pd-spacing-0": spacing[0],
|
|
1090
|
+
"--pd-spacing-1": spacing[1],
|
|
1091
|
+
"--pd-spacing-2": spacing[2],
|
|
1092
|
+
"--pd-spacing-3": spacing[3],
|
|
1093
|
+
"--pd-spacing-4": spacing[4],
|
|
1094
|
+
"--pd-spacing-5": spacing[5],
|
|
1095
|
+
"--pd-spacing-6": spacing[6],
|
|
1096
|
+
"--pd-spacing-8": spacing[8],
|
|
1097
|
+
"--pd-spacing-10": spacing[10],
|
|
1098
|
+
"--pd-spacing-12": spacing[12],
|
|
1099
|
+
"--pd-spacing-16": spacing[16],
|
|
1100
|
+
"--pd-spacing-20": spacing[20],
|
|
1101
|
+
"--pd-spacing-24": spacing[24],
|
|
1102
|
+
// Radius
|
|
1103
|
+
"--pd-radius-none": radius.none,
|
|
1104
|
+
"--pd-radius-sm": radius.sm,
|
|
1105
|
+
"--pd-radius-base": radius.base,
|
|
1106
|
+
"--pd-radius-md": radius.md,
|
|
1107
|
+
"--pd-radius-lg": radius.lg,
|
|
1108
|
+
"--pd-radius-xl": radius.xl,
|
|
1109
|
+
"--pd-radius-2xl": radius["2xl"],
|
|
1110
|
+
"--pd-radius-3xl": radius["3xl"],
|
|
1111
|
+
"--pd-radius-full": radius.full,
|
|
1112
|
+
// Shadows
|
|
1113
|
+
"--pd-shadow-sm": shadows.sm,
|
|
1114
|
+
"--pd-shadow-base": shadows.base,
|
|
1115
|
+
"--pd-shadow-md": shadows.md,
|
|
1116
|
+
"--pd-shadow-lg": shadows.lg,
|
|
1117
|
+
"--pd-shadow-xl": shadows.xl,
|
|
1118
|
+
"--pd-shadow-2xl": shadows["2xl"],
|
|
1119
|
+
"--pd-shadow-inner": shadows.inner,
|
|
1120
|
+
"--pd-shadow-none": shadows.none,
|
|
1121
|
+
// Z-index
|
|
1122
|
+
"--pd-z-dropdown": String(zIndex.dropdown),
|
|
1123
|
+
"--pd-z-sticky": String(zIndex.sticky),
|
|
1124
|
+
"--pd-z-fixed": String(zIndex.fixed),
|
|
1125
|
+
"--pd-z-modal-backdrop": String(zIndex.modalBackdrop),
|
|
1126
|
+
"--pd-z-modal": String(zIndex.modal),
|
|
1127
|
+
"--pd-z-popover": String(zIndex.popover),
|
|
1128
|
+
"--pd-z-tooltip": String(zIndex.tooltip),
|
|
1129
|
+
// Typography
|
|
1130
|
+
"--pd-font-sans": typography.fontFamily.sans.join(", "),
|
|
1131
|
+
"--pd-font-mono": typography.fontFamily.mono.join(", "),
|
|
1132
|
+
"--pd-font-size-xs": typography.fontSize.xs,
|
|
1133
|
+
"--pd-font-size-sm": typography.fontSize.sm,
|
|
1134
|
+
"--pd-font-size-base": typography.fontSize.base,
|
|
1135
|
+
"--pd-font-size-lg": typography.fontSize.lg,
|
|
1136
|
+
"--pd-font-size-xl": typography.fontSize.xl,
|
|
1137
|
+
"--pd-font-size-2xl": typography.fontSize["2xl"],
|
|
1138
|
+
"--pd-font-size-3xl": typography.fontSize["3xl"],
|
|
1139
|
+
"--pd-font-size-4xl": typography.fontSize["4xl"],
|
|
1140
|
+
"--pd-font-size-5xl": typography.fontSize["5xl"],
|
|
1141
|
+
"--pd-font-weight-normal": typography.fontWeight.normal,
|
|
1142
|
+
"--pd-font-weight-medium": typography.fontWeight.medium,
|
|
1143
|
+
"--pd-font-weight-semibold": typography.fontWeight.semibold,
|
|
1144
|
+
"--pd-font-weight-bold": typography.fontWeight.bold,
|
|
1145
|
+
"--pd-line-height-tight": typography.lineHeight.tight,
|
|
1146
|
+
"--pd-line-height-normal": typography.lineHeight.normal,
|
|
1147
|
+
"--pd-line-height-relaxed": typography.lineHeight.relaxed,
|
|
1148
|
+
// shadcn/ui CSS variable mappings for compatibility
|
|
1149
|
+
"--background": semantic.surface.base.background,
|
|
1150
|
+
"--foreground": semantic.text.body,
|
|
1151
|
+
"--card": semantic.surface.elevated.background,
|
|
1152
|
+
"--card-foreground": semantic.text.body,
|
|
1153
|
+
"--popover": semantic.surface.elevated.background,
|
|
1154
|
+
"--popover-foreground": semantic.text.body,
|
|
1155
|
+
"--primary": semantic.intent.primary.color,
|
|
1156
|
+
"--primary-foreground": colors.white,
|
|
1157
|
+
"--secondary": semantic.intent.neutral.background,
|
|
1158
|
+
"--secondary-foreground": semantic.intent.neutral.text,
|
|
1159
|
+
"--muted": semantic.intent.neutral.background,
|
|
1160
|
+
"--muted-foreground": semantic.text.muted,
|
|
1161
|
+
"--accent": semantic.intent.primary.background,
|
|
1162
|
+
"--accent-foreground": semantic.intent.primary.text,
|
|
1163
|
+
"--destructive": semantic.intent.danger.color,
|
|
1164
|
+
"--destructive-foreground": colors.white,
|
|
1165
|
+
"--border": semantic.intent.neutral.border,
|
|
1166
|
+
"--input": semantic.intent.neutral.border,
|
|
1167
|
+
"--ring": semantic.intent.primary.color,
|
|
1168
|
+
"--radius": radius.md,
|
|
1169
|
+
// New semantic token CSS variables (border, content, background)
|
|
1170
|
+
// Border tokens
|
|
1171
|
+
"--pd-border-primary": border.primary,
|
|
1172
|
+
"--pd-border-secondary": border.secondary,
|
|
1173
|
+
"--pd-border-subtle": border.subtle,
|
|
1174
|
+
"--pd-border-invert": border.invert,
|
|
1175
|
+
"--pd-border-onColor": border.onColor,
|
|
1176
|
+
"--pd-border-blue": border.blue,
|
|
1177
|
+
"--pd-border-blueSubtle": border.blueSubtle,
|
|
1178
|
+
"--pd-border-blueOnHover": border.blueOnHover,
|
|
1179
|
+
"--pd-border-red": border.red,
|
|
1180
|
+
"--pd-border-redSubtle": border.redSubtle,
|
|
1181
|
+
"--pd-border-redOnHover": border.redOnHover,
|
|
1182
|
+
"--pd-border-orange": border.orange,
|
|
1183
|
+
"--pd-border-orangeSubtle": border.orangeSubtle,
|
|
1184
|
+
"--pd-border-orangeOnHover": border.orangeOnHover,
|
|
1185
|
+
"--pd-border-yellow": border.yellow,
|
|
1186
|
+
"--pd-border-yellowSubtle": border.yellowSubtle,
|
|
1187
|
+
"--pd-border-yellowOnHover": border.yellowOnHover,
|
|
1188
|
+
"--pd-border-green": border.green,
|
|
1189
|
+
"--pd-border-greenSubtle": border.greenSubtle,
|
|
1190
|
+
"--pd-border-greenOnHover": border.greenOnHover,
|
|
1191
|
+
// Content tokens
|
|
1192
|
+
"--pd-content-primary": content.primary,
|
|
1193
|
+
"--pd-content-secondary": content.secondary,
|
|
1194
|
+
"--pd-content-subtle": content.subtle,
|
|
1195
|
+
"--pd-content-onColor": content.onColor,
|
|
1196
|
+
"--pd-content-alwaysWhite": content.alwaysWhite,
|
|
1197
|
+
"--pd-content-alwaysBlack": content.alwaysBlack,
|
|
1198
|
+
"--pd-content-onColorInverse": content.onColorInverse,
|
|
1199
|
+
"--pd-content-blue": content.blue,
|
|
1200
|
+
"--pd-content-blueDisabled": content.blueDisabled,
|
|
1201
|
+
"--pd-content-blueOnHover": content.blueOnHover,
|
|
1202
|
+
"--pd-content-green": content.green,
|
|
1203
|
+
"--pd-content-greenDisabled": content.greenDisabled,
|
|
1204
|
+
"--pd-content-greenOnHover": content.greenOnHover,
|
|
1205
|
+
"--pd-content-red": content.red,
|
|
1206
|
+
"--pd-content-redDisabled": content.redDisabled,
|
|
1207
|
+
"--pd-content-redOnHover": content.redOnHover,
|
|
1208
|
+
"--pd-content-orange": content.orange,
|
|
1209
|
+
"--pd-content-orangeDisabled": content.orangeDisabled,
|
|
1210
|
+
"--pd-content-orangeOnHover": content.orangeOnHover,
|
|
1211
|
+
"--pd-content-yellow": content.yellow,
|
|
1212
|
+
"--pd-content-yellowDisabled": content.yellowDisabled,
|
|
1213
|
+
"--pd-content-yellowOnHover": content.yellowOnHover,
|
|
1214
|
+
// Background tokens
|
|
1215
|
+
"--pd-background-base": background.base,
|
|
1216
|
+
"--pd-background-primary": background.primary,
|
|
1217
|
+
"--pd-background-primaryOnHover": background.primaryOnHover,
|
|
1218
|
+
"--pd-background-secondary": background.secondary,
|
|
1219
|
+
"--pd-background-tertiary": background.tertiary,
|
|
1220
|
+
"--pd-background-invert": background.invert,
|
|
1221
|
+
"--pd-background-invertLight": background.invertLight,
|
|
1222
|
+
"--pd-background-green": background.green,
|
|
1223
|
+
"--pd-background-greenOnHover": background.greenOnHover,
|
|
1224
|
+
"--pd-background-red": background.red,
|
|
1225
|
+
"--pd-background-redOnHover": background.redOnHover,
|
|
1226
|
+
"--pd-background-orange": background.orange,
|
|
1227
|
+
"--pd-background-orangeOnHover": background.orangeOnHover,
|
|
1228
|
+
"--pd-background-yellow": background.yellow,
|
|
1229
|
+
"--pd-background-yellowOnHover": background.yellowOnHover,
|
|
1230
|
+
"--pd-background-low": background.low,
|
|
1231
|
+
"--pd-background-lowOnHover": background.lowOnHover,
|
|
1232
|
+
"--pd-background-info": background.info,
|
|
1233
|
+
"--pd-background-infoOnHover": background.infoOnHover
|
|
1234
|
+
};
|
|
1235
|
+
return {
|
|
1236
|
+
name,
|
|
1237
|
+
mode,
|
|
1238
|
+
cssVariables
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
var [DEFAULT_ADAPTER2] = ADAPTER_TYPES;
|
|
1242
|
+
var [DEFAULT_THEME2] = THEME_NAMES;
|
|
1243
|
+
var [DEFAULT_MODE2] = THEME_MODES;
|
|
1244
|
+
var ThemeContext = React.createContext(null);
|
|
1245
|
+
function ThemeProvider({
|
|
1246
|
+
children,
|
|
1247
|
+
adapter = DEFAULT_ADAPTER2,
|
|
1248
|
+
theme: themeName = DEFAULT_THEME2,
|
|
1249
|
+
mode = DEFAULT_MODE2
|
|
1250
|
+
}) {
|
|
1251
|
+
const theme = React.useMemo(() => createTheme(themeName, mode), [themeName, mode]);
|
|
1252
|
+
React.useEffect(() => {
|
|
1253
|
+
setDesignSystemConfig({ adapter, theme: themeName, mode });
|
|
1254
|
+
}, [adapter, themeName, mode]);
|
|
1255
|
+
React.useEffect(() => {
|
|
1256
|
+
const root = document.documentElement;
|
|
1257
|
+
Object.entries(theme.cssVariables).forEach(([key, value]) => {
|
|
1258
|
+
root.style.setProperty(key, value);
|
|
1259
|
+
});
|
|
1260
|
+
return () => {
|
|
1261
|
+
Object.keys(theme.cssVariables).forEach((key) => {
|
|
1262
|
+
root.style.removeProperty(key);
|
|
1263
|
+
});
|
|
1264
|
+
};
|
|
1265
|
+
}, [theme]);
|
|
1266
|
+
const contextValue = React.useMemo(() => ({
|
|
1267
|
+
config: getDesignSystemConfig(),
|
|
1268
|
+
setConfig: setDesignSystemConfig
|
|
1269
|
+
}), []);
|
|
1270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue, children });
|
|
1271
|
+
}
|
|
1272
|
+
function useTheme() {
|
|
1273
|
+
const context = React.useContext(ThemeContext);
|
|
1274
|
+
if (!context) {
|
|
1275
|
+
throw new Error("useTheme must be used within ThemeProvider");
|
|
1276
|
+
}
|
|
1277
|
+
return context;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// src/tokens/index.ts
|
|
1281
|
+
var tokens = {
|
|
1282
|
+
colors: {
|
|
1283
|
+
// Individual color scales
|
|
1284
|
+
neutral,
|
|
1285
|
+
blue,
|
|
1286
|
+
orange,
|
|
1287
|
+
red,
|
|
1288
|
+
green,
|
|
1289
|
+
yellow,
|
|
1290
|
+
// All colors grouped together
|
|
1291
|
+
all: colorPrimitives,
|
|
1292
|
+
// Legacy color names (for backward compatibility)
|
|
1293
|
+
legacy: colors
|
|
1294
|
+
},
|
|
1295
|
+
semantic: {
|
|
1296
|
+
border: borderTokens,
|
|
1297
|
+
content: contentTokens,
|
|
1298
|
+
background: backgroundTokens,
|
|
1299
|
+
// Full semantic tokens object
|
|
1300
|
+
all: semanticTokens
|
|
1301
|
+
},
|
|
1302
|
+
spacing,
|
|
1303
|
+
typography,
|
|
1304
|
+
radius,
|
|
1305
|
+
shadows,
|
|
1306
|
+
zIndex
|
|
1307
|
+
};
|
|
1308
|
+
function extractTextFromChildren(children) {
|
|
1309
|
+
if (typeof children === "string") {
|
|
1310
|
+
return children.trim();
|
|
1311
|
+
}
|
|
1312
|
+
if (typeof children === "number") {
|
|
1313
|
+
return String(children);
|
|
1314
|
+
}
|
|
1315
|
+
if (Array.isArray(children)) {
|
|
1316
|
+
return children.map(extractTextFromChildren).join(" ").trim();
|
|
1317
|
+
}
|
|
1318
|
+
if (React__default.default.isValidElement(children) && children.props) {
|
|
1319
|
+
if (children.props.children) {
|
|
1320
|
+
return extractTextFromChildren(children.props.children);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
return "";
|
|
1324
|
+
}
|
|
1325
|
+
function validateAccessibilityProps(props, componentType, options = {}) {
|
|
1326
|
+
if (process.env.NODE_ENV === "production") {
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
const warnings = [];
|
|
1330
|
+
if (componentType === "button" && options.iconOnly && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
1331
|
+
warnings.push(
|
|
1332
|
+
`[pd-design] Icon-only button should have an aria-label or aria-labelledby for accessibility.`
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
if ((componentType === "button" || componentType === "link") && !props["aria-label"] && !props["aria-labelledby"] && !extractTextFromChildren(options.children)) {
|
|
1336
|
+
warnings.push(
|
|
1337
|
+
`[pd-design] ${componentType} should have an accessible name (aria-label, aria-labelledby, or text content).`
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
if ((componentType === "input" || componentType === "select" || componentType === "textarea") && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
1341
|
+
warnings.push(
|
|
1342
|
+
`[pd-design] ${componentType} should have an accessible label (aria-label or aria-labelledby).`
|
|
1343
|
+
);
|
|
1344
|
+
}
|
|
1345
|
+
if (props.tabIndex !== void 0 && props.tabIndex > 0) {
|
|
1346
|
+
warnings.push(
|
|
1347
|
+
`[pd-design] tabIndex > 0 is not recommended. Use tabIndex={0} for focusable elements or tabIndex={-1} for programmatic focus only.`
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
warnings.forEach((warning) => console.warn(warning));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
exports.ADAPTER_TYPES = ADAPTER_TYPES;
|
|
1354
|
+
exports.BUTTON_TYPES = BUTTON_TYPES;
|
|
1355
|
+
exports.Button = Button;
|
|
1356
|
+
exports.ButtonGroup = ButtonGroup;
|
|
1357
|
+
exports.COLOR_SCALES = COLOR_SCALES;
|
|
1358
|
+
exports.INPUT_TYPES = INPUT_TYPES;
|
|
1359
|
+
exports.INTENTS = INTENTS;
|
|
1360
|
+
exports.ORIENTATIONS = ORIENTATIONS;
|
|
1361
|
+
exports.SIZES = SIZES;
|
|
1362
|
+
exports.SURFACE_LEVELS = SURFACE_LEVELS;
|
|
1363
|
+
exports.THEME_MODES = THEME_MODES;
|
|
1364
|
+
exports.THEME_NAMES = THEME_NAMES;
|
|
1365
|
+
exports.ThemeProvider = ThemeProvider;
|
|
1366
|
+
exports.VARIANTS = VARIANTS;
|
|
1367
|
+
exports.backgroundTokens = backgroundTokens;
|
|
1368
|
+
exports.blue = blue;
|
|
1369
|
+
exports.borderTokens = borderTokens;
|
|
1370
|
+
exports.colorPrimitives = colorPrimitives;
|
|
1371
|
+
exports.colors = colors;
|
|
1372
|
+
exports.contentTokens = contentTokens;
|
|
1373
|
+
exports.createSemanticTokens = createSemanticTokens;
|
|
1374
|
+
exports.createTheme = createTheme;
|
|
1375
|
+
exports.getAdapter = getAdapter;
|
|
1376
|
+
exports.getAvailableIconNames = getAvailableIconNames;
|
|
1377
|
+
exports.getDesignSystemConfig = getDesignSystemConfig;
|
|
1378
|
+
exports.getIcon = getIcon;
|
|
1379
|
+
exports.getThemeMode = getThemeMode;
|
|
1380
|
+
exports.getThemeName = getThemeName;
|
|
1381
|
+
exports.green = green;
|
|
1382
|
+
exports.iconExists = iconExists;
|
|
1383
|
+
exports.neutral = neutral;
|
|
1384
|
+
exports.orange = orange;
|
|
1385
|
+
exports.radius = radius;
|
|
1386
|
+
exports.red = red;
|
|
1387
|
+
exports.renderIcon = renderIcon;
|
|
1388
|
+
exports.semanticTokens = semanticTokens;
|
|
1389
|
+
exports.setDesignSystemConfig = setDesignSystemConfig;
|
|
1390
|
+
exports.shadows = shadows;
|
|
1391
|
+
exports.spacing = spacing;
|
|
1392
|
+
exports.tokens = tokens;
|
|
1393
|
+
exports.typography = typography;
|
|
1394
|
+
exports.useTheme = useTheme;
|
|
1395
|
+
exports.validateAccessibilityProps = validateAccessibilityProps;
|
|
1396
|
+
exports.yellow = yellow;
|
|
1397
|
+
exports.zIndex = zIndex;
|
|
1398
|
+
//# sourceMappingURL=index.cjs.map
|
|
1399
|
+
//# sourceMappingURL=index.cjs.map
|