@wirekyt/solid 0.0.1 → 0.0.3

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 (207) hide show
  1. package/dist/accordion.d.ts +68 -0
  2. package/dist/accordion.js +168 -0
  3. package/dist/accordion.jsx +143 -0
  4. package/dist/angle-slider.d.ts +72 -0
  5. package/dist/angle-slider.js +141 -0
  6. package/dist/angle-slider.jsx +130 -0
  7. package/dist/avatar.d.ts +47 -0
  8. package/dist/avatar.js +86 -0
  9. package/dist/avatar.jsx +79 -0
  10. package/dist/carousel.d.ts +92 -0
  11. package/dist/carousel.js +189 -0
  12. package/dist/carousel.jsx +174 -0
  13. package/dist/checkbox.d.ts +140 -0
  14. package/dist/checkbox.js +252 -0
  15. package/dist/checkbox.jsx +234 -0
  16. package/dist/client-only.d.ts +9 -0
  17. package/dist/client-only.js +22 -0
  18. package/dist/client-only.jsx +13 -0
  19. package/dist/clipboard.d.ts +70 -0
  20. package/dist/clipboard.js +137 -0
  21. package/dist/clipboard.jsx +120 -0
  22. package/dist/collapsible-BwNoH1At.jsx +106 -0
  23. package/dist/collapsible-Dp8aqjtN.js +118 -0
  24. package/dist/collapsible.d.ts +58 -0
  25. package/dist/collapsible.js +2 -0
  26. package/dist/collapsible.jsx +2 -0
  27. package/dist/collection-By8qgqkx.js +213 -0
  28. package/dist/collection-Mkvw6TyT.jsx +213 -0
  29. package/dist/collection.d.ts +2 -0
  30. package/dist/collection.js +2 -0
  31. package/dist/collection.jsx +2 -0
  32. package/dist/color-picker.d.ts +179 -0
  33. package/dist/color-picker.js +457 -0
  34. package/dist/color-picker.jsx +395 -0
  35. package/dist/combobox.d.ts +128 -0
  36. package/dist/combobox.js +326 -0
  37. package/dist/combobox.jsx +284 -0
  38. package/dist/core-7QKBNp9p.js +485 -0
  39. package/dist/core-7QKBNp9p.jsx +485 -0
  40. package/dist/date-input.d.ts +68 -0
  41. package/dist/date-input.js +178 -0
  42. package/dist/date-input.jsx +163 -0
  43. package/dist/date-picker.d.ts +191 -0
  44. package/dist/date-picker.js +506 -0
  45. package/dist/date-picker.jsx +430 -0
  46. package/dist/dialog.d.ts +77 -0
  47. package/dist/dialog.js +205 -0
  48. package/dist/dialog.jsx +159 -0
  49. package/dist/download-trigger.d.ts +22 -0
  50. package/dist/download-trigger.js +55 -0
  51. package/dist/download-trigger.jsx +51 -0
  52. package/dist/drawer.d.ts +114 -0
  53. package/dist/drawer.js +291 -0
  54. package/dist/drawer.jsx +237 -0
  55. package/dist/editable.d.ts +77 -0
  56. package/dist/editable.js +171 -0
  57. package/dist/editable.jsx +162 -0
  58. package/dist/factory-D2A7xdtl.js +34 -0
  59. package/dist/factory-DRw_slzE.jsx +34 -0
  60. package/dist/factory-wuwfJqbU.d.ts +15 -0
  61. package/dist/field-CQr_Dibp.js +317 -0
  62. package/dist/field-R5jVNdtK.jsx +282 -0
  63. package/dist/field.d.ts +194 -0
  64. package/dist/field.js +2 -0
  65. package/dist/field.jsx +2 -0
  66. package/dist/fieldset-5shfE0Z5.jsx +155 -0
  67. package/dist/fieldset-D5teGLZ9.js +170 -0
  68. package/dist/fieldset.d.ts +98 -0
  69. package/dist/fieldset.js +2 -0
  70. package/dist/fieldset.jsx +2 -0
  71. package/dist/file-upload.d.ts +100 -0
  72. package/dist/file-upload.js +254 -0
  73. package/dist/file-upload.jsx +232 -0
  74. package/dist/floating-panel.d.ts +97 -0
  75. package/dist/floating-panel.js +231 -0
  76. package/dist/floating-panel.jsx +199 -0
  77. package/dist/focus-trap.d.ts +12 -0
  78. package/dist/focus-trap.js +30 -0
  79. package/dist/focus-trap.jsx +26 -0
  80. package/dist/format.d.ts +32 -0
  81. package/dist/format.js +50 -0
  82. package/dist/format.jsx +53 -0
  83. package/dist/frame.d.ts +12 -0
  84. package/dist/frame.js +119 -0
  85. package/dist/frame.jsx +83 -0
  86. package/dist/image-cropper.d.ts +62 -0
  87. package/dist/image-cropper.js +137 -0
  88. package/dist/image-cropper.jsx +130 -0
  89. package/dist/index-B17eqq14.d.ts +32 -0
  90. package/dist/index-BZHmHI7d.d.ts +142 -0
  91. package/dist/index-CANuc1X0.d.ts +81 -0
  92. package/dist/index-CJwZCGOS.d.ts +75 -0
  93. package/dist/index-ClU-Lb8Z.d.ts +23 -0
  94. package/dist/index-J9N2CBHP.d.ts +21 -0
  95. package/dist/index.d.ts +5 -0
  96. package/dist/index.js +5 -0
  97. package/dist/index.jsx +5 -0
  98. package/dist/json-tree-view.d.ts +50 -0
  99. package/dist/json-tree-view.js +330 -0
  100. package/dist/json-tree-view.jsx +201 -0
  101. package/dist/listbox.d.ts +109 -0
  102. package/dist/listbox.js +237 -0
  103. package/dist/listbox.jsx +212 -0
  104. package/dist/marquee.d.ts +57 -0
  105. package/dist/marquee.js +125 -0
  106. package/dist/marquee.jsx +113 -0
  107. package/dist/menu.d.ts +158 -0
  108. package/dist/menu.js +441 -0
  109. package/dist/menu.jsx +362 -0
  110. package/dist/navigation-menu.d.ts +88 -0
  111. package/dist/navigation-menu.js +289 -0
  112. package/dist/navigation-menu.jsx +228 -0
  113. package/dist/number-input.d.ts +72 -0
  114. package/dist/number-input.js +166 -0
  115. package/dist/number-input.jsx +157 -0
  116. package/dist/pagination.d.ts +67 -0
  117. package/dist/pagination.js +131 -0
  118. package/dist/pagination.jsx +124 -0
  119. package/dist/password-input.d.ts +64 -0
  120. package/dist/password-input.js +144 -0
  121. package/dist/password-input.jsx +125 -0
  122. package/dist/pin-input.d.ts +57 -0
  123. package/dist/pin-input.js +138 -0
  124. package/dist/pin-input.jsx +129 -0
  125. package/dist/popover.d.ts +92 -0
  126. package/dist/popover.js +206 -0
  127. package/dist/popover.jsx +174 -0
  128. package/dist/presence-9UGkuyfn.jsx +59 -0
  129. package/dist/presence-CE6lXCu5.js +72 -0
  130. package/dist/presence.d.ts +2 -0
  131. package/dist/presence.js +2 -0
  132. package/dist/presence.jsx +2 -0
  133. package/dist/progress.d.ts +77 -0
  134. package/dist/progress.js +146 -0
  135. package/dist/progress.jsx +137 -0
  136. package/dist/providers-B-Vi5wQ7.js +124 -0
  137. package/dist/providers-CqNHqLpB.jsx +110 -0
  138. package/dist/qr-code.d.ts +57 -0
  139. package/dist/qr-code.js +111 -0
  140. package/dist/qr-code.jsx +104 -0
  141. package/dist/radio-group.d.ts +77 -0
  142. package/dist/radio-group.js +170 -0
  143. package/dist/radio-group.jsx +157 -0
  144. package/dist/rating-group.d.ts +67 -0
  145. package/dist/rating-group.js +142 -0
  146. package/dist/rating-group.jsx +131 -0
  147. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  148. package/dist/rolldown-runtime-D7D4PA-g.jsx +13 -0
  149. package/dist/run-if-fn-CjvD7VzQ.js +5 -0
  150. package/dist/run-if-fn-CjvD7VzQ.jsx +5 -0
  151. package/dist/scroll-area.d.ts +61 -0
  152. package/dist/scroll-area.js +119 -0
  153. package/dist/scroll-area.jsx +109 -0
  154. package/dist/segment-group.d.ts +80 -0
  155. package/dist/segment-group.js +166 -0
  156. package/dist/segment-group.jsx +153 -0
  157. package/dist/select.d.ts +132 -0
  158. package/dist/select.js +337 -0
  159. package/dist/select.jsx +283 -0
  160. package/dist/signature-pad.d.ts +67 -0
  161. package/dist/signature-pad.js +159 -0
  162. package/dist/signature-pad.jsx +141 -0
  163. package/dist/slider.d.ts +87 -0
  164. package/dist/slider.js +191 -0
  165. package/dist/slider.jsx +179 -0
  166. package/dist/splitter.d.ts +57 -0
  167. package/dist/splitter.js +126 -0
  168. package/dist/splitter.jsx +116 -0
  169. package/dist/steps.d.ts +100 -0
  170. package/dist/steps.js +199 -0
  171. package/dist/steps.jsx +184 -0
  172. package/dist/swap.d.ts +51 -0
  173. package/dist/swap.js +123 -0
  174. package/dist/swap.jsx +106 -0
  175. package/dist/switch.d.ts +57 -0
  176. package/dist/switch.js +125 -0
  177. package/dist/switch.jsx +116 -0
  178. package/dist/tabs.d.ts +58 -0
  179. package/dist/tabs.js +146 -0
  180. package/dist/tabs.jsx +122 -0
  181. package/dist/tags-input.d.ts +97 -0
  182. package/dist/tags-input.js +228 -0
  183. package/dist/tags-input.jsx +213 -0
  184. package/dist/timer.d.ts +62 -0
  185. package/dist/timer.js +119 -0
  186. package/dist/timer.jsx +110 -0
  187. package/dist/toast.d.ts +60 -0
  188. package/dist/toast.js +120 -0
  189. package/dist/toast.jsx +106 -0
  190. package/dist/toggle-group.d.ts +42 -0
  191. package/dist/toggle-group.js +87 -0
  192. package/dist/toggle-group.jsx +80 -0
  193. package/dist/toggle.d.ts +38 -0
  194. package/dist/toggle.js +73 -0
  195. package/dist/toggle.jsx +61 -0
  196. package/dist/tooltip.d.ts +67 -0
  197. package/dist/tooltip.js +159 -0
  198. package/dist/tooltip.jsx +127 -0
  199. package/dist/tour.d.ts +112 -0
  200. package/dist/tour.js +256 -0
  201. package/dist/tour.jsx +192 -0
  202. package/dist/tree-view-ATyeBPXq.js +290 -0
  203. package/dist/tree-view-CoWx7osT.jsx +265 -0
  204. package/dist/tree-view.d.ts +3 -0
  205. package/dist/tree-view.js +3 -0
  206. package/dist/tree-view.jsx +3 -0
  207. package/package.json +324 -6
