@sprawlify/react 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{collapsible-DCBcxJA8.mjs → collapsible-pBuZr56X.mjs} +7 -7
- package/dist/{collection-XVYHjcEl.mjs → collection-ZQpeUlrg.mjs} +2 -2
- package/dist/components/accordion/index.d.cts +11 -11
- package/dist/components/accordion/index.d.mts +11 -11
- package/dist/components/accordion/index.mjs +10 -10
- package/dist/components/angle-slider/index.d.cts +13 -13
- package/dist/components/angle-slider/index.d.mts +13 -13
- package/dist/components/angle-slider/index.mjs +8 -8
- package/dist/components/avatar/index.d.cts +8 -8
- package/dist/components/avatar/index.d.mts +8 -8
- package/dist/components/avatar/index.mjs +8 -8
- package/dist/components/bottom-sheet/index.d.cts +15 -15
- package/dist/components/bottom-sheet/index.d.mts +16 -16
- package/dist/components/bottom-sheet/index.mjs +12 -12
- package/dist/components/carousel/index.d.cts +18 -18
- package/dist/components/carousel/index.d.mts +18 -18
- package/dist/components/carousel/index.mjs +8 -8
- package/dist/components/checkbox/index.d.cts +14 -14
- package/dist/components/checkbox/index.d.mts +14 -14
- package/dist/components/checkbox/index.mjs +13 -13
- package/dist/components/clipboard/index.d.cts +12 -12
- package/dist/components/clipboard/index.d.mts +12 -12
- package/dist/components/clipboard/index.mjs +6 -6
- package/dist/components/collapsible/index.d.cts +10 -10
- package/dist/components/collapsible/index.d.mts +10 -10
- package/dist/components/collapsible/index.mjs +7 -7
- package/dist/components/collection/index.d.cts +1 -1
- package/dist/components/collection/index.d.mts +1 -1
- package/dist/components/collection/index.mjs +3 -3
- package/dist/components/color-picker/index.d.cts +35 -35
- package/dist/components/color-picker/index.d.mts +36 -36
- package/dist/components/color-picker/index.mjs +14 -14
- package/dist/components/combobox/index.d.cts +22 -22
- package/dist/components/combobox/index.d.mts +23 -23
- package/dist/components/combobox/index.mjs +15 -15
- package/dist/components/date-picker/index.d.cts +32 -32
- package/dist/components/date-picker/index.d.mts +33 -33
- package/dist/components/date-picker/index.mjs +11 -11
- package/dist/components/dialog/index.d.cts +15 -15
- package/dist/components/dialog/index.d.mts +16 -16
- package/dist/components/dialog/index.mjs +11 -11
- package/dist/components/download-trigger/index.d.cts +4 -4
- package/dist/components/download-trigger/index.d.mts +4 -4
- package/dist/components/download-trigger/index.mjs +5 -5
- package/dist/components/editable/index.d.cts +13 -13
- package/dist/components/editable/index.d.mts +13 -13
- package/dist/components/editable/index.mjs +11 -11
- package/dist/components/field/index.d.cts +14 -14
- package/dist/components/field/index.d.mts +14 -14
- package/dist/components/field/index.mjs +9 -9
- package/dist/components/fieldset/index.d.cts +10 -10
- package/dist/components/fieldset/index.d.mts +10 -10
- package/dist/components/fieldset/index.mjs +9 -9
- package/dist/components/file-upload/index.d.cts +18 -18
- package/dist/components/file-upload/index.d.mts +18 -18
- package/dist/components/file-upload/index.mjs +11 -11
- package/dist/components/floating-panel/index.d.cts +19 -19
- package/dist/components/floating-panel/index.d.mts +17 -17
- package/dist/components/floating-panel/index.mjs +11 -11
- package/dist/components/focus-trap/index.d.cts +4 -4
- package/dist/components/focus-trap/index.d.mts +4 -4
- package/dist/components/focus-trap/index.mjs +4 -4
- package/dist/components/format/index.d.cts +4 -4
- package/dist/components/format/index.d.mts +4 -4
- package/dist/components/format/index.mjs +3 -3
- package/dist/components/frame/index.d.cts +3 -3
- package/dist/components/frame/index.d.mts +3 -3
- package/dist/components/frame/index.mjs +6 -6
- package/dist/components/highlight/index.d.cts +3 -3
- package/dist/components/highlight/index.d.mts +3 -3
- package/dist/components/highlight/index.mjs +1 -1
- package/dist/components/hover-card/index.d.cts +13 -13
- package/dist/components/hover-card/index.d.mts +14 -14
- package/dist/components/hover-card/index.mjs +10 -10
- package/dist/components/image-cropper/index.d.cts +11 -11
- package/dist/components/image-cropper/index.d.mts +11 -11
- package/dist/components/image-cropper/index.mjs +8 -8
- package/dist/components/json-tree-view/index.d.cts +5 -5
- package/dist/components/json-tree-view/index.d.mts +9 -9
- package/dist/components/json-tree-view/index.mjs +13 -13
- package/dist/components/listbox/index.d.cts +17 -17
- package/dist/components/listbox/index.d.mts +17 -17
- package/dist/components/listbox/index.mjs +10 -10
- package/dist/components/marquee/index.d.cts +10 -10
- package/dist/components/marquee/index.d.mts +10 -10
- package/dist/components/marquee/index.mjs +8 -8
- package/dist/components/menu/index.d.cts +25 -25
- package/dist/components/menu/index.d.mts +28 -28
- package/dist/components/menu/index.mjs +11 -11
- package/dist/components/navigation-menu/index.d.cts +17 -17
- package/dist/components/navigation-menu/index.d.mts +17 -17
- package/dist/components/navigation-menu/index.mjs +13 -13
- package/dist/components/number-input/index.d.cts +13 -13
- package/dist/components/number-input/index.d.mts +13 -13
- package/dist/components/number-input/index.mjs +11 -11
- package/dist/components/pagination/index.d.cts +12 -12
- package/dist/components/pagination/index.d.mts +12 -12
- package/dist/components/pagination/index.mjs +8 -8
- package/dist/components/password-input/index.d.cts +11 -11
- package/dist/components/password-input/index.d.mts +11 -11
- package/dist/components/password-input/index.mjs +11 -11
- package/dist/components/pin-input/index.d.cts +10 -10
- package/dist/components/pin-input/index.d.mts +10 -10
- package/dist/components/pin-input/index.mjs +11 -11
- package/dist/components/popover/index.d.cts +18 -18
- package/dist/components/popover/index.d.mts +19 -19
- package/dist/components/popover/index.mjs +10 -10
- package/dist/components/portal/index.d.cts +2 -2
- package/dist/components/portal/index.d.mts +2 -2
- package/dist/components/portal/index.mjs +5 -5
- package/dist/components/presence/index.d.cts +1 -1
- package/dist/components/presence/index.d.mts +3 -3
- package/dist/components/presence/index.mjs +5 -5
- package/dist/components/progress/index.d.cts +14 -14
- package/dist/components/progress/index.d.mts +14 -14
- package/dist/components/progress/index.mjs +8 -8
- package/dist/components/qr-code/index.d.cts +10 -10
- package/dist/components/qr-code/index.d.mts +10 -10
- package/dist/components/qr-code/index.mjs +8 -8
- package/dist/components/radio-group/index.d.cts +12 -12
- package/dist/components/radio-group/index.d.mts +12 -12
- package/dist/components/radio-group/index.mjs +11 -11
- package/dist/components/rating-group/index.d.cts +10 -10
- package/dist/components/rating-group/index.d.mts +10 -10
- package/dist/components/rating-group/index.mjs +11 -11
- package/dist/components/scroll-area/index.d.cts +11 -11
- package/dist/components/scroll-area/index.d.mts +11 -11
- package/dist/components/scroll-area/index.mjs +8 -8
- package/dist/components/segment-group/index.d.cts +14 -14
- package/dist/components/segment-group/index.d.mts +14 -14
- package/dist/components/segment-group/index.mjs +8 -8
- package/dist/components/select/index.d.cts +21 -21
- package/dist/components/select/index.d.mts +22 -22
- package/dist/components/select/index.mjs +15 -15
- package/dist/components/signature-pad/index.cjs +213 -0
- package/dist/components/signature-pad/index.d.cts +69 -0
- package/dist/components/signature-pad/index.d.mts +69 -0
- package/dist/components/signature-pad/index.mjs +190 -0
- package/dist/components/slider/index.cjs +278 -0
- package/dist/components/slider/index.d.cts +89 -0
- package/dist/components/slider/index.d.mts +89 -0
- package/dist/components/slider/index.mjs +251 -0
- package/dist/components/splitter/index.cjs +177 -0
- package/dist/components/splitter/index.d.cts +54 -0
- package/dist/components/splitter/index.d.mts +54 -0
- package/dist/components/splitter/index.mjs +151 -0
- package/dist/components/steps/index.cjs +289 -0
- package/dist/components/steps/index.d.cts +104 -0
- package/dist/components/steps/index.d.mts +104 -0
- package/dist/components/steps/index.mjs +260 -0
- package/dist/components/switch/index.cjs +180 -0
- package/dist/components/switch/index.d.cts +59 -0
- package/dist/components/switch/index.d.mts +59 -0
- package/dist/components/switch/index.mjs +159 -0
- package/dist/components/tabs/index.cjs +191 -0
- package/dist/components/tabs/index.d.cts +60 -0
- package/dist/components/tabs/index.d.mts +60 -0
- package/dist/components/tabs/index.mjs +170 -0
- package/dist/components/tags-input/index.cjs +318 -0
- package/dist/components/tags-input/index.d.cts +98 -0
- package/dist/components/tags-input/index.d.mts +98 -0
- package/dist/components/tags-input/index.mjs +289 -0
- package/dist/components/timer/index.cjs +179 -0
- package/dist/components/timer/index.d.cts +64 -0
- package/dist/components/timer/index.d.mts +64 -0
- package/dist/components/timer/index.mjs +157 -0
- package/dist/components/toast/index.cjs +165 -0
- package/dist/components/toast/index.d.cts +60 -0
- package/dist/components/toast/index.d.mts +60 -0
- package/dist/components/toast/index.mjs +144 -0
- package/dist/components/toggle/index.cjs +93 -0
- package/dist/components/toggle/index.d.cts +40 -0
- package/dist/components/toggle/index.d.mts +40 -0
- package/dist/components/toggle/index.mjs +80 -0
- package/dist/components/toggle-group/index.cjs +127 -0
- package/dist/components/toggle-group/index.d.cts +44 -0
- package/dist/components/toggle-group/index.d.mts +44 -0
- package/dist/components/toggle-group/index.mjs +109 -0
- package/dist/components/tooltip/index.cjs +165 -0
- package/dist/components/tooltip/index.d.cts +70 -0
- package/dist/components/tooltip/index.d.mts +71 -0
- package/dist/components/tooltip/index.mjs +143 -0
- package/dist/components/tour/index.cjs +274 -0
- package/dist/components/tour/index.d.cts +108 -0
- package/dist/components/tour/index.d.mts +109 -0
- package/dist/components/tour/index.mjs +250 -0
- package/dist/components/tree-view/index.d.cts +2 -2
- package/dist/components/tree-view/index.d.mts +5 -5
- package/dist/components/tree-view/index.mjs +11 -11
- package/dist/{environment-Cnx9ZBbN.mjs → environment-tlwGXNO0.mjs} +1 -1
- package/dist/{factory-BwIiMV5g.mjs → factory-cfMsSoBo.mjs} +1 -1
- package/dist/{field-BuPxh7ZO.mjs → field-gOd2zfjb.mjs} +9 -9
- package/dist/{fieldset-UIFriN0i.mjs → fieldset-BEq6qoMh.mjs} +8 -8
- package/dist/{index-YjtX6_Hn.d.cts → index-BCPLfgXO.d.cts} +3 -3
- package/dist/{index-BoKwZUuR.d.mts → index-BFMTj3aZ.d.mts} +25 -25
- package/dist/{index-tmg3Dc0S.d.mts → index-BTuBtHhO.d.cts} +7 -7
- package/dist/{index-IQMPWCzE.d.cts → index-CceDvJme.d.cts} +25 -25
- package/dist/{index-CQrt31Vz.d.mts → index-Z3NG9Uo-.d.mts} +3 -3
- package/dist/{index-C-uklBbh.d.cts → index-zgzvveQM.d.mts} +7 -7
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +7 -7
- package/dist/{locale-BheNIyu4.mjs → locale-BmYiujeK.mjs} +1 -1
- package/dist/{portal-Cf1DNJ7L.mjs → portal-KVRub3AL.mjs} +1 -1
- package/dist/{presence-D-rmmMDm.mjs → presence-CxbyNsuo.mjs} +6 -6
- package/dist/{render-strategy-D2htg_Zz.mjs → render-strategy-BakagjKt.mjs} +2 -2
- package/dist/{tree-view-Br67rmuK.mjs → tree-view-D3_iO1Yt.mjs} +9 -9
- package/dist/{use-fieldset-context-DPgRcctn.mjs → use-fieldset-context-BhJsLpTP.mjs} +1 -1
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +132 -2
- /package/dist/{chunk-tPcuhsU6.mjs → chunk-Bw6_Qrqn.mjs} +0 -0
- /package/dist/{compose-refs-ymQahgeo.mjs → compose-refs-DSWOgxGb.mjs} +0 -0
- /package/dist/{core-BrQa5x6H.mjs → core-CAwCcfBy.mjs} +0 -0
- /package/dist/{create-context-aizX7yAt.mjs → create-context-B-_JrOL2.mjs} +0 -0
- /package/dist/{create-split-props-BHHQqbKs.mjs → create-split-props-BjYU0VXX.mjs} +0 -0
- /package/dist/{factory-Bv0JsGLd.d.cts → factory-Fen9bAK7.d.mts} +0 -0
- /package/dist/{factory-DcDjbYQq.d.mts → factory-dXEes8-E.d.cts} +0 -0
- /package/dist/{index-BH0zbKp3.d.mts → index-BHMQ8oZ_.d.mts} +0 -0
- /package/dist/{index-DJx_8PSR.d.mts → index-BVPDbcQQ.d.mts} +0 -0
- /package/dist/{index-CsVbgeF4.d.cts → index-D5x5-_6p.d.cts} +0 -0
- /package/dist/{index-WJ-tNaCp.d.mts → index-DFbafCkW.d.mts} +0 -0
- /package/dist/{index-D2T5b4fK.d.cts → index-Kf5h4wwZ.d.cts} +0 -0
- /package/dist/{normalize-props-EzaAUPva.d.cts → normalize-props-Ddn7AQaE.d.cts} +0 -0
- /package/dist/{providers-B1DbplwV.mjs → providers-DPvEY1gv.mjs} +0 -0
- /package/dist/{render-strategy-DEUBHfUP.d.cts → render-strategy-B_O9rJFa.d.cts} +0 -0
- /package/dist/{render-strategy-C5J78Qs-.d.mts → render-strategy-DHJmxfwl.d.mts} +0 -0
- /package/dist/{types-C2LNTNCl.d.cts → types-0lfB8uM7.d.cts} +0 -0
- /package/dist/{types-CdhepaRC.d.mts → types-C61WyxPn.d.mts} +0 -0
- /package/dist/{use-event-qKb6UUEI.mjs → use-event-CjjVkASI.mjs} +0 -0
- /package/dist/{use-safe-layout-effect-BHE-Ll-k.mjs → use-safe-layout-effect-B6ZrTy_c.mjs} +0 -0
- /package/dist/{utils-Bx4WJ5W9.mjs → utils-BFOdioBT.mjs} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-Bw6_Qrqn.mjs";
|
|
2
|
+
import { i as useMachine, r as normalizeProps, t as mergeProps } from "../../core-CAwCcfBy.mjs";
|
|
3
|
+
import { t as createContext$1 } from "../../create-context-B-_JrOL2.mjs";
|
|
4
|
+
import { n as useEnvironmentContext } from "../../environment-tlwGXNO0.mjs";
|
|
5
|
+
import { i as useLocaleContext } from "../../locale-BmYiujeK.mjs";
|
|
6
|
+
import "../../providers-DPvEY1gv.mjs";
|
|
7
|
+
import { n as sprawlify } from "../../factory-cfMsSoBo.mjs";
|
|
8
|
+
import { t as createSplitProps } from "../../create-split-props-BjYU0VXX.mjs";
|
|
9
|
+
import "../../use-fieldset-context-BhJsLpTP.mjs";
|
|
10
|
+
import "../../use-safe-layout-effect-B6ZrTy_c.mjs";
|
|
11
|
+
import { m as useFieldContext } from "../../field-gOd2zfjb.mjs";
|
|
12
|
+
import { forwardRef, useId } from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as zagSwitch from "@sprawlify/primitives/machines/switch";
|
|
15
|
+
import { anatomy as switchAnatomy } from "@sprawlify/primitives/machines/switch";
|
|
16
|
+
|
|
17
|
+
//#region src/components/switch/use-switch-context.ts
|
|
18
|
+
const [SwitchProvider, useSwitchContext] = createContext$1({
|
|
19
|
+
name: "SwitchContext",
|
|
20
|
+
hookName: "useSwitchContext",
|
|
21
|
+
providerName: "<SwitchProvider />"
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/switch/switch-context.tsx
|
|
26
|
+
const SwitchContext = (props) => props.children(useSwitchContext());
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/components/switch/switch-control.tsx
|
|
30
|
+
const SwitchControl = forwardRef((props, ref) => {
|
|
31
|
+
const mergedProps = mergeProps(useSwitchContext().getControlProps(), props);
|
|
32
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
33
|
+
...mergedProps,
|
|
34
|
+
ref
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
SwitchControl.displayName = "SwitchControl";
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/switch/switch-hidden-input.tsx
|
|
41
|
+
const SwitchHiddenInput = forwardRef((props, ref) => {
|
|
42
|
+
const mergedProps = mergeProps(useSwitchContext().getHiddenInputProps(), props);
|
|
43
|
+
const field = useFieldContext();
|
|
44
|
+
return /* @__PURE__ */ jsx(sprawlify.input, {
|
|
45
|
+
"aria-describedby": field?.ariaDescribedby,
|
|
46
|
+
...mergedProps,
|
|
47
|
+
ref
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
SwitchHiddenInput.displayName = "SwitchHiddenInput";
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/components/switch/switch-label.tsx
|
|
54
|
+
const SwitchLabel = forwardRef((props, ref) => {
|
|
55
|
+
const mergedProps = mergeProps(useSwitchContext().getLabelProps(), props);
|
|
56
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
57
|
+
...mergedProps,
|
|
58
|
+
ref
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
SwitchLabel.displayName = "SwitchLabel";
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/switch/use-switch.ts
|
|
65
|
+
const useSwitch = (props) => {
|
|
66
|
+
const id = useId();
|
|
67
|
+
const { getRootNode } = useEnvironmentContext();
|
|
68
|
+
const { dir } = useLocaleContext();
|
|
69
|
+
const field = useFieldContext();
|
|
70
|
+
const machineProps = {
|
|
71
|
+
id,
|
|
72
|
+
ids: {
|
|
73
|
+
label: field?.ids.label,
|
|
74
|
+
hiddenInput: field?.ids.control
|
|
75
|
+
},
|
|
76
|
+
dir,
|
|
77
|
+
disabled: field?.disabled,
|
|
78
|
+
readOnly: field?.readOnly,
|
|
79
|
+
invalid: field?.invalid,
|
|
80
|
+
required: field?.required,
|
|
81
|
+
getRootNode,
|
|
82
|
+
...props
|
|
83
|
+
};
|
|
84
|
+
const service = useMachine(zagSwitch.machine, machineProps);
|
|
85
|
+
return zagSwitch.connect(service, normalizeProps);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/components/switch/switch-root.tsx
|
|
90
|
+
const splitRootProps = createSplitProps();
|
|
91
|
+
const SwitchRoot = forwardRef((props, ref) => {
|
|
92
|
+
const [useSwitchProps, localProps] = splitRootProps(props, [
|
|
93
|
+
"checked",
|
|
94
|
+
"defaultChecked",
|
|
95
|
+
"disabled",
|
|
96
|
+
"form",
|
|
97
|
+
"id",
|
|
98
|
+
"ids",
|
|
99
|
+
"invalid",
|
|
100
|
+
"label",
|
|
101
|
+
"name",
|
|
102
|
+
"onCheckedChange",
|
|
103
|
+
"readOnly",
|
|
104
|
+
"required",
|
|
105
|
+
"value"
|
|
106
|
+
]);
|
|
107
|
+
const switchContext = useSwitch(useSwitchProps);
|
|
108
|
+
const mergedProps = mergeProps(switchContext.getRootProps(), localProps);
|
|
109
|
+
return /* @__PURE__ */ jsx(SwitchProvider, {
|
|
110
|
+
value: switchContext,
|
|
111
|
+
children: /* @__PURE__ */ jsx(sprawlify.label, {
|
|
112
|
+
...mergedProps,
|
|
113
|
+
ref
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
SwitchRoot.displayName = "SwitchRoot";
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/components/switch/switch-root-provider.tsx
|
|
121
|
+
const splitRootProviderProps = createSplitProps();
|
|
122
|
+
const SwitchRootProvider = forwardRef((props, ref) => {
|
|
123
|
+
const [{ value: api }, localProps] = splitRootProviderProps(props, ["value"]);
|
|
124
|
+
const mergedProps = mergeProps(api.getRootProps(), localProps);
|
|
125
|
+
return /* @__PURE__ */ jsx(SwitchProvider, {
|
|
126
|
+
value: api,
|
|
127
|
+
children: /* @__PURE__ */ jsx(sprawlify.label, {
|
|
128
|
+
...mergedProps,
|
|
129
|
+
ref
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
SwitchRootProvider.displayName = "SwitchRootProvider";
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/switch/switch-thumb.tsx
|
|
137
|
+
const SwitchThumb = forwardRef((props, ref) => {
|
|
138
|
+
const mergedProps = mergeProps(useSwitchContext().getThumbProps(), props);
|
|
139
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
140
|
+
...mergedProps,
|
|
141
|
+
ref
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
SwitchThumb.displayName = "SwitchThumb";
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/components/switch/switch.ts
|
|
148
|
+
var switch_exports = /* @__PURE__ */ __export({
|
|
149
|
+
Context: () => SwitchContext,
|
|
150
|
+
Control: () => SwitchControl,
|
|
151
|
+
HiddenInput: () => SwitchHiddenInput,
|
|
152
|
+
Label: () => SwitchLabel,
|
|
153
|
+
Root: () => SwitchRoot,
|
|
154
|
+
RootProvider: () => SwitchRootProvider,
|
|
155
|
+
Thumb: () => SwitchThumb
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
export { switch_exports as Switch, SwitchContext, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb, switchAnatomy, useSwitch, useSwitchContext };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-BYnRvbsk.cjs');
|
|
2
|
+
const require_core = require('../../core-DCWyxy9D.cjs');
|
|
3
|
+
const require_create_context = require('../../create-context-CQ4U0lLj.cjs');
|
|
4
|
+
const require_environment = require('../../environment-CvilmfQt.cjs');
|
|
5
|
+
const require_locale = require('../../locale-BcnWD1Hf.cjs');
|
|
6
|
+
require('../../providers-BNAArubQ.cjs');
|
|
7
|
+
const require_compose_refs = require('../../compose-refs-C5QNDywq.cjs');
|
|
8
|
+
const require_factory = require('../../factory-C166evrS.cjs');
|
|
9
|
+
const require_create_split_props = require('../../create-split-props-Dp4TWOyM.cjs');
|
|
10
|
+
const require_render_strategy = require('../../render-strategy-BywM_IvB.cjs');
|
|
11
|
+
const require_presence = require('../../presence-CPov8wyU.cjs');
|
|
12
|
+
require('../../use-event-CLH8zHoJ.cjs');
|
|
13
|
+
let react = require("react");
|
|
14
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
|
+
let __sprawlify_primitives_machines_tabs = require("@sprawlify/primitives/machines/tabs");
|
|
16
|
+
__sprawlify_primitives_machines_tabs = require_chunk.__toESM(__sprawlify_primitives_machines_tabs);
|
|
17
|
+
let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
|
|
18
|
+
|
|
19
|
+
//#region src/components/tabs/use-tabs-context.ts
|
|
20
|
+
const [TabsProvider, useTabsContext] = require_create_context.createContext({
|
|
21
|
+
name: "TabsContext",
|
|
22
|
+
hookName: "useTabsContext",
|
|
23
|
+
providerName: "<TabsProvider />"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/tabs/tab-content.tsx
|
|
28
|
+
const splitContentProps = require_create_split_props.createSplitProps();
|
|
29
|
+
const TabContent = (0, react.forwardRef)((props, ref) => {
|
|
30
|
+
const [contentProps, localProps] = splitContentProps(props, ["value"]);
|
|
31
|
+
const tabs = useTabsContext();
|
|
32
|
+
const presence = require_presence.usePresence({
|
|
33
|
+
...require_render_strategy.useRenderStrategyPropsContext(),
|
|
34
|
+
present: tabs.value === props.value,
|
|
35
|
+
immediate: true
|
|
36
|
+
});
|
|
37
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(tabs.getContentProps(contentProps), presence.getPresenceProps(), localProps);
|
|
38
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_presence.PresenceProvider, {
|
|
39
|
+
value: presence,
|
|
40
|
+
children: presence.unmounted ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
41
|
+
...mergedProps,
|
|
42
|
+
ref: require_compose_refs.composeRefs(presence.ref, ref)
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
TabContent.displayName = "TabContent";
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/tabs/tab-indicator.tsx
|
|
50
|
+
const TabIndicator = (0, react.forwardRef)((props, ref) => {
|
|
51
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useTabsContext().getIndicatorProps(), props);
|
|
52
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
53
|
+
...mergedProps,
|
|
54
|
+
ref
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
TabIndicator.displayName = "TabIndicator";
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/components/tabs/tab-list.tsx
|
|
61
|
+
const TabList = (0, react.forwardRef)((props, ref) => {
|
|
62
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useTabsContext().getListProps(), props);
|
|
63
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
64
|
+
...mergedProps,
|
|
65
|
+
ref
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
TabList.displayName = "TabList";
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/components/tabs/tab-trigger.tsx
|
|
72
|
+
const splitTriggerProps = require_create_split_props.createSplitProps();
|
|
73
|
+
const TabTrigger = (0, react.forwardRef)((props, ref) => {
|
|
74
|
+
const [tabProps, localProps] = splitTriggerProps(props, ["disabled", "value"]);
|
|
75
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useTabsContext().getTriggerProps(tabProps), localProps);
|
|
76
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.button, {
|
|
77
|
+
...mergedProps,
|
|
78
|
+
ref
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
TabTrigger.displayName = "TabTrigger";
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/components/tabs/tabs-context.tsx
|
|
85
|
+
const TabsContext = (props) => props.children(useTabsContext());
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/components/tabs/use-tabs.ts
|
|
89
|
+
const useTabs = (props) => {
|
|
90
|
+
const id = (0, react.useId)();
|
|
91
|
+
const { getRootNode } = require_environment.useEnvironmentContext();
|
|
92
|
+
const { dir } = require_locale.useLocaleContext();
|
|
93
|
+
const machineProps = {
|
|
94
|
+
id,
|
|
95
|
+
dir,
|
|
96
|
+
getRootNode,
|
|
97
|
+
...props
|
|
98
|
+
};
|
|
99
|
+
const service = require_core.useMachine(__sprawlify_primitives_machines_tabs.machine, machineProps);
|
|
100
|
+
return __sprawlify_primitives_machines_tabs.connect(service, require_core.normalizeProps);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/components/tabs/tabs-root.tsx
|
|
105
|
+
const splitRootProps = require_create_split_props.createSplitProps();
|
|
106
|
+
const TabsRoot = (0, react.forwardRef)((props, ref) => {
|
|
107
|
+
const [renderStrategyProps, tabsProps] = require_render_strategy.splitRenderStrategyProps(props);
|
|
108
|
+
const [useTabsProps, localProps] = splitRootProps(tabsProps, [
|
|
109
|
+
"activationMode",
|
|
110
|
+
"composite",
|
|
111
|
+
"defaultValue",
|
|
112
|
+
"deselectable",
|
|
113
|
+
"id",
|
|
114
|
+
"ids",
|
|
115
|
+
"loopFocus",
|
|
116
|
+
"navigate",
|
|
117
|
+
"onFocusChange",
|
|
118
|
+
"onValueChange",
|
|
119
|
+
"orientation",
|
|
120
|
+
"translations",
|
|
121
|
+
"value"
|
|
122
|
+
]);
|
|
123
|
+
const tabs = useTabs(useTabsProps);
|
|
124
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(tabs.getRootProps(), localProps);
|
|
125
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsProvider, {
|
|
126
|
+
value: tabs,
|
|
127
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_render_strategy.RenderStrategyPropsProvider, {
|
|
128
|
+
value: renderStrategyProps,
|
|
129
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
130
|
+
...mergedProps,
|
|
131
|
+
ref
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
TabsRoot.displayName = "TabsRoot";
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/components/tabs/tabs-root-provider.tsx
|
|
140
|
+
const splitRootProviderProps = require_create_split_props.createSplitProps();
|
|
141
|
+
const TabsRootProvider = (0, react.forwardRef)((props, ref) => {
|
|
142
|
+
const [renderStrategyProps, tabsProps] = require_render_strategy.splitRenderStrategyProps(props);
|
|
143
|
+
const [{ value: tabs }, localProps] = splitRootProviderProps(tabsProps, ["value"]);
|
|
144
|
+
const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(tabs.getRootProps(), localProps);
|
|
145
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsProvider, {
|
|
146
|
+
value: tabs,
|
|
147
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_render_strategy.RenderStrategyPropsProvider, {
|
|
148
|
+
value: renderStrategyProps,
|
|
149
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
150
|
+
...mergedProps,
|
|
151
|
+
ref
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
TabsRootProvider.displayName = "TabsRootProvider";
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/components/tabs/tabs.ts
|
|
160
|
+
var tabs_exports = /* @__PURE__ */ require_chunk.__export({
|
|
161
|
+
Content: () => TabContent,
|
|
162
|
+
Context: () => TabsContext,
|
|
163
|
+
Indicator: () => TabIndicator,
|
|
164
|
+
List: () => TabList,
|
|
165
|
+
Root: () => TabsRoot,
|
|
166
|
+
RootProvider: () => TabsRootProvider,
|
|
167
|
+
Trigger: () => TabTrigger
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
exports.TabContent = TabContent;
|
|
172
|
+
exports.TabIndicator = TabIndicator;
|
|
173
|
+
exports.TabList = TabList;
|
|
174
|
+
exports.TabTrigger = TabTrigger;
|
|
175
|
+
Object.defineProperty(exports, 'Tabs', {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () {
|
|
178
|
+
return tabs_exports;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
exports.TabsContext = TabsContext;
|
|
182
|
+
exports.TabsRoot = TabsRoot;
|
|
183
|
+
exports.TabsRootProvider = TabsRootProvider;
|
|
184
|
+
Object.defineProperty(exports, 'tabsAnatomy', {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () {
|
|
187
|
+
return __sprawlify_primitives_machines_tabs.anatomy;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
exports.useTabs = useTabs;
|
|
191
|
+
exports.useTabsContext = useTabsContext;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as PropTypes } from "../../normalize-props-Ddn7AQaE.cjs";
|
|
2
|
+
import { r as Optional, t as Assign } from "../../types-0lfB8uM7.cjs";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "../../factory-dXEes8-E.cjs";
|
|
4
|
+
import { t as RenderStrategyProps } from "../../render-strategy-B_O9rJFa.cjs";
|
|
5
|
+
import * as react450 from "react";
|
|
6
|
+
import { ReactNode } from "react";
|
|
7
|
+
import * as tabs from "@sprawlify/primitives/machines/tabs";
|
|
8
|
+
import { ContentProps, FocusChangeDetails, FocusChangeDetails as TabsFocusChangeDetails, TriggerProps, ValueChangeDetails, ValueChangeDetails as TabsValueChangeDetails, anatomy as tabsAnatomy } from "@sprawlify/primitives/machines/tabs";
|
|
9
|
+
|
|
10
|
+
//#region src/components/tabs/tab-content.d.ts
|
|
11
|
+
interface TabContentBaseProps extends ContentProps, PolymorphicProps {}
|
|
12
|
+
interface TabContentProps extends HTMLProps<"div">, TabContentBaseProps {}
|
|
13
|
+
declare const TabContent: react450.ForwardRefExoticComponent<TabContentProps & react450.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/tabs/tab-indicator.d.ts
|
|
16
|
+
interface TabIndicatorBaseProps extends PolymorphicProps {}
|
|
17
|
+
interface TabIndicatorProps extends HTMLProps<"div">, TabIndicatorBaseProps {}
|
|
18
|
+
declare const TabIndicator: react450.ForwardRefExoticComponent<TabIndicatorProps & react450.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/tabs/tab-list.d.ts
|
|
21
|
+
interface TabListBaseProps extends PolymorphicProps {}
|
|
22
|
+
interface TabListProps extends HTMLProps<"div">, TabListBaseProps {}
|
|
23
|
+
declare const TabList: react450.ForwardRefExoticComponent<TabListProps & react450.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/tabs/tab-trigger.d.ts
|
|
26
|
+
interface TabTriggerBaseProps extends TriggerProps, PolymorphicProps {}
|
|
27
|
+
interface TabTriggerProps extends Assign<HTMLProps<"button">, TabTriggerBaseProps> {}
|
|
28
|
+
declare const TabTrigger: react450.ForwardRefExoticComponent<TabTriggerProps & react450.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/tabs/use-tabs.d.ts
|
|
31
|
+
interface UseTabsProps extends Optional<Omit<tabs.Props, "dir" | "getRootNode">, "id"> {}
|
|
32
|
+
interface UseTabsReturn extends tabs.Api<PropTypes> {}
|
|
33
|
+
declare const useTabs: (props?: UseTabsProps) => UseTabsReturn;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/tabs/use-tabs-context.d.ts
|
|
36
|
+
interface UseTabsContext extends UseTabsReturn {}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/tabs/tabs-context.d.ts
|
|
39
|
+
interface TabsContextProps {
|
|
40
|
+
children: (context: UseTabsContext) => ReactNode;
|
|
41
|
+
}
|
|
42
|
+
declare const TabsContext: (props: TabsContextProps) => ReactNode;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/tabs/tabs-root.d.ts
|
|
45
|
+
interface TabsRootBaseProps extends UseTabsProps, RenderStrategyProps, PolymorphicProps {}
|
|
46
|
+
interface TabsRootProps extends Assign<HTMLProps<"div">, TabsRootBaseProps> {}
|
|
47
|
+
declare const TabsRoot: react450.ForwardRefExoticComponent<TabsRootProps & react450.RefAttributes<HTMLDivElement>>;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/tabs/tabs-root-provider.d.ts
|
|
50
|
+
interface RootProviderProps {
|
|
51
|
+
value: UseTabsReturn;
|
|
52
|
+
}
|
|
53
|
+
interface TabsRootProviderBaseProps extends RootProviderProps, RenderStrategyProps, PolymorphicProps {}
|
|
54
|
+
interface TabsRootProviderProps extends HTMLProps<"div">, TabsRootProviderBaseProps {}
|
|
55
|
+
declare const TabsRootProvider: react450.ForwardRefExoticComponent<TabsRootProviderProps & react450.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
declare namespace tabs_d_exports {
|
|
57
|
+
export { TabContent as Content, TabContentBaseProps as ContentBaseProps, TabContentProps as ContentProps, TabsContext as Context, TabsContextProps as ContextProps, FocusChangeDetails, TabIndicator as Indicator, TabIndicatorBaseProps as IndicatorBaseProps, TabIndicatorProps as IndicatorProps, TabList as List, TabListBaseProps as ListBaseProps, TabListProps as ListProps, TabsRoot as Root, TabsRootBaseProps as RootBaseProps, TabsRootProps as RootProps, TabsRootProvider as RootProvider, TabsRootProviderBaseProps as RootProviderBaseProps, TabsRootProviderProps as RootProviderProps, TabTrigger as Trigger, TabTriggerBaseProps as TriggerBaseProps, TabTriggerProps as TriggerProps, ValueChangeDetails };
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { TabContent, type TabContentBaseProps, type TabContentProps, TabIndicator, type TabIndicatorBaseProps, type TabIndicatorProps, TabList, type TabListBaseProps, type TabListProps, TabTrigger, type TabTriggerBaseProps, type TabTriggerProps, tabs_d_exports as Tabs, TabsContext, type TabsContextProps, type TabsFocusChangeDetails, TabsRoot, type TabsRootBaseProps, type TabsRootProps, TabsRootProvider, type TabsRootProviderBaseProps, type TabsRootProviderProps, type TabsValueChangeDetails, type UseTabsContext, type UseTabsProps, type UseTabsReturn, tabsAnatomy, useTabs, useTabsContext };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { r as PropTypes } from "../../index-BVPDbcQQ.mjs";
|
|
2
|
+
import { r as Optional, t as Assign } from "../../types-C61WyxPn.mjs";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "../../factory-Fen9bAK7.mjs";
|
|
4
|
+
import { t as RenderStrategyProps } from "../../render-strategy-DHJmxfwl.mjs";
|
|
5
|
+
import * as react674 from "react";
|
|
6
|
+
import { ReactNode } from "react";
|
|
7
|
+
import * as tabs from "@sprawlify/primitives/machines/tabs";
|
|
8
|
+
import { ContentProps, FocusChangeDetails, FocusChangeDetails as TabsFocusChangeDetails, TriggerProps, ValueChangeDetails, ValueChangeDetails as TabsValueChangeDetails, anatomy as tabsAnatomy } from "@sprawlify/primitives/machines/tabs";
|
|
9
|
+
|
|
10
|
+
//#region src/components/tabs/tab-content.d.ts
|
|
11
|
+
interface TabContentBaseProps extends ContentProps, PolymorphicProps {}
|
|
12
|
+
interface TabContentProps extends HTMLProps<"div">, TabContentBaseProps {}
|
|
13
|
+
declare const TabContent: react674.ForwardRefExoticComponent<TabContentProps & react674.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/tabs/tab-indicator.d.ts
|
|
16
|
+
interface TabIndicatorBaseProps extends PolymorphicProps {}
|
|
17
|
+
interface TabIndicatorProps extends HTMLProps<"div">, TabIndicatorBaseProps {}
|
|
18
|
+
declare const TabIndicator: react674.ForwardRefExoticComponent<TabIndicatorProps & react674.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/tabs/tab-list.d.ts
|
|
21
|
+
interface TabListBaseProps extends PolymorphicProps {}
|
|
22
|
+
interface TabListProps extends HTMLProps<"div">, TabListBaseProps {}
|
|
23
|
+
declare const TabList: react674.ForwardRefExoticComponent<TabListProps & react674.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/tabs/tab-trigger.d.ts
|
|
26
|
+
interface TabTriggerBaseProps extends TriggerProps, PolymorphicProps {}
|
|
27
|
+
interface TabTriggerProps extends Assign<HTMLProps<"button">, TabTriggerBaseProps> {}
|
|
28
|
+
declare const TabTrigger: react674.ForwardRefExoticComponent<TabTriggerProps & react674.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/tabs/use-tabs.d.ts
|
|
31
|
+
interface UseTabsProps extends Optional<Omit<tabs.Props, "dir" | "getRootNode">, "id"> {}
|
|
32
|
+
interface UseTabsReturn extends tabs.Api<PropTypes> {}
|
|
33
|
+
declare const useTabs: (props?: UseTabsProps) => UseTabsReturn;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/tabs/use-tabs-context.d.ts
|
|
36
|
+
interface UseTabsContext extends UseTabsReturn {}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/tabs/tabs-context.d.ts
|
|
39
|
+
interface TabsContextProps {
|
|
40
|
+
children: (context: UseTabsContext) => ReactNode;
|
|
41
|
+
}
|
|
42
|
+
declare const TabsContext: (props: TabsContextProps) => ReactNode;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/tabs/tabs-root.d.ts
|
|
45
|
+
interface TabsRootBaseProps extends UseTabsProps, RenderStrategyProps, PolymorphicProps {}
|
|
46
|
+
interface TabsRootProps extends Assign<HTMLProps<"div">, TabsRootBaseProps> {}
|
|
47
|
+
declare const TabsRoot: react674.ForwardRefExoticComponent<TabsRootProps & react674.RefAttributes<HTMLDivElement>>;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/tabs/tabs-root-provider.d.ts
|
|
50
|
+
interface RootProviderProps {
|
|
51
|
+
value: UseTabsReturn;
|
|
52
|
+
}
|
|
53
|
+
interface TabsRootProviderBaseProps extends RootProviderProps, RenderStrategyProps, PolymorphicProps {}
|
|
54
|
+
interface TabsRootProviderProps extends HTMLProps<"div">, TabsRootProviderBaseProps {}
|
|
55
|
+
declare const TabsRootProvider: react674.ForwardRefExoticComponent<TabsRootProviderProps & react674.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
declare namespace tabs_d_exports {
|
|
57
|
+
export { TabContent as Content, TabContentBaseProps as ContentBaseProps, TabContentProps as ContentProps, TabsContext as Context, TabsContextProps as ContextProps, FocusChangeDetails, TabIndicator as Indicator, TabIndicatorBaseProps as IndicatorBaseProps, TabIndicatorProps as IndicatorProps, TabList as List, TabListBaseProps as ListBaseProps, TabListProps as ListProps, TabsRoot as Root, TabsRootBaseProps as RootBaseProps, TabsRootProps as RootProps, TabsRootProvider as RootProvider, TabsRootProviderBaseProps as RootProviderBaseProps, TabsRootProviderProps as RootProviderProps, TabTrigger as Trigger, TabTriggerBaseProps as TriggerBaseProps, TabTriggerProps as TriggerProps, ValueChangeDetails };
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { TabContent, type TabContentBaseProps, type TabContentProps, TabIndicator, type TabIndicatorBaseProps, type TabIndicatorProps, TabList, type TabListBaseProps, type TabListProps, TabTrigger, type TabTriggerBaseProps, type TabTriggerProps, tabs_d_exports as Tabs, TabsContext, type TabsContextProps, type TabsFocusChangeDetails, TabsRoot, type TabsRootBaseProps, type TabsRootProps, TabsRootProvider, type TabsRootProviderBaseProps, type TabsRootProviderProps, type TabsValueChangeDetails, type UseTabsContext, type UseTabsProps, type UseTabsReturn, tabsAnatomy, useTabs, useTabsContext };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-Bw6_Qrqn.mjs";
|
|
2
|
+
import { i as useMachine, r as normalizeProps, t as mergeProps } from "../../core-CAwCcfBy.mjs";
|
|
3
|
+
import { t as createContext$1 } from "../../create-context-B-_JrOL2.mjs";
|
|
4
|
+
import { n as useEnvironmentContext } from "../../environment-tlwGXNO0.mjs";
|
|
5
|
+
import { i as useLocaleContext } from "../../locale-BmYiujeK.mjs";
|
|
6
|
+
import "../../providers-DPvEY1gv.mjs";
|
|
7
|
+
import { t as composeRefs } from "../../compose-refs-DSWOgxGb.mjs";
|
|
8
|
+
import { n as sprawlify } from "../../factory-cfMsSoBo.mjs";
|
|
9
|
+
import { t as createSplitProps } from "../../create-split-props-BjYU0VXX.mjs";
|
|
10
|
+
import { n as splitRenderStrategyProps, r as useRenderStrategyPropsContext, t as RenderStrategyPropsProvider } from "../../render-strategy-BakagjKt.mjs";
|
|
11
|
+
import { i as usePresence, t as PresenceProvider } from "../../presence-CxbyNsuo.mjs";
|
|
12
|
+
import "../../use-event-CjjVkASI.mjs";
|
|
13
|
+
import { forwardRef, useId } from "react";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
import * as tabs from "@sprawlify/primitives/machines/tabs";
|
|
16
|
+
import { anatomy as tabsAnatomy } from "@sprawlify/primitives/machines/tabs";
|
|
17
|
+
|
|
18
|
+
//#region src/components/tabs/use-tabs-context.ts
|
|
19
|
+
const [TabsProvider, useTabsContext] = createContext$1({
|
|
20
|
+
name: "TabsContext",
|
|
21
|
+
hookName: "useTabsContext",
|
|
22
|
+
providerName: "<TabsProvider />"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/tabs/tab-content.tsx
|
|
27
|
+
const splitContentProps = createSplitProps();
|
|
28
|
+
const TabContent = forwardRef((props, ref) => {
|
|
29
|
+
const [contentProps, localProps] = splitContentProps(props, ["value"]);
|
|
30
|
+
const tabs$1 = useTabsContext();
|
|
31
|
+
const presence = usePresence({
|
|
32
|
+
...useRenderStrategyPropsContext(),
|
|
33
|
+
present: tabs$1.value === props.value,
|
|
34
|
+
immediate: true
|
|
35
|
+
});
|
|
36
|
+
const mergedProps = mergeProps(tabs$1.getContentProps(contentProps), presence.getPresenceProps(), localProps);
|
|
37
|
+
return /* @__PURE__ */ jsx(PresenceProvider, {
|
|
38
|
+
value: presence,
|
|
39
|
+
children: presence.unmounted ? null : /* @__PURE__ */ jsx(sprawlify.div, {
|
|
40
|
+
...mergedProps,
|
|
41
|
+
ref: composeRefs(presence.ref, ref)
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
TabContent.displayName = "TabContent";
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/tabs/tab-indicator.tsx
|
|
49
|
+
const TabIndicator = forwardRef((props, ref) => {
|
|
50
|
+
const mergedProps = mergeProps(useTabsContext().getIndicatorProps(), props);
|
|
51
|
+
return /* @__PURE__ */ jsx(sprawlify.div, {
|
|
52
|
+
...mergedProps,
|
|
53
|
+
ref
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
TabIndicator.displayName = "TabIndicator";
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/components/tabs/tab-list.tsx
|
|
60
|
+
const TabList = forwardRef((props, ref) => {
|
|
61
|
+
const mergedProps = mergeProps(useTabsContext().getListProps(), props);
|
|
62
|
+
return /* @__PURE__ */ jsx(sprawlify.div, {
|
|
63
|
+
...mergedProps,
|
|
64
|
+
ref
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
TabList.displayName = "TabList";
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/components/tabs/tab-trigger.tsx
|
|
71
|
+
const splitTriggerProps = createSplitProps();
|
|
72
|
+
const TabTrigger = forwardRef((props, ref) => {
|
|
73
|
+
const [tabProps, localProps] = splitTriggerProps(props, ["disabled", "value"]);
|
|
74
|
+
const mergedProps = mergeProps(useTabsContext().getTriggerProps(tabProps), localProps);
|
|
75
|
+
return /* @__PURE__ */ jsx(sprawlify.button, {
|
|
76
|
+
...mergedProps,
|
|
77
|
+
ref
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
TabTrigger.displayName = "TabTrigger";
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/components/tabs/tabs-context.tsx
|
|
84
|
+
const TabsContext = (props) => props.children(useTabsContext());
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/tabs/use-tabs.ts
|
|
88
|
+
const useTabs = (props) => {
|
|
89
|
+
const id = useId();
|
|
90
|
+
const { getRootNode } = useEnvironmentContext();
|
|
91
|
+
const { dir } = useLocaleContext();
|
|
92
|
+
const machineProps = {
|
|
93
|
+
id,
|
|
94
|
+
dir,
|
|
95
|
+
getRootNode,
|
|
96
|
+
...props
|
|
97
|
+
};
|
|
98
|
+
const service = useMachine(tabs.machine, machineProps);
|
|
99
|
+
return tabs.connect(service, normalizeProps);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/tabs/tabs-root.tsx
|
|
104
|
+
const splitRootProps = createSplitProps();
|
|
105
|
+
const TabsRoot = forwardRef((props, ref) => {
|
|
106
|
+
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
107
|
+
const [useTabsProps, localProps] = splitRootProps(tabsProps, [
|
|
108
|
+
"activationMode",
|
|
109
|
+
"composite",
|
|
110
|
+
"defaultValue",
|
|
111
|
+
"deselectable",
|
|
112
|
+
"id",
|
|
113
|
+
"ids",
|
|
114
|
+
"loopFocus",
|
|
115
|
+
"navigate",
|
|
116
|
+
"onFocusChange",
|
|
117
|
+
"onValueChange",
|
|
118
|
+
"orientation",
|
|
119
|
+
"translations",
|
|
120
|
+
"value"
|
|
121
|
+
]);
|
|
122
|
+
const tabs$1 = useTabs(useTabsProps);
|
|
123
|
+
const mergedProps = mergeProps(tabs$1.getRootProps(), localProps);
|
|
124
|
+
return /* @__PURE__ */ jsx(TabsProvider, {
|
|
125
|
+
value: tabs$1,
|
|
126
|
+
children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, {
|
|
127
|
+
value: renderStrategyProps,
|
|
128
|
+
children: /* @__PURE__ */ jsx(sprawlify.div, {
|
|
129
|
+
...mergedProps,
|
|
130
|
+
ref
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
TabsRoot.displayName = "TabsRoot";
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/components/tabs/tabs-root-provider.tsx
|
|
139
|
+
const splitRootProviderProps = createSplitProps();
|
|
140
|
+
const TabsRootProvider = forwardRef((props, ref) => {
|
|
141
|
+
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
142
|
+
const [{ value: tabs$1 }, localProps] = splitRootProviderProps(tabsProps, ["value"]);
|
|
143
|
+
const mergedProps = mergeProps(tabs$1.getRootProps(), localProps);
|
|
144
|
+
return /* @__PURE__ */ jsx(TabsProvider, {
|
|
145
|
+
value: tabs$1,
|
|
146
|
+
children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, {
|
|
147
|
+
value: renderStrategyProps,
|
|
148
|
+
children: /* @__PURE__ */ jsx(sprawlify.div, {
|
|
149
|
+
...mergedProps,
|
|
150
|
+
ref
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
TabsRootProvider.displayName = "TabsRootProvider";
|
|
156
|
+
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/components/tabs/tabs.ts
|
|
159
|
+
var tabs_exports = /* @__PURE__ */ __export({
|
|
160
|
+
Content: () => TabContent,
|
|
161
|
+
Context: () => TabsContext,
|
|
162
|
+
Indicator: () => TabIndicator,
|
|
163
|
+
List: () => TabList,
|
|
164
|
+
Root: () => TabsRoot,
|
|
165
|
+
RootProvider: () => TabsRootProvider,
|
|
166
|
+
Trigger: () => TabTrigger
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
export { TabContent, TabIndicator, TabList, TabTrigger, tabs_exports as Tabs, TabsContext, TabsRoot, TabsRootProvider, tabsAnatomy, useTabs, useTabsContext };
|