@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.
Files changed (127) hide show
  1. package/dist/{collapsible-DYgHs1_i.mjs → collapsible-B06GGGE7.mjs} +7 -4
  2. package/dist/{collapsible-D_cXuaRy.cjs → collapsible-D5kle6Bc.cjs} +12 -9
  3. package/dist/collection-BKabYqpE.cjs +229 -0
  4. package/dist/collection-DEsp9z6X.mjs +187 -0
  5. package/dist/components/accordion/index.cjs +19 -24
  6. package/dist/components/accordion/index.d.cts +11 -9
  7. package/dist/components/accordion/index.d.mts +11 -9
  8. package/dist/components/accordion/index.mjs +9 -14
  9. package/dist/components/angle-slider/index.cjs +12 -9
  10. package/dist/components/angle-slider/index.d.cts +13 -11
  11. package/dist/components/angle-slider/index.d.mts +13 -11
  12. package/dist/components/angle-slider/index.mjs +7 -4
  13. package/dist/components/avatar/index.cjs +12 -9
  14. package/dist/components/avatar/index.d.cts +8 -6
  15. package/dist/components/avatar/index.d.mts +8 -6
  16. package/dist/components/avatar/index.mjs +7 -4
  17. package/dist/components/bottom-sheet/index.cjs +213 -0
  18. package/dist/components/bottom-sheet/index.d.cts +80 -0
  19. package/dist/components/bottom-sheet/index.d.mts +81 -0
  20. package/dist/components/bottom-sheet/index.mjs +190 -0
  21. package/dist/components/carousel/index.cjs +263 -0
  22. package/dist/components/carousel/index.d.cts +95 -0
  23. package/dist/components/carousel/index.d.mts +95 -0
  24. package/dist/components/carousel/index.mjs +242 -0
  25. package/dist/components/checkbox/index.cjs +308 -0
  26. package/dist/components/checkbox/index.d.cts +115 -0
  27. package/dist/components/checkbox/index.d.mts +115 -0
  28. package/dist/components/checkbox/index.mjs +289 -0
  29. package/dist/components/client-only/index.cjs +14 -0
  30. package/dist/components/client-only/index.d.cts +8 -0
  31. package/dist/components/client-only/index.d.mts +8 -0
  32. package/dist/components/client-only/index.mjs +13 -0
  33. package/dist/components/clipboard/index.cjs +185 -0
  34. package/dist/components/clipboard/index.d.cts +71 -0
  35. package/dist/components/clipboard/index.d.mts +71 -0
  36. package/dist/components/clipboard/index.mjs +163 -0
  37. package/dist/components/collapsible/index.cjs +6 -3
  38. package/dist/components/collapsible/index.d.cts +10 -8
  39. package/dist/components/collapsible/index.d.mts +10 -8
  40. package/dist/components/collapsible/index.mjs +6 -3
  41. package/dist/components/collection/index.cjs +11 -0
  42. package/dist/components/collection/index.d.cts +2 -0
  43. package/dist/components/collection/index.d.mts +2 -0
  44. package/dist/components/collection/index.mjs +5 -0
  45. package/dist/components/color-picker/index.cjs +613 -0
  46. package/dist/components/color-picker/index.d.cts +181 -0
  47. package/dist/components/color-picker/index.d.mts +182 -0
  48. package/dist/components/color-picker/index.mjs +570 -0
  49. package/dist/components/combobox/index.cjs +416 -0
  50. package/dist/components/combobox/index.d.cts +132 -0
  51. package/dist/components/combobox/index.d.mts +133 -0
  52. package/dist/components/combobox/index.mjs +387 -0
  53. package/dist/components/field/index.cjs +27 -0
  54. package/dist/components/field/index.d.cts +116 -0
  55. package/dist/components/field/index.d.mts +116 -0
  56. package/dist/components/field/index.mjs +9 -0
  57. package/dist/components/fieldset/index.cjs +23 -0
  58. package/dist/components/fieldset/index.d.cts +73 -0
  59. package/dist/components/fieldset/index.d.mts +73 -0
  60. package/dist/components/fieldset/index.mjs +9 -0
  61. package/dist/components/highlight/index.cjs +32 -0
  62. package/dist/components/highlight/index.d.cts +14 -0
  63. package/dist/components/highlight/index.d.mts +14 -0
  64. package/dist/components/highlight/index.mjs +30 -0
  65. package/dist/components/portal/index.cjs +32 -0
  66. package/dist/components/portal/index.d.cts +11 -0
  67. package/dist/components/portal/index.d.mts +11 -0
  68. package/dist/components/portal/index.mjs +31 -0
  69. package/dist/components/presence/index.cjs +11 -0
  70. package/dist/components/presence/index.d.cts +2 -0
  71. package/dist/components/presence/index.d.mts +4 -0
  72. package/dist/components/presence/index.mjs +7 -0
  73. package/dist/components/select/index.cjs +419 -0
  74. package/dist/components/select/index.d.cts +132 -0
  75. package/dist/components/select/index.d.mts +133 -0
  76. package/dist/components/select/index.mjs +384 -0
  77. package/dist/{factory-DN0EdT7u.mjs → core-C0F-4KYH.mjs} +4 -154
  78. package/dist/{factory-CfqPG186.cjs → core-CPLjF6nm.cjs} +0 -198
  79. package/dist/{create-context-DCEySQ7J.cjs → create-context-D6DyFRSf.cjs} +1 -1
  80. package/dist/environment-BXkWNF2O.mjs +46 -0
  81. package/dist/environment-DLPiALpf.cjs +58 -0
  82. package/dist/factory-BbbIuDqa.d.mts +15 -0
  83. package/dist/factory-CDX-oCN5.cjs +81 -0
  84. package/dist/factory-DQlmCPH2.mjs +63 -0
  85. package/dist/factory-DaNWFLLN.d.cts +15 -0
  86. package/dist/field-CGCTFCx2.mjs +322 -0
  87. package/dist/field-CXhpW6zO.cjs +404 -0
  88. package/dist/fieldset-CuSSYZxV.cjs +237 -0
  89. package/dist/fieldset-poJ8RDvB.mjs +184 -0
  90. package/dist/index-BUN9wyVM.d.mts +34 -0
  91. package/dist/index-Dhthtdz_.d.mts +74 -0
  92. package/dist/index-DqRXPiW_.d.cts +34 -0
  93. package/dist/index-DsZldSch.d.cts +74 -0
  94. package/dist/index-DtdZfcpz.d.mts +25 -0
  95. package/dist/index.cjs +14 -11
  96. package/dist/index.d.cts +7 -5
  97. package/dist/index.d.mts +7 -5
  98. package/dist/index.mjs +6 -3
  99. package/dist/normalize-props-sqcs77GC.d.cts +13 -0
  100. package/dist/presence-2A4loEJY.mjs +71 -0
  101. package/dist/presence-BX1tNsGA.cjs +101 -0
  102. package/dist/providers-Bk3ALTxZ.cjs +78 -0
  103. package/dist/providers-CyTYcOU1.mjs +54 -0
  104. package/dist/render-strategy-D3w8btTD.mjs +13 -0
  105. package/dist/render-strategy-k1JmEGnq.cjs +30 -0
  106. package/dist/types-DYWV3uAj.d.cts +5 -0
  107. package/dist/types-FLvjyw__.d.mts +5 -0
  108. package/dist/use-event-BcyNH29h.mjs +19 -0
  109. package/dist/use-event-CGMgV6xB.cjs +25 -0
  110. package/dist/use-safe-layout-effect-BlOhFUAp.mjs +17 -0
  111. package/dist/use-safe-layout-effect-vuYaDIpT.cjs +35 -0
  112. package/dist/utils/index.cjs +2 -2
  113. package/dist/utils/index.d.cts +1 -1
  114. package/dist/utils/index.d.mts +1 -1
  115. package/dist/utils/index.mjs +2 -2
  116. package/package.json +142 -2
  117. package/dist/factory-BZBSaT-0.d.cts +0 -29
  118. package/dist/factory-DaVMAttY.d.mts +0 -41
  119. /package/dist/{chunk-CYMnug_4.mjs → chunk-DLP0tNsH.mjs} +0 -0
  120. /package/dist/{create-context-DGYD_HQt.mjs → create-context-CdjrBhu7.mjs} +0 -0
  121. /package/dist/{create-split-props-BFscidWy.mjs → create-split-props-BJQdOyld.mjs} +0 -0
  122. /package/dist/{create-split-props-CSaOnJRj.cjs → create-split-props-CSkzaUOy.cjs} +0 -0
  123. /package/dist/{index-OOf7QNG5.d.mts → index-BwTxN5vG.d.mts} +0 -0
  124. /package/dist/{index-DiYk6N_L.d.cts → index-zOmANnUL.d.cts} +0 -0
  125. /package/dist/{render-strategy-RT-KvAqO.d.cts → render-strategy-CdpAg9jb.d.cts} +0 -0
  126. /package/dist/{render-strategy--1FNKx5x.d.mts → render-strategy-GetMScNK.d.mts} +0 -0
  127. /package/dist/{utils-nfWHwVIS.mjs → utils-DflO0-3U.mjs} +0 -0
