@takeoff-ui/react-spar 0.1.0-beta.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/README.md +212 -0
- package/dist/index.cjs +1452 -0
- package/dist/index.d.cts +1352 -0
- package/dist/index.d.ts +1352 -0
- package/dist/index.mjs +1436 -0
- package/package.json +80 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1452 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var spar = require('@turkish-technology/spar');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
|
|
8
|
+
// src/provider.tsx
|
|
9
|
+
|
|
10
|
+
// src/utils/isDevelopment.ts
|
|
11
|
+
var isDevelopment = () => typeof process !== "undefined" && process?.env?.NODE_ENV !== "production";
|
|
12
|
+
var TakeoffSparContext = react.createContext(void 0);
|
|
13
|
+
var TakeoffSparProvider = ({ children, colorMode = "light", locale, components }) => {
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
const html = document.documentElement;
|
|
16
|
+
const previous = html.dataset.theme;
|
|
17
|
+
html.dataset.theme = colorMode;
|
|
18
|
+
return () => {
|
|
19
|
+
if (previous === void 0) {
|
|
20
|
+
delete html.dataset.theme;
|
|
21
|
+
} else {
|
|
22
|
+
html.dataset.theme = previous;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}, [colorMode]);
|
|
26
|
+
react.useEffect(() => {
|
|
27
|
+
if (!locale) return;
|
|
28
|
+
const html = document.documentElement;
|
|
29
|
+
const previous = html.lang;
|
|
30
|
+
html.lang = locale;
|
|
31
|
+
return () => {
|
|
32
|
+
html.lang = previous;
|
|
33
|
+
};
|
|
34
|
+
}, [locale]);
|
|
35
|
+
const value = react.useMemo(() => ({ colorMode, locale, components }), [colorMode, locale, components]);
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TakeoffSparContext.Provider, { value, children });
|
|
37
|
+
};
|
|
38
|
+
var DEFAULT_THEME = { colorMode: "light" };
|
|
39
|
+
var useThemeWarningEmitted = false;
|
|
40
|
+
var useTheme = () => {
|
|
41
|
+
const context = react.useContext(TakeoffSparContext);
|
|
42
|
+
if (context === void 0) {
|
|
43
|
+
if (isDevelopment() && !useThemeWarningEmitted) {
|
|
44
|
+
useThemeWarningEmitted = true;
|
|
45
|
+
console.warn(
|
|
46
|
+
'[TakeoffSparProvider] `useTheme` was called outside a provider; falling back to `{ colorMode: "light" }`. Wrap your app in <TakeoffSparProvider> to customize.'
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return DEFAULT_THEME;
|
|
50
|
+
}
|
|
51
|
+
return { colorMode: context.colorMode };
|
|
52
|
+
};
|
|
53
|
+
var useComponentTheme = (componentName) => {
|
|
54
|
+
const context = react.useContext(TakeoffSparContext);
|
|
55
|
+
return context?.components?.[componentName];
|
|
56
|
+
};
|
|
57
|
+
var buildSlotAttrs = (canonicalAttrs, slotKey, layers = {}) => {
|
|
58
|
+
const { themeSlotProps, themeClassNames, themeClassName, instanceSlotProps, instanceClassNames } = layers;
|
|
59
|
+
const themeForSlot = themeSlotProps?.[slotKey];
|
|
60
|
+
const instanceForSlot = instanceSlotProps?.[slotKey];
|
|
61
|
+
const resolvedThemeClass = themeClassNames?.[slotKey] ?? (slotKey === "root" ? themeClassName : void 0);
|
|
62
|
+
const resolvedInstanceClass = instanceClassNames?.[slotKey];
|
|
63
|
+
const composedClassName = clsx.clsx(canonicalAttrs.className, resolvedThemeClass, resolvedInstanceClass) || void 0;
|
|
64
|
+
return {
|
|
65
|
+
...themeForSlot,
|
|
66
|
+
...instanceForSlot,
|
|
67
|
+
...canonicalAttrs,
|
|
68
|
+
className: composedClassName
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/core/composeRootAttrs.ts
|
|
73
|
+
var dropUndefined = (attrs) => {
|
|
74
|
+
const out = {};
|
|
75
|
+
for (const key in attrs) {
|
|
76
|
+
const value = attrs[key];
|
|
77
|
+
if (value !== void 0) out[key] = value;
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
};
|
|
81
|
+
var composeRootAttrs = (base, props, theme, options) => {
|
|
82
|
+
const merged = base.resolveProps(props, theme?.defaultProps);
|
|
83
|
+
const { className, classNames, slotProps, ...rest } = merged;
|
|
84
|
+
const rootSlot = "root";
|
|
85
|
+
const rootAttrs = buildSlotAttrs(base.getSlotProps(rootSlot, { className }), rootSlot, {
|
|
86
|
+
themeSlotProps: theme?.slotProps,
|
|
87
|
+
themeClassNames: theme?.classNames,
|
|
88
|
+
themeClassName: theme?.className,
|
|
89
|
+
instanceSlotProps: slotProps,
|
|
90
|
+
instanceClassNames: classNames
|
|
91
|
+
});
|
|
92
|
+
const stateAttrs = options?.stateAttrs ? dropUndefined(options.stateAttrs(merged)) : void 0;
|
|
93
|
+
const composed = stateAttrs ? { ...rootAttrs, ...stateAttrs } : rootAttrs;
|
|
94
|
+
return {
|
|
95
|
+
rootAttrs: composed,
|
|
96
|
+
rest
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
var toDataSlotName = (slot) => slot.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
100
|
+
var createComponentBase = (config) => {
|
|
101
|
+
const { name, slots, classes, defaultProps = {} } = config;
|
|
102
|
+
const getSlotProps = (slot, attrs) => {
|
|
103
|
+
const { className: instanceClassName, ...rest } = attrs ?? {};
|
|
104
|
+
const composed = clsx.clsx(classes[slot], instanceClassName);
|
|
105
|
+
return {
|
|
106
|
+
...rest,
|
|
107
|
+
"data-slot": toDataSlotName(slot),
|
|
108
|
+
"className": composed || void 0
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const resolveProps = (props, themeDefaults) => ({
|
|
112
|
+
...defaultProps,
|
|
113
|
+
...themeDefaults,
|
|
114
|
+
...props
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
name,
|
|
118
|
+
slots,
|
|
119
|
+
classes,
|
|
120
|
+
defaultProps,
|
|
121
|
+
getSlotProps,
|
|
122
|
+
resolveProps
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/components/accordion/base.ts
|
|
127
|
+
var AccordionBase = createComponentBase({
|
|
128
|
+
name: "Accordion",
|
|
129
|
+
slots: ["root"],
|
|
130
|
+
classes: { root: "tk-accordion" }
|
|
131
|
+
});
|
|
132
|
+
var AccordionItemBase = createComponentBase({
|
|
133
|
+
name: "AccordionItem",
|
|
134
|
+
slots: ["root"],
|
|
135
|
+
classes: { root: "tk-accordion-item" }
|
|
136
|
+
});
|
|
137
|
+
var AccordionHeaderBase = createComponentBase({
|
|
138
|
+
name: "AccordionHeader",
|
|
139
|
+
slots: ["root"],
|
|
140
|
+
classes: { root: "" }
|
|
141
|
+
});
|
|
142
|
+
var AccordionTriggerBase = createComponentBase({
|
|
143
|
+
name: "AccordionTrigger",
|
|
144
|
+
slots: ["root", "startContent", "title"],
|
|
145
|
+
classes: {
|
|
146
|
+
root: "tk-accordion-item-header",
|
|
147
|
+
startContent: "tk-accordion-item-start-content",
|
|
148
|
+
title: "tk-accordion-item-title"
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
var AccordionIndicatorBase = createComponentBase({
|
|
152
|
+
name: "AccordionIndicator",
|
|
153
|
+
slots: ["root"],
|
|
154
|
+
classes: { root: "tk-accordion-item-indicator" }
|
|
155
|
+
});
|
|
156
|
+
var AccordionContentBase = createComponentBase({
|
|
157
|
+
name: "AccordionContent",
|
|
158
|
+
slots: ["root"],
|
|
159
|
+
classes: { root: "tk-accordion-item-content" }
|
|
160
|
+
});
|
|
161
|
+
function createSafeContext(displayName) {
|
|
162
|
+
const Context = react.createContext(null);
|
|
163
|
+
Context.displayName = displayName;
|
|
164
|
+
const Provider = ({ value, children }) => react.createElement(Context.Provider, { value }, children);
|
|
165
|
+
Provider.displayName = `${displayName}.Provider`;
|
|
166
|
+
const useSafeContext = (consumerName) => {
|
|
167
|
+
const context = react.useContext(Context);
|
|
168
|
+
if (context === null) {
|
|
169
|
+
throw new Error(`${consumerName ?? "Hook"} must be used within ${displayName}`);
|
|
170
|
+
}
|
|
171
|
+
return context;
|
|
172
|
+
};
|
|
173
|
+
return [Provider, useSafeContext];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/components/accordion/context.ts
|
|
177
|
+
var [AccordionProvider, useAccordionOwnContext] = createSafeContext("AccordionProvider");
|
|
178
|
+
|
|
179
|
+
// src/components/accordion/defaults.ts
|
|
180
|
+
var DEFAULT_TYPE = "grouped";
|
|
181
|
+
var DEFAULT_MODE = "default";
|
|
182
|
+
var DEFAULT_SIZE = "base";
|
|
183
|
+
var Accordion = (props) => {
|
|
184
|
+
const theme = useComponentTheme("Accordion");
|
|
185
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionBase, props, theme, {
|
|
186
|
+
stateAttrs: ({ mode: mode2 = DEFAULT_MODE, size: size2 = DEFAULT_SIZE, disabled: disabled2 }) => ({
|
|
187
|
+
"data-mode": mode2,
|
|
188
|
+
"data-size": size2,
|
|
189
|
+
"data-disabled": disabled2 ? "" : void 0
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
const { type = DEFAULT_TYPE, mode = DEFAULT_MODE, size = DEFAULT_SIZE, multiple = false, collapsible = true, disabled = false, children, ref, ...sparProps } = rest;
|
|
193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
AccordionProvider,
|
|
195
|
+
{
|
|
196
|
+
value: {
|
|
197
|
+
type,
|
|
198
|
+
mode,
|
|
199
|
+
size
|
|
200
|
+
},
|
|
201
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(spar.Accordion, { ...sparProps, multiple, collapsible, disabled, ref, ...rootAttrs, children })
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
Accordion.displayName = "Accordion";
|
|
206
|
+
var AccordionItem = (props) => {
|
|
207
|
+
const theme = useComponentTheme("AccordionItem");
|
|
208
|
+
const { type, mode, size } = useAccordionOwnContext("Accordion.Item");
|
|
209
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionItemBase, props, theme, {
|
|
210
|
+
stateAttrs: () => ({
|
|
211
|
+
"data-type": type,
|
|
212
|
+
"data-mode": mode,
|
|
213
|
+
"data-size": size
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
const { children, ref, ...spar$1 } = rest;
|
|
217
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.AccordionItem, { ...spar$1, ...rootAttrs, ref, children });
|
|
218
|
+
};
|
|
219
|
+
AccordionItem.displayName = "Accordion.Item";
|
|
220
|
+
var AccordionHeader = (props) => {
|
|
221
|
+
const theme = useComponentTheme("AccordionHeader");
|
|
222
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionHeaderBase, props, theme);
|
|
223
|
+
const { children, level, ref, ...spar$1 } = rest;
|
|
224
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.AccordionHeader, { ...spar$1, level, ...rootAttrs, ref, children });
|
|
225
|
+
};
|
|
226
|
+
AccordionHeader.displayName = "Accordion.Header";
|
|
227
|
+
var DEFAULT_EXPAND_ICON = /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6L8 10L12 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
228
|
+
var DEFAULT_COLLAPSE_ICON = /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 10L8 6L12 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
229
|
+
var AccordionIndicator = (props) => {
|
|
230
|
+
const theme = useComponentTheme("AccordionIndicator");
|
|
231
|
+
const { isOpen } = spar.useAccordionItemContext();
|
|
232
|
+
const Component = props.as ?? "span";
|
|
233
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionIndicatorBase, props, theme);
|
|
234
|
+
const { as: _as, children, ref, ...rendered } = rest;
|
|
235
|
+
const resolved = typeof children === "function" ? children({ isOpen }) : children ?? (isOpen ? DEFAULT_COLLAPSE_ICON : DEFAULT_EXPAND_ICON);
|
|
236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rendered, ref, "aria-hidden": "true", ...rootAttrs, children: resolved });
|
|
237
|
+
};
|
|
238
|
+
AccordionIndicator.displayName = "Accordion.Indicator";
|
|
239
|
+
var AccordionTrigger = (props) => {
|
|
240
|
+
const theme = useComponentTheme("AccordionTrigger");
|
|
241
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionTriggerBase, props, theme);
|
|
242
|
+
const { children, startContent, ref, ...spar$1 } = rest;
|
|
243
|
+
const slotLayers = {
|
|
244
|
+
themeSlotProps: theme?.slotProps,
|
|
245
|
+
themeClassNames: theme?.classNames,
|
|
246
|
+
instanceSlotProps: props.slotProps,
|
|
247
|
+
instanceClassNames: props.classNames
|
|
248
|
+
};
|
|
249
|
+
const startContentNode = startContent !== void 0 && startContent !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { ...buildSlotAttrs(AccordionTriggerBase.getSlotProps("startContent"), "startContent", slotLayers), children: startContent });
|
|
250
|
+
const inlineNodes = [];
|
|
251
|
+
let titleBuffer = [];
|
|
252
|
+
let titleKey = 0;
|
|
253
|
+
const flushTitle = () => {
|
|
254
|
+
if (titleBuffer.length === 0) return;
|
|
255
|
+
inlineNodes.push(
|
|
256
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { ...buildSlotAttrs(AccordionTriggerBase.getSlotProps("title"), "title", slotLayers), children: titleBuffer }, `title-${titleKey++}`)
|
|
257
|
+
);
|
|
258
|
+
titleBuffer = [];
|
|
259
|
+
};
|
|
260
|
+
react.Children.toArray(children).forEach((child) => {
|
|
261
|
+
if (react.isValidElement(child) && child.type === AccordionIndicator) {
|
|
262
|
+
flushTitle();
|
|
263
|
+
inlineNodes.push(child);
|
|
264
|
+
} else {
|
|
265
|
+
titleBuffer.push(child);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
flushTitle();
|
|
269
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(spar.AccordionTrigger, { ...spar$1, ...rootAttrs, ref, children: [
|
|
270
|
+
startContentNode,
|
|
271
|
+
inlineNodes
|
|
272
|
+
] });
|
|
273
|
+
};
|
|
274
|
+
AccordionTrigger.displayName = "Accordion.Trigger";
|
|
275
|
+
var AccordionContent = (props) => {
|
|
276
|
+
const theme = useComponentTheme("AccordionContent");
|
|
277
|
+
const { rootAttrs, rest } = composeRootAttrs(AccordionContentBase, props, theme);
|
|
278
|
+
const { children, ref, ...spar$1 } = rest;
|
|
279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.AccordionContent, { ...spar$1, ...rootAttrs, ref, children });
|
|
280
|
+
};
|
|
281
|
+
AccordionContent.displayName = "Accordion.Content";
|
|
282
|
+
|
|
283
|
+
// src/components/accordion/index.ts
|
|
284
|
+
var Accordion2 = Object.assign(Accordion, {
|
|
285
|
+
Item: AccordionItem,
|
|
286
|
+
Header: AccordionHeader,
|
|
287
|
+
Trigger: AccordionTrigger,
|
|
288
|
+
Indicator: AccordionIndicator,
|
|
289
|
+
Content: AccordionContent
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// src/components/badge/base.ts
|
|
293
|
+
var BadgeBase = createComponentBase({
|
|
294
|
+
name: "Badge",
|
|
295
|
+
slots: ["root", "label", "icon"],
|
|
296
|
+
classes: {
|
|
297
|
+
root: "tk-badge",
|
|
298
|
+
label: "tk-badge-label",
|
|
299
|
+
icon: "tk-badge-icon"
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// src/components/badge/defaults.ts
|
|
304
|
+
var DEFAULT_VARIANT = "primary";
|
|
305
|
+
var DEFAULT_APPEARANCE = "filled";
|
|
306
|
+
var DEFAULT_SIZE2 = "base";
|
|
307
|
+
var Badge = (props) => {
|
|
308
|
+
const theme = useComponentTheme("Badge");
|
|
309
|
+
const { rootAttrs, rest } = composeRootAttrs(BadgeBase, props, theme, {
|
|
310
|
+
stateAttrs: ({ variant = DEFAULT_VARIANT, appearance = DEFAULT_APPEARANCE, size = DEFAULT_SIZE2, rounded, dot: dot2 }) => ({
|
|
311
|
+
"data-variant": variant,
|
|
312
|
+
"data-type": appearance,
|
|
313
|
+
"data-size": dot2 ? void 0 : size,
|
|
314
|
+
"data-rounded": rounded ? "" : void 0,
|
|
315
|
+
"data-dot": dot2 ? "" : void 0
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
const { variant: _variant, appearance: _appearance, size: _size, rounded: _rounded, dot = false, startContent, endContent, children, ref, ...nativeProps } = rest;
|
|
319
|
+
const labelSlotAttrs = buildSlotAttrs(BadgeBase.getSlotProps("label"), "label", {
|
|
320
|
+
themeSlotProps: theme?.slotProps,
|
|
321
|
+
themeClassNames: theme?.classNames,
|
|
322
|
+
instanceSlotProps: props.slotProps,
|
|
323
|
+
instanceClassNames: props.classNames
|
|
324
|
+
});
|
|
325
|
+
const iconSlotAttrs = buildSlotAttrs(BadgeBase.getSlotProps("icon"), "icon", {
|
|
326
|
+
themeSlotProps: theme?.slotProps,
|
|
327
|
+
themeClassNames: theme?.classNames,
|
|
328
|
+
instanceSlotProps: props.slotProps,
|
|
329
|
+
instanceClassNames: props.classNames
|
|
330
|
+
});
|
|
331
|
+
if (dot) {
|
|
332
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ...nativeProps, ...rootAttrs, ref });
|
|
333
|
+
}
|
|
334
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { ...nativeProps, ...rootAttrs, ref, children: [
|
|
335
|
+
startContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconSlotAttrs, children: startContent }),
|
|
336
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("span", { ...labelSlotAttrs, children }),
|
|
337
|
+
endContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconSlotAttrs, children: endContent })
|
|
338
|
+
] });
|
|
339
|
+
};
|
|
340
|
+
Badge.displayName = "Badge";
|
|
341
|
+
|
|
342
|
+
// src/components/button/base.ts
|
|
343
|
+
var ButtonBase = createComponentBase({
|
|
344
|
+
name: "Button",
|
|
345
|
+
slots: ["root", "content", "label", "spinner"],
|
|
346
|
+
classes: {
|
|
347
|
+
root: "tk-button",
|
|
348
|
+
content: "tk-button-content",
|
|
349
|
+
label: "tk-button-label",
|
|
350
|
+
spinner: "tk-button-spinner"
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// src/components/button/defaults.ts
|
|
355
|
+
var DEFAULT_VARIANT2 = "primary";
|
|
356
|
+
var DEFAULT_APPEARANCE2 = "filled";
|
|
357
|
+
var DEFAULT_SIZE3 = "base";
|
|
358
|
+
var Button = (props) => {
|
|
359
|
+
const theme = useComponentTheme("Button");
|
|
360
|
+
const { rootAttrs, rest } = composeRootAttrs(ButtonBase, props, theme, {
|
|
361
|
+
// `data-disabled` and `data-loading` are intentionally NOT set here —
|
|
362
|
+
// Spar's Button already emits them (see SparButton dataAttributes), so
|
|
363
|
+
// setting them again would create two sources of truth that drift the
|
|
364
|
+
// moment Spar renames or extends its vocabulary.
|
|
365
|
+
stateAttrs: ({ variant = DEFAULT_VARIANT2, appearance = DEFAULT_APPEARANCE2, size = DEFAULT_SIZE3, rounded, startContent: startContent2, endContent: endContent2, children: children2 }) => {
|
|
366
|
+
const hasIcon = !!(startContent2 || endContent2);
|
|
367
|
+
const isIconOnly = hasIcon && !children2;
|
|
368
|
+
return {
|
|
369
|
+
"data-variant": variant,
|
|
370
|
+
"data-type": appearance,
|
|
371
|
+
"data-size": size,
|
|
372
|
+
"data-rounded": rounded ? "" : void 0,
|
|
373
|
+
"data-icon-only": isIconOnly ? "" : void 0
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
const {
|
|
378
|
+
// Visual props are consumed by `stateAttrs` above; destructured here to
|
|
379
|
+
// keep them off the underlying button DOM (otherwise they would leak via
|
|
380
|
+
// `...sparProps` as raw HTML attributes).
|
|
381
|
+
variant: _variant,
|
|
382
|
+
appearance: _appearance,
|
|
383
|
+
size: _size,
|
|
384
|
+
rounded: _rounded,
|
|
385
|
+
isLoading = false,
|
|
386
|
+
startContent,
|
|
387
|
+
endContent,
|
|
388
|
+
disabled = false,
|
|
389
|
+
children,
|
|
390
|
+
ref,
|
|
391
|
+
...sparProps
|
|
392
|
+
} = rest;
|
|
393
|
+
const contentSlotAttrs = buildSlotAttrs(ButtonBase.getSlotProps("content"), "content", {
|
|
394
|
+
themeSlotProps: theme?.slotProps,
|
|
395
|
+
themeClassNames: theme?.classNames,
|
|
396
|
+
instanceSlotProps: props.slotProps,
|
|
397
|
+
instanceClassNames: props.classNames
|
|
398
|
+
});
|
|
399
|
+
const labelSlotAttrs = buildSlotAttrs(ButtonBase.getSlotProps("label"), "label", {
|
|
400
|
+
themeSlotProps: theme?.slotProps,
|
|
401
|
+
themeClassNames: theme?.classNames,
|
|
402
|
+
instanceSlotProps: props.slotProps,
|
|
403
|
+
instanceClassNames: props.classNames
|
|
404
|
+
});
|
|
405
|
+
const spinnerSlotAttrs = buildSlotAttrs(ButtonBase.getSlotProps("spinner"), "spinner", {
|
|
406
|
+
themeSlotProps: theme?.slotProps,
|
|
407
|
+
themeClassNames: theme?.classNames,
|
|
408
|
+
instanceSlotProps: props.slotProps,
|
|
409
|
+
instanceClassNames: props.classNames
|
|
410
|
+
});
|
|
411
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(spar.Button, { ...sparProps, disabled, isLoading, ref, ...rootAttrs, children: [
|
|
412
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { ...spinnerSlotAttrs }),
|
|
413
|
+
startContent && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { ...contentSlotAttrs, children: startContent }),
|
|
414
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("span", { ...labelSlotAttrs, children }),
|
|
415
|
+
endContent && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { ...contentSlotAttrs, children: endContent })
|
|
416
|
+
] });
|
|
417
|
+
};
|
|
418
|
+
Button.displayName = "Button";
|
|
419
|
+
|
|
420
|
+
// src/components/checkbox/base.ts
|
|
421
|
+
var CheckboxBase = createComponentBase({
|
|
422
|
+
name: "Checkbox",
|
|
423
|
+
slots: ["root", "indicator", "icon"],
|
|
424
|
+
classes: {
|
|
425
|
+
root: "tk-checkbox",
|
|
426
|
+
// @archetype react-enhancement — visible box (Core's `.mask`).
|
|
427
|
+
indicator: "tk-checkbox-indicator",
|
|
428
|
+
// @archetype react-enhancement — check / dash glyph inside the indicator.
|
|
429
|
+
icon: "tk-checkbox-icon"
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// src/components/checkbox/context.ts
|
|
434
|
+
var [CheckboxProvider, useCheckboxOwnContext] = createSafeContext("CheckboxProvider");
|
|
435
|
+
|
|
436
|
+
// src/components/checkbox/defaults.ts
|
|
437
|
+
var DEFAULT_SIZE4 = "base";
|
|
438
|
+
var DEFAULT_TYPE2 = "default";
|
|
439
|
+
var Checkbox = (props) => {
|
|
440
|
+
const theme = useComponentTheme("Checkbox");
|
|
441
|
+
const { rootAttrs, rest } = composeRootAttrs(CheckboxBase, props, theme, {
|
|
442
|
+
stateAttrs: ({ size = DEFAULT_SIZE4, type = DEFAULT_TYPE2 }) => ({
|
|
443
|
+
"data-size": size,
|
|
444
|
+
"data-type": type
|
|
445
|
+
})
|
|
446
|
+
});
|
|
447
|
+
const { classNames, slotProps } = props;
|
|
448
|
+
const {
|
|
449
|
+
// Visual props are consumed via `stateAttrs`; destructured to keep them
|
|
450
|
+
// off the rendered DOM where they would leak as raw HTML attributes.
|
|
451
|
+
size: _size,
|
|
452
|
+
type: _type,
|
|
453
|
+
// `invalid` is forwarded to Spar as `invalid` (same name).
|
|
454
|
+
invalid = false,
|
|
455
|
+
// takeoff-spar tri-state vocabulary; mapped to Spar's `CheckedState` below.
|
|
456
|
+
checked,
|
|
457
|
+
defaultChecked,
|
|
458
|
+
indeterminate = false,
|
|
459
|
+
onChange,
|
|
460
|
+
// Behavior props owned by Spar — defaults are restated here so they also
|
|
461
|
+
// flow into the context for compound sub-components (asterisk on Label).
|
|
462
|
+
disabled = false,
|
|
463
|
+
readOnly = false,
|
|
464
|
+
required = false,
|
|
465
|
+
children,
|
|
466
|
+
ref,
|
|
467
|
+
...sparProps
|
|
468
|
+
} = rest;
|
|
469
|
+
const sparChecked = indeterminate ? "indeterminate" : checked;
|
|
470
|
+
const sparDefaultChecked = indeterminate ? "indeterminate" : defaultChecked;
|
|
471
|
+
const handleSparChange = onChange ? (next) => onChange(next === true) : void 0;
|
|
472
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
spar.Checkbox,
|
|
474
|
+
{
|
|
475
|
+
...sparProps,
|
|
476
|
+
checked: sparChecked,
|
|
477
|
+
defaultChecked: sparDefaultChecked,
|
|
478
|
+
onChange: handleSparChange,
|
|
479
|
+
disabled,
|
|
480
|
+
readOnly,
|
|
481
|
+
required,
|
|
482
|
+
invalid,
|
|
483
|
+
ref,
|
|
484
|
+
...rootAttrs,
|
|
485
|
+
children: (state) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
486
|
+
CheckboxProvider,
|
|
487
|
+
{
|
|
488
|
+
value: {
|
|
489
|
+
classNames,
|
|
490
|
+
slotProps,
|
|
491
|
+
required,
|
|
492
|
+
invalid,
|
|
493
|
+
disabled: state.disabled,
|
|
494
|
+
readOnly: state.readOnly,
|
|
495
|
+
checked: state.checked === true,
|
|
496
|
+
indeterminate: state.checked === "indeterminate"
|
|
497
|
+
},
|
|
498
|
+
children: typeof children === "function" ? children(state) : children
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
};
|
|
504
|
+
Checkbox.displayName = "Checkbox";
|
|
505
|
+
var baseSvgProps = {
|
|
506
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
507
|
+
"width": "1em",
|
|
508
|
+
"height": "1em",
|
|
509
|
+
"viewBox": "0 0 24 24",
|
|
510
|
+
"fill": "none",
|
|
511
|
+
"stroke": "currentColor",
|
|
512
|
+
"strokeWidth": 2,
|
|
513
|
+
"strokeLinecap": "round",
|
|
514
|
+
"strokeLinejoin": "round",
|
|
515
|
+
"focusable": false,
|
|
516
|
+
"aria-hidden": true
|
|
517
|
+
};
|
|
518
|
+
var PlaceholderCheck = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "check", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12l5 5L20 7" }) });
|
|
519
|
+
var PlaceholderRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "remove", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }) });
|
|
520
|
+
var CheckboxIndicator = (props) => {
|
|
521
|
+
const theme = useComponentTheme("Checkbox");
|
|
522
|
+
const { classNames, slotProps, checked, indeterminate } = useCheckboxOwnContext("Checkbox.Indicator");
|
|
523
|
+
const { className, children, ref, ...rest } = props;
|
|
524
|
+
const indicatorAttrs = buildSlotAttrs(CheckboxBase.getSlotProps("indicator", { className }), "indicator", {
|
|
525
|
+
themeSlotProps: theme?.slotProps,
|
|
526
|
+
themeClassNames: theme?.classNames,
|
|
527
|
+
instanceSlotProps: slotProps,
|
|
528
|
+
instanceClassNames: classNames
|
|
529
|
+
});
|
|
530
|
+
const iconAttrs = buildSlotAttrs(CheckboxBase.getSlotProps("icon"), "icon", {
|
|
531
|
+
themeSlotProps: theme?.slotProps,
|
|
532
|
+
themeClassNames: theme?.classNames,
|
|
533
|
+
instanceSlotProps: slotProps,
|
|
534
|
+
instanceClassNames: classNames
|
|
535
|
+
});
|
|
536
|
+
const resolvedChildren = typeof children === "function" ? children({ checked, indeterminate }) : children ?? /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": true, children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderRemove, {}) : /* @__PURE__ */ jsxRuntime.jsx(PlaceholderCheck, {}) });
|
|
537
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ...rest, ...indicatorAttrs, ref, children: resolvedChildren });
|
|
538
|
+
};
|
|
539
|
+
CheckboxIndicator.displayName = "Checkbox.Indicator";
|
|
540
|
+
|
|
541
|
+
// src/components/checkbox/index.ts
|
|
542
|
+
var Checkbox2 = Object.assign(Checkbox, {
|
|
543
|
+
Indicator: CheckboxIndicator
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
// src/components/drawer/context.ts
|
|
547
|
+
var [DrawerProvider, useDrawerOwnContext] = createSafeContext("DrawerProvider");
|
|
548
|
+
|
|
549
|
+
// src/components/drawer/defaults.ts
|
|
550
|
+
var DEFAULT_PLACEMENT = "right";
|
|
551
|
+
var DEFAULT_HEADER_TYPE = "basic";
|
|
552
|
+
var DEFAULT_FOOTER_TYPE = "basic";
|
|
553
|
+
var DEFAULT_INTENSITY = "base";
|
|
554
|
+
var Drawer = (props) => {
|
|
555
|
+
const theme = useComponentTheme("Drawer");
|
|
556
|
+
const merged = { ...theme?.defaultProps, ...props };
|
|
557
|
+
const { placement = DEFAULT_PLACEMENT, dismissable = true, disabled = false, children, ...sparProps } = merged;
|
|
558
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DrawerProvider, { value: { placement, dismissable }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Dialog, { ...sparProps, disabled, forceMount: true, children }) });
|
|
559
|
+
};
|
|
560
|
+
Drawer.displayName = "Drawer";
|
|
561
|
+
|
|
562
|
+
// src/components/drawer/base.ts
|
|
563
|
+
createComponentBase({
|
|
564
|
+
name: "Drawer",
|
|
565
|
+
slots: ["root"],
|
|
566
|
+
classes: { root: "tk-drawer" }
|
|
567
|
+
});
|
|
568
|
+
var DrawerOverlayBase = createComponentBase({
|
|
569
|
+
name: "DrawerOverlay",
|
|
570
|
+
slots: ["root"],
|
|
571
|
+
classes: { root: "tk-drawer-overlay" }
|
|
572
|
+
});
|
|
573
|
+
var DrawerPanelBase = createComponentBase({
|
|
574
|
+
name: "DrawerPanel",
|
|
575
|
+
slots: ["root"],
|
|
576
|
+
classes: { root: "tk-drawer-panel" }
|
|
577
|
+
});
|
|
578
|
+
var DrawerHeaderBase = createComponentBase({
|
|
579
|
+
name: "DrawerHeader",
|
|
580
|
+
slots: ["root"],
|
|
581
|
+
classes: { root: "tk-drawer-header" }
|
|
582
|
+
});
|
|
583
|
+
var DrawerTitleBase = createComponentBase({
|
|
584
|
+
name: "DrawerTitle",
|
|
585
|
+
slots: ["root"],
|
|
586
|
+
classes: { root: "tk-drawer-title" }
|
|
587
|
+
});
|
|
588
|
+
var DrawerDescriptionBase = createComponentBase({
|
|
589
|
+
name: "DrawerDescription",
|
|
590
|
+
slots: ["root"],
|
|
591
|
+
classes: { root: "tk-drawer-description" }
|
|
592
|
+
});
|
|
593
|
+
var DrawerBodyBase = createComponentBase({
|
|
594
|
+
name: "DrawerBody",
|
|
595
|
+
slots: ["root"],
|
|
596
|
+
classes: { root: "tk-drawer-body" }
|
|
597
|
+
});
|
|
598
|
+
var DrawerFooterBase = createComponentBase({
|
|
599
|
+
name: "DrawerFooter",
|
|
600
|
+
slots: ["root"],
|
|
601
|
+
classes: { root: "tk-drawer-footer" }
|
|
602
|
+
});
|
|
603
|
+
var DrawerCloseButtonBase = createComponentBase({
|
|
604
|
+
name: "DrawerCloseButton",
|
|
605
|
+
slots: ["root"],
|
|
606
|
+
classes: { root: "tk-drawer-close-button" }
|
|
607
|
+
});
|
|
608
|
+
var DrawerTriggerBase = createComponentBase({
|
|
609
|
+
name: "DrawerTrigger",
|
|
610
|
+
slots: ["root"],
|
|
611
|
+
classes: { root: "tk-drawer-trigger" }
|
|
612
|
+
});
|
|
613
|
+
var DrawerTrigger = (props) => {
|
|
614
|
+
const theme = useComponentTheme("DrawerTrigger");
|
|
615
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerTriggerBase, props, theme);
|
|
616
|
+
const { children, ref, ...triggerProps } = rest;
|
|
617
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogTrigger, { ...triggerProps, ref, ...rootAttrs, children });
|
|
618
|
+
};
|
|
619
|
+
DrawerTrigger.displayName = "DrawerTrigger";
|
|
620
|
+
var DrawerOverlay = (props) => {
|
|
621
|
+
const theme = useComponentTheme("DrawerOverlay");
|
|
622
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerOverlayBase, props, theme, {
|
|
623
|
+
stateAttrs: ({ intensity = DEFAULT_INTENSITY, invisible }) => ({
|
|
624
|
+
"data-intensity": intensity,
|
|
625
|
+
"data-invisible": invisible ? "" : void 0
|
|
626
|
+
})
|
|
627
|
+
});
|
|
628
|
+
const { intensity: _intensity, invisible: _invisible, children, ref, ...overlayProps } = rest;
|
|
629
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogOverlay, { ...overlayProps, ref, ...rootAttrs, children });
|
|
630
|
+
};
|
|
631
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
632
|
+
var preventDefault = (e) => e.preventDefault();
|
|
633
|
+
var DrawerPanel = (props) => {
|
|
634
|
+
const theme = useComponentTheme("DrawerPanel");
|
|
635
|
+
const { placement, dismissable } = useDrawerOwnContext();
|
|
636
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerPanelBase, props, theme, {
|
|
637
|
+
stateAttrs: () => ({
|
|
638
|
+
"data-placement": placement
|
|
639
|
+
})
|
|
640
|
+
});
|
|
641
|
+
const { container, children, ref, ...panelProps } = rest;
|
|
642
|
+
const dismissHandlers = !dismissable && {
|
|
643
|
+
onEscapeKeyDown: preventDefault,
|
|
644
|
+
onPointerDownOutside: preventDefault
|
|
645
|
+
};
|
|
646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogContent, { ...panelProps, container, ref, ...rootAttrs, ...dismissHandlers, children });
|
|
647
|
+
};
|
|
648
|
+
DrawerPanel.displayName = "DrawerPanel";
|
|
649
|
+
var DrawerHeader = (props) => {
|
|
650
|
+
const theme = useComponentTheme("DrawerHeader");
|
|
651
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerHeaderBase, props, theme, {
|
|
652
|
+
stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE }) => ({
|
|
653
|
+
"data-header-type": headerType
|
|
654
|
+
})
|
|
655
|
+
});
|
|
656
|
+
const { as, headerType: _headerType, children, ref, ...headerProps } = rest;
|
|
657
|
+
const Component = as ?? "div";
|
|
658
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...headerProps, ref, ...rootAttrs, children });
|
|
659
|
+
};
|
|
660
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
661
|
+
var DrawerTitle = (props) => {
|
|
662
|
+
const theme = useComponentTheme("DrawerTitle");
|
|
663
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerTitleBase, props, theme);
|
|
664
|
+
const { level = 5, children, ref, ...titleProps } = rest;
|
|
665
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogTitle, { ...titleProps, level, ref, ...rootAttrs, children });
|
|
666
|
+
};
|
|
667
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
668
|
+
var DrawerDescription = (props) => {
|
|
669
|
+
const theme = useComponentTheme("DrawerDescription");
|
|
670
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerDescriptionBase, props, theme);
|
|
671
|
+
const { children, ref, ...descProps } = rest;
|
|
672
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogDescription, { ...descProps, ref, ...rootAttrs, children });
|
|
673
|
+
};
|
|
674
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
675
|
+
var DrawerBody = (props) => {
|
|
676
|
+
const theme = useComponentTheme("DrawerBody");
|
|
677
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerBodyBase, props, theme);
|
|
678
|
+
const { as, children, ref, ...bodyProps } = rest;
|
|
679
|
+
const Component = as ?? "div";
|
|
680
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...bodyProps, ref, ...rootAttrs, children });
|
|
681
|
+
};
|
|
682
|
+
DrawerBody.displayName = "DrawerBody";
|
|
683
|
+
var DrawerFooter = (props) => {
|
|
684
|
+
const theme = useComponentTheme("DrawerFooter");
|
|
685
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerFooterBase, props, theme, {
|
|
686
|
+
stateAttrs: ({ footerType = DEFAULT_FOOTER_TYPE }) => ({
|
|
687
|
+
"data-footer-type": footerType
|
|
688
|
+
})
|
|
689
|
+
});
|
|
690
|
+
const { as, footerType: _footerType, children, ref, ...footerProps } = rest;
|
|
691
|
+
const Component = as ?? "div";
|
|
692
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...footerProps, ref, ...rootAttrs, children });
|
|
693
|
+
};
|
|
694
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
695
|
+
var DrawerCloseButton = (props) => {
|
|
696
|
+
const theme = useComponentTheme("DrawerCloseButton");
|
|
697
|
+
const { rootAttrs, rest } = composeRootAttrs(DrawerCloseButtonBase, props, theme);
|
|
698
|
+
const { children, ref, ...closeProps } = rest;
|
|
699
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogClose, { ...closeProps, ref, ...rootAttrs, children });
|
|
700
|
+
};
|
|
701
|
+
DrawerCloseButton.displayName = "DrawerCloseButton";
|
|
702
|
+
|
|
703
|
+
// src/components/drawer/index.ts
|
|
704
|
+
var Drawer2 = Object.assign(Drawer, {
|
|
705
|
+
Trigger: DrawerTrigger,
|
|
706
|
+
Overlay: DrawerOverlay,
|
|
707
|
+
Panel: DrawerPanel,
|
|
708
|
+
Header: DrawerHeader,
|
|
709
|
+
Title: DrawerTitle,
|
|
710
|
+
Description: DrawerDescription,
|
|
711
|
+
Body: DrawerBody,
|
|
712
|
+
Footer: DrawerFooter,
|
|
713
|
+
CloseButton: DrawerCloseButton
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
// src/components/field/base.ts
|
|
717
|
+
var FieldBase = createComponentBase({
|
|
718
|
+
name: "Field",
|
|
719
|
+
slots: ["root"],
|
|
720
|
+
classes: { root: "tk-field" }
|
|
721
|
+
});
|
|
722
|
+
var FieldLabelBase = createComponentBase({
|
|
723
|
+
name: "FieldLabel",
|
|
724
|
+
slots: ["root", "asterisk"],
|
|
725
|
+
classes: { root: "tk-field-label", asterisk: "tk-field-asterisk" }
|
|
726
|
+
});
|
|
727
|
+
var FieldDescriptionBase = createComponentBase({
|
|
728
|
+
name: "FieldDescription",
|
|
729
|
+
slots: ["root"],
|
|
730
|
+
classes: { root: "tk-field-description" }
|
|
731
|
+
});
|
|
732
|
+
var FieldErrorMessageBase = createComponentBase({
|
|
733
|
+
name: "FieldErrorMessage",
|
|
734
|
+
slots: ["root"],
|
|
735
|
+
classes: { root: "tk-field-error-message" }
|
|
736
|
+
});
|
|
737
|
+
var Field = (props) => {
|
|
738
|
+
const theme = useComponentTheme("Field");
|
|
739
|
+
const { rootAttrs, rest } = composeRootAttrs(FieldBase, props, theme);
|
|
740
|
+
const { children, ref, ...sparProps } = rest;
|
|
741
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.Field, { ...sparProps, ref, ...rootAttrs, children });
|
|
742
|
+
};
|
|
743
|
+
Field.displayName = "Field";
|
|
744
|
+
var FieldLabel = (props) => {
|
|
745
|
+
const theme = useComponentTheme("FieldLabel");
|
|
746
|
+
const { required } = spar.useFieldContext();
|
|
747
|
+
const { rootAttrs, rest } = composeRootAttrs(FieldLabelBase, props, theme);
|
|
748
|
+
const { children, ref, ...spar$1 } = rest;
|
|
749
|
+
const asteriskAttrs = buildSlotAttrs(FieldLabelBase.getSlotProps("asterisk"), "asterisk", {
|
|
750
|
+
themeSlotProps: theme?.slotProps,
|
|
751
|
+
themeClassNames: theme?.classNames,
|
|
752
|
+
instanceSlotProps: props.slotProps,
|
|
753
|
+
instanceClassNames: props.classNames
|
|
754
|
+
});
|
|
755
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(spar.FieldLabel, { ...spar$1, ref, ...rootAttrs, children: [
|
|
756
|
+
children,
|
|
757
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { ...asteriskAttrs, "aria-hidden": "true", children: "*" })
|
|
758
|
+
] });
|
|
759
|
+
};
|
|
760
|
+
FieldLabel.displayName = "Field.Label";
|
|
761
|
+
var FieldDescription = (props) => {
|
|
762
|
+
const theme = useComponentTheme("FieldDescription");
|
|
763
|
+
const { rootAttrs, rest } = composeRootAttrs(FieldDescriptionBase, props, theme);
|
|
764
|
+
const { children, ref, ...spar$1 } = rest;
|
|
765
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.FieldDescription, { ...spar$1, ref, ...rootAttrs, children });
|
|
766
|
+
};
|
|
767
|
+
FieldDescription.displayName = "Field.Description";
|
|
768
|
+
var FieldErrorMessage = (props) => {
|
|
769
|
+
const theme = useComponentTheme("FieldErrorMessage");
|
|
770
|
+
const { rootAttrs, rest } = composeRootAttrs(FieldErrorMessageBase, props, theme);
|
|
771
|
+
const { children, ref, ...spar$1 } = rest;
|
|
772
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.FieldErrorMessage, { ...spar$1, ref, ...rootAttrs, children });
|
|
773
|
+
};
|
|
774
|
+
FieldErrorMessage.displayName = "Field.ErrorMessage";
|
|
775
|
+
|
|
776
|
+
// src/components/field/index.ts
|
|
777
|
+
var Field2 = Object.assign(Field, {
|
|
778
|
+
Label: FieldLabel,
|
|
779
|
+
Description: FieldDescription,
|
|
780
|
+
ErrorMessage: FieldErrorMessage
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
// src/components/input/base.ts
|
|
784
|
+
var InputBase = createComponentBase({
|
|
785
|
+
name: "Input",
|
|
786
|
+
slots: ["root"],
|
|
787
|
+
classes: { root: "tk-input" }
|
|
788
|
+
});
|
|
789
|
+
var InputContainerBase = createComponentBase({
|
|
790
|
+
name: "InputContainer",
|
|
791
|
+
slots: ["root", "startContent", "endContent"],
|
|
792
|
+
classes: {
|
|
793
|
+
root: "tk-input-container",
|
|
794
|
+
startContent: "tk-input-start-content",
|
|
795
|
+
endContent: "tk-input-end-content"
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
var InputFieldBase = createComponentBase({
|
|
799
|
+
name: "InputField",
|
|
800
|
+
slots: ["root"],
|
|
801
|
+
classes: { root: "tk-input-field" }
|
|
802
|
+
});
|
|
803
|
+
var InputPrefixBase = createComponentBase({
|
|
804
|
+
name: "InputPrefix",
|
|
805
|
+
slots: ["root"],
|
|
806
|
+
classes: { root: "tk-input-prefix" }
|
|
807
|
+
});
|
|
808
|
+
var InputSuffixBase = createComponentBase({
|
|
809
|
+
name: "InputSuffix",
|
|
810
|
+
slots: ["root"],
|
|
811
|
+
classes: { root: "tk-input-suffix" }
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// src/components/input/context.ts
|
|
815
|
+
var [InputProvider, useInputOwnContext] = createSafeContext("InputProvider");
|
|
816
|
+
|
|
817
|
+
// src/components/input/defaults.ts
|
|
818
|
+
var DEFAULT_SIZE5 = "base";
|
|
819
|
+
var Input = (props) => {
|
|
820
|
+
const theme = useComponentTheme("Input");
|
|
821
|
+
const { rootAttrs, rest } = composeRootAttrs(InputBase, props, theme, {
|
|
822
|
+
stateAttrs: ({ size: size2 = DEFAULT_SIZE5 }) => ({
|
|
823
|
+
"data-size": size2
|
|
824
|
+
})
|
|
825
|
+
});
|
|
826
|
+
const { size = DEFAULT_SIZE5, children, ref, ...sparProps } = rest;
|
|
827
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputProvider, { value: { size }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Input, { ...sparProps, ref, ...rootAttrs, children }) });
|
|
828
|
+
};
|
|
829
|
+
Input.displayName = "Input";
|
|
830
|
+
var InputContainer = (props) => {
|
|
831
|
+
const theme = useComponentTheme("InputContainer");
|
|
832
|
+
const { invalid, disabled, readOnly } = spar.useInputContext();
|
|
833
|
+
const Component = props.as ?? "div";
|
|
834
|
+
const { rootAttrs, rest } = composeRootAttrs(InputContainerBase, props, theme, {
|
|
835
|
+
stateAttrs: () => ({
|
|
836
|
+
"data-invalid": invalid ? "" : void 0,
|
|
837
|
+
"data-disabled": disabled ? "" : void 0,
|
|
838
|
+
"data-readonly": readOnly ? "" : void 0
|
|
839
|
+
})
|
|
840
|
+
});
|
|
841
|
+
const { as: _as, children, startContent, endContent, ref, ...rendered } = rest;
|
|
842
|
+
const slotAttrs = (slot) => buildSlotAttrs(InputContainerBase.getSlotProps(slot), slot, {
|
|
843
|
+
themeSlotProps: theme?.slotProps,
|
|
844
|
+
themeClassNames: theme?.classNames,
|
|
845
|
+
instanceSlotProps: props.slotProps,
|
|
846
|
+
instanceClassNames: props.classNames
|
|
847
|
+
});
|
|
848
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Component, { ...rendered, ref, ...rootAttrs, children: [
|
|
849
|
+
startContent != null && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", ...slotAttrs("startContent"), children: startContent }),
|
|
850
|
+
children,
|
|
851
|
+
endContent != null && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", ...slotAttrs("endContent"), children: endContent })
|
|
852
|
+
] });
|
|
853
|
+
};
|
|
854
|
+
InputContainer.displayName = "Input.Container";
|
|
855
|
+
var InputField = (props) => {
|
|
856
|
+
const theme = useComponentTheme("InputField");
|
|
857
|
+
const { size } = useInputOwnContext("Input.Field");
|
|
858
|
+
const { rootAttrs, rest } = composeRootAttrs(InputFieldBase, props, theme, {
|
|
859
|
+
stateAttrs: () => ({
|
|
860
|
+
"data-size": size
|
|
861
|
+
})
|
|
862
|
+
});
|
|
863
|
+
const { ref, ...spar$1 } = rest;
|
|
864
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.InputField, { ...spar$1, ref, ...rootAttrs });
|
|
865
|
+
};
|
|
866
|
+
InputField.displayName = "Input.Field";
|
|
867
|
+
var InputPrefix = (props) => {
|
|
868
|
+
const theme = useComponentTheme("InputPrefix");
|
|
869
|
+
const Component = props.as ?? "span";
|
|
870
|
+
const { rootAttrs, rest } = composeRootAttrs(InputPrefixBase, props, theme);
|
|
871
|
+
const { as: _as, children, ref, ...rendered } = rest;
|
|
872
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rendered, ref, ...rootAttrs, children });
|
|
873
|
+
};
|
|
874
|
+
InputPrefix.displayName = "Input.Prefix";
|
|
875
|
+
var InputSuffix = (props) => {
|
|
876
|
+
const theme = useComponentTheme("InputSuffix");
|
|
877
|
+
const Component = props.as ?? "span";
|
|
878
|
+
const { rootAttrs, rest } = composeRootAttrs(InputSuffixBase, props, theme);
|
|
879
|
+
const { as: _as, children, ref, ...rendered } = rest;
|
|
880
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rendered, ref, ...rootAttrs, children });
|
|
881
|
+
};
|
|
882
|
+
InputSuffix.displayName = "Input.Suffix";
|
|
883
|
+
|
|
884
|
+
// src/components/input/index.ts
|
|
885
|
+
var Input2 = Object.assign(Input, {
|
|
886
|
+
Container: InputContainer,
|
|
887
|
+
Field: InputField,
|
|
888
|
+
Prefix: InputPrefix,
|
|
889
|
+
Suffix: InputSuffix
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
// src/components/radio/base.ts
|
|
893
|
+
var RadioBase = createComponentBase({
|
|
894
|
+
name: "Radio",
|
|
895
|
+
slots: ["root"],
|
|
896
|
+
classes: { root: "tk-radio" }
|
|
897
|
+
});
|
|
898
|
+
var RadioItemBase = createComponentBase({
|
|
899
|
+
name: "RadioItem",
|
|
900
|
+
slots: ["root"],
|
|
901
|
+
classes: { root: "tk-radio-item" }
|
|
902
|
+
});
|
|
903
|
+
var RadioIndicatorBase = createComponentBase({
|
|
904
|
+
name: "RadioIndicator",
|
|
905
|
+
slots: ["root", "icon"],
|
|
906
|
+
classes: {
|
|
907
|
+
root: "tk-radio-indicator",
|
|
908
|
+
icon: "tk-radio-icon"
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
var RadioLabelBase = createComponentBase({
|
|
912
|
+
name: "RadioLabel",
|
|
913
|
+
slots: ["root"],
|
|
914
|
+
classes: { root: "tk-radio-label" }
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
// src/components/radio/context.ts
|
|
918
|
+
var [RadioGroupProvider, useRadioGroupOwnContext] = createSafeContext("RadioGroupProvider");
|
|
919
|
+
var RADIO_ITEM_CONTEXT_VALUE = { inside: true };
|
|
920
|
+
var [RadioItemProvider, useRadioItemOwnContext] = createSafeContext("RadioItemProvider");
|
|
921
|
+
|
|
922
|
+
// src/components/radio/defaults.ts
|
|
923
|
+
var DEFAULT_SIZE6 = "base";
|
|
924
|
+
var DEFAULT_TYPE3 = "default";
|
|
925
|
+
var DEFAULT_POSITION = "left";
|
|
926
|
+
var Radio = (props) => {
|
|
927
|
+
const theme = useComponentTheme("Radio");
|
|
928
|
+
const { rootAttrs, rest } = composeRootAttrs(RadioBase, props, theme, {
|
|
929
|
+
stateAttrs: ({ size: size2 = DEFAULT_SIZE6, type: type2 = DEFAULT_TYPE3, position: position2 = DEFAULT_POSITION, spread }) => ({
|
|
930
|
+
"data-size": size2,
|
|
931
|
+
"data-type": type2,
|
|
932
|
+
"data-position": position2,
|
|
933
|
+
"data-spread": spread ? "" : void 0
|
|
934
|
+
})
|
|
935
|
+
});
|
|
936
|
+
const {
|
|
937
|
+
size = DEFAULT_SIZE6,
|
|
938
|
+
type = DEFAULT_TYPE3,
|
|
939
|
+
position = DEFAULT_POSITION,
|
|
940
|
+
invalid,
|
|
941
|
+
// `spread` is consumed only as a data-attr above; destructure to keep it
|
|
942
|
+
// out of `sparProps` so the underlying div doesn't receive an unknown
|
|
943
|
+
// boolean DOM attribute.
|
|
944
|
+
spread: _spread,
|
|
945
|
+
children,
|
|
946
|
+
ref,
|
|
947
|
+
...sparProps
|
|
948
|
+
} = rest;
|
|
949
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupProvider, { value: { size, type, position }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Radio, { ...sparProps, invalid, ...rootAttrs, ref, children }) });
|
|
950
|
+
};
|
|
951
|
+
Radio.displayName = "Radio";
|
|
952
|
+
var RadioIndicator = (props) => {
|
|
953
|
+
useRadioItemOwnContext("Radio.Indicator");
|
|
954
|
+
const theme = useComponentTheme("RadioIndicator");
|
|
955
|
+
const { rootAttrs, rest } = composeRootAttrs(RadioIndicatorBase, props, theme);
|
|
956
|
+
const { children, ref, as, ...spar } = rest;
|
|
957
|
+
const iconAttrs = buildSlotAttrs(RadioIndicatorBase.getSlotProps("icon"), "icon", {
|
|
958
|
+
themeSlotProps: theme?.slotProps,
|
|
959
|
+
themeClassNames: theme?.classNames,
|
|
960
|
+
instanceSlotProps: props.slotProps,
|
|
961
|
+
instanceClassNames: props.classNames
|
|
962
|
+
});
|
|
963
|
+
const Component = as ?? "span";
|
|
964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...spar, ...rootAttrs, ref, "aria-hidden": "true", children: children ?? /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs }) });
|
|
965
|
+
};
|
|
966
|
+
RadioIndicator.displayName = "Radio.Indicator";
|
|
967
|
+
var RadioItem = (props) => {
|
|
968
|
+
const theme = useComponentTheme("RadioItem");
|
|
969
|
+
const group = useRadioGroupOwnContext("Radio.Item");
|
|
970
|
+
const { rootAttrs, rest } = composeRootAttrs(RadioItemBase, props, theme, {
|
|
971
|
+
stateAttrs: ({ position }) => ({
|
|
972
|
+
"data-size": group.size,
|
|
973
|
+
"data-type": group.type,
|
|
974
|
+
"data-position": position ?? group.position
|
|
975
|
+
})
|
|
976
|
+
});
|
|
977
|
+
const { position: _position, children, ref, ...spar$1 } = rest;
|
|
978
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadioItemProvider, { value: RADIO_ITEM_CONTEXT_VALUE, children: /* @__PURE__ */ jsxRuntime.jsx(spar.RadioItem, { ...spar$1, ...rootAttrs, ref, children }) });
|
|
979
|
+
};
|
|
980
|
+
RadioItem.displayName = "Radio.Item";
|
|
981
|
+
var RadioLabel = (props) => {
|
|
982
|
+
useRadioItemOwnContext("Radio.Label");
|
|
983
|
+
const theme = useComponentTheme("RadioLabel");
|
|
984
|
+
const { rootAttrs, rest } = composeRootAttrs(RadioLabelBase, props, theme);
|
|
985
|
+
const { children, ref, as, ...spar } = rest;
|
|
986
|
+
const Component = as ?? "span";
|
|
987
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...spar, ...rootAttrs, ref, children });
|
|
988
|
+
};
|
|
989
|
+
RadioLabel.displayName = "Radio.Label";
|
|
990
|
+
|
|
991
|
+
// src/components/radio/index.ts
|
|
992
|
+
var Radio2 = Object.assign(Radio, {
|
|
993
|
+
Item: RadioItem,
|
|
994
|
+
Indicator: RadioIndicator,
|
|
995
|
+
Label: RadioLabel
|
|
996
|
+
});
|
|
997
|
+
var Popover = (props) => {
|
|
998
|
+
const theme = useComponentTheme("Popover");
|
|
999
|
+
const merged = { ...theme?.defaultProps, ...props };
|
|
1000
|
+
const { children, ...sparProps } = merged;
|
|
1001
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.Popover, { ...sparProps, children });
|
|
1002
|
+
};
|
|
1003
|
+
Popover.displayName = "Popover";
|
|
1004
|
+
|
|
1005
|
+
// src/components/popover/base.ts
|
|
1006
|
+
var PopoverTriggerBase = createComponentBase({
|
|
1007
|
+
name: "PopoverTrigger",
|
|
1008
|
+
slots: ["root"],
|
|
1009
|
+
classes: {
|
|
1010
|
+
root: "tk-popover-trigger"
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
var PopoverContentBase = createComponentBase({
|
|
1014
|
+
name: "PopoverContent",
|
|
1015
|
+
slots: ["root"],
|
|
1016
|
+
classes: {
|
|
1017
|
+
root: "tk-popover-content"
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
var PopoverHeaderBase = createComponentBase({
|
|
1021
|
+
name: "PopoverHeader",
|
|
1022
|
+
slots: ["root"],
|
|
1023
|
+
classes: {
|
|
1024
|
+
root: "tk-popover-header"
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
var PopoverDescriptionBase = createComponentBase({
|
|
1028
|
+
name: "PopoverDescription",
|
|
1029
|
+
slots: ["root"],
|
|
1030
|
+
classes: {
|
|
1031
|
+
root: "tk-popover-description"
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
var PopoverArrowBase = createComponentBase({
|
|
1035
|
+
name: "PopoverArrow",
|
|
1036
|
+
slots: ["root"],
|
|
1037
|
+
classes: {
|
|
1038
|
+
root: "tk-popover-arrow"
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
var PopoverCloseBase = createComponentBase({
|
|
1042
|
+
name: "PopoverClose",
|
|
1043
|
+
slots: ["root"],
|
|
1044
|
+
classes: {
|
|
1045
|
+
root: "tk-popover-close"
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
var PopoverTrigger = (props) => {
|
|
1049
|
+
const theme = useComponentTheme("PopoverTrigger");
|
|
1050
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverTriggerBase, props, theme);
|
|
1051
|
+
const { children, ref, ...sparProps } = rest;
|
|
1052
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverTrigger, { ...sparProps, ...rootAttrs, ref, children });
|
|
1053
|
+
};
|
|
1054
|
+
PopoverTrigger.displayName = "Popover.Trigger";
|
|
1055
|
+
|
|
1056
|
+
// src/components/popover/defaults.ts
|
|
1057
|
+
var DEFAULT_VARIANT3 = "dark";
|
|
1058
|
+
var PopoverContent = (props) => {
|
|
1059
|
+
const theme = useComponentTheme("PopoverContent");
|
|
1060
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverContentBase, props, theme, {
|
|
1061
|
+
stateAttrs: ({ variant = DEFAULT_VARIANT3 }) => ({
|
|
1062
|
+
"data-variant": variant
|
|
1063
|
+
})
|
|
1064
|
+
});
|
|
1065
|
+
const { variant: _variant, children, ref, ...sparProps } = rest;
|
|
1066
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverContent, { ...sparProps, ...rootAttrs, ref, children });
|
|
1067
|
+
};
|
|
1068
|
+
PopoverContent.displayName = "Popover.Content";
|
|
1069
|
+
var PopoverHeader = (props) => {
|
|
1070
|
+
const theme = useComponentTheme("PopoverHeader");
|
|
1071
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverHeaderBase, props, theme);
|
|
1072
|
+
const { children, ref, ...nativeProps } = rest;
|
|
1073
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...nativeProps, ...rootAttrs, ref, children });
|
|
1074
|
+
};
|
|
1075
|
+
PopoverHeader.displayName = "Popover.Header";
|
|
1076
|
+
var PopoverDescription = (props) => {
|
|
1077
|
+
const theme = useComponentTheme("PopoverDescription");
|
|
1078
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverDescriptionBase, props, theme);
|
|
1079
|
+
const { children, ref, ...nativeProps } = rest;
|
|
1080
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { ...nativeProps, ...rootAttrs, ref, children });
|
|
1081
|
+
};
|
|
1082
|
+
PopoverDescription.displayName = "Popover.Description";
|
|
1083
|
+
var PopoverArrow = (props) => {
|
|
1084
|
+
const theme = useComponentTheme("PopoverArrow");
|
|
1085
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverArrowBase, props, theme);
|
|
1086
|
+
const { ref, ...sparProps } = rest;
|
|
1087
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverArrow, { ...sparProps, ...rootAttrs, ref });
|
|
1088
|
+
};
|
|
1089
|
+
PopoverArrow.displayName = "Popover.Arrow";
|
|
1090
|
+
var PopoverClose = (props) => {
|
|
1091
|
+
const theme = useComponentTheme("PopoverClose");
|
|
1092
|
+
const { rootAttrs, rest } = composeRootAttrs(PopoverCloseBase, props, theme);
|
|
1093
|
+
const { children, ref, ...sparProps } = rest;
|
|
1094
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverClose, { ...sparProps, ...rootAttrs, ref, children });
|
|
1095
|
+
};
|
|
1096
|
+
PopoverClose.displayName = "Popover.Close";
|
|
1097
|
+
|
|
1098
|
+
// src/components/popover/index.ts
|
|
1099
|
+
var Popover2 = Object.assign(Popover, {
|
|
1100
|
+
Trigger: PopoverTrigger,
|
|
1101
|
+
Content: PopoverContent,
|
|
1102
|
+
Header: PopoverHeader,
|
|
1103
|
+
Description: PopoverDescription,
|
|
1104
|
+
Arrow: PopoverArrow,
|
|
1105
|
+
Close: PopoverClose
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
// src/components/select/base.ts
|
|
1109
|
+
var SelectBase = createComponentBase({
|
|
1110
|
+
name: "Select",
|
|
1111
|
+
slots: ["root"],
|
|
1112
|
+
classes: { root: "tk-select" }
|
|
1113
|
+
});
|
|
1114
|
+
var SelectTriggerBase = createComponentBase({
|
|
1115
|
+
name: "SelectTrigger",
|
|
1116
|
+
slots: ["root"],
|
|
1117
|
+
classes: { root: "tk-select-trigger" }
|
|
1118
|
+
});
|
|
1119
|
+
var SelectValueBase = createComponentBase({
|
|
1120
|
+
name: "SelectValue",
|
|
1121
|
+
slots: ["root"],
|
|
1122
|
+
classes: { root: "tk-select-value" }
|
|
1123
|
+
});
|
|
1124
|
+
var SelectContentBase = createComponentBase({
|
|
1125
|
+
name: "SelectContent",
|
|
1126
|
+
slots: ["root"],
|
|
1127
|
+
classes: { root: "tk-select-content" }
|
|
1128
|
+
});
|
|
1129
|
+
var SelectItemBase = createComponentBase({
|
|
1130
|
+
name: "SelectItem",
|
|
1131
|
+
slots: ["root"],
|
|
1132
|
+
classes: { root: "tk-select-item" }
|
|
1133
|
+
});
|
|
1134
|
+
var SelectGroupBase = createComponentBase({
|
|
1135
|
+
name: "SelectGroup",
|
|
1136
|
+
slots: ["root"],
|
|
1137
|
+
classes: { root: "tk-select-group" }
|
|
1138
|
+
});
|
|
1139
|
+
var SelectLabelBase = createComponentBase({
|
|
1140
|
+
name: "SelectLabel",
|
|
1141
|
+
slots: ["root"],
|
|
1142
|
+
classes: { root: "tk-select-label" }
|
|
1143
|
+
});
|
|
1144
|
+
var SelectItemTextBase = createComponentBase({
|
|
1145
|
+
name: "SelectItemText",
|
|
1146
|
+
slots: ["root"],
|
|
1147
|
+
classes: { root: "tk-select-item-text" }
|
|
1148
|
+
});
|
|
1149
|
+
var SelectSeparatorBase = createComponentBase({
|
|
1150
|
+
name: "SelectSeparator",
|
|
1151
|
+
slots: ["root"],
|
|
1152
|
+
classes: { root: "tk-select-separator" }
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
// src/components/select/context.ts
|
|
1156
|
+
var [SelectProvider, useSelectOwnContext] = createSafeContext("SelectProvider");
|
|
1157
|
+
|
|
1158
|
+
// src/components/select/defaults.ts
|
|
1159
|
+
var DEFAULT_SIZE7 = "base";
|
|
1160
|
+
var Select = (props) => {
|
|
1161
|
+
const theme = useComponentTheme("Select");
|
|
1162
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectBase, props, theme, {
|
|
1163
|
+
stateAttrs: ({ size: size2 = DEFAULT_SIZE7, invalid: invalid2 }) => ({
|
|
1164
|
+
"data-size": size2,
|
|
1165
|
+
"data-invalid": invalid2 ? "" : void 0
|
|
1166
|
+
})
|
|
1167
|
+
});
|
|
1168
|
+
const { size = DEFAULT_SIZE7, invalid = false, children, ref, ...sparProps } = rest;
|
|
1169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectProvider, { value: { size, invalid }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Select, { ...sparProps, ref, ...rootAttrs, children }) });
|
|
1170
|
+
};
|
|
1171
|
+
Select.displayName = "Select";
|
|
1172
|
+
var SelectTrigger = (props) => {
|
|
1173
|
+
const theme = useComponentTheme("SelectTrigger");
|
|
1174
|
+
const { size, invalid } = useSelectOwnContext("Select.Trigger");
|
|
1175
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectTriggerBase, props, theme, {
|
|
1176
|
+
stateAttrs: () => ({
|
|
1177
|
+
"data-size": size,
|
|
1178
|
+
"data-invalid": invalid ? "" : void 0
|
|
1179
|
+
})
|
|
1180
|
+
});
|
|
1181
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectTrigger, { ...spar$1, ref, ...rootAttrs, children });
|
|
1183
|
+
};
|
|
1184
|
+
SelectTrigger.displayName = "Select.Trigger";
|
|
1185
|
+
var SelectValue = (props) => {
|
|
1186
|
+
const theme = useComponentTheme("SelectValue");
|
|
1187
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectValueBase, props, theme);
|
|
1188
|
+
const { placeholder, children, ref, ...spar$1 } = rest;
|
|
1189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectValue, { ...spar$1, placeholder, ref, ...rootAttrs, children });
|
|
1190
|
+
};
|
|
1191
|
+
SelectValue.displayName = "Select.Value";
|
|
1192
|
+
var SelectContent = (props) => {
|
|
1193
|
+
const theme = useComponentTheme("SelectContent");
|
|
1194
|
+
const { size } = useSelectOwnContext("Select.Content");
|
|
1195
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectContentBase, props, theme, {
|
|
1196
|
+
stateAttrs: () => ({
|
|
1197
|
+
"data-size": size
|
|
1198
|
+
})
|
|
1199
|
+
});
|
|
1200
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1201
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectContent, { ...spar$1, ref, ...rootAttrs, children });
|
|
1202
|
+
};
|
|
1203
|
+
SelectContent.displayName = "Select.Content";
|
|
1204
|
+
var SelectItem = (props) => {
|
|
1205
|
+
const theme = useComponentTheme("SelectItem");
|
|
1206
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectItemBase, props, theme);
|
|
1207
|
+
const { value, disabled, textValue, children, ref, ...spar$1 } = rest;
|
|
1208
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectItem, { ...spar$1, value, disabled, textValue, ref, ...rootAttrs, children });
|
|
1209
|
+
};
|
|
1210
|
+
SelectItem.displayName = "Select.Item";
|
|
1211
|
+
var SelectItemText = (props) => {
|
|
1212
|
+
const theme = useComponentTheme("SelectItemText");
|
|
1213
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectItemTextBase, props, theme);
|
|
1214
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectItemText, { ...spar$1, ref, ...rootAttrs, children });
|
|
1216
|
+
};
|
|
1217
|
+
SelectItemText.displayName = "Select.ItemText";
|
|
1218
|
+
var SelectGroup = (props) => {
|
|
1219
|
+
const theme = useComponentTheme("SelectGroup");
|
|
1220
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectGroupBase, props, theme);
|
|
1221
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1222
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectGroup, { ...spar$1, ref, ...rootAttrs, children });
|
|
1223
|
+
};
|
|
1224
|
+
SelectGroup.displayName = "Select.Group";
|
|
1225
|
+
var SelectLabel = (props) => {
|
|
1226
|
+
const theme = useComponentTheme("SelectLabel");
|
|
1227
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectLabelBase, props, theme);
|
|
1228
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectLabel, { ...spar$1, ref, ...rootAttrs, children });
|
|
1230
|
+
};
|
|
1231
|
+
SelectLabel.displayName = "Select.Label";
|
|
1232
|
+
var SelectSeparator = (props) => {
|
|
1233
|
+
const theme = useComponentTheme("SelectSeparator");
|
|
1234
|
+
const { rootAttrs, rest } = composeRootAttrs(SelectSeparatorBase, props, theme);
|
|
1235
|
+
const { children, ref, ...spar$1 } = rest;
|
|
1236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.SelectSeparator, { ...spar$1, ref, ...rootAttrs, children });
|
|
1237
|
+
};
|
|
1238
|
+
SelectSeparator.displayName = "Select.Separator";
|
|
1239
|
+
|
|
1240
|
+
// src/components/select/index.ts
|
|
1241
|
+
var Select2 = Object.assign(Select, {
|
|
1242
|
+
Trigger: SelectTrigger,
|
|
1243
|
+
Value: SelectValue,
|
|
1244
|
+
Content: SelectContent,
|
|
1245
|
+
Item: SelectItem,
|
|
1246
|
+
ItemText: SelectItemText,
|
|
1247
|
+
Group: SelectGroup,
|
|
1248
|
+
Label: SelectLabel,
|
|
1249
|
+
Separator: SelectSeparator
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
// src/components/switch/base.ts
|
|
1253
|
+
var SwitchBase = createComponentBase({
|
|
1254
|
+
name: "Switch",
|
|
1255
|
+
slots: ["root", "indicator", "thumb"],
|
|
1256
|
+
classes: {
|
|
1257
|
+
root: "tk-toggle",
|
|
1258
|
+
// @archetype react-enhancement — visible track ("input container" in tokens CSS).
|
|
1259
|
+
indicator: "tk-toggle-input-container",
|
|
1260
|
+
// @archetype react-enhancement — sliding thumb inside the track.
|
|
1261
|
+
thumb: "tk-toggle-thumb"
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
// src/components/switch/context.ts
|
|
1266
|
+
var [SwitchProvider, useSwitchOwnContext] = createSafeContext("SwitchProvider");
|
|
1267
|
+
|
|
1268
|
+
// src/components/switch/defaults.ts
|
|
1269
|
+
var DEFAULT_SIZE8 = "base";
|
|
1270
|
+
var DEFAULT_VARIANT4 = "info";
|
|
1271
|
+
var Switch = (props) => {
|
|
1272
|
+
const theme = useComponentTheme("Switch");
|
|
1273
|
+
const { rootAttrs, rest } = composeRootAttrs(SwitchBase, props, theme, {
|
|
1274
|
+
stateAttrs: ({ size = DEFAULT_SIZE8, variant = DEFAULT_VARIANT4 }) => ({
|
|
1275
|
+
"data-size": size,
|
|
1276
|
+
"data-variant": variant
|
|
1277
|
+
})
|
|
1278
|
+
});
|
|
1279
|
+
const { classNames, slotProps } = props;
|
|
1280
|
+
const {
|
|
1281
|
+
// Visual props are consumed via `stateAttrs`; destructured to keep them
|
|
1282
|
+
// off the rendered DOM where they would leak as raw HTML attributes.
|
|
1283
|
+
size: _size,
|
|
1284
|
+
variant: _variant,
|
|
1285
|
+
// `invalid` is forwarded to Spar as `invalid` (same name).
|
|
1286
|
+
invalid = false,
|
|
1287
|
+
children,
|
|
1288
|
+
ref,
|
|
1289
|
+
...sparProps
|
|
1290
|
+
} = rest;
|
|
1291
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1292
|
+
spar.Switch,
|
|
1293
|
+
{
|
|
1294
|
+
...sparProps,
|
|
1295
|
+
invalid,
|
|
1296
|
+
ref,
|
|
1297
|
+
...rootAttrs,
|
|
1298
|
+
children: (state) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1299
|
+
SwitchProvider,
|
|
1300
|
+
{
|
|
1301
|
+
value: {
|
|
1302
|
+
classNames,
|
|
1303
|
+
slotProps,
|
|
1304
|
+
checked: state.checked,
|
|
1305
|
+
disabled: state.disabled,
|
|
1306
|
+
readOnly: state.readOnly
|
|
1307
|
+
},
|
|
1308
|
+
children: typeof children === "function" ? children(state) : children
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
}
|
|
1312
|
+
);
|
|
1313
|
+
};
|
|
1314
|
+
Switch.displayName = "Switch";
|
|
1315
|
+
var SwitchIndicator = (props) => {
|
|
1316
|
+
const theme = useComponentTheme("Switch");
|
|
1317
|
+
const { classNames, slotProps, checked, disabled, readOnly } = useSwitchOwnContext("Switch.Indicator");
|
|
1318
|
+
const { className, children, ref, ...rest } = props;
|
|
1319
|
+
const indicatorAttrs = buildSlotAttrs(SwitchBase.getSlotProps("indicator", { className }), "indicator", {
|
|
1320
|
+
themeSlotProps: theme?.slotProps,
|
|
1321
|
+
themeClassNames: theme?.classNames,
|
|
1322
|
+
instanceSlotProps: slotProps,
|
|
1323
|
+
instanceClassNames: classNames
|
|
1324
|
+
});
|
|
1325
|
+
const thumbAttrs = buildSlotAttrs(SwitchBase.getSlotProps("thumb"), "thumb", {
|
|
1326
|
+
themeSlotProps: theme?.slotProps,
|
|
1327
|
+
themeClassNames: theme?.classNames,
|
|
1328
|
+
instanceSlotProps: slotProps,
|
|
1329
|
+
instanceClassNames: classNames
|
|
1330
|
+
});
|
|
1331
|
+
const resolvedChildren = typeof children === "function" ? children({ checked, disabled, readOnly }) : children ?? /* @__PURE__ */ jsxRuntime.jsx("span", { ...thumbAttrs, "aria-hidden": true });
|
|
1332
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ...rest, ...indicatorAttrs, ref, children: resolvedChildren });
|
|
1333
|
+
};
|
|
1334
|
+
SwitchIndicator.displayName = "Switch.Indicator";
|
|
1335
|
+
|
|
1336
|
+
// src/components/switch/index.ts
|
|
1337
|
+
var Switch2 = Object.assign(Switch, {
|
|
1338
|
+
Indicator: SwitchIndicator
|
|
1339
|
+
});
|
|
1340
|
+
var Tooltip = ({ children, id, open, defaultOpen, onOpenChange, delay, hideDelay, disabled }) => {
|
|
1341
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.Tooltip, { id, open, defaultOpen, onOpenChange, delay, hideDelay, disabled, children });
|
|
1342
|
+
};
|
|
1343
|
+
Tooltip.displayName = "Tooltip";
|
|
1344
|
+
var TooltipProvider = ({ children, delayDuration, skipDelayDuration, disableHoverableContent }) => {
|
|
1345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.TooltipProvider, { delayDuration, skipDelayDuration, disableHoverableContent, children });
|
|
1346
|
+
};
|
|
1347
|
+
TooltipProvider.displayName = "Tooltip.Provider";
|
|
1348
|
+
|
|
1349
|
+
// src/components/tooltip/base.ts
|
|
1350
|
+
var TooltipTriggerBase = createComponentBase({
|
|
1351
|
+
name: "TooltipTrigger",
|
|
1352
|
+
slots: ["root"],
|
|
1353
|
+
classes: {
|
|
1354
|
+
root: "tk-tooltip-trigger"
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
var TooltipContentBase = createComponentBase({
|
|
1358
|
+
name: "TooltipContent",
|
|
1359
|
+
slots: ["root"],
|
|
1360
|
+
classes: {
|
|
1361
|
+
root: "tk-tooltip-content"
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
var TooltipHeaderBase = createComponentBase({
|
|
1365
|
+
name: "TooltipHeader",
|
|
1366
|
+
slots: ["root"],
|
|
1367
|
+
classes: {
|
|
1368
|
+
root: "tk-tooltip-header"
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
var TooltipDescriptionBase = createComponentBase({
|
|
1372
|
+
name: "TooltipDescription",
|
|
1373
|
+
slots: ["root"],
|
|
1374
|
+
classes: {
|
|
1375
|
+
root: "tk-tooltip-description"
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
var TooltipArrowBase = createComponentBase({
|
|
1379
|
+
name: "TooltipArrow",
|
|
1380
|
+
slots: ["root"],
|
|
1381
|
+
classes: {
|
|
1382
|
+
root: "tk-tooltip-arrow"
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
var TooltipTrigger = (props) => {
|
|
1386
|
+
const theme = useComponentTheme("TooltipTrigger");
|
|
1387
|
+
const { rootAttrs, rest } = composeRootAttrs(TooltipTriggerBase, props, theme);
|
|
1388
|
+
const { children, ref, ...sparProps } = rest;
|
|
1389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.TooltipTrigger, { ...sparProps, ...rootAttrs, ref, children });
|
|
1390
|
+
};
|
|
1391
|
+
TooltipTrigger.displayName = "Tooltip.Trigger";
|
|
1392
|
+
|
|
1393
|
+
// src/components/tooltip/defaults.ts
|
|
1394
|
+
var DEFAULT_VARIANT5 = "dark";
|
|
1395
|
+
var TooltipContent = (props) => {
|
|
1396
|
+
const theme = useComponentTheme("TooltipContent");
|
|
1397
|
+
const { rootAttrs, rest } = composeRootAttrs(TooltipContentBase, props, theme, {
|
|
1398
|
+
stateAttrs: ({ variant = DEFAULT_VARIANT5 }) => ({
|
|
1399
|
+
"data-variant": variant
|
|
1400
|
+
})
|
|
1401
|
+
});
|
|
1402
|
+
const { variant: _variant, children, ref, ...sparProps } = rest;
|
|
1403
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.TooltipContent, { ...sparProps, ...rootAttrs, ref, children });
|
|
1404
|
+
};
|
|
1405
|
+
TooltipContent.displayName = "Tooltip.Content";
|
|
1406
|
+
var TooltipHeader = (props) => {
|
|
1407
|
+
const theme = useComponentTheme("TooltipHeader");
|
|
1408
|
+
const { rootAttrs, rest } = composeRootAttrs(TooltipHeaderBase, props, theme);
|
|
1409
|
+
const { children, ref, ...nativeProps } = rest;
|
|
1410
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...nativeProps, ...rootAttrs, ref, children });
|
|
1411
|
+
};
|
|
1412
|
+
TooltipHeader.displayName = "Tooltip.Header";
|
|
1413
|
+
var TooltipDescription = (props) => {
|
|
1414
|
+
const theme = useComponentTheme("TooltipDescription");
|
|
1415
|
+
const { rootAttrs, rest } = composeRootAttrs(TooltipDescriptionBase, props, theme);
|
|
1416
|
+
const { children, ref, ...nativeProps } = rest;
|
|
1417
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { ...nativeProps, ...rootAttrs, ref, children });
|
|
1418
|
+
};
|
|
1419
|
+
TooltipDescription.displayName = "Tooltip.Description";
|
|
1420
|
+
var TooltipArrow = (props) => {
|
|
1421
|
+
const theme = useComponentTheme("TooltipArrow");
|
|
1422
|
+
const { rootAttrs, rest } = composeRootAttrs(TooltipArrowBase, props, theme);
|
|
1423
|
+
const { ref, ...sparProps } = rest;
|
|
1424
|
+
return /* @__PURE__ */ jsxRuntime.jsx(spar.TooltipArrow, { ...sparProps, ...rootAttrs, ref });
|
|
1425
|
+
};
|
|
1426
|
+
TooltipArrow.displayName = "Tooltip.Arrow";
|
|
1427
|
+
|
|
1428
|
+
// src/components/tooltip/index.ts
|
|
1429
|
+
var Tooltip2 = Object.assign(Tooltip, {
|
|
1430
|
+
Provider: TooltipProvider,
|
|
1431
|
+
Trigger: TooltipTrigger,
|
|
1432
|
+
Content: TooltipContent,
|
|
1433
|
+
Header: TooltipHeader,
|
|
1434
|
+
Description: TooltipDescription,
|
|
1435
|
+
Arrow: TooltipArrow
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
exports.Accordion = Accordion2;
|
|
1439
|
+
exports.Badge = Badge;
|
|
1440
|
+
exports.Button = Button;
|
|
1441
|
+
exports.Checkbox = Checkbox2;
|
|
1442
|
+
exports.Drawer = Drawer2;
|
|
1443
|
+
exports.Field = Field2;
|
|
1444
|
+
exports.Input = Input2;
|
|
1445
|
+
exports.Popover = Popover2;
|
|
1446
|
+
exports.Radio = Radio2;
|
|
1447
|
+
exports.Select = Select2;
|
|
1448
|
+
exports.Switch = Switch2;
|
|
1449
|
+
exports.TakeoffSparProvider = TakeoffSparProvider;
|
|
1450
|
+
exports.Tooltip = Tooltip2;
|
|
1451
|
+
exports.useComponentTheme = useComponentTheme;
|
|
1452
|
+
exports.useTheme = useTheme;
|