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