@proyecto-viviana/solidaria-components 0.2.5 → 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 (225) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -272
  3. package/dist/ActionBar.d.ts +79 -0
  4. package/dist/ActionBar.d.ts.map +1 -0
  5. package/dist/ActionGroup.d.ts +74 -0
  6. package/dist/ActionGroup.d.ts.map +1 -0
  7. package/dist/Alert.d.ts +70 -0
  8. package/dist/Alert.d.ts.map +1 -0
  9. package/dist/Autocomplete.d.ts +5 -5
  10. package/dist/Autocomplete.d.ts.map +1 -1
  11. package/dist/Breadcrumbs.d.ts +27 -8
  12. package/dist/Breadcrumbs.d.ts.map +1 -1
  13. package/dist/Button.d.ts +28 -5
  14. package/dist/Button.d.ts.map +1 -1
  15. package/dist/Calendar.d.ts +51 -7
  16. package/dist/Calendar.d.ts.map +1 -1
  17. package/dist/Checkbox.d.ts +33 -8
  18. package/dist/Checkbox.d.ts.map +1 -1
  19. package/dist/Collection.d.ts +130 -0
  20. package/dist/Collection.d.ts.map +1 -0
  21. package/dist/Color.d.ts +210 -9
  22. package/dist/Color.d.ts.map +1 -1
  23. package/dist/ColorEditor.d.ts +42 -0
  24. package/dist/ColorEditor.d.ts.map +1 -0
  25. package/dist/ComboBox.d.ts +146 -16
  26. package/dist/ComboBox.d.ts.map +1 -1
  27. package/dist/ContextualHelpTrigger.d.ts +40 -0
  28. package/dist/ContextualHelpTrigger.d.ts.map +1 -0
  29. package/dist/DateField.d.ts +35 -8
  30. package/dist/DateField.d.ts.map +1 -1
  31. package/dist/DatePicker.d.ts +101 -5
  32. package/dist/DatePicker.d.ts.map +1 -1
  33. package/dist/DateRangePickerContext.d.ts +30 -0
  34. package/dist/DateRangePickerContext.d.ts.map +1 -0
  35. package/dist/Dialog.d.ts +5 -5
  36. package/dist/Dialog.d.ts.map +1 -1
  37. package/dist/Disclosure.d.ts +25 -5
  38. package/dist/Disclosure.d.ts.map +1 -1
  39. package/dist/DragAndDrop.d.ts +80 -0
  40. package/dist/DragAndDrop.d.ts.map +1 -0
  41. package/dist/DragPreview.d.ts +14 -0
  42. package/dist/DragPreview.d.ts.map +1 -0
  43. package/dist/DropZone.d.ts +27 -0
  44. package/dist/DropZone.d.ts.map +1 -0
  45. package/dist/FieldError.d.ts +27 -0
  46. package/dist/FieldError.d.ts.map +1 -0
  47. package/dist/FileTrigger.d.ts +26 -0
  48. package/dist/FileTrigger.d.ts.map +1 -0
  49. package/dist/Focusable.d.ts +27 -0
  50. package/dist/Focusable.d.ts.map +1 -0
  51. package/dist/Form.d.ts +41 -0
  52. package/dist/Form.d.ts.map +1 -0
  53. package/dist/GridList.d.ts +69 -10
  54. package/dist/GridList.d.ts.map +1 -1
  55. package/dist/HiddenDateInput.d.ts +26 -0
  56. package/dist/HiddenDateInput.d.ts.map +1 -0
  57. package/dist/HiddenTimeInput.d.ts +25 -0
  58. package/dist/HiddenTimeInput.d.ts.map +1 -0
  59. package/dist/Icon.d.ts +57 -0
  60. package/dist/Icon.d.ts.map +1 -0
  61. package/dist/Keyboard.d.ts +13 -0
  62. package/dist/Keyboard.d.ts.map +1 -0
  63. package/dist/Landmark.d.ts +3 -3
  64. package/dist/Landmark.d.ts.map +1 -1
  65. package/dist/Link.d.ts +10 -4
  66. package/dist/Link.d.ts.map +1 -1
  67. package/dist/ListBox.d.ts +73 -11
  68. package/dist/ListBox.d.ts.map +1 -1
  69. package/dist/ListDropTargetDelegate.d.ts +38 -0
  70. package/dist/ListDropTargetDelegate.d.ts.map +1 -0
  71. package/dist/Menu.d.ts +79 -10
  72. package/dist/Menu.d.ts.map +1 -1
  73. package/dist/Meter.d.ts +4 -4
  74. package/dist/Meter.d.ts.map +1 -1
  75. package/dist/Modal.d.ts +6 -4
  76. package/dist/Modal.d.ts.map +1 -1
  77. package/dist/NumberField.d.ts +10 -12
  78. package/dist/NumberField.d.ts.map +1 -1
  79. package/dist/Popover.d.ts +32 -7
  80. package/dist/Popover.d.ts.map +1 -1
  81. package/dist/Pressable.d.ts +27 -0
  82. package/dist/Pressable.d.ts.map +1 -0
  83. package/dist/ProgressBar.d.ts +6 -4
  84. package/dist/ProgressBar.d.ts.map +1 -1
  85. package/dist/RadioGroup.d.ts +43 -9
  86. package/dist/RadioGroup.d.ts.map +1 -1
  87. package/dist/RangeCalendar.d.ts +39 -7
  88. package/dist/RangeCalendar.d.ts.map +1 -1
  89. package/dist/RouterProvider.d.ts +75 -0
  90. package/dist/RouterProvider.d.ts.map +1 -0
  91. package/dist/SearchField.d.ts +23 -21
  92. package/dist/SearchField.d.ts.map +1 -1
  93. package/dist/Select.d.ts +48 -7
  94. package/dist/Select.d.ts.map +1 -1
  95. package/dist/SelectionIndicator.d.ts +30 -0
  96. package/dist/SelectionIndicator.d.ts.map +1 -0
  97. package/dist/Separator.d.ts +9 -3
  98. package/dist/Separator.d.ts.map +1 -1
  99. package/dist/SharedElementTransition.d.ts +41 -0
  100. package/dist/SharedElementTransition.d.ts.map +1 -0
  101. package/dist/Slider.d.ts +15 -8
  102. package/dist/Slider.d.ts.map +1 -1
  103. package/dist/StepList.d.ts +90 -0
  104. package/dist/StepList.d.ts.map +1 -0
  105. package/dist/Switch.d.ts +11 -5
  106. package/dist/Switch.d.ts.map +1 -1
  107. package/dist/Table.d.ts +222 -19
  108. package/dist/Table.d.ts.map +1 -1
  109. package/dist/Tabs.d.ts +47 -10
  110. package/dist/Tabs.d.ts.map +1 -1
  111. package/dist/TagGroup.d.ts +22 -10
  112. package/dist/TagGroup.d.ts.map +1 -1
  113. package/dist/Text.d.ts +10 -0
  114. package/dist/Text.d.ts.map +1 -0
  115. package/dist/TextField.d.ts +19 -11
  116. package/dist/TextField.d.ts.map +1 -1
  117. package/dist/TimeField.d.ts +32 -7
  118. package/dist/TimeField.d.ts.map +1 -1
  119. package/dist/Toast.d.ts +29 -14
  120. package/dist/Toast.d.ts.map +1 -1
  121. package/dist/ToggleButton.d.ts +36 -0
  122. package/dist/ToggleButton.d.ts.map +1 -0
  123. package/dist/ToggleButtonGroup.d.ts +33 -0
  124. package/dist/ToggleButtonGroup.d.ts.map +1 -0
  125. package/dist/Toolbar.d.ts +7 -3
  126. package/dist/Toolbar.d.ts.map +1 -1
  127. package/dist/Tooltip.d.ts +58 -7
  128. package/dist/Tooltip.d.ts.map +1 -1
  129. package/dist/Tree.d.ts +102 -11
  130. package/dist/Tree.d.ts.map +1 -1
  131. package/dist/Virtualizer.d.ts +61 -0
  132. package/dist/Virtualizer.d.ts.map +1 -0
  133. package/dist/VirtualizerLayouts.d.ts +82 -0
  134. package/dist/VirtualizerLayouts.d.ts.map +1 -0
  135. package/dist/VisuallyHidden.d.ts +4 -2
  136. package/dist/VisuallyHidden.d.ts.map +1 -1
  137. package/dist/contexts.d.ts +6 -1
  138. package/dist/contexts.d.ts.map +1 -1
  139. package/dist/index.d.ts +73 -39
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +23342 -10644
  142. package/dist/index.js.map +1 -7
  143. package/dist/index.jsx +18110 -0
  144. package/dist/index.jsx.map +1 -0
  145. package/dist/useDragAndDrop.d.ts +93 -0
  146. package/dist/useDragAndDrop.d.ts.map +1 -0
  147. package/dist/utils.d.ts +8 -2
  148. package/dist/utils.d.ts.map +1 -1
  149. package/dist/virtualizer/Layout.d.ts +79 -0
  150. package/dist/virtualizer/Layout.d.ts.map +1 -0
  151. package/package.json +33 -32
  152. package/src/ActionBar.tsx +251 -0
  153. package/src/ActionGroup.tsx +277 -0
  154. package/src/Alert.tsx +152 -0
  155. package/src/Autocomplete.tsx +39 -44
  156. package/src/Breadcrumbs.tsx +227 -72
  157. package/src/Button.tsx +315 -74
  158. package/src/Calendar.tsx +347 -141
  159. package/src/Checkbox.tsx +414 -123
  160. package/src/Collection.tsx +350 -0
  161. package/src/Color.tsx +1325 -284
  162. package/src/ColorEditor.tsx +213 -0
  163. package/src/ComboBox.tsx +644 -245
  164. package/src/ContextualHelpTrigger.tsx +195 -0
  165. package/src/DateField.tsx +274 -106
  166. package/src/DatePicker.tsx +892 -111
  167. package/src/DateRangePickerContext.tsx +44 -0
  168. package/src/Dialog.tsx +173 -104
  169. package/src/Disclosure.tsx +158 -105
  170. package/src/DragAndDrop.tsx +340 -0
  171. package/src/DragPreview.tsx +47 -0
  172. package/src/DropZone.tsx +233 -0
  173. package/src/FieldError.tsx +89 -0
  174. package/src/FileTrigger.tsx +83 -0
  175. package/src/Focusable.tsx +103 -0
  176. package/src/Form.tsx +140 -0
  177. package/src/GridList.tsx +542 -128
  178. package/src/HiddenDateInput.tsx +153 -0
  179. package/src/HiddenTimeInput.tsx +133 -0
  180. package/src/Icon.tsx +133 -0
  181. package/src/Keyboard.tsx +26 -0
  182. package/src/Landmark.tsx +37 -63
  183. package/src/Link.tsx +132 -69
  184. package/src/ListBox.tsx +656 -106
  185. package/src/ListDropTargetDelegate.ts +283 -0
  186. package/src/Menu.tsx +1234 -132
  187. package/src/Meter.tsx +44 -58
  188. package/src/Modal.tsx +262 -166
  189. package/src/NumberField.tsx +267 -151
  190. package/src/Popover.tsx +452 -343
  191. package/src/Pressable.tsx +108 -0
  192. package/src/ProgressBar.tsx +54 -59
  193. package/src/RadioGroup.tsx +533 -121
  194. package/src/RangeCalendar.tsx +249 -150
  195. package/src/RouterProvider.tsx +223 -0
  196. package/src/SearchField.tsx +460 -133
  197. package/src/Select.tsx +804 -233
  198. package/src/SelectionIndicator.tsx +108 -0
  199. package/src/Separator.tsx +47 -49
  200. package/src/SharedElementTransition.tsx +264 -0
  201. package/src/Slider.tsx +148 -98
  202. package/src/StepList.tsx +272 -0
  203. package/src/Switch.tsx +93 -46
  204. package/src/Table.tsx +1551 -225
  205. package/src/Tabs.tsx +377 -123
  206. package/src/TagGroup.tsx +233 -135
  207. package/src/Text.tsx +18 -0
  208. package/src/TextField.tsx +413 -86
  209. package/src/TimeField.tsx +232 -222
  210. package/src/Toast.tsx +306 -160
  211. package/src/ToggleButton.tsx +169 -0
  212. package/src/ToggleButtonGroup.tsx +141 -0
  213. package/src/Toolbar.tsx +61 -70
  214. package/src/Tooltip.tsx +473 -116
  215. package/src/Tree.tsx +1514 -175
  216. package/src/Virtualizer.tsx +730 -0
  217. package/src/VirtualizerLayouts.ts +280 -0
  218. package/src/VisuallyHidden.tsx +32 -38
  219. package/src/contexts.ts +29 -36
  220. package/src/index.ts +972 -620
  221. package/src/useDragAndDrop.ts +367 -0
  222. package/src/utils.tsx +69 -50
  223. package/src/virtualizer/Layout.ts +192 -0
  224. package/dist/index.ssr.js +0 -9785
  225. package/dist/index.ssr.js.map +0 -7
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Drag and drop compatibility hook for collection components.
3
+ *
4
+ * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid
5
+ * state and aria primitives.
6
+ */
7
+ import type { Accessor, JSX } from "solid-js";
8
+ import { DragPreview } from "./DragPreview";
9
+ import { ListDropTargetDelegate } from "./ListDropTargetDelegate";
10
+ import { type DraggableCollectionOptions, type DraggableCollectionAria, type DraggableItemOptions, type DraggableItemAria, type DroppableCollectionOptions, type DroppableCollectionAria, type DroppableItemOptions, type DroppableItemAria, type DropTargetDelegate as AriaDropTargetDelegate } from "@proyecto-viviana/solidaria";
11
+ import { type DragItem, type DragPreviewRenderer, type DraggableCollectionProps, type DraggableCollectionState, type DraggableCollectionStateOptions, type DropTarget, type DroppableCollectionProps, type DroppableCollectionState, type DroppableCollectionStateOptions } from "@proyecto-viviana/solid-stately";
12
+ interface DraggableCollectionStateOpts<T = object> extends Omit<DraggableCollectionStateOptions<T>, "getItems"> {
13
+ items?: T[];
14
+ }
15
+ interface DragHooks<T = object> {
16
+ useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState;
17
+ useDraggableCollection?: (props: Omit<DraggableCollectionOptions, "ref">, state: DraggableCollectionState, ref: Accessor<HTMLElement | null>) => DraggableCollectionAria;
18
+ useDraggableItem?: (props: DraggableItemOptions, state: DraggableCollectionState) => DraggableItemAria;
19
+ DragPreview?: typeof DragPreview;
20
+ renderDragPreview?: DragAndDropOptions<T>["renderDragPreview"];
21
+ isVirtualDragging?: () => boolean;
22
+ }
23
+ interface DropHooks {
24
+ useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState;
25
+ useDroppableCollection?: (props: Omit<DroppableCollectionOptions, "ref">, state: DroppableCollectionState, ref: Accessor<HTMLElement | null>) => DroppableCollectionAria;
26
+ useDroppableItem?: (options: Omit<DroppableItemOptions, "ref">, state: DroppableCollectionState, ref: Accessor<HTMLElement | null>) => DroppableItemAria;
27
+ useDropIndicator?: (props: {
28
+ target: DropTarget;
29
+ }, state: DroppableCollectionState, ref: Accessor<HTMLElement | null>) => {
30
+ dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;
31
+ isDropTarget: boolean;
32
+ isHidden: boolean;
33
+ };
34
+ renderDropIndicator?: (target: DropTarget) => JSX.Element;
35
+ dropTargetDelegate?: AriaDropTargetDelegate;
36
+ ListDropTargetDelegate?: typeof ListDropTargetDelegate;
37
+ }
38
+ export type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;
39
+ export interface DragAndDrop<T = object> {
40
+ /** Drag and drop hooks for the collection element. */
41
+ dragAndDropHooks: DragAndDropHooks<T>;
42
+ }
43
+ export interface DragAndDropOptions<T = object> extends Partial<Omit<DraggableCollectionProps<T>, "preview">>, Partial<DroppableCollectionProps> {
44
+ /**
45
+ * Optional keyboard delegate forwarded to the collection droppable hook.
46
+ */
47
+ keyboardDelegate?: DroppableCollectionOptions["keyboardDelegate"];
48
+ /**
49
+ * Optional keydown handler composed with collection droppable keyboard behavior.
50
+ */
51
+ onKeyDown?: DroppableCollectionOptions["onKeyDown"];
52
+ /**
53
+ * A function that returns the items being dragged.
54
+ * If omitted, draggable hooks are not added.
55
+ */
56
+ getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];
57
+ /**
58
+ * Optional custom drag preview renderer.
59
+ */
60
+ renderDragPreview?: (items: DragItem[]) => JSX.Element | {
61
+ element: JSX.Element;
62
+ x: number;
63
+ y: number;
64
+ };
65
+ /**
66
+ * Optional drop indicator renderer for collection components.
67
+ */
68
+ renderDropIndicator?: (target: DropTarget) => JSX.Element;
69
+ /**
70
+ * Optional custom drop target delegate.
71
+ */
72
+ dropTargetDelegate?: AriaDropTargetDelegate;
73
+ /**
74
+ * Optional drag preview ref.
75
+ */
76
+ preview?: {
77
+ current: DragPreviewRenderer | null;
78
+ };
79
+ /**
80
+ * Optional item snapshot used by draggable state `getItems`.
81
+ */
82
+ items?: T[];
83
+ /**
84
+ * Disable both drag and drop behavior.
85
+ */
86
+ isDisabled?: boolean;
87
+ }
88
+ /**
89
+ * Provides hooks to enable drag-and-drop behavior for collection components.
90
+ */
91
+ export declare function useDragAndDrop<T = object>(options?: DragAndDropOptions<T>): DragAndDrop<T>;
92
+ export {};
93
+ //# sourceMappingURL=useDragAndDrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDragAndDrop.d.ts","sourceRoot":"","sources":["../src/useDragAndDrop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAOL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,IAAI,sBAAsB,EAClD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,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AC,EAAE,KAAK,QAAQ,EAAE,CAAC;IAClE;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,QAAQ,EAAE,KACd,GAAG,CAAC,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1D;;OAEG;IACH,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAAE,CAAC;IAClD;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,MAAM,EAAE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CA2N9F"}
package/dist/utils.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Utility functions for solidaria-components
3
3
  * Port of react-aria-components/src/utils.tsx
