@ark-ui/solid 4.10.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -9
- package/dist/chunk/{ATMUKDFF.js → 26K66CRD.js} +11 -12
- package/dist/chunk/{U3XJZI3X.jsx → 2LZKFXR5.jsx} +19 -26
- package/dist/chunk/{H4RSHLA7.jsx → 3FYZXSQZ.jsx} +14 -15
- package/dist/chunk/{MQDN267C.jsx → 3VO34CGN.jsx} +13 -13
- package/dist/chunk/{YV5BACLX.js → 46YZVE6D.js} +12 -11
- package/dist/chunk/{MBQQASZE.js → 4QFED3VE.js} +12 -12
- package/dist/chunk/{SWUA2VFC.js → 4UD3WT4B.js} +10 -12
- package/dist/chunk/{IQJBNZOX.jsx → 5T73FAJY.jsx} +13 -8
- package/dist/chunk/{IZC6PKGT.jsx → 65SQKHCI.jsx} +15 -16
- package/dist/chunk/{WM2IZOYM.jsx → 72UBZBQP.jsx} +53 -82
- package/dist/chunk/{F3QPTRGW.jsx → 7IHVZWMT.jsx} +32 -36
- package/dist/chunk/{X34KVQNW.js → 7KGMTGCS.js} +3 -2
- package/dist/chunk/{34MDPAG6.js → 7RR233CD.js} +30 -12
- package/dist/chunk/{7S43DIPW.js → 7S7524Q3.js} +15 -26
- package/dist/chunk/{E72NMPSK.jsx → A4744EEE.jsx} +9 -14
- package/dist/chunk/{BY62F4IV.jsx → AD2EIGNX.jsx} +13 -13
- package/dist/chunk/{3HMZSTYX.js → B246J3FR.js} +10 -11
- package/dist/chunk/{K54W24N6.jsx → B2KZ5VSW.jsx} +15 -17
- package/dist/chunk/{2GATVLPK.js → C4PG7WMU.js} +9 -9
- package/dist/chunk/{3LRXHWW2.js → C745EVQO.js} +32 -27
- package/dist/chunk/{TOVWS5LG.jsx → CA4LWAR2.jsx} +20 -26
- package/dist/chunk/{WKVZFHUH.jsx → CABZW4BQ.jsx} +19 -27
- package/dist/chunk/{Y4LH2CR6.jsx → CGBS64C2.jsx} +13 -13
- package/dist/chunk/{2HTNQLGP.jsx → CHLRHJV2.jsx} +13 -14
- package/dist/chunk/{SJSLQDBZ.jsx → CSDXHOTM.jsx} +15 -20
- package/dist/chunk/{5O4RWSWO.jsx → D2Z5BEON.jsx} +3 -3
- package/dist/chunk/{CPMYIT5J.jsx → D6BC5RCX.jsx} +16 -14
- package/dist/chunk/{6MXKM4GA.js → E4A5DGUC.js} +12 -12
- package/dist/chunk/{2J42A7KM.js → E5BXBABH.js} +2 -2
- package/dist/chunk/{U7SPBSDD.jsx → EEG3DZXG.jsx} +13 -15
- package/dist/chunk/{M2FICVVI.js → EI7I4DR6.js} +12 -13
- package/dist/chunk/{5CYHETDY.js → EWPKE75H.js} +10 -9
- package/dist/chunk/{2W32Z6JZ.js → F5GOQFKX.js} +12 -12
- package/dist/chunk/{CIPYIXIW.js → F7JP3DGZ.js} +11 -12
- package/dist/chunk/{PRMWTLUY.jsx → FUS6GOJL.jsx} +13 -11
- package/dist/chunk/{ASCGEGA5.jsx → GCDTOEZN.jsx} +16 -17
- package/dist/chunk/{G2WIACWP.js → GJSXT6PD.js} +11 -11
- package/dist/chunk/{LVPQ6GR4.js → GMNTJ5KE.js} +9 -9
- package/dist/chunk/{WPFSEVTX.js → I2RQ2435.js} +14 -16
- package/dist/chunk/{AIQFNVCU.jsx → IKA3JJFV.jsx} +14 -20
- package/dist/chunk/{3O5VTKDF.jsx → IYMTFLF3.jsx} +20 -33
- package/dist/chunk/{EHJDQTTW.jsx → JRMTU7C7.jsx} +3 -16
- package/dist/chunk/{VARNCRUN.js → JUYBJNX6.js} +19 -20
- package/dist/chunk/{FNEB2RAF.js → JWXGONCE.js} +12 -12
- package/dist/chunk/{SN5TXTB6.jsx → JZ7ZQZT4.jsx} +17 -54
- package/dist/chunk/{WQQVH7YG.jsx → KBHIJYMD.jsx} +34 -19
- package/dist/chunk/{MMS6MJ72.js → KFJJXGK6.js} +11 -13
- package/dist/chunk/{X3BMEEJH.js → KVVYU5Z3.js} +34 -14
- package/dist/chunk/{T4NRAKVA.jsx → KZCXBFHA.jsx} +14 -12
- package/dist/chunk/{5EVN6V64.js → LK5627GR.js} +15 -17
- package/dist/chunk/{5JS7LFUQ.js → LTZUX6NG.js} +12 -10
- package/dist/chunk/{NK4T7LIZ.jsx → MA35L6TV.jsx} +12 -13
- package/dist/chunk/{ZC6KWJ4T.jsx → MDJAL2LV.jsx} +12 -14
- package/dist/chunk/{CCA5XJM6.jsx → MERJALY6.jsx} +23 -38
- package/dist/chunk/MOG4V2NQ.jsx +15 -0
- package/dist/chunk/{2H4WHODR.js → MSLAT5GQ.js} +10 -12
- package/dist/chunk/{5ONYCKM3.jsx → NEBB7COJ.jsx} +1 -1
- package/dist/chunk/{DU4TY3XA.jsx → NEYCBIOW.jsx} +16 -17
- package/dist/chunk/{DXYB7RYX.js → NF3HZO6T.js} +12 -10
- package/dist/chunk/{5XD5ZSBX.js → NZEL4233.js} +15 -18
- package/dist/chunk/OAPCRIL5.js +8 -0
- package/dist/chunk/{LCESUDZB.js → OY4ARTMM.js} +7 -14
- package/dist/chunk/{Q7NPTAJI.js → QBFJVUX3.js} +10 -10
- package/dist/chunk/{HPDOBQ3V.js → QEMQBM6W.js} +1 -1
- package/dist/chunk/{L7OSYHVR.js → QFAL6GWC.js} +1 -1
- package/dist/chunk/{34OZO53S.js → QTSWXPKO.js} +12 -14
- package/dist/chunk/{JVXNYKNA.js → R5NPBVOA.js} +11 -12
- package/dist/chunk/{3QQZKR3F.jsx → RCXMZN3G.jsx} +1 -1
- package/dist/chunk/{5SRZ3YYC.js → ROXCI3ZP.js} +10 -10
- package/dist/chunk/{GZVCPLKK.jsx → RY6GW37O.jsx} +14 -12
- package/dist/chunk/SDD2HKR3.js +71 -0
- package/dist/chunk/{RAEDLHD3.js → TKGOCHK5.js} +14 -16
- package/dist/chunk/{I5UG2QUO.js → TROPIN4C.js} +1 -7
- package/dist/chunk/{AX5SMQMA.js → TRUQMF25.js} +19 -19
- package/dist/chunk/{NMGUCD2L.jsx → TVCIHLER.jsx} +2 -11
- package/dist/chunk/{YCYZZGN2.jsx → TZDLUIKR.jsx} +14 -10
- package/dist/chunk/{QGV2SUTQ.jsx → U3J33PVO.jsx} +21 -21
- package/dist/chunk/{P7I44WC4.jsx → UCYPIMZC.jsx} +21 -22
- package/dist/chunk/{GXWVYON6.js → UODFV2GS.js} +11 -12
- package/dist/chunk/{7YIHAT7J.jsx → V564AMKR.jsx} +39 -18
- package/dist/chunk/{PSLLOEMD.js → VLQWCBZM.js} +16 -29
- package/dist/chunk/{3WGLTS6O.js → VNK2NPTS.js} +10 -10
- package/dist/chunk/{WIVXL7HJ.jsx → WDXH3NHK.jsx} +14 -15
- package/dist/chunk/{QQUR4MWN.js → WGFUGTWA.js} +18 -19
- package/dist/chunk/{B7LE23PE.jsx → WNIFZKTJ.jsx} +13 -14
- package/dist/chunk/{IOTZAUDA.jsx → WUTUKX4C.jsx} +1 -1
- package/dist/chunk/{XUVXUPEH.js → XN3MSM3M.js} +14 -18
- package/dist/chunk/{MYMGOYXH.js → XR4WJDUT.js} +2 -2
- package/dist/chunk/{DOPROT6M.jsx → XZZ6TULR.jsx} +15 -10
- package/dist/chunk/{QZYE5W7T.jsx → Y7EY3OTU.jsx} +16 -21
- package/dist/chunk/{MRQ2UYM4.jsx → YIVTZ7BP.jsx} +12 -11
- package/dist/chunk/{QODB3C3M.js → YMMMHJJS.js} +3 -3
- package/dist/chunk/{HU7FZMJI.jsx → YPH7FBUN.jsx} +14 -16
- package/dist/chunk/{TC2QHQ47.jsx → Z254KIAA.jsx} +22 -44
- package/dist/chunk/{W43X4SNE.js → Z2TDX72A.js} +9 -8
- package/dist/chunk/{6YQ3EF2J.js → ZGXZNLX2.js} +12 -13
- package/dist/chunk/{R6RE56DG.jsx → ZJM2GZS7.jsx} +4 -1
- package/dist/chunk/{UGKLUHKU.js → ZOGAU3AQ.js} +11 -13
- package/dist/chunk/{7PKUSZKY.jsx → ZPSBF7S2.jsx} +14 -11
- package/dist/chunk/{RZBYC7DR.jsx → ZYF7GVNI.jsx} +21 -27
- package/dist/components/accordion/index.d.ts +4 -9
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.jsx +7 -7
- package/dist/components/avatar/index.d.ts +4 -4
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.jsx +5 -5
- package/dist/components/carousel/index.d.ts +4 -9
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/carousel/index.jsx +5 -5
- package/dist/components/checkbox/index.d.ts +5 -10
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.jsx +8 -8
- package/dist/components/clipboard/index.d.ts +4 -4
- package/dist/components/clipboard/index.js +1 -1
- package/dist/components/clipboard/index.jsx +5 -5
- package/dist/components/collapsible/index.d.ts +4 -9
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/collapsible/index.jsx +6 -6
- package/dist/components/collection.d.ts +3 -3
- package/dist/components/collection.js +1 -1
- package/dist/components/collection.jsx +1 -1
- package/dist/components/color-picker/index.d.ts +6 -16
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-picker/index.jsx +10 -9
- package/dist/components/combobox/index.d.ts +5 -15
- package/dist/components/combobox/index.js +2 -2
- package/dist/components/combobox/index.jsx +12 -11
- package/dist/components/date-picker/index.d.ts +6 -18
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-picker/index.jsx +7 -7
- package/dist/components/dialog/index.d.ts +5 -10
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.jsx +7 -7
- package/dist/components/editable/index.d.ts +4 -14
- package/dist/components/editable/index.js +1 -1
- package/dist/components/editable/index.jsx +8 -7
- package/dist/components/factory.d.ts +1 -1
- package/dist/components/field/index.d.ts +4 -4
- package/dist/components/field/index.js +1 -1
- package/dist/components/field/index.jsx +5 -3
- package/dist/components/fieldset/index.d.ts +4 -4
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/fieldset/index.jsx +3 -2
- package/dist/components/file-upload/index.d.ts +4 -4
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/file-upload/index.jsx +8 -7
- package/dist/components/focus-trap/index.d.ts +2 -2
- package/dist/components/format/index.js +1 -1
- package/dist/components/format/index.jsx +4 -4
- package/dist/components/frame/index.d.ts +1 -1
- package/dist/components/frame/index.js +1 -1
- package/dist/components/frame/index.jsx +4 -4
- package/dist/components/highlight/index.d.ts +2 -2
- package/dist/components/highlight/index.js +1 -1
- package/dist/components/highlight/index.jsx +2 -1
- package/dist/components/hover-card/index.d.ts +5 -10
- package/dist/components/hover-card/index.js +1 -1
- package/dist/components/hover-card/index.jsx +7 -7
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +46 -46
- package/dist/components/index.jsx +289 -290
- package/dist/components/menu/index.d.ts +6 -11
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.jsx +7 -7
- package/dist/components/number-input/index.d.ts +4 -9
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/index.jsx +8 -7
- package/dist/components/pagination/index.d.ts +4 -9
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/index.jsx +5 -5
- package/dist/components/pin-input/index.d.ts +4 -9
- package/dist/components/pin-input/index.js +1 -1
- package/dist/components/pin-input/index.jsx +8 -7
- package/dist/components/popover/index.d.ts +5 -10
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.jsx +7 -7
- package/dist/components/presence/index.d.ts +3 -3
- package/dist/components/presence/index.js +1 -1
- package/dist/components/presence/index.jsx +4 -3
- package/dist/components/progress/index.d.ts +4 -9
- package/dist/components/progress/index.js +1 -1
- package/dist/components/progress/index.jsx +5 -5
- package/dist/components/qr-code/index.d.ts +4 -9
- package/dist/components/qr-code/index.js +1 -1
- package/dist/components/qr-code/index.jsx +5 -5
- package/dist/components/radio-group/index.d.ts +4 -9
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/radio-group/index.jsx +5 -5
- package/dist/components/rating-group/index.d.ts +6 -11
- package/dist/components/rating-group/index.js +1 -1
- package/dist/components/rating-group/index.jsx +8 -7
- package/dist/components/segment-group/index.d.ts +5 -10
- package/dist/components/segment-group/index.js +1 -1
- package/dist/components/segment-group/index.jsx +5 -5
- package/dist/components/select/index.d.ts +5 -15
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/index.jsx +12 -11
- package/dist/components/signature-pad/index.d.ts +4 -4
- package/dist/components/signature-pad/index.js +1 -1
- package/dist/components/signature-pad/index.jsx +8 -7
- package/dist/components/slider/index.d.ts +4 -9
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.jsx +5 -5
- package/dist/components/splitter/index.d.ts +4 -9
- package/dist/components/splitter/index.js +1 -1
- package/dist/components/splitter/index.jsx +5 -5
- package/dist/components/steps/index.d.ts +8 -12
- package/dist/components/steps/index.js +1 -1
- package/dist/components/steps/index.jsx +5 -5
- package/dist/components/switch/index.d.ts +4 -9
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.jsx +8 -7
- package/dist/components/tabs/index.d.ts +4 -9
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.jsx +7 -7
- package/dist/components/tags-input/index.d.ts +4 -9
- package/dist/components/tags-input/index.js +1 -1
- package/dist/components/tags-input/index.jsx +8 -7
- package/dist/components/time-picker/index.d.ts +5 -15
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/time-picker/index.jsx +7 -7
- package/dist/components/timer/index.d.ts +4 -4
- package/dist/components/timer/index.js +1 -1
- package/dist/components/timer/index.jsx +5 -5
- package/dist/components/toast/index.d.ts +6 -7
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toast/index.jsx +6 -2
- package/dist/components/toggle/index.d.ts +7 -36
- package/dist/components/toggle/index.js +1 -1
- package/dist/components/toggle/index.jsx +2 -4
- package/dist/components/toggle-group/index.d.ts +4 -9
- package/dist/components/toggle-group/index.js +1 -1
- package/dist/components/toggle-group/index.jsx +5 -5
- package/dist/components/tooltip/index.d.ts +5 -10
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.jsx +7 -7
- package/dist/components/tour/index.d.ts +6 -6
- package/dist/components/tour/index.js +1 -1
- package/dist/components/tour/index.jsx +7 -7
- package/dist/components/tree-view/index.d.ts +7 -17
- package/dist/components/tree-view/index.js +2 -2
- package/dist/components/tree-view/index.jsx +9 -9
- package/dist/index.d.ts +3 -2
- package/dist/index.js +48 -48
- package/dist/index.jsx +290 -291
- package/dist/providers/environment/index.js +1 -1
- package/dist/providers/environment/index.jsx +2 -2
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.jsx +4 -4
- package/dist/providers/locale/index.js +1 -1
- package/dist/providers/locale/index.jsx +2 -2
- package/dist/types-CxryXVkR.d.ts +8 -0
- package/dist/{use-presence-Ct1onT3-.d.ts → use-presence-B6QV_j94.d.ts} +3 -3
- package/package.json +71 -78
- package/dist/chunk/52WUF3CY.jsx +0 -26
- package/dist/chunk/BSPFGETO.js +0 -21
- package/dist/chunk/CTTG4GSG.js +0 -30
- package/dist/chunk/JHG4EID2.jsx +0 -233
- package/dist/chunk/MV3KTL7M.js +0 -107
- package/dist/types-B277wCdv.d.ts +0 -5
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createSplitProps } from './ZMHI4GDJ.js';
|
|
2
2
|
import { ark } from './EPLBB4QN.js';
|
|
3
|
-
import { useEnvironmentContext } from './
|
|
4
|
-
import { useLocaleContext } from './
|
|
5
|
-
import { createContext } from './
|
|
3
|
+
import { useEnvironmentContext } from './YMMMHJJS.js';
|
|
4
|
+
import { useLocaleContext } from './QEMQBM6W.js';
|
|
5
|
+
import { createContext } from './TROPIN4C.js';
|
|
6
|
+
import { runIfFn } from './DT73WLR4.js';
|
|
6
7
|
import { __export } from './ESLJRKWD.js';
|
|
7
8
|
import { createComponent } from 'solid-js/web';
|
|
8
9
|
import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
|
|
@@ -11,12 +12,10 @@ import { anatomy } from '@zag-js/radio-group';
|
|
|
11
12
|
import { createMemo, createUniqueId } from 'solid-js';
|
|
12
13
|
|
|
13
14
|
// src/components/segment-group/use-segment-group-context.ts
|
|
14
|
-
var [SegmentGroupProvider, useSegmentGroupContext] = createContext(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
);
|
|
15
|
+
var [SegmentGroupProvider, useSegmentGroupContext] = createContext({
|
|
16
|
+
hookName: "useSegmentGroupContext",
|
|
17
|
+
providerName: "<SegmentGroupProvider />"
|
|
18
|
+
});
|
|
20
19
|
|
|
21
20
|
// src/components/segment-group/segment-group-context.tsx
|
|
22
21
|
var SegmentGroupContext = (props) => props.children(useSegmentGroupContext());
|
|
@@ -86,19 +85,18 @@ var SegmentGroupLabel = (props) => {
|
|
|
86
85
|
const mergedProps = mergeProps(() => segmentGroup2().getLabelProps(), parts.label.attrs, props);
|
|
87
86
|
return createComponent(ark.label, mergedProps);
|
|
88
87
|
};
|
|
89
|
-
var useSegmentGroup = (props
|
|
88
|
+
var useSegmentGroup = (props) => {
|
|
89
|
+
const id = createUniqueId();
|
|
90
90
|
const locale = useLocaleContext();
|
|
91
91
|
const environment = useEnvironmentContext();
|
|
92
|
-
const
|
|
93
|
-
const context = createMemo(() => ({
|
|
92
|
+
const machineProps = createMemo(() => ({
|
|
94
93
|
id,
|
|
95
94
|
dir: locale().dir,
|
|
96
95
|
getRootNode: environment().getRootNode,
|
|
97
|
-
|
|
98
|
-
...props
|
|
96
|
+
...runIfFn(props)
|
|
99
97
|
}));
|
|
100
|
-
const
|
|
101
|
-
return createMemo(() => segmentGroup.connect(
|
|
98
|
+
const service = useMachine(segmentGroup.machine, machineProps);
|
|
99
|
+
return createMemo(() => segmentGroup.connect(service, normalizeProps));
|
|
102
100
|
};
|
|
103
101
|
|
|
104
102
|
// src/components/segment-group/segment-group-root.tsx
|
|
@@ -5,13 +5,7 @@ function getErrorMessage(hook, provider) {
|
|
|
5
5
|
return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
|
|
6
6
|
}
|
|
7
7
|
function createContext(options = {}) {
|
|
8
|
-
const {
|
|
9
|
-
strict = true,
|
|
10
|
-
hookName = "useContext",
|
|
11
|
-
providerName = "Provider",
|
|
12
|
-
errorMessage,
|
|
13
|
-
defaultValue
|
|
14
|
-
} = options;
|
|
8
|
+
const { strict = true, hookName = "useContext", providerName = "Provider", errorMessage, defaultValue } = options;
|
|
15
9
|
const Context = createContext$1(defaultValue);
|
|
16
10
|
function useContext$1() {
|
|
17
11
|
const context = useContext(Context);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useFieldContext } from './
|
|
1
|
+
import { useFieldContext } from './KVVYU5Z3.js';
|
|
2
2
|
import { createSplitProps } from './ZMHI4GDJ.js';
|
|
3
3
|
import { ark } from './EPLBB4QN.js';
|
|
4
|
-
import { useEnvironmentContext } from './
|
|
5
|
-
import { useLocaleContext } from './
|
|
6
|
-
import { createContext } from './
|
|
4
|
+
import { useEnvironmentContext } from './YMMMHJJS.js';
|
|
5
|
+
import { useLocaleContext } from './QEMQBM6W.js';
|
|
6
|
+
import { createContext } from './TROPIN4C.js';
|
|
7
|
+
import { runIfFn } from './DT73WLR4.js';
|
|
7
8
|
import { __export } from './ESLJRKWD.js';
|
|
8
9
|
import { createComponent, mergeProps as mergeProps$1 } from 'solid-js/web';
|
|
9
10
|
import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
|
|
10
11
|
import { createMemo, createUniqueId } from 'solid-js';
|
|
11
|
-
import * as
|
|
12
|
+
import * as ratingGroup from '@zag-js/rating-group';
|
|
12
13
|
export { anatomy } from '@zag-js/rating-group';
|
|
13
14
|
|
|
14
15
|
// src/components/rating-group/use-rating-group-context.ts
|
|
@@ -20,13 +21,13 @@ var [RatingGroupProvider, useRatingGroupContext] = createContext({
|
|
|
20
21
|
// src/components/rating-group/rating-group-context.tsx
|
|
21
22
|
var RatingGroupContext = (props) => props.children(useRatingGroupContext());
|
|
22
23
|
var RatingGroupControl = (props) => {
|
|
23
|
-
const
|
|
24
|
-
const mergedProps = mergeProps(() =>
|
|
24
|
+
const ratingGroup2 = useRatingGroupContext();
|
|
25
|
+
const mergedProps = mergeProps(() => ratingGroup2().getControlProps(), props);
|
|
25
26
|
return createComponent(ark.div, mergedProps);
|
|
26
27
|
};
|
|
27
28
|
var RatingGroupHiddenInput = (props) => {
|
|
28
|
-
const
|
|
29
|
-
const mergedProps = mergeProps(() =>
|
|
29
|
+
const ratingGroup2 = useRatingGroupContext();
|
|
30
|
+
const mergedProps = mergeProps(() => ratingGroup2().getHiddenInputProps(), props);
|
|
30
31
|
const field = useFieldContext();
|
|
31
32
|
return createComponent(ark.input, mergeProps$1({
|
|
32
33
|
get ["aria-describedby"]() {
|
|
@@ -62,12 +63,12 @@ var RatingGroupLabel = (props) => {
|
|
|
62
63
|
const mergedProps = mergeProps(() => api().getLabelProps(), props);
|
|
63
64
|
return createComponent(ark.label, mergedProps);
|
|
64
65
|
};
|
|
65
|
-
var useRatingGroup = (props
|
|
66
|
+
var useRatingGroup = (props) => {
|
|
67
|
+
const id = createUniqueId();
|
|
66
68
|
const locale = useLocaleContext();
|
|
67
69
|
const environment = useEnvironmentContext();
|
|
68
|
-
const id = createUniqueId();
|
|
69
70
|
const field = useFieldContext();
|
|
70
|
-
const
|
|
71
|
+
const machineProps = createMemo(() => ({
|
|
71
72
|
id,
|
|
72
73
|
ids: {
|
|
73
74
|
label: field?.().ids.label,
|
|
@@ -78,11 +79,10 @@ var useRatingGroup = (props = {}) => {
|
|
|
78
79
|
required: field?.().required,
|
|
79
80
|
dir: locale().dir,
|
|
80
81
|
getRootNode: environment().getRootNode,
|
|
81
|
-
|
|
82
|
-
...props
|
|
82
|
+
...runIfFn(props)
|
|
83
83
|
}));
|
|
84
|
-
const
|
|
85
|
-
return createMemo(() =>
|
|
84
|
+
const service = useMachine(ratingGroup.machine, machineProps);
|
|
85
|
+
return createMemo(() => ratingGroup.connect(service, normalizeProps));
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
// src/components/rating-group/rating-group-root.tsx
|
|
@@ -99,11 +99,11 @@ var RatingGroupRoot = (props) => {
|
|
|
99
99
|
};
|
|
100
100
|
var RatingGroupRootProvider = (props) => {
|
|
101
101
|
const [{
|
|
102
|
-
value:
|
|
102
|
+
value: ratingGroup2
|
|
103
103
|
}, localProps] = createSplitProps()(props, ["value"]);
|
|
104
|
-
const mergedProps = mergeProps(() =>
|
|
104
|
+
const mergedProps = mergeProps(() => ratingGroup2().getRootProps(), localProps);
|
|
105
105
|
return createComponent(RatingGroupProvider, {
|
|
106
|
-
value:
|
|
106
|
+
value: ratingGroup2,
|
|
107
107
|
get children() {
|
|
108
108
|
return createComponent(ark.div, mergedProps);
|
|
109
109
|
}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
// src/utils/create-context.ts
|
|
2
|
-
import {
|
|
3
|
-
createContext as createSolidContext,
|
|
4
|
-
useContext as useSolidContext
|
|
5
|
-
} from "solid-js";
|
|
2
|
+
import { createContext as createSolidContext, useContext as useSolidContext } from "solid-js";
|
|
6
3
|
function getErrorMessage(hook, provider) {
|
|
7
4
|
return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
|
|
8
5
|
}
|
|
9
6
|
function createContext(options = {}) {
|
|
10
|
-
const {
|
|
11
|
-
strict = true,
|
|
12
|
-
hookName = "useContext",
|
|
13
|
-
providerName = "Provider",
|
|
14
|
-
errorMessage,
|
|
15
|
-
defaultValue
|
|
16
|
-
} = options;
|
|
7
|
+
const { strict = true, hookName = "useContext", providerName = "Provider", errorMessage, defaultValue } = options;
|
|
17
8
|
const Context = createSolidContext(defaultValue);
|
|
18
9
|
function useContext() {
|
|
19
10
|
const context = useSolidContext(Context);
|
|
@@ -6,10 +6,13 @@ import {
|
|
|
6
6
|
} from "./UFYZ7HLU.jsx";
|
|
7
7
|
import {
|
|
8
8
|
useEnvironmentContext
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./D2Z5BEON.jsx";
|
|
10
10
|
import {
|
|
11
11
|
createContext
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./TVCIHLER.jsx";
|
|
13
|
+
import {
|
|
14
|
+
runIfFn
|
|
15
|
+
} from "./KGOB2IMX.jsx";
|
|
13
16
|
import {
|
|
14
17
|
__export
|
|
15
18
|
} from "./7IUG3E2V.jsx";
|
|
@@ -25,8 +28,9 @@ var [TimerProvider, useTimerContext] = createContext({
|
|
|
25
28
|
|
|
26
29
|
// src/components/timer/timer-action-trigger.tsx
|
|
27
30
|
var TimerActionTrigger = (props) => {
|
|
31
|
+
const [actionTriggerProps, localProps] = createSplitProps()(props, ["action"]);
|
|
28
32
|
const timer2 = useTimerContext();
|
|
29
|
-
const mergedProps = mergeProps(() => timer2().getActionTriggerProps(
|
|
33
|
+
const mergedProps = mergeProps(() => timer2().getActionTriggerProps(actionTriggerProps), localProps);
|
|
30
34
|
return <ark.button {...mergedProps} />;
|
|
31
35
|
};
|
|
32
36
|
|
|
@@ -65,16 +69,16 @@ import { mergeProps as mergeProps5 } from "@zag-js/solid";
|
|
|
65
69
|
import { normalizeProps, useMachine } from "@zag-js/solid";
|
|
66
70
|
import * as timer from "@zag-js/timer";
|
|
67
71
|
import { createMemo, createUniqueId } from "solid-js";
|
|
68
|
-
var useTimer = (props
|
|
69
|
-
const env = useEnvironmentContext();
|
|
72
|
+
var useTimer = (props) => {
|
|
70
73
|
const id = createUniqueId();
|
|
71
|
-
const
|
|
74
|
+
const environment = useEnvironmentContext();
|
|
75
|
+
const machineProps = createMemo(() => ({
|
|
72
76
|
id,
|
|
73
|
-
getRootNode:
|
|
74
|
-
...props
|
|
77
|
+
getRootNode: environment().getRootNode,
|
|
78
|
+
...runIfFn(props)
|
|
75
79
|
}));
|
|
76
|
-
const
|
|
77
|
-
return createMemo(() => timer.connect(
|
|
80
|
+
const service = useMachine(timer.machine, machineProps);
|
|
81
|
+
return createMemo(() => timer.connect(service, normalizeProps));
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
// src/components/timer/timer-root.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useFieldContext
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./UCYPIMZC.jsx";
|
|
4
4
|
import {
|
|
5
5
|
createSplitProps
|
|
6
6
|
} from "./6WEDGJKQ.jsx";
|
|
@@ -9,13 +9,16 @@ import {
|
|
|
9
9
|
} from "./UFYZ7HLU.jsx";
|
|
10
10
|
import {
|
|
11
11
|
useEnvironmentContext
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./D2Z5BEON.jsx";
|
|
13
13
|
import {
|
|
14
14
|
useLocaleContext
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./RCXMZN3G.jsx";
|
|
16
16
|
import {
|
|
17
17
|
createContext
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./TVCIHLER.jsx";
|
|
19
|
+
import {
|
|
20
|
+
runIfFn
|
|
21
|
+
} from "./KGOB2IMX.jsx";
|
|
19
22
|
import {
|
|
20
23
|
__export
|
|
21
24
|
} from "./7IUG3E2V.jsx";
|
|
@@ -32,16 +35,16 @@ var RatingGroupContext = (props) => props.children(useRatingGroupContext());
|
|
|
32
35
|
// src/components/rating-group/rating-group-control.tsx
|
|
33
36
|
import { mergeProps } from "@zag-js/solid";
|
|
34
37
|
var RatingGroupControl = (props) => {
|
|
35
|
-
const
|
|
36
|
-
const mergedProps = mergeProps(() =>
|
|
38
|
+
const ratingGroup2 = useRatingGroupContext();
|
|
39
|
+
const mergedProps = mergeProps(() => ratingGroup2().getControlProps(), props);
|
|
37
40
|
return <ark.div {...mergedProps} />;
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
// src/components/rating-group/rating-group-hidden-input.tsx
|
|
41
44
|
import { mergeProps as mergeProps2 } from "@zag-js/solid";
|
|
42
45
|
var RatingGroupHiddenInput = (props) => {
|
|
43
|
-
const
|
|
44
|
-
const mergedProps = mergeProps2(() =>
|
|
46
|
+
const ratingGroup2 = useRatingGroupContext();
|
|
47
|
+
const mergedProps = mergeProps2(() => ratingGroup2().getHiddenInputProps(), props);
|
|
45
48
|
const field = useFieldContext();
|
|
46
49
|
return <ark.input aria-describedby={field?.().ariaDescribedby} {...mergedProps} />;
|
|
47
50
|
};
|
|
@@ -82,15 +85,15 @@ var RatingGroupLabel = (props) => {
|
|
|
82
85
|
import { mergeProps as mergeProps5 } from "@zag-js/solid";
|
|
83
86
|
|
|
84
87
|
// src/components/rating-group/use-rating-group.ts
|
|
85
|
-
import * as
|
|
88
|
+
import * as ratingGroup from "@zag-js/rating-group";
|
|
86
89
|
import { normalizeProps, useMachine } from "@zag-js/solid";
|
|
87
90
|
import { createMemo as createMemo2, createUniqueId } from "solid-js";
|
|
88
|
-
var useRatingGroup = (props
|
|
91
|
+
var useRatingGroup = (props) => {
|
|
92
|
+
const id = createUniqueId();
|
|
89
93
|
const locale = useLocaleContext();
|
|
90
94
|
const environment = useEnvironmentContext();
|
|
91
|
-
const id = createUniqueId();
|
|
92
95
|
const field = useFieldContext();
|
|
93
|
-
const
|
|
96
|
+
const machineProps = createMemo2(() => ({
|
|
94
97
|
id,
|
|
95
98
|
ids: {
|
|
96
99
|
label: field?.().ids.label,
|
|
@@ -101,11 +104,10 @@ var useRatingGroup = (props = {}) => {
|
|
|
101
104
|
required: field?.().required,
|
|
102
105
|
dir: locale().dir,
|
|
103
106
|
getRootNode: environment().getRootNode,
|
|
104
|
-
|
|
105
|
-
...props
|
|
107
|
+
...runIfFn(props)
|
|
106
108
|
}));
|
|
107
|
-
const
|
|
108
|
-
return createMemo2(() =>
|
|
109
|
+
const service = useMachine(ratingGroup.machine, machineProps);
|
|
110
|
+
return createMemo2(() => ratingGroup.connect(service, normalizeProps));
|
|
109
111
|
};
|
|
110
112
|
|
|
111
113
|
// src/components/rating-group/rating-group-root.tsx
|
|
@@ -137,11 +139,9 @@ var RatingGroupRoot = (props) => {
|
|
|
137
139
|
// src/components/rating-group/rating-group-root-provider.tsx
|
|
138
140
|
import { mergeProps as mergeProps6 } from "@zag-js/solid";
|
|
139
141
|
var RatingGroupRootProvider = (props) => {
|
|
140
|
-
const [{ value:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const mergedProps = mergeProps6(() => ratingGroup().getRootProps(), localProps);
|
|
144
|
-
return <RatingGroupProvider value={ratingGroup}>
|
|
142
|
+
const [{ value: ratingGroup2 }, localProps] = createSplitProps()(props, ["value"]);
|
|
143
|
+
const mergedProps = mergeProps6(() => ratingGroup2().getRootProps(), localProps);
|
|
144
|
+
return <RatingGroupProvider value={ratingGroup2}>
|
|
145
145
|
<ark.div {...mergedProps} />
|
|
146
146
|
</RatingGroupProvider>;
|
|
147
147
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useFieldsetContext
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./ZYF7GVNI.jsx";
|
|
4
|
+
import {
|
|
5
|
+
composeRefs
|
|
6
|
+
} from "./DOBZPYAN.jsx";
|
|
4
7
|
import {
|
|
5
8
|
createSplitProps
|
|
6
9
|
} from "./6WEDGJKQ.jsx";
|
|
@@ -9,7 +12,7 @@ import {
|
|
|
9
12
|
} from "./UFYZ7HLU.jsx";
|
|
10
13
|
import {
|
|
11
14
|
createContext
|
|
12
|
-
} from "./
|
|
15
|
+
} from "./TVCIHLER.jsx";
|
|
13
16
|
import {
|
|
14
17
|
__export
|
|
15
18
|
} from "./7IUG3E2V.jsx";
|
|
@@ -75,14 +78,7 @@ import { mergeProps as mergeProps7 } from "@zag-js/solid";
|
|
|
75
78
|
|
|
76
79
|
// src/components/field/use-field.ts
|
|
77
80
|
import { ariaAttr, dataAttr, getWindow } from "@zag-js/dom-query";
|
|
78
|
-
import {
|
|
79
|
-
createEffect,
|
|
80
|
-
createMemo,
|
|
81
|
-
createSignal,
|
|
82
|
-
createUniqueId,
|
|
83
|
-
mergeProps as mergeProps6,
|
|
84
|
-
onCleanup
|
|
85
|
-
} from "solid-js";
|
|
81
|
+
import { createMemo, createSignal, createUniqueId, mergeProps as mergeProps6, onCleanup, onMount } from "solid-js";
|
|
86
82
|
|
|
87
83
|
// src/components/field/field.anatomy.ts
|
|
88
84
|
import { createAnatomy } from "@zag-js/anatomy";
|
|
@@ -108,13 +104,13 @@ var useField = (props) => {
|
|
|
108
104
|
const [hasErrorText, setHasErrorText] = createSignal(false);
|
|
109
105
|
const [hasHelperText, setHasHelperText] = createSignal(false);
|
|
110
106
|
const id = fieldProps.id ?? createUniqueId();
|
|
111
|
-
|
|
107
|
+
const [rootRef, setRootRef] = createSignal(void 0);
|
|
112
108
|
const rootId = fieldProps.ids?.control ?? `field::${id}`;
|
|
113
109
|
const errorTextId = fieldProps.ids?.errorText ?? `field::${id}::error-text`;
|
|
114
110
|
const helperTextId = fieldProps.ids?.helperText ?? `field::${id}::helper-text`;
|
|
115
111
|
const labelId = fieldProps.ids?.label ?? `field::${id}::label`;
|
|
116
|
-
|
|
117
|
-
const rootNode = rootRef;
|
|
112
|
+
onMount(() => {
|
|
113
|
+
const rootNode = rootRef();
|
|
118
114
|
if (!rootNode) return;
|
|
119
115
|
const win = getWindow(rootNode);
|
|
120
116
|
const doc = win.document;
|
|
@@ -143,11 +139,14 @@ var useField = (props) => {
|
|
|
143
139
|
"data-readonly": dataAttr(fieldProps.readOnly),
|
|
144
140
|
htmlFor: id
|
|
145
141
|
});
|
|
146
|
-
const labelIds =
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const labelIds = createMemo(() => {
|
|
143
|
+
const ids = [];
|
|
144
|
+
if (hasErrorText() && fieldProps.invalid) ids.push(errorTextId);
|
|
145
|
+
if (hasHelperText()) ids.push(helperTextId);
|
|
146
|
+
return ids;
|
|
147
|
+
});
|
|
149
148
|
const getControlProps = () => ({
|
|
150
|
-
"aria-describedby": labelIds.join(" ") || void 0,
|
|
149
|
+
"aria-describedby": labelIds().join(" ") || void 0,
|
|
151
150
|
"aria-invalid": ariaAttr(fieldProps.invalid),
|
|
152
151
|
"data-invalid": dataAttr(fieldProps.invalid),
|
|
153
152
|
"data-required": dataAttr(fieldProps.required),
|
|
@@ -184,7 +183,7 @@ var useField = (props) => {
|
|
|
184
183
|
...parts.requiredIndicator.attrs
|
|
185
184
|
});
|
|
186
185
|
return createMemo(() => ({
|
|
187
|
-
ariaDescribedby: labelIds.join(" "),
|
|
186
|
+
ariaDescribedby: labelIds().join(" "),
|
|
188
187
|
ids: {
|
|
189
188
|
control: id,
|
|
190
189
|
label: labelId,
|
|
@@ -192,7 +191,7 @@ var useField = (props) => {
|
|
|
192
191
|
helperText: helperTextId
|
|
193
192
|
},
|
|
194
193
|
refs: {
|
|
195
|
-
rootRef
|
|
194
|
+
rootRef: setRootRef
|
|
196
195
|
},
|
|
197
196
|
disabled: fieldProps.disabled,
|
|
198
197
|
invalid: fieldProps.invalid,
|
|
@@ -222,7 +221,7 @@ var FieldRoot = (props) => {
|
|
|
222
221
|
const field = useField(useFieldProps);
|
|
223
222
|
const mergedProps = mergeProps7(() => field().getRootProps(), localProps);
|
|
224
223
|
return <FieldProvider value={field}>
|
|
225
|
-
<ark.div {...mergedProps} />
|
|
224
|
+
<ark.div {...mergedProps} ref={composeRefs(field().refs.rootRef, props.ref)} />
|
|
226
225
|
</FieldProvider>;
|
|
227
226
|
};
|
|
228
227
|
|
|
@@ -247,7 +246,7 @@ var FieldSelect = (props) => {
|
|
|
247
246
|
// src/components/field/field-textarea.tsx
|
|
248
247
|
import { autoresizeTextarea } from "@zag-js/auto-resize";
|
|
249
248
|
import { mergeProps as mergeProps10 } from "@zag-js/solid";
|
|
250
|
-
import { createEffect
|
|
249
|
+
import { createEffect } from "solid-js";
|
|
251
250
|
var FieldTextarea = (props) => {
|
|
252
251
|
const field = useFieldContext();
|
|
253
252
|
let textareaRef;
|
|
@@ -257,7 +256,7 @@ var FieldTextarea = (props) => {
|
|
|
257
256
|
() => ({ style: { resize: autoresize ? "none" : void 0 } }),
|
|
258
257
|
textareaProps
|
|
259
258
|
);
|
|
260
|
-
|
|
259
|
+
createEffect(() => {
|
|
261
260
|
if (!autoresize) return;
|
|
262
261
|
const cleanup = autoresizeTextarea(textareaRef);
|
|
263
262
|
return cleanup;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { splitPresenceProps, usePresence, PresenceProvider, usePresenceContext } from './OY4ARTMM.js';
|
|
2
2
|
import { createSplitProps } from './ZMHI4GDJ.js';
|
|
3
3
|
import { ark } from './EPLBB4QN.js';
|
|
4
|
-
import { useEnvironmentContext } from './
|
|
5
|
-
import { useLocaleContext } from './
|
|
6
|
-
import { createContext } from './
|
|
4
|
+
import { useEnvironmentContext } from './YMMMHJJS.js';
|
|
5
|
+
import { useLocaleContext } from './QEMQBM6W.js';
|
|
6
|
+
import { createContext } from './TROPIN4C.js';
|
|
7
|
+
import { runIfFn } from './DT73WLR4.js';
|
|
7
8
|
import { __export } from './ESLJRKWD.js';
|
|
8
9
|
import { createComponent } from 'solid-js/web';
|
|
9
10
|
import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
|
|
@@ -57,20 +58,18 @@ var TooltipPositioner = (props) => {
|
|
|
57
58
|
}
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
|
-
var useTooltip = (props
|
|
61
|
+
var useTooltip = (props) => {
|
|
62
|
+
const id = createUniqueId();
|
|
61
63
|
const locale = useLocaleContext();
|
|
62
64
|
const environment = useEnvironmentContext();
|
|
63
|
-
const
|
|
64
|
-
const context = createMemo(() => ({
|
|
65
|
+
const machineProps = createMemo(() => ({
|
|
65
66
|
id,
|
|
66
67
|
dir: locale().dir,
|
|
67
68
|
getRootNode: environment().getRootNode,
|
|
68
|
-
|
|
69
|
-
"open.controlled": props.open !== void 0,
|
|
70
|
-
...props
|
|
69
|
+
...runIfFn(props)
|
|
71
70
|
}));
|
|
72
|
-
const
|
|
73
|
-
return createMemo(() => tooltip.connect(
|
|
71
|
+
const service = useMachine(tooltip.machine, machineProps);
|
|
72
|
+
return createMemo(() => tooltip.connect(service, normalizeProps));
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
// src/components/tooltip/tooltip-root.tsx
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useControllableState
|
|
3
|
-
} from "./52WUF3CY.jsx";
|
|
4
1
|
import {
|
|
5
2
|
useFieldContext
|
|
6
|
-
} from "./
|
|
3
|
+
} from "./UCYPIMZC.jsx";
|
|
7
4
|
import {
|
|
8
5
|
createSplitProps
|
|
9
6
|
} from "./6WEDGJKQ.jsx";
|
|
@@ -12,13 +9,16 @@ import {
|
|
|
12
9
|
} from "./UFYZ7HLU.jsx";
|
|
13
10
|
import {
|
|
14
11
|
useEnvironmentContext
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./D2Z5BEON.jsx";
|
|
16
13
|
import {
|
|
17
14
|
useLocaleContext
|
|
18
|
-
} from "./
|
|
15
|
+
} from "./RCXMZN3G.jsx";
|
|
19
16
|
import {
|
|
20
17
|
createContext
|
|
21
|
-
} from "./
|
|
18
|
+
} from "./TVCIHLER.jsx";
|
|
19
|
+
import {
|
|
20
|
+
runIfFn
|
|
21
|
+
} from "./KGOB2IMX.jsx";
|
|
22
22
|
import {
|
|
23
23
|
__export
|
|
24
24
|
} from "./7IUG3E2V.jsx";
|
|
@@ -45,15 +45,36 @@ import { anatomy } from "@zag-js/checkbox";
|
|
|
45
45
|
var checkboxAnatomy = anatomy.extendWith("group");
|
|
46
46
|
|
|
47
47
|
// src/components/checkbox/use-checkbox-group.ts
|
|
48
|
-
import { createMemo } from "solid-js";
|
|
48
|
+
import { createMemo as createMemo2 } from "solid-js";
|
|
49
|
+
|
|
50
|
+
// src/utils/use-controllable-state.ts
|
|
51
|
+
import { createMemo, createSignal, untrack } from "solid-js";
|
|
52
|
+
function useControllableState(props) {
|
|
53
|
+
const [uncontrolledValue, setUncontrolledValue] = createSignal(runIfFn(props.defaultValue));
|
|
54
|
+
const controlled = createMemo(() => props.value?.() !== void 0);
|
|
55
|
+
const currentValue = createMemo(() => controlled() ? props.value?.() : uncontrolledValue());
|
|
56
|
+
const setValue = (next) => {
|
|
57
|
+
untrack(() => {
|
|
58
|
+
const nextValue = runIfFn(next, currentValue());
|
|
59
|
+
if (controlled()) {
|
|
60
|
+
return props.onChange?.(nextValue);
|
|
61
|
+
}
|
|
62
|
+
setUncontrolledValue(nextValue);
|
|
63
|
+
return props.onChange?.(nextValue);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return [currentValue, setValue];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/components/checkbox/use-checkbox-group.ts
|
|
49
70
|
function useCheckboxGroup(props = {}) {
|
|
50
|
-
const interactive =
|
|
71
|
+
const interactive = createMemo2(() => !(props.disabled || props.readOnly));
|
|
51
72
|
const [value, setValue] = useControllableState({
|
|
52
73
|
value: props.value,
|
|
53
74
|
defaultValue: props.defaultValue || [],
|
|
54
75
|
onChange: props.onValueChange
|
|
55
76
|
});
|
|
56
|
-
return
|
|
77
|
+
return createMemo2(() => {
|
|
57
78
|
const isChecked = (val) => {
|
|
58
79
|
return value().some((v) => String(v) === String(val));
|
|
59
80
|
};
|
|
@@ -157,17 +178,18 @@ import { mergeProps as mergeProps6 } from "@zag-js/solid";
|
|
|
157
178
|
// src/components/checkbox/use-checkbox.ts
|
|
158
179
|
import * as checkbox from "@zag-js/checkbox";
|
|
159
180
|
import { mergeProps as mergeProps5, normalizeProps, useMachine } from "@zag-js/solid";
|
|
160
|
-
import { createMemo as
|
|
181
|
+
import { createMemo as createMemo3, createUniqueId } from "solid-js";
|
|
161
182
|
var useCheckbox = (ownProps = {}) => {
|
|
162
183
|
const checkboxGroup = useCheckboxGroupContext();
|
|
163
|
-
const props =
|
|
164
|
-
|
|
184
|
+
const props = createMemo3(() => {
|
|
185
|
+
const resolvedProps = runIfFn(ownProps);
|
|
186
|
+
return mergeProps5(resolvedProps, checkboxGroup?.().getItemProps({ value: resolvedProps.value }) ?? {});
|
|
165
187
|
}, [ownProps, checkboxGroup]);
|
|
188
|
+
const id = createUniqueId();
|
|
166
189
|
const locale = useLocaleContext();
|
|
167
190
|
const environment = useEnvironmentContext();
|
|
168
|
-
const id = createUniqueId();
|
|
169
191
|
const field = useFieldContext();
|
|
170
|
-
const
|
|
192
|
+
const machineProps = createMemo3(() => ({
|
|
171
193
|
id,
|
|
172
194
|
ids: {
|
|
173
195
|
label: field?.().ids.label,
|
|
@@ -179,11 +201,10 @@ var useCheckbox = (ownProps = {}) => {
|
|
|
179
201
|
required: field?.().required,
|
|
180
202
|
dir: locale().dir,
|
|
181
203
|
getRootNode: environment().getRootNode,
|
|
182
|
-
checked: props().defaultChecked,
|
|
183
204
|
...props()
|
|
184
205
|
}));
|
|
185
|
-
const
|
|
186
|
-
return
|
|
206
|
+
const service = useMachine(checkbox.machine, machineProps);
|
|
207
|
+
return createMemo3(() => checkbox.connect(service, normalizeProps));
|
|
187
208
|
};
|
|
188
209
|
|
|
189
210
|
// src/components/checkbox/checkbox-root.tsx
|