@proyecto-viviana/solidaria-components 0.2.9 → 0.3.1

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 (222) hide show
  1. package/README.md +39 -272
  2. package/dist/ActionBar.d.ts +21 -13
  3. package/dist/ActionBar.d.ts.map +1 -1
  4. package/dist/ActionGroup.d.ts +8 -8
  5. package/dist/ActionGroup.d.ts.map +1 -1
  6. package/dist/Alert.d.ts +5 -5
  7. package/dist/Alert.d.ts.map +1 -1
  8. package/dist/Autocomplete.d.ts +5 -5
  9. package/dist/Autocomplete.d.ts.map +1 -1
  10. package/dist/Breadcrumbs.d.ts +18 -7
  11. package/dist/Breadcrumbs.d.ts.map +1 -1
  12. package/dist/Button.d.ts +24 -5
  13. package/dist/Button.d.ts.map +1 -1
  14. package/dist/Calendar.d.ts +38 -7
  15. package/dist/Calendar.d.ts.map +1 -1
  16. package/dist/Checkbox.d.ts +32 -7
  17. package/dist/Checkbox.d.ts.map +1 -1
  18. package/dist/Collection.d.ts +19 -14
  19. package/dist/Collection.d.ts.map +1 -1
  20. package/dist/Color.d.ts +103 -14
  21. package/dist/Color.d.ts.map +1 -1
  22. package/dist/ColorEditor.d.ts +6 -6
  23. package/dist/ColorEditor.d.ts.map +1 -1
  24. package/dist/ComboBox.d.ts +85 -19
  25. package/dist/ComboBox.d.ts.map +1 -1
  26. package/dist/ContextualHelpTrigger.d.ts +2 -2
  27. package/dist/ContextualHelpTrigger.d.ts.map +1 -1
  28. package/dist/DateField.d.ts +8 -6
  29. package/dist/DateField.d.ts.map +1 -1
  30. package/dist/DatePicker.d.ts +53 -22
  31. package/dist/DatePicker.d.ts.map +1 -1
  32. package/dist/DateRangePickerContext.d.ts +30 -0
  33. package/dist/DateRangePickerContext.d.ts.map +1 -0
  34. package/dist/Dialog.d.ts +5 -5
  35. package/dist/Dialog.d.ts.map +1 -1
  36. package/dist/Disclosure.d.ts +23 -5
  37. package/dist/Disclosure.d.ts.map +1 -1
  38. package/dist/DragAndDrop.d.ts +6 -6
  39. package/dist/DragAndDrop.d.ts.map +1 -1
  40. package/dist/DragPreview.d.ts +2 -2
  41. package/dist/DragPreview.d.ts.map +1 -1
  42. package/dist/DropZone.d.ts +4 -4
  43. package/dist/DropZone.d.ts.map +1 -1
  44. package/dist/FieldError.d.ts +9 -5
  45. package/dist/FieldError.d.ts.map +1 -1
  46. package/dist/FileTrigger.d.ts +3 -3
  47. package/dist/FileTrigger.d.ts.map +1 -1
  48. package/dist/Focusable.d.ts +2 -2
  49. package/dist/Focusable.d.ts.map +1 -1
  50. package/dist/Form.d.ts +18 -4
  51. package/dist/Form.d.ts.map +1 -1
  52. package/dist/GridList.d.ts +32 -12
  53. package/dist/GridList.d.ts.map +1 -1
  54. package/dist/HiddenDateInput.d.ts +26 -0
  55. package/dist/HiddenDateInput.d.ts.map +1 -0
  56. package/dist/HiddenTimeInput.d.ts +25 -0
  57. package/dist/HiddenTimeInput.d.ts.map +1 -0
  58. package/dist/Icon.d.ts +5 -5
  59. package/dist/Icon.d.ts.map +1 -1
  60. package/dist/Keyboard.d.ts +1 -1
  61. package/dist/Landmark.d.ts +3 -3
  62. package/dist/Landmark.d.ts.map +1 -1
  63. package/dist/Link.d.ts +10 -4
  64. package/dist/Link.d.ts.map +1 -1
  65. package/dist/ListBox.d.ts +32 -12
  66. package/dist/ListBox.d.ts.map +1 -1
  67. package/dist/ListDropTargetDelegate.d.ts +6 -6
  68. package/dist/ListDropTargetDelegate.d.ts.map +1 -1
  69. package/dist/Menu.d.ts +65 -14
  70. package/dist/Menu.d.ts.map +1 -1
  71. package/dist/Meter.d.ts +3 -3
  72. package/dist/Meter.d.ts.map +1 -1
  73. package/dist/Modal.d.ts +5 -5
  74. package/dist/Modal.d.ts.map +1 -1
  75. package/dist/NumberField.d.ts +8 -12
  76. package/dist/NumberField.d.ts.map +1 -1
  77. package/dist/Popover.d.ts +28 -5
  78. package/dist/Popover.d.ts.map +1 -1
  79. package/dist/Pressable.d.ts +2 -2
  80. package/dist/Pressable.d.ts.map +1 -1
  81. package/dist/ProgressBar.d.ts +5 -3
  82. package/dist/ProgressBar.d.ts.map +1 -1
  83. package/dist/RadioGroup.d.ts +43 -9
  84. package/dist/RadioGroup.d.ts.map +1 -1
  85. package/dist/RangeCalendar.d.ts +34 -7
  86. package/dist/RangeCalendar.d.ts.map +1 -1
  87. package/dist/RouterProvider.d.ts +2 -2
  88. package/dist/RouterProvider.d.ts.map +1 -1
  89. package/dist/SearchField.d.ts +23 -20
  90. package/dist/SearchField.d.ts.map +1 -1
  91. package/dist/Select.d.ts +41 -11
  92. package/dist/Select.d.ts.map +1 -1
  93. package/dist/SelectionIndicator.d.ts +3 -3
  94. package/dist/SelectionIndicator.d.ts.map +1 -1
  95. package/dist/Separator.d.ts +9 -3
  96. package/dist/Separator.d.ts.map +1 -1
  97. package/dist/SharedElementTransition.d.ts +6 -4
  98. package/dist/SharedElementTransition.d.ts.map +1 -1
  99. package/dist/Slider.d.ts +12 -8
  100. package/dist/Slider.d.ts.map +1 -1
  101. package/dist/StepList.d.ts +90 -0
  102. package/dist/StepList.d.ts.map +1 -0
  103. package/dist/Switch.d.ts +11 -5
  104. package/dist/Switch.d.ts.map +1 -1
  105. package/dist/Table.d.ts +187 -23
  106. package/dist/Table.d.ts.map +1 -1
  107. package/dist/Tabs.d.ts +45 -9
  108. package/dist/Tabs.d.ts.map +1 -1
  109. package/dist/TagGroup.d.ts +12 -10
  110. package/dist/TagGroup.d.ts.map +1 -1
  111. package/dist/Text.d.ts +2 -2
  112. package/dist/TextField.d.ts +15 -11
  113. package/dist/TextField.d.ts.map +1 -1
  114. package/dist/TimeField.d.ts +6 -6
  115. package/dist/TimeField.d.ts.map +1 -1
  116. package/dist/Toast.d.ts +29 -14
  117. package/dist/Toast.d.ts.map +1 -1
  118. package/dist/ToggleButton.d.ts +11 -5
  119. package/dist/ToggleButton.d.ts.map +1 -1
  120. package/dist/ToggleButtonGroup.d.ts +7 -7
  121. package/dist/ToggleButtonGroup.d.ts.map +1 -1
  122. package/dist/Toolbar.d.ts +7 -3
  123. package/dist/Toolbar.d.ts.map +1 -1
  124. package/dist/Tooltip.d.ts +50 -8
  125. package/dist/Tooltip.d.ts.map +1 -1
  126. package/dist/Tree.d.ts +66 -17
  127. package/dist/Tree.d.ts.map +1 -1
  128. package/dist/Virtualizer.d.ts +12 -12
  129. package/dist/Virtualizer.d.ts.map +1 -1
  130. package/dist/VirtualizerLayouts.d.ts +2 -2
  131. package/dist/VirtualizerLayouts.d.ts.map +1 -1
  132. package/dist/VisuallyHidden.d.ts +1 -1
  133. package/dist/VisuallyHidden.d.ts.map +1 -1
  134. package/dist/contexts.d.ts +5 -1
  135. package/dist/contexts.d.ts.map +1 -1
  136. package/dist/index.d.ts +73 -71
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +23253 -18564
  139. package/dist/index.js.map +1 -1
  140. package/dist/index.jsx +18116 -0
  141. package/dist/index.jsx.map +1 -0
  142. package/dist/useDragAndDrop.d.ts +13 -13
  143. package/dist/useDragAndDrop.d.ts.map +1 -1
  144. package/dist/utils.d.ts +2 -2
  145. package/dist/utils.d.ts.map +1 -1
  146. package/dist/virtualizer/Layout.d.ts +1 -1
  147. package/dist/virtualizer/Layout.d.ts.map +1 -1
  148. package/package.json +31 -32
  149. package/src/ActionBar.tsx +75 -72
  150. package/src/ActionGroup.tsx +53 -61
  151. package/src/Alert.tsx +17 -42
  152. package/src/Autocomplete.tsx +39 -44
  153. package/src/Breadcrumbs.tsx +149 -80
  154. package/src/Button.tsx +267 -70
  155. package/src/Calendar.tsx +218 -138
  156. package/src/Checkbox.tsx +413 -121
  157. package/src/Collection.tsx +67 -58
  158. package/src/Color.tsx +803 -380
  159. package/src/ColorEditor.tsx +131 -149
  160. package/src/ComboBox.tsx +414 -249
  161. package/src/ContextualHelpTrigger.tsx +86 -74
  162. package/src/DateField.tsx +185 -91
  163. package/src/DatePicker.tsx +524 -213
  164. package/src/DateRangePickerContext.tsx +44 -0
  165. package/src/Dialog.tsx +156 -118
  166. package/src/Disclosure.tsx +127 -80
  167. package/src/DragAndDrop.tsx +60 -54
  168. package/src/DragPreview.tsx +13 -11
  169. package/src/DropZone.tsx +42 -22
  170. package/src/FieldError.tsx +45 -23
  171. package/src/FileTrigger.tsx +19 -19
  172. package/src/Focusable.tsx +21 -24
  173. package/src/Form.tsx +71 -16
  174. package/src/GridList.tsx +273 -197
  175. package/src/HiddenDateInput.tsx +153 -0
  176. package/src/HiddenTimeInput.tsx +133 -0
  177. package/src/Icon.tsx +22 -43
  178. package/src/Keyboard.tsx +3 -3
  179. package/src/Landmark.tsx +37 -63
  180. package/src/Link.tsx +125 -75
  181. package/src/ListBox.tsx +332 -233
  182. package/src/ListDropTargetDelegate.ts +81 -80
  183. package/src/Menu.tsx +1023 -274
  184. package/src/Meter.tsx +38 -56
  185. package/src/Modal.tsx +251 -176
  186. package/src/NumberField.tsx +139 -143
  187. package/src/Popover.tsx +396 -234
  188. package/src/Pressable.tsx +21 -21
  189. package/src/ProgressBar.tsx +48 -57
  190. package/src/RadioGroup.tsx +524 -122
  191. package/src/RangeCalendar.tsx +157 -90
  192. package/src/RouterProvider.tsx +30 -47
  193. package/src/SearchField.tsx +362 -143
  194. package/src/Select.tsx +656 -233
  195. package/src/SelectionIndicator.tsx +18 -15
  196. package/src/Separator.tsx +47 -49
  197. package/src/SharedElementTransition.tsx +103 -97
  198. package/src/Slider.tsx +138 -98
  199. package/src/StepList.tsx +272 -0
  200. package/src/Switch.tsx +93 -46
  201. package/src/Table.tsx +1308 -342
  202. package/src/Tabs.tsx +324 -103
  203. package/src/TagGroup.tsx +139 -126
  204. package/src/Text.tsx +3 -3
  205. package/src/TextField.tsx +389 -79
  206. package/src/TimeField.tsx +136 -76
  207. package/src/Toast.tsx +216 -158
  208. package/src/ToggleButton.tsx +47 -37
  209. package/src/ToggleButtonGroup.tsx +39 -34
  210. package/src/Toolbar.tsx +54 -69
  211. package/src/Tooltip.tsx +387 -119
  212. package/src/Tree.tsx +651 -368
  213. package/src/Virtualizer.tsx +208 -180
  214. package/src/VirtualizerLayouts.ts +45 -30
  215. package/src/VisuallyHidden.tsx +19 -19
  216. package/src/contexts.ts +29 -37
  217. package/src/index.ts +110 -195
  218. package/src/useDragAndDrop.ts +87 -71
  219. package/src/utils.tsx +49 -60
  220. package/src/virtualizer/Layout.ts +14 -22
  221. package/dist/index.ssr.js +0 -16996
  222. package/dist/index.ssr.js.map +0 -1
