@tarsis/toolkit 0.6.6 → 0.7.1

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.
Files changed (78) hide show
  1. package/dist/Container-BVX2MW1U.cjs +138 -0
  2. package/dist/Container-BirkN1fA.js +119 -0
  3. package/dist/SelectBase-BC6WKZVF.cjs +448 -0
  4. package/dist/SelectBase-DPcXvMTa.js +399 -0
  5. package/dist/Slot-SOe-b2n6.cjs +77 -0
  6. package/dist/Slot-z71j7q57.js +65 -0
  7. package/dist/animation-BFpILbqb.js +102 -0
  8. package/dist/animation-BauloIgQ.cjs +119 -0
  9. package/dist/assets-BMqH4phf.cjs +52 -0
  10. package/dist/assets-huTvlamy.js +29 -0
  11. package/dist/audio/fail.mp3 +0 -0
  12. package/dist/audio/fail.ogg +0 -0
  13. package/dist/audio/hover.mp3 +0 -0
  14. package/dist/audio/hover.ogg +0 -0
  15. package/dist/audio/lock/fail.mp3 +0 -0
  16. package/dist/audio/lock/fail.ogg +0 -0
  17. package/dist/audio/lock/hover.mp3 +0 -0
  18. package/dist/audio/lock/hover.ogg +0 -0
  19. package/dist/audio/lock/prev-next.mp3 +0 -0
  20. package/dist/audio/lock/prev-next.ogg +0 -0
  21. package/dist/audio/lock/select.mp3 +0 -0
  22. package/dist/audio/lock/select.ogg +0 -0
  23. package/dist/audio/lock/success.mp3 +0 -0
  24. package/dist/audio/lock/success.ogg +0 -0
  25. package/dist/audio/prev-next.mp3 +0 -0
  26. package/dist/audio/prev-next.ogg +0 -0
  27. package/dist/audio/select.mp3 +0 -0
  28. package/dist/audio/select.ogg +0 -0
  29. package/dist/audio/success.mp3 +0 -0
  30. package/dist/audio/success.ogg +0 -0
  31. package/dist/chunk-CKQMccvm.cjs +28 -0
  32. package/dist/fonts/orbitron/orbitron-black.fnt +426 -0
  33. package/dist/fonts/orbitron/orbitron-black.png +0 -0
  34. package/dist/fonts/orbitron-black.fnt +426 -0
  35. package/dist/fonts/orbitron-black.png +0 -0
  36. package/dist/gl-B0NhVYRl.cjs +177 -0
  37. package/dist/gl-BipoEx9s.js +171 -0
  38. package/dist/hooks.cjs +661 -24
  39. package/dist/hooks.d.ts +72 -0
  40. package/dist/hooks.js +635 -1
  41. package/dist/index.cjs +26708 -384
  42. package/dist/index.d.ts +913 -27
  43. package/dist/index.js +26282 -3
  44. package/dist/layout.cjs +5 -0
  45. package/dist/layout.d.ts +45 -0
  46. package/dist/layout.js +2 -0
  47. package/dist/primitives.cjs +13 -0
  48. package/dist/primitives.d.ts +178 -0
  49. package/dist/primitives.js +3 -0
  50. package/dist/server.cjs +25 -0
  51. package/dist/server.d.ts +70 -0
  52. package/dist/server.js +2 -0
  53. package/dist/styles.css +4020 -2946
  54. package/dist/tokens-B2AxRYyF.js +434 -0
  55. package/dist/tokens-DlMougUi.cjs +469 -0
  56. package/dist/tokens.cjs +12 -0
  57. package/dist/tokens.d.ts +435 -0
  58. package/dist/tokens.js +3 -0
  59. package/dist/useMergeRefs-BM2-gSLn.js +16 -0
  60. package/dist/useMergeRefs-C_l6omwU.cjs +28 -0
  61. package/dist/utils-BGgmkNY4.cjs +330 -0
  62. package/dist/utils-Dw5El_3G.js +222 -0
  63. package/dist/utils.cjs +44 -38
  64. package/dist/utils.d.ts +75 -0
  65. package/dist/utils.js +3 -1
  66. package/dist/values-BTw18-W5.js +138 -0
  67. package/dist/values-BqSJ0h9o.cjs +275 -0
  68. package/package.json +88 -36
  69. package/dist/gl-C1OpenGq.js +0 -3258
  70. package/dist/gl-LtHwn-bj.cjs +0 -3262
  71. package/dist/index-Cz74WvnK.js +0 -3910
  72. package/dist/index-DhWWozeo.cjs +0 -3912
  73. package/dist/index-DvXp0wCM.cjs +0 -116866
  74. package/dist/index-JZY8IMW2.js +0 -116503
  75. package/dist/svg-BT_esDTZ.cjs +0 -236
  76. package/dist/svg-CQLdTbLk.js +0 -205
  77. package/dist/useWindowReady-6kIdYolB.cjs +0 -9317
  78. package/dist/useWindowReady-tUs-ONyG.js +0 -9224
