@proyecto-viviana/solid-stately 0.1.5 → 0.2.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 (217) hide show
  1. package/{src → dist}/autocomplete/createAutocompleteState.d.ts +0 -1
  2. package/{src → dist}/autocomplete/index.d.ts +0 -1
  3. package/{src → dist}/calendar/createCalendarState.d.ts +0 -1
  4. package/{src → dist}/calendar/createDateFieldState.d.ts +0 -1
  5. package/{src → dist}/calendar/createRangeCalendarState.d.ts +0 -1
  6. package/{src → dist}/calendar/createTimeFieldState.d.ts +0 -1
  7. package/{src → dist}/calendar/index.d.ts +0 -1
  8. package/{src → dist}/checkbox/createCheckboxGroupState.d.ts +0 -1
  9. package/{src → dist}/checkbox/index.d.ts +0 -1
  10. package/{src → dist}/collections/ListCollection.d.ts +0 -1
  11. package/{src → dist}/collections/createListState.d.ts +0 -1
  12. package/{src → dist}/collections/createMenuState.d.ts +0 -1
  13. package/{src → dist}/collections/createSelectionState.d.ts +0 -1
  14. package/{src → dist}/collections/index.d.ts +0 -1
  15. package/{src → dist}/collections/types.d.ts +0 -1
  16. package/{src → dist}/color/Color.d.ts +0 -1
  17. package/{src → dist}/color/createColorAreaState.d.ts +0 -1
  18. package/{src → dist}/color/createColorFieldState.d.ts +0 -1
  19. package/{src → dist}/color/createColorSliderState.d.ts +0 -1
  20. package/{src → dist}/color/createColorWheelState.d.ts +0 -1
  21. package/{src → dist}/color/index.d.ts +0 -1
  22. package/{src → dist}/color/types.d.ts +0 -1
  23. package/{src → dist}/combobox/createComboBoxState.d.ts +0 -1
  24. package/{src → dist}/combobox/index.d.ts +0 -1
  25. package/{src → dist}/disclosure/createDisclosureState.d.ts +0 -1
  26. package/{src → dist}/disclosure/index.d.ts +0 -1
  27. package/{src → dist}/dnd/createDragState.d.ts +0 -1
  28. package/{src → dist}/dnd/createDraggableCollectionState.d.ts +0 -1
  29. package/{src → dist}/dnd/createDropState.d.ts +0 -1
  30. package/{src → dist}/dnd/createDroppableCollectionState.d.ts +0 -1
  31. package/{src → dist}/dnd/index.d.ts +0 -1
  32. package/{src → dist}/dnd/types.d.ts +0 -1
  33. package/{src → dist}/form/createFormValidationState.d.ts +0 -1
  34. package/{src → dist}/form/index.d.ts +0 -1
  35. package/{src → dist}/grid/createGridState.d.ts +0 -1
  36. package/{src → dist}/grid/index.d.ts +0 -1
  37. package/{src → dist}/grid/types.d.ts +0 -1
  38. package/dist/index.d.ts +25 -3363
  39. package/dist/index.js +2 -2
  40. package/dist/index.js.map +7 -1
  41. package/{src → dist}/numberfield/createNumberFieldState.d.ts +0 -1
  42. package/{src → dist}/numberfield/index.d.ts +0 -1
  43. package/{src → dist}/overlays/createOverlayTriggerState.d.ts +0 -1
  44. package/{src → dist}/overlays/index.d.ts +0 -1
  45. package/{src → dist}/radio/createRadioGroupState.d.ts +0 -1
  46. package/{src → dist}/radio/index.d.ts +0 -1
  47. package/{src → dist}/searchfield/createSearchFieldState.d.ts +0 -1
  48. package/{src → dist}/searchfield/index.d.ts +0 -1
  49. package/{src → dist}/select/createSelectState.d.ts +0 -1
  50. package/{src → dist}/select/index.d.ts +0 -1
  51. package/{src → dist}/slider/createSliderState.d.ts +0 -1
  52. package/{src → dist}/slider/index.d.ts +0 -1
  53. package/{src → dist}/ssr/index.d.ts +0 -1
  54. package/{src → dist}/table/TableCollection.d.ts +0 -1
  55. package/{src → dist}/table/createTableState.d.ts +0 -1
  56. package/{src → dist}/table/index.d.ts +0 -1
  57. package/{src → dist}/table/types.d.ts +0 -1
  58. package/{src → dist}/tabs/createTabListState.d.ts +0 -1
  59. package/{src → dist}/tabs/index.d.ts +0 -1
  60. package/{src → dist}/textfield/createTextFieldState.d.ts +0 -1
  61. package/{src → dist}/textfield/index.d.ts +0 -1
  62. package/{src → dist}/toast/createToastState.d.ts +0 -1
  63. package/{src → dist}/toast/index.d.ts +0 -1
  64. package/{src → dist}/toggle/createToggleState.d.ts +0 -1
  65. package/{src → dist}/toggle/index.d.ts +0 -1
  66. package/{src → dist}/tooltip/createTooltipTriggerState.d.ts +0 -1
  67. package/{src → dist}/tooltip/index.d.ts +0 -1
  68. package/{src → dist}/tree/TreeCollection.d.ts +0 -1
  69. package/{src → dist}/tree/createTreeState.d.ts +0 -1
  70. package/{src → dist}/tree/index.d.ts +0 -1
  71. package/{src → dist}/tree/types.d.ts +0 -1
  72. package/{src → dist}/utils/reactivity.d.ts +0 -1
  73. package/package.json +5 -7
  74. package/src/autocomplete/createAutocompleteState.d.ts.map +0 -1
  75. package/src/autocomplete/createAutocompleteState.ts +0 -90
  76. package/src/autocomplete/index.d.ts.map +0 -1
  77. package/src/autocomplete/index.ts +0 -5
  78. package/src/calendar/createCalendarState.d.ts.map +0 -1
  79. package/src/calendar/createCalendarState.ts +0 -461
  80. package/src/calendar/createDateFieldState.d.ts.map +0 -1
  81. package/src/calendar/createDateFieldState.ts +0 -562
  82. package/src/calendar/createRangeCalendarState.d.ts.map +0 -1
  83. package/src/calendar/createRangeCalendarState.ts +0 -535
  84. package/src/calendar/createTimeFieldState.d.ts.map +0 -1
  85. package/src/calendar/createTimeFieldState.ts +0 -483
  86. package/src/calendar/index.d.ts.map +0 -1
  87. package/src/calendar/index.ts +0 -81
  88. package/src/checkbox/createCheckboxGroupState.d.ts.map +0 -1
  89. package/src/checkbox/createCheckboxGroupState.ts +0 -193
  90. package/src/checkbox/index.d.ts.map +0 -1
  91. package/src/checkbox/index.ts +0 -5
  92. package/src/collections/ListCollection.d.ts.map +0 -1
  93. package/src/collections/ListCollection.ts +0 -146
  94. package/src/collections/createListState.d.ts.map +0 -1
  95. package/src/collections/createListState.ts +0 -264
  96. package/src/collections/createMenuState.d.ts.map +0 -1
  97. package/src/collections/createMenuState.ts +0 -106
  98. package/src/collections/createSelectionState.d.ts.map +0 -1
  99. package/src/collections/createSelectionState.ts +0 -336
  100. package/src/collections/index.d.ts.map +0 -1
  101. package/src/collections/index.ts +0 -46
  102. package/src/collections/types.d.ts.map +0 -1
  103. package/src/collections/types.ts +0 -169
  104. package/src/color/Color.d.ts.map +0 -1
  105. package/src/color/Color.ts +0 -951
  106. package/src/color/createColorAreaState.d.ts.map +0 -1
  107. package/src/color/createColorAreaState.ts +0 -293
  108. package/src/color/createColorFieldState.d.ts.map +0 -1
  109. package/src/color/createColorFieldState.ts +0 -292
  110. package/src/color/createColorSliderState.d.ts.map +0 -1
  111. package/src/color/createColorSliderState.ts +0 -241
  112. package/src/color/createColorWheelState.d.ts.map +0 -1
  113. package/src/color/createColorWheelState.ts +0 -211
  114. package/src/color/index.d.ts.map +0 -1
  115. package/src/color/index.ts +0 -47
  116. package/src/color/types.d.ts.map +0 -1
  117. package/src/color/types.ts +0 -127
  118. package/src/combobox/createComboBoxState.d.ts.map +0 -1
  119. package/src/combobox/createComboBoxState.ts +0 -703
  120. package/src/combobox/index.d.ts.map +0 -1
  121. package/src/combobox/index.ts +0 -13
  122. package/src/disclosure/createDisclosureState.d.ts.map +0 -1
  123. package/src/disclosure/createDisclosureState.ts +0 -193
  124. package/src/disclosure/index.d.ts.map +0 -1
  125. package/src/disclosure/index.ts +0 -9
  126. package/src/dnd/createDragState.d.ts.map +0 -1
  127. package/src/dnd/createDragState.ts +0 -153
  128. package/src/dnd/createDraggableCollectionState.d.ts.map +0 -1
  129. package/src/dnd/createDraggableCollectionState.ts +0 -165
  130. package/src/dnd/createDropState.d.ts.map +0 -1
  131. package/src/dnd/createDropState.ts +0 -212
  132. package/src/dnd/createDroppableCollectionState.d.ts.map +0 -1
  133. package/src/dnd/createDroppableCollectionState.ts +0 -357
  134. package/src/dnd/index.d.ts.map +0 -1
  135. package/src/dnd/index.ts +0 -76
  136. package/src/dnd/types.d.ts.map +0 -1
  137. package/src/dnd/types.ts +0 -317
  138. package/src/form/createFormValidationState.d.ts.map +0 -1
  139. package/src/form/createFormValidationState.ts +0 -389
  140. package/src/form/index.d.ts.map +0 -1
  141. package/src/form/index.ts +0 -15
  142. package/src/grid/createGridState.d.ts.map +0 -1
  143. package/src/grid/createGridState.ts +0 -327
  144. package/src/grid/index.d.ts.map +0 -1
  145. package/src/grid/index.ts +0 -13
  146. package/src/grid/types.d.ts.map +0 -1
  147. package/src/grid/types.ts +0 -179
  148. package/src/index.d.ts +0 -26
  149. package/src/index.d.ts.map +0 -1
  150. package/src/index.ts +0 -383
  151. package/src/numberfield/createNumberFieldState.d.ts.map +0 -1
  152. package/src/numberfield/createNumberFieldState.ts +0 -383
  153. package/src/numberfield/index.d.ts.map +0 -1
  154. package/src/numberfield/index.ts +0 -5
  155. package/src/overlays/createOverlayTriggerState.d.ts.map +0 -1
  156. package/src/overlays/createOverlayTriggerState.ts +0 -67
  157. package/src/overlays/index.d.ts.map +0 -1
  158. package/src/overlays/index.ts +0 -5
  159. package/src/radio/createRadioGroupState.d.ts.map +0 -1
  160. package/src/radio/createRadioGroupState.ts +0 -201
  161. package/src/radio/index.d.ts.map +0 -1
  162. package/src/radio/index.ts +0 -6
  163. package/src/searchfield/createSearchFieldState.d.ts.map +0 -1
  164. package/src/searchfield/createSearchFieldState.ts +0 -62
  165. package/src/searchfield/index.d.ts.map +0 -1
  166. package/src/searchfield/index.ts +0 -5
  167. package/src/select/createSelectState.d.ts.map +0 -1
  168. package/src/select/createSelectState.ts +0 -181
  169. package/src/select/index.d.ts.map +0 -1
  170. package/src/select/index.ts +0 -5
  171. package/src/slider/createSliderState.d.ts.map +0 -1
  172. package/src/slider/createSliderState.ts +0 -211
  173. package/src/slider/index.d.ts.map +0 -1
  174. package/src/slider/index.ts +0 -6
  175. package/src/ssr/index.d.ts.map +0 -1
  176. package/src/ssr/index.ts +0 -41
  177. package/src/table/TableCollection.d.ts.map +0 -1
  178. package/src/table/TableCollection.ts +0 -388
  179. package/src/table/createTableState.d.ts.map +0 -1
  180. package/src/table/createTableState.ts +0 -127
  181. package/src/table/index.d.ts.map +0 -1
  182. package/src/table/index.ts +0 -18
  183. package/src/table/types.d.ts.map +0 -1
  184. package/src/table/types.ts +0 -150
  185. package/src/tabs/createTabListState.d.ts.map +0 -1
  186. package/src/tabs/createTabListState.ts +0 -240
  187. package/src/tabs/index.d.ts.map +0 -1
  188. package/src/tabs/index.ts +0 -7
  189. package/src/textfield/createTextFieldState.d.ts.map +0 -1
  190. package/src/textfield/createTextFieldState.ts +0 -75
  191. package/src/textfield/index.d.ts.map +0 -1
  192. package/src/textfield/index.ts +0 -5
  193. package/src/toast/createToastState.d.ts.map +0 -1
  194. package/src/toast/createToastState.ts +0 -316
  195. package/src/toast/index.d.ts.map +0 -1
  196. package/src/toast/index.ts +0 -11
  197. package/src/toggle/createToggleState.d.ts.map +0 -1
  198. package/src/toggle/createToggleState.ts +0 -94
  199. package/src/toggle/index.d.ts.map +0 -1
  200. package/src/toggle/index.ts +0 -5
  201. package/src/tooltip/createTooltipTriggerState.d.ts.map +0 -1
  202. package/src/tooltip/createTooltipTriggerState.ts +0 -183
  203. package/src/tooltip/index.d.ts.map +0 -1
  204. package/src/tooltip/index.ts +0 -6
  205. package/src/tree/TreeCollection.d.ts.map +0 -1
  206. package/src/tree/TreeCollection.ts +0 -175
  207. package/src/tree/createTreeState.d.ts.map +0 -1
  208. package/src/tree/createTreeState.ts +0 -392
  209. package/src/tree/index.d.ts.map +0 -1
  210. package/src/tree/index.ts +0 -13
  211. package/src/tree/types.d.ts.map +0 -1
  212. package/src/tree/types.ts +0 -174
  213. package/src/utils/index.d.ts +0 -2
  214. package/src/utils/index.d.ts.map +0 -1
  215. package/src/utils/reactivity.d.ts.map +0 -1
  216. package/src/utils/reactivity.ts +0 -36
  217. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -1,106 +0,0 @@
