@proyecto-viviana/solid-stately 0.2.4 → 0.3.0

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 (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -283
  3. package/dist/autocomplete/createAutocompleteState.d.ts +3 -2
  4. package/dist/autocomplete/index.d.ts +1 -1
  5. package/dist/calendar/createCalendarState.d.ts +22 -7
  6. package/dist/calendar/createDateFieldState.d.ts +30 -7
  7. package/dist/calendar/createDatePickerState.d.ts +60 -0
  8. package/dist/calendar/createRangeCalendarState.d.ts +27 -8
  9. package/dist/calendar/createTimeFieldState.d.ts +34 -7
  10. package/dist/calendar/index.d.ts +7 -6
  11. package/dist/checkbox/createCheckboxGroupState.d.ts +12 -3
  12. package/dist/checkbox/index.d.ts +1 -1
  13. package/dist/collections/ListCollection.d.ts +1 -1
  14. package/dist/collections/createListState.d.ts +8 -8
  15. package/dist/collections/createMenuState.d.ts +7 -7
  16. package/dist/collections/createSelectionState.d.ts +5 -5
  17. package/dist/collections/index.d.ts +5 -5
  18. package/dist/collections/types.d.ts +23 -12
  19. package/dist/color/Color.d.ts +1 -1
  20. package/dist/color/createColorAreaState.d.ts +4 -2
  21. package/dist/color/createColorFieldState.d.ts +38 -12
  22. package/dist/color/createColorSliderState.d.ts +9 -2
  23. package/dist/color/createColorWheelState.d.ts +13 -2
  24. package/dist/color/getColorChannels.d.ts +20 -0
  25. package/dist/color/index.d.ts +6 -6
  26. package/dist/color/types.d.ts +4 -4
  27. package/dist/combobox/createComboBoxState.d.ts +27 -13
  28. package/dist/combobox/index.d.ts +1 -1
  29. package/dist/data/createAsyncList.d.ts +111 -0
  30. package/dist/data/createListData.d.ts +65 -0
  31. package/dist/data/createTreeData.d.ts +65 -0
  32. package/dist/data/index.d.ts +3 -0
  33. package/dist/datepicker/index.d.ts +8 -0
  34. package/dist/disclosure/createDisclosureState.d.ts +2 -2
  35. package/dist/disclosure/index.d.ts +1 -1
  36. package/dist/dnd/createDragState.d.ts +2 -2
  37. package/dist/dnd/createDraggableCollectionState.d.ts +2 -2
  38. package/dist/dnd/createDropState.d.ts +2 -2
  39. package/dist/dnd/createDroppableCollectionState.d.ts +3 -3
  40. package/dist/dnd/index.d.ts +5 -5
  41. package/dist/dnd/types.d.ts +16 -16
  42. package/dist/form/createFormValidationState.d.ts +3 -3
  43. package/dist/form/index.d.ts +1 -1
  44. package/dist/grid/createGridState.d.ts +2 -2
  45. package/dist/grid/index.d.ts +2 -2
  46. package/dist/grid/types.d.ts +17 -11
  47. package/dist/index.d.ts +31 -25
  48. package/dist/index.js +7990 -6264
  49. package/dist/index.js.map +1 -7
  50. package/dist/menu/index.d.ts +8 -0
  51. package/dist/numberfield/createNumberFieldState.d.ts +2 -2
  52. package/dist/numberfield/index.d.ts +1 -1
  53. package/dist/overlays/createOverlayTriggerState.d.ts +2 -2
  54. package/dist/overlays/index.d.ts +1 -1
  55. package/dist/radio/createRadioGroupState.d.ts +13 -4
  56. package/dist/radio/index.d.ts +1 -1
  57. package/dist/searchfield/createSearchFieldState.d.ts +2 -2
  58. package/dist/searchfield/index.d.ts +2 -2
  59. package/dist/select/createSelectState.d.ts +20 -3
  60. package/dist/select/index.d.ts +1 -1
  61. package/dist/selection/index.d.ts +11 -0
  62. package/dist/slider/createSliderState.d.ts +3 -3
  63. package/dist/slider/index.d.ts +2 -2
  64. package/dist/steplist/createStepListState.d.ts +48 -0
  65. package/dist/steplist/index.d.ts +1 -0
  66. package/dist/table/TableCollection.d.ts +3 -3
  67. package/dist/table/createTableColumnResizeState.d.ts +54 -0
  68. package/dist/table/createTableState.d.ts +2 -2
  69. package/dist/table/index.d.ts +5 -3
  70. package/dist/table/types.d.ts +10 -10
  71. package/dist/tabs/createTabListState.d.ts +5 -5
  72. package/dist/tabs/index.d.ts +1 -1
  73. package/dist/textfield/createTextFieldState.d.ts +2 -2
  74. package/dist/textfield/index.d.ts +1 -1
  75. package/dist/toast/createToastState.d.ts +15 -3
  76. package/dist/toast/index.d.ts +1 -1
  77. package/dist/toggle/createToggleGroupState.d.ts +45 -0
  78. package/dist/toggle/createToggleState.d.ts +2 -2
  79. package/dist/toggle/index.d.ts +2 -1
  80. package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
  81. package/dist/tooltip/index.d.ts +1 -1
  82. package/dist/tree/TreeCollection.d.ts +5 -4
  83. package/dist/tree/createTreeState.d.ts +2 -2
  84. package/dist/tree/index.d.ts +3 -3
  85. package/dist/tree/types.d.ts +19 -13
  86. package/dist/utils/index.d.ts +1 -1
  87. package/dist/utils/reactivity.d.ts +1 -1
  88. package/package.json +30 -30
  89. package/src/autocomplete/createAutocompleteState.d.ts +19 -17
  90. package/src/autocomplete/createAutocompleteState.ts +25 -32
  91. package/src/autocomplete/index.d.ts +6 -2
  92. package/src/autocomplete/index.ts +1 -1
  93. package/src/calendar/createCalendarState.d.ts +139 -117
  94. package/src/calendar/createCalendarState.ts +221 -74
  95. package/src/calendar/createDateFieldState.d.ts +130 -95
  96. package/src/calendar/createDateFieldState.ts +286 -151
  97. package/src/calendar/createDatePickerState.ts +347 -0
  98. package/src/calendar/createRangeCalendarState.d.ts +154 -129
  99. package/src/calendar/createRangeCalendarState.ts +293 -79
  100. package/src/calendar/createTimeFieldState.d.ts +81 -79
  101. package/src/calendar/createTimeFieldState.ts +187 -108
  102. package/src/calendar/index.d.ts +80 -7
  103. package/src/calendar/index.ts +21 -12
  104. package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
  105. package/src/checkbox/createCheckboxGroupState.ts +57 -30
  106. package/src/checkbox/index.d.ts +6 -2
  107. package/src/checkbox/index.ts +1 -1
  108. package/src/collections/ListCollection.d.ts +25 -22
  109. package/src/collections/ListCollection.ts +152 -146
  110. package/src/collections/createListState.d.ts +73 -58
  111. package/src/collections/createListState.ts +267 -264
  112. package/src/collections/createMenuState.d.ts +36 -31
  113. package/src/collections/createMenuState.ts +112 -106
  114. package/src/collections/createSelectionState.d.ts +78 -65
  115. package/src/collections/createSelectionState.ts +340 -336
  116. package/src/collections/index.d.ts +38 -6
  117. package/src/collections/index.ts +41 -46
  118. package/src/collections/types.d.ts +101 -101
  119. package/src/collections/types.ts +181 -169
  120. package/src/color/Color.d.ts +20 -5
  121. package/src/color/Color.ts +1054 -951
  122. package/src/color/createColorAreaState.d.ts +67 -65
  123. package/src/color/createColorAreaState.ts +301 -293
  124. package/src/color/createColorFieldState.d.ts +46 -44
  125. package/src/color/createColorFieldState.ts +428 -292
  126. package/src/color/createColorSliderState.d.ts +58 -56
  127. package/src/color/createColorSliderState.ts +272 -241
  128. package/src/color/createColorWheelState.d.ts +42 -40
  129. package/src/color/createColorWheelState.ts +248 -211
  130. package/src/color/getColorChannels.ts +36 -0
  131. package/src/color/index.d.ts +36 -7
  132. package/src/color/index.ts +44 -47
  133. package/src/color/types.d.ts +68 -63
  134. package/src/color/types.ts +119 -127
  135. package/src/combobox/createComboBoxState.d.ts +107 -105
  136. package/src/combobox/createComboBoxState.ts +790 -703
  137. package/src/combobox/index.d.ts +10 -2
  138. package/src/combobox/index.ts +13 -13
  139. package/src/data/createAsyncList.ts +403 -0
  140. package/src/data/createListData.ts +298 -0
  141. package/src/data/createTreeData.ts +646 -0
  142. package/src/data/index.ts +25 -0
  143. package/src/datepicker/index.ts +32 -0
  144. package/src/disclosure/createDisclosureState.d.ts +47 -43
  145. package/src/disclosure/createDisclosureState.ts +9 -23
  146. package/src/disclosure/index.d.ts +10 -2
  147. package/src/disclosure/index.ts +1 -1
  148. package/src/dnd/createDragState.d.ts +51 -42
  149. package/src/dnd/createDragState.ts +151 -153
  150. package/src/dnd/createDraggableCollectionState.d.ts +52 -41
  151. package/src/dnd/createDraggableCollectionState.ts +158 -165
  152. package/src/dnd/createDropState.d.ts +64 -45
  153. package/src/dnd/createDropState.ts +202 -212
  154. package/src/dnd/createDroppableCollectionState.d.ts +88 -59
  155. package/src/dnd/createDroppableCollectionState.ts +354 -357
  156. package/src/dnd/index.d.ts +54 -6
  157. package/src/dnd/index.ts +63 -76
  158. package/src/dnd/types.d.ts +167 -156
  159. package/src/dnd/types.ts +316 -317
  160. package/src/form/createFormValidationState.d.ts +47 -45
  161. package/src/form/createFormValidationState.ts +356 -389
  162. package/src/form/index.d.ts +16 -2
  163. package/src/form/index.ts +15 -15
  164. package/src/grid/createGridState.d.ts +7 -4
  165. package/src/grid/createGridState.ts +44 -51
  166. package/src/grid/index.d.ts +3 -3
  167. package/src/grid/index.ts +2 -8
  168. package/src/grid/types.d.ts +136 -129
  169. package/src/grid/types.ts +24 -17
  170. package/src/index.d.ts +310 -26
  171. package/src/index.ts +87 -79
  172. package/src/menu/index.ts +17 -0
  173. package/src/numberfield/createNumberFieldState.d.ts +56 -54
  174. package/src/numberfield/createNumberFieldState.ts +422 -383
  175. package/src/numberfield/index.d.ts +6 -2
  176. package/src/numberfield/index.ts +5 -5
  177. package/src/overlays/createOverlayTriggerState.d.ts +22 -20
  178. package/src/overlays/createOverlayTriggerState.ts +66 -67
  179. package/src/overlays/index.d.ts +6 -2
  180. package/src/overlays/index.ts +5 -5
  181. package/src/radio/createRadioGroupState.d.ts +54 -52
  182. package/src/radio/createRadioGroupState.ts +66 -30
  183. package/src/radio/index.d.ts +7 -2
  184. package/src/radio/index.ts +1 -1
  185. package/src/searchfield/createSearchFieldState.d.ts +16 -14
  186. package/src/searchfield/createSearchFieldState.ts +56 -62
  187. package/src/searchfield/index.d.ts +3 -3
  188. package/src/searchfield/index.ts +2 -5
  189. package/src/select/createSelectState.d.ts +63 -61
  190. package/src/select/createSelectState.ts +290 -181
  191. package/src/select/index.d.ts +2 -2
  192. package/src/select/index.ts +1 -5
  193. package/src/selection/index.ts +27 -0
  194. package/src/slider/createSliderState.d.ts +60 -60
  195. package/src/slider/createSliderState.ts +233 -211
  196. package/src/slider/index.d.ts +3 -3
  197. package/src/slider/index.ts +2 -6
  198. package/src/ssr/index.d.ts +1 -1
  199. package/src/ssr/index.ts +2 -2
  200. package/src/steplist/createStepListState.ts +191 -0
  201. package/src/steplist/index.ts +5 -0
  202. package/src/table/TableCollection.d.ts +42 -40
  203. package/src/table/TableCollection.ts +61 -64
  204. package/src/table/createTableColumnResizeState.ts +242 -0
  205. package/src/table/createTableState.d.ts +7 -4
  206. package/src/table/createTableState.ts +10 -7
  207. package/src/table/index.d.ts +14 -4
  208. package/src/table/index.ts +10 -3
  209. package/src/table/types.d.ts +98 -92
  210. package/src/table/types.ts +17 -13
  211. package/src/tabs/createTabListState.d.ts +59 -57
  212. package/src/tabs/createTabListState.ts +58 -39
  213. package/src/tabs/index.d.ts +8 -2
  214. package/src/tabs/index.ts +1 -1
  215. package/src/textfield/createTextFieldState.d.ts +16 -14
  216. package/src/textfield/createTextFieldState.ts +7 -18
  217. package/src/textfield/index.d.ts +6 -2
  218. package/src/textfield/index.ts +1 -1
  219. package/src/toast/createToastState.d.ts +92 -81
  220. package/src/toast/createToastState.ts +56 -44
  221. package/src/toast/index.d.ts +12 -2
  222. package/src/toast/index.ts +1 -1
  223. package/src/toggle/createToggleGroupState.ts +117 -0
  224. package/src/toggle/createToggleState.d.ts +19 -19
  225. package/src/toggle/createToggleState.ts +2 -16
  226. package/src/toggle/index.d.ts +2 -2
  227. package/src/toggle/index.ts +6 -4
  228. package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
  229. package/src/tooltip/createTooltipTriggerState.ts +184 -183
  230. package/src/tooltip/index.d.ts +7 -2
  231. package/src/tooltip/index.ts +6 -6
  232. package/src/tree/TreeCollection.d.ts +26 -23
  233. package/src/tree/TreeCollection.ts +215 -175
  234. package/src/tree/createTreeState.d.ts +7 -4
  235. package/src/tree/createTreeState.ts +390 -392
  236. package/src/tree/index.d.ts +10 -4
  237. package/src/tree/index.ts +13 -13
  238. package/src/tree/types.d.ts +131 -126
  239. package/src/tree/types.ts +183 -174
  240. package/src/utils/index.d.ts +2 -2
  241. package/src/utils/index.ts +1 -1
  242. package/src/utils/reactivity.d.ts +2 -2
  243. package/src/utils/reactivity.ts +3 -3
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Menu compatibility surface.
3
+ *
4
+ * Exposes React Stately-like menu hook names while using existing
5
+ * Solid menu state primitives.
6
+ */
7
+ export { createMenuState, createMenuTriggerState, type MenuStateProps, type MenuState, type MenuTriggerStateProps, type MenuTriggerState, } from "../collections/createMenuState";
8
+ export { createMenuTriggerState as useMenuTriggerState } from "../collections/createMenuState";
@@ -2,8 +2,8 @@
2
2
  * State management for NumberField.
3
3
  * Based on @react-stately/numberfield useNumberFieldState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
7
  export interface NumberFieldStateProps {
8
8
  /** The current value (controlled). */
9
9
  value?: number;
@@ -1 +1 @@
1
- export { createNumberFieldState, type NumberFieldStateProps, type NumberFieldState, } from './createNumberFieldState';
1
+ export { createNumberFieldState, type NumberFieldStateProps, type NumberFieldState, } from "./createNumberFieldState";
@@ -2,8 +2,8 @@
2
2
  * Manages state for an overlay trigger.
3
3
  * Based on @react-stately/overlays useOverlayTriggerState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
7
  export interface OverlayTriggerProps {
8
8
  /** Whether the overlay is open by default (uncontrolled). */
9
9
  defaultOpen?: boolean;
@@ -1 +1 @@
1
- export { createOverlayTriggerState, type OverlayTriggerProps, type OverlayTriggerState, } from './createOverlayTriggerState';
1
+ export { createOverlayTriggerState, type OverlayTriggerProps, type OverlayTriggerState, } from "./createOverlayTriggerState";
@@ -6,8 +6,9 @@
6
6
  *
7
7
  * This is a 1:1 port of @react-stately/radio's useRadioGroupState.
8
8
  */
9
- import { Accessor } from 'solid-js';
10
- import { type MaybeAccessor } from '../utils';
9
+ import { Accessor } from "solid-js";
10
+ import { type MaybeAccessor } from "../utils";
11
+ import { type FormValidationState, type ValidationFunction, type ValidationResult } from "../form";
11
12
  export interface RadioGroupProps {
12
13
  /** The current selected value (controlled). */
13
14
  value?: string | null;
@@ -30,15 +31,21 @@ export interface RadioGroupProps {
30
31
  /** The label for the radio group. */
31
32
  label?: string;
32
33
  /** Orientation of the radio group. */
33
- orientation?: 'horizontal' | 'vertical';
34
+ orientation?: "horizontal" | "vertical";
34
35
  /** Handler that is called when the radio group receives focus. */
35
36
  onFocus?: (e: FocusEvent) => void;
36
37
  /** Handler that is called when the radio group loses focus. */
37
38
  onBlur?: (e: FocusEvent) => void;
38
39
  /** Handler that is called when the radio group's focus status changes. */
39
40
  onFocusChange?: (isFocused: boolean) => void;
41
+ /** Backward-compatible controlled validation state. */
42
+ validationState?: "valid" | "invalid";
43
+ /** Custom validation function. */
44
+ validate?: ValidationFunction<string | null>;
45
+ /** Validation behavior for the radio group. */
46
+ validationBehavior?: "aria" | "native";
40
47
  }
41
- export interface RadioGroupState {
48
+ export interface RadioGroupState extends Pick<FormValidationState, "realtimeValidation" | "displayValidation" | "updateValidation" | "resetValidation" | "commitValidation"> {
42
49
  /** The name for the group, used for native form submission. */
43
50
  readonly name: string;
44
51
  /** Whether the radio group is disabled. */
@@ -59,6 +66,8 @@ export interface RadioGroupState {
59
66
  readonly lastFocusedValue: Accessor<string | null>;
60
67
  /** Sets the last focused value. */
61
68
  setLastFocusedValue(value: string | null): void;
69
+ /** Current display validation result for the group. */
70
+ readonly displayValidation: Accessor<ValidationResult>;
62
71
  }
63
72
  /**
64
73
  * Internal WeakMap to store sync version accessors for each radio group state.
@@ -1 +1 @@
1
- export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from './createRadioGroupState';
1
+ export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from "./createRadioGroupState";
@@ -2,8 +2,8 @@
2
2
  * Creates state for a search field component.
3
3
  * Based on @react-stately/searchfield useSearchFieldState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
7
  export interface SearchFieldStateProps {
8
8
  /** The current value (controlled). */
9
9
  value?: string;
@@ -1,2 +1,2 @@
1
- export { createSearchFieldState } from './createSearchFieldState';
2
- export type { SearchFieldState, SearchFieldStateProps, } from './createSearchFieldState';
1
+ export { createSearchFieldState } from "./createSearchFieldState";
2
+ export type { SearchFieldState, SearchFieldStateProps } from "./createSearchFieldState";
@@ -2,9 +2,10 @@
2
2
  * State management for select components.
3
3
  * Based on @react-stately/select useSelectState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
7
- import type { Key, CollectionNode, Collection } from '../collections/types';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
+ import type { Key, CollectionNode, Collection } from "../collections/types";
8
+ import type { SelectionMode, Selection } from "../collections/types";
8
9
  export interface SelectStateProps<T = unknown> {
9
10
  /** The items to display in the select. */
10
11
  items: T[];
@@ -20,8 +21,16 @@ export interface SelectStateProps<T = unknown> {
20
21
  selectedKey?: Key | null;
21
22
  /** The default selected key (uncontrolled). */
22
23
  defaultSelectedKey?: Key | null;
24
+ /** The selected keys (controlled, for multiple selection mode). */
25
+ selectedKeys?: "all" | Iterable<Key>;
26
+ /** Default selected keys (uncontrolled, for multiple selection mode). */
27
+ defaultSelectedKeys?: "all" | Iterable<Key>;
23
28
  /** Handler called when the selection changes. */
24
29
  onSelectionChange?: (key: Key | null) => void;
30
+ /** Handler called when selected keys change. */
31
+ onSelectionChangeKeys?: (keys: Selection) => void;
32
+ /** Selection mode for the select. */
33
+ selectionMode?: Extract<SelectionMode, "single" | "multiple">;
25
34
  /** Whether the select is open (controlled). */
26
35
  isOpen?: boolean;
27
36
  /** Whether the select is open by default (uncontrolled). */
@@ -46,10 +55,16 @@ export interface SelectState<T = unknown> {
46
55
  toggle(): void;
47
56
  /** The currently selected key. */
48
57
  readonly selectedKey: Accessor<Key | null>;
58
+ /** The selected keys. */
59
+ readonly selectedKeys: Accessor<Selection>;
49
60
  /** The currently selected item. */
50
61
  readonly selectedItem: Accessor<CollectionNode<T> | null>;
62
+ /** The currently selected items. */
63
+ readonly selectedItems: Accessor<CollectionNode<T>[]>;
51
64
  /** Set the selected key. */
52
65
  setSelectedKey(key: Key | null): void;
66
+ /** Set selected keys. */
67
+ setSelectedKeys(keys: Iterable<Key>): void;
53
68
  /** The currently focused key. */
54
69
  readonly focusedKey: Accessor<Key | null>;
55
70
  /** Set the focused key. */
@@ -64,6 +79,8 @@ export interface SelectState<T = unknown> {
64
79
  readonly isDisabled: boolean;
65
80
  /** Whether the select is required. */
66
81
  readonly isRequired: boolean;
82
+ /** The selection mode. */
83
+ readonly selectionMode: Accessor<"single" | "multiple">;
67
84
  }
68
85
  /**
69
86
  * Creates state for a select component.
@@ -1 +1 @@
1
- export { createSelectState, type SelectStateProps, type SelectState, } from './createSelectState';
1
+ export { createSelectState, type SelectStateProps, type SelectState } from "./createSelectState";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Selection compatibility surface.
3
+ *
4
+ * Provides a React Stately-like module entrypoint for selection state while
5
+ * delegating to the existing Solid collection selection primitives.
6
+ */
7
+ export { createSelectionState, type SelectionStateProps, type SelectionState, } from "../collections/createSelectionState";
8
+ export type { Key, Selection, SelectionMode, SelectionBehavior, DisabledBehavior, FocusStrategy, } from "../collections/types";
9
+ export type MultipleSelectionStateProps = import("../collections/createSelectionState").SelectionStateProps;
10
+ export type MultipleSelectionState = import("../collections/createSelectionState").SelectionState;
11
+ export { createSelectionState as useMultipleSelectionState } from "../collections/createSelectionState";
@@ -2,9 +2,9 @@
2
2
  * Creates state for a slider component.
3
3
  * Based on @react-stately/slider useSliderState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
7
- export type SliderOrientation = 'horizontal' | 'vertical';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
+ export type SliderOrientation = "horizontal" | "vertical";
8
8
  export interface SliderStateProps {
9
9
  /** The current value (controlled). */
10
10
  value?: number;
@@ -1,2 +1,2 @@
1
- export { createSliderState } from './createSliderState';
2
- export type { SliderState, SliderStateProps, SliderOrientation, } from './createSliderState';
1
+ export { createSliderState } from "./createSliderState";
2
+ export type { SliderState, SliderStateProps, SliderOrientation } from "./createSliderState";
@@ -0,0 +1,48 @@
1
+ /**
2
+ * State management for step list components.
3
+ * Tracks selected step, completion status, and selectability.
4
+ */
5
+ import { type Accessor } from "solid-js";
6
+ import type { Key } from "../collections/types";
7
+ export interface StepListStateProps {
8
+ /** The currently selected step key (controlled). */
9
+ selectedKey?: Key;
10
+ /** The default selected step key (uncontrolled). */
11
+ defaultSelectedKey?: Key;
12
+ /** Called when the selected step changes. */
13
+ onSelectionChange?: (key: Key) => void;
14
+ /** The last completed step key (controlled). */
15
+ lastCompletedStep?: Key;
16
+ /** The default last completed step key (uncontrolled). */
17
+ defaultLastCompletedStep?: Key;
18
+ /** Called when last completed step changes. */
19
+ onLastCompletedStepChange?: (key: Key | null) => void;
20
+ /** Whether all steps are disabled. */
21
+ isDisabled?: boolean;
22
+ /** Whether all steps are read-only. */
23
+ isReadOnly?: boolean;
24
+ /** Keys of individually disabled steps. */
25
+ disabledKeys?: Iterable<Key>;
26
+ /** The step items. */
27
+ items: Array<{
28
+ key: Key;
29
+ [key: string]: any;
30
+ }>;
31
+ }
32
+ export interface StepListState {
33
+ readonly selectedKey: Accessor<Key | null>;
34
+ readonly lastCompletedStep: Accessor<Key | null>;
35
+ readonly items: Accessor<Array<{
36
+ key: Key;
37
+ }>>;
38
+ setSelectedKey(key: Key): void;
39
+ setLastCompletedStep(key: Key): void;
40
+ isCompleted(key: Key): boolean;
41
+ isSelectable(key: Key): boolean;
42
+ isDisabled: Accessor<boolean>;
43
+ isReadOnly: Accessor<boolean>;
44
+ }
45
+ /**
46
+ * Creates state for a step list component.
47
+ */
48
+ export declare function createStepListState(props: StepListStateProps): StepListState;
@@ -0,0 +1 @@
1
+ export { createStepListState, type StepListStateProps, type StepListState, } from "./createStepListState";
@@ -2,9 +2,9 @@
2
2
  * TableCollection - A collection class for table data.
3
3
  * Based on @react-stately/table/TableCollection.
4
4
  */
5
- import type { Key } from '../collections/types';
6
- import type { GridNode } from '../grid/types';
7
- import type { TableCollection as ITableCollection, TableCollectionOptions } from './types';
5
+ import type { Key } from "../collections/types";
6
+ import type { GridNode } from "../grid/types";
7
+ import type { TableCollection as ITableCollection, TableCollectionOptions } from "./types";
8
8
  /**
9
9
  * Creates a table collection from column and row definitions.
10
10
  */
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Table column resize state management.
3
+ * Based on @react-stately/table/useTableColumnResizeState.
4
+ *
5
+ * Provides column width state management for a table with column resizing.
6
+ * Tracks column widths, the currently resizing column, and handles
7
+ * width distribution and clamping.
8
+ */
9
+ import { type Accessor } from "solid-js";
10
+ import type { Key } from "../collections/types";
11
+ /** Column size: a number (px) or a string ('100px', '50%', '1fr'). */
12
+ export type ColumnSize = number | string;
13
+ export interface ColumnResizeDefinition {
14
+ /** The column key. */
15
+ key: Key;
16
+ /** The width of the column. Numbers are px, strings can be 'Xfr', 'Xpx', or 'X%'. */
17
+ width?: ColumnSize;
18
+ /** Minimum width in pixels. Default: 75. */
19
+ minWidth?: number;
20
+ /** Maximum width in pixels. Default: Infinity. */
21
+ maxWidth?: number;
22
+ }
23
+ export interface TableColumnResizeStateProps {
24
+ /** Current width of the table or table viewport. */
25
+ tableWidth: number;
26
+ /** Column definitions with width/min/max. */
27
+ columns: ColumnResizeDefinition[];
28
+ }
29
+ export interface TableColumnResizeState {
30
+ /** The key of the column currently being resized, or null. */
31
+ readonly resizingColumn: Accessor<Key | null>;
32
+ /** A reactive map of computed column widths in pixels. */
33
+ readonly columnWidths: Accessor<Map<Key, number>>;
34
+ /** Begin a resize operation for the given column. */
35
+ startResize(key: Key): void;
36
+ /** End the current resize operation. */
37
+ endResize(): void;
38
+ /** Update column widths during a resize drag. Returns the new widths map. */
39
+ updateResizedColumns(key: Key, width: number): Map<Key, number>;
40
+ /** Get the current computed width for a column. */
41
+ getColumnWidth(key: Key): number;
42
+ /** Get the minimum width for a column. */
43
+ getColumnMinWidth(key: Key): number;
44
+ /** Get the maximum width for a column. */
45
+ getColumnMaxWidth(key: Key): number;
46
+ }
47
+ /**
48
+ * Creates column resize state for a table component.
49
+ *
50
+ * Builds an initial column width map from column definitions + table width,
51
+ * then tracks resize operations that clamp to min/max and redistribute
52
+ * remaining space among flex columns.
53
+ */
54
+ export declare function createTableColumnResizeState(props: Accessor<TableColumnResizeStateProps>): TableColumnResizeState;
@@ -2,8 +2,8 @@
2
2
  * Table state management for Table components.
3
3
  * Based on @react-stately/table/useTableState.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import type { TableState, TableStateOptions, TableCollection } from './types';
5
+ import { type Accessor } from "solid-js";
6
+ import type { TableState, TableStateOptions, TableCollection } from "./types";
7
7
  /**
8
8
  * Creates state management for a table component.
9
9
  * Extends grid state with sorting and table-specific features.
@@ -2,6 +2,8 @@
2
2
  * Table state management module.
3
3
  * Provides state hooks for Table components.
4
4
  */
5
- export { createTableState } from './createTableState';
6
- export { TableCollection, createTableCollection } from './TableCollection';
7
- export type { TableState, TableStateOptions, TableCollection as ITableCollection, SortDescriptor, SortDirection, Sortable, ColumnDefinition, RowDefinition, TableCollectionOptions, } from './types';
5
+ export { createTableState } from "./createTableState";
6
+ export { createTableColumnResizeState } from "./createTableColumnResizeState";
7
+ export { TableCollection, createTableCollection } from "./TableCollection";
8
+ export type { TableState, TableStateOptions, TableCollection as ITableCollection, SortDescriptor, SortDirection, Sortable, ColumnDefinition, RowDefinition, TableCollectionOptions, } from "./types";
9
+ export type { ColumnSize, ColumnResizeDefinition, TableColumnResizeStateProps, TableColumnResizeState, } from "./createTableColumnResizeState";
@@ -2,12 +2,12 @@
2
2
  * Table state types for Table components.
3
3
  * Based on @react-stately/table and @react-types/table.
4
4
  */
5
- import type { Key } from '../collections/types';
6
- import type { GridState, GridCollection, GridNode } from '../grid/types';
5
+ import type { Key } from "../collections/types";
6
+ import type { GridState, GridCollection, GridNode } from "../grid/types";
7
7
  /**
8
8
  * Sort direction for table columns.
9
9
  */
10
- export type SortDirection = 'ascending' | 'descending';
10
+ export type SortDirection = "ascending" | "descending";
11
11
  /**
12
12
  * Describes which column to sort by and in what direction.
13
13
  */
@@ -46,7 +46,7 @@ export interface TableCollection<T = unknown> extends GridCollection<T> {
46
46
  * State for a table component.
47
47
  * Extends GridState with table-specific functionality.
48
48
  */
49
- export interface TableState<T, C extends TableCollection<T> = TableCollection<T>> extends Omit<GridState<T, GridCollection<T>>, 'collection'> {
49
+ export interface TableState<T, C extends TableCollection<T> = TableCollection<T>> extends Omit<GridState<T, GridCollection<T>>, "collection"> {
50
50
  /** The table collection. */
51
51
  readonly collection: C;
52
52
  /** Whether the row selection checkboxes should be displayed. */
@@ -65,19 +65,19 @@ export interface TableStateOptions<T, C extends TableCollection<T> = TableCollec
65
65
  /** Keys of disabled rows. */
66
66
  disabledKeys?: Iterable<Key>;
67
67
  /** Focus mode: 'row' or 'cell'. */
68
- focusMode?: 'row' | 'cell';
68
+ focusMode?: "row" | "cell";
69
69
  /** Selection mode. */
70
- selectionMode?: 'none' | 'single' | 'multiple';
70
+ selectionMode?: "none" | "single" | "multiple";
71
71
  /** Selection behavior. */
72
- selectionBehavior?: 'toggle' | 'replace';
72
+ selectionBehavior?: "toggle" | "replace";
73
73
  /** Whether empty selection is disallowed. */
74
74
  disallowEmptySelection?: boolean;
75
75
  /** Currently selected keys (controlled). */
76
- selectedKeys?: 'all' | Iterable<Key>;
76
+ selectedKeys?: "all" | Iterable<Key>;
77
77
  /** Default selected keys (uncontrolled). */
78
- defaultSelectedKeys?: 'all' | Iterable<Key>;
78
+ defaultSelectedKeys?: "all" | Iterable<Key>;
79
79
  /** Handler for selection changes. */
80
- onSelectionChange?: (keys: 'all' | Set<Key>) => void;
80
+ onSelectionChange?: (keys: "all" | Set<Key>) => void;
81
81
  /** Whether the row selection checkboxes should be displayed. */
82
82
  showSelectionCheckboxes?: boolean;
83
83
  }
@@ -2,11 +2,11 @@
2
2
  * State management for tab components.
3
3
  * Based on @react-stately/tabs.
4
4
  */
5
- import { type Accessor } from 'solid-js';
6
- import { type MaybeAccessor } from '../utils';
7
- import type { Collection, CollectionNode, Key, FocusStrategy } from '../collections/types';
8
- export type KeyboardActivation = 'automatic' | 'manual';
9
- export type TabOrientation = 'horizontal' | 'vertical';
5
+ import { type Accessor } from "solid-js";
6
+ import { type MaybeAccessor } from "../utils";
7
+ import type { Collection, CollectionNode, Key, FocusStrategy } from "../collections/types";
8
+ export type KeyboardActivation = "automatic" | "manual";
9
+ export type TabOrientation = "horizontal" | "vertical";
10
10
  export interface TabListStateProps<T = unknown> {
11
11
  /** The items in the tab list. */
12
12
  items?: T[];
@@ -1 +1 @@
1
- export { createTabListState, type TabListStateProps, type TabListState, type KeyboardActivation, type TabOrientation, } from './createTabListState';
1
+ export { createTabListState, type TabListStateProps, type TabListState, type KeyboardActivation, type TabOrientation, } from "./createTabListState";
@@ -6,8 +6,8 @@
6
6
  * This is a port of @react-stately/utils's useControlledState pattern
7
7
  * as used by @react-aria/textfield.
8
8
  */
9
- import { Accessor } from 'solid-js';
10
- import { type MaybeAccessor } from '../utils';
9
+ import { Accessor } from "solid-js";
10
+ import { type MaybeAccessor } from "../utils";
11
11
  export interface TextFieldStateOptions {
12
12
  /** The current value (controlled). */
13
13
  value?: string;
@@ -1 +1 @@
1
- export { createTextFieldState, type TextFieldStateOptions, type TextFieldState, } from './createTextFieldState';
1
+ export { createTextFieldState, type TextFieldStateOptions, type TextFieldState, } from "./createTextFieldState";
@@ -2,7 +2,7 @@
2
2
  * Toast state management for SolidJS
3
3
  * Based on @react-stately/toast useToastState
4
4
  */
5
- import { type Accessor } from 'solid-js';
5
+ import { type Accessor } from "solid-js";
6
6
  export interface ToastOptions {
7
7
  /** A timeout to automatically close the toast, in milliseconds. */
8
8
  timeout?: number;
@@ -19,7 +19,7 @@ export interface QueuedToast<T> {
19
19
  /** The timer for the toast. */
20
20
  timer: Timer | null;
21
21
  /** Whether the toast should be animated. */
22
- animation?: 'entering' | 'exiting' | 'queued';
22
+ animation?: "entering" | "exiting" | "queued";
23
23
  /** The priority of the toast. */
24
24
  priority: number;
25
25
  /** Handler called when the toast is closed. */
@@ -42,8 +42,16 @@ export interface ToastState<T> {
42
42
  visibleToasts: Accessor<QueuedToast<T>[]>;
43
43
  /** Adds a toast to the queue. */
44
44
  add: (content: T, options?: ToastOptions) => string;
45
- /** Closes a toast by key. */
45
+ /** Closes a toast by key. Starts exit animation if hasExitAnimation is enabled. */
46
46
  close: (key: string) => void;
47
+ /**
48
+ * Removes a toast after exit animation completes.
49
+ * Call this from the component layer when the CSS exit animation finishes.
50
+ * If hasExitAnimation is false, close() removes immediately and this is not needed.
51
+ */
52
+ remove: (key: string) => void;
53
+ /** Clears all queued and visible toasts. */
54
+ clear: () => void;
47
55
  /** Pauses all toast timers. */
48
56
  pauseAll: () => void;
49
57
  /** Resumes all toast timers. */
@@ -91,6 +99,10 @@ export declare class ToastQueue<T> {
91
99
  * Remove a toast after exit animation completes.
92
100
  */
93
101
  remove(key: string): void;
102
+ /**
103
+ * Clear all queued and visible toasts.
104
+ */
105
+ clear(): void;
94
106
  /**
95
107
  * Pause all toast timers.
96
108
  */
@@ -1 +1 @@
1
- export { createToastState, createToastQueue, ToastQueue, Timer, type ToastOptions, type QueuedToast, type ToastQueueOptions, type ToastStateProps, type ToastState, } from './createToastState';
1
+ export { createToastState, createToastQueue, ToastQueue, Timer, type ToastOptions, type QueuedToast, type ToastQueueOptions, type ToastStateProps, type ToastState, } from "./createToastState";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Toggle group state for Solid Stately
3
+ *
4
+ * Provides state management for groups of toggle buttons with
5
+ * single or multiple selection.
6
+ *
7
+ * This is a port of @react-stately/toggle's useToggleGroupState.
8
+ */
9
+ import type { Key } from "../collections";
10
+ import { type MaybeAccessor } from "../utils";
11
+ export interface ToggleGroupProps {
12
+ /**
13
+ * Whether single or multiple selection is enabled.
14
+ * @default 'single'
15
+ */
16
+ selectionMode?: "single" | "multiple";
17
+ /** Whether empty selection is disallowed. */
18
+ disallowEmptySelection?: boolean;
19
+ /** Controlled selected keys. */
20
+ selectedKeys?: Iterable<Key>;
21
+ /** Uncontrolled initial selected keys. */
22
+ defaultSelectedKeys?: Iterable<Key>;
23
+ /** Called when selected keys change. */
24
+ onSelectionChange?: (keys: Set<Key>) => void;
25
+ /** Whether all items are disabled. */
26
+ isDisabled?: boolean;
27
+ }
28
+ export interface ToggleGroupState {
29
+ /** Whether single or multiple selection is enabled. */
30
+ readonly selectionMode: "single" | "multiple";
31
+ /** Whether all items are disabled. */
32
+ readonly isDisabled: boolean;
33
+ /** Current selected keys. */
34
+ readonly selectedKeys: Set<Key>;
35
+ /** Toggles selected state for a key. */
36
+ toggleKey(key: Key): void;
37
+ /** Sets selected state for a key. */
38
+ setSelected(key: Key, isSelected: boolean): void;
39
+ /** Replaces selected keys. */
40
+ setSelectedKeys(keys: Set<Key>): void;
41
+ }
42
+ /**
43
+ * Manages state for a group of toggle buttons.
44
+ */
45
+ export declare function createToggleGroupState(props?: MaybeAccessor<ToggleGroupProps>): ToggleGroupState;
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * This is a 1:1 port of @react-stately/toggle's useToggleState.
7
7
  */
8
- import { Accessor } from 'solid-js';
9
- import { type MaybeAccessor } from '../utils';
8
+ import { Accessor } from "solid-js";
9
+ import { type MaybeAccessor } from "../utils";
10
10
  export interface ToggleStateOptions {
11
11
  /** Whether the element should be selected (controlled). */
12
12
  isSelected?: boolean;
@@ -1 +1,2 @@
1
- export { createToggleState, type ToggleStateOptions, type ToggleState, } from './createToggleState';
1
+ export { createToggleState, type ToggleStateOptions, type ToggleState } from "./createToggleState";
2
+ export { createToggleGroupState, type ToggleGroupProps, type ToggleGroupState, } from "./createToggleGroupState";
@@ -5,8 +5,8 @@
5
5
  * Tracks whether the tooltip is open, and provides methods to toggle this state.
6
6
  * Ensures only one tooltip is open at a time and controls the delay for showing a tooltip.
7
7
  */
8
- import { type Accessor } from 'solid-js';
9
- import { type OverlayTriggerProps } from '../overlays';
8
+ import { type Accessor } from "solid-js";
9
+ import { type OverlayTriggerProps } from "../overlays";
10
10
  export interface TooltipTriggerProps extends OverlayTriggerProps {
11
11
  /** The delay time in milliseconds for the tooltip to show up. */
12
12
  delay?: number;
@@ -1 +1 @@
1
- export { createTooltipTriggerState, resetTooltipState, type TooltipTriggerProps, type TooltipTriggerState, } from './createTooltipTriggerState';
1
+ export { createTooltipTriggerState, resetTooltipState, type TooltipTriggerProps, type TooltipTriggerState, } from "./createTooltipTriggerState";
@@ -5,16 +5,17 @@
5
5
  * A flattened view of tree nodes that respects expanded state.
6
6
  * Only visible nodes (root + expanded children) are included in iteration.
7
7
  */
8
- import type { Key } from '../collections/types';
9
- import type { TreeCollection as ITreeCollection, TreeNode, TreeItemData } from './types';
8
+ import type { Key } from "../collections/types";
9
+ import type { TreeCollection as ITreeCollection, TreeNode, TreeItemData } from "./types";
10
10
  /**
11
11
  * Creates a TreeCollection from hierarchical data.
12
12
  * The collection is flattened based on expanded keys.
13
13
  */
14
14
  export declare class TreeCollection<T> implements ITreeCollection<T> {
15
15
  private keyMap;
16
- private visibleKeys;
17
- private _rows;
16
+ private visibleRows;
17
+ private firstKey;
18
+ private lastKey;
18
19
  constructor(items: TreeItemData<T>[], expandedKeys: Set<Key>);
19
20
  private buildCollection;
20
21
  get size(): number;
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * Manages expansion state, selection, and focus for hierarchical tree data.
6
6
  */
7
- import { type Accessor } from 'solid-js';
8
- import type { TreeState, TreeStateOptions, TreeCollection } from './types';
7
+ import { type Accessor } from "solid-js";
8
+ import type { TreeState, TreeStateOptions, TreeCollection } from "./types";
9
9
  /**
10
10
  * Creates state management for a tree component.
11
11
  * Handles expansion, selection, focus management, and keyboard navigation state.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Tree state management exports.
3
3
  */
4
- export { createTreeState } from './createTreeState';
5
- export { TreeCollection, createTreeCollection } from './TreeCollection';
6
- export type { TreeState, TreeStateOptions, TreeCollection as TreeCollectionInterface, TreeNode, TreeItemData, } from './types';
4
+ export { createTreeState } from "./createTreeState";
5
+ export { TreeCollection, createTreeCollection } from "./TreeCollection";
6
+ export type { TreeState, TreeStateOptions, TreeCollection as TreeCollectionInterface, TreeNode, TreeItemData, } from "./types";