@@ -0,0 +1,234 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.jsx";
2
+ import { a as mergeProps$1, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.jsx";
3
+ import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.jsx";
4
+ import { t as wire } from "./factory-DRw_slzE.jsx";
5
+ import { a as useLocaleContext, l as useEnvironmentContext } from "./providers-CqNHqLpB.jsx";
6
+ import { u as useFieldsetContext } from "./fieldset-5shfE0Z5.jsx";
7
+ import { h as useFieldContext } from "./field-R5jVNdtK.jsx";
8
+ import { createMemo, createSignal, createUniqueId, untrack } from "solid-js";
9
+ import * as checkbox from "@wirekyt/dom/machines/checkbox";
10
+ import { anatomy } from "@wirekyt/dom/machines/checkbox";
11
+ //#region src/components/checkbox/use-context.ts
12
+ const [CheckboxProvider, useCheckboxContext] = createContext$1({
13
+ hookName: "useCheckboxContext",
14
+ providerName: "<CheckboxProvider />"
15
+ });
16
+ //#endregion
17
+ //#region src/components/checkbox/context.tsx
18
+ const CheckboxContext = (props) => props.children(useCheckboxContext());
19
+ //#endregion
20
+ //#region src/components/checkbox/control.tsx
21
+ const CheckboxControl = (props) => {
22
+ const checkbox = useCheckboxContext();
23
+ const mergedProps = mergeProps$1(() => checkbox().getControlProps(), props);
24
+ return <wire.div {...mergedProps} />;
25
+ };
26
+ //#endregion
27
+ //#region src/components/checkbox/anatomy.ts
28
+ const checkboxAnatomy = anatomy.extendWith("group");
29
+ //#endregion
30
+ //#region src/utils/use-controllable-state.ts
31
+ function useControllableState(props) {
32
+ const [uncontrolledValue, setUncontrolledValue] = createSignal(runIfFn(props.defaultValue));
33
+ const controlled = createMemo(() => props.value?.() !== void 0);
34
+ const currentValue = createMemo(() => controlled() ? props.value?.() : uncontrolledValue());
35
+ const setValue = (next) => {
36
+ untrack(() => {
37
+ const nextValue = runIfFn(next, currentValue());
38
+ if (controlled()) return props.onChange?.(nextValue);
39
+ setUncontrolledValue(nextValue);
40
+ return props.onChange?.(nextValue);
41
+ });
42
+ };
43
+ return [currentValue, setValue];
44
+ }
45
+ //#endregion
46
+ //#region src/components/checkbox/use-group.ts
47
+ function useCheckboxGroup(props = {}) {
48
+ const fieldset = useFieldsetContext();
49
+ const disabled = () => props.disabled ?? fieldset?.()?.disabled;
50
+ const invalid = () => props.invalid ?? fieldset?.()?.invalid;
51
+ const interactive = createMemo(() => !(disabled() || props.readOnly));
52
+ const [value, setValue] = useControllableState({
53
+ value: props.value,
54
+ defaultValue: props.defaultValue || [],
55
+ onChange: props.onValueChange
56
+ });
57
+ return createMemo(() => {
58
+ const isChecked = (val) => {
59
+ return value().some((v) => String(v) === String(val));
60
+ };
61
+ const toggleValue = (val) => {
62
+ if (isChecked(val)) removeValue(val);
63
+ else addValue(val);
64
+ };
65
+ const isAtMax = props.maxSelectedValues != null && value().length >= props.maxSelectedValues;
66
+ const addValue = (val) => {
67
+ if (!interactive()) return;
68
+ if (isChecked(val)) return;
69
+ if (isAtMax) return;
70
+ setValue(value().concat(val));
71
+ };
72
+ const removeValue = (val) => {
73
+ if (!interactive()) return;
74
+ setValue(value().filter((v) => String(v) !== String(val)));
75
+ };
76
+ const getItemProps = (itemProps) => {
77
+ const checked = itemProps.value != null ? isChecked(itemProps.value) : void 0;
78
+ return {
79
+ checked,
80
+ onCheckedChange() {
81
+ if (itemProps.value != null) toggleValue(itemProps.value);
82
+ },
83
+ name: props.name,
84
+ disabled: disabled() || isAtMax && !checked,
85
+ readOnly: props.readOnly,
86
+ invalid: invalid()
87
+ };
88
+ };
89
+ return {
90
+ isChecked,
91
+ value,
92
+ name: props.name,
93
+ disabled: disabled(),
94
+ readOnly: props.readOnly,
95
+ invalid: invalid(),
96
+ setValue,
97
+ addValue,
98
+ toggleValue,
99
+ getItemProps
100
+ };
101
+ });
102
+ }
103
+ //#endregion
104
+ //#region src/components/checkbox/use-group-context.tsx
105
+ const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext$1({
106
+ hookName: "useCheckboxGroupContext",
107
+ providerName: "<CheckboxGroupProvider />",
108
+ strict: false
109
+ });
110
+ //#endregion
111
+ //#region src/components/checkbox/group.tsx
112
+ const CheckboxGroup = (props) => {
113
+ const [checkboxGroupProps, localProps] = createSplitProps()(props, [
114
+ "defaultValue",
115
+ "value",
116
+ "onValueChange",
117
+ "disabled",
118
+ "invalid",
119
+ "readOnly",
120
+ "name",
121
+ "maxSelectedValues"
122
+ ]);
123
+ const checkboxGroup = useCheckboxGroup(checkboxGroupProps);
124
+ return <CheckboxGroupContextProvider value={checkboxGroup}>
125
+ <wire.div role="group" {...localProps} {...checkboxAnatomy.build().group.attrs} />
126
+ </CheckboxGroupContextProvider>;
127
+ };
128
+ //#endregion
129
+ //#region src/components/checkbox/group-provider.tsx
130
+ const CheckboxGroupProvider = (props) => {
131
+ const [localProps, restProps] = createSplitProps()(props, ["value"]);
132
+ return <CheckboxGroupContextProvider value={localProps.value}>
133
+ <wire.div role="group" {...restProps} {...checkboxAnatomy.build().group.attrs} />
134
+ </CheckboxGroupContextProvider>;
135
+ };
136
+ //#endregion
137
+ //#region src/components/checkbox/hidden-input.tsx
138
+ const CheckboxHiddenInput = (props) => {
139
+ const checkbox = useCheckboxContext();
140
+ const mergedProps = mergeProps$1(() => checkbox().getHiddenInputProps(), props);
141
+ const field = useFieldContext();
142
+ return <wire.input aria-describedby={field?.().ariaDescribedby} {...mergedProps} />;
143
+ };
144
+ //#endregion
145
+ //#region src/components/checkbox/indicator.tsx
146
+ const CheckboxIndicator = (props) => {
147
+ const [indicatorProps, localProps] = createSplitProps()(props, ["indeterminate"]);
148
+ const checkbox = useCheckboxContext();
149
+ const mergedProps = mergeProps$1(() => checkbox().getIndicatorProps(), localProps);
150
+ return <wire.div {...mergedProps} hidden={!(indicatorProps.indeterminate ? checkbox().indeterminate : checkbox().checked)} />;
151
+ };
152
+ //#endregion
153
+ //#region src/components/checkbox/label.tsx
154
+ const CheckboxLabel = (props) => {
155
+ const checkbox = useCheckboxContext();
156
+ const mergedProps = mergeProps$1(() => checkbox().getLabelProps(), props);
157
+ return <wire.span {...mergedProps} />;
158
+ };
159
+ //#endregion
160
+ //#region src/components/checkbox/use.ts
161
+ const useCheckbox = (ownProps = {}) => {
162
+ const checkboxGroup = useCheckboxGroupContext();
163
+ const props = createMemo(() => {
164
+ const resolvedProps = runIfFn(ownProps);
165
+ return mergeProps$1(checkboxGroup?.().getItemProps({ value: resolvedProps.value }) ?? {}, resolvedProps);
166
+ }, [ownProps, checkboxGroup]);
167
+ const id = createUniqueId();
168
+ const locale = useLocaleContext();
169
+ const environment = useEnvironmentContext();
170
+ const field = useFieldContext();
171
+ const machineProps = createMemo(() => ({
172
+ id,
173
+ ids: {
174
+ label: field?.().ids.label,
175
+ hiddenInput: field?.().ids.control
176
+ },
177
+ disabled: field?.().disabled,
178
+ readOnly: field?.().readOnly,
179
+ invalid: field?.().invalid,
180
+ required: field?.().required,
181
+ dir: locale().dir,
182
+ getRootNode: environment().getRootNode,
183
+ ...props()
184
+ }));
185
+ const service = useMachine(checkbox.machine, machineProps);
186
+ return createMemo(() => checkbox.connect(service, normalizeProps));
187
+ };
188
+ //#endregion
189
+ //#region src/components/checkbox/root.tsx
190
+ const CheckboxRoot = (props) => {
191
+ const [useCheckboxProps, labelprops] = createSplitProps()(props, [
192
+ "checked",
193
+ "defaultChecked",
194
+ "disabled",
195
+ "form",
196
+ "id",
197
+ "ids",
198
+ "invalid",
199
+ "name",
200
+ "onCheckedChange",
201
+ "readOnly",
202
+ "required",
203
+ "value"
204
+ ]);
205
+ const checkbox = useCheckbox(useCheckboxProps);
206
+ const mergedProps = mergeProps$1(() => checkbox().getRootProps(), labelprops);
207
+ return <CheckboxProvider value={checkbox}>
208
+ <wire.label {...mergedProps} />
209
+ </CheckboxProvider>;
210
+ };
211
+ //#endregion
212
+ //#region src/components/checkbox/root-provider.tsx
213
+ const CheckboxRootProvider = (props) => {
214
+ const [{ value: checkbox }, labelprops] = createSplitProps()(props, ["value"]);
215
+ const mergedProps = mergeProps$1(() => checkbox().getRootProps(), labelprops);
216
+ return <CheckboxProvider value={checkbox}>
217
+ <wire.label {...mergedProps} />
218
+ </CheckboxProvider>;
219
+ };
220
+ //#endregion
221
+ //#region src/components/checkbox/checkbox.ts
222
+ var checkbox_exports = /* @__PURE__ */ __exportAll({
223
+ Context: () => CheckboxContext,
224
+ Control: () => CheckboxControl,
225
+ Group: () => CheckboxGroup,
226
+ GroupProvider: () => CheckboxGroupProvider,
227
+ HiddenInput: () => CheckboxHiddenInput,
228
+ Indicator: () => CheckboxIndicator,
229
+ Label: () => CheckboxLabel,
230
+ Root: () => CheckboxRoot,
231
+ RootProvider: () => CheckboxRootProvider
232
+ });
233
+ //#endregion
234
+ export { checkbox_exports as Checkbox, CheckboxContext, CheckboxControl, CheckboxGroup, CheckboxGroupProvider, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, CheckboxRootProvider, checkboxAnatomy, useCheckbox, useCheckboxContext, useCheckboxGroup, useCheckboxGroupContext };
@@ -0,0 +1,9 @@
1
+ import { JSX } from "solid-js";
2
+ //#region src/components/client-only/client-only.d.ts
3
+ interface ClientOnlyProps {
4
+ children: JSX.Element;
5
+ fallback?: JSX.Element;
6
+ }
7
+ declare function ClientOnly(props: ClientOnlyProps): JSX.Element;
8
+ //#endregion
9
+ export { ClientOnly, type ClientOnlyProps };
@@ -0,0 +1,22 @@
1
+ import { Show, createSignal, onMount } from "solid-js";
2
+ import { createComponent } from "solid-js/web";
3
+ //#region src/components/client-only/client-only.tsx
4
+ function ClientOnly(props) {
5
+ const [isClient, setIsClient] = createSignal(false);
6
+ onMount(() => {
7
+ setIsClient(true);
8
+ });
9
+ return createComponent(Show, {
10
+ get when() {
11
+ return isClient();
12
+ },
13
+ get fallback() {
14
+ return props.fallback;
15
+ },
16
+ get children() {
17
+ return props.children;
18
+ }
19
+ });
20
+ }
21
+ //#endregion
22
+ export { ClientOnly };
@@ -0,0 +1,13 @@
1
+ import { Show, createSignal, onMount } from "solid-js";
2
+ //#region src/components/client-only/client-only.tsx
3
+ function ClientOnly(props) {
4
+ const [isClient, setIsClient] = createSignal(false);
5
+ onMount(() => {
6
+ setIsClient(true);
7
+ });
8
+ return <Show when={isClient()} fallback={props.fallback}>
9
+ {props.children}
10
+ </Show>;
11
+ }
12
+ //#endregion
13
+ export { ClientOnly };
@@ -0,0 +1,70 @@
1
+ import { a as Optional, r as MaybeAccessor, s as PropTypes } from "./index-ClU-Lb8Z.js";
2
+ import { r as PolymorphicProps, t as HTMLProps } from "./factory-wuwfJqbU.js";
3
+ import { Accessor, JSX } from "solid-js";
4
+ import * as clipboard from "@wirekyt/dom/machines/clipboard";
5
+ import { CopyStatusDetails, CopyStatusDetails as ClipboardCopyStatusDetails, anatomy as clipboardAnatomy } from "@wirekyt/dom/machines/clipboard";
6
+ //#region src/components/clipboard/use.d.ts
7
+ interface UseClipboardProps extends Optional<Omit<clipboard.Props, "dir" | "getRootNode">, "id"> {}
8
+ interface UseClipboardReturn extends Accessor<clipboard.Api<PropTypes>> {}
9
+ declare const useClipboard: (props?: MaybeAccessor<UseClipboardProps>) => UseClipboardReturn;
10
+ //#endregion
11
+ //#region src/components/clipboard/use-context.d.ts
12
+ interface UseClipboardContext extends UseClipboardReturn {}
13
+ declare const ClipboardProvider: import("solid-js").ContextProviderComponent<UseClipboardContext>, useClipboardContext: () => UseClipboardContext;
14
+ //#endregion
15
+ //#region src/components/clipboard/context.d.ts
16
+ interface ClipboardContextProps {
17
+ children: (context: UseClipboardContext) => JSX.Element;
18
+ }
19
+ declare const ClipboardContext: (props: ClipboardContextProps) => JSX.Element;
20
+ //#endregion
21
+ //#region src/components/clipboard/control.d.ts
22
+ interface ClipboardControlBaseProps extends PolymorphicProps<"div"> {}
23
+ interface ClipboardControlProps extends HTMLProps<"div">, ClipboardControlBaseProps {}
24
+ declare const ClipboardControl: (props: ClipboardControlProps) => import("solid-js").JSX.Element;
25
+ //#endregion
26
+ //#region src/components/clipboard/indicator.d.ts
27
+ interface IndicatorProps {
28
+ copied?: JSX.Element;
29
+ }
30
+ interface ClipboardIndicatorBaseProps extends IndicatorProps, PolymorphicProps<"div"> {}
31
+ interface ClipboardIndicatorProps extends HTMLProps<"div">, ClipboardIndicatorBaseProps {}
32
+ declare const ClipboardIndicator: (props: ClipboardIndicatorProps) => JSX.Element;
33
+ //#endregion
34
+ //#region src/components/clipboard/input.d.ts
35
+ interface ClipboardInputBaseProps extends PolymorphicProps<"input"> {}
36
+ interface ClipboardInputProps extends HTMLProps<"input">, ClipboardInputBaseProps {}
37
+ declare const ClipboardInput: (props: ClipboardInputProps) => import("solid-js").JSX.Element;
38
+ //#endregion
39
+ //#region src/components/clipboard/label.d.ts
40
+ interface ClipboardLabelBaseProps extends PolymorphicProps<"label"> {}
41
+ interface ClipboardLabelProps extends HTMLProps<"label">, ClipboardLabelBaseProps {}
42
+ declare const ClipboardLabel: (props: ClipboardLabelProps) => import("solid-js").JSX.Element;
43
+ //#endregion
44
+ //#region src/components/clipboard/root.d.ts
45
+ interface ClipboardRootBaseProps extends UseClipboardProps, PolymorphicProps<"div"> {}
46
+ interface ClipboardRootProps extends HTMLProps<"div">, ClipboardRootBaseProps {}
47
+ declare const ClipboardRoot: (props: ClipboardRootProps) => import("solid-js").JSX.Element;
48
+ //#endregion
49
+ //#region src/components/clipboard/root-provider.d.ts
50
+ interface RootProviderProps {
51
+ value: UseClipboardReturn;
52
+ }
53
+ interface ClipboardRootProviderBaseProps extends PolymorphicProps<"div"> {}
54
+ interface ClipboardRootProviderProps extends HTMLProps<"div">, RootProviderProps, ClipboardRootProviderBaseProps {}
55
+ declare const ClipboardRootProvider: (props: ClipboardRootProviderProps) => import("solid-js").JSX.Element;
56
+ //#endregion
57
+ //#region src/components/clipboard/trigger.d.ts
58
+ interface ClipboardTriggerBaseProps extends PolymorphicProps<"button"> {}
59
+ interface ClipboardTriggerProps extends HTMLProps<"button">, ClipboardTriggerBaseProps {}
60
+ declare const ClipboardTrigger: (props: ClipboardTriggerProps) => import("solid-js").JSX.Element;
61
+ //#endregion
62
+ //#region src/components/clipboard/value-text.d.ts
63
+ interface ClipboardValueTextBaseProps extends PolymorphicProps<"span"> {}
64
+ interface ClipboardValueTextProps extends HTMLProps<"span">, ClipboardValueTextBaseProps {}
65
+ declare const ClipboardValueText: (props: ClipboardValueTextProps) => import("solid-js").JSX.Element;
66
+ declare namespace clipboard_d_exports {
67
+ export { ClipboardContext as Context, ClipboardContextProps as ContextProps, ClipboardControl as Control, ClipboardControlBaseProps as ControlBaseProps, ClipboardControlProps as ControlProps, CopyStatusDetails, ClipboardIndicator as Indicator, ClipboardIndicatorBaseProps as IndicatorBaseProps, ClipboardIndicatorProps as IndicatorProps, ClipboardInput as Input, ClipboardInputBaseProps as InputBaseProps, ClipboardInputProps as InputProps, ClipboardLabel as Label, ClipboardLabelBaseProps as LabelBaseProps, ClipboardLabelProps as LabelProps, ClipboardRoot as Root, ClipboardRootBaseProps as RootBaseProps, ClipboardRootProps as RootProps, ClipboardRootProvider as RootProvider, ClipboardRootProviderBaseProps as RootProviderBaseProps, ClipboardRootProviderProps as RootProviderProps, ClipboardTrigger as Trigger, ClipboardTriggerBaseProps as TriggerBaseProps, ClipboardTriggerProps as TriggerProps, ClipboardValueText as ValueText, ClipboardValueTextBaseProps as ValueTextBaseProps, ClipboardValueTextProps as ValueTextProps };
68
+ }
69
+ //#endregion
70
+ export { clipboard_d_exports as Clipboard, ClipboardContext, type ClipboardContextProps, ClipboardControl, type ClipboardControlBaseProps, type ClipboardControlProps, type ClipboardCopyStatusDetails, ClipboardIndicator, type ClipboardIndicatorBaseProps, type ClipboardIndicatorProps, ClipboardInput, type ClipboardInputBaseProps, type ClipboardInputProps, ClipboardLabel, type ClipboardLabelBaseProps, type ClipboardLabelProps, ClipboardRoot, type ClipboardRootBaseProps, type ClipboardRootProps, ClipboardRootProvider, type ClipboardRootProviderBaseProps, type ClipboardRootProviderProps, ClipboardTrigger, type ClipboardTriggerBaseProps, type ClipboardTriggerProps, ClipboardValueText, type ClipboardValueTextBaseProps, type ClipboardValueTextProps, type UseClipboardContext, type UseClipboardProps, type UseClipboardReturn, clipboardAnatomy, useClipboard, useClipboardContext };
@@ -0,0 +1,137 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { a as mergeProps$2, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.js";
3
+ import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.js";
4
+ import { t as wire } from "./factory-D2A7xdtl.js";
5
+ import { l as useEnvironmentContext } from "./providers-B-Vi5wQ7.js";
6
+ import { Show, children, createMemo, createUniqueId } from "solid-js";
7
+ import { createComponent, mergeProps as mergeProps$1 } from "solid-js/web";
8
+ import * as clipboard from "@wirekyt/dom/machines/clipboard";
9
+ import { anatomy as clipboardAnatomy } from "@wirekyt/dom/machines/clipboard";
10
+ //#region src/components/clipboard/use-context.ts
11
+ const [ClipboardProvider, useClipboardContext] = createContext$1({
12
+ hookName: "useClipboardContext",
13
+ providerName: "<ClipboardProvider />"
14
+ });
15
+ //#endregion
16
+ //#region src/components/clipboard/context.tsx
17
+ const ClipboardContext = (props) => props.children(useClipboardContext());
18
+ //#endregion
19
+ //#region src/components/clipboard/control.tsx
20
+ const ClipboardControl = (props) => {
21
+ const api = useClipboardContext();
22
+ const mergedProps = mergeProps$2(() => api().getControlProps(), props);
23
+ return createComponent(wire.div, mergedProps);
24
+ };
25
+ //#endregion
26
+ //#region src/components/clipboard/indicator.tsx
27
+ const ClipboardIndicator = (props) => {
28
+ const [indicatorProps, localProps] = createSplitProps()(props, ["copied"]);
29
+ const api = useClipboardContext();
30
+ const mergedProps = mergeProps$2(api().getIndicatorProps({ copied: api().copied }), localProps);
31
+ const getChildren = children(() => localProps.children);
32
+ return createComponent(wire.div, mergeProps$1(mergedProps, { get children() {
33
+ return createComponent(Show, {
34
+ get when() {
35
+ return api().copied;
36
+ },
37
+ get fallback() {
38
+ return getChildren();
39
+ },
40
+ get children() {
41
+ return indicatorProps.copied;
42
+ }
43
+ });
44
+ } }));
45
+ };
46
+ //#endregion
47
+ //#region src/components/clipboard/input.tsx
48
+ const ClipboardInput = (props) => {
49
+ const api = useClipboardContext();
50
+ const mergedProps = mergeProps$2(() => api().getInputProps(), props);
51
+ return createComponent(wire.input, mergedProps);
52
+ };
53
+ //#endregion
54
+ //#region src/components/clipboard/label.tsx
55
+ const ClipboardLabel = (props) => {
56
+ const api = useClipboardContext();
57
+ const mergedProps = mergeProps$2(() => api().getLabelProps(), props);
58
+ return createComponent(wire.label, mergedProps);
59
+ };
60
+ //#endregion
61
+ //#region src/components/clipboard/use.ts
62
+ const useClipboard = (props) => {
63
+ const id = createUniqueId();
64
+ const environment = useEnvironmentContext();
65
+ const machineProps = createMemo(() => ({
66
+ id,
67
+ getRootNode: environment().getRootNode,
68
+ ...runIfFn(props)
69
+ }));
70
+ const service = useMachine(clipboard.machine, machineProps);
71
+ return createMemo(() => clipboard.connect(service, normalizeProps));
72
+ };
73
+ //#endregion
74
+ //#region src/components/clipboard/root.tsx
75
+ const ClipboardRoot = (props) => {
76
+ const [useClipboardProps, localProps] = createSplitProps()(props, [
77
+ "defaultValue",
78
+ "id",
79
+ "ids",
80
+ "onStatusChange",
81
+ "onValueChange",
82
+ "timeout",
83
+ "translations",
84
+ "value"
85
+ ]);
86
+ const api = useClipboard(useClipboardProps);
87
+ const mergedProps = mergeProps$2(() => api().getRootProps(), localProps);
88
+ return createComponent(ClipboardProvider, {
89
+ value: api,
90
+ get children() {
91
+ return createComponent(wire.div, mergedProps);
92
+ }
93
+ });
94
+ };
95
+ //#endregion
96
+ //#region src/components/clipboard/root-provider.tsx
97
+ const ClipboardRootProvider = (props) => {
98
+ const [{ value: clipboard }, localProps] = createSplitProps()(props, ["value"]);
99
+ const mergedProps = mergeProps$2(() => clipboard().getRootProps(), localProps);
100
+ return createComponent(ClipboardProvider, {
101
+ value: clipboard,
102
+ get children() {
103
+ return createComponent(wire.div, mergedProps);
104
+ }
105
+ });
106
+ };
107
+ //#endregion
108
+ //#region src/components/clipboard/trigger.tsx
109
+ const ClipboardTrigger = (props) => {
110
+ const api = useClipboardContext();
111
+ const mergedProps = mergeProps$2(() => api().getTriggerProps(), props);
112
+ return createComponent(wire.button, mergedProps);
113
+ };
114
+ //#endregion
115
+ //#region src/components/clipboard/value-text.tsx
116
+ const ClipboardValueText = (props) => {
117
+ const api = useClipboardContext();
118
+ const mergedProps = mergeProps$2(props);
119
+ return createComponent(wire.span, mergeProps$1(mergedProps, { get children() {
120
+ return props.children || api().value;
121
+ } }));
122
+ };
123
+ //#endregion
124
+ //#region src/components/clipboard/clipboard.ts
125
+ var clipboard_exports = /* @__PURE__ */ __exportAll({
126
+ Context: () => ClipboardContext,
127
+ Control: () => ClipboardControl,
128
+ Indicator: () => ClipboardIndicator,
129
+ Input: () => ClipboardInput,
130
+ Label: () => ClipboardLabel,
131
+ Root: () => ClipboardRoot,
132
+ RootProvider: () => ClipboardRootProvider,
133
+ Trigger: () => ClipboardTrigger,
134
+ ValueText: () => ClipboardValueText
135
+ });
136
+ //#endregion
137
+ export { clipboard_exports as Clipboard, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, ClipboardValueText, clipboardAnatomy, useClipboard, useClipboardContext };
@@ -0,0 +1,120 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.jsx";
2
+ import { a as mergeProps$1, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.jsx";
3
+ import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.jsx";
4
+ import { t as wire } from "./factory-DRw_slzE.jsx";
5
+ import { l as useEnvironmentContext } from "./providers-CqNHqLpB.jsx";
6
+ import { Show, children, createMemo, createUniqueId } from "solid-js";
7
+ import * as clipboard from "@wirekyt/dom/machines/clipboard";
8
+ import { anatomy as clipboardAnatomy } from "@wirekyt/dom/machines/clipboard";
9
+ //#region src/components/clipboard/use-context.ts
10
+ const [ClipboardProvider, useClipboardContext] = createContext$1({
11
+ hookName: "useClipboardContext",
12
+ providerName: "<ClipboardProvider />"
13
+ });
14
+ //#endregion
15
+ //#region src/components/clipboard/context.tsx
16
+ const ClipboardContext = (props) => props.children(useClipboardContext());
17
+ //#endregion
18
+ //#region src/components/clipboard/control.tsx
19
+ const ClipboardControl = (props) => {
20
+ const api = useClipboardContext();
21
+ const mergedProps = mergeProps$1(() => api().getControlProps(), props);
22
+ return <wire.div {...mergedProps} />;
23
+ };
24
+ //#endregion
25
+ //#region src/components/clipboard/indicator.tsx
26
+ const ClipboardIndicator = (props) => {
27
+ const [indicatorProps, localProps] = createSplitProps()(props, ["copied"]);
28
+ const api = useClipboardContext();
29
+ const mergedProps = mergeProps$1(api().getIndicatorProps({ copied: api().copied }), localProps);
30
+ const getChildren = children(() => localProps.children);
31
+ return <wire.div {...mergedProps}>
32
+ <Show when={api().copied} fallback={getChildren()}>
33
+ {indicatorProps.copied}
34
+ </Show>
35
+ </wire.div>;
36
+ };
37
+ //#endregion
38
+ //#region src/components/clipboard/input.tsx
39
+ const ClipboardInput = (props) => {
40
+ const api = useClipboardContext();
41
+ const mergedProps = mergeProps$1(() => api().getInputProps(), props);
42
+ return <wire.input {...mergedProps} />;
43
+ };
44
+ //#endregion
45
+ //#region src/components/clipboard/label.tsx
46
+ const ClipboardLabel = (props) => {
47
+ const api = useClipboardContext();
48
+ const mergedProps = mergeProps$1(() => api().getLabelProps(), props);
49
+ return <wire.label {...mergedProps} />;
50
+ };
51
+ //#endregion
52
+ //#region src/components/clipboard/use.ts
53
+ const useClipboard = (props) => {
54
+ const id = createUniqueId();
55
+ const environment = useEnvironmentContext();
56
+ const machineProps = createMemo(() => ({
57
+ id,
58
+ getRootNode: environment().getRootNode,
59
+ ...runIfFn(props)
60
+ }));
61
+ const service = useMachine(clipboard.machine, machineProps);
62
+ return createMemo(() => clipboard.connect(service, normalizeProps));
63
+ };
64
+ //#endregion
65
+ //#region src/components/clipboard/root.tsx
66
+ const ClipboardRoot = (props) => {
67
+ const [useClipboardProps, localProps] = createSplitProps()(props, [
68
+ "defaultValue",
69
+ "id",
70
+ "ids",
71
+ "onStatusChange",
72
+ "onValueChange",
73
+ "timeout",
74
+ "translations",
75
+ "value"
76
+ ]);
77
+ const api = useClipboard(useClipboardProps);
78
+ const mergedProps = mergeProps$1(() => api().getRootProps(), localProps);
79
+ return <ClipboardProvider value={api}>
80
+ <wire.div {...mergedProps} />
81
+ </ClipboardProvider>;
82
+ };
83
+ //#endregion
84
+ //#region src/components/clipboard/root-provider.tsx
85
+ const ClipboardRootProvider = (props) => {
86
+ const [{ value: clipboard }, localProps] = createSplitProps()(props, ["value"]);
87
+ const mergedProps = mergeProps$1(() => clipboard().getRootProps(), localProps);
88
+ return <ClipboardProvider value={clipboard}>
89
+ <wire.div {...mergedProps} />
90
+ </ClipboardProvider>;
91
+ };
92
+ //#endregion
93
+ //#region src/components/clipboard/trigger.tsx
94
+ const ClipboardTrigger = (props) => {
95
+ const api = useClipboardContext();
96
+ const mergedProps = mergeProps$1(() => api().getTriggerProps(), props);
97
+ return <wire.button {...mergedProps} />;
98
+ };
99
+ //#endregion
100
+ //#region src/components/clipboard/value-text.tsx
101
+ const ClipboardValueText = (props) => {
102
+ const api = useClipboardContext();
103
+ const mergedProps = mergeProps$1(props);
104
+ return <wire.span {...mergedProps}>{props.children || api().value}</wire.span>;
105
+ };
106
+ //#endregion
107
+ //#region src/components/clipboard/clipboard.ts
108
+ var clipboard_exports = /* @__PURE__ */ __exportAll({
109
+ Context: () => ClipboardContext,
110
+ Control: () => ClipboardControl,
111
+ Indicator: () => ClipboardIndicator,
112
+ Input: () => ClipboardInput,
113
+ Label: () => ClipboardLabel,
114
+ Root: () => ClipboardRoot,
115
+ RootProvider: () => ClipboardRootProvider,
116
+ Trigger: () => ClipboardTrigger,
117
+ ValueText: () => ClipboardValueText
118
+ });
119
+ //#endregion
120
+ export { clipboard_exports as Clipboard, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, ClipboardValueText, clipboardAnatomy, useClipboard, useClipboardContext };