1
- /**
2
- * State management for menu components.
3
- * Based on @react-stately/menu.
4
- */
5
-
6
- import { access, type MaybeAccessor } from '../utils';
7
- import { createListState, type ListState, type ListStateProps } from './createListState';
8
- import type { Key } from './types';
9
-
10
- export interface MenuStateProps<T = unknown>
11
- extends Omit<ListStateProps<T>, 'selectionMode' | 'disallowEmptySelection'> {
12
- /** Handler called when an item is activated (pressed). */
13
- onAction?: (key: Key) => void;
14
- /** Handler called when the menu should close. */
15
- onClose?: () => void;
16
- }
17
-
18
- export interface MenuState<T = unknown> extends ListState<T> {
19
- /** Close the menu. */
20
- close(): void;
21
- }
22
-
23
- /**
24
- * Creates state for a menu component.
25
- * Menus are single-select lists that support actions.
26
- */
27
- export function createMenuState<T = unknown>(
28
- props: MaybeAccessor<MenuStateProps<T>>
29
- ): MenuState<T> {
30
- const getProps = () => access(props);
31
-
32
- // Create list state with single selection
33
- const listState = createListState<T>({
34
- get items() {
35
- return getProps().items;
36
- },
37
- get getKey() {
38
- return getProps().getKey;
39
- },
40
- get getTextValue() {
41
- return getProps().getTextValue;
42
- },
43
- get getDisabled() {
44
- return getProps().getDisabled;
45
- },
46
- get disabledKeys() {
47
- return getProps().disabledKeys;
48
- },
49
- get disabledBehavior() {
50
- return getProps().disabledBehavior;
51
- },
52
- selectionMode: 'none', // Menus typically use onAction, not selection
53
- disallowEmptySelection: true,
54
- get selectedKeys() {
55
- return getProps().selectedKeys;
56
- },
57
- get defaultSelectedKeys() {
58
- return getProps().defaultSelectedKeys;
59
- },
60
- get onSelectionChange() {
61
- return getProps().onSelectionChange;
62
- },
63
- get selectionBehavior() {
64
- return getProps().selectionBehavior;
65
- },
66
- });
67
-
68
- const close = () => {
69
- getProps().onClose?.();
70
- };
71
-
72
- return {
73
- ...listState,
74
- close,
75
- };
76
- }
77
-
78
- export interface MenuTriggerStateProps {
79
- /** Whether the menu is open (controlled). */
80
- isOpen?: boolean;
81
- /** Default open state (uncontrolled). */
82
- defaultOpen?: boolean;
83
- /** Handler called when the open state changes. */
84
- onOpenChange?: (isOpen: boolean) => void;
85
- }
86
-
87
- export interface MenuTriggerState {
88
- /** Whether the menu is open. */
89
- readonly isOpen: () => boolean;
90
- /** Open the menu. */
91
- open(): void;
92
- /** Close the menu. */
93
- close(): void;
94
- /** Toggle the menu. */
95
- toggle(): void;
96
- /** Focus strategy for when the menu opens. */
97
- readonly focusStrategy: () => 'first' | 'last' | null;
98
- /** Set the focus strategy. */
99
- setFocusStrategy(strategy: 'first' | 'last' | null): void;
100
- }
101
-
102
- /**
103
- * Creates state for a menu trigger (button that opens a menu).
104
- * This is essentially the same as overlay trigger state but with focus strategy.
105
- */
106
- export { createOverlayTriggerState as createMenuTriggerState } from '../overlays';
@@ -1 +0,0 @@
1
- {"version":3,"file":"createSelectionState.d.ts","sourceRoot":"","sources":["createSelectionState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAEhB,GAAG,EACH,SAAS,EACT,iBAAiB,EACjB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,6CAA6C;IAC7C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4CAA4C;IAC5C,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrC,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5C,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAC9C,8BAA8B;IAC9B,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mDAAmD;IACnD,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,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AAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1D,yCAAyC;IACzC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CACnH;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,GAAE,aAAa,CAAC,mBAAmB,CAAM,GAC7C,cAAc,CAgPhB"}
@@ -1,336 +0,0 @@
1
- /**
2
- * Selection state management for collections.
3
- * Based on @react-stately/selection.
4
- */
5
-
6
- import { createSignal, type Accessor } from 'solid-js';
7
- import { access, type MaybeAccessor } from '../utils';
8
- import type {
9
- Collection,
10
- DisabledBehavior,
11
- FocusStrategy,
12
- Key,
13
- Selection,
14
- SelectionBehavior,
15
- SelectionMode,
16
- } from './types';
17
-
18
- export interface SelectionStateProps {
19
- /** The selection mode. */
20
- selectionMode?: SelectionMode;
21
- /** How selection behaves on interaction. */
22
- selectionBehavior?: SelectionBehavior;
23
- /** Whether empty selection is disallowed. */
24
- disallowEmptySelection?: boolean;
25
- /** Currently selected keys (controlled). */
26
- selectedKeys?: 'all' | Iterable<Key>;
27
- /** Default selected keys (uncontrolled). */
28
- defaultSelectedKeys?: 'all' | Iterable<Key>;
29
- /** Handler for selection changes. */
30
- onSelectionChange?: (keys: Selection) => void;
31
- /** Keys of disabled items. */
32
- disabledKeys?: Iterable<Key>;
33
- /** How disabled keys behave. */
34
- disabledBehavior?: DisabledBehavior;
35
- /** Whether to allow duplicate selection events. */
36
- allowDuplicateSelectionEvents?: boolean;
37
- }
38
-
39
- export interface SelectionState {
40
- /** The selection mode. */
41
- readonly selectionMode: Accessor<SelectionMode>;
42
- /** The selection behavior. */
43
- readonly selectionBehavior: Accessor<SelectionBehavior>;
44
- /** Whether empty selection is disallowed. */
45
- readonly disallowEmptySelection: Accessor<boolean>;
46
- /** The currently selected keys. */
47
- readonly selectedKeys: Accessor<Selection>;
48
- /** Set of disabled keys. */
49
- readonly disabledKeys: Accessor<Set<Key>>;
50
- /** How disabled keys behave. */
51
- readonly disabledBehavior: Accessor<DisabledBehavior>;
52
- /** Whether the selection is empty. */
53
- readonly isEmpty: Accessor<boolean>;
54
- /** Whether all items are selected. */
55
- readonly isSelectAll: Accessor<boolean>;
56
- /** Check if a key is selected. */
57
- isSelected(key: Key): boolean;
58
- /** Check if a key is disabled. */
59
- isDisabled(key: Key): boolean;
60
- /** Set the selection behavior. */
61
- setSelectionBehavior(behavior: SelectionBehavior): void;
62
- /** Toggle selection for a key. */
63
- toggleSelection(key: Key): void;
64
- /** Replace selection with a single key. */
65
- replaceSelection(key: Key): void;
66
- /** Set multiple selected keys. */
67
- setSelectedKeys(keys: Iterable<Key>): void;
68
- /** Select all items. */
69
- selectAll(): void;
70
- /** Clear all selection. */
71
- clearSelection(): void;
72
- /** Toggle between select all and clear. */
73
- toggleSelectAll(): void;
74
- /** Extend selection to a key (for shift-click). */
75
- extendSelection(toKey: Key, collection: Collection): void;
76
- /** Select a key based on interaction. */
77
- select(key: Key, e?: { shiftKey?: boolean; ctrlKey?: boolean; metaKey?: boolean }, collection?: Collection): void;
78
- }
79
-
80
- /**
81
- * Creates selection state for a collection.
82
- */
83
- export function createSelectionState(
84
- props: MaybeAccessor<SelectionStateProps> = {}
85
- ): SelectionState {
86
- const getProps = () => access(props);
87
-
88
- // Selection behavior state
89
- const [internalBehavior, setInternalBehavior] = createSignal<SelectionBehavior>('toggle');
90
-
91
- // Internal selection state
92
- const [internalSelectedKeys, setInternalSelectedKeys] = createSignal<Selection>(
93
- getInitialSelection(getProps().defaultSelectedKeys)
94
- );
95
-
96
- // Track anchor for range selection
97
- const [anchorKey, setAnchorKey] = createSignal<Key | null>(null);
98
-
99
- // Computed values
100
- const selectionMode: Accessor<SelectionMode> = () => getProps().selectionMode ?? 'none';
101
-
102
- const selectionBehavior: Accessor<SelectionBehavior> = () => {
103
- return getProps().selectionBehavior ?? internalBehavior();
104
- };
105
-
106
- const disallowEmptySelection: Accessor<boolean> = () => {
107
- return getProps().disallowEmptySelection ?? false;
108
- };
109
-
110
- const selectedKeys: Accessor<Selection> = () => {
111
- const p = getProps();
112
- if (p.selectedKeys !== undefined) {
113
- return normalizeSelection(p.selectedKeys);
114
- }
115
- return internalSelectedKeys();
116
- };
117
-
118
- const disabledKeys: Accessor<Set<Key>> = () => {
119
- const keys = getProps().disabledKeys;
120
- return keys ? new Set(keys) : new Set();
121
- };
122
-
123
- const disabledBehavior: Accessor<DisabledBehavior> = () => {
124
- return getProps().disabledBehavior ?? 'all';
125
- };
126
-
127
- const isEmpty: Accessor<boolean> = () => {
128
- const keys = selectedKeys();
129
- return keys !== 'all' && keys.size === 0;
130
- };
131
-
132
- const isSelectAll: Accessor<boolean> = () => {
133
- return selectedKeys() === 'all';
134
- };
135
-
136
- // Methods
137
- const isSelected = (key: Key): boolean => {
138
- const keys = selectedKeys();
139
- if (keys === 'all') return true;
140
- return keys.has(key);
141
- };
142
-
143
- const isDisabled = (key: Key): boolean => {
144
- return disabledKeys().has(key);
145
- };
146
-
147
- const updateSelection = (newSelection: Selection) => {
148
- const p = getProps();
149
-
150
- // Controlled mode
151
- if (p.selectedKeys !== undefined) {
152
- p.onSelectionChange?.(newSelection);
153
- return;
154
- }
155
-
156
- // Uncontrolled mode
157
- const current = internalSelectedKeys();
158
- const isDifferent =
159
- current === 'all' ||
160
- newSelection === 'all' ||
161
- current.size !== (newSelection as Set<Key>).size ||
162
- ![...current].every((k) => (newSelection as Set<Key>).has(k));
163
-
164
- if (isDifferent || p.allowDuplicateSelectionEvents) {
165
- setInternalSelectedKeys(newSelection);
166
- p.onSelectionChange?.(newSelection);
167
- }
168
- };
169
-
170
- const toggleSelection = (key: Key) => {
171
- if (isDisabled(key)) return;
172
- if (selectionMode() === 'none') return;
173
-
174
- const current = selectedKeys();
175
-
176
- if (selectionMode() === 'single') {
177
- if (isSelected(key) && !disallowEmptySelection()) {
178
- updateSelection(new Set());
179
- } else {
180
- updateSelection(new Set([key]));
181
- }
182
- return;
183
- }
184
-
185
- // Multiple selection
186
- if (current === 'all') {
187
- // Can't toggle when all selected without collection
188
- return;
189
- }
190
-
191
- const newSelection = new Set(current);
192
- if (newSelection.has(key)) {
193
- if (newSelection.size > 1 || !disallowEmptySelection()) {
194
- newSelection.delete(key);
195
- }
196
- } else {
197
- newSelection.add(key);
198
- }
199
-
200
- updateSelection(newSelection);
201
- setAnchorKey(key);
202
- };
203
-
204
- const replaceSelection = (key: Key) => {
205
- if (isDisabled(key)) return;
206
- if (selectionMode() === 'none') return;
207
-
208
- updateSelection(new Set([key]));
209
- setAnchorKey(key);
210
- };
211
-
212
- const setSelectedKeys = (keys: Iterable<Key>) => {
213
- const filtered = [...keys].filter((k) => !isDisabled(k));
214
- updateSelection(new Set(filtered));
215
- };
216
-
217
- const selectAll = () => {
218
- if (selectionMode() !== 'multiple') return;
219
- updateSelection('all');
220
- };
221
-
222
- const clearSelection = () => {
223
- if (disallowEmptySelection()) return;
224
- updateSelection(new Set());
225
- };
226
-
227
- const toggleSelectAll = () => {
228
- if (selectionMode() !== 'multiple') return;
229
-
230
- if (isSelectAll()) {
231
- clearSelection();
232
- } else {
233
- selectAll();
234
- }
235
- };
236
-
237
- const extendSelection = (toKey: Key, collection: Collection) => {
238
- if (isDisabled(toKey)) return;
239
- if (selectionMode() !== 'multiple') {
240
- replaceSelection(toKey);
241
- return;
242
- }
243
-
244
- const anchor = anchorKey();
245
- if (!anchor) {
246
- replaceSelection(toKey);
247
- return;
248
- }
249
-
250
- // Get keys between anchor and toKey
251
- const keys = [...collection.getKeys()];
252
- const anchorIndex = keys.indexOf(anchor);
253
- const toIndex = keys.indexOf(toKey);
254
-
255
- if (anchorIndex === -1 || toIndex === -1) {
256
- replaceSelection(toKey);
257
- return;
258
- }
259
-
260
- const start = Math.min(anchorIndex, toIndex);
261
- const end = Math.max(anchorIndex, toIndex);
262
- const rangeKeys = keys.slice(start, end + 1).filter((k) => !isDisabled(k));
263
-
264
- updateSelection(new Set(rangeKeys));
265
- };
266
-
267
- const select = (
268
- key: Key,
269
- e?: { shiftKey?: boolean; ctrlKey?: boolean; metaKey?: boolean },
270
- collection?: Collection
271
- ) => {
272
- if (isDisabled(key)) return;
273
- if (selectionMode() === 'none') return;
274
-
275
- const mode = selectionMode();
276
- const behavior = selectionBehavior();
277
-
278
- if (mode === 'single') {
279
- if (behavior === 'replace' || !isSelected(key)) {
280
- replaceSelection(key);
281
- } else if (!disallowEmptySelection()) {
282
- clearSelection();
283
- }
284
- return;
285
- }
286
-
287
- // Multiple selection
288
- if (e?.shiftKey && collection) {
289
- extendSelection(key, collection);
290
- return;
291
- }
292
-
293
- if (e?.ctrlKey || e?.metaKey || behavior === 'toggle') {
294
- toggleSelection(key);
295
- } else {
296
- replaceSelection(key);
297
- }
298
- };
299
-
300
- const setSelectionBehavior = (behavior: SelectionBehavior) => {
301
- setInternalBehavior(behavior);
302
- };
303
-
304
- return {
305
- selectionMode,
306
- selectionBehavior,
307
- disallowEmptySelection,
308
- selectedKeys,
309
- disabledKeys,
310
- disabledBehavior,
311
- isEmpty,
312
- isSelectAll,
313
- isSelected,
314
- isDisabled,
315
- setSelectionBehavior,
316
- toggleSelection,
317
- replaceSelection,
318
- setSelectedKeys,
319
- selectAll,
320
- clearSelection,
321
- toggleSelectAll,
322
- extendSelection,
323
- select,
324
- };
325
- }
326
-
327
- // Helper functions
328
- function getInitialSelection(defaultKeys?: 'all' | Iterable<Key>): Selection {
329
- if (defaultKeys === undefined) return new Set();
330
- return normalizeSelection(defaultKeys);
331
- }
332
-
333
- function normalizeSelection(keys: 'all' | Iterable<Key>): Selection {
334
- if (keys === 'all') return 'all';
335
- return new Set(keys);
336
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,GAAG,EACH,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxE,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC"}
@@ -1,46 +0,0 @@
1
- // Types
2
- export type {
3
- Key,
4
- SelectionMode,
5
- SelectionBehavior,
6
- Selection,
7
- FocusStrategy,
8
- DisabledBehavior,
9
- CollectionNode,
10
- Collection,
11
- ItemProps,
12
- SectionProps,
13
- CollectionBase,
14
- SingleSelection,
15
- MultipleSelection,
16
- } from './types';
17
-
18
- // List Collection
19
- export { ListCollection, createListCollection } from './ListCollection';
20
-
21
- // Selection State
22
- export {
23
- createSelectionState,
24
- type SelectionStateProps,
25
- type SelectionState,
26
- } from './createSelectionState';
27
-
28
- // List State
29
- export {
30
- createListState,
31
- createSingleSelectListState,
32
- type ListStateProps,
33
- type ListState,
34
- type SingleSelectListStateProps,
35
- type SingleSelectListState,
36
- } from './createListState';
37
-
38
- // Menu State
39
- export {
40
- createMenuState,
41
- createMenuTriggerState,
42
- type MenuStateProps,
43
- type MenuState,
44
- type MenuTriggerStateProps,
45
- type Menu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;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,0CAA0C;IAC1C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,gDAAgD;IAChD,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrC,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5C,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAC9C,8BAA8B;IAC9B,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;CAC9B"}
@@ -1,169 +0,0 @@
1
- /**
2
- * Core types for collection state management.
3
- * Simplified from @react-stately/collections for SolidJS.
4
- */
5
-
6
- import type { JSX } from 'solid-js';
7
-
8
- /** A unique identifier for an item in a collection. */
9
- export type Key = string | number;
10
-
11
- /** The type of selection allowed in a collection. */
12
- export type SelectionMode = 'none' | 'single' | 'multiple';
13
-
14
- /** How selection behaves when clicking on items. */
15
- export type SelectionBehavior = 'toggle' | 'replace';
16
-
17
- /** Represents the current selection state. */
18
- export type Selection = 'all' | Set<Key>;
19
-
20
- /** Strategy for focusing first or last item. */
21
- export type FocusStrategy = 'first' | 'last';
22
-
23
- /** Whether disabled keys affect selection, actions, or both. */
24
- export type DisabledBehavior = 'selection' | 'all';
25
-
26
- /**
27
- * Represents a node in a collection (item or section).
28
- */
29
- export interface CollectionNode<T = unknown> {
30
- /** The type of node: 'item' or 'section'. */
31
- type: 'item' | 'section';
32
- /** A unique key for the node. */
33
- key: Key;
34
- /** The original value/data for this node. */
35
- value: T | null;
36
- /** The text content for accessibility and typeahead. */
37
- textValue: string;
38
- /** The rendered content (JSX). */
39
- rendered: JSX.Element;
40
- /** The level of nesting (0 for top-level). */
41
- level: number;
42
- /** The index within the parent. */
43
- index: number;
44
- /** The key of the parent node, if any. */
45
- parentKey: Key | null;
46
- /** Whether this node has child nodes. */
47
- hasChildNodes: boolean;
48
- /** Child nodes, if any. */
49
- childNodes: CollectionNode<T>[];
50
- /** Whether this item is disabled. */
51
- isDisabled?: boolean;
52
- /** ARIA label for this node. */
53
- 'aria-label'?: string;
54
- /** Additional props for the node. */
55
- props?: Record<string, unknown>;
56
- }
57
-
58
- /**
59
- * A collection of nodes with methods to traverse and query.
60
- */
61
- export interface Collection<T = unknown> extends Iterable<CollectionNode<T>> {
62
- /** The number of items in the collection. */
63
- readonly size: number;
64
-
65
- /** Get all keys in the collection. */
66
- getKeys(): Iterable<Key>;
67
-
68
- /** Get a node by its key. */
69
- getItem(key: Key): CollectionNode<T> | null;
70
-
71
- /** Get a node by index. */
72
- at(index: number): CollectionNode<T> | null;
73
-
74
- /** Get the key before the given key. */
75
- getKeyBefore(key: Key): Key | null;
76
-
77
- /** Get the key after the given key. */
78
- getKeyAfter(key: Key): Key | null;
79
-
80
- /** Get the first key in the collection. */
81
- getFirstKey(): Key | null;
82
-
83
- /** Get the last key in the collection. */
84
- getLastKey(): Key | null;
85
-
86
- /** Get the children of a node. */
87
- getChildren(key: Key): Iterable<CollectionNode<T>>;
88
-
89
- /** Get the text value for a key. */
90
- getTextValue(key: Key): string;
91
- }
92
-
93
- /**
94
- * Props for items in a collection.
95
- */
96
- export interface ItemProps<T = unknown> {
97
- /** Unique key for the item. Required if items is used for dynamic collections. */
98
- key?: Key;
99
- /** The text value for accessibility and typeahead. If not provided, derived from children. */
100
- textValue?: string;
101
- /** Whether the item is disabled. */
102
- isDisabled?: boolean;
103
- /** The rendered content of the item. */
104
- children?: JSX.Element;
105
- /** ARIA label for the item. */
106
- 'aria-label'?: string;
107
- /** The original value for dynamic collections. */
108
- value?: T;
109
- }
110
-
111
- /**
112
- * Props for sections in a collection.
113
- */
114
- export interface SectionProps<T = unknown> {
115
- /** Unique key for the section. */
116
- key?: Key;
117
- /** The section header/title. */
118
- title?: JSX.Element;
119
- /** ARIA label for the section. */
120
- 'aria-label'?: string;
121
- /** The items in this section. */
122
- children?: JSX.Element;
123
- /** Items for dynamic rendering. */
124
- items?: Iterable<T>;
125
- }
126
-
127
- /**
128
- * Base props for components that use collections.
129
- */
130
- export interface CollectionBase<T = unknown> {
131
- /** The items in the collection (for dynamic rendering). */
132
- items?: Iterable<T>;
133
- /** The children (static items or render function). */
134
- children?: JSX.Element | ((item: T) => JSX.Element);
135
- /** Keys of disabled items. */
136
- disabledKeys?: Iterable<Key>;
137
- }
138
-
139
- /**
140
- * Props for single selection.
141
- */
142
- export interface SingleSelection {
143
- /** Whether empty selection is allowed. */
144
- disallowEmptySelection?: boolean;
145
- /** The currently selected key (controlled). */
146
- selectedKey?: Key | null;
147
- /** The default selected key (uncontrolled). */
148
- defaultSelectedKey?: Key;
149
- /** Handler called when selection changes. */
150
- onSelectionChange?: (key: Key | null) => void;
151
- }
152
-
153
- /**
154
- * Props for multiple selection.
155
- */
156
- export interface MultipleSelection {
157
- /** The selection mode. */
158
- selectionMode?: SelectionMode;
159
- /** Whether empty selection is allowed. */
160
- disallowEmptySelection?: boolean;
161
- /** The currently selected keys (controlled). */
162
- selectedKeys?: 'all' | Iterable<Key>;
163
- /** The default selected keys (uncontrolled). */
164
- defaultSelectedKeys?: 'all' | Iterable<Key>;
165
- /** Handler called when selection changes. */
166
- onSelectionChange?: (keys: Selection) => void;
167
- /** Keys of disabled items. */
168
- disabledKeys?: Iterable<Key>;
169
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["Color.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EASN,MAAM,SAAS,CAAC;AAi0BjB;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAkE/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,KAAK,CAEjG;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,KAAK,CAE3G;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,KAAK,CAE5G;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAK3D"}