package/src/Slider.tsx CHANGED
@@ -5,25 +5,19 @@
5
5
  * Port of react-aria-components/src/Slider.tsx
6
6
  */
7
7
 
8
- import {
9
- type JSX,
10
- createContext,
11
- createMemo,
12
- splitProps,
13
- useContext,
14
- Show,
15
- } from 'solid-js';
8
+ import { type JSX, createContext, createMemo, splitProps, useContext, Show } from "solid-js";
16
9
  import {
17
10
  createSlider,
18
11
  createFocusRing,
19
12
  createHover,
13
+ mergeProps,
20
14
  type AriaSliderProps,
21
- } from '@proyecto-viviana/solidaria';
15
+ } from "@proyecto-viviana/solidaria";
22
16
  import {
23
17
  createSliderState,
24
18
  type SliderState,
25
19
  type SliderOrientation,
26
- } from '@proyecto-viviana/solid-stately';
20
+ } from "@proyecto-viviana/solid-stately";
27
21
  import {
28
22
  type RenderChildren,
29
23
  type ClassNameOrFunction,
@@ -31,11 +25,8 @@ import {
31
25
  type SlotProps,
32
26
  useRenderProps,
33
27
  filterDOMProps,
34
- } from './utils';
35
-
36
- // ============================================
37
- // TYPES
38
- // ============================================
28
+ } from "./utils";
29
+ import { VisuallyHidden } from "./VisuallyHidden";
39
30
 
