@sprawlify/react 0.0.6 → 0.0.8
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-BYnRvbsk.cjs +53 -0
- package/dist/{collapsible-DYgHs1_i.mjs → collapsible-Nbt3Sequ.mjs} +7 -4
- package/dist/{collapsible-D_cXuaRy.cjs → collapsible-aFKYmVbP.cjs} +13 -9
- package/dist/collection-DGEUORi5.cjs +230 -0
- package/dist/collection-DQWWySNV.mjs +187 -0
- package/dist/components/accordion/index.cjs +21 -24
- package/dist/components/accordion/index.d.cts +11 -9
- package/dist/components/accordion/index.d.mts +11 -9
- package/dist/components/accordion/index.mjs +10 -14
- package/dist/components/angle-slider/index.cjs +14 -9
- package/dist/components/angle-slider/index.d.cts +13 -11
- package/dist/components/angle-slider/index.d.mts +13 -11
- package/dist/components/angle-slider/index.mjs +8 -4
- package/dist/components/avatar/index.cjs +14 -9
- package/dist/components/avatar/index.d.cts +8 -6
- package/dist/components/avatar/index.d.mts +8 -6
- package/dist/components/avatar/index.mjs +8 -4
- package/dist/components/bottom-sheet/index.cjs +216 -0
- package/dist/components/bottom-sheet/index.d.cts +80 -0
- package/dist/components/bottom-sheet/index.d.mts +81 -0
- package/dist/components/bottom-sheet/index.mjs +192 -0
- package/dist/components/carousel/index.cjs +265 -0
- package/dist/components/carousel/index.d.cts +95 -0
- package/dist/components/carousel/index.d.mts +95 -0
- package/dist/components/carousel/index.mjs +243 -0
- package/dist/components/checkbox/index.cjs +311 -0
- package/dist/components/checkbox/index.d.cts +115 -0
- package/dist/components/checkbox/index.d.mts +115 -0
- package/dist/components/checkbox/index.mjs +291 -0
- package/dist/components/client-only/index.cjs +14 -0
- package/dist/components/client-only/index.d.cts +8 -0
- package/dist/components/client-only/index.d.mts +8 -0
- package/dist/components/client-only/index.mjs +13 -0
- package/dist/components/clipboard/index.cjs +186 -0
- package/dist/components/clipboard/index.d.cts +71 -0
- package/dist/components/clipboard/index.d.mts +71 -0
- package/dist/components/clipboard/index.mjs +163 -0
- package/dist/components/collapsible/index.cjs +8 -3
- package/dist/components/collapsible/index.d.cts +10 -8
- package/dist/components/collapsible/index.d.mts +10 -8
- package/dist/components/collapsible/index.mjs +7 -3
- package/dist/components/collection/index.cjs +11 -0
- package/dist/components/collection/index.d.cts +2 -0
- package/dist/components/collection/index.d.mts +2 -0
- package/dist/components/collection/index.mjs +5 -0
- package/dist/components/color-picker/index.cjs +617 -0
- package/dist/components/color-picker/index.d.cts +181 -0
- package/dist/components/color-picker/index.d.mts +182 -0
- package/dist/components/color-picker/index.mjs +573 -0
- package/dist/components/combobox/index.cjs +420 -0
- package/dist/components/combobox/index.d.cts +132 -0
- package/dist/components/combobox/index.d.mts +133 -0
- package/dist/components/combobox/index.mjs +390 -0
- package/dist/components/date-picker/index.cjs +567 -0
- package/dist/components/date-picker/index.d.cts +164 -0
- package/dist/components/date-picker/index.d.mts +165 -0
- package/dist/components/date-picker/index.mjs +526 -0
- package/dist/components/dialog/index.cjs +211 -0
- package/dist/components/dialog/index.d.cts +80 -0
- package/dist/components/dialog/index.d.mts +81 -0
- package/dist/components/dialog/index.mjs +187 -0
- package/dist/components/download-trigger/index.cjs +43 -0
- package/dist/components/download-trigger/index.d.cts +16 -0
- package/dist/components/download-trigger/index.d.mts +16 -0
- package/dist/components/download-trigger/index.mjs +42 -0
- package/dist/components/editable/index.cjs +246 -0
- package/dist/components/editable/index.d.cts +79 -0
- package/dist/components/editable/index.d.mts +79 -0
- package/dist/components/editable/index.mjs +221 -0
- package/dist/components/field/index.cjs +29 -0
- package/dist/components/field/index.d.cts +116 -0
- package/dist/components/field/index.d.mts +116 -0
- package/dist/components/field/index.mjs +11 -0
- package/dist/components/fieldset/index.cjs +25 -0
- package/dist/components/fieldset/index.d.cts +73 -0
- package/dist/components/fieldset/index.d.mts +73 -0
- package/dist/components/fieldset/index.mjs +11 -0
- package/dist/components/file-upload/index.cjs +351 -0
- package/dist/components/file-upload/index.d.cts +102 -0
- package/dist/components/file-upload/index.d.mts +102 -0
- package/dist/components/file-upload/index.mjs +322 -0
- package/dist/components/floating-panel/index.cjs +287 -0
- package/dist/components/floating-panel/index.d.cts +100 -0
- package/dist/components/floating-panel/index.d.mts +101 -0
- package/dist/components/floating-panel/index.mjs +259 -0
- package/dist/components/focus-trap/index.cjs +36 -0
- package/dist/components/focus-trap/index.d.cts +14 -0
- package/dist/components/focus-trap/index.d.mts +14 -0
- package/dist/components/focus-trap/index.mjs +35 -0
- package/dist/components/format/index.cjs +57 -0
- package/dist/components/format/index.d.cts +36 -0
- package/dist/components/format/index.d.mts +36 -0
- package/dist/components/format/index.mjs +49 -0
- package/dist/components/frame/index.cjs +90 -0
- package/dist/components/frame/index.d.cts +13 -0
- package/dist/components/frame/index.d.mts +13 -0
- package/dist/components/frame/index.mjs +89 -0
- package/dist/components/highlight/index.cjs +32 -0
- package/dist/components/highlight/index.d.cts +14 -0
- package/dist/components/highlight/index.d.mts +14 -0
- package/dist/components/highlight/index.mjs +30 -0
- package/dist/components/portal/index.cjs +33 -0
- package/dist/components/portal/index.d.cts +11 -0
- package/dist/components/portal/index.d.mts +11 -0
- package/dist/components/portal/index.mjs +32 -0
- package/dist/components/presence/index.cjs +11 -0
- package/dist/components/presence/index.d.cts +2 -0
- package/dist/components/presence/index.d.mts +4 -0
- package/dist/components/presence/index.mjs +7 -0
- package/dist/components/select/index.cjs +423 -0
- package/dist/components/select/index.d.cts +132 -0
- package/dist/components/select/index.d.mts +133 -0
- package/dist/components/select/index.mjs +387 -0
- package/dist/compose-refs-BEptPEkE.mjs +16 -0
- package/dist/compose-refs-C5QNDywq.cjs +22 -0
- package/dist/{factory-DN0EdT7u.mjs → core-Ba4IEjhK.mjs} +4 -154
- package/dist/{factory-CfqPG186.cjs → core-DCWyxy9D.cjs} +2 -251
- package/dist/{create-context-DCEySQ7J.cjs → create-context-CQ4U0lLj.cjs} +1 -1
- package/dist/environment-CvilmfQt.cjs +58 -0
- package/dist/environment-Ded7DkGr.mjs +46 -0
- package/dist/factory-Bi8oEg8i.mjs +49 -0
- package/dist/factory-C-EBNsCW.d.mts +15 -0
- package/dist/factory-C166evrS.cjs +61 -0
- package/dist/factory-C4cfTHs7.d.cts +15 -0
- package/dist/field-B-6qoKdn.mjs +324 -0
- package/dist/field-C-57Gj2E.cjs +406 -0
- package/dist/fieldset-B-MkM2Ms.cjs +239 -0
- package/dist/fieldset-gaVneDYh.mjs +186 -0
- package/dist/index-BJvW7OpY.d.mts +25 -0
- package/dist/index-BhGgEHWc.d.cts +34 -0
- package/dist/index-ByIsf4E7.d.mts +74 -0
- package/dist/index-Cp1i1zbg.d.mts +34 -0
- package/dist/index-CumJbg8V.d.cts +74 -0
- package/dist/index.cjs +17 -12
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +7 -3
- package/dist/locale-BcnWD1Hf.cjs +78 -0
- package/dist/locale-Coin-d7R.mjs +54 -0
- package/dist/normalize-props-skGwa8Dk.d.cts +13 -0
- package/dist/presence-Bc6Bxe5i.mjs +72 -0
- package/dist/presence-CPov8wyU.cjs +103 -0
- package/dist/providers-BNAArubQ.cjs +0 -0
- package/dist/providers-Dm2P3F2_.mjs +1 -0
- package/dist/render-strategy-BywM_IvB.cjs +30 -0
- package/dist/render-strategy-FiPgAp1U.mjs +13 -0
- package/dist/types-B4tvWlDb.d.cts +6 -0
- package/dist/types-BmBABPZb.d.mts +6 -0
- package/dist/use-event-4J5QFFqK.mjs +19 -0
- package/dist/use-event-CLH8zHoJ.cjs +25 -0
- package/dist/use-fieldset-context-CCQLmNLL.cjs +23 -0
- package/dist/use-fieldset-context-LwveT1OS.mjs +12 -0
- package/dist/use-safe-layout-effect-C2GgvNT3.cjs +13 -0
- package/dist/use-safe-layout-effect-CLjnuJFb.mjs +7 -0
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +232 -2
- package/dist/factory-BZBSaT-0.d.cts +0 -29
- package/dist/factory-DaVMAttY.d.mts +0 -41
- /package/dist/{chunk-CYMnug_4.mjs → chunk-BXPHTOwk.mjs} +0 -0
- /package/dist/{create-context-DGYD_HQt.mjs → create-context-CCXzjEv8.mjs} +0 -0
- /package/dist/{create-split-props-BFscidWy.mjs → create-split-props-CBL0m-GX.mjs} +0 -0
- /package/dist/{create-split-props-CSaOnJRj.cjs → create-split-props-Dp4TWOyM.cjs} +0 -0
- /package/dist/{index-OOf7QNG5.d.mts → index-CureNJdc.d.mts} +0 -0
- /package/dist/{index-DiYk6N_L.d.cts → index-dbTyAXLy.d.cts} +0 -0
- /package/dist/{render-strategy--1FNKx5x.d.mts → render-strategy-C8IyLw0O.d.mts} +0 -0
- /package/dist/{render-strategy-RT-KvAqO.d.cts → render-strategy-rA4C5NUX.d.cts} +0 -0
- /package/dist/{utils-Cb5K29pi.cjs → utils-B_Ojepvp.cjs} +0 -0
- /package/dist/{utils-nfWHwVIS.mjs → utils-C-m3mZWI.mjs} +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-BXPHTOwk.mjs";
|
|
2
|
+
import { t as mergeProps } from "./core-Ba4IEjhK.mjs";
|
|
3
|
+
import { n as useEnvironmentContext } from "./environment-Ded7DkGr.mjs";
|
|
4
|
+
import { t as composeRefs } from "./compose-refs-BEptPEkE.mjs";
|
|
5
|
+
import { n as sprawlify } from "./factory-Bi8oEg8i.mjs";
|
|
6
|
+
import { t as createSplitProps } from "./create-split-props-CBL0m-GX.mjs";
|
|
7
|
+
import { n as useFieldsetContext, t as FieldsetProvider } from "./use-fieldset-context-LwveT1OS.mjs";
|
|
8
|
+
import { t as useSafeLayoutEffect } from "./use-safe-layout-effect-CLjnuJFb.mjs";
|
|
9
|
+
import { forwardRef, useId, useRef, useState } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
import { dataAttr } from "@sprawlify/primitives/dom-query";
|
|
12
|
+
import { createAnatomy } from "@sprawlify/primitives/anatomy";
|
|
13
|
+
|
|
14
|
+
//#region src/components/fieldset/fieldset-context.tsx
|
|
15
|
+
const FieldsetContext = (props) => props.children(useFieldsetContext());
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/components/fieldset/fieldset-error-text.tsx
|
|
19
|
+
const FieldsetErrorText = forwardRef((props, ref) => {
|
|
20
|
+
const fieldset = useFieldsetContext();
|
|
21
|
+
const mergedProps = mergeProps(fieldset.getErrorTextProps(), props);
|
|
22
|
+
return fieldset.invalid ? /* @__PURE__ */ jsx(sprawlify.span, {
|
|
23
|
+
...mergedProps,
|
|
24
|
+
ref
|
|
25
|
+
}) : null;
|
|
26
|
+
});
|
|
27
|
+
FieldsetErrorText.displayName = "FieldsetErrorText";
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/fieldset/fieldset-helper-text.tsx
|
|
31
|
+
const FieldsetHelperText = forwardRef((props, ref) => {
|
|
32
|
+
const mergedProps = mergeProps(useFieldsetContext().getHelperTextProps(), props);
|
|
33
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
34
|
+
...mergedProps,
|
|
35
|
+
ref
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
FieldsetHelperText.displayName = "FieldsetHelperText";
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/fieldset/fieldset-legend.tsx
|
|
42
|
+
const FieldsetLegend = forwardRef((props, ref) => {
|
|
43
|
+
const mergedProps = mergeProps(useFieldsetContext().getLegendProps(), props);
|
|
44
|
+
return /* @__PURE__ */ jsx(sprawlify.legend, {
|
|
45
|
+
...mergedProps,
|
|
46
|
+
ref
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
FieldsetLegend.displayName = "FieldsetLegend";
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/fieldset/fieldset-anatomy.ts
|
|
53
|
+
const fieldsetAnatomy = createAnatomy("fieldset").parts("root", "errorText", "helperText", "legend");
|
|
54
|
+
const parts = fieldsetAnatomy.build();
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/fieldset/use-fieldset.ts
|
|
58
|
+
const useFieldset = (props = {}) => {
|
|
59
|
+
const { disabled = false, invalid = false } = props;
|
|
60
|
+
const env = useEnvironmentContext();
|
|
61
|
+
const [textElements, setTextElements] = useState({
|
|
62
|
+
hasErrorText: false,
|
|
63
|
+
hasHelperText: false
|
|
64
|
+
});
|
|
65
|
+
const uid = useId();
|
|
66
|
+
const id = props.id ?? uid;
|
|
67
|
+
const rootRef = useRef(null);
|
|
68
|
+
const legendId = `fieldset::${id}::legend`;
|
|
69
|
+
const errorTextId = `fieldset::${id}::error-text`;
|
|
70
|
+
const helperTextId = `fieldset::${id}::helper-text`;
|
|
71
|
+
useSafeLayoutEffect(() => {
|
|
72
|
+
const rootNode = rootRef.current;
|
|
73
|
+
if (!rootNode) return;
|
|
74
|
+
const checkTextElements = () => {
|
|
75
|
+
const docOrShadowRoot = env.getRootNode();
|
|
76
|
+
setTextElements({
|
|
77
|
+
hasErrorText: !!docOrShadowRoot.getElementById(errorTextId),
|
|
78
|
+
hasHelperText: !!docOrShadowRoot.getElementById(helperTextId)
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
checkTextElements();
|
|
82
|
+
const observer = new (env.getWindow()).MutationObserver(checkTextElements);
|
|
83
|
+
observer.observe(rootNode, {
|
|
84
|
+
childList: true,
|
|
85
|
+
subtree: true
|
|
86
|
+
});
|
|
87
|
+
return () => observer.disconnect();
|
|
88
|
+
}, [
|
|
89
|
+
env,
|
|
90
|
+
errorTextId,
|
|
91
|
+
helperTextId
|
|
92
|
+
]);
|
|
93
|
+
const ids = [];
|
|
94
|
+
if (textElements.hasErrorText && invalid) ids.push(errorTextId);
|
|
95
|
+
if (textElements.hasHelperText) ids.push(helperTextId);
|
|
96
|
+
const labelIds = ids.length > 0 ? ids.join(" ") : void 0;
|
|
97
|
+
const getRootProps = () => ({
|
|
98
|
+
...parts.root.attrs,
|
|
99
|
+
ref: rootRef,
|
|
100
|
+
disabled,
|
|
101
|
+
"data-disabled": dataAttr(disabled),
|
|
102
|
+
"data-invalid": dataAttr(invalid),
|
|
103
|
+
"aria-labelledby": legendId,
|
|
104
|
+
"aria-describedby": labelIds
|
|
105
|
+
});
|
|
106
|
+
const getLegendProps = () => ({
|
|
107
|
+
id: legendId,
|
|
108
|
+
...parts.legend.attrs,
|
|
109
|
+
"data-disabled": dataAttr(disabled),
|
|
110
|
+
"data-invalid": dataAttr(invalid)
|
|
111
|
+
});
|
|
112
|
+
const getHelperTextProps = () => ({
|
|
113
|
+
id: helperTextId,
|
|
114
|
+
...parts.helperText.attrs
|
|
115
|
+
});
|
|
116
|
+
const getErrorTextProps = () => ({
|
|
117
|
+
id: errorTextId,
|
|
118
|
+
...parts.errorText.attrs,
|
|
119
|
+
"aria-live": "polite"
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
refs: { rootRef },
|
|
123
|
+
ids: {
|
|
124
|
+
legend: legendId,
|
|
125
|
+
errorText: errorTextId,
|
|
126
|
+
helperText: helperTextId
|
|
127
|
+
},
|
|
128
|
+
disabled,
|
|
129
|
+
invalid,
|
|
130
|
+
getRootProps,
|
|
131
|
+
getLegendProps,
|
|
132
|
+
getHelperTextProps,
|
|
133
|
+
getErrorTextProps
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/components/fieldset/fieldset-root.tsx
|
|
139
|
+
const splitRootProps = createSplitProps();
|
|
140
|
+
const FieldsetRoot = forwardRef((props, ref) => {
|
|
141
|
+
const [useFieldsetProps, localProps] = splitRootProps(props, [
|
|
142
|
+
"id",
|
|
143
|
+
"disabled",
|
|
144
|
+
"invalid"
|
|
145
|
+
]);
|
|
146
|
+
const fieldset = useFieldset(useFieldsetProps);
|
|
147
|
+
const mergedProps = mergeProps(fieldset.getRootProps(), localProps);
|
|
148
|
+
return /* @__PURE__ */ jsx(FieldsetProvider, {
|
|
149
|
+
value: fieldset,
|
|
150
|
+
children: /* @__PURE__ */ jsx(sprawlify.fieldset, {
|
|
151
|
+
...mergedProps,
|
|
152
|
+
ref: composeRefs(ref, fieldset.refs.rootRef)
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
FieldsetRoot.displayName = "FieldsetRoot";
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/components/fieldset/fieldset-root-provider.tsx
|
|
160
|
+
const splitRootProviderProps = createSplitProps();
|
|
161
|
+
const FieldsetRootProvider = forwardRef((props, ref) => {
|
|
162
|
+
const [{ value: fieldset }, localProps] = splitRootProviderProps(props, ["value"]);
|
|
163
|
+
const mergedProps = mergeProps(fieldset.getRootProps(), localProps);
|
|
164
|
+
return /* @__PURE__ */ jsx(FieldsetProvider, {
|
|
165
|
+
value: fieldset,
|
|
166
|
+
children: /* @__PURE__ */ jsx(sprawlify.fieldset, {
|
|
167
|
+
...mergedProps,
|
|
168
|
+
ref
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
FieldsetRootProvider.displayName = "FieldsetRootProvider";
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/components/fieldset/fieldset.ts
|
|
176
|
+
var fieldset_exports = /* @__PURE__ */ __export({
|
|
177
|
+
Context: () => FieldsetContext,
|
|
178
|
+
ErrorText: () => FieldsetErrorText,
|
|
179
|
+
HelperText: () => FieldsetHelperText,
|
|
180
|
+
Legend: () => FieldsetLegend,
|
|
181
|
+
Root: () => FieldsetRoot,
|
|
182
|
+
RootProvider: () => FieldsetRootProvider
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
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 };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
|
|
2
|
+
import { CSSProperties, HTMLAttributes, JSX, PropsWithChildren, RefObject } from "react";
|
|
3
|
+
import * as _sprawlify_primitives_types0 from "@sprawlify/primitives/types";
|
|
4
|
+
|
|
5
|
+
//#region src/core/machine.d.ts
|
|
6
|
+
declare function useMachine<T extends MachineSchema>(machine: Machine<T>, userProps?: Partial<T["props"]>): Service<T>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/core/normalize-props.d.ts
|
|
9
|
+
type WithoutRef<T> = Omit<T, "ref">;
|
|
10
|
+
type ElementsWithoutRef = { [K in keyof JSX.IntrinsicElements]: WithoutRef<JSX.IntrinsicElements[K]> };
|
|
11
|
+
type PropTypes$1 = ElementsWithoutRef & {
|
|
12
|
+
element: WithoutRef<HTMLAttributes<HTMLElement>>;
|
|
13
|
+
style: CSSProperties;
|
|
14
|
+
};
|
|
15
|
+
declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes$1>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/core/portal.d.ts
|
|
18
|
+
interface PortalProps {
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
container?: RefObject<HTMLElement> | undefined;
|
|
21
|
+
getRootNode?: (() => ShadowRoot | Document | Node) | undefined;
|
|
22
|
+
}
|
|
23
|
+
declare const Portal: (props: PropsWithChildren<PortalProps>) => JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useMachine as a, normalizeProps as i, PortalProps as n, PropTypes$1 as r, Portal as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { r as Optional } from "./types-B4tvWlDb.cjs";
|
|
2
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory-C4cfTHs7.cjs";
|
|
3
|
+
import { t as RenderStrategyProps } from "./render-strategy-rA4C5NUX.cjs";
|
|
4
|
+
import * as react94 from "react";
|
|
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
|
+
skipAnimationOnMount?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
type UsePresenceReturn = ReturnType<typeof usePresence>;
|
|
12
|
+
declare const usePresence: (props?: UsePresenceProps) => {
|
|
13
|
+
ref: (node: HTMLElement | null) => void;
|
|
14
|
+
getPresenceProps: () => {
|
|
15
|
+
"data-state": string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
};
|
|
18
|
+
present: boolean;
|
|
19
|
+
unmounted: boolean | undefined;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/presence/presence.d.ts
|
|
23
|
+
interface PresenceBaseProps extends UsePresenceProps, PolymorphicProps {}
|
|
24
|
+
interface PresenceProps extends HTMLProps<"div">, PresenceBaseProps {}
|
|
25
|
+
declare const Presence: react94.ForwardRefExoticComponent<PresenceProps & react94.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/presence/split-presence-props.d.ts
|
|
28
|
+
declare const splitPresenceProps: <T extends UsePresenceProps>(props: T) => [UsePresenceProps, Omit<T, "present" | "onExitComplete" | "immediate" | "lazyMount" | "unmountOnExit" | "skipAnimationOnMount">];
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/presence/use-presence-context.d.ts
|
|
31
|
+
interface UsePresenceContext extends UsePresenceReturn {}
|
|
32
|
+
declare const PresenceProvider: react94.Provider<UsePresenceContext>, usePresenceContext: () => UsePresenceContext;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Presence as a, UsePresenceProps as c, splitPresenceProps as i, UsePresenceReturn as l, UsePresenceContext as n, PresenceBaseProps as o, usePresenceContext as r, PresenceProps as s, PresenceProvider as t, usePresence as u };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
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";
|
|
2
|
+
import * as asyncList from "@sprawlify/primitives/machines/async-list";
|
|
3
|
+
|
|
4
|
+
//#region src/components/collection/grid-collection.d.ts
|
|
5
|
+
declare const createGridCollection: <T extends CollectionItem$1>(options: GridCollectionOptions<T>) => GridCollection$1<T>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/components/collection/list-collection.d.ts
|
|
8
|
+
declare const createListCollection: <T extends CollectionItem>(options: CollectionOptions<T>) => ListCollection$1<T>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/collection/tree-collection.d.ts
|
|
11
|
+
declare const createTreeCollection: <T extends TreeNode>(options: TreeCollectionOptions<T>) => TreeCollection<T>;
|
|
12
|
+
declare const createFileTreeCollection: (paths: string[]) => TreeCollection<FilePathTreeNode>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/collection/use-async-list.d.ts
|
|
15
|
+
interface UseAsyncListProps<T, C = string> extends asyncList.Props<T, C> {}
|
|
16
|
+
interface UseAsyncListReturn<T, C = string> extends asyncList.Api<T, C> {}
|
|
17
|
+
declare function useAsyncList<T, C = string>(props: UseAsyncListProps<T, C>): UseAsyncListReturn<T, C>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/collection/use-list-collection.d.ts
|
|
20
|
+
interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, "items"> {
|
|
21
|
+
initialItems: T[] | readonly T[];
|
|
22
|
+
filter?: (itemText: string, filterText: string, item: T) => boolean;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
declare function useListCollection<T>(props: UseListCollectionProps<T>): UseListCollectionReturn<T>;
|
|
26
|
+
interface UseListCollectionReturn<T> {
|
|
27
|
+
collection: ListCollection$1<T>;
|
|
28
|
+
filter: (inputValue: string) => void;
|
|
29
|
+
set: (items: T[]) => void;
|
|
30
|
+
reset: () => void;
|
|
31
|
+
clear: () => void;
|
|
32
|
+
insert: (index: number, ...items: T[]) => void;
|
|
33
|
+
insertBefore: (value: string, ...items: T[]) => void;
|
|
34
|
+
insertAfter: (value: string, ...items: T[]) => void;
|
|
35
|
+
remove: (...itemOrValues: Array<T | string>) => void;
|
|
36
|
+
move: (value: string, to: number) => void;
|
|
37
|
+
moveBefore: (value: string, ...values: string[]) => void;
|
|
38
|
+
moveAfter: (value: string, ...values: string[]) => void;
|
|
39
|
+
reorder: (from: number, to: number) => void;
|
|
40
|
+
append: (...items: T[]) => void;
|
|
41
|
+
upsert: (value: string, item: T, mode?: "append" | "prepend") => void;
|
|
42
|
+
prepend: (...items: T[]) => void;
|
|
43
|
+
update: (value: string, item: T) => void;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/collection/use-list-selection.d.ts
|
|
47
|
+
interface UseListSelectionProps<T extends CollectionItem> {
|
|
48
|
+
selectionMode?: SelectionMode;
|
|
49
|
+
deselectable?: boolean;
|
|
50
|
+
initialSelectedValues?: string[];
|
|
51
|
+
resetOnCollectionChange?: boolean;
|
|
52
|
+
collection: ListCollection$1<T>;
|
|
53
|
+
}
|
|
54
|
+
declare function useListSelection<T extends CollectionItem>(props: UseListSelectionProps<T>): UseListSelectionReturn;
|
|
55
|
+
interface UseListSelectionReturn {
|
|
56
|
+
selectedValues: string[];
|
|
57
|
+
isEmpty: boolean;
|
|
58
|
+
firstSelectedValue: string | null;
|
|
59
|
+
lastSelectedValue: string | null;
|
|
60
|
+
isSelected: (value: string | null) => boolean;
|
|
61
|
+
canSelect: (value: string) => boolean;
|
|
62
|
+
select: (value: string, forceToggle?: boolean) => void;
|
|
63
|
+
deselect: (value: string) => void;
|
|
64
|
+
toggle: (value: string) => void;
|
|
65
|
+
replace: (value: string | null) => void;
|
|
66
|
+
extend: (anchorValue: string, targetValue: string) => void;
|
|
67
|
+
setSelectedValues: (values: string[]) => void;
|
|
68
|
+
clear: () => void;
|
|
69
|
+
resetSelection: () => void;
|
|
70
|
+
isAllSelected: () => boolean;
|
|
71
|
+
isSomeSelected: () => boolean;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
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,34 @@
|
|
|
1
|
+
import { r as Optional } from "./types-BmBABPZb.mjs";
|
|
2
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory-C-EBNsCW.mjs";
|
|
3
|
+
import { t as RenderStrategyProps } from "./render-strategy-C8IyLw0O.mjs";
|
|
4
|
+
import * as react83 from "react";
|
|
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
|
+
skipAnimationOnMount?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
type UsePresenceReturn = ReturnType<typeof usePresence>;
|
|
12
|
+
declare const usePresence: (props?: UsePresenceProps) => {
|
|
13
|
+
ref: (node: HTMLElement | null) => void;
|
|
14
|
+
getPresenceProps: () => {
|
|
15
|
+
"data-state": string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
};
|
|
18
|
+
present: boolean;
|
|
19
|
+
unmounted: boolean | undefined;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/presence/presence.d.ts
|
|
23
|
+
interface PresenceBaseProps extends UsePresenceProps, PolymorphicProps {}
|
|
24
|
+
interface PresenceProps extends HTMLProps<"div">, PresenceBaseProps {}
|
|
25
|
+
declare const Presence: react83.ForwardRefExoticComponent<PresenceProps & react83.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/presence/split-presence-props.d.ts
|
|
28
|
+
declare const splitPresenceProps: <T extends UsePresenceProps>(props: T) => [UsePresenceProps, Omit<T, "present" | "onExitComplete" | "immediate" | "lazyMount" | "unmountOnExit" | "skipAnimationOnMount">];
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/presence/use-presence-context.d.ts
|
|
31
|
+
interface UsePresenceContext extends UsePresenceReturn {}
|
|
32
|
+
declare const PresenceProvider: react83.Provider<UsePresenceContext>, usePresenceContext: () => UsePresenceContext;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Presence as a, UsePresenceProps as c, splitPresenceProps as i, UsePresenceReturn as l, UsePresenceContext as n, PresenceBaseProps as o, usePresenceContext as r, PresenceProps as s, PresenceProvider as t, usePresence as u };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CollectionItem, CollectionItem as CollectionItem$1, CollectionOptions, FilePathTreeNode, FilePathTreeNode as FilePathTreeNode$1, FlatTreeNode, GridCollection, GridCollectionOptions, ListCollection, SelectionMode, TreeCollection, TreeCollection as TreeCollection$1, TreeCollectionOptions, TreeCollectionOptions as TreeCollectionOptions$1, TreeNode, TreeNode as TreeNode$1 } from "@sprawlify/primitives/collection";
|
|
2
|
+
import * as asyncList from "@sprawlify/primitives/machines/async-list";
|
|
3
|
+
|
|
4
|
+
//#region src/components/collection/grid-collection.d.ts
|
|
5
|
+
declare const createGridCollection: <T extends CollectionItem$1>(options: GridCollectionOptions<T>) => GridCollection<T>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/components/collection/list-collection.d.ts
|
|
8
|
+
declare const createListCollection: <T extends CollectionItem>(options: CollectionOptions<T>) => ListCollection<T>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/collection/tree-collection.d.ts
|
|
11
|
+
declare const createTreeCollection: <T extends TreeNode>(options: TreeCollectionOptions<T>) => TreeCollection<T>;
|
|
12
|
+
declare const createFileTreeCollection: (paths: string[]) => TreeCollection<FilePathTreeNode>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/collection/use-async-list.d.ts
|
|
15
|
+
interface UseAsyncListProps<T, C = string> extends asyncList.Props<T, C> {}
|
|
16
|
+
interface UseAsyncListReturn<T, C = string> extends asyncList.Api<T, C> {}
|
|
17
|
+
declare function useAsyncList<T, C = string>(props: UseAsyncListProps<T, C>): UseAsyncListReturn<T, C>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/collection/use-list-collection.d.ts
|
|
20
|
+
interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, "items"> {
|
|
21
|
+
initialItems: T[] | readonly T[];
|
|
22
|
+
filter?: (itemText: string, filterText: string, item: T) => boolean;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
declare function useListCollection<T>(props: UseListCollectionProps<T>): UseListCollectionReturn<T>;
|
|
26
|
+
interface UseListCollectionReturn<T> {
|
|
27
|
+
collection: ListCollection<T>;
|
|
28
|
+
filter: (inputValue: string) => void;
|
|
29
|
+
set: (items: T[]) => void;
|
|
30
|
+
reset: () => void;
|
|
31
|
+
clear: () => void;
|
|
32
|
+
insert: (index: number, ...items: T[]) => void;
|
|
33
|
+
insertBefore: (value: string, ...items: T[]) => void;
|
|
34
|
+
insertAfter: (value: string, ...items: T[]) => void;
|
|
35
|
+
remove: (...itemOrValues: Array<T | string>) => void;
|
|
36
|
+
move: (value: string, to: number) => void;
|
|
37
|
+
moveBefore: (value: string, ...values: string[]) => void;
|
|
38
|
+
moveAfter: (value: string, ...values: string[]) => void;
|
|
39
|
+
reorder: (from: number, to: number) => void;
|
|
40
|
+
append: (...items: T[]) => void;
|
|
41
|
+
upsert: (value: string, item: T, mode?: "append" | "prepend") => void;
|
|
42
|
+
prepend: (...items: T[]) => void;
|
|
43
|
+
update: (value: string, item: T) => void;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/collection/use-list-selection.d.ts
|
|
47
|
+
interface UseListSelectionProps<T extends CollectionItem> {
|
|
48
|
+
selectionMode?: SelectionMode;
|
|
49
|
+
deselectable?: boolean;
|
|
50
|
+
initialSelectedValues?: string[];
|
|
51
|
+
resetOnCollectionChange?: boolean;
|
|
52
|
+
collection: ListCollection<T>;
|
|
53
|
+
}
|
|
54
|
+
declare function useListSelection<T extends CollectionItem>(props: UseListSelectionProps<T>): UseListSelectionReturn;
|
|
55
|
+
interface UseListSelectionReturn {
|
|
56
|
+
selectedValues: string[];
|
|
57
|
+
isEmpty: boolean;
|
|
58
|
+
firstSelectedValue: string | null;
|
|
59
|
+
lastSelectedValue: string | null;
|
|
60
|
+
isSelected: (value: string | null) => boolean;
|
|
61
|
+
canSelect: (value: string) => boolean;
|
|
62
|
+
select: (value: string, forceToggle?: boolean) => void;
|
|
63
|
+
deselect: (value: string) => void;
|
|
64
|
+
toggle: (value: string) => void;
|
|
65
|
+
replace: (value: string | null) => void;
|
|
66
|
+
extend: (anchorValue: string, targetValue: string) => void;
|
|
67
|
+
setSelectedValues: (values: string[]) => void;
|
|
68
|
+
clear: () => void;
|
|
69
|
+
resetSelection: () => void;
|
|
70
|
+
isAllSelected: () => boolean;
|
|
71
|
+
isSomeSelected: () => boolean;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
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 as x, ListCollection as y };
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
require('./
|
|
1
|
+
const require_chunk = require('./chunk-BYnRvbsk.cjs');
|
|
2
|
+
const require_core = require('./core-DCWyxy9D.cjs');
|
|
3
|
+
const require_create_context = require('./create-context-CQ4U0lLj.cjs');
|
|
4
|
+
require('./utils-B_Ojepvp.cjs');
|
|
5
|
+
const require_environment = require('./environment-CvilmfQt.cjs');
|
|
6
|
+
const require_locale = require('./locale-BcnWD1Hf.cjs');
|
|
7
|
+
require('./providers-BNAArubQ.cjs');
|
|
8
|
+
const require_factory = require('./factory-C166evrS.cjs');
|
|
4
9
|
let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
|
|
5
10
|
|
|
6
|
-
exports.EnvironmentProvider =
|
|
7
|
-
exports.LocaleProvider =
|
|
8
|
-
exports.Portal =
|
|
11
|
+
exports.EnvironmentProvider = require_environment.EnvironmentProvider;
|
|
12
|
+
exports.LocaleProvider = require_locale.LocaleProvider;
|
|
13
|
+
exports.Portal = require_core.Portal;
|
|
9
14
|
exports.createContext = require_create_context.createContext;
|
|
10
15
|
exports.jsxFactory = require_factory.jsxFactory;
|
|
11
|
-
exports.normalizeProps =
|
|
16
|
+
exports.normalizeProps = require_core.normalizeProps;
|
|
12
17
|
exports.sprawlify = require_factory.sprawlify;
|
|
13
|
-
exports.useCollator =
|
|
14
|
-
exports.useEnvironmentContext =
|
|
15
|
-
exports.useFilter =
|
|
16
|
-
exports.useLocaleContext =
|
|
17
|
-
exports.useMachine =
|
|
18
|
+
exports.useCollator = require_locale.useCollator;
|
|
19
|
+
exports.useEnvironmentContext = require_environment.useEnvironmentContext;
|
|
20
|
+
exports.useFilter = require_locale.useFilter;
|
|
21
|
+
exports.useLocaleContext = require_locale.useLocaleContext;
|
|
22
|
+
exports.useMachine = require_core.useMachine;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as normalizeProps, t as PropTypes } from "./normalize-props-skGwa8Dk.cjs";
|
|
2
|
+
import { r as Optional, t as Assign } from "./types-B4tvWlDb.cjs";
|
|
3
|
+
import { a as sprawlify, i as jsxFactory, n as HTMLSprawlifyProps, r as PolymorphicProps, t as HTMLProps } from "./factory-C4cfTHs7.cjs";
|
|
4
|
+
import { n as createContext } from "./index-dbTyAXLy.cjs";
|
|
3
5
|
import { JSX, PropsWithChildren, ReactNode, RefObject } from "react";
|
|
4
6
|
import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
|
|
5
|
-
import * as
|
|
7
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
6
8
|
import { FilterOptions, FilterReturn, Locale } from "@sprawlify/primitives/i18n-utils";
|
|
7
9
|
|
|
8
10
|
//#region src/core/machine.d.ts
|
|
@@ -29,13 +31,13 @@ interface EnvironmentProviderProps {
|
|
|
29
31
|
children?: ReactNode | undefined;
|
|
30
32
|
value?: RootNode | (() => RootNode) | undefined;
|
|
31
33
|
}
|
|
32
|
-
declare const EnvironmentProvider: (props: EnvironmentProviderProps) =>
|
|
34
|
+
declare const EnvironmentProvider: (props: EnvironmentProviderProps) => react_jsx_runtime10.JSX.Element;
|
|
33
35
|
//#endregion
|
|
34
36
|
//#region src/providers/locale/locale-provider.d.ts
|
|
35
37
|
interface LocaleProviderProps extends PropsWithChildren {
|
|
36
38
|
locale: string;
|
|
37
39
|
}
|
|
38
|
-
declare const LocaleProvider: (props: LocaleProviderProps) =>
|
|
40
|
+
declare const LocaleProvider: (props: LocaleProviderProps) => react_jsx_runtime10.JSX.Element;
|
|
39
41
|
//#endregion
|
|
40
42
|
//#region src/providers/locale/use-collator.d.ts
|
|
41
43
|
interface UseCollatorProps extends Intl.CollatorOptions {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
1
|
+
import { a as useMachine, i as normalizeProps, n as PortalProps, r as PropTypes, t as Portal } from "./index-BJvW7OpY.mjs";
|
|
2
|
+
import { r as Optional, t as Assign } from "./types-BmBABPZb.mjs";
|
|
3
|
+
import { a as sprawlify, i as jsxFactory, n as HTMLSprawlifyProps, r as PolymorphicProps, t as HTMLProps } from "./factory-C-EBNsCW.mjs";
|
|
4
|
+
import { n as createContext } from "./index-CureNJdc.mjs";
|
|
3
5
|
import { PropsWithChildren, ReactNode } from "react";
|
|
4
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
5
7
|
import { FilterOptions, FilterReturn, Locale } from "@sprawlify/primitives/i18n-utils";
|
|
6
8
|
|
|
7
9
|
//#region src/providers/environment/use-environment-context.d.ts
|
|
@@ -17,13 +19,13 @@ interface EnvironmentProviderProps {
|
|
|
17
19
|
children?: ReactNode | undefined;
|
|
18
20
|
value?: RootNode | (() => RootNode) | undefined;
|
|
19
21
|
}
|
|
20
|
-
declare const EnvironmentProvider: (props: EnvironmentProviderProps) =>
|
|
22
|
+
declare const EnvironmentProvider: (props: EnvironmentProviderProps) => react_jsx_runtime11.JSX.Element;
|
|
21
23
|
//#endregion
|
|
22
24
|
//#region src/providers/locale/locale-provider.d.ts
|
|
23
25
|
interface LocaleProviderProps extends PropsWithChildren {
|
|
24
26
|
locale: string;
|
|
25
27
|
}
|
|
26
|
-
declare const LocaleProvider: (props: LocaleProviderProps) =>
|
|
28
|
+
declare const LocaleProvider: (props: LocaleProviderProps) => react_jsx_runtime11.JSX.Element;
|
|
27
29
|
//#endregion
|
|
28
30
|
//#region src/providers/locale/use-collator.d.ts
|
|
29
31
|
interface UseCollatorProps extends Intl.CollatorOptions {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createContext } from "./create-context-
|
|
3
|
-
import "./utils-
|
|
1
|
+
import { i as useMachine, n as Portal, r as normalizeProps, t as mergeProps } from "./core-Ba4IEjhK.mjs";
|
|
2
|
+
import { t as createContext } from "./create-context-CCXzjEv8.mjs";
|
|
3
|
+
import "./utils-C-m3mZWI.mjs";
|
|
4
|
+
import { n as useEnvironmentContext, t as EnvironmentProvider } from "./environment-Ded7DkGr.mjs";
|
|
5
|
+
import { i as useLocaleContext, n as useCollator, r as LocaleProvider, t as useFilter } from "./locale-Coin-d7R.mjs";
|
|
6
|
+
import "./providers-Dm2P3F2_.mjs";
|
|
7
|
+
import { n as sprawlify, t as jsxFactory } from "./factory-Bi8oEg8i.mjs";
|
|
4
8
|
|
|
5
9
|
export { EnvironmentProvider, LocaleProvider, Portal, createContext, jsxFactory, normalizeProps, sprawlify, useCollator, useEnvironmentContext, useFilter, useLocaleContext, useMachine };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BYnRvbsk.cjs');
|
|
2
|
+
const require_create_context = require('./create-context-CQ4U0lLj.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let __sprawlify_primitives_i18n_utils = require("@sprawlify/primitives/i18n-utils");
|
|
6
|
+
|
|
7
|
+
//#region src/providers/locale/use-locale-context.ts
|
|
8
|
+
const [LocaleContextProvider, useLocaleContext] = require_create_context.createContext({
|
|
9
|
+
name: "LocaleContext",
|
|
10
|
+
hookName: "useLocaleContext",
|
|
11
|
+
providerName: "<LocaleProvider />",
|
|
12
|
+
strict: false,
|
|
13
|
+
defaultValue: {
|
|
14
|
+
dir: "ltr",
|
|
15
|
+
locale: "en-US"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/providers/locale/locale-provider.tsx
|
|
21
|
+
const LocaleProvider = (props) => {
|
|
22
|
+
const { children, locale } = props;
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleContextProvider, {
|
|
24
|
+
value: {
|
|
25
|
+
locale,
|
|
26
|
+
dir: (0, __sprawlify_primitives_i18n_utils.isRTL)(locale) ? "rtl" : "ltr"
|
|
27
|
+
},
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/providers/locale/use-collator.ts
|
|
34
|
+
function useCollator(props = {}) {
|
|
35
|
+
const env = useLocaleContext();
|
|
36
|
+
const locale = props.locale ?? env.locale;
|
|
37
|
+
return (0, react.useMemo)(() => {
|
|
38
|
+
const { locale: _, ...options } = props;
|
|
39
|
+
return (0, __sprawlify_primitives_i18n_utils.createCollator)(locale, options);
|
|
40
|
+
}, [locale, props]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/providers/locale/use-filter.ts
|
|
45
|
+
function useFilter(props) {
|
|
46
|
+
const env = useLocaleContext();
|
|
47
|
+
const locale = props.locale ?? env.locale;
|
|
48
|
+
return (0, react.useMemo)(() => (0, __sprawlify_primitives_i18n_utils.createFilter)({
|
|
49
|
+
...props,
|
|
50
|
+
locale
|
|
51
|
+
}), [locale, props]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
Object.defineProperty(exports, 'LocaleProvider', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return LocaleProvider;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, 'useCollator', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return useCollator;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, 'useFilter', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return useFilter;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'useLocaleContext', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return useLocaleContext;
|
|
77
|
+
}
|
|
78
|
+
});
|