@sprawlify/solid 0.0.13 → 0.0.15
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/chunk-C4aQI7lE.jsx +18 -0
- package/dist/chunk-CKcAJnC7.js +18 -0
- package/dist/collapsible-Cg7zPadX.js +129 -0
- package/dist/collapsible-CjuC6xYl.jsx +117 -0
- package/dist/collection-BiyRTWsX.js +219 -0
- package/dist/collection-BlnS2UQy.jsx +219 -0
- package/dist/components/accordion/index.d.ts +69 -0
- package/dist/components/accordion/index.js +183 -0
- package/dist/components/accordion/index.jsx +157 -0
- package/dist/components/angle-slider/index.d.ts +74 -0
- package/dist/components/angle-slider/index.js +155 -0
- package/dist/components/angle-slider/index.jsx +144 -0
- package/dist/components/avatar/index.d.ts +49 -0
- package/dist/components/avatar/index.js +95 -0
- package/dist/components/avatar/index.jsx +88 -0
- package/dist/components/bottom-sheet/index.d.ts +80 -0
- package/dist/components/bottom-sheet/index.js +218 -0
- package/dist/components/bottom-sheet/index.jsx +177 -0
- package/dist/components/carousel/index.d.ts +98 -0
- package/dist/components/carousel/index.js +207 -0
- package/dist/components/carousel/index.jsx +192 -0
- package/dist/components/checkbox/index.d.ts +138 -0
- package/dist/components/checkbox/index.js +265 -0
- package/dist/components/checkbox/index.jsx +247 -0
- package/dist/components/client-only/index.d.ts +10 -0
- package/dist/components/client-only/index.js +24 -0
- package/dist/components/client-only/index.jsx +15 -0
- package/dist/components/clipboard/index.d.ts +72 -0
- package/dist/components/clipboard/index.js +149 -0
- package/dist/components/clipboard/index.jsx +132 -0
- package/dist/components/collapsible/index.d.ts +60 -0
- package/dist/components/collapsible/index.js +8 -0
- package/dist/components/collapsible/index.jsx +8 -0
- package/dist/components/collection/index.d.ts +3 -0
- package/dist/components/collection/index.js +4 -0
- package/dist/components/collection/index.jsx +4 -0
- package/dist/components/field/index.d.ts +201 -0
- package/dist/components/field/index.js +9 -0
- package/dist/components/field/index.jsx +9 -0
- package/dist/components/fieldset/index.d.ts +109 -0
- package/dist/components/fieldset/index.js +8 -0
- package/dist/components/fieldset/index.jsx +8 -0
- package/dist/components/presence/index.d.ts +5 -0
- package/dist/components/presence/index.js +8 -0
- package/dist/components/presence/index.jsx +8 -0
- package/dist/components/select/index.d.ts +134 -0
- package/dist/components/select/index.js +361 -0
- package/dist/components/select/index.jsx +310 -0
- package/dist/compose-refs-CzyOb8yH.jsx +20 -0
- package/dist/compose-refs-vsrTrt13.js +20 -0
- package/dist/create-context-PS2j4mEo.js +29 -0
- package/dist/create-context-h3cXiEld.jsx +29 -0
- package/dist/create-split-props-CQVsvhvg.jsx +41 -0
- package/dist/factory-B6RK6SH4.d.ts +14 -0
- package/dist/factory-CEdj72aS.js +47 -0
- package/dist/field-C_WuoXOj.js +287 -0
- package/dist/field-CphvciGc.jsx +259 -0
- package/dist/fieldset-BG-0ZqWT.jsx +167 -0
- package/dist/fieldset-D1BO0LmU.js +182 -0
- package/dist/index-B0YoIRC4.d.ts +14 -0
- package/dist/index-C3ATynHc.d.ts +23 -0
- package/dist/index-DXheKbqg.d.ts +76 -0
- package/dist/index-NWiNyxpL.d.ts +38 -0
- package/dist/index-vSwYtc2L.d.ts +38 -0
- package/dist/index.d.ts +40 -19
- package/dist/index.js +5 -415
- package/dist/index.jsx +5 -415
- package/dist/presence-Bfjusgm3.js +79 -0
- package/dist/presence-arWh1hVd.jsx +66 -0
- package/dist/providers-CHqGPEsc.jsx +82 -0
- package/dist/providers-CQkAUunr.js +96 -0
- package/dist/render-strategy-COrlrUuR.js +12 -0
- package/dist/render-strategy-CZDG_yDi.jsx +12 -0
- package/dist/render-strategy-CtRkdWei.d.ts +9 -0
- package/dist/run-if-fn-DRWB51JE.jsx +421 -0
- package/dist/run-if-fn-eYlaegHy.js +421 -0
- package/dist/types-bQRbEioA.d.ts +9 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.jsx +4 -0
- package/dist/utils-DYer-9SY.js +0 -0
- package/dist/utils-DrvO4Hk3.jsx +0 -0
- package/package.json +62 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-C4aQI7lE.jsx";
|
|
2
|
+
import { i as mergeProps$1, t as runIfFn } from "./run-if-fn-DRWB51JE.jsx";
|
|
3
|
+
import { t as createContext$1 } from "./create-context-h3cXiEld.jsx";
|
|
4
|
+
import { o as useEnvironmentContext } from "./providers-CHqGPEsc.jsx";
|
|
5
|
+
import { n as sprawlify, t as createSplitProps } from "./create-split-props-CQVsvhvg.jsx";
|
|
6
|
+
import { t as composeRefs } from "./compose-refs-CzyOb8yH.jsx";
|
|
7
|
+
import { Show, createMemo, createSignal, createUniqueId, mergeProps, onCleanup, onMount } from "solid-js";
|
|
8
|
+
import { dataAttr } from "@sprawlify/primitives/dom-query";
|
|
9
|
+
import { createAnatomy } from "@sprawlify/primitives/anatomy";
|
|
10
|
+
|
|
11
|
+
//#region src/components/fieldset/use-fieldset-context.ts
|
|
12
|
+
const [FieldsetProvider, useFieldsetContext] = createContext$1({
|
|
13
|
+
hookName: "useFieldsetContext",
|
|
14
|
+
providerName: "<FieldsetProvider />",
|
|
15
|
+
strict: false
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/fieldset/fieldset-context.tsx
|
|
20
|
+
const FieldsetContext = (props) => props.children(useFieldsetContext());
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/fieldset/fieldset-error-text.tsx
|
|
24
|
+
const FieldsetErrorText = (props) => {
|
|
25
|
+
const fieldset = useFieldsetContext();
|
|
26
|
+
const mergedProps = mergeProps$1(() => fieldset().getErrorTextProps(), props);
|
|
27
|
+
return <Show when={fieldset().invalid}>
|
|
28
|
+
<sprawlify.span {...mergedProps} />
|
|
29
|
+
</Show>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/fieldset/fieldset-helper-text.tsx
|
|
34
|
+
const FieldsetHelperText = (props) => {
|
|
35
|
+
const fieldset = useFieldsetContext();
|
|
36
|
+
const mergedProps = mergeProps$1(() => fieldset().getHelperTextProps(), props);
|
|
37
|
+
return <sprawlify.span {...mergedProps} />;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/fieldset/fieldset-legend.tsx
|
|
42
|
+
const FieldsetLegend = (props) => {
|
|
43
|
+
const fieldset = useFieldsetContext();
|
|
44
|
+
const mergedProps = mergeProps$1(() => fieldset().getLegendProps(), props);
|
|
45
|
+
return <sprawlify.legend {...mergedProps} />;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/fieldset/fieldset-anatomy.ts
|
|
50
|
+
const fieldsetAnatomy = createAnatomy("fieldset").parts("root", "errorText", "helperText", "legend");
|
|
51
|
+
const parts = fieldsetAnatomy.build();
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/components/fieldset/use-fieldset.ts
|
|
55
|
+
const useFieldset = (props) => {
|
|
56
|
+
const env = useEnvironmentContext();
|
|
57
|
+
const mergedProps = mergeProps({
|
|
58
|
+
disabled: false,
|
|
59
|
+
invalid: false
|
|
60
|
+
}, runIfFn(props));
|
|
61
|
+
const [rootRef, setRootRef] = createSignal(void 0);
|
|
62
|
+
const id = mergedProps.id ?? createUniqueId();
|
|
63
|
+
const legendId = `fieldset::${id}::legend`;
|
|
64
|
+
const errorTextId = `fieldset::${id}::error-text`;
|
|
65
|
+
const helperTextId = `fieldset::${id}::helper-text`;
|
|
66
|
+
const [hasErrorText, setHasErrorText] = createSignal(false);
|
|
67
|
+
const [hasHelperText, setHasHelperText] = createSignal(false);
|
|
68
|
+
onMount(() => {
|
|
69
|
+
const rootNode = rootRef();
|
|
70
|
+
if (!rootNode) return;
|
|
71
|
+
const checkTextElements = () => {
|
|
72
|
+
const docOrShadowRoot = env().getRootNode();
|
|
73
|
+
setHasErrorText(!!docOrShadowRoot.getElementById(errorTextId));
|
|
74
|
+
setHasHelperText(!!docOrShadowRoot.getElementById(helperTextId));
|
|
75
|
+
};
|
|
76
|
+
checkTextElements();
|
|
77
|
+
const observer = new (env().getWindow()).MutationObserver(checkTextElements);
|
|
78
|
+
observer.observe(rootNode, {
|
|
79
|
+
childList: true,
|
|
80
|
+
subtree: true
|
|
81
|
+
});
|
|
82
|
+
onCleanup(() => observer.disconnect());
|
|
83
|
+
});
|
|
84
|
+
const labelIds = createMemo(() => {
|
|
85
|
+
const ids = [];
|
|
86
|
+
if (hasErrorText() && mergedProps.invalid) ids.push(errorTextId);
|
|
87
|
+
if (hasHelperText()) ids.push(helperTextId);
|
|
88
|
+
return ids;
|
|
89
|
+
});
|
|
90
|
+
const getRootProps = () => ({
|
|
91
|
+
...parts.root.attrs,
|
|
92
|
+
disabled: mergedProps.disabled,
|
|
93
|
+
"data-disabled": dataAttr(mergedProps.disabled),
|
|
94
|
+
"data-invalid": dataAttr(mergedProps.invalid),
|
|
95
|
+
"aria-labelledby": legendId,
|
|
96
|
+
"aria-describedby": labelIds().join(" ") || void 0
|
|
97
|
+
});
|
|
98
|
+
const getLegendProps = () => ({
|
|
99
|
+
id: legendId,
|
|
100
|
+
...parts.legend.attrs,
|
|
101
|
+
"data-disabled": dataAttr(mergedProps.disabled),
|
|
102
|
+
"data-invalid": dataAttr(mergedProps.invalid)
|
|
103
|
+
});
|
|
104
|
+
const getHelperTextProps = () => ({
|
|
105
|
+
id: helperTextId,
|
|
106
|
+
...parts.helperText.attrs
|
|
107
|
+
});
|
|
108
|
+
const getErrorTextProps = () => ({
|
|
109
|
+
id: errorTextId,
|
|
110
|
+
...parts.errorText.attrs,
|
|
111
|
+
"aria-live": "polite"
|
|
112
|
+
});
|
|
113
|
+
return createMemo(() => ({
|
|
114
|
+
refs: { rootRef: setRootRef },
|
|
115
|
+
ids: {
|
|
116
|
+
legend: legendId,
|
|
117
|
+
errorText: errorTextId,
|
|
118
|
+
helperText: helperTextId
|
|
119
|
+
},
|
|
120
|
+
disabled: mergedProps.disabled,
|
|
121
|
+
invalid: mergedProps.invalid,
|
|
122
|
+
getRootProps,
|
|
123
|
+
getLegendProps,
|
|
124
|
+
getHelperTextProps,
|
|
125
|
+
getErrorTextProps
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/components/fieldset/fieldset-root.tsx
|
|
131
|
+
const FieldsetRoot = (props) => {
|
|
132
|
+
const [useFieldsetProps, localProps] = createSplitProps()(props, [
|
|
133
|
+
"id",
|
|
134
|
+
"disabled",
|
|
135
|
+
"invalid"
|
|
136
|
+
]);
|
|
137
|
+
const fieldset = useFieldset(useFieldsetProps);
|
|
138
|
+
const mergedProps = mergeProps$1(() => fieldset().getRootProps(), localProps);
|
|
139
|
+
return <FieldsetProvider value={fieldset}>
|
|
140
|
+
<sprawlify.fieldset {...mergedProps} ref={composeRefs(fieldset().refs.rootRef, props.ref)} />
|
|
141
|
+
</FieldsetProvider>;
|
|
142
|
+
};
|
|
143
|
+
FieldsetRoot.displayName = "FieldsetRoot";
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/components/fieldset/fieldset-root-provider.tsx
|
|
147
|
+
const FieldsetRootProvider = (props) => {
|
|
148
|
+
const [{ value: fieldset }, localProps] = createSplitProps()(props, ["value"]);
|
|
149
|
+
const mergedProps = mergeProps$1(() => fieldset().getRootProps(), localProps);
|
|
150
|
+
return <FieldsetProvider value={fieldset}>
|
|
151
|
+
<sprawlify.fieldset {...mergedProps} />
|
|
152
|
+
</FieldsetProvider>;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/fieldset/fieldset.tsx
|
|
157
|
+
var fieldset_exports = /* @__PURE__ */ __export({
|
|
158
|
+
Context: () => FieldsetContext,
|
|
159
|
+
ErrorText: () => FieldsetErrorText,
|
|
160
|
+
HelperText: () => FieldsetHelperText,
|
|
161
|
+
Legend: () => FieldsetLegend,
|
|
162
|
+
Root: () => FieldsetRoot,
|
|
163
|
+
RootProvider: () => FieldsetRootProvider
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
//#endregion
|
|
167
|
+
export { fieldsetAnatomy as a, FieldsetErrorText as c, useFieldset as i, FieldsetContext as l, FieldsetRootProvider as n, FieldsetLegend as o, FieldsetRoot as r, FieldsetHelperText as s, fieldset_exports as t, useFieldsetContext as u };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-CKcAJnC7.js";
|
|
2
|
+
import { i as mergeProps$2, t as runIfFn } from "./run-if-fn-eYlaegHy.js";
|
|
3
|
+
import { t as createContext$1 } from "./create-context-PS2j4mEo.js";
|
|
4
|
+
import { o as useEnvironmentContext } from "./providers-CQkAUunr.js";
|
|
5
|
+
import { n as createSplitProps, t as sprawlify } from "./factory-CEdj72aS.js";
|
|
6
|
+
import { t as composeRefs } from "./compose-refs-vsrTrt13.js";
|
|
7
|
+
import { Show, createMemo, createSignal, createUniqueId, mergeProps, onCleanup, onMount } from "solid-js";
|
|
8
|
+
import { createComponent, mergeProps as mergeProps$1 } from "solid-js/web";
|
|
9
|
+
import { dataAttr } from "@sprawlify/primitives/dom-query";
|
|
10
|
+
import { createAnatomy } from "@sprawlify/primitives/anatomy";
|
|
11
|
+
|
|
12
|
+
//#region src/components/fieldset/use-fieldset-context.ts
|
|
13
|
+
const [FieldsetProvider, useFieldsetContext] = createContext$1({
|
|
14
|
+
hookName: "useFieldsetContext",
|
|
15
|
+
providerName: "<FieldsetProvider />",
|
|
16
|
+
strict: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/fieldset/fieldset-context.tsx
|
|
21
|
+
const FieldsetContext = (props) => props.children(useFieldsetContext());
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/components/fieldset/fieldset-error-text.tsx
|
|
25
|
+
const FieldsetErrorText = (props) => {
|
|
26
|
+
const fieldset = useFieldsetContext();
|
|
27
|
+
const mergedProps = mergeProps$2(() => fieldset().getErrorTextProps(), props);
|
|
28
|
+
return createComponent(Show, {
|
|
29
|
+
get when() {
|
|
30
|
+
return fieldset().invalid;
|
|
31
|
+
},
|
|
32
|
+
get children() {
|
|
33
|
+
return createComponent(sprawlify.span, mergedProps);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/fieldset/fieldset-helper-text.tsx
|
|
40
|
+
const FieldsetHelperText = (props) => {
|
|
41
|
+
const fieldset = useFieldsetContext();
|
|
42
|
+
const mergedProps = mergeProps$2(() => fieldset().getHelperTextProps(), props);
|
|
43
|
+
return createComponent(sprawlify.span, mergedProps);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/fieldset/fieldset-legend.tsx
|
|
48
|
+
const FieldsetLegend = (props) => {
|
|
49
|
+
const fieldset = useFieldsetContext();
|
|
50
|
+
const mergedProps = mergeProps$2(() => fieldset().getLegendProps(), props);
|
|
51
|
+
return createComponent(sprawlify.legend, mergedProps);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/fieldset/fieldset-anatomy.ts
|
|
56
|
+
const fieldsetAnatomy = createAnatomy("fieldset").parts("root", "errorText", "helperText", "legend");
|
|
57
|
+
const parts = fieldsetAnatomy.build();
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/components/fieldset/use-fieldset.ts
|
|
61
|
+
const useFieldset = (props) => {
|
|
62
|
+
const env = useEnvironmentContext();
|
|
63
|
+
const mergedProps = mergeProps({
|
|
64
|
+
disabled: false,
|
|
65
|
+
invalid: false
|
|
66
|
+
}, runIfFn(props));
|
|
67
|
+
const [rootRef, setRootRef] = createSignal(void 0);
|
|
68
|
+
const id = mergedProps.id ?? createUniqueId();
|
|
69
|
+
const legendId = `fieldset::${id}::legend`;
|
|
70
|
+
const errorTextId = `fieldset::${id}::error-text`;
|
|
71
|
+
const helperTextId = `fieldset::${id}::helper-text`;
|
|
72
|
+
const [hasErrorText, setHasErrorText] = createSignal(false);
|
|
73
|
+
const [hasHelperText, setHasHelperText] = createSignal(false);
|
|
74
|
+
onMount(() => {
|
|
75
|
+
const rootNode = rootRef();
|
|
76
|
+
if (!rootNode) return;
|
|
77
|
+
const checkTextElements = () => {
|
|
78
|
+
const docOrShadowRoot = env().getRootNode();
|
|
79
|
+
setHasErrorText(!!docOrShadowRoot.getElementById(errorTextId));
|
|
80
|
+
setHasHelperText(!!docOrShadowRoot.getElementById(helperTextId));
|
|
81
|
+
};
|
|
82
|
+
checkTextElements();
|
|
83
|
+
const observer = new (env().getWindow()).MutationObserver(checkTextElements);
|
|
84
|
+
observer.observe(rootNode, {
|
|
85
|
+
childList: true,
|
|
86
|
+
subtree: true
|
|
87
|
+
});
|
|
88
|
+
onCleanup(() => observer.disconnect());
|
|
89
|
+
});
|
|
90
|
+
const labelIds = createMemo(() => {
|
|
91
|
+
const ids = [];
|
|
92
|
+
if (hasErrorText() && mergedProps.invalid) ids.push(errorTextId);
|
|
93
|
+
if (hasHelperText()) ids.push(helperTextId);
|
|
94
|
+
return ids;
|
|
95
|
+
});
|
|
96
|
+
const getRootProps = () => ({
|
|
97
|
+
...parts.root.attrs,
|
|
98
|
+
disabled: mergedProps.disabled,
|
|
99
|
+
"data-disabled": dataAttr(mergedProps.disabled),
|
|
100
|
+
"data-invalid": dataAttr(mergedProps.invalid),
|
|
101
|
+
"aria-labelledby": legendId,
|
|
102
|
+
"aria-describedby": labelIds().join(" ") || void 0
|
|
103
|
+
});
|
|
104
|
+
const getLegendProps = () => ({
|
|
105
|
+
id: legendId,
|
|
106
|
+
...parts.legend.attrs,
|
|
107
|
+
"data-disabled": dataAttr(mergedProps.disabled),
|
|
108
|
+
"data-invalid": dataAttr(mergedProps.invalid)
|
|
109
|
+
});
|
|
110
|
+
const getHelperTextProps = () => ({
|
|
111
|
+
id: helperTextId,
|
|
112
|
+
...parts.helperText.attrs
|
|
113
|
+
});
|
|
114
|
+
const getErrorTextProps = () => ({
|
|
115
|
+
id: errorTextId,
|
|
116
|
+
...parts.errorText.attrs,
|
|
117
|
+
"aria-live": "polite"
|
|
118
|
+
});
|
|
119
|
+
return createMemo(() => ({
|
|
120
|
+
refs: { rootRef: setRootRef },
|
|
121
|
+
ids: {
|
|
122
|
+
legend: legendId,
|
|
123
|
+
errorText: errorTextId,
|
|
124
|
+
helperText: helperTextId
|
|
125
|
+
},
|
|
126
|
+
disabled: mergedProps.disabled,
|
|
127
|
+
invalid: mergedProps.invalid,
|
|
128
|
+
getRootProps,
|
|
129
|
+
getLegendProps,
|
|
130
|
+
getHelperTextProps,
|
|
131
|
+
getErrorTextProps
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/fieldset/fieldset-root.tsx
|
|
137
|
+
const FieldsetRoot = (props) => {
|
|
138
|
+
const [useFieldsetProps, localProps] = createSplitProps()(props, [
|
|
139
|
+
"id",
|
|
140
|
+
"disabled",
|
|
141
|
+
"invalid"
|
|
142
|
+
]);
|
|
143
|
+
const fieldset = useFieldset(useFieldsetProps);
|
|
144
|
+
const mergedProps = mergeProps$2(() => fieldset().getRootProps(), localProps);
|
|
145
|
+
return createComponent(FieldsetProvider, {
|
|
146
|
+
value: fieldset,
|
|
147
|
+
get children() {
|
|
148
|
+
return createComponent(sprawlify.fieldset, mergeProps$1(mergedProps, { ref(r$) {
|
|
149
|
+
var _ref$ = composeRefs(fieldset().refs.rootRef, props.ref);
|
|
150
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
151
|
+
} }));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
FieldsetRoot.displayName = "FieldsetRoot";
|
|
156
|
+
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/components/fieldset/fieldset-root-provider.tsx
|
|
159
|
+
const FieldsetRootProvider = (props) => {
|
|
160
|
+
const [{ value: fieldset }, localProps] = createSplitProps()(props, ["value"]);
|
|
161
|
+
const mergedProps = mergeProps$2(() => fieldset().getRootProps(), localProps);
|
|
162
|
+
return createComponent(FieldsetProvider, {
|
|
163
|
+
value: fieldset,
|
|
164
|
+
get children() {
|
|
165
|
+
return createComponent(sprawlify.fieldset, mergedProps);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/components/fieldset/fieldset.tsx
|
|
172
|
+
var fieldset_exports = /* @__PURE__ */ __export({
|
|
173
|
+
Context: () => FieldsetContext,
|
|
174
|
+
ErrorText: () => FieldsetErrorText,
|
|
175
|
+
HelperText: () => FieldsetHelperText,
|
|
176
|
+
Legend: () => FieldsetLegend,
|
|
177
|
+
Root: () => FieldsetRoot,
|
|
178
|
+
RootProvider: () => FieldsetRootProvider
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
//#endregion
|
|
182
|
+
export { fieldsetAnatomy as a, FieldsetErrorText as c, useFieldset as i, FieldsetContext as l, FieldsetRootProvider as n, FieldsetLegend as o, FieldsetRoot as r, FieldsetHelperText as s, fieldset_exports as t, useFieldsetContext as u };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context } from "solid-js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/create-context.d.ts
|
|
4
|
+
interface CreateContextOptions<T> {
|
|
5
|
+
strict?: boolean;
|
|
6
|
+
hookName?: string;
|
|
7
|
+
providerName?: string;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
defaultValue?: T;
|
|
10
|
+
}
|
|
11
|
+
type CreateContextReturn<T> = [Context<T>['Provider'], () => T, Context<T>];
|
|
12
|
+
declare function createContext$1<T>(options?: CreateContextOptions<T>): CreateContextReturn<T>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createContext$1 as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Key } from "@solid-primitives/keyed";
|
|
2
|
+
import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
|
|
3
|
+
import { Accessor, JSX } from "solid-js";
|
|
4
|
+
import * as _sprawlify_primitives_types0 from "@sprawlify/primitives/types";
|
|
5
|
+
|
|
6
|
+
//#region src/core/machine.d.ts
|
|
7
|
+
declare function useMachine<T extends MachineSchema>(machine: Machine<T>, userProps?: Partial<T["props"]> | Accessor<Partial<T["props"]>>): Service<T>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/core/merge-props.d.ts
|
|
10
|
+
type MaybeAccessor<T> = T | (() => T);
|
|
11
|
+
declare function mergeProps$2<T>(source: MaybeAccessor<T>): T;
|
|
12
|
+
declare function mergeProps$2<T, U>(source: MaybeAccessor<T>, source1: MaybeAccessor<U>): T & U;
|
|
13
|
+
declare function mergeProps$2<T, U, V>(source: MaybeAccessor<T>, source1: MaybeAccessor<U>, source2: MaybeAccessor<V>): T & U & V;
|
|
14
|
+
declare function mergeProps$2<T, U, V, W>(source: MaybeAccessor<T>, source1: MaybeAccessor<U>, source2: MaybeAccessor<V>, source3: MaybeAccessor<W>): T & U & V & W;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/core/normalize-props.d.ts
|
|
17
|
+
type PropTypes = JSX.IntrinsicElements & {
|
|
18
|
+
element: JSX.HTMLAttributes<any>;
|
|
19
|
+
style: JSX.CSSProperties;
|
|
20
|
+
};
|
|
21
|
+
declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useMachine as a, mergeProps$2 as i, PropTypes as n, normalizeProps as r, Key as t };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { n as MaybeAccessor } from "./types-bQRbEioA.js";
|
|
2
|
+
import { Accessor } from "solid-js";
|
|
3
|
+
import { CollectionItem, CollectionItem as CollectionItem$1, CollectionOptions, FilePathTreeNode, FilePathTreeNode as FilePathTreeNode$1, FlatTreeNode, GridCollection as GridCollection$1, GridCollectionOptions, ListCollection as ListCollection$1, SelectionMode, TreeCollection, TreeCollection as TreeCollection$1, TreeCollectionOptions, TreeCollectionOptions as TreeCollectionOptions$1, TreeNode, TreeNode as TreeNode$1 } from "@sprawlify/primitives/collection";
|
|
4
|
+
import * as asyncList from "@sprawlify/primitives/machines/async-list";
|
|
5
|
+
|
|
6
|
+
//#region src/components/collection/grid-collection.d.ts
|
|
7
|
+
declare const createGridCollection: <T extends CollectionItem$1>(options: GridCollectionOptions<T>) => GridCollection$1<T>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/components/collection/list-collection.d.ts
|
|
10
|
+
declare const createListCollection: <T extends CollectionItem>(options: CollectionOptions<T>) => ListCollection$1<T>;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/collection/tree-collection.d.ts
|
|
13
|
+
declare const createTreeCollection: <T extends TreeNode>(options: TreeCollectionOptions<T>) => TreeCollection<T>;
|
|
14
|
+
declare const createFileTreeCollection: (paths: string[]) => TreeCollection<FilePathTreeNode>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/collection/use-async-list.d.ts
|
|
17
|
+
interface UseAsyncListProps<T, C = string> extends asyncList.Props<T, C> {}
|
|
18
|
+
interface UseAsyncListReturn<T, C = string> extends Accessor<asyncList.Api<T, C>> {}
|
|
19
|
+
declare const useAsyncList: <T, C = string>(props?: MaybeAccessor<UseAsyncListProps<T, C>>) => UseAsyncListReturn<T, C>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/collection/use-list-collection.d.ts
|
|
22
|
+
interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, 'items'> {
|
|
23
|
+
initialItems: T[] | readonly T[];
|
|
24
|
+
filter?: (itemText: string, filterText: string, item: T) => boolean;
|
|
25
|
+
limit?: number;
|
|
26
|
+
}
|
|
27
|
+
declare function useListCollection<T>(props: MaybeAccessor<UseListCollectionProps<T>>): UseListCollectionReturn<T>;
|
|
28
|
+
interface UseListCollectionReturn<T> {
|
|
29
|
+
collection: () => ListCollection$1<T>;
|
|
30
|
+
filter: (inputValue: string) => void;
|
|
31
|
+
set: (items: T[]) => void;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
clear: () => void;
|
|
34
|
+
insert: (index: number, ...items: T[]) => void;
|
|
35
|
+
insertBefore: (value: string, ...items: T[]) => void;
|
|
36
|
+
insertAfter: (value: string, ...items: T[]) => void;
|
|
37
|
+
remove: (...itemOrValues: Array<T | string>) => void;
|
|
38
|
+
move: (value: string, to: number) => void;
|
|
39
|
+
moveBefore: (value: string, ...values: string[]) => void;
|
|
40
|
+
moveAfter: (value: string, ...values: string[]) => void;
|
|
41
|
+
reorder: (from: number, to: number) => void;
|
|
42
|
+
append: (...items: T[]) => void;
|
|
43
|
+
upsert: (value: string, item: T, mode?: 'append' | 'prepend') => void;
|
|
44
|
+
prepend: (...items: T[]) => void;
|
|
45
|
+
update: (value: string, item: T) => void;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/collection/use-list-selection.d.ts
|
|
49
|
+
interface UseListSelectionProps<T extends CollectionItem> {
|
|
50
|
+
selectionMode?: SelectionMode;
|
|
51
|
+
deselectable?: boolean;
|
|
52
|
+
initialSelectedValues?: string[];
|
|
53
|
+
resetOnCollectionChange?: boolean;
|
|
54
|
+
collection: ListCollection$1<T>;
|
|
55
|
+
}
|
|
56
|
+
declare function useListSelection<T extends CollectionItem>(props: MaybeAccessor<UseListSelectionProps<T>>): UseListSelectionReturn;
|
|
57
|
+
interface UseListSelectionReturn {
|
|
58
|
+
selectedValues: () => string[];
|
|
59
|
+
isEmpty: () => boolean;
|
|
60
|
+
firstSelectedValue: () => string | null;
|
|
61
|
+
lastSelectedValue: () => string | null;
|
|
62
|
+
isSelected: (value: string | null) => boolean;
|
|
63
|
+
canSelect: (value: string) => boolean;
|
|
64
|
+
select: (value: string, forceToggle?: boolean) => void;
|
|
65
|
+
deselect: (value: string) => void;
|
|
66
|
+
toggle: (value: string) => void;
|
|
67
|
+
replace: (value: string | null) => void;
|
|
68
|
+
extend: (anchorValue: string, targetValue: string) => void;
|
|
69
|
+
setSelectedValues: (values: string[]) => void;
|
|
70
|
+
clear: () => void;
|
|
71
|
+
resetSelection: () => void;
|
|
72
|
+
isAllSelected: () => boolean;
|
|
73
|
+
isSomeSelected: () => boolean;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { createGridCollection as C, GridCollectionOptions as S, CollectionItem as _, UseListCollectionReturn as a, createListCollection as b, UseAsyncListReturn as c, FlatTreeNode as d, TreeCollection$1 as f, createTreeCollection as g, createFileTreeCollection as h, UseListCollectionProps as i, useAsyncList as l, TreeNode$1 as m, UseListSelectionReturn as n, useListCollection as o, TreeCollectionOptions$1 as p, useListSelection as r, UseAsyncListProps as s, UseListSelectionProps as t, FilePathTreeNode$1 as u, CollectionOptions as v, GridCollection$1 as x, ListCollection$1 as y };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { i as Optional, n as MaybeAccessor } from "./types-bQRbEioA.js";
|
|
2
|
+
import { n as PolymorphicProps, t as HTMLProps } from "./factory-B6RK6SH4.js";
|
|
3
|
+
import { t as RenderStrategyProps } from "./render-strategy-CtRkdWei.js";
|
|
4
|
+
import * as solid_js5 from "solid-js";
|
|
5
|
+
import * as presence from "@sprawlify/primitives/machines/presence";
|
|
6
|
+
|
|
7
|
+
//#region src/components/presence/use-presence.d.ts
|
|
8
|
+
interface UsePresenceProps extends Optional<presence.Props, 'present'>, RenderStrategyProps {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to allow the initial presence animation.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
skipAnimationOnMount?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface UsePresenceReturn extends ReturnType<typeof usePresence> {}
|
|
16
|
+
declare const usePresence: (props: MaybeAccessor<UsePresenceProps>) => solid_js5.Accessor<{
|
|
17
|
+
unmounted: boolean | undefined;
|
|
18
|
+
present: boolean;
|
|
19
|
+
ref: (node: Element | null) => void;
|
|
20
|
+
presenceProps: {
|
|
21
|
+
hidden: boolean;
|
|
22
|
+
'data-state': string | undefined;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/presence/presence.d.ts
|
|
27
|
+
interface PresenceBaseProps extends UsePresenceProps, PolymorphicProps<'div'> {}
|
|
28
|
+
interface PresenceProps extends HTMLProps<'div'>, PresenceBaseProps {}
|
|
29
|
+
declare const Presence: (props: PresenceProps) => solid_js5.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/presence/split-presence-props.d.ts
|
|
32
|
+
declare const splitPresenceProps: <T extends UsePresenceProps>(props: T) => [Pick<T, Extract<("present" | "onExitComplete" | "immediate" | "skipAnimationOnMount" | "lazyMount" | "unmountOnExit")[], readonly (keyof T)[]>[number]>, { [P in keyof T as Exclude<P, "present" | "onExitComplete" | "immediate" | "skipAnimationOnMount" | "lazyMount" | "unmountOnExit">]: T[P] }];
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/presence/use-presence-context.d.ts
|
|
35
|
+
interface UsePresenceContext extends UsePresenceReturn {}
|
|
36
|
+
declare const PresenceProvider: solid_js5.ContextProviderComponent<UsePresenceContext>, usePresenceContext: () => UsePresenceContext;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Presence as a, UsePresenceReturn as c, splitPresenceProps as i, usePresence as l, UsePresenceContext as n, PresenceProps as o, usePresenceContext as r, UsePresenceProps as s, PresenceProvider as t };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { i as Optional, n as MaybeAccessor } from "./types-bQRbEioA.js";
|
|
2
|
+
import { n as PolymorphicProps, t as HTMLProps } from "./factory-B6RK6SH4.js";
|
|
3
|
+
import { t as RenderStrategyProps } from "./render-strategy-CtRkdWei.js";
|
|
4
|
+
import * as solid_js12 from "solid-js";
|
|
5
|
+
import * as presence from "@sprawlify/primitives/machines/presence";
|
|
6
|
+
|
|
7
|
+
//#region src/components/presence/use-presence.d.ts
|
|
8
|
+
interface UsePresenceProps extends Optional<presence.Props, 'present'>, RenderStrategyProps {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to allow the initial presence animation.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
skipAnimationOnMount?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface UsePresenceReturn extends ReturnType<typeof usePresence> {}
|
|
16
|
+
declare const usePresence: (props: MaybeAccessor<UsePresenceProps>) => solid_js12.Accessor<{
|
|
17
|
+
unmounted: boolean | undefined;
|
|
18
|
+
present: boolean;
|
|
19
|
+
ref: (node: Element | null) => void;
|
|
20
|
+
presenceProps: {
|
|
21
|
+
hidden: boolean;
|
|
22
|
+
'data-state': string | undefined;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/presence/presence.d.ts
|
|
27
|
+
interface PresenceBaseProps extends UsePresenceProps, PolymorphicProps<'div'> {}
|
|
28
|
+
interface PresenceProps extends HTMLProps<'div'>, PresenceBaseProps {}
|
|
29
|
+
declare const Presence: (props: PresenceProps) => solid_js12.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/presence/split-presence-props.d.ts
|
|
32
|
+
declare const splitPresenceProps: <T extends UsePresenceProps>(props: T) => [Pick<T, Extract<("present" | "onExitComplete" | "immediate" | "skipAnimationOnMount" | "lazyMount" | "unmountOnExit")[], readonly (keyof T)[]>[number]>, { [P in keyof T as Exclude<P, "present" | "onExitComplete" | "immediate" | "skipAnimationOnMount" | "lazyMount" | "unmountOnExit">]: T[P] }];
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/presence/use-presence-context.d.ts
|
|
35
|
+
interface UsePresenceContext extends UsePresenceReturn {}
|
|
36
|
+
declare const PresenceProvider: solid_js12.ContextProviderComponent<UsePresenceContext>, usePresenceContext: () => UsePresenceContext;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Presence as a, UsePresenceReturn as c, splitPresenceProps as i, usePresence as l, UsePresenceContext as n, PresenceProps as o, usePresenceContext as r, UsePresenceProps as s, PresenceProvider as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
import { Key } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
1
|
+
import { a as useMachine, i as mergeProps, n as PropTypes, r as normalizeProps, t as Key } from "./index-C3ATynHc.js";
|
|
2
|
+
import { i as Optional, n as MaybeAccessor, r as MaybePromise, t as Assign } from "./types-bQRbEioA.js";
|
|
3
|
+
import { t as createContext } from "./index-B0YoIRC4.js";
|
|
4
|
+
import * as solid_js107 from "solid-js";
|
|
5
|
+
import { Accessor, JSX, ParentProps } from "solid-js";
|
|
6
|
+
import { FilterOptions, FilterReturn, Locale } from "@sprawlify/primitives/i18n-utils";
|
|
5
7
|
|
|
6
|
-
//#region src/
|
|
7
|
-
|
|
8
|
+
//#region src/providers/environment/use-environment-context.d.ts
|
|
9
|
+
type RootNode = ShadowRoot | Document | Node;
|
|
10
|
+
interface UseEnvironmentContext {
|
|
11
|
+
getRootNode(): RootNode;
|
|
12
|
+
getDocument(): Document;
|
|
13
|
+
getWindow(): Window & typeof globalThis;
|
|
14
|
+
}
|
|
8
15
|
//#endregion
|
|
9
|
-
//#region src/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare
|
|
16
|
+
//#region src/providers/environment/environment-provider.d.ts
|
|
17
|
+
interface EnvironmentProviderProps {
|
|
18
|
+
children?: JSX.Element;
|
|
19
|
+
value?: RootNode | (() => RootNode);
|
|
20
|
+
}
|
|
21
|
+
declare const EnvironmentProvider: (props: EnvironmentProviderProps) => JSX.Element;
|
|
15
22
|
//#endregion
|
|
16
|
-
//#region src/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
|
|
23
|
+
//#region src/providers/locale/locale-provider.d.ts
|
|
24
|
+
interface LocaleProviderProps extends ParentProps {
|
|
25
|
+
locale: string;
|
|
26
|
+
}
|
|
27
|
+
declare const LocaleProvider: (props: LocaleProviderProps) => solid_js107.JSX.Element;
|
|
22
28
|
//#endregion
|
|
23
|
-
|
|
29
|
+
//#region src/providers/locale/use-collator.d.ts
|
|
30
|
+
interface UseCollatorProps extends Intl.CollatorOptions {
|
|
31
|
+
locale?: string;
|
|
32
|
+
}
|
|
33
|
+
interface UseCollatorReturn extends Accessor<Intl.Collator> {}
|
|
34
|
+
declare function useCollator(props?: UseCollatorProps): UseCollatorReturn;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/providers/locale/use-filter.d.ts
|
|
37
|
+
interface UseFilterProps extends FilterOptions {}
|
|
38
|
+
declare function useFilter(props: UseFilterProps): UseFilterReturn;
|
|
39
|
+
interface UseFilterReturn extends Accessor<FilterReturn> {}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/providers/locale/use-locale-context.d.ts
|
|
42
|
+
interface UseLocaleContext extends Accessor<Locale> {}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Assign, EnvironmentProvider, type EnvironmentProviderProps, Key, LocaleProvider, type LocaleProviderProps, MaybeAccessor, MaybePromise, Optional, PropTypes, type RootNode, type UseCollatorProps, type UseEnvironmentContext, type UseFilterProps, type UseFilterReturn, type UseLocaleContext, createContext, mergeProps, normalizeProps, useCollator, useEnvironmentContext, useFilter, useLocaleContext, useMachine };
|