40
31
  export interface SliderRenderProps {
41
32
  /** Whether the slider is disabled. */
@@ -52,7 +43,7 @@ export interface SliderRenderProps {
52
43
  orientation: SliderOrientation;
53
44
  }
54
45
 
55
- export interface SliderProps extends Omit<AriaSliderProps, 'label'>, SlotProps {
46
+ export interface SliderProps extends Omit<AriaSliderProps, "label">, SlotProps {
56
47
  /** The current value (controlled). */
57
48
  value?: number;
58
49
  /** The default value (uncontrolled). */
@@ -81,6 +72,8 @@ export interface SliderProps extends Omit<AriaSliderProps, 'label'>, SlotProps {
81
72
  class?: ClassNameOrFunction<SliderRenderProps>;
82
73
  /** The inline style for the element. */
83
74
  style?: StyleOrFunction<SliderRenderProps>;
75
+ /** Ref for the slider root element. */
76
+ ref?: (el: HTMLDivElement) => void;
84
77
  }
85
78
 
86
79
  export interface SliderTrackRenderProps {
@@ -94,7 +87,8 @@ export interface SliderTrackRenderProps {
94
87
  orientation: SliderOrientation;
95
88
  }
96
89
 
97
- export interface SliderTrackProps extends SlotProps, Omit<JSX.HTMLAttributes<HTMLDivElement>, 'class' | 'style' | 'children'> {
90
+ export interface SliderTrackProps
91
+ extends SlotProps, Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "style" | "children"> {
98
92
  /** The children of the track. */
99
93
  children?: RenderChildren<SliderTrackRenderProps>;
100
94
  /** The CSS className for the element. */
@@ -120,7 +114,8 @@ export interface SliderThumbRenderProps {
120
114
  valuePercent: number;
121
115
  }
122
116
 
123
- export interface SliderThumbProps extends SlotProps, Omit<JSX.HTMLAttributes<HTMLDivElement>, 'class' | 'style' | 'children'> {
117
+ export interface SliderThumbProps
118
+ extends SlotProps, Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "style" | "children"> {
124
119
  /** The children of the thumb. */
125
120
  children?: RenderChildren<SliderThumbRenderProps>;
126
121
  /** The CSS className for the element. */
@@ -136,7 +131,8 @@ export interface SliderOutputRenderProps {
136
131
  formattedValue: string;
137
132
  }
138
133
 
139
- export interface SliderOutputProps extends SlotProps, Omit<JSX.HTMLAttributes<HTMLElement>, 'class' | 'style' | 'children'> {
134
+ export interface SliderOutputProps
135
+ extends SlotProps, Omit<JSX.HTMLAttributes<HTMLElement>, "class" | "style" | "children"> {
140
136
  /** The children of the output. */
141
137
  children?: RenderChildren<SliderOutputRenderProps>;
142
138
  /** The CSS className for the element. */
@@ -145,10 +141,6 @@ export interface SliderOutputProps extends SlotProps, Omit<JSX.HTMLAttributes<HT
145
141
  style?: StyleOrFunction<SliderOutputRenderProps>;
146
142
  }
147
143
 
148
- // ============================================
149
- // CONTEXT
150
- // ============================================
151
-
152
144
  interface SliderContextValue {
153
145
  state: SliderState;
154
146
  trackProps: JSX.HTMLAttributes<HTMLElement>;
@@ -157,6 +149,8 @@ interface SliderContextValue {
157
149
  inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
158
150
  trackRef: HTMLElement | undefined;
159
151
  setTrackRef: (el: HTMLElement) => void;
152
+ inputRef: HTMLInputElement | undefined;
153
+ setInputRef: (el: HTMLInputElement) => void;
160
154
  }
161
155
 
162
156
  export const SliderContext = createContext<SliderContextValue | null>(null);
@@ -164,22 +158,37 @@ export const SliderStateContext = SliderContext;
164
158
  export const SliderTrackContext = SliderContext;
165
159
  export const SliderOutputContext = SliderContext;
166
160
 
167
- // ============================================
168
- // COMPONENTS
169
- // ============================================
170
-
171
161
  /**
172
162
  * A slider allows users to select a value from a range.
173
163
  */
174
164
  export function Slider(props: SliderProps): JSX.Element {
175
165
  const [local, stateProps, ariaProps, rest] = splitProps(
176
166
  props,
177
- ['class', 'style', 'slot'],
178
- ['value', 'defaultValue', 'onChange', 'onChangeEnd', 'minValue', 'maxValue', 'step', 'orientation', 'locale', 'formatOptions'],
179
- ['label', 'aria-label', 'aria-labelledby', 'aria-describedby', 'isDisabled', 'id']
167
+ ["class", "style", "slot", "ref"],
168
+ [
169
+ "value",
170
+ "defaultValue",
171
+ "onChange",
172
+ "onChangeEnd",
173
+ "minValue",
174
+ "maxValue",
175
+ "step",
176
+ "orientation",
177
+ "locale",
178
+ "formatOptions",
179
+ ],
180
+ [
181
+ "label",
182
+ "aria-label",
183
+ "aria-labelledby",
184
+ "aria-describedby",
185
+ "isDisabled",
186
+ "id",
187
+ "name",
188
+ "form",
189
+ ],
180
190
  );
181
191
 
182
- // Create slider state
183
192
  const state = createSliderState({
184
193
  get value() {
185
194
  return stateProps.value;
@@ -216,23 +225,22 @@ export function Slider(props: SliderProps): JSX.Element {
216
225
  },
217
226
  });
218
227
 
219
- // Track ref for pointer handling
220
228
  let trackRef: HTMLElement | undefined;
221
229
  const setTrackRef = (el: HTMLElement) => {
222
230
  trackRef = el;
223
231
  };
232
+ let inputRef: HTMLInputElement | undefined;
233
+ const setInputRef = (el: HTMLInputElement) => {
234
+ inputRef = el;
235
+ };
236
+
237
+ const sliderAria = createSlider(
238
+ ariaProps,
239
+ state,
240
+ () => trackRef ?? null,
241
+ () => inputRef ?? null,
242
+ );
224
243
 
225
- // Create slider aria props
226
- const {
227
- labelProps,
228
- groupProps,
229
- trackProps,
230
- thumbProps,
231
- inputProps,
232
- outputProps,
233
- } = createSlider(ariaProps, state, () => trackRef ?? null);
234
-
235
- // Render props values
236
244
  const renderValues = createMemo<SliderRenderProps>(() => ({
237
245
  isDisabled: state.isDisabled,
238
246
  isDragging: state.isDragging(),
@@ -242,23 +250,48 @@ export function Slider(props: SliderProps): JSX.Element {
242
250
  orientation: state.orientation,
243
251
  }));
244
252
 
245
- // Resolve render props
246
253
  const renderProps = useRenderProps(
247
254
  {
248
255
  children: props.children,
249
256
  class: local.class,
250
257
  style: local.style,
251
- defaultClassName: 'solidaria-Slider',
258
+ defaultClassName: "solidaria-Slider",
252
259
  },
253
- renderValues
260
+ renderValues,
254
261
  );
255
262
 
256
- // Filter DOM props
257
- const domProps = createMemo(() => filterDOMProps(rest as Record<string, unknown>, { global: true }));
263
+ const childRenderValues: SliderRenderProps = {
264
+ get isDisabled() {
265
+ return state.isDisabled;
266
+ },
267
+ get isDragging() {
268
+ return state.isDragging();
269
+ },
270
+ get isFocused() {
271
+ return state.isFocused();
272
+ },
273
+ get value() {
274
+ return state.value();
275
+ },
276
+ get valuePercent() {
277
+ return state.getValuePercent();
278
+ },
279
+ get orientation() {
280
+ return state.orientation;
281
+ },
282
+ };
283
+
284
+ const sliderChildren = () => {
285
+ const children = props.children;
286
+ return typeof children === "function" ? children(childRenderValues) : children;
287
+ };
288
+
289
+ const domProps = createMemo(() =>
290
+ filterDOMProps(rest as Record<string, unknown>, { global: true }),
291
+ );
258
292
 
259
- // Clean props helpers
260
293
  const cleanGroupProps = () => {
261
- const { ref: _ref, ...rest } = groupProps as Record<string, unknown>;
294
+ const { ref: _ref, ...rest } = sliderAria.groupProps as Record<string, unknown>;
262
295
  return rest;
263
296
  };
264
297
 
@@ -266,32 +299,43 @@ export function Slider(props: SliderProps): JSX.Element {
266
299
  <SliderContext.Provider
267
300
  value={{
268
301
  state,
269
- trackProps,
270
- thumbProps,
271
- outputProps,
272
- inputProps,
273
- trackRef,
302
+ get trackProps() {
303
+ return sliderAria.trackProps;
304
+ },
305
+ get thumbProps() {
306
+ return sliderAria.thumbProps;
307
+ },
308
+ get outputProps() {
309
+ return sliderAria.outputProps;
310
+ },
311
+ get inputProps() {
312
+ return sliderAria.inputProps;
313
+ },
314
+ get trackRef() {
315
+ return trackRef;
316
+ },
274
317
  setTrackRef,
318
+ get inputRef() {
319
+ return inputRef;
320
+ },
321
+ setInputRef,
275
322
  }}
276
323
  >
277
324
  <div
278
325
  {...domProps()}
279
326
  {...cleanGroupProps()}
327
+ ref={local.ref}
280
328
  class={renderProps.class()}
281
329
  style={renderProps.style()}
282
330
  data-disabled={state.isDisabled || undefined}
283
331
  data-orientation={state.orientation}
284
332
  data-dragging={state.isDragging() || undefined}
285
333
  >
286
- {/* Label */}
287
334
  <Show when={ariaProps.label}>
288
- <span {...labelProps}>{ariaProps.label}</span>
335
+ <span {...sliderAria.labelProps}>{ariaProps.label}</span>
289
336
  </Show>
290
337
 
291
- {renderProps.renderChildren()}
292
-
293
- {/* Hidden input for form submission */}
294
- <input {...inputProps} />
338
+ {sliderChildren()}
295
339
  </div>
296
340
  </SliderContext.Provider>
297
341
  );
@@ -301,16 +345,15 @@ export function Slider(props: SliderProps): JSX.Element {
301
345
  * The track element of a slider.
302
346
  */
303
347
  export function SliderTrack(props: SliderTrackProps): JSX.Element {
304
- const [local, domProps] = splitProps(props, ['class', 'style', 'slot', 'children']);
348
+ const [local, domProps] = splitProps(props, ["class", "style", "slot", "children"]);
305
349
 
306
350
  const context = useContext(SliderContext);
307
351
  if (!context) {
308
- throw new Error('SliderTrack must be used within a Slider');
352
+ throw new Error("SliderTrack must be used within a Slider");
309
353
  }
310
354
 
311
- const { state, trackProps, setTrackRef } = context;
355
+ const { state, setTrackRef } = context;
312
356
 
313
- // Render props values
314
357
  const renderValues = createMemo<SliderTrackRenderProps>(() => ({
315
358
  isDisabled: state.isDisabled,
316
359
  isDragging: state.isDragging(),
@@ -318,26 +361,23 @@ export function SliderTrack(props: SliderTrackProps): JSX.Element {
318
361
  orientation: state.orientation,
319
362
  }));
320
363
 
321
- // Resolve render props
322
364
  const renderProps = useRenderProps(
323
365
  {
324
366
  children: props.children,
325
367
  class: local.class,
326
368
  style: local.style,
327
- defaultClassName: 'solidaria-Slider-track',
369
+ defaultClassName: "solidaria-Slider-track",
328
370
  },
329
- renderValues
371
+ renderValues,
330
372
  );
331
373
 
332
- // Clean props
333
374
  const cleanTrackProps = () => {
334
- const { ref: _ref, style: trackStyle, ...rest } = trackProps as Record<string, unknown>;
375
+ const { ref: _ref, style: trackStyle, ...rest } = context.trackProps as Record<string, unknown>;
335
376
  return rest;
336
377
  };
337
378
 
338
- // Merge styles
339
379
  const mergedStyle = () => {
340
- const trackStyle = (trackProps as { style?: Record<string, string> }).style || {};
380
+ const trackStyle = (context.trackProps as { style?: Record<string, string> }).style || {};
341
381
  const renderStyle = renderProps.style() || {};
342
382
  return { ...trackStyle, ...renderStyle };
343
383
  };
@@ -362,26 +402,23 @@ export function SliderTrack(props: SliderTrackProps): JSX.Element {
362
402
  * The thumb element of a slider.
363
403
  */
364
404
  export function SliderThumb(props: SliderThumbProps): JSX.Element {
365
- const [local, domProps] = splitProps(props, ['class', 'style', 'slot', 'children']);
405
+ const [local, domProps] = splitProps(props, ["class", "style", "slot", "children"]);
366
406
 
367
407
  const context = useContext(SliderContext);
368
408
  if (!context) {
369
- throw new Error('SliderFill must be used within a Slider');
409
+ throw new Error("SliderThumb must be used within a Slider");
370
410
  }
371
411
 
372
- const { state, thumbProps } = context;
412
+ const { state, setInputRef } = context;
373
413
 
374
- // Create focus ring
375
414
  const { isFocused, isFocusVisible, focusProps } = createFocusRing();
376
415
 
377
- // Create hover
378
416
  const { isHovered, hoverProps } = createHover({
379
417
  get isDisabled() {
380
418
  return state.isDisabled;
381
419
  },
382
420
  });
383
421
 
384
- // Render props values
385
422
  const renderValues = createMemo<SliderThumbRenderProps>(() => ({
386
423
  isDisabled: state.isDisabled,
387
424
  isDragging: state.isDragging(),
@@ -392,20 +429,18 @@ export function SliderThumb(props: SliderThumbProps): JSX.Element {
392
429
  valuePercent: state.getValuePercent(),
393
430
  }));
394
431
 
395
- // Resolve render props
396
432
  const renderProps = useRenderProps(
397
433
  {
398
434
  children: props.children,
399
435
  class: local.class,
400
436
  style: local.style,
401
- defaultClassName: 'solidaria-Slider-thumb',
437
+ defaultClassName: "solidaria-Slider-thumb",
402
438
  },
403
- renderValues
439
+ renderValues,
404
440
  );
405
441
 
406
- // Clean props
407
442
  const cleanThumbProps = () => {
408
- const { ref: _ref, style: thumbStyle, ...rest } = thumbProps as Record<string, unknown>;
443
+ const { ref: _ref, style: thumbStyle, ...rest } = context.thumbProps as Record<string, unknown>;
409
444
  return rest;
410
445
  };
411
446
  const cleanFocusProps = () => {
@@ -417,27 +452,37 @@ export function SliderThumb(props: SliderThumbProps): JSX.Element {
417
452
  return rest;
418
453
  };
419
454
 
420
- // Merge styles
421
455
  const mergedStyle = () => {
422
- const thumbStyle = (thumbProps as { style?: Record<string, string> }).style || {};
456
+ const thumbStyle = (context.thumbProps as { style?: Record<string, string> }).style || {};
423
457
  const renderStyle = renderProps.style() || {};
424
458
  return { ...thumbStyle, ...renderStyle };
425
459
  };
460
+ const cleanInputProps = () => {
461
+ const { ref: _ref, ...rest } = context.inputProps as Record<string, unknown>;
462
+ return rest;
463
+ };
464
+ const mergedInputProps = () =>
465
+ mergeProps(
466
+ cleanInputProps() as Record<string, unknown>,
467
+ cleanFocusProps() as Record<string, unknown>,
468
+ ) as JSX.InputHTMLAttributes<HTMLInputElement>;
426
469
 
427
470
  return (
428
471
  <div
429
472
  {...domProps}
430
473
  {...cleanThumbProps()}
431
- {...cleanFocusProps()}
432
474
  {...cleanHoverProps()}
433
475
  class={renderProps.class()}
434
476
  style={mergedStyle()}
435
477
  data-disabled={state.isDisabled || undefined}
436
478
  data-dragging={state.isDragging() || undefined}
437
- data-focused={isFocused() || undefined}
479
+ data-focused={isFocused() || state.isFocused() || undefined}
438
480
  data-focus-visible={isFocusVisible() || undefined}
439
481
  data-hovered={isHovered() || undefined}
440
482
  >
483
+ <VisuallyHidden>
484
+ <input ref={setInputRef} {...mergedInputProps()} />
485
+ </VisuallyHidden>
441
486
  {renderProps.renderChildren()}
442
487
  </div>
443
488
  );
@@ -447,43 +492,39 @@ export function SliderThumb(props: SliderThumbProps): JSX.Element {
447
492
  * The output element of a slider, displaying the current value.
448
493
  */
449
494
  export function SliderOutput(props: SliderOutputProps): JSX.Element {
450
- const [local, domProps] = splitProps(props, ['class', 'style', 'slot', 'children']);
495
+ const [local, domProps] = splitProps(props, ["class", "style", "slot", "children"]);
451
496
 
452
497
  const context = useContext(SliderContext);
453
498
  if (!context) {
454
- throw new Error('SliderThumb must be used within a Slider');
499
+ throw new Error("SliderOutput must be used within a Slider");
455
500
  }
456
501
 
457
- const { state, outputProps } = context;
502
+ const { state } = context;
458
503
 
459
- // Render props values
460
504
  const renderValues = createMemo<SliderOutputRenderProps>(() => ({
461
505
  value: state.value(),
462
506
  formattedValue: state.getFormattedValue(),
463
507
  }));
464
508
 
465
- // Resolve render props
466
509
  const renderProps = useRenderProps(
467
510
  {
468
511
  children: props.children,
469
512
  class: local.class,
470
513
  style: local.style,
471
- defaultClassName: 'solidaria-Slider-output',
514
+ defaultClassName: "solidaria-Slider-output",
472
515
  },
473
- renderValues
516
+ renderValues,
474
517
  );
475
518
 
476
- // Clean props
477
519
  const cleanDomProps = () => {
478
520
  const { ref: _ref, ...rest } = domProps as Record<string, unknown>;
479
521
  return rest;
480
522
  };
481
523
  const cleanOutputProps = () => {
482
- const { ref: _ref, ...rest } = outputProps as Record<string, unknown>;
524
+ const { ref: _ref, ...rest } = context.outputProps as Record<string, unknown>;
483
525
  return rest;
484
526
  };
485
527
 
486
- // Default children shows formatted value
487
528
  const renderedChildren = () => {
488
529
  // Check if raw children prop exists before calling renderChildren
489
530
  if (renderProps.children === undefined || renderProps.children === null) {
@@ -504,7 +545,6 @@ export function SliderOutput(props: SliderOutputProps): JSX.Element {
504
545
  );
505
546
  }
506
547
 
507
- // Attach sub-components
508
548
  Slider.Track = SliderTrack;
509
549
  Slider.Thumb = SliderThumb;
510
550
  Slider.Output = SliderOutput;