@sprawlify/react 0.0.6 → 0.0.7
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-DYgHs1_i.mjs → collapsible-B06GGGE7.mjs} +7 -4
- package/dist/{collapsible-D_cXuaRy.cjs → collapsible-D5kle6Bc.cjs} +12 -9
- package/dist/collection-BKabYqpE.cjs +229 -0
- package/dist/collection-DEsp9z6X.mjs +187 -0
- package/dist/components/accordion/index.cjs +19 -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 +9 -14
- package/dist/components/angle-slider/index.cjs +12 -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 +7 -4
- package/dist/components/avatar/index.cjs +12 -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 +7 -4
- package/dist/components/bottom-sheet/index.cjs +213 -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 +190 -0
- package/dist/components/carousel/index.cjs +263 -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 +242 -0
- package/dist/components/checkbox/index.cjs +308 -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 +289 -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 +185 -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 +6 -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 +6 -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 +613 -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 +570 -0
- package/dist/components/combobox/index.cjs +416 -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 +387 -0
- package/dist/components/field/index.cjs +27 -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 +9 -0
- package/dist/components/fieldset/index.cjs +23 -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 +9 -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 +32 -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 +31 -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 +419 -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 +384 -0
- package/dist/{factory-DN0EdT7u.mjs → core-C0F-4KYH.mjs} +4 -154
- package/dist/{factory-CfqPG186.cjs → core-CPLjF6nm.cjs} +0 -198
- package/dist/{create-context-DCEySQ7J.cjs → create-context-D6DyFRSf.cjs} +1 -1
- package/dist/environment-BXkWNF2O.mjs +46 -0
- package/dist/environment-DLPiALpf.cjs +58 -0
- package/dist/factory-BbbIuDqa.d.mts +15 -0
- package/dist/factory-CDX-oCN5.cjs +81 -0
- package/dist/factory-DQlmCPH2.mjs +63 -0
- package/dist/factory-DaNWFLLN.d.cts +15 -0
- package/dist/field-CGCTFCx2.mjs +322 -0
- package/dist/field-CXhpW6zO.cjs +404 -0
- package/dist/fieldset-CuSSYZxV.cjs +237 -0
- package/dist/fieldset-poJ8RDvB.mjs +184 -0
- package/dist/index-BUN9wyVM.d.mts +34 -0
- package/dist/index-Dhthtdz_.d.mts +74 -0
- package/dist/index-DqRXPiW_.d.cts +34 -0
- package/dist/index-DsZldSch.d.cts +74 -0
- package/dist/index-DtdZfcpz.d.mts +25 -0
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +6 -3
- package/dist/normalize-props-sqcs77GC.d.cts +13 -0
- package/dist/presence-2A4loEJY.mjs +71 -0
- package/dist/presence-BX1tNsGA.cjs +101 -0
- package/dist/providers-Bk3ALTxZ.cjs +78 -0
- package/dist/providers-CyTYcOU1.mjs +54 -0
- package/dist/render-strategy-D3w8btTD.mjs +13 -0
- package/dist/render-strategy-k1JmEGnq.cjs +30 -0
- package/dist/types-DYWV3uAj.d.cts +5 -0
- package/dist/types-FLvjyw__.d.mts +5 -0
- package/dist/use-event-BcyNH29h.mjs +19 -0
- package/dist/use-event-CGMgV6xB.cjs +25 -0
- package/dist/use-safe-layout-effect-BlOhFUAp.mjs +17 -0
- package/dist/use-safe-layout-effect-vuYaDIpT.cjs +35 -0
- package/dist/utils/index.cjs +2 -2
- 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 +142 -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-DLP0tNsH.mjs} +0 -0
- /package/dist/{create-context-DGYD_HQt.mjs → create-context-CdjrBhu7.mjs} +0 -0
- /package/dist/{create-split-props-BFscidWy.mjs → create-split-props-BJQdOyld.mjs} +0 -0
- /package/dist/{create-split-props-CSaOnJRj.cjs → create-split-props-CSkzaUOy.cjs} +0 -0
- /package/dist/{index-OOf7QNG5.d.mts → index-BwTxN5vG.d.mts} +0 -0
- /package/dist/{index-DiYk6N_L.d.cts → index-zOmANnUL.d.cts} +0 -0
- /package/dist/{render-strategy-RT-KvAqO.d.cts → render-strategy-CdpAg9jb.d.cts} +0 -0
- /package/dist/{render-strategy--1FNKx5x.d.mts → render-strategy-GetMScNK.d.mts} +0 -0
- /package/dist/{utils-nfWHwVIS.mjs → utils-DflO0-3U.mjs} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const require_core = require('./core-CPLjF6nm.cjs');
|
|
2
|
+
const require_create_context = require('./create-context-D6DyFRSf.cjs');
|
|
3
|
+
const require_factory = require('./factory-CDX-oCN5.cjs');
|
|
4
|
+
const require_create_split_props = require('./create-split-props-CSkzaUOy.cjs');
|
|
5
|
+
const require_use_event = require('./use-event-CGMgV6xB.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let __sprawlify_primitives_machines_presence = require("@sprawlify/primitives/machines/presence");
|
|
9
|
+
__sprawlify_primitives_machines_presence = require_core.__toESM(__sprawlify_primitives_machines_presence);
|
|
10
|
+
|
|
11
|
+
//#region src/components/presence/split-presence-props.ts
|
|
12
|
+
const splitPresenceProps = (props) => require_create_split_props.createSplitProps()(props, [
|
|
13
|
+
"immediate",
|
|
14
|
+
"lazyMount",
|
|
15
|
+
"onExitComplete",
|
|
16
|
+
"present",
|
|
17
|
+
"skipAnimationOnMount",
|
|
18
|
+
"unmountOnExit"
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/presence/use-presence.ts
|
|
23
|
+
const usePresence = (props = {}) => {
|
|
24
|
+
const { lazyMount, unmountOnExit, present, skipAnimationOnMount = false, ...rest } = props;
|
|
25
|
+
const wasEverPresent = (0, react.useRef)(false);
|
|
26
|
+
const machineProps = {
|
|
27
|
+
...rest,
|
|
28
|
+
present,
|
|
29
|
+
onExitComplete: require_use_event.useEvent(props.onExitComplete)
|
|
30
|
+
};
|
|
31
|
+
const service = require_core.useMachine(__sprawlify_primitives_machines_presence.machine, machineProps);
|
|
32
|
+
const api = __sprawlify_primitives_machines_presence.connect(service, require_core.normalizeProps);
|
|
33
|
+
if (api.present) wasEverPresent.current = true;
|
|
34
|
+
const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
|
|
35
|
+
const getPresenceProps = () => ({
|
|
36
|
+
"data-state": api.skip && skipAnimationOnMount ? void 0 : present ? "open" : "closed",
|
|
37
|
+
hidden: !api.present
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
ref: api.setNode,
|
|
41
|
+
getPresenceProps,
|
|
42
|
+
present: api.present,
|
|
43
|
+
unmounted
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/presence/presence.tsx
|
|
49
|
+
const Presence = (0, react.forwardRef)((props, ref) => {
|
|
50
|
+
const [presenceProps, localProps] = splitPresenceProps(props);
|
|
51
|
+
const presence = usePresence(presenceProps);
|
|
52
|
+
if (presence.unmounted) return null;
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
|
|
54
|
+
...localProps,
|
|
55
|
+
...presence.getPresenceProps(),
|
|
56
|
+
"data-scope": "presence",
|
|
57
|
+
"data-part": "root",
|
|
58
|
+
ref: require_factory.composeRefs(presence.ref, ref)
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
Presence.displayName = "Presence";
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/presence/use-presence-context.ts
|
|
65
|
+
const [PresenceProvider, usePresenceContext] = require_create_context.createContext({
|
|
66
|
+
name: "PresenceContext",
|
|
67
|
+
hookName: "usePresenceContext",
|
|
68
|
+
providerName: "<PresenceProvider />"
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
Object.defineProperty(exports, 'Presence', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return Presence;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, 'PresenceProvider', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return PresenceProvider;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, 'splitPresenceProps', {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return splitPresenceProps;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, 'usePresence', {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return usePresence;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, 'usePresenceContext', {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return usePresenceContext;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const require_core = require('./core-CPLjF6nm.cjs');
|
|
2
|
+
const require_create_context = require('./create-context-D6DyFRSf.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
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { t as createContext$1 } from "./create-context-CdjrBhu7.mjs";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createCollator, createFilter, isRTL } from "@sprawlify/primitives/i18n-utils";
|
|
5
|
+
|
|
6
|
+
//#region src/providers/locale/use-locale-context.ts
|
|
7
|
+
const [LocaleContextProvider, useLocaleContext] = createContext$1({
|
|
8
|
+
name: "LocaleContext",
|
|
9
|
+
hookName: "useLocaleContext",
|
|
10
|
+
providerName: "<LocaleProvider />",
|
|
11
|
+
strict: false,
|
|
12
|
+
defaultValue: {
|
|
13
|
+
dir: "ltr",
|
|
14
|
+
locale: "en-US"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/providers/locale/locale-provider.tsx
|
|
20
|
+
const LocaleProvider = (props) => {
|
|
21
|
+
const { children, locale } = props;
|
|
22
|
+
return /* @__PURE__ */ jsx(LocaleContextProvider, {
|
|
23
|
+
value: {
|
|
24
|
+
locale,
|
|
25
|
+
dir: isRTL(locale) ? "rtl" : "ltr"
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/providers/locale/use-collator.ts
|
|
33
|
+
function useCollator(props = {}) {
|
|
34
|
+
const env = useLocaleContext();
|
|
35
|
+
const locale = props.locale ?? env.locale;
|
|
36
|
+
return useMemo(() => {
|
|
37
|
+
const { locale: _, ...options } = props;
|
|
38
|
+
return createCollator(locale, options);
|
|
39
|
+
}, [locale, props]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/providers/locale/use-filter.ts
|
|
44
|
+
function useFilter(props) {
|
|
45
|
+
const env = useLocaleContext();
|
|
46
|
+
const locale = props.locale ?? env.locale;
|
|
47
|
+
return useMemo(() => createFilter({
|
|
48
|
+
...props,
|
|
49
|
+
locale
|
|
50
|
+
}), [locale, props]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { useLocaleContext as i, useCollator as n, LocaleProvider as r, useFilter as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as createContext } from "./create-context-CdjrBhu7.mjs";
|
|
2
|
+
import { t as createSplitProps } from "./create-split-props-BJQdOyld.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/render-strategy.ts
|
|
5
|
+
const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createContext({
|
|
6
|
+
name: "RenderStrategyContext",
|
|
7
|
+
hookName: "useRenderStrategyContext",
|
|
8
|
+
providerName: "<RenderStrategyPropsProvider />"
|
|
9
|
+
});
|
|
10
|
+
const splitRenderStrategyProps = (props) => createSplitProps()(props, ["lazyMount", "unmountOnExit"]);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { splitRenderStrategyProps as n, useRenderStrategyPropsContext as r, RenderStrategyPropsProvider as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_create_context = require('./create-context-D6DyFRSf.cjs');
|
|
2
|
+
const require_create_split_props = require('./create-split-props-CSkzaUOy.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/utils/render-strategy.ts
|
|
5
|
+
const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = require_create_context.createContext({
|
|
6
|
+
name: "RenderStrategyContext",
|
|
7
|
+
hookName: "useRenderStrategyContext",
|
|
8
|
+
providerName: "<RenderStrategyPropsProvider />"
|
|
9
|
+
});
|
|
10
|
+
const splitRenderStrategyProps = (props) => require_create_split_props.createSplitProps()(props, ["lazyMount", "unmountOnExit"]);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.defineProperty(exports, 'RenderStrategyPropsProvider', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return RenderStrategyPropsProvider;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, 'splitRenderStrategyProps', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return splitRenderStrategyProps;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, 'useRenderStrategyPropsContext', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return useRenderStrategyPropsContext;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/use-event.ts
|
|
4
|
+
function useEvent(callback, opts = {}) {
|
|
5
|
+
const { sync = false } = opts;
|
|
6
|
+
const callbackRef = useLatestRef(callback);
|
|
7
|
+
return useCallback((...args) => {
|
|
8
|
+
if (sync) return queueMicrotask(() => callbackRef.current?.(...args));
|
|
9
|
+
return callbackRef.current?.(...args);
|
|
10
|
+
}, [sync, callbackRef]);
|
|
11
|
+
}
|
|
12
|
+
function useLatestRef(value) {
|
|
13
|
+
const ref = useRef(value);
|
|
14
|
+
ref.current = value;
|
|
15
|
+
return ref;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useEvent as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_core = require('./core-CPLjF6nm.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
|
|
4
|
+
//#region src/utils/use-event.ts
|
|
5
|
+
function useEvent(callback, opts = {}) {
|
|
6
|
+
const { sync = false } = opts;
|
|
7
|
+
const callbackRef = useLatestRef(callback);
|
|
8
|
+
return (0, react.useCallback)((...args) => {
|
|
9
|
+
if (sync) return queueMicrotask(() => callbackRef.current?.(...args));
|
|
10
|
+
return callbackRef.current?.(...args);
|
|
11
|
+
}, [sync, callbackRef]);
|
|
12
|
+
}
|
|
13
|
+
function useLatestRef(value) {
|
|
14
|
+
const ref = (0, react.useRef)(value);
|
|
15
|
+
ref.current = value;
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
Object.defineProperty(exports, 'useEvent', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return useEvent;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as createContext$1 } from "./create-context-CdjrBhu7.mjs";
|
|
2
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/fieldset/use-fieldset-context.ts
|
|
5
|
+
const [FieldsetProvider, useFieldsetContext] = createContext$1({
|
|
6
|
+
name: "FieldsetContext",
|
|
7
|
+
hookName: "useFieldsetContext",
|
|
8
|
+
providerName: "<FieldsetProvider />",
|
|
9
|
+
strict: false
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/utils/use-safe-layout-effect.ts
|
|
14
|
+
const useSafeLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FieldsetProvider as n, useFieldsetContext as r, useSafeLayoutEffect as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const require_core = require('./core-CPLjF6nm.cjs');
|
|
2
|
+
const require_create_context = require('./create-context-D6DyFRSf.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
|
|
5
|
+
//#region src/components/fieldset/use-fieldset-context.ts
|
|
6
|
+
const [FieldsetProvider, useFieldsetContext] = require_create_context.createContext({
|
|
7
|
+
name: "FieldsetContext",
|
|
8
|
+
hookName: "useFieldsetContext",
|
|
9
|
+
providerName: "<FieldsetProvider />",
|
|
10
|
+
strict: false
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/utils/use-safe-layout-effect.ts
|
|
15
|
+
const useSafeLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
Object.defineProperty(exports, 'FieldsetProvider', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return FieldsetProvider;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, 'useFieldsetContext', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return useFieldsetContext;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, 'useSafeLayoutEffect', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return useSafeLayoutEffect;
|
|
34
|
+
}
|
|
35
|
+
});
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_create_context = require('../create-context-
|
|
1
|
+
const require_core = require('../core-CPLjF6nm.cjs');
|
|
2
|
+
const require_create_context = require('../create-context-D6DyFRSf.cjs');
|
|
3
3
|
require('../utils-Cb5K29pi.cjs');
|
|
4
4
|
let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
|
|
5
5
|
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createContext, t as mergeProps } from "../index-
|
|
1
|
+
import { n as createContext, t as mergeProps } from "../index-zOmANnUL.cjs";
|
|
2
2
|
export { createContext, mergeProps };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createContext, t as mergeProps } from "../index-
|
|
1
|
+
import { n as createContext, t as mergeProps } from "../index-BwTxN5vG.mjs";
|
|
2
2
|
export { createContext, mergeProps };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createContext } from "../create-context-
|
|
2
|
-
import { t as mergeProps } from "../utils-
|
|
1
|
+
import { t as createContext } from "../create-context-CdjrBhu7.mjs";
|
|
2
|
+
import { t as mergeProps } from "../utils-DflO0-3U.mjs";
|
|
3
3
|
|
|
4
4
|
export { createContext, mergeProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprawlify/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React wrapper for primitives.",
|
|
6
6
|
"author": "sprawlify <npm@sprawlify.com>",
|
|
@@ -48,6 +48,56 @@
|
|
|
48
48
|
"default": "./dist/components/avatar/index.cjs"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
"./bottom-sheet": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/components/bottom-sheet/index.d.mts",
|
|
54
|
+
"default": "./dist/components/bottom-sheet/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/components/bottom-sheet/index.d.cts",
|
|
58
|
+
"default": "./dist/components/bottom-sheet/index.cjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./carousel": {
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./dist/components/carousel/index.d.mts",
|
|
64
|
+
"default": "./dist/components/carousel/index.mjs"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./dist/components/carousel/index.d.cts",
|
|
68
|
+
"default": "./dist/components/carousel/index.cjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"./checkbox": {
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./dist/components/checkbox/index.d.mts",
|
|
74
|
+
"default": "./dist/components/checkbox/index.mjs"
|
|
75
|
+
},
|
|
76
|
+
"require": {
|
|
77
|
+
"types": "./dist/components/checkbox/index.d.cts",
|
|
78
|
+
"default": "./dist/components/checkbox/index.cjs"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"./client-only": {
|
|
82
|
+
"import": {
|
|
83
|
+
"types": "./dist/components/client-only/index.d.mts",
|
|
84
|
+
"default": "./dist/components/client-only/index.mjs"
|
|
85
|
+
},
|
|
86
|
+
"require": {
|
|
87
|
+
"types": "./dist/components/client-only/index.d.cts",
|
|
88
|
+
"default": "./dist/components/client-only/index.cjs"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"./clipboard": {
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./dist/components/clipboard/index.d.mts",
|
|
94
|
+
"default": "./dist/components/clipboard/index.mjs"
|
|
95
|
+
},
|
|
96
|
+
"require": {
|
|
97
|
+
"types": "./dist/components/clipboard/index.d.cts",
|
|
98
|
+
"default": "./dist/components/clipboard/index.cjs"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
51
101
|
"./collapsible": {
|
|
52
102
|
"import": {
|
|
53
103
|
"types": "./dist/components/collapsible/index.d.mts",
|
|
@@ -57,6 +107,96 @@
|
|
|
57
107
|
"types": "./dist/components/collapsible/index.d.cts",
|
|
58
108
|
"default": "./dist/components/collapsible/index.cjs"
|
|
59
109
|
}
|
|
110
|
+
},
|
|
111
|
+
"./collection": {
|
|
112
|
+
"import": {
|
|
113
|
+
"types": "./dist/components/collection/index.d.mts",
|
|
114
|
+
"default": "./dist/components/collection/index.mjs"
|
|
115
|
+
},
|
|
116
|
+
"require": {
|
|
117
|
+
"types": "./dist/components/collection/index.d.cts",
|
|
118
|
+
"default": "./dist/components/collection/index.cjs"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"./color-picker": {
|
|
122
|
+
"import": {
|
|
123
|
+
"types": "./dist/components/color-picker/index.d.mts",
|
|
124
|
+
"default": "./dist/components/color-picker/index.mjs"
|
|
125
|
+
},
|
|
126
|
+
"require": {
|
|
127
|
+
"types": "./dist/components/color-picker/index.d.cts",
|
|
128
|
+
"default": "./dist/components/color-picker/index.cjs"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"./combobox": {
|
|
132
|
+
"import": {
|
|
133
|
+
"types": "./dist/components/combobox/index.d.mts",
|
|
134
|
+
"default": "./dist/components/combobox/index.mjs"
|
|
135
|
+
},
|
|
136
|
+
"require": {
|
|
137
|
+
"types": "./dist/components/combobox/index.d.cts",
|
|
138
|
+
"default": "./dist/components/combobox/index.cjs"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"./field": {
|
|
142
|
+
"import": {
|
|
143
|
+
"types": "./dist/components/field/index.d.mts",
|
|
144
|
+
"default": "./dist/components/field/index.mjs"
|
|
145
|
+
},
|
|
146
|
+
"require": {
|
|
147
|
+
"types": "./dist/components/field/index.d.cts",
|
|
148
|
+
"default": "./dist/components/field/index.cjs"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"./fieldset": {
|
|
152
|
+
"import": {
|
|
153
|
+
"types": "./dist/components/fieldset/index.d.mts",
|
|
154
|
+
"default": "./dist/components/fieldset/index.mjs"
|
|
155
|
+
},
|
|
156
|
+
"require": {
|
|
157
|
+
"types": "./dist/components/fieldset/index.d.cts",
|
|
158
|
+
"default": "./dist/components/fieldset/index.cjs"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"./highlight": {
|
|
162
|
+
"import": {
|
|
163
|
+
"types": "./dist/components/highlight/index.d.mts",
|
|
164
|
+
"default": "./dist/components/highlight/index.mjs"
|
|
165
|
+
},
|
|
166
|
+
"require": {
|
|
167
|
+
"types": "./dist/components/highlight/index.d.cts",
|
|
168
|
+
"default": "./dist/components/highlight/index.cjs"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"./portal": {
|
|
172
|
+
"import": {
|
|
173
|
+
"types": "./dist/components/portal/index.d.mts",
|
|
174
|
+
"default": "./dist/components/portal/index.mjs"
|
|
175
|
+
},
|
|
176
|
+
"require": {
|
|
177
|
+
"types": "./dist/components/portal/index.d.cts",
|
|
178
|
+
"default": "./dist/components/portal/index.cjs"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"./presence": {
|
|
182
|
+
"import": {
|
|
183
|
+
"types": "./dist/components/presence/index.d.mts",
|
|
184
|
+
"default": "./dist/components/presence/index.mjs"
|
|
185
|
+
},
|
|
186
|
+
"require": {
|
|
187
|
+
"types": "./dist/components/presence/index.d.cts",
|
|
188
|
+
"default": "./dist/components/presence/index.cjs"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"./select": {
|
|
192
|
+
"import": {
|
|
193
|
+
"types": "./dist/components/select/index.d.mts",
|
|
194
|
+
"default": "./dist/components/select/index.mjs"
|
|
195
|
+
},
|
|
196
|
+
"require": {
|
|
197
|
+
"types": "./dist/components/select/index.d.cts",
|
|
198
|
+
"default": "./dist/components/select/index.cjs"
|
|
199
|
+
}
|
|
60
200
|
}
|
|
61
201
|
},
|
|
62
202
|
"files": [
|
|
@@ -66,7 +206,7 @@
|
|
|
66
206
|
"access": "public"
|
|
67
207
|
},
|
|
68
208
|
"dependencies": {
|
|
69
|
-
"@sprawlify/primitives": "0.0.
|
|
209
|
+
"@sprawlify/primitives": "0.0.7"
|
|
70
210
|
},
|
|
71
211
|
"peerDependencies": {
|
|
72
212
|
"react": ">=19.0.0",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ComponentPropsWithoutRef, HTMLAttributes, JSX } from "react";
|
|
2
|
-
import * as _sprawlify_primitives_types0 from "@sprawlify/primitives/types";
|
|
3
|
-
|
|
4
|
-
//#region src/core/normalize-props.d.ts
|
|
5
|
-
type WithoutRef<T> = Omit<T, "ref">;
|
|
6
|
-
type ElementsWithoutRef = { [K in keyof JSX.IntrinsicElements]: WithoutRef<JSX.IntrinsicElements[K]> };
|
|
7
|
-
type PropTypes = ElementsWithoutRef & {
|
|
8
|
-
element: WithoutRef<HTMLAttributes<HTMLElement>>;
|
|
9
|
-
style: CSSProperties;
|
|
10
|
-
};
|
|
11
|
-
declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/types.d.ts
|
|
14
|
-
type Assign<T, U> = Omit<T, keyof U> & U;
|
|
15
|
-
type Optional<T, K$1 extends keyof T> = Pick<Partial<T>, K$1> & Omit<T, K$1>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/components/factory.d.ts
|
|
18
|
-
interface PolymorphicProps {
|
|
19
|
-
asChild?: boolean | undefined;
|
|
20
|
-
}
|
|
21
|
-
type JsxElements = { [E in keyof JSX.IntrinsicElements]: SprawlifyForwardRefComponent<E> };
|
|
22
|
-
type SprawlifyForwardRefComponent<E$1 extends React.ElementType> = React.ForwardRefExoticComponent<SprawlifyPropsWithRef<E$1>>;
|
|
23
|
-
type SprawlifyPropsWithRef<E$1 extends React.ElementType> = React.ComponentPropsWithRef<E$1> & PolymorphicProps;
|
|
24
|
-
type HTMLProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T>;
|
|
25
|
-
type HTMLSprawlifyProps<T extends keyof JSX.IntrinsicElements> = HTMLProps<T> & PolymorphicProps;
|
|
26
|
-
declare const jsxFactory: () => JsxElements;
|
|
27
|
-
declare const sprawlify: JsxElements;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { sprawlify as a, PropTypes as c, jsxFactory as i, normalizeProps as l, HTMLSprawlifyProps as n, Assign as o, PolymorphicProps as r, Optional as s, HTMLProps as t };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
|
|
2
|
-
import React, { CSSProperties, ComponentPropsWithoutRef, 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 = ElementsWithoutRef & {
|
|
12
|
-
element: WithoutRef<HTMLAttributes<HTMLElement>>;
|
|
13
|
-
style: CSSProperties;
|
|
14
|
-
};
|
|
15
|
-
declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
|
|
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
|
-
//#region src/types.d.ts
|
|
26
|
-
type Assign<T, U> = Omit<T, keyof U> & U;
|
|
27
|
-
type Optional<T, K$1 extends keyof T> = Pick<Partial<T>, K$1> & Omit<T, K$1>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/components/factory.d.ts
|
|
30
|
-
interface PolymorphicProps {
|
|
31
|
-
asChild?: boolean | undefined;
|
|
32
|
-
}
|
|
33
|
-
type JsxElements = { [E in keyof JSX.IntrinsicElements]: SprawlifyForwardRefComponent<E> };
|
|
34
|
-
type SprawlifyForwardRefComponent<E$1 extends React.ElementType> = React.ForwardRefExoticComponent<SprawlifyPropsWithRef<E$1>>;
|
|
35
|
-
type SprawlifyPropsWithRef<E$1 extends React.ElementType> = React.ComponentPropsWithRef<E$1> & PolymorphicProps;
|
|
36
|
-
type HTMLProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T>;
|
|
37
|
-
type HTMLSprawlifyProps<T extends keyof JSX.IntrinsicElements> = HTMLProps<T> & PolymorphicProps;
|
|
38
|
-
declare const jsxFactory: () => JsxElements;
|
|
39
|
-
declare const sprawlify: JsxElements;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { sprawlify as a, Portal as c, normalizeProps as d, useMachine as f, jsxFactory as i, PortalProps as l, HTMLSprawlifyProps as n, Assign as o, PolymorphicProps as r, Optional as s, HTMLProps as t, PropTypes as u };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|