4
4
  */
5
- import { type JSX, type Accessor, type FlowComponent, createContext } from 'solid-js';
5
+ import { type JSX, type Accessor, type FlowComponent, type ParentComponent, createContext } from "solid-js";
6
6
  /**
7
7
  * Render props pattern - children can be a function that receives state
8
8
  */
@@ -33,6 +33,7 @@ export interface SlotProps {
33
33
  /** A slot name for the component. */
34
34
  slot?: string;
35
35
  }
36
+ export declare const DEFAULT_SLOT = "default";
36
37
  /**
37
38
  * Return type for useRenderProps
38
39
  */
@@ -69,6 +70,7 @@ export interface RenderPropsResult<T> {
69
70
  export declare function useRenderProps<T extends object>(props: RenderPropsBase<T> & {
70
71
  defaultClassName?: string;
71
72
  }, values: Accessor<T>): RenderPropsResult<T>;
73
+ export declare function composeRenderProps<T extends object>(base: RenderPropsBase<T> | undefined, override: RenderPropsBase<T> | undefined): RenderPropsBase<T>;
72
74
  /**
73
75
  * Context value that can be null or the actual value
74
76
  */
@@ -81,10 +83,14 @@ export declare function createSlottedContext<T>(): import("solid-js").Context<T
81
83
  * Use context with null check
82
84
  */
83
85
  export declare function useSlottedContext<T>(context: ReturnType<typeof createContext<T | null>>): T | null;
86
+ export declare function useContextProps<TProps extends object, TRef>(props: TProps, ref: TRef, context?: ContextValue<Partial<TProps>>): [TProps, TRef];
87
+ export declare const Provider: ParentComponent<{
88
+ values: Array<[ReturnType<typeof createContext<unknown>>, unknown]>;
89
+ }>;
84
90
  /**
85
91
  * Converts boolean state values to data attributes
86
92
  */
87
- export declare function dataAttr(value: boolean | undefined): '' | undefined;
93
+ export declare function dataAttr(value: boolean | undefined): "" | undefined;
88
94
  /**
89
95
  * Creates data attributes from render props
90
96
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,GAAG,EACR,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,aAAa,EAMd,MAAM,UAAU,CAAC;AAOlB;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,CAAC,aAAa,CAAC,CAAC;AAE7F;;GAE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,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACzF,MAAM,EAAE,CAAC,GACR,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAYpC;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAUnF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,CAAC,CAqCH;AAED,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,eAAe,CAmBrD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,CAiBjD"}
@@ -0,0 +1,79 @@
1
+ import type { Key } from "@proyecto-viviana/solid-stately";
2
+ export interface InvalidationContext<O = unknown> {
3
+ contentChanged?: boolean;
4
+ offsetChanged?: boolean;
5
+ sizeChanged?: boolean;
6
+ itemSizeChanged?: boolean;
7
+ layoutOptionsChanged?: boolean;
8
+ layoutOptions?: O;
9
+ }
10
+ export declare class Point {
11
+ x: number;
12
+ y: number;
13
+ constructor(x?: number, y?: number);
14
+ copy(): Point;
15
+ equals(point: Point): boolean;
16
+ isOrigin(): boolean;
17
+ }
18
+ export declare class Size {
19
+ width: number;
20
+ height: number;
21
+ constructor(width?: number, height?: number);
22
+ copy(): Size;
23
+ equals(other: Size): boolean;
24
+ get area(): number;
25
+ }
26
+ export declare class Rect {
27
+ x: number;
28
+ y: number;
29
+ width: number;
30
+ height: number;
31
+ constructor(x?: number, y?: number, width?: number, height?: number);
32
+ get maxX(): number;
33
+ get maxY(): number;
34
+ get area(): number;
35
+ get topLeft(): Point;
36
+ get topRight(): Point;
37
+ get bottomLeft(): Point;
38
+ get bottomRight(): Point;
39
+ intersects(rect: Rect): boolean;
40
+ containsRect(rect: Rect): boolean;
41
+ containsPoint(point: Point): boolean;
42
+ union(other: Rect): Rect;
43
+ intersection(other: Rect): Rect;
44
+ copy(): Rect;
45
+ equals(rect: Rect): boolean;
46
+ }
47
+ export declare class LayoutInfo {
48
+ type: string;
49
+ key: Key;
50
+ rect: Rect;
51
+ parentKey: Key | null;
52
+ content: unknown;
53
+ estimatedSize: boolean;
54
+ isSticky: boolean;
55
+ opacity: number;
56
+ transform: string | null;
57
+ zIndex: number;
58
+ allowOverflow: boolean;
59
+ constructor(type: string, key: Key, rect: Rect);
60
+ copy(): LayoutInfo;
61
+ }
62
+ interface VirtualizerLike {
63
+ visibleRect: Rect;
64
+ }
65
+ export declare abstract class Layout<T extends object = object, O = unknown> {
66
+ virtualizer: VirtualizerLike | null;
67
+ abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];
68
+ abstract getLayoutInfo(key: Key): LayoutInfo | null;
69
+ abstract getContentSize(): Size;
70
+ shouldInvalidate(newRect: Rect, oldRect: Rect): boolean;
71
+ shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean;
72
+ update(_context: InvalidationContext<O>): void;
73
+ updateItemSize?(_key: Key, _size: Size): boolean;
74
+ getDropTargetLayoutInfo?(_target: unknown): LayoutInfo | null;
75
+ protected getItemRect(key: Key): Rect | null;
76
+ getVisibleRect(): Rect;
77
+ }
78
+ export {};
79
+ //# sourceMappingURL=Layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../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C,CAAC,GAAG,IAAI;IAE9C,cAAc,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;IAChD,uBAAuB,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI;IAE7D,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IAI5C,cAAc,IAAI,IAAI;CAGvB"}
package/package.json CHANGED
@@ -1,53 +1,54 @@
1
1
  {
2
2
  "name": "@proyecto-viviana/solidaria-components",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Pre-wired headless components for SolidJS - port of react-aria-components",
5
+ "keywords": [
6
+ "accessibility",
7
+ "aria",
8
+ "components",
9
+ "headless",
10
+ "solid",
11
+ "solidjs"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/proyecto-viviana/ui.git",
17
+ "directory": "packages/solidaria-components"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src"
22
+ ],
5
23
  "type": "module",
24
+ "sideEffects": false,
6
25
  "main": "./dist/index.js",
7
26
  "module": "./dist/index.js",
8
27
  "types": "./dist/index.d.ts",
9
28
  "exports": {
10
29
  ".": {
11
30
  "types": "./dist/index.d.ts",
12
- "solid": "./src/index.ts",
31
+ "solid": "./dist/index.jsx",
13
32
  "import": "./dist/index.js",
14
33
  "default": "./dist/index.js"
15
34
  }
16
35
  },
17
- "files": [
18
- "dist",
19
- "src"
20
- ],
21
- "sideEffects": false,
22
- "scripts": {
23
- "build": "tsup && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
24
- "dev": "tsup --watch",
25
- "prepublishOnly": "echo 'Use deno task release from root'"
36
+ "publishConfig": {
37
+ "access": "public"
26
38
  },
27
39
  "dependencies": {
28
- "@proyecto-viviana/solidaria": "^0.2.5",
29
- "@proyecto-viviana/solid-stately": "^0.2.4"
30
- },
31
- "peerDependencies": {
32
- "solid-js": "^1.9.0"
40
+ "@internationalized/date": "^3.8.0",
41
+ "@proyecto-viviana/solidaria": "0.3.0",
42
+ "@proyecto-viviana/solid-stately": "0.3.0"
33
43
  },
34
44
  "devDependencies": {
35
- "solid-js": "^1.9.10"
45
+ "solid-js": "^1.9.11"
36
46
  },
37
- "keywords": [
38
- "solid",
39
- "solidjs",
40
- "accessibility",
41
- "aria",
42
- "headless",
43
- "components"
44
- ],
45
- "license": "MIT",
46
- "repository": {
47
- "type": "git",
48
- "url": "https://github.com/proyecto-viviana/proyecto-viviana"
47
+ "peerDependencies": {
48
+ "solid-js": "^1.9.0"
49
49
  },
50
- "publishConfig": {
51
- "access": "public"
50
+ "scripts": {
51
+ "build": "rm -rf dist && tsdown && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
52
+ "dev": "tsup --watch"
52
53
  }
53
- }
54
+ }
@@ -0,0 +1,251 @@
1
+ /**
2
+ * ActionBar component for solidaria-components
3
+ *
4
+ * Headless action bar that appears when items are selected in a collection.
5
+ * Shows a selection count, clear button, and action buttons.
6
+ *
7
+ * No RAC headless equivalent — this is a thin component layer that ties
8
+ * selection state to visibility and keyboard behavior.
9
+ */
10
+
11
+ import {
12
+ type JSX,
13
+ type ParentProps,
14
+ Show,
15
+ createContext,
16
+ createMemo,
17
+ createEffect,
18
+ splitProps,
19
+ useContext,
20
+ } from "solid-js";
21
+ import { announce, createToolbar } from "@proyecto-viviana/solidaria";
22
+ import type { Key } from "@proyecto-viviana/solid-stately";
23
+ import {
24
+ type ClassNameOrFunction,
25
+ type StyleOrFunction,
26
+ type SlotProps,
27
+ useRenderProps,
28
+ filterDOMProps,
29
+ } from "./utils";
30
+
31
+ type RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;
32
+
33
+ function assignRef<T>(ref: RefLike<T>, el: T): void {
34
+ if (!ref) return;
35
+ if (typeof ref === "function") {
36
+ ref(el);
37
+ } else {
38
+ ref.current = el;
39
+ }
40
+ }
41
+
42
+ export interface ActionBarRenderProps {
43
+ /** Whether the action bar is visible. */
44
+ isOpen: boolean;
45
+ /** The number of selected items. */
46
+ selectedItemCount: number | "all";
47
+ }
48
+
49
+ export interface ActionBarProps
50
+ extends
51
+ Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "style" | "children" | "ref" | "slot">,
52
+ SlotProps {
53
+ /** The number of selected items. ActionBar is hidden when 0. @default 0 */
54
+ selectedItemCount?: number | "all";
55
+ /** Callback when the clear button is pressed. */
56
+ onClearSelection?: () => void;
57
+ /** Callback when an action is triggered. */
58
+ onAction?: (key: Key) => void;
59
+ /** The action buttons to display. */
60
+ children?: JSX.Element;
61
+ /** CSS class for the container. */
62
+ class?: ClassNameOrFunction<ActionBarRenderProps>;
63
+ /** Inline style for the container. */
64
+ style?: StyleOrFunction<ActionBarRenderProps>;
65
+ /** Accessible label for the action bar. @default 'Actions' */
66
+ "aria-label"?: string;
67
+ /** Identifies the element (or elements) that labels the action bar. */
68
+ "aria-labelledby"?: string;
69
+ /** Optional keydown handler on the action bar element. */
70
+ onKeyDown?: JSX.EventHandlerUnion<HTMLDivElement, KeyboardEvent>;
71
+ /** Screen reader announcement when the action bar becomes available. */
72
+ actionsAvailableMessage?: string;
73
+ /** Ref for the underlying action bar element. */
74
+ ref?: RefLike<HTMLDivElement>;
75
+ }
76
+
77
+ export interface ActionBarContextValue {
78
+ selectedItemCount: () => number | "all";
79
+ onClearSelection?: () => void;
80
+ onAction?: (key: Key) => void;
81
+ }
82
+
83
+ export const ActionBarContext = createContext<ActionBarContextValue | null>(null);
84
+
85
+ export function useActionBarContext(): ActionBarContextValue | null {
86
+ return useContext(ActionBarContext);
87
+ }
88
+
89
+ export function ActionBar(props: ActionBarProps): JSX.Element {
90
+ const [local, domProps] = splitProps(props, [
91
+ "selectedItemCount",
92
+ "onClearSelection",
93
+ "onAction",
94
+ "children",
95
+ "class",
96
+ "style",
97
+ "slot",
98
+ "aria-label",
99
+ "aria-labelledby",
100
+ "onKeyDown",
101
+ "actionsAvailableMessage",
102
+ "ref",
103
+ ]);
104
+
105
+ const selectedItemCount = () => local.selectedItemCount ?? 0;
106
+ const isOpen = () => selectedItemCount() !== 0;
107
+
108
+ const { toolbarProps } = createToolbar({
109
+ orientation: "horizontal",
110
+ get "aria-label"() {
111
+ return local["aria-label"] ?? (local["aria-labelledby"] ? undefined : "Actions");
112
+ },
113
+ get "aria-labelledby"() {
114
+ return local["aria-labelledby"];
115
+ },
116
+ });
117
+
118
+ let wasOpen = false;
119
+ createEffect(() => {
120
+ const open = isOpen();
121
+ if (open && !wasOpen) {
122
+ const message = local.actionsAvailableMessage ?? "Actions available.";
123
+ if (message) {
124
+ announce(message);
125
+ }
126
+ }
127
+ wasOpen = open;
128
+ });
129
+
130
+ const handleKeyDown: JSX.EventHandlerUnion<HTMLDivElement, KeyboardEvent> = (e) => {
131
+ const onKeyDown = local.onKeyDown as
132
+ | JSX.EventHandler<HTMLDivElement, KeyboardEvent>
133
+ | undefined;
134
+ onKeyDown?.(e);
135
+ if (e.defaultPrevented) {
136
+ return;
137
+ }
138
+
139
+ if (e.key === "Escape" && isOpen()) {
140
+ e.preventDefault();
141
+ e.stopPropagation();
142
+ local.onClearSelection?.();
143
+ }
144
+ };
145
+
146
+ const renderProps = useRenderProps(
147
+ {
148
+ children: undefined,
149
+ class: local.class,
150
+ style: local.style,
151
+ defaultClassName: "solidaria-ActionBar",
152
+ },
153
+ () => ({
154
+ isOpen: isOpen(),
155
+ selectedItemCount: selectedItemCount(),
156
+ }),
157
+ );
158
+
159
+ const filteredDOMProps = createMemo(() =>
160
+ filterDOMProps(domProps as Record<string, unknown>, { global: true }),
161
+ );
162
+
163
+ const contextValue = createMemo<ActionBarContextValue>(() => ({
164
+ selectedItemCount,
165
+ onClearSelection: local.onClearSelection,
166
+ onAction: local.onAction,
167
+ }));
168
+
169
+ return (
170
+ <Show when={isOpen()}>
171
+ <ActionBarContext.Provider value={contextValue()}>
172
+ <div
173
+ {...filteredDOMProps()}
174
+ {...toolbarProps}
175
+ class={renderProps.class()}
176
+ style={renderProps.style()}
177
+ slot={local.slot}
178
+ data-open={isOpen() || undefined}
179
+ onKeyDown={handleKeyDown}
180
+ ref={(el) => assignRef(local.ref, el)}
181
+ >
182
+ {local.children}
183
+ </div>
184
+ </ActionBarContext.Provider>
185
+ </Show>
186
+ );
187
+ }
188
+
189
+ export interface ActionBarContainerProps extends ParentProps {
190
+ class?: string;
191
+ style?: JSX.CSSProperties;
192
+ }
193
+
194
+ /**
195
+ * Container that positions a collection and its ActionBar.
196
+ */
197
+ export function ActionBarContainer(props: ActionBarContainerProps): JSX.Element {
198
+ return (
199
+ <div
200
+ class={props.class ?? "solidaria-ActionBarContainer"}
201
+ style={{ position: "relative", ...props.style }}
202
+ >
203
+ {props.children}
204
+ </div>
205
+ );
206
+ }
207
+
208
+ export interface ActionBarSelectionCountProps {
209
+ class?: string;
210
+ }
211
+
212
+ /**
213
+ * Displays the count of selected items.
214
+ */
215
+ export function ActionBarSelectionCount(props: ActionBarSelectionCountProps): JSX.Element {
216
+ const ctx = useActionBarContext();
217
+
218
+ const text = () => {
219
+ if (!ctx) return "";
220
+ const count = ctx.selectedItemCount();
221
+ if (count === "all") return "All selected";
222
+ if (count === 0) return "None selected";
223
+ return `${count} selected`;
224
+ };
225
+
226
+ return <span class={props.class}>{text()}</span>;
227
+ }
228
+
229
+ export interface ActionBarClearButtonProps {
230
+ class?: string;
231
+ children?: JSX.Element;
232
+ "aria-label"?: string;
233
+ }
234
+
235
+ /**
236
+ * Button to clear the current selection.
237
+ */
238
+ export function ActionBarClearButton(props: ActionBarClearButtonProps): JSX.Element {
239
+ const ctx = useActionBarContext();
240
+
241
+ return (
242
+ <button
243
+ type="button"
244
+ aria-label={props["aria-label"] ?? "Clear selection"}
245
+ class={props.class}
246
+ onClick={() => ctx?.onClearSelection?.()}
247
+ >
248
+ {props.children ?? "\u2715"}
249
+ </button>
250
+ );
251
+ }