@@ -0,0 +1,399 @@
1
+ import { n as useMergeRefs$1 } from "./useMergeRefs-BM2-gSLn.js";
2
+ import { useControllableState, useFormField } from "./hooks.js";
3
+ import cn from "clsx";
4
+ import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { FloatingFocusManager, FloatingPortal, autoUpdate, flip, offset, safePolygon, shift, size, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useListNavigation, useRole } from "@floating-ui/react";
7
+ import { createPortal } from "react-dom";
8
+ //#region src/components/primitives/VisuallyHidden/VisuallyHidden.tsx
9
+ var hiddenStyles = {
10
+ position: "absolute",
11
+ width: 1,
12
+ height: 1,
13
+ padding: 0,
14
+ margin: -1,
15
+ overflow: "hidden",
16
+ clip: "rect(0, 0, 0, 0)",
17
+ whiteSpace: "nowrap",
18
+ borderWidth: 0
19
+ };
20
+ var VisuallyHidden = ({ children, style, ...props }) => /* @__PURE__ */ jsx("span", {
21
+ style: {
22
+ ...hiddenStyles,
23
+ ...style
24
+ },
25
+ ...props,
26
+ children
27
+ });
28
+ //#endregion
29
+ //#region src/components/primitives/Portal/Portal.tsx
30
+ var Portal = ({ children, container }) => {
31
+ const mountNode = useMemo(() => typeof document !== "undefined" ? container ?? document.body : null, [container]);
32
+ if (!mountNode) return null;
33
+ return createPortal(children, mountNode);
34
+ };
35
+ var FormField_module_default = {
36
+ root: "_root_1m3zs_1",
37
+ label: "_label_1m3zs_8",
38
+ error: "_error_1m3zs_15",
39
+ hint: "_hint_1m3zs_22"
40
+ };
41
+ //#endregion
42
+ //#region src/components/primitives/FormField/FormFieldContext.ts
43
+ var FormFieldContext = createContext(null);
44
+ function useFormFieldContext() {
45
+ const ctx = useContext(FormFieldContext);
46
+ if (!ctx) throw new Error("FormField compound components must be used within <FormField>");
47
+ return ctx;
48
+ }
49
+ //#endregion
50
+ //#region src/components/primitives/FormField/FormField.tsx
51
+ var FormFieldRoot = ({ children, className, style, id, hasError = false, hasHint = false }) => {
52
+ const field = useFormField({
53
+ id,
54
+ hasError,
55
+ hasHint
56
+ });
57
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, {
58
+ value: field,
59
+ children: /* @__PURE__ */ jsx("div", {
60
+ className: cn(FormField_module_default.root, className),
61
+ style,
62
+ "data-has-error": hasError ? "" : void 0,
63
+ children
64
+ })
65
+ });
66
+ };
67
+ var FormFieldLabel = ({ children, className }) => {
68
+ const { labelProps } = useFormFieldContext();
69
+ return /* @__PURE__ */ jsx("label", {
70
+ ...labelProps,
71
+ className: cn(FormField_module_default.label, className),
72
+ children
73
+ });
74
+ };
75
+ var FormFieldControl = ({ children }) => {
76
+ const { fieldProps } = useFormFieldContext();
77
+ return /* @__PURE__ */ jsx(Fragment$1, { children: children(fieldProps) });
78
+ };
79
+ var FormFieldError = ({ children, className }) => {
80
+ const { errorProps } = useFormFieldContext();
81
+ if (!children) return null;
82
+ return /* @__PURE__ */ jsx("p", {
83
+ ...errorProps,
84
+ className: cn(FormField_module_default.error, className),
85
+ children
86
+ });
87
+ };
88
+ var FormFieldHint = ({ children, className }) => {
89
+ const { hintProps } = useFormFieldContext();
90
+ if (!children) return null;
91
+ return /* @__PURE__ */ jsx("p", {
92
+ ...hintProps,
93
+ className: cn(FormField_module_default.hint, className),
94
+ children
95
+ });
96
+ };
97
+ var FormField = Object.assign(FormFieldRoot, {
98
+ Label: FormFieldLabel,
99
+ Control: FormFieldControl,
100
+ Error: FormFieldError,
101
+ Hint: FormFieldHint
102
+ });
103
+ //#endregion
104
+ //#region src/components/primitives/DialogBase/DialogBase.module.scss
105
+ var dialog = "_dialog_bhv2h_1";
106
+ var content = "_content_bhv2h_29";
107
+ var DialogBase_module_default = {
108
+ dialog,
109
+ "dialog-backdrop-fade-in": "_dialog-backdrop-fade-in_bhv2h_1",
110
+ content,
111
+ "dialog-content-enter": "_dialog-content-enter_bhv2h_1"
112
+ };
113
+ //#endregion
114
+ //#region src/components/primitives/DialogBase/DialogBase.tsx
115
+ var DialogBase = ({ open, onClose, children, className, overlayClassName, style, ref: externalRef, closeOnOverlayClick = true, closeOnEscape = true, ...ariaProps }) => {
116
+ const internalRef = useRef(null);
117
+ const dialogRef = useMergeRefs$1(internalRef, externalRef ?? null);
118
+ useEffect(() => {
119
+ const dialog = internalRef.current;
120
+ if (!dialog) return;
121
+ if (open && !dialog.open) dialog.showModal();
122
+ else if (!open && dialog.open) dialog.close();
123
+ }, [open]);
124
+ useEffect(() => {
125
+ if (!open) return;
126
+ const originalOverflow = document.body.style.overflow;
127
+ document.body.style.overflow = "hidden";
128
+ return () => {
129
+ document.body.style.overflow = originalOverflow;
130
+ };
131
+ }, [open]);
132
+ const handleCancel = useCallback((e) => {
133
+ e.preventDefault();
134
+ if (closeOnEscape) onClose();
135
+ }, [closeOnEscape, onClose]);
136
+ const handleBackdropClick = useCallback((e) => {
137
+ if (!closeOnOverlayClick) return;
138
+ if (e.target === internalRef.current) onClose();
139
+ }, [closeOnOverlayClick, onClose]);
140
+ return /* @__PURE__ */ jsx("dialog", {
141
+ ref: dialogRef,
142
+ className: cn(DialogBase_module_default.dialog, overlayClassName),
143
+ onCancel: handleCancel,
144
+ onClick: handleBackdropClick,
145
+ "aria-label": ariaProps["aria-label"],
146
+ "aria-labelledby": ariaProps["aria-labelledby"],
147
+ "aria-describedby": ariaProps["aria-describedby"],
148
+ children: /* @__PURE__ */ jsx("div", {
149
+ className: cn(DialogBase_module_default.content, className),
150
+ style,
151
+ children
152
+ })
153
+ });
154
+ };
155
+ var PopoverBase_module_default = {
156
+ popover: "_popover_stzls_1",
157
+ "popover-enter": "_popover-enter_stzls_1"
158
+ };
159
+ //#endregion
160
+ //#region src/components/primitives/PopoverBase/PopoverBase.tsx
161
+ var PopoverBase = ({ open, onOpenChange, trigger, children, placement = "bottom", offsetValue = 8, className, style, triggerRef: externalTriggerRef, ...ariaProps }) => {
162
+ const { refs, floatingStyles, context } = useFloating({
163
+ open,
164
+ onOpenChange,
165
+ placement,
166
+ middleware: [
167
+ offset(offsetValue),
168
+ flip(),
169
+ shift({ padding: 8 })
170
+ ],
171
+ whileElementsMounted: autoUpdate
172
+ });
173
+ const { getReferenceProps, getFloatingProps } = useInteractions([
174
+ useClick(context),
175
+ useDismiss(context),
176
+ useRole(context)
177
+ ]);
178
+ const setTriggerRef = useCallback((node) => {
179
+ refs.setReference(node);
180
+ }, [refs]);
181
+ const setFloatingRef = useCallback((node) => {
182
+ refs.setFloating(node);
183
+ }, [refs]);
184
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
185
+ ref: useMergeRefs$1(setTriggerRef, externalTriggerRef ?? null),
186
+ ...getReferenceProps(),
187
+ style: { display: "inline-flex" },
188
+ children: trigger
189
+ }), open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(FloatingFocusManager, {
190
+ context,
191
+ modal: false,
192
+ children: /* @__PURE__ */ jsx("div", {
193
+ ref: setFloatingRef,
194
+ className: cn(PopoverBase_module_default.popover, className),
195
+ style: {
196
+ ...floatingStyles,
197
+ ...style
198
+ },
199
+ "aria-label": ariaProps["aria-label"],
200
+ "aria-labelledby": ariaProps["aria-labelledby"],
201
+ ...getFloatingProps(),
202
+ children
203
+ })
204
+ }) })] });
205
+ };
206
+ var TooltipBase_module_default = {
207
+ tooltip: "_tooltip_n91kb_1",
208
+ "tooltip-enter": "_tooltip-enter_n91kb_1"
209
+ };
210
+ //#endregion
211
+ //#region src/components/primitives/TooltipBase/TooltipBase.tsx
212
+ var TooltipBase = ({ content, children, placement = "top", delayMs = 300, closeDelayMs = 0, open: controlledOpen, onOpenChange: controlledOnOpenChange, className, style, triggerRef: externalTriggerRef }) => {
213
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
214
+ const isControlled = controlledOpen !== void 0;
215
+ const open = isControlled ? controlledOpen : uncontrolledOpen;
216
+ const onOpenChange = isControlled ? controlledOnOpenChange ?? (() => {}) : setUncontrolledOpen;
217
+ const tooltipId = useId();
218
+ const { refs, floatingStyles, context } = useFloating({
219
+ open,
220
+ onOpenChange,
221
+ placement,
222
+ middleware: [
223
+ offset(6),
224
+ flip(),
225
+ shift({ padding: 8 })
226
+ ],
227
+ whileElementsMounted: autoUpdate
228
+ });
229
+ const { getReferenceProps, getFloatingProps } = useInteractions([
230
+ useHover(context, {
231
+ delay: {
232
+ open: delayMs,
233
+ close: closeDelayMs
234
+ },
235
+ handleClose: safePolygon()
236
+ }),
237
+ useFocus(context),
238
+ useDismiss(context),
239
+ useRole(context, { role: "tooltip" })
240
+ ]);
241
+ const setTriggerRef = useCallback((node) => {
242
+ refs.setReference(node);
243
+ }, [refs]);
244
+ const setFloatingRef = useCallback((node) => {
245
+ refs.setFloating(node);
246
+ }, [refs]);
247
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
248
+ ref: useMergeRefs$1(setTriggerRef, externalTriggerRef ?? null),
249
+ ...getReferenceProps(),
250
+ "aria-describedby": open ? tooltipId : void 0,
251
+ style: { display: "inline-flex" },
252
+ children
253
+ }), open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx("div", {
254
+ ref: setFloatingRef,
255
+ id: tooltipId,
256
+ role: "tooltip",
257
+ className: cn(TooltipBase_module_default.tooltip, className),
258
+ style: {
259
+ ...floatingStyles,
260
+ ...style
261
+ },
262
+ ...getFloatingProps(),
263
+ children: content
264
+ }) })] });
265
+ };
266
+ var SelectBase_module_default = {
267
+ root: "_root_fausy_1",
268
+ trigger: "_trigger_fausy_14",
269
+ disabled: "_disabled_fausy_53",
270
+ value: "_value_fausy_59",
271
+ chevron: "_chevron_fausy_66",
272
+ listbox: "_listbox_fausy_76",
273
+ option: "_option_fausy_87",
274
+ active: "_active_fausy_102",
275
+ selected: "_selected_fausy_106",
276
+ optionDisabled: "_optionDisabled_fausy_110"
277
+ };
278
+ //#endregion
279
+ //#region src/components/primitives/SelectBase/SelectBase.tsx
280
+ var SelectContext = createContext(null);
281
+ var SelectBase = ({ options, value: controlledValue, defaultValue, onChange, placeholder = "Select...", disabled = false, name, className, style, ref, ...ariaProps }) => {
282
+ const [selectedValue, setSelectedValue] = useControllableState(controlledValue, defaultValue ?? void 0, onChange);
283
+ const [isOpen, setIsOpen] = useState(false);
284
+ const [activeIndex, setActiveIndex] = useState(null);
285
+ const listRef = useRef([]);
286
+ const triggerId = useId();
287
+ const listboxId = useId();
288
+ const { refs, floatingStyles, context } = useFloating({
289
+ open: isOpen,
290
+ onOpenChange: setIsOpen,
291
+ whileElementsMounted: autoUpdate,
292
+ placement: "bottom-start",
293
+ middleware: [
294
+ offset(4),
295
+ flip(),
296
+ shift({ padding: 8 }),
297
+ size({ apply({ rects, elements }) {
298
+ Object.assign(elements.floating.style, { minWidth: `${rects.reference.width}px` });
299
+ } })
300
+ ]
301
+ });
302
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
303
+ useClick(context),
304
+ useDismiss(context),
305
+ useRole(context, { role: "listbox" }),
306
+ useListNavigation(context, {
307
+ listRef,
308
+ activeIndex,
309
+ onNavigate: setActiveIndex,
310
+ loop: true
311
+ })
312
+ ]);
313
+ const handleSelect = useCallback((value) => {
314
+ setSelectedValue(value);
315
+ setIsOpen(false);
316
+ }, [setSelectedValue]);
317
+ const selectedOption = options.find((o) => o.value === selectedValue);
318
+ const getItemPropsForIndex = useCallback((_index) => getItemProps({ role: "option" }), [getItemProps]);
319
+ return /* @__PURE__ */ jsx(SelectContext.Provider, {
320
+ value: {
321
+ isOpen,
322
+ activeIndex,
323
+ selectedValue,
324
+ getItemProps: getItemPropsForIndex,
325
+ handleSelect,
326
+ listRef
327
+ },
328
+ children: /* @__PURE__ */ jsxs("div", {
329
+ ref,
330
+ className: cn(SelectBase_module_default.root, className),
331
+ style,
332
+ children: [
333
+ name && selectedValue !== void 0 && /* @__PURE__ */ jsx("input", {
334
+ type: "hidden",
335
+ name,
336
+ value: selectedValue
337
+ }),
338
+ /* @__PURE__ */ jsxs("button", {
339
+ ref: refs.setReference,
340
+ type: "button",
341
+ id: triggerId,
342
+ className: cn(SelectBase_module_default.trigger, disabled && SelectBase_module_default.disabled),
343
+ disabled,
344
+ "aria-expanded": isOpen,
345
+ "aria-haspopup": "listbox",
346
+ "aria-controls": isOpen ? listboxId : void 0,
347
+ "aria-label": ariaProps["aria-label"],
348
+ "aria-labelledby": ariaProps["aria-labelledby"],
349
+ ...getReferenceProps(),
350
+ children: [/* @__PURE__ */ jsx("span", {
351
+ className: SelectBase_module_default.value,
352
+ children: selectedOption ? selectedOption.label : placeholder
353
+ }), /* @__PURE__ */ jsx("span", {
354
+ className: SelectBase_module_default.chevron,
355
+ "aria-hidden": "true",
356
+ children: /* @__PURE__ */ jsx("svg", {
357
+ width: "12",
358
+ height: "12",
359
+ viewBox: "0 0 12 12",
360
+ fill: "none",
361
+ children: /* @__PURE__ */ jsx("path", {
362
+ d: "M3 4.5L6 7.5L9 4.5",
363
+ stroke: "currentColor",
364
+ strokeWidth: "1.5",
365
+ strokeLinecap: "round",
366
+ strokeLinejoin: "round"
367
+ })
368
+ })
369
+ })]
370
+ }),
371
+ isOpen && /* @__PURE__ */ jsx("div", {
372
+ ref: refs.setFloating,
373
+ id: listboxId,
374
+ role: "listbox",
375
+ className: SelectBase_module_default.listbox,
376
+ style: floatingStyles,
377
+ "aria-labelledby": triggerId,
378
+ ...getFloatingProps(),
379
+ children: options.map((option, index) => /* @__PURE__ */ jsx("div", {
380
+ ref: (node) => {
381
+ listRef.current[index] = node;
382
+ },
383
+ role: "option",
384
+ className: cn(SelectBase_module_default.option, activeIndex === index && SelectBase_module_default.active, option.value === selectedValue && SelectBase_module_default.selected, option.disabled && SelectBase_module_default.optionDisabled),
385
+ "aria-selected": option.value === selectedValue,
386
+ "aria-disabled": option.disabled,
387
+ tabIndex: activeIndex === index ? 0 : -1,
388
+ ...getItemProps({ onClick: () => {
389
+ if (!option.disabled) handleSelect(option.value);
390
+ } }),
391
+ children: option.label
392
+ }, option.value))
393
+ })
394
+ ]
395
+ })
396
+ });
397
+ };
398
+ //#endregion
399
+ export { FormField as a, VisuallyHidden as c, DialogBase as i, TooltipBase as n, useFormFieldContext as o, PopoverBase as r, Portal as s, SelectBase as t };
@@ -0,0 +1,77 @@
1
+ require("./chunk-CKQMccvm.cjs");
2
+ const require_useMergeRefs = require("./useMergeRefs-C_l6omwU.cjs");
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/components/primitives/Slot/Slot.tsx
6
+ function isSlottable(child) {
7
+ return (0, react.isValidElement)(child) && child.type === Slottable;
8
+ }
9
+ var Slottable = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
10
+ var Slot = ({ children, ref, ...slotProps }) => {
11
+ const childrenArray = react.Children.toArray(children);
12
+ const slottable = childrenArray.find(isSlottable);
13
+ if (slottable) {
14
+ const newElement = slottable.props.children;
15
+ const newChildren = childrenArray.map((child) => {
16
+ if (child === slottable) {
17
+ if (react.Children.count(newElement) > 1) return react.Children.only(null);
18
+ return (0, react.isValidElement)(newElement) ? newElement.props.children : null;
19
+ }
20
+ return child;
21
+ });
22
+ if (!(0, react.isValidElement)(newElement)) return null;
23
+ const childProps = newElement.props;
24
+ const childRef = childProps.ref;
25
+ return (0, react.cloneElement)(newElement, {
26
+ ...mergeProps(slotProps, childProps),
27
+ ref: ref ? require_useMergeRefs.mergeRefs(ref, childRef ?? null) : childRef
28
+ }, newChildren);
29
+ }
30
+ if (!(0, react.isValidElement)(children)) {
31
+ if (react.Children.count(children) > 1) return react.Children.only(null);
32
+ return null;
33
+ }
34
+ const childProps = children.props;
35
+ const childRef = childProps.ref;
36
+ return (0, react.cloneElement)(children, {
37
+ ...mergeProps(slotProps, childProps),
38
+ ref: ref ? require_useMergeRefs.mergeRefs(ref, childRef ?? null) : childRef
39
+ });
40
+ };
41
+ function mergeProps(slotProps, childProps) {
42
+ const overrideProps = { ...childProps };
43
+ for (const propName in childProps) {
44
+ const slotValue = slotProps[propName];
45
+ const childValue = childProps[propName];
46
+ if (propName === "ref") continue;
47
+ if (propName === "style") overrideProps[propName] = {
48
+ ...slotValue,
49
+ ...childValue
50
+ };
51
+ else if (propName === "className") overrideProps[propName] = [slotValue, childValue].filter(Boolean).join(" ");
52
+ else if (/^on[A-Z]/.test(propName)) if (slotValue && childValue) overrideProps[propName] = (...args) => {
53
+ childValue(...args);
54
+ slotValue(...args);
55
+ };
56
+ else overrideProps[propName] = slotValue ?? childValue;
57
+ else if (propName !== "children") overrideProps[propName] = childValue ?? slotValue;
58
+ }
59
+ for (const propName in slotProps) {
60
+ if (propName === "ref") continue;
61
+ if (overrideProps[propName] === void 0) overrideProps[propName] = slotProps[propName];
62
+ }
63
+ return overrideProps;
64
+ }
65
+ //#endregion
66
+ Object.defineProperty(exports, "Slot", {
67
+ enumerable: true,
68
+ get: function() {
69
+ return Slot;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "Slottable", {
73
+ enumerable: true,
74
+ get: function() {
75
+ return Slottable;
76
+ }
77
+ });
@@ -0,0 +1,65 @@
1
+ import { t as mergeRefs } from "./useMergeRefs-BM2-gSLn.js";
2
+ import { Children, cloneElement, isValidElement } from "react";
3
+ import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
4
+ //#region src/components/primitives/Slot/Slot.tsx
5
+ function isSlottable(child) {
6
+ return isValidElement(child) && child.type === Slottable;
7
+ }
8
+ var Slottable = ({ children }) => /* @__PURE__ */ jsx(Fragment$1, { children });
9
+ var Slot = ({ children, ref, ...slotProps }) => {
10
+ const childrenArray = Children.toArray(children);
11
+ const slottable = childrenArray.find(isSlottable);
12
+ if (slottable) {
13
+ const newElement = slottable.props.children;
14
+ const newChildren = childrenArray.map((child) => {
15
+ if (child === slottable) {
16
+ if (Children.count(newElement) > 1) return Children.only(null);
17
+ return isValidElement(newElement) ? newElement.props.children : null;
18
+ }
19
+ return child;
20
+ });
21
+ if (!isValidElement(newElement)) return null;
22
+ const childProps = newElement.props;
23
+ const childRef = childProps.ref;
24
+ return cloneElement(newElement, {
25
+ ...mergeProps(slotProps, childProps),
26
+ ref: ref ? mergeRefs(ref, childRef ?? null) : childRef
27
+ }, newChildren);
28
+ }
29
+ if (!isValidElement(children)) {
30
+ if (Children.count(children) > 1) return Children.only(null);
31
+ return null;
32
+ }
33
+ const childProps = children.props;
34
+ const childRef = childProps.ref;
35
+ return cloneElement(children, {
36
+ ...mergeProps(slotProps, childProps),
37
+ ref: ref ? mergeRefs(ref, childRef ?? null) : childRef
38
+ });
39
+ };
40
+ function mergeProps(slotProps, childProps) {
41
+ const overrideProps = { ...childProps };
42
+ for (const propName in childProps) {
43
+ const slotValue = slotProps[propName];
44
+ const childValue = childProps[propName];
45
+ if (propName === "ref") continue;
46
+ if (propName === "style") overrideProps[propName] = {
47
+ ...slotValue,
48
+ ...childValue
49
+ };
50
+ else if (propName === "className") overrideProps[propName] = [slotValue, childValue].filter(Boolean).join(" ");
51
+ else if (/^on[A-Z]/.test(propName)) if (slotValue && childValue) overrideProps[propName] = (...args) => {
52
+ childValue(...args);
53
+ slotValue(...args);
54
+ };
55
+ else overrideProps[propName] = slotValue ?? childValue;
56
+ else if (propName !== "children") overrideProps[propName] = childValue ?? slotValue;
57
+ }
58
+ for (const propName in slotProps) {
59
+ if (propName === "ref") continue;
60
+ if (overrideProps[propName] === void 0) overrideProps[propName] = slotProps[propName];
61
+ }
62
+ return overrideProps;
63
+ }
64
+ //#endregion
65
+ export { Slottable as n, Slot as t };
@@ -0,0 +1,102 @@
1
+ //#region src/tokens/animation.ts
2
+ /**
3
+ * JS-accessible animation duration values (in seconds)
4
+ * for use with GSAP, framer-motion, and Web Animations API.
5
+ * Source of truth for the CSS var equivalents in global.css.
6
+ */
7
+ var animationDuration = {
8
+ fastest: .1,
9
+ fast: .15,
10
+ short: .2,
11
+ medium: .3,
12
+ long: .4,
13
+ slow: .5,
14
+ slowest: .8
15
+ };
16
+ /**
17
+ * Cubic-bezier tuples for programmatic use.
18
+ * CSS equivalents live in global.css --ease-* vars.
19
+ */
20
+ var easing = {
21
+ linear: [
22
+ 0,
23
+ 0,
24
+ 1,
25
+ 1
26
+ ],
27
+ ease: [
28
+ .25,
29
+ .1,
30
+ .25,
31
+ 1
32
+ ],
33
+ easeIn: [
34
+ .42,
35
+ 0,
36
+ 1,
37
+ 1
38
+ ],
39
+ easeOut: [
40
+ 0,
41
+ 0,
42
+ .58,
43
+ 1
44
+ ],
45
+ easeInOut: [
46
+ .42,
47
+ 0,
48
+ .58,
49
+ 1
50
+ ],
51
+ easeInOutCubic: [
52
+ .4,
53
+ 0,
54
+ .2,
55
+ 1
56
+ ],
57
+ easeOutCubic: [
58
+ .215,
59
+ .61,
60
+ .355,
61
+ 1
62
+ ],
63
+ easeOutQuad: [
64
+ .25,
65
+ .46,
66
+ .45,
67
+ .94
68
+ ],
69
+ easeInOutQuad: [
70
+ .455,
71
+ .03,
72
+ .515,
73
+ .955
74
+ ],
75
+ easeInQuart: [
76
+ .5,
77
+ 0,
78
+ .75,
79
+ 0
80
+ ],
81
+ easeOutQuart: [
82
+ .25,
83
+ 1,
84
+ .5,
85
+ 1
86
+ ],
87
+ easeInOutQuart: [
88
+ .76,
89
+ 0,
90
+ .24,
91
+ 1
92
+ ],
93
+ easeOutExpo: [
94
+ .16,
95
+ 1,
96
+ .3,
97
+ 1
98
+ ]
99
+ };
100
+ var staggerDelay = .03;
101
+ //#endregion
102
+ export { easing as n, staggerDelay as r, animationDuration as t };