@sprawlify/solid 0.0.15 → 0.0.16
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-Cg7zPadX.js → collapsible-CX2tnXKq.js} +8 -6
- package/dist/{collapsible-CjuC6xYl.jsx → collapsible-sG-Rzvf2.jsx} +8 -6
- package/dist/{collection-BlnS2UQy.jsx → collection-BRr4O2_i.jsx} +2 -1
- package/dist/{collection-BiyRTWsX.js → collection-zj3lxnwW.js} +2 -1
- package/dist/components/accordion/index.d.ts +11 -11
- package/dist/components/accordion/index.js +9 -7
- package/dist/components/accordion/index.jsx +9 -7
- package/dist/components/angle-slider/index.d.ts +13 -13
- package/dist/components/angle-slider/index.js +7 -5
- package/dist/components/angle-slider/index.jsx +7 -5
- package/dist/components/avatar/index.d.ts +8 -8
- package/dist/components/avatar/index.js +7 -5
- package/dist/components/avatar/index.jsx +7 -5
- package/dist/components/bottom-sheet/index.d.ts +13 -13
- package/dist/components/bottom-sheet/index.js +10 -8
- package/dist/components/bottom-sheet/index.jsx +10 -8
- package/dist/components/carousel/index.d.ts +17 -17
- package/dist/components/carousel/index.js +7 -5
- package/dist/components/carousel/index.jsx +7 -5
- package/dist/components/checkbox/index.d.ts +14 -14
- package/dist/components/checkbox/index.js +10 -8
- package/dist/components/checkbox/index.jsx +10 -8
- package/dist/components/clipboard/index.d.ts +11 -11
- package/dist/components/clipboard/index.js +7 -5
- package/dist/components/clipboard/index.jsx +7 -5
- package/dist/components/collapsible/index.d.ts +10 -10
- package/dist/components/collapsible/index.js +7 -6
- package/dist/components/collapsible/index.jsx +7 -6
- package/dist/components/collection/index.d.ts +2 -2
- package/dist/components/collection/index.js +2 -2
- package/dist/components/collection/index.jsx +2 -2
- package/dist/components/color-picker/index.d.ts +183 -0
- package/dist/components/color-picker/index.js +500 -0
- package/dist/components/color-picker/index.jsx +436 -0
- package/dist/components/combobox/index.d.ts +134 -0
- package/dist/components/combobox/index.js +357 -0
- package/dist/components/combobox/index.jsx +315 -0
- package/dist/components/date-picker/index.d.ts +165 -0
- package/dist/components/date-picker/index.js +476 -0
- package/dist/components/date-picker/index.jsx +415 -0
- package/dist/components/dialog/index.d.ts +80 -0
- package/dist/components/dialog/index.js +219 -0
- package/dist/components/dialog/index.jsx +173 -0
- package/dist/components/download-trigger/index.d.ts +25 -0
- package/dist/components/download-trigger/index.js +42 -0
- package/dist/components/download-trigger/index.jsx +38 -0
- package/dist/components/editable/index.d.ts +79 -0
- package/dist/components/editable/index.js +190 -0
- package/dist/components/editable/index.jsx +181 -0
- package/dist/components/field/index.d.ts +14 -14
- package/dist/components/field/index.js +8 -7
- package/dist/components/field/index.jsx +8 -7
- package/dist/components/fieldset/index.d.ts +12 -12
- package/dist/components/fieldset/index.js +7 -6
- package/dist/components/fieldset/index.jsx +7 -6
- package/dist/components/highlight/index.d.ts +15 -0
- package/dist/components/highlight/index.js +47 -0
- package/dist/components/highlight/index.jsx +31 -0
- package/dist/components/presence/index.d.ts +4 -4
- package/dist/components/presence/index.js +7 -6
- package/dist/components/presence/index.jsx +7 -6
- package/dist/components/select/index.d.ts +22 -22
- package/dist/components/select/index.js +13 -11
- package/dist/components/select/index.jsx +13 -11
- package/dist/{run-if-fn-eYlaegHy.js → core-DbInRfhI.jsx} +1 -6
- package/dist/{run-if-fn-DRWB51JE.jsx → core-oNB2jGcl.js} +1 -6
- package/dist/create-split-props-B8A7_AF7.jsx +7 -0
- package/dist/create-split-props-pQu7jijw.js +7 -0
- package/dist/{factory-B6RK6SH4.d.ts → factory-4A25bngy.d.ts} +1 -1
- package/dist/{create-split-props-CQVsvhvg.jsx → factory-Ch5jgk20.jsx} +2 -6
- package/dist/{factory-CEdj72aS.js → factory-PGDAvOKb.js} +2 -6
- package/dist/{field-CphvciGc.jsx → field-BRr9Zdes.jsx} +8 -7
- package/dist/{field-C_WuoXOj.js → field-CoYiA2ek.js} +8 -7
- package/dist/{fieldset-BG-0ZqWT.jsx → fieldset-B_LyllEa.jsx} +8 -6
- package/dist/{fieldset-D1BO0LmU.js → fieldset-BrJqMLEd.js} +8 -6
- package/dist/{index-DXheKbqg.d.ts → index-GEfvAmRc.d.ts} +1 -1
- package/dist/{index-NWiNyxpL.d.ts → index-j2avJy7D.d.ts} +8 -8
- package/dist/{index-vSwYtc2L.d.ts → index-oc8gLl07.d.ts} +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/index.jsx +4 -4
- package/dist/{presence-arWh1hVd.jsx → presence-Bmn43U_q.jsx} +7 -5
- package/dist/{presence-Bfjusgm3.js → presence-BpwBRlZW.js} +7 -5
- package/dist/{providers-CQkAUunr.js → providers-Bo0OFe08.js} +2 -2
- package/dist/{providers-CHqGPEsc.jsx → providers-DFaRRd80.jsx} +2 -2
- package/dist/{render-strategy-CZDG_yDi.jsx → render-strategy-CdJhRv3I.jsx} +2 -2
- package/dist/{render-strategy-COrlrUuR.js → render-strategy-DFlz7Uc4.js} +2 -2
- package/dist/run-if-fn-A3VwXy-o.jsx +6 -0
- package/dist/run-if-fn-D5794CxE.js +6 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.jsx +2 -2
- package/package.json +42 -2
- /package/dist/{chunk-C4aQI7lE.jsx → chunk-B5so6B0y.jsx} +0 -0
- /package/dist/{chunk-CKcAJnC7.js → chunk-B93cd-Dz.js} +0 -0
- /package/dist/{compose-refs-CzyOb8yH.jsx → compose-refs-BVVIB7xn.js} +0 -0
- /package/dist/{compose-refs-vsrTrt13.js → compose-refs-icUeuyHm.jsx} +0 -0
- /package/dist/{create-context-PS2j4mEo.js → create-context-C3rvZvkc.jsx} +0 -0
- /package/dist/{create-context-h3cXiEld.jsx → create-context-GfQ_MylE.js} +0 -0
- /package/dist/{index-B0YoIRC4.d.ts → index-B6dBCfnB.d.ts} +0 -0
- /package/dist/{index-C3ATynHc.d.ts → index-C7N791Fc.d.ts} +0 -0
- /package/dist/{render-strategy-CtRkdWei.d.ts → render-strategy-BNECKEQk.d.ts} +0 -0
- /package/dist/{types-bQRbEioA.d.ts → types-Dbw4va3W.d.ts} +0 -0
- /package/dist/{utils-DYer-9SY.js → utils-DQi-Cen5.js} +0 -0
- /package/dist/{utils-DrvO4Hk3.jsx → utils-vSjszv0W.jsx} +0 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-B93cd-Dz.js";
|
|
2
|
+
import { i as useMachine, n as normalizeProps, r as mergeProps$2 } from "../../core-oNB2jGcl.js";
|
|
3
|
+
import { t as runIfFn } from "../../run-if-fn-D5794CxE.js";
|
|
4
|
+
import { t as createContext$1 } from "../../create-context-GfQ_MylE.js";
|
|
5
|
+
import { i as useLocaleContext, o as useEnvironmentContext } from "../../providers-Bo0OFe08.js";
|
|
6
|
+
import { t as createSplitProps } from "../../create-split-props-pQu7jijw.js";
|
|
7
|
+
import "../../render-strategy-DFlz7Uc4.js";
|
|
8
|
+
import { t as sprawlify } from "../../factory-PGDAvOKb.js";
|
|
9
|
+
import { t as composeRefs } from "../../compose-refs-BVVIB7xn.js";
|
|
10
|
+
import { a as splitPresenceProps, i as usePresence, n as usePresenceContext, t as PresenceProvider } from "../../presence-BpwBRlZW.js";
|
|
11
|
+
import "../../fieldset-BrJqMLEd.js";
|
|
12
|
+
import { m as useFieldContext } from "../../field-CoYiA2ek.js";
|
|
13
|
+
import { n as useListCollection, o as createListCollection } from "../../collection-zj3lxnwW.js";
|
|
14
|
+
import { Show, createMemo, createUniqueId } from "solid-js";
|
|
15
|
+
import { createComponent, mergeProps as mergeProps$1 } from "solid-js/web";
|
|
16
|
+
import * as combobox from "@sprawlify/primitives/machines/combobox";
|
|
17
|
+
import { anatomy } from "@sprawlify/primitives/machines/combobox";
|
|
18
|
+
|
|
19
|
+
//#region src/components/combobox/use-combobox-context.ts
|
|
20
|
+
const [ComboboxProvider, useComboboxContext] = createContext$1({
|
|
21
|
+
hookName: "useComboboxContext",
|
|
22
|
+
providerName: "<ComboboxProvider />"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/combobox/combobox-clear-trigger.tsx
|
|
27
|
+
const ComboboxClearTrigger = (props) => {
|
|
28
|
+
const combobox$1 = useComboboxContext();
|
|
29
|
+
const mergedProps = mergeProps$2(() => combobox$1().getClearTriggerProps(), props);
|
|
30
|
+
return createComponent(sprawlify.button, mergedProps);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/combobox/combobox-content.tsx
|
|
35
|
+
const ComboboxContent = (props) => {
|
|
36
|
+
const api = useComboboxContext();
|
|
37
|
+
const presenceApi = usePresenceContext();
|
|
38
|
+
const mergedProps = mergeProps$2(() => api().getContentProps(), () => presenceApi().presenceProps, props);
|
|
39
|
+
return createComponent(Show, {
|
|
40
|
+
get when() {
|
|
41
|
+
return !presenceApi().unmounted;
|
|
42
|
+
},
|
|
43
|
+
get children() {
|
|
44
|
+
return createComponent(sprawlify.div, mergeProps$1(mergedProps, { ref(r$) {
|
|
45
|
+
var _ref$ = composeRefs(presenceApi().ref, props.ref);
|
|
46
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
47
|
+
} }));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/components/combobox/combobox-anatomy.ts
|
|
54
|
+
const comboboxAnatomy = anatomy.extendWith("empty");
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/combobox/combobox-empty.tsx
|
|
58
|
+
const parts = comboboxAnatomy.build();
|
|
59
|
+
const ComboboxEmpty = (props) => {
|
|
60
|
+
const combobox$1 = useComboboxContext();
|
|
61
|
+
const size = createMemo(() => combobox$1().collection.size);
|
|
62
|
+
return createComponent(Show, {
|
|
63
|
+
get when() {
|
|
64
|
+
return size() === 0;
|
|
65
|
+
},
|
|
66
|
+
get children() {
|
|
67
|
+
return createComponent(sprawlify.div, mergeProps$1(() => parts.empty.attrs, props, { role: "presentation" }));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/components/combobox/combobox-context.tsx
|
|
74
|
+
const ComboboxContext = (props) => props.children(useComboboxContext());
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/combobox/combobox-control.tsx
|
|
78
|
+
const ComboboxControl = (props) => {
|
|
79
|
+
const combobox$1 = useComboboxContext();
|
|
80
|
+
const mergedProps = mergeProps$2(() => combobox$1().getControlProps(), props);
|
|
81
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/components/combobox/combobox-input.tsx
|
|
86
|
+
const ComboboxInput = (props) => {
|
|
87
|
+
const combobox$1 = useComboboxContext();
|
|
88
|
+
const mergedProps = mergeProps$2(() => combobox$1().getInputProps(), props);
|
|
89
|
+
const field = useFieldContext();
|
|
90
|
+
return createComponent(sprawlify.input, mergeProps$1({ get ["aria-describedby"]() {
|
|
91
|
+
return field?.().ariaDescribedby;
|
|
92
|
+
} }, mergedProps));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/components/combobox/use-combobox-item-context.ts
|
|
97
|
+
const [ComboboxItemProvider, useComboboxItemContext] = createContext$1({
|
|
98
|
+
hookName: "useComboboxItemContext",
|
|
99
|
+
providerName: "<ComboboxItemProvider />"
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/combobox/use-combobox-item-props-context.ts
|
|
104
|
+
const [ComboboxItemPropsProvider, useComboboxItemPropsContext] = createContext$1({
|
|
105
|
+
hookName: "useComboboxItemPropsContext",
|
|
106
|
+
providerName: "<ComboboxItemPropsProvider />"
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/combobox/combobox-item.tsx
|
|
111
|
+
const ComboboxItem = (props) => {
|
|
112
|
+
const [itemProps, localProps] = createSplitProps()(props, ["item", "persistFocus"]);
|
|
113
|
+
const api = useComboboxContext();
|
|
114
|
+
const mergedProps = mergeProps$2(() => api().getItemProps(itemProps), localProps);
|
|
115
|
+
const itemState = createMemo(() => api().getItemState(itemProps));
|
|
116
|
+
return createComponent(ComboboxItemPropsProvider, {
|
|
117
|
+
value: itemProps,
|
|
118
|
+
get children() {
|
|
119
|
+
return createComponent(ComboboxItemProvider, {
|
|
120
|
+
value: itemState,
|
|
121
|
+
get children() {
|
|
122
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/components/combobox/combobox-item-context.tsx
|
|
131
|
+
const ComboboxItemContext = (props) => props.children(useComboboxItemContext());
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/components/combobox/use-combobox-item-group-props-context.ts
|
|
135
|
+
const [ComboboxItemGroupPropsProvider, useComboboxItemGroupPropsContext] = createContext$1({
|
|
136
|
+
hookName: "useComboboxItemGroupPropsContext",
|
|
137
|
+
providerName: "<ComboboxItemGroupPropsProvider />"
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/components/combobox/combobox-item-group.tsx
|
|
142
|
+
const ComboboxItemGroup = (props) => {
|
|
143
|
+
const [_itemGroupProps, localProps] = createSplitProps()(props, ["id"]);
|
|
144
|
+
const combobox$1 = useComboboxContext();
|
|
145
|
+
const itemGroupProps = mergeProps$2({ id: createUniqueId() }, _itemGroupProps);
|
|
146
|
+
const mergedProps = mergeProps$2(() => combobox$1().getItemGroupProps(itemGroupProps), localProps);
|
|
147
|
+
return createComponent(ComboboxItemGroupPropsProvider, {
|
|
148
|
+
value: itemGroupProps,
|
|
149
|
+
get children() {
|
|
150
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/combobox/combobox-item-group-label.tsx
|
|
157
|
+
const ComboboxItemGroupLabel = (props) => {
|
|
158
|
+
const combobox$1 = useComboboxContext();
|
|
159
|
+
const itemGroupProps = useComboboxItemGroupPropsContext();
|
|
160
|
+
const mergedProps = mergeProps$2(() => combobox$1().getItemGroupLabelProps({ htmlFor: itemGroupProps.id }), props);
|
|
161
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/components/combobox/combobox-item-indicator.tsx
|
|
166
|
+
const ComboboxItemIndicator = (props) => {
|
|
167
|
+
const combobox$1 = useComboboxContext();
|
|
168
|
+
const itemProps = useComboboxItemPropsContext();
|
|
169
|
+
const mergedProps = mergeProps$2(() => combobox$1().getItemIndicatorProps(itemProps), props);
|
|
170
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/components/combobox/combobox-item-text.tsx
|
|
175
|
+
const ComboboxItemText = (props) => {
|
|
176
|
+
const api = useComboboxContext();
|
|
177
|
+
const itemProps = useComboboxItemPropsContext();
|
|
178
|
+
const mergedProps = mergeProps$2(() => api().getItemTextProps(itemProps), props);
|
|
179
|
+
return createComponent(sprawlify.span, mergedProps);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/components/combobox/combobox-label.tsx
|
|
184
|
+
const ComboboxLabel = (props) => {
|
|
185
|
+
const combobox$1 = useComboboxContext();
|
|
186
|
+
const mergedProps = mergeProps$2(() => combobox$1().getLabelProps(), props);
|
|
187
|
+
return createComponent(sprawlify.label, mergedProps);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/combobox/combobox-list.tsx
|
|
192
|
+
const ComboboxList = (props) => {
|
|
193
|
+
const combobox$1 = useComboboxContext();
|
|
194
|
+
const mergedProps = mergeProps$2(() => combobox$1().getListProps(), props);
|
|
195
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/components/combobox/combobox-positioner.tsx
|
|
200
|
+
const ComboboxPositioner = (props) => {
|
|
201
|
+
const api = useComboboxContext();
|
|
202
|
+
const presenceApi = usePresenceContext();
|
|
203
|
+
const mergedProps = mergeProps$2(() => api().getPositionerProps(), props);
|
|
204
|
+
return createComponent(Show, {
|
|
205
|
+
get when() {
|
|
206
|
+
return !presenceApi().unmounted;
|
|
207
|
+
},
|
|
208
|
+
get children() {
|
|
209
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/components/combobox/use-combobox.ts
|
|
216
|
+
const useCombobox = (props) => {
|
|
217
|
+
const locale = useLocaleContext();
|
|
218
|
+
const environment = useEnvironmentContext();
|
|
219
|
+
const id = createUniqueId();
|
|
220
|
+
const field = useFieldContext();
|
|
221
|
+
const machineProps = createMemo(() => ({
|
|
222
|
+
id,
|
|
223
|
+
ids: {
|
|
224
|
+
label: field?.().ids.label,
|
|
225
|
+
input: field?.().ids.control
|
|
226
|
+
},
|
|
227
|
+
disabled: field?.().disabled,
|
|
228
|
+
readOnly: field?.().readOnly,
|
|
229
|
+
required: field?.().required,
|
|
230
|
+
invalid: field?.().invalid,
|
|
231
|
+
dir: locale().dir,
|
|
232
|
+
getRootNode: environment().getRootNode,
|
|
233
|
+
...runIfFn(props)
|
|
234
|
+
}));
|
|
235
|
+
const service = useMachine(combobox.machine, machineProps);
|
|
236
|
+
return createMemo(() => combobox.connect(service, normalizeProps));
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/components/combobox/combobox-root.tsx
|
|
241
|
+
const ComboboxRoot = (props) => {
|
|
242
|
+
const [presenceProps, comboboxProps] = splitPresenceProps(props);
|
|
243
|
+
const [useComboboxProps, localProps] = createSplitProps()(comboboxProps, [
|
|
244
|
+
"allowCustomValue",
|
|
245
|
+
"alwaysSubmitOnEnter",
|
|
246
|
+
"autoFocus",
|
|
247
|
+
"closeOnSelect",
|
|
248
|
+
"collection",
|
|
249
|
+
"composite",
|
|
250
|
+
"defaultHighlightedValue",
|
|
251
|
+
"defaultInputValue",
|
|
252
|
+
"defaultOpen",
|
|
253
|
+
"defaultValue",
|
|
254
|
+
"disabled",
|
|
255
|
+
"disableLayer",
|
|
256
|
+
"form",
|
|
257
|
+
"highlightedValue",
|
|
258
|
+
"id",
|
|
259
|
+
"ids",
|
|
260
|
+
"inputBehavior",
|
|
261
|
+
"inputValue",
|
|
262
|
+
"invalid",
|
|
263
|
+
"loopFocus",
|
|
264
|
+
"multiple",
|
|
265
|
+
"name",
|
|
266
|
+
"navigate",
|
|
267
|
+
"onFocusOutside",
|
|
268
|
+
"onHighlightChange",
|
|
269
|
+
"onInputValueChange",
|
|
270
|
+
"onInteractOutside",
|
|
271
|
+
"onOpenChange",
|
|
272
|
+
"onPointerDownOutside",
|
|
273
|
+
"onValueChange",
|
|
274
|
+
"onSelect",
|
|
275
|
+
"open",
|
|
276
|
+
"openOnChange",
|
|
277
|
+
"openOnClick",
|
|
278
|
+
"openOnKeyPress",
|
|
279
|
+
"placeholder",
|
|
280
|
+
"positioning",
|
|
281
|
+
"readOnly",
|
|
282
|
+
"required",
|
|
283
|
+
"scrollToIndexFn",
|
|
284
|
+
"selectionBehavior",
|
|
285
|
+
"translations",
|
|
286
|
+
"value"
|
|
287
|
+
]);
|
|
288
|
+
const api = useCombobox(useComboboxProps);
|
|
289
|
+
const apiPresence = usePresence(mergeProps$2(presenceProps, () => ({ present: api().open })));
|
|
290
|
+
const mergedProps = mergeProps$2(() => api().getRootProps(), localProps);
|
|
291
|
+
return createComponent(ComboboxProvider, {
|
|
292
|
+
value: api,
|
|
293
|
+
get children() {
|
|
294
|
+
return createComponent(PresenceProvider, {
|
|
295
|
+
value: apiPresence,
|
|
296
|
+
get children() {
|
|
297
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/components/combobox/combobox-root-provider.tsx
|
|
306
|
+
const ComboboxRootProvider = (props) => {
|
|
307
|
+
const [presenceProps, comboboxProps] = splitPresenceProps(props);
|
|
308
|
+
const [{ value: combobox$1 }, localProps] = createSplitProps()(comboboxProps, ["value"]);
|
|
309
|
+
const apiPresence = usePresence(mergeProps$2(presenceProps, () => ({ present: combobox$1().open })));
|
|
310
|
+
const mergedProps = mergeProps$2(() => combobox$1().getRootProps(), localProps);
|
|
311
|
+
return createComponent(ComboboxProvider, {
|
|
312
|
+
value: combobox$1,
|
|
313
|
+
get children() {
|
|
314
|
+
return createComponent(PresenceProvider, {
|
|
315
|
+
value: apiPresence,
|
|
316
|
+
get children() {
|
|
317
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/components/combobox/combobox-trigger.tsx
|
|
326
|
+
const ComboboxTrigger = (props) => {
|
|
327
|
+
const [triggerProps, localProps] = createSplitProps()(props, ["focusable"]);
|
|
328
|
+
const combobox$1 = useComboboxContext();
|
|
329
|
+
const mergedProps = mergeProps$2(() => combobox$1().getTriggerProps(triggerProps), localProps);
|
|
330
|
+
return createComponent(sprawlify.button, mergedProps);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/components/combobox/combobox.ts
|
|
335
|
+
var combobox_exports = /* @__PURE__ */ __export({
|
|
336
|
+
ClearTrigger: () => ComboboxClearTrigger,
|
|
337
|
+
Content: () => ComboboxContent,
|
|
338
|
+
Context: () => ComboboxContext,
|
|
339
|
+
Control: () => ComboboxControl,
|
|
340
|
+
Empty: () => ComboboxEmpty,
|
|
341
|
+
Input: () => ComboboxInput,
|
|
342
|
+
Item: () => ComboboxItem,
|
|
343
|
+
ItemContext: () => ComboboxItemContext,
|
|
344
|
+
ItemGroup: () => ComboboxItemGroup,
|
|
345
|
+
ItemGroupLabel: () => ComboboxItemGroupLabel,
|
|
346
|
+
ItemIndicator: () => ComboboxItemIndicator,
|
|
347
|
+
ItemText: () => ComboboxItemText,
|
|
348
|
+
Label: () => ComboboxLabel,
|
|
349
|
+
List: () => ComboboxList,
|
|
350
|
+
Positioner: () => ComboboxPositioner,
|
|
351
|
+
Root: () => ComboboxRoot,
|
|
352
|
+
RootProvider: () => ComboboxRootProvider,
|
|
353
|
+
Trigger: () => ComboboxTrigger
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
//#endregion
|
|
357
|
+
export { combobox_exports as Combobox, ComboboxClearTrigger, ComboboxContent, ComboboxContext, ComboboxControl, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxItemContext, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxRootProvider, ComboboxTrigger, comboboxAnatomy, createListCollection, useCombobox, useComboboxContext, useComboboxItemContext, useListCollection };
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-B5so6B0y.jsx";
|
|
2
|
+
import { i as useMachine, n as normalizeProps, r as mergeProps$1 } from "../../core-DbInRfhI.jsx";
|
|
3
|
+
import { t as runIfFn } from "../../run-if-fn-A3VwXy-o.jsx";
|
|
4
|
+
import { t as createContext$1 } from "../../create-context-C3rvZvkc.jsx";
|
|
5
|
+
import { i as useLocaleContext, o as useEnvironmentContext } from "../../providers-DFaRRd80.jsx";
|
|
6
|
+
import { t as createSplitProps } from "../../create-split-props-B8A7_AF7.jsx";
|
|
7
|
+
import "../../render-strategy-CdJhRv3I.jsx";
|
|
8
|
+
import { t as sprawlify } from "../../factory-Ch5jgk20.jsx";
|
|
9
|
+
import { t as composeRefs } from "../../compose-refs-icUeuyHm.jsx";
|
|
10
|
+
import { a as splitPresenceProps, i as usePresence, n as usePresenceContext, t as PresenceProvider } from "../../presence-Bmn43U_q.jsx";
|
|
11
|
+
import "../../fieldset-B_LyllEa.jsx";
|
|
12
|
+
import { m as useFieldContext } from "../../field-BRr9Zdes.jsx";
|
|
13
|
+
import { n as useListCollection, o as createListCollection } from "../../collection-BRr4O2_i.jsx";
|
|
14
|
+
import { Show, createMemo, createUniqueId } from "solid-js";
|
|
15
|
+
import * as combobox from "@sprawlify/primitives/machines/combobox";
|
|
16
|
+
import { anatomy } from "@sprawlify/primitives/machines/combobox";
|
|
17
|
+
|
|
18
|
+
//#region src/components/combobox/use-combobox-context.ts
|
|
19
|
+
const [ComboboxProvider, useComboboxContext] = createContext$1({
|
|
20
|
+
hookName: "useComboboxContext",
|
|
21
|
+
providerName: "<ComboboxProvider />"
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/combobox/combobox-clear-trigger.tsx
|
|
26
|
+
const ComboboxClearTrigger = (props) => {
|
|
27
|
+
const combobox$1 = useComboboxContext();
|
|
28
|
+
const mergedProps = mergeProps$1(() => combobox$1().getClearTriggerProps(), props);
|
|
29
|
+
return <sprawlify.button {...mergedProps} />;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/combobox/combobox-content.tsx
|
|
34
|
+
const ComboboxContent = (props) => {
|
|
35
|
+
const api = useComboboxContext();
|
|
36
|
+
const presenceApi = usePresenceContext();
|
|
37
|
+
const mergedProps = mergeProps$1(() => api().getContentProps(), () => presenceApi().presenceProps, props);
|
|
38
|
+
return <Show when={!presenceApi().unmounted}>
|
|
39
|
+
<sprawlify.div {...mergedProps} ref={composeRefs(presenceApi().ref, props.ref)} />
|
|
40
|
+
</Show>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/combobox/combobox-anatomy.ts
|
|
45
|
+
const comboboxAnatomy = anatomy.extendWith("empty");
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/combobox/combobox-empty.tsx
|
|
49
|
+
const parts = comboboxAnatomy.build();
|
|
50
|
+
const ComboboxEmpty = (props) => {
|
|
51
|
+
const combobox$1 = useComboboxContext();
|
|
52
|
+
const size = createMemo(() => combobox$1().collection.size);
|
|
53
|
+
return <Show when={size() === 0}>
|
|
54
|
+
<sprawlify.div {...parts.empty.attrs} {...props} role="presentation" />
|
|
55
|
+
</Show>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/components/combobox/combobox-context.tsx
|
|
60
|
+
const ComboboxContext = (props) => props.children(useComboboxContext());
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/components/combobox/combobox-control.tsx
|
|
64
|
+
const ComboboxControl = (props) => {
|
|
65
|
+
const combobox$1 = useComboboxContext();
|
|
66
|
+
const mergedProps = mergeProps$1(() => combobox$1().getControlProps(), props);
|
|
67
|
+
return <sprawlify.div {...mergedProps} />;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/components/combobox/combobox-input.tsx
|
|
72
|
+
const ComboboxInput = (props) => {
|
|
73
|
+
const combobox$1 = useComboboxContext();
|
|
74
|
+
const mergedProps = mergeProps$1(() => combobox$1().getInputProps(), props);
|
|
75
|
+
const field = useFieldContext();
|
|
76
|
+
return <sprawlify.input aria-describedby={field?.().ariaDescribedby} {...mergedProps} />;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/components/combobox/use-combobox-item-context.ts
|
|
81
|
+
const [ComboboxItemProvider, useComboboxItemContext] = createContext$1({
|
|
82
|
+
hookName: "useComboboxItemContext",
|
|
83
|
+
providerName: "<ComboboxItemProvider />"
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/combobox/use-combobox-item-props-context.ts
|
|
88
|
+
const [ComboboxItemPropsProvider, useComboboxItemPropsContext] = createContext$1({
|
|
89
|
+
hookName: "useComboboxItemPropsContext",
|
|
90
|
+
providerName: "<ComboboxItemPropsProvider />"
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/components/combobox/combobox-item.tsx
|
|
95
|
+
const ComboboxItem = (props) => {
|
|
96
|
+
const [itemProps, localProps] = createSplitProps()(props, ["item", "persistFocus"]);
|
|
97
|
+
const api = useComboboxContext();
|
|
98
|
+
const mergedProps = mergeProps$1(() => api().getItemProps(itemProps), localProps);
|
|
99
|
+
const itemState = createMemo(() => api().getItemState(itemProps));
|
|
100
|
+
return <ComboboxItemPropsProvider value={itemProps}>
|
|
101
|
+
<ComboboxItemProvider value={itemState}>
|
|
102
|
+
<sprawlify.div {...mergedProps} />
|
|
103
|
+
</ComboboxItemProvider>
|
|
104
|
+
</ComboboxItemPropsProvider>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/combobox/combobox-item-context.tsx
|
|
109
|
+
const ComboboxItemContext = (props) => props.children(useComboboxItemContext());
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/components/combobox/use-combobox-item-group-props-context.ts
|
|
113
|
+
const [ComboboxItemGroupPropsProvider, useComboboxItemGroupPropsContext] = createContext$1({
|
|
114
|
+
hookName: "useComboboxItemGroupPropsContext",
|
|
115
|
+
providerName: "<ComboboxItemGroupPropsProvider />"
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/components/combobox/combobox-item-group.tsx
|
|
120
|
+
const ComboboxItemGroup = (props) => {
|
|
121
|
+
const [_itemGroupProps, localProps] = createSplitProps()(props, ["id"]);
|
|
122
|
+
const combobox$1 = useComboboxContext();
|
|
123
|
+
const itemGroupProps = mergeProps$1({ id: createUniqueId() }, _itemGroupProps);
|
|
124
|
+
const mergedProps = mergeProps$1(() => combobox$1().getItemGroupProps(itemGroupProps), localProps);
|
|
125
|
+
return <ComboboxItemGroupPropsProvider value={itemGroupProps}>
|
|
126
|
+
<sprawlify.div {...mergedProps} />
|
|
127
|
+
</ComboboxItemGroupPropsProvider>;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/components/combobox/combobox-item-group-label.tsx
|
|
132
|
+
const ComboboxItemGroupLabel = (props) => {
|
|
133
|
+
const combobox$1 = useComboboxContext();
|
|
134
|
+
const itemGroupProps = useComboboxItemGroupPropsContext();
|
|
135
|
+
const mergedProps = mergeProps$1(() => combobox$1().getItemGroupLabelProps({ htmlFor: itemGroupProps.id }), props);
|
|
136
|
+
return <sprawlify.div {...mergedProps} />;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/components/combobox/combobox-item-indicator.tsx
|
|
141
|
+
const ComboboxItemIndicator = (props) => {
|
|
142
|
+
const combobox$1 = useComboboxContext();
|
|
143
|
+
const itemProps = useComboboxItemPropsContext();
|
|
144
|
+
const mergedProps = mergeProps$1(() => combobox$1().getItemIndicatorProps(itemProps), props);
|
|
145
|
+
return <sprawlify.div {...mergedProps} />;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/components/combobox/combobox-item-text.tsx
|
|
150
|
+
const ComboboxItemText = (props) => {
|
|
151
|
+
const api = useComboboxContext();
|
|
152
|
+
const itemProps = useComboboxItemPropsContext();
|
|
153
|
+
const mergedProps = mergeProps$1(() => api().getItemTextProps(itemProps), props);
|
|
154
|
+
return <sprawlify.span {...mergedProps} />;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/components/combobox/combobox-label.tsx
|
|
159
|
+
const ComboboxLabel = (props) => {
|
|
160
|
+
const combobox$1 = useComboboxContext();
|
|
161
|
+
const mergedProps = mergeProps$1(() => combobox$1().getLabelProps(), props);
|
|
162
|
+
return <sprawlify.label {...mergedProps} />;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/components/combobox/combobox-list.tsx
|
|
167
|
+
const ComboboxList = (props) => {
|
|
168
|
+
const combobox$1 = useComboboxContext();
|
|
169
|
+
const mergedProps = mergeProps$1(() => combobox$1().getListProps(), props);
|
|
170
|
+
return <sprawlify.div {...mergedProps} />;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/components/combobox/combobox-positioner.tsx
|
|
175
|
+
const ComboboxPositioner = (props) => {
|
|
176
|
+
const api = useComboboxContext();
|
|
177
|
+
const presenceApi = usePresenceContext();
|
|
178
|
+
const mergedProps = mergeProps$1(() => api().getPositionerProps(), props);
|
|
179
|
+
return <Show when={!presenceApi().unmounted}>
|
|
180
|
+
<sprawlify.div {...mergedProps} />
|
|
181
|
+
</Show>;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/components/combobox/use-combobox.ts
|
|
186
|
+
const useCombobox = (props) => {
|
|
187
|
+
const locale = useLocaleContext();
|
|
188
|
+
const environment = useEnvironmentContext();
|
|
189
|
+
const id = createUniqueId();
|
|
190
|
+
const field = useFieldContext();
|
|
191
|
+
const machineProps = createMemo(() => ({
|
|
192
|
+
id,
|
|
193
|
+
ids: {
|
|
194
|
+
label: field?.().ids.label,
|
|
195
|
+
input: field?.().ids.control
|
|
196
|
+
},
|
|
197
|
+
disabled: field?.().disabled,
|
|
198
|
+
readOnly: field?.().readOnly,
|
|
199
|
+
required: field?.().required,
|
|
200
|
+
invalid: field?.().invalid,
|
|
201
|
+
dir: locale().dir,
|
|
202
|
+
getRootNode: environment().getRootNode,
|
|
203
|
+
...runIfFn(props)
|
|
204
|
+
}));
|
|
205
|
+
const service = useMachine(combobox.machine, machineProps);
|
|
206
|
+
return createMemo(() => combobox.connect(service, normalizeProps));
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/combobox/combobox-root.tsx
|
|
211
|
+
const ComboboxRoot = (props) => {
|
|
212
|
+
const [presenceProps, comboboxProps] = splitPresenceProps(props);
|
|
213
|
+
const [useComboboxProps, localProps] = createSplitProps()(comboboxProps, [
|
|
214
|
+
"allowCustomValue",
|
|
215
|
+
"alwaysSubmitOnEnter",
|
|
216
|
+
"autoFocus",
|
|
217
|
+
"closeOnSelect",
|
|
218
|
+
"collection",
|
|
219
|
+
"composite",
|
|
220
|
+
"defaultHighlightedValue",
|
|
221
|
+
"defaultInputValue",
|
|
222
|
+
"defaultOpen",
|
|
223
|
+
"defaultValue",
|
|
224
|
+
"disabled",
|
|
225
|
+
"disableLayer",
|
|
226
|
+
"form",
|
|
227
|
+
"highlightedValue",
|
|
228
|
+
"id",
|
|
229
|
+
"ids",
|
|
230
|
+
"inputBehavior",
|
|
231
|
+
"inputValue",
|
|
232
|
+
"invalid",
|
|
233
|
+
"loopFocus",
|
|
234
|
+
"multiple",
|
|
235
|
+
"name",
|
|
236
|
+
"navigate",
|
|
237
|
+
"onFocusOutside",
|
|
238
|
+
"onHighlightChange",
|
|
239
|
+
"onInputValueChange",
|
|
240
|
+
"onInteractOutside",
|
|
241
|
+
"onOpenChange",
|
|
242
|
+
"onPointerDownOutside",
|
|
243
|
+
"onValueChange",
|
|
244
|
+
"onSelect",
|
|
245
|
+
"open",
|
|
246
|
+
"openOnChange",
|
|
247
|
+
"openOnClick",
|
|
248
|
+
"openOnKeyPress",
|
|
249
|
+
"placeholder",
|
|
250
|
+
"positioning",
|
|
251
|
+
"readOnly",
|
|
252
|
+
"required",
|
|
253
|
+
"scrollToIndexFn",
|
|
254
|
+
"selectionBehavior",
|
|
255
|
+
"translations",
|
|
256
|
+
"value"
|
|
257
|
+
]);
|
|
258
|
+
const api = useCombobox(useComboboxProps);
|
|
259
|
+
const apiPresence = usePresence(mergeProps$1(presenceProps, () => ({ present: api().open })));
|
|
260
|
+
const mergedProps = mergeProps$1(() => api().getRootProps(), localProps);
|
|
261
|
+
return <ComboboxProvider value={api}>
|
|
262
|
+
<PresenceProvider value={apiPresence}>
|
|
263
|
+
<sprawlify.div {...mergedProps} />
|
|
264
|
+
</PresenceProvider>
|
|
265
|
+
</ComboboxProvider>;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/components/combobox/combobox-root-provider.tsx
|
|
270
|
+
const ComboboxRootProvider = (props) => {
|
|
271
|
+
const [presenceProps, comboboxProps] = splitPresenceProps(props);
|
|
272
|
+
const [{ value: combobox$1 }, localProps] = createSplitProps()(comboboxProps, ["value"]);
|
|
273
|
+
const apiPresence = usePresence(mergeProps$1(presenceProps, () => ({ present: combobox$1().open })));
|
|
274
|
+
const mergedProps = mergeProps$1(() => combobox$1().getRootProps(), localProps);
|
|
275
|
+
return <ComboboxProvider value={combobox$1}>
|
|
276
|
+
<PresenceProvider value={apiPresence}>
|
|
277
|
+
<sprawlify.div {...mergedProps} />
|
|
278
|
+
</PresenceProvider>
|
|
279
|
+
</ComboboxProvider>;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/components/combobox/combobox-trigger.tsx
|
|
284
|
+
const ComboboxTrigger = (props) => {
|
|
285
|
+
const [triggerProps, localProps] = createSplitProps()(props, ["focusable"]);
|
|
286
|
+
const combobox$1 = useComboboxContext();
|
|
287
|
+
const mergedProps = mergeProps$1(() => combobox$1().getTriggerProps(triggerProps), localProps);
|
|
288
|
+
return <sprawlify.button {...mergedProps} />;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/components/combobox/combobox.ts
|
|
293
|
+
var combobox_exports = /* @__PURE__ */ __export({
|
|
294
|
+
ClearTrigger: () => ComboboxClearTrigger,
|
|
295
|
+
Content: () => ComboboxContent,
|
|
296
|
+
Context: () => ComboboxContext,
|
|
297
|
+
Control: () => ComboboxControl,
|
|
298
|
+
Empty: () => ComboboxEmpty,
|
|
299
|
+
Input: () => ComboboxInput,
|
|
300
|
+
Item: () => ComboboxItem,
|
|
301
|
+
ItemContext: () => ComboboxItemContext,
|
|
302
|
+
ItemGroup: () => ComboboxItemGroup,
|
|
303
|
+
ItemGroupLabel: () => ComboboxItemGroupLabel,
|
|
304
|
+
ItemIndicator: () => ComboboxItemIndicator,
|
|
305
|
+
ItemText: () => ComboboxItemText,
|
|
306
|
+
Label: () => ComboboxLabel,
|
|
307
|
+
List: () => ComboboxList,
|
|
308
|
+
Positioner: () => ComboboxPositioner,
|
|
309
|
+
Root: () => ComboboxRoot,
|
|
310
|
+
RootProvider: () => ComboboxRootProvider,
|
|
311
|
+
Trigger: () => ComboboxTrigger
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
export { combobox_exports as Combobox, ComboboxClearTrigger, ComboboxContent, ComboboxContext, ComboboxControl, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxItemContext, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxRootProvider, ComboboxTrigger, comboboxAnatomy, createListCollection, useCombobox, useComboboxContext, useComboboxItemContext, useListCollection };
|