@@ -0,0 +1,115 @@
1
+ import { r as PropTypes } from "../../index-DtdZfcpz.mjs";
2
+ import { n as Optional, t as Assign } from "../../types-FLvjyw__.mjs";
3
+ import { r as PolymorphicProps, t as HTMLProps } from "../../factory-BbbIuDqa.mjs";
4
+ import * as react180 from "react";
5
+ import { ReactNode } from "react";
6
+ import * as checkbox from "@sprawlify/primitives/machines/checkbox";
7
+ import { CheckedChangeDetails, CheckedChangeDetails as CheckboxCheckedChangeDetails, CheckedState, CheckedState as CheckboxCheckedState } from "@sprawlify/primitives/machines/checkbox";
8
+ import * as _sprawlify_primitives_anatomy1 from "@sprawlify/primitives/anatomy";
9
+
10
+ //#region src/components/checkbox/use-checkbox.d.ts
11
+ interface UseCheckboxProps extends Optional<Omit<checkbox.Props, "dir" | "getRootNode">, "id"> {}
12
+ interface UseCheckboxReturn extends checkbox.Api<PropTypes> {}
13
+ declare const useCheckbox: (ownProps?: UseCheckboxProps) => UseCheckboxReturn;
14
+ //#endregion
15
+ //#region src/components/checkbox/use-checkbox-context.d.ts
16
+ interface UseCheckboxContext extends UseCheckboxReturn {}
17
+ //#endregion
18
+ //#region src/components/checkbox/checkbox-context.d.ts
19
+ interface CheckboxContextProps {
20
+ children: (context: UseCheckboxContext) => ReactNode;
21
+ }
22
+ declare const CheckboxContext: (props: CheckboxContextProps) => ReactNode;
23
+ //#endregion
24
+ //#region src/components/checkbox/checkbox-control.d.ts
25
+ interface CheckboxControlBaseProps extends PolymorphicProps {}
26
+ interface CheckboxControlProps extends HTMLProps<"div">, CheckboxControlBaseProps {}
27
+ declare const CheckboxControl: react180.ForwardRefExoticComponent<CheckboxControlProps & react180.RefAttributes<HTMLDivElement>>;
28
+ //#endregion
29
+ //#region src/components/checkbox/use-checkbox-group.d.ts
30
+ interface UseCheckboxGroupProps {
31
+ defaultValue?: string[] | undefined;
32
+ value?: string[] | undefined;
33
+ name?: string | undefined;
34
+ onValueChange?: ((value: string[]) => void) | undefined;
35
+ disabled?: boolean | undefined;
36
+ readOnly?: boolean | undefined;
37
+ invalid?: boolean | undefined;
38
+ }
39
+ interface CheckboxGroupItemProps {
40
+ value: string | undefined;
41
+ }
42
+ declare function useCheckboxGroup(props?: UseCheckboxGroupProps): {
43
+ isChecked: (val: string | undefined) => boolean;
44
+ value: string[];
45
+ name: string | undefined;
46
+ disabled: boolean;
47
+ readOnly: boolean;
48
+ invalid: boolean;
49
+ setValue: (value: string[]) => void | undefined;
50
+ addValue: (val: string) => void;
51
+ toggleValue: (val: string) => void;
52
+ getItemProps: (props: CheckboxGroupItemProps) => {
53
+ checked: boolean | undefined;
54
+ onCheckedChange(): void;
55
+ name: string | undefined;
56
+ disabled: boolean;
57
+ readOnly: boolean | undefined;
58
+ invalid: boolean;
59
+ };
60
+ };
61
+ type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
62
+ //#endregion
63
+ //#region src/components/checkbox/checkbox-group.d.ts
64
+ interface CheckboxGroupBaseProps extends UseCheckboxGroupProps, PolymorphicProps {}
65
+ interface CheckboxGroupProps extends Assign<HTMLProps<"div">, CheckboxGroupBaseProps> {}
66
+ declare const CheckboxGroup: react180.ForwardRefExoticComponent<CheckboxGroupProps & react180.RefAttributes<HTMLDivElement>>;
67
+ //#endregion
68
+ //#region src/components/checkbox/use-checkbox-group-context.d.ts
69
+ interface UseCheckboxGroupContext extends UseCheckboxGroupReturn {}
70
+ //#endregion
71
+ //#region src/components/checkbox/checkbox-group-provider.d.ts
72
+ interface ProviderProps {
73
+ value: UseCheckboxGroupContext;
74
+ }
75
+ interface CheckboxGroupProviderBaseProps extends ProviderProps, PolymorphicProps {}
76
+ interface CheckboxGroupProviderProps extends Assign<HTMLProps<"div">, CheckboxGroupProviderBaseProps> {}
77
+ declare const CheckboxGroupProvider: react180.ForwardRefExoticComponent<CheckboxGroupProviderProps & react180.RefAttributes<HTMLDivElement>>;
78
+ //#endregion
79
+ //#region src/components/checkbox/checkbox-hidden-input.d.ts
80
+ interface CheckboxHiddenInputBaseProps extends PolymorphicProps {}
81
+ interface CheckboxHiddenInputProps extends HTMLProps<"input">, CheckboxHiddenInputBaseProps {}
82
+ declare const CheckboxHiddenInput: react180.ForwardRefExoticComponent<CheckboxHiddenInputProps & react180.RefAttributes<HTMLInputElement>>;
83
+ //#endregion
84
+ //#region src/components/checkbox/checkbox-indicator.d.ts
85
+ interface CheckboxIndicatorBaseProps extends PolymorphicProps {
86
+ indeterminate?: boolean | undefined;
87
+ }
88
+ interface CheckboxIndicatorProps extends HTMLProps<"div">, CheckboxIndicatorBaseProps {}
89
+ declare const CheckboxIndicator: react180.ForwardRefExoticComponent<CheckboxIndicatorProps & react180.RefAttributes<HTMLDivElement>>;
90
+ //#endregion
91
+ //#region src/components/checkbox/checkbox-label.d.ts
92
+ interface CheckboxLabelBaseProps extends PolymorphicProps {}
93
+ interface CheckboxLabelProps extends HTMLProps<"span">, CheckboxLabelBaseProps {}
94
+ declare const CheckboxLabel: react180.ForwardRefExoticComponent<CheckboxLabelProps & react180.RefAttributes<HTMLSpanElement>>;
95
+ //#endregion
96
+ //#region src/components/checkbox/checkbox-root.d.ts
97
+ interface CheckboxRootBaseProps extends UseCheckboxProps, PolymorphicProps {}
98
+ interface CheckboxRootProps extends Assign<HTMLProps<"label">, CheckboxRootBaseProps> {}
99
+ declare const CheckboxRoot: react180.ForwardRefExoticComponent<CheckboxRootProps & react180.RefAttributes<HTMLLabelElement>>;
100
+ //#endregion
101
+ //#region src/components/checkbox/checkbox-root-provider.d.ts
102
+ interface RootProviderProps {
103
+ value: UseCheckboxReturn;
104
+ }
105
+ interface CheckboxRootProviderBaseProps extends RootProviderProps, PolymorphicProps {}
106
+ interface CheckboxRootProviderProps extends HTMLProps<"label">, CheckboxRootProviderBaseProps {}
107
+ declare const CheckboxRootProvider: react180.ForwardRefExoticComponent<CheckboxRootProviderProps & react180.RefAttributes<HTMLLabelElement>>;
108
+ //#endregion
109
+ //#region src/components/checkbox/checkbox-anatomy.d.ts
110
+ declare const checkboxAnatomy: _sprawlify_primitives_anatomy1.AnatomyInstance<"label" | "root" | "control" | "indicator" | "group">;
111
+ declare namespace checkbox_d_exports {
112
+ export { CheckedChangeDetails, CheckedState, CheckboxContext as Context, CheckboxContextProps as ContextProps, CheckboxControl as Control, CheckboxControlBaseProps as ControlBaseProps, CheckboxControlProps as ControlProps, CheckboxGroup as Group, CheckboxGroupBaseProps as GroupBaseProps, CheckboxGroupProps as GroupProps, CheckboxGroupProvider as GroupProvider, CheckboxGroupProviderBaseProps as GroupProviderBaseProps, CheckboxGroupProviderProps as GroupProviderProps, CheckboxHiddenInput as HiddenInput, CheckboxHiddenInputBaseProps as HiddenInputBaseProps, CheckboxHiddenInputProps as HiddenInputProps, CheckboxIndicator as Indicator, CheckboxIndicatorBaseProps as IndicatorBaseProps, CheckboxIndicatorProps as IndicatorProps, CheckboxLabel as Label, CheckboxLabelBaseProps as LabelBaseProps, CheckboxLabelProps as LabelProps, CheckboxRoot as Root, CheckboxRootBaseProps as RootBaseProps, CheckboxRootProps as RootProps, CheckboxRootProvider as RootProvider, CheckboxRootProviderBaseProps as RootProviderBaseProps, CheckboxRootProviderProps as RootProviderProps };
113
+ }
114
+ //#endregion
115
+ export { checkbox_d_exports as Checkbox, type CheckboxCheckedChangeDetails, type CheckboxCheckedState, CheckboxContext, type CheckboxContextProps, CheckboxControl, type CheckboxControlBaseProps, type CheckboxControlProps, CheckboxGroup, type CheckboxGroupBaseProps, type CheckboxGroupProps, CheckboxGroupProvider, type CheckboxGroupProviderBaseProps, type CheckboxGroupProviderProps, CheckboxHiddenInput, type CheckboxHiddenInputBaseProps, type CheckboxHiddenInputProps, CheckboxIndicator, type CheckboxIndicatorBaseProps, type CheckboxIndicatorProps, CheckboxLabel, type CheckboxLabelBaseProps, type CheckboxLabelProps, CheckboxRoot, type CheckboxRootBaseProps, type CheckboxRootProps, CheckboxRootProvider, type CheckboxRootProviderBaseProps, type CheckboxRootProviderProps, type UseCheckboxContext, type UseCheckboxGroupContext, type UseCheckboxGroupProps, type UseCheckboxGroupReturn, type UseCheckboxProps, type UseCheckboxReturn, checkboxAnatomy, useCheckbox, useCheckboxContext, useCheckboxGroup, useCheckboxGroupContext };
@@ -0,0 +1,289 @@
1
+ import { t as __export } from "../../chunk-DLP0tNsH.mjs";
2
+ import { i as useMachine, r as normalizeProps, t as mergeProps } from "../../core-C0F-4KYH.mjs";
3
+ import { t as createContext$1 } from "../../create-context-CdjrBhu7.mjs";
4
+ import { n as useEnvironmentContext } from "../../environment-BXkWNF2O.mjs";
5
+ import { i as useLocaleContext } from "../../providers-CyTYcOU1.mjs";
6
+ import { n as sprawlify } from "../../factory-DQlmCPH2.mjs";
7
+ import { t as createSplitProps } from "../../create-split-props-BJQdOyld.mjs";
8
+ import { t as useEvent } from "../../use-event-BcyNH29h.mjs";
9
+ import { r as useFieldsetContext } from "../../use-safe-layout-effect-BlOhFUAp.mjs";
10
+ import "../../fieldset-poJ8RDvB.mjs";
11
+ import { m as useFieldContext } from "../../field-CGCTFCx2.mjs";
12
+ import { forwardRef, useCallback, useId, useMemo, useState } from "react";
13
+ import { jsx } from "react/jsx-runtime";
14
+ import * as checkbox from "@sprawlify/primitives/machines/checkbox";
15
+ import { anatomy } from "@sprawlify/primitives/machines/checkbox";
16
+
17
+ //#region src/components/checkbox/use-checkbox-context.ts
18
+ const [CheckboxProvider, useCheckboxContext] = createContext$1({
19
+ name: "CheckboxContext",
20
+ hookName: "useCheckboxContext",
21
+ providerName: "<CheckboxProvider />"
22
+ });
23
+
24
+ //#endregion
25
+ //#region src/components/checkbox/checkbox-context.tsx
26
+ const CheckboxContext = (props) => props.children(useCheckboxContext());
27
+
28
+ //#endregion
29
+ //#region src/components/checkbox/checkbox-control.tsx
30
+ const CheckboxControl = forwardRef((props, ref) => {
31
+ const mergedProps = mergeProps(useCheckboxContext().getControlProps(), props);
32
+ return /* @__PURE__ */ jsx(sprawlify.div, {
33
+ ...mergedProps,
34
+ ref
35
+ });
36
+ });
37
+ CheckboxControl.displayName = "CheckboxControl";
38
+
39
+ //#endregion
40
+ //#region src/components/checkbox/checkbox-anatomy.ts
41
+ const checkboxAnatomy = anatomy.extendWith("group");
42
+
43
+ //#endregion
44
+ //#region src/utils/use-controllable-state.ts
45
+ function useControllableState(props) {
46
+ const { value, onChange, defaultValue } = props;
47
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
48
+ const controlled = value !== void 0;
49
+ return [controlled ? value : uncontrolledValue, useCallback((value$1) => {
50
+ if (controlled) return onChange?.(value$1);
51
+ setUncontrolledValue(value$1);
52
+ return onChange?.(value$1);
53
+ }, [controlled, onChange])];
54
+ }
55
+
56
+ //#endregion
57
+ //#region src/components/checkbox/use-checkbox-group.ts
58
+ function useCheckboxGroup(props = {}) {
59
+ const fieldset = useFieldsetContext();
60
+ const { defaultValue, value: controlledValue, onValueChange, disabled = fieldset?.disabled, readOnly, name, invalid = fieldset?.invalid } = props;
61
+ const interactive = !(disabled || readOnly);
62
+ const onChangeProp = useEvent(onValueChange, { sync: true });
63
+ const [value, setValue] = useControllableState({
64
+ value: controlledValue,
65
+ defaultValue: defaultValue || [],
66
+ onChange: onChangeProp
67
+ });
68
+ const isChecked = (val) => {
69
+ return value.some((v) => String(v) === String(val));
70
+ };
71
+ const toggleValue = (val) => {
72
+ isChecked(val) ? removeValue(val) : addValue(val);
73
+ };
74
+ const addValue = (val) => {
75
+ if (!interactive) return;
76
+ if (isChecked(val)) return;
77
+ setValue(value.concat(val));
78
+ };
79
+ const removeValue = (val) => {
80
+ if (!interactive) return;
81
+ setValue(value.filter((v) => String(v) !== String(val)));
82
+ };
83
+ const getItemProps = (props$1) => {
84
+ return {
85
+ checked: props$1.value != null ? isChecked(props$1.value) : void 0,
86
+ onCheckedChange() {
87
+ if (props$1.value != null) toggleValue(props$1.value);
88
+ },
89
+ name,
90
+ disabled,
91
+ readOnly,
92
+ invalid
93
+ };
94
+ };
95
+ return {
96
+ isChecked,
97
+ value,
98
+ name,
99
+ disabled: !!disabled,
100
+ readOnly: !!readOnly,
101
+ invalid: !!invalid,
102
+ setValue,
103
+ addValue,
104
+ toggleValue,
105
+ getItemProps
106
+ };
107
+ }
108
+
109
+ //#endregion
110
+ //#region src/components/checkbox/use-checkbox-group-context.tsx
111
+ const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext$1({
112
+ name: "CheckboxGroupContext",
113
+ hookName: "useCheckboxGroupContext",
114
+ providerName: "<CheckboxGroupProvider />",
115
+ strict: false
116
+ });
117
+
118
+ //#endregion
119
+ //#region src/components/checkbox/checkbox-group.tsx
120
+ const splitGroupProps = createSplitProps();
121
+ const CheckboxGroup = forwardRef((props, ref) => {
122
+ const [checkboxGroupProps, localProps] = splitGroupProps(props, [
123
+ "defaultValue",
124
+ "value",
125
+ "onValueChange",
126
+ "disabled",
127
+ "invalid",
128
+ "readOnly",
129
+ "name"
130
+ ]);
131
+ return /* @__PURE__ */ jsx(CheckboxGroupContextProvider, {
132
+ value: useCheckboxGroup(checkboxGroupProps),
133
+ children: /* @__PURE__ */ jsx(sprawlify.div, {
134
+ ref,
135
+ role: "group",
136
+ ...localProps,
137
+ ...checkboxAnatomy.build().group.attrs
138
+ })
139
+ });
140
+ });
141
+ CheckboxGroup.displayName = "CheckboxGroup";
142
+
143
+ //#endregion
144
+ //#region src/components/checkbox/checkbox-group-provider.tsx
145
+ const splitProviderProps = createSplitProps();
146
+ const CheckboxGroupProvider = forwardRef((props, ref) => {
147
+ const [localProps, restProps] = splitProviderProps(props, ["value"]);
148
+ return /* @__PURE__ */ jsx(CheckboxGroupContextProvider, {
149
+ value: localProps.value,
150
+ children: /* @__PURE__ */ jsx(sprawlify.div, {
151
+ ref,
152
+ role: "group",
153
+ ...restProps,
154
+ ...checkboxAnatomy.build().group.attrs
155
+ })
156
+ });
157
+ });
158
+ CheckboxGroupProvider.displayName = "CheckboxGroupProvider";
159
+
160
+ //#endregion
161
+ //#region src/components/checkbox/checkbox-hidden-input.tsx
162
+ const CheckboxHiddenInput = forwardRef((props, ref) => {
163
+ const mergedProps = mergeProps(useCheckboxContext().getHiddenInputProps(), props);
164
+ const field = useFieldContext();
165
+ return /* @__PURE__ */ jsx(sprawlify.input, {
166
+ "aria-describedby": field?.ariaDescribedby,
167
+ ...mergedProps,
168
+ ref
169
+ });
170
+ });
171
+ CheckboxHiddenInput.displayName = "CheckboxHiddenInput";
172
+
173
+ //#endregion
174
+ //#region src/components/checkbox/checkbox-indicator.tsx
175
+ const CheckboxIndicator = forwardRef((props, ref) => {
176
+ const { indeterminate, ...rest } = props;
177
+ const checkbox$1 = useCheckboxContext();
178
+ const mergedProps = mergeProps(checkbox$1.getIndicatorProps(), rest);
179
+ const isVisible = indeterminate ? checkbox$1.indeterminate : checkbox$1.checked;
180
+ return /* @__PURE__ */ jsx(sprawlify.div, {
181
+ ...mergedProps,
182
+ hidden: !isVisible,
183
+ ref
184
+ });
185
+ });
186
+ CheckboxIndicator.displayName = "CheckboxIndicator";
187
+
188
+ //#endregion
189
+ //#region src/components/checkbox/checkbox-label.tsx
190
+ const CheckboxLabel = forwardRef((props, ref) => {
191
+ const mergedProps = mergeProps(useCheckboxContext().getLabelProps(), props);
192
+ return /* @__PURE__ */ jsx(sprawlify.span, {
193
+ ...mergedProps,
194
+ ref
195
+ });
196
+ });
197
+ CheckboxLabel.displayName = "CheckboxLabel";
198
+
199
+ //#endregion
200
+ //#region src/components/checkbox/use-checkbox.ts
201
+ const useCheckbox = (ownProps = {}) => {
202
+ const checkboxGroup = useCheckboxGroupContext();
203
+ const field = useFieldContext();
204
+ const props = useMemo(() => {
205
+ return mergeProps(ownProps, checkboxGroup?.getItemProps({ value: ownProps.value }) ?? {});
206
+ }, [ownProps, checkboxGroup]);
207
+ const id = useId();
208
+ const { getRootNode } = useEnvironmentContext();
209
+ const { dir } = useLocaleContext();
210
+ const machineProps = {
211
+ id,
212
+ ids: {
213
+ label: field?.ids.label,
214
+ hiddenInput: field?.ids.control
215
+ },
216
+ dir,
217
+ disabled: field?.disabled,
218
+ readOnly: field?.readOnly,
219
+ invalid: field?.invalid,
220
+ required: field?.required,
221
+ getRootNode,
222
+ ...props
223
+ };
224
+ const service = useMachine(checkbox.machine, machineProps);
225
+ return checkbox.connect(service, normalizeProps);
226
+ };
227
+
228
+ //#endregion
229
+ //#region src/components/checkbox/checkbox-root.tsx
230
+ const splitRootProps = createSplitProps();
231
+ const CheckboxRoot = forwardRef((props, ref) => {
232
+ const [useCheckboxProps, localProps] = splitRootProps(props, [
233
+ "checked",
234
+ "defaultChecked",
235
+ "disabled",
236
+ "form",
237
+ "id",
238
+ "ids",
239
+ "invalid",
240
+ "name",
241
+ "onCheckedChange",
242
+ "readOnly",
243
+ "required",
244
+ "value"
245
+ ]);
246
+ const checkbox$1 = useCheckbox(useCheckboxProps);
247
+ const mergedProps = mergeProps(checkbox$1.getRootProps(), localProps);
248
+ return /* @__PURE__ */ jsx(CheckboxProvider, {
249
+ value: checkbox$1,
250
+ children: /* @__PURE__ */ jsx(sprawlify.label, {
251
+ ...mergedProps,
252
+ ref
253
+ })
254
+ });
255
+ });
256
+ CheckboxRoot.displayName = "CheckboxRoot";
257
+
258
+ //#endregion
259
+ //#region src/components/checkbox/checkbox-root-provider.tsx
260
+ const splitRootProviderProps = createSplitProps();
261
+ const CheckboxRootProvider = forwardRef((props, ref) => {
262
+ const [{ value: checkbox$1 }, localProps] = splitRootProviderProps(props, ["value"]);
263
+ const mergedProps = mergeProps(checkbox$1.getRootProps(), localProps);
264
+ return /* @__PURE__ */ jsx(CheckboxProvider, {
265
+ value: checkbox$1,
266
+ children: /* @__PURE__ */ jsx(sprawlify.label, {
267
+ ...mergedProps,
268
+ ref
269
+ })
270
+ });
271
+ });
272
+ CheckboxRootProvider.displayName = "CheckboxRootProvider";
273
+
274
+ //#endregion
275
+ //#region src/components/checkbox/checkbox.ts
276
+ var checkbox_exports = /* @__PURE__ */ __export({
277
+ Context: () => CheckboxContext,
278
+ Control: () => CheckboxControl,
279
+ Group: () => CheckboxGroup,
280
+ GroupProvider: () => CheckboxGroupProvider,
281
+ HiddenInput: () => CheckboxHiddenInput,
282
+ Indicator: () => CheckboxIndicator,
283
+ Label: () => CheckboxLabel,
284
+ Root: () => CheckboxRoot,
285
+ RootProvider: () => CheckboxRootProvider
286
+ });
287
+
288
+ //#endregion
289
+ export { checkbox_exports as Checkbox, CheckboxContext, CheckboxControl, CheckboxGroup, CheckboxGroupProvider, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, CheckboxRootProvider, checkboxAnatomy, useCheckbox, useCheckboxContext, useCheckboxGroup, useCheckboxGroupContext };
@@ -0,0 +1,14 @@
1
+ const require_core = require('../../core-CPLjF6nm.cjs');
2
+ let react = require("react");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+
5
+ //#region src/components/client-only/client-only.tsx
6
+ const noop = () => void 0;
7
+ const ClientOnly = (props) => {
8
+ const { children, fallback } = props;
9
+ if (!(0, react.useSyncExternalStore)(() => noop, () => true, () => false)) return fallback;
10
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: typeof children === "function" ? children() : children });
11
+ };
12
+
13
+ //#endregion
14
+ exports.ClientOnly = ClientOnly;
@@ -0,0 +1,8 @@
1
+ //#region src/components/client-only/client-only.d.ts
2
+ interface ClientOnlyProps {
3
+ children: React.ReactNode | (() => React.ReactNode);
4
+ fallback?: React.ReactNode | undefined;
5
+ }
6
+ declare const ClientOnly: (props: ClientOnlyProps) => React.ReactNode;
7
+ //#endregion
8
+ export { ClientOnly, type ClientOnlyProps };
@@ -0,0 +1,8 @@
1
+ //#region src/components/client-only/client-only.d.ts
2
+ interface ClientOnlyProps {
3
+ children: React.ReactNode | (() => React.ReactNode);
4
+ fallback?: React.ReactNode | undefined;
5
+ }
6
+ declare const ClientOnly: (props: ClientOnlyProps) => React.ReactNode;
7
+ //#endregion
8
+ export { ClientOnly, type ClientOnlyProps };
@@ -0,0 +1,13 @@
1
+ import { useSyncExternalStore } from "react";
2
+ import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/components/client-only/client-only.tsx
5
+ const noop = () => void 0;
6
+ const ClientOnly = (props) => {
7
+ const { children, fallback } = props;
8
+ if (!useSyncExternalStore(() => noop, () => true, () => false)) return fallback;
9
+ return /* @__PURE__ */ jsx(Fragment$1, { children: typeof children === "function" ? children() : children });
10
+ };
11
+
12
+ //#endregion
13
+ export { ClientOnly };
@@ -0,0 +1,185 @@
1
+ const require_core = require('../../core-CPLjF6nm.cjs');
2
+ const require_create_context = require('../../create-context-D6DyFRSf.cjs');
3
+ const require_environment = require('../../environment-DLPiALpf.cjs');
4
+ const require_factory = require('../../factory-CDX-oCN5.cjs');
5
+ const require_create_split_props = require('../../create-split-props-CSkzaUOy.cjs');
6
+ let react = require("react");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ let __sprawlify_primitives_machines_clipboard = require("@sprawlify/primitives/machines/clipboard");
9
+ __sprawlify_primitives_machines_clipboard = require_core.__toESM(__sprawlify_primitives_machines_clipboard);
10
+ let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
11
+
12
+ //#region src/components/clipboard/use-clipboard-context.ts
13
+ const [ClipboardProvider, useClipboardContext] = require_create_context.createContext({
14
+ name: "ClipboardContext",
15
+ hookName: "useClipboardContext",
16
+ providerName: "<ClipboardProvider />"
17
+ });
18
+
19
+ //#endregion
20
+ //#region src/components/clipboard/clipboard-context.tsx
21
+ const ClipboardContext = (props) => props.children(useClipboardContext());
22
+
23
+ //#endregion
24
+ //#region src/components/clipboard/clipboard-control.tsx
25
+ const ClipboardControl = (0, react.forwardRef)((props, ref) => {
26
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useClipboardContext().getControlProps(), props);
27
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
28
+ ...mergedProps,
29
+ ref
30
+ });
31
+ });
32
+ ClipboardControl.displayName = "ClipboardControl";
33
+
34
+ //#endregion
35
+ //#region src/components/clipboard/clipboard-indicator.tsx
36
+ const ClipboardIndicator = (0, react.forwardRef)((props, ref) => {
37
+ const { children, copied, ...localProps } = props;
38
+ const clipboard = useClipboardContext();
39
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(clipboard.getIndicatorProps({ copied: clipboard.copied }), localProps);
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
41
+ ...mergedProps,
42
+ ref,
43
+ children: clipboard.copied ? copied : children
44
+ });
45
+ });
46
+ ClipboardIndicator.displayName = "ClipboardIndicator";
47
+
48
+ //#endregion
49
+ //#region src/components/clipboard/clipboard-input.tsx
50
+ const ClipboardInput = (0, react.forwardRef)((props, ref) => {
51
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useClipboardContext().getInputProps(), props);
52
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.input, {
53
+ ...mergedProps,
54
+ ref
55
+ });
56
+ });
57
+ ClipboardInput.displayName = "ClipboardInput";
58
+
59
+ //#endregion
60
+ //#region src/components/clipboard/clipboard-label.tsx
61
+ const ClipboardLabel = (0, react.forwardRef)((props, ref) => {
62
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useClipboardContext().getLabelProps(), props);
63
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.label, {
64
+ ...mergedProps,
65
+ ref
66
+ });
67
+ });
68
+ ClipboardLabel.displayName = "ClipboardLabel";
69
+
70
+ //#endregion
71
+ //#region src/components/clipboard/use-clipboard.ts
72
+ const useClipboard = (props) => {
73
+ const id = (0, react.useId)();
74
+ const { getRootNode } = require_environment.useEnvironmentContext();
75
+ const machineProps = {
76
+ id,
77
+ getRootNode,
78
+ ...props
79
+ };
80
+ const service = require_core.useMachine(__sprawlify_primitives_machines_clipboard.machine, machineProps);
81
+ return __sprawlify_primitives_machines_clipboard.connect(service, require_core.normalizeProps);
82
+ };
83
+
84
+ //#endregion
85
+ //#region src/components/clipboard/clipboard-root.tsx
86
+ const splitRootProps = require_create_split_props.createSplitProps();
87
+ const ClipboardRoot = (0, react.forwardRef)((props, ref) => {
88
+ const [useClipboardProps, localProps] = splitRootProps(props, [
89
+ "defaultValue",
90
+ "id",
91
+ "ids",
92
+ "onStatusChange",
93
+ "onValueChange",
94
+ "timeout",
95
+ "value"
96
+ ]);
97
+ const clipboard = useClipboard(useClipboardProps);
98
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(clipboard.getRootProps(), localProps);
99
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClipboardProvider, {
100
+ value: clipboard,
101
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
102
+ ref,
103
+ ...mergedProps
104
+ })
105
+ });
106
+ });
107
+ ClipboardRoot.displayName = "ClipboardRoot";
108
+
109
+ //#endregion
110
+ //#region src/components/clipboard/clipboard-root-provider.tsx
111
+ const splitRootProviderProps = require_create_split_props.createSplitProps();
112
+ const ClipboardRootProvider = (0, react.forwardRef)((props, ref) => {
113
+ const [{ value: clipboard }, localProps] = splitRootProviderProps(props, ["value"]);
114
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(clipboard.getRootProps(), localProps);
115
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClipboardProvider, {
116
+ value: clipboard,
117
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.div, {
118
+ ref,
119
+ ...mergedProps
120
+ })
121
+ });
122
+ });
123
+ ClipboardRootProvider.displayName = "ClipboardRootProvider";
124
+
125
+ //#endregion
126
+ //#region src/components/clipboard/clipboard-trigger.tsx
127
+ const ClipboardTrigger = (0, react.forwardRef)((props, ref) => {
128
+ const mergedProps = (0, __sprawlify_primitives_core.mergeProps)(useClipboardContext().getTriggerProps(), props);
129
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.button, {
130
+ ...mergedProps,
131
+ ref
132
+ });
133
+ });
134
+ ClipboardTrigger.displayName = "ClipboardTrigger";
135
+
136
+ //#endregion
137
+ //#region src/components/clipboard/clipboard-value-text.tsx
138
+ const ClipboardValueText = (0, react.forwardRef)((props, ref) => {
139
+ const clipboard = useClipboardContext();
140
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.sprawlify.span, {
141
+ ...props,
142
+ ref,
143
+ children: props.children || clipboard.value
144
+ });
145
+ });
146
+ ClipboardValueText.displayName = "ClipboardValueText";
147
+
148
+ //#endregion
149
+ //#region src/components/clipboard/clipboard.ts
150
+ var clipboard_exports = /* @__PURE__ */ require_core.__export({
151
+ Context: () => ClipboardContext,
152
+ Control: () => ClipboardControl,
153
+ Indicator: () => ClipboardIndicator,
154
+ Input: () => ClipboardInput,
155
+ Label: () => ClipboardLabel,
156
+ Root: () => ClipboardRoot,
157
+ RootProvider: () => ClipboardRootProvider,
158
+ Trigger: () => ClipboardTrigger,
159
+ ValueText: () => ClipboardValueText
160
+ });
161
+
162
+ //#endregion
163
+ Object.defineProperty(exports, 'Clipboard', {
164
+ enumerable: true,
165
+ get: function () {
166
+ return clipboard_exports;
167
+ }
168
+ });
169
+ exports.ClipboardContext = ClipboardContext;
170
+ exports.ClipboardControl = ClipboardControl;
171
+ exports.ClipboardIndicator = ClipboardIndicator;
172
+ exports.ClipboardInput = ClipboardInput;
173
+ exports.ClipboardLabel = ClipboardLabel;
174
+ exports.ClipboardRoot = ClipboardRoot;
175
+ exports.ClipboardRootProvider = ClipboardRootProvider;
176
+ exports.ClipboardTrigger = ClipboardTrigger;
177
+ exports.ClipboardValueText = ClipboardValueText;
178
+ Object.defineProperty(exports, 'clipboardAnatomy', {
179
+ enumerable: true,
180
+ get: function () {
181
+ return __sprawlify_primitives_machines_clipboard.anatomy;
182
+ }
183
+ });
184
+ exports.useClipboard = useClipboard;
185
+ exports.useClipboardContext = useClipboardContext;