@rebasepro/ui 0.24.0 → 0.24.1-canary.gcb918fc

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 (241) hide show
  1. package/dist/components/Alert.d.ts +6 -0
  2. package/dist/components/Alert.es.js +82 -0
  3. package/dist/components/Alert.es.js.map +1 -0
  4. package/dist/components/Autocomplete.es.js +53 -0
  5. package/dist/components/Autocomplete.es.js.map +1 -0
  6. package/dist/components/Avatar.d.ts +3 -1
  7. package/dist/components/Avatar.es.js +37 -0
  8. package/dist/components/Avatar.es.js.map +1 -0
  9. package/dist/components/Badge.es.js +27 -0
  10. package/dist/components/Badge.es.js.map +1 -0
  11. package/dist/components/BooleanSwitch.es.js +75 -0
  12. package/dist/components/BooleanSwitch.es.js.map +1 -0
  13. package/dist/components/BooleanSwitchWithLabel.es.js +55 -0
  14. package/dist/components/BooleanSwitchWithLabel.es.js.map +1 -0
  15. package/dist/components/Button.es.js +58 -0
  16. package/dist/components/Button.es.js.map +1 -0
  17. package/dist/components/Card.es.js +26 -0
  18. package/dist/components/Card.es.js.map +1 -0
  19. package/dist/components/CenteredView.es.js +23 -0
  20. package/dist/components/CenteredView.es.js.map +1 -0
  21. package/dist/components/Checkbox.es.js +62 -0
  22. package/dist/components/Checkbox.es.js.map +1 -0
  23. package/dist/components/Chip.es.js +72 -0
  24. package/dist/components/Chip.es.js.map +1 -0
  25. package/dist/components/CircularProgress.es.js +28 -0
  26. package/dist/components/CircularProgress.es.js.map +1 -0
  27. package/dist/components/CircularProgressCenter.es.js +30 -0
  28. package/dist/components/CircularProgressCenter.es.js.map +1 -0
  29. package/dist/components/Collapse.es.js +57 -0
  30. package/dist/components/Collapse.es.js.map +1 -0
  31. package/dist/components/ColorPicker.es.js +89 -0
  32. package/dist/components/ColorPicker.es.js.map +1 -0
  33. package/dist/components/Container.es.js +31 -0
  34. package/dist/components/Container.es.js.map +1 -0
  35. package/dist/components/DateTimeField.d.ts +11 -1
  36. package/dist/components/DateTimeField.es.js +253 -0
  37. package/dist/components/DateTimeField.es.js.map +1 -0
  38. package/dist/components/DebouncedTextField.es.js +93 -0
  39. package/dist/components/DebouncedTextField.es.js.map +1 -0
  40. package/dist/components/Dialog.es.js +98 -0
  41. package/dist/components/Dialog.es.js.map +1 -0
  42. package/dist/components/DialogActions.es.js +15 -0
  43. package/dist/components/DialogActions.es.js.map +1 -0
  44. package/dist/components/DialogContent.es.js +18 -0
  45. package/dist/components/DialogContent.es.js.map +1 -0
  46. package/dist/components/DialogTitle.es.js +26 -0
  47. package/dist/components/DialogTitle.es.js.map +1 -0
  48. package/dist/components/ErrorBoundary.es.js +158 -0
  49. package/dist/components/ErrorBoundary.es.js.map +1 -0
  50. package/dist/components/ExpandablePanel.es.js +91 -0
  51. package/dist/components/ExpandablePanel.es.js.map +1 -0
  52. package/dist/components/FileUpload.es.js +58 -0
  53. package/dist/components/FileUpload.es.js.map +1 -0
  54. package/dist/components/FilterChip.es.js +31 -0
  55. package/dist/components/FilterChip.es.js.map +1 -0
  56. package/dist/components/IconButton.es.js +52 -0
  57. package/dist/components/IconButton.es.js.map +1 -0
  58. package/dist/components/InfoLabel.es.js +18 -0
  59. package/dist/components/InfoLabel.es.js.map +1 -0
  60. package/dist/components/InputLabel.es.js +27 -0
  61. package/dist/components/InputLabel.es.js.map +1 -0
  62. package/dist/components/Label.es.js +18 -0
  63. package/dist/components/Label.es.js.map +1 -0
  64. package/dist/components/LoadingButton.es.js +21 -0
  65. package/dist/components/LoadingButton.es.js.map +1 -0
  66. package/dist/components/Markdown.es.js +88 -0
  67. package/dist/components/Markdown.es.js.map +1 -0
  68. package/dist/components/Menu.es.js +46 -0
  69. package/dist/components/Menu.es.js.map +1 -0
  70. package/dist/components/Menubar.es.js +142 -0
  71. package/dist/components/Menubar.es.js.map +1 -0
  72. package/dist/components/MultiSelect.d.ts +1 -7
  73. package/dist/components/MultiSelect.es.js +271 -0
  74. package/dist/components/MultiSelect.es.js.map +1 -0
  75. package/dist/components/Paper.es.js +16 -0
  76. package/dist/components/Paper.es.js.map +1 -0
  77. package/dist/components/Popover.es.js +113 -0
  78. package/dist/components/Popover.es.js.map +1 -0
  79. package/dist/components/RadioGroup.es.js +30 -0
  80. package/dist/components/RadioGroup.es.js.map +1 -0
  81. package/dist/components/ResizablePanels.d.ts +3 -1
  82. package/dist/components/ResizablePanels.es.js +137 -0
  83. package/dist/components/ResizablePanels.es.js.map +1 -0
  84. package/dist/components/SearchBar.es.js +82 -0
  85. package/dist/components/SearchBar.es.js.map +1 -0
  86. package/dist/components/Select.d.ts +8 -1
  87. package/dist/components/Select.es.js +300 -0
  88. package/dist/components/Select.es.js.map +1 -0
  89. package/dist/components/Separator.es.js +20 -0
  90. package/dist/components/Separator.es.js.map +1 -0
  91. package/dist/components/Sheet.es.js +73 -0
  92. package/dist/components/Sheet.es.js.map +1 -0
  93. package/dist/components/Skeleton.es.js +33 -0
  94. package/dist/components/Skeleton.es.js.map +1 -0
  95. package/dist/components/Slider.es.js +56 -0
  96. package/dist/components/Slider.es.js.map +1 -0
  97. package/dist/components/Table.d.ts +18 -3
  98. package/dist/components/Table.es.js +69 -0
  99. package/dist/components/Table.es.js.map +1 -0
  100. package/dist/components/Tabs.es.js +101 -0
  101. package/dist/components/Tabs.es.js.map +1 -0
  102. package/dist/components/TextField.d.ts +0 -8
  103. package/dist/components/TextField.es.js +111 -0
  104. package/dist/components/TextField.es.js.map +1 -0
  105. package/dist/components/TextareaAutosize.es.js +187 -0
  106. package/dist/components/TextareaAutosize.es.js.map +1 -0
  107. package/dist/components/ToggleButtonGroup.d.ts +6 -1
  108. package/dist/components/ToggleButtonGroup.es.js +35 -0
  109. package/dist/components/ToggleButtonGroup.es.js.map +1 -0
  110. package/dist/components/Tooltip.d.ts +24 -0
  111. package/dist/components/Tooltip.es.js +165 -0
  112. package/dist/components/Tooltip.es.js.map +1 -0
  113. package/dist/components/Typography.es.js +85 -0
  114. package/dist/components/Typography.es.js.map +1 -0
  115. package/dist/components/VirtualTable/VirtualTable.es.js +516 -0
  116. package/dist/components/VirtualTable/VirtualTable.es.js.map +1 -0
  117. package/dist/components/VirtualTable/VirtualTableCell.d.ts +1 -1
  118. package/dist/components/VirtualTable/VirtualTableCell.es.js +40 -0
  119. package/dist/components/VirtualTable/VirtualTableCell.es.js.map +1 -0
  120. package/dist/components/VirtualTable/VirtualTableHeader.es.js +209 -0
  121. package/dist/components/VirtualTable/VirtualTableHeader.es.js.map +1 -0
  122. package/dist/components/VirtualTable/VirtualTableHeaderRow.es.js +166 -0
  123. package/dist/components/VirtualTable/VirtualTableHeaderRow.es.js.map +1 -0
  124. package/dist/components/VirtualTable/VirtualTableProps.d.ts +13 -2
  125. package/dist/components/VirtualTable/VirtualTableRow.d.ts +6 -7
  126. package/dist/components/VirtualTable/VirtualTableRow.es.js +41 -0
  127. package/dist/components/VirtualTable/VirtualTableRow.es.js.map +1 -0
  128. package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +2 -1
  129. package/dist/components/VirtualTable/fields/VirtualTableDateField.es.js +71 -0
  130. package/dist/components/VirtualTable/fields/VirtualTableDateField.es.js.map +1 -0
  131. package/dist/components/VirtualTable/fields/VirtualTableInput.es.js +73 -0
  132. package/dist/components/VirtualTable/fields/VirtualTableInput.es.js.map +1 -0
  133. package/dist/components/VirtualTable/fields/VirtualTableNumberInput.es.js +47 -0
  134. package/dist/components/VirtualTable/fields/VirtualTableNumberInput.es.js.map +1 -0
  135. package/dist/components/VirtualTable/fields/VirtualTableSelect.es.js +83 -0
  136. package/dist/components/VirtualTable/fields/VirtualTableSelect.es.js.map +1 -0
  137. package/dist/components/VirtualTable/fields/VirtualTableSwitch.es.js +22 -0
  138. package/dist/components/VirtualTable/fields/VirtualTableSwitch.es.js.map +1 -0
  139. package/dist/components/VirtualTable/selection/SelectionContext.es.js +23 -0
  140. package/dist/components/VirtualTable/selection/SelectionContext.es.js.map +1 -0
  141. package/dist/components/VirtualTable/selection/SelectionStore.es.js +43 -0
  142. package/dist/components/VirtualTable/selection/SelectionStore.es.js.map +1 -0
  143. package/dist/components/VirtualTable/types.d.ts +1 -1
  144. package/dist/components/common/SelectInputLabel.es.js +28 -0
  145. package/dist/components/common/SelectInputLabel.es.js.map +1 -0
  146. package/dist/components/index.es.js +64 -0
  147. package/dist/hooks/PortalContainerContext.es.js +40 -0
  148. package/dist/hooks/PortalContainerContext.es.js.map +1 -0
  149. package/dist/hooks/UiLabelsContext.d.ts +63 -0
  150. package/dist/hooks/UiLabelsContext.es.js +59 -0
  151. package/dist/hooks/UiLabelsContext.es.js.map +1 -0
  152. package/dist/hooks/useDebounceCallback.es.js +15 -0
  153. package/dist/hooks/useDebounceCallback.es.js.map +1 -0
  154. package/dist/hooks/useDebounceValue.es.js +19 -0
  155. package/dist/hooks/useDebounceValue.es.js.map +1 -0
  156. package/dist/hooks/useDebouncedCallback.es.js +36 -0
  157. package/dist/hooks/useDebouncedCallback.es.js.map +1 -0
  158. package/dist/hooks/useInjectStyles.es.js +27 -0
  159. package/dist/hooks/useInjectStyles.es.js.map +1 -0
  160. package/dist/hooks/useIsDarkMode.es.js +61 -0
  161. package/dist/hooks/useIsDarkMode.es.js.map +1 -0
  162. package/dist/hooks/useModalFocus.es.js +81 -0
  163. package/dist/hooks/useModalFocus.es.js.map +1 -0
  164. package/dist/hooks/useOutsideAlerter.es.js +41 -0
  165. package/dist/hooks/useOutsideAlerter.es.js.map +1 -0
  166. package/dist/hooks/useRestoreInterruptedFocus.es.js +61 -0
  167. package/dist/hooks/useRestoreInterruptedFocus.es.js.map +1 -0
  168. package/dist/icons/GitHubIcon.es.js +23 -0
  169. package/dist/icons/GitHubIcon.es.js.map +1 -0
  170. package/dist/icons/HandleIcon.es.js +60 -0
  171. package/dist/icons/HandleIcon.es.js.map +1 -0
  172. package/dist/icons/Icon.es.js +25 -0
  173. package/dist/icons/Icon.es.js.map +1 -0
  174. package/dist/icons/LucideIconByName.d.ts +12 -9
  175. package/dist/icons/LucideIconByName.es.js +83 -0
  176. package/dist/icons/LucideIconByName.es.js.map +1 -0
  177. package/dist/icons/cool_icon_keys.es.js +55 -0
  178. package/dist/icons/cool_icon_keys.es.js.map +1 -0
  179. package/dist/icons/icon_keys.es.js +1941 -0
  180. package/dist/icons/icon_keys.es.js.map +1 -0
  181. package/dist/icons/index.d.ts +4 -3
  182. package/dist/icons/index.es.js +8 -0
  183. package/dist/icons/lucide_icon_map.d.ts +12 -0
  184. package/dist/icons/lucide_icon_map.es.js +2 -0
  185. package/dist/index.d.ts +2 -0
  186. package/dist/index.es.js +87 -9563
  187. package/dist/styles.es.js +158 -0
  188. package/dist/styles.es.js.map +1 -0
  189. package/dist/util/chip_colors.es.js +290 -0
  190. package/dist/util/chip_colors.es.js.map +1 -0
  191. package/dist/util/cls.es.js +10 -0
  192. package/dist/util/cls.es.js.map +1 -0
  193. package/dist/util/debounce.es.js +22 -0
  194. package/dist/util/debounce.es.js.map +1 -0
  195. package/dist/util/hash.es.js +16 -0
  196. package/dist/util/hash.es.js.map +1 -0
  197. package/dist/util/keys.es.js +37 -0
  198. package/dist/util/keys.es.js.map +1 -0
  199. package/dist/util/lazy_chunk.es.js +96 -0
  200. package/dist/util/lazy_chunk.es.js.map +1 -0
  201. package/dist/views/CardView.d.ts +26 -2
  202. package/dist/views/CardView.es.js +435 -0
  203. package/dist/views/CardView.es.js.map +1 -0
  204. package/dist/views/CollectionView/CollectionCardView.es.js +179 -0
  205. package/dist/views/CollectionView/CollectionCardView.es.js.map +1 -0
  206. package/dist/views/CollectionView/CollectionKanbanView.es.js +172 -0
  207. package/dist/views/CollectionView/CollectionKanbanView.es.js.map +1 -0
  208. package/dist/views/CollectionView/CollectionListView.es.js +156 -0
  209. package/dist/views/CollectionView/CollectionListView.es.js.map +1 -0
  210. package/dist/views/CollectionView/CollectionTableView.es.js +149 -0
  211. package/dist/views/CollectionView/CollectionTableView.es.js.map +1 -0
  212. package/dist/views/CollectionView/CollectionView.es.js +197 -0
  213. package/dist/views/CollectionView/CollectionView.es.js.map +1 -0
  214. package/dist/views/CollectionView/CollectionViewToolbar.es.js +155 -0
  215. package/dist/views/CollectionView/CollectionViewToolbar.es.js.map +1 -0
  216. package/dist/views/CollectionView/DefaultCellRenderer.es.js +302 -0
  217. package/dist/views/CollectionView/DefaultCellRenderer.es.js.map +1 -0
  218. package/dist/views/CollectionView/resolveTitleProperty.es.js +56 -0
  219. package/dist/views/CollectionView/resolveTitleProperty.es.js.map +1 -0
  220. package/dist/views/CollectionView/utils.es.js +19 -0
  221. package/dist/views/CollectionView/utils.es.js.map +1 -0
  222. package/dist/views/Kanban/Board.es.js +237 -0
  223. package/dist/views/Kanban/Board.es.js.map +1 -0
  224. package/dist/views/Kanban/BoardColumn.es.js +81 -0
  225. package/dist/views/Kanban/BoardColumn.es.js.map +1 -0
  226. package/dist/views/Kanban/BoardColumnTitle.es.js +27 -0
  227. package/dist/views/Kanban/BoardColumnTitle.es.js.map +1 -0
  228. package/dist/views/Kanban/BoardSortableList.es.js +98 -0
  229. package/dist/views/Kanban/BoardSortableList.es.js.map +1 -0
  230. package/dist/views/Kanban/placement.es.js +27 -0
  231. package/dist/views/Kanban/placement.es.js.map +1 -0
  232. package/dist/views/KanbanView.es.js +11 -0
  233. package/dist/views/KanbanView.es.js.map +1 -0
  234. package/dist/views/ListView.d.ts +15 -2
  235. package/dist/views/ListView.es.js +245 -0
  236. package/dist/views/ListView.es.js.map +1 -0
  237. package/dist/views/useScrollParentRestoration.d.ts +8 -1
  238. package/dist/views/useScrollParentRestoration.es.js +75 -0
  239. package/dist/views/useScrollParentRestoration.es.js.map +1 -0
  240. package/package.json +2 -2
  241. package/dist/index.es.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualTableDateField.es.js","names":[],"sources":["../../../../src/components/VirtualTable/fields/VirtualTableDateField.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { DateTimeField, type DateTimeFieldMode } from \"../../DateTimeField\";\n\nexport function VirtualTableDateField(props: {\n name?: string;\n error?: Error;\n mode?: DateTimeFieldMode;\n timezone?: string;\n internalValue: Date | undefined | null;\n updateValue: (newValue: (Date | null)) => void;\n focused: boolean;\n disabled: boolean;\n small?: boolean;\n locale?: string;\n /**\n * Whether the field draws its own calendar button. A table that draws its\n * own opener for the cell turns it off, and the value then sits flush with\n * the text of the cells beside it rather than indented like a form field.\n */\n pickerButton?: boolean;\n /** The native input, for a caller that opens the picker itself (`showPicker()`). */\n inputRef?: React.Ref<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { name, disabled, error, mode, timezone, internalValue, updateValue, small = false, locale, pickerButton = true, inputRef } = props;\n\n // An empty date input still paints its mask — `dd/mm/yyyy, --:--` — so a\n // column with gaps in it read as a column of placeholders, one per row.\n // The mask is only useful once someone is typing into it.\n const [focused, setFocused] = useState(false);\n const focusedRef = useRef(false);\n\n // A typed date is written once it is complete, not once per keystroke:\n // the input reports each one, and retyping a year passes through 0002,\n // 0020 and 0202 on its way to 2026. While the field has the focus a change\n // waits for the typing to pause — and a year of fewer than four digits for\n // more typing — and leaving the field writes what it holds. A date picked\n // with the field unfocused is written at once.\n const [draft, setDraft] = useState<{ value: Date | null } | null>(null);\n const draftRef = useRef<{ value: Date | null } | null>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const updateValueRef = useRef(updateValue);\n useEffect(() => {\n updateValueRef.current = updateValue;\n }, [updateValue]);\n\n const commit = useCallback(() => {\n clearTimeout(timerRef.current);\n const pending = draftRef.current;\n if (!pending) return;\n draftRef.current = null;\n setDraft(null);\n updateValueRef.current(pending.value);\n }, []);\n\n const onDateChange = (dateValue: Date | null) => {\n const pending = { value: dateValue ?? null };\n draftRef.current = pending;\n setDraft(pending);\n clearTimeout(timerRef.current);\n if (!focusedRef.current) {\n commit();\n } else if (!pending.value || pending.value.getFullYear() >= 1000) {\n timerRef.current = setTimeout(commit, 400);\n }\n };\n\n useEffect(() => () => {\n clearTimeout(timerRef.current);\n if (draftRef.current) updateValueRef.current(draftRef.current.value);\n }, []);\n\n const shownValue = draft ? draft.value : internalValue;\n const empty = !shownValue;\n\n return (\n <div className={\"w-full h-full flex items-center\"}\n onFocus={() => {\n focusedRef.current = true;\n setFocused(true);\n }}\n onBlur={() => {\n focusedRef.current = false;\n setFocused(false);\n commit();\n }}>\n <DateTimeField\n value={shownValue ?? undefined}\n onChange={onDateChange}\n // Same omission as `VirtualTableInput`: destructured and forwarded\n // nowhere, so a disabled date cell was still editable. `error` went\n // the same way — it drives `DateTimeField`'s invalid styling, and a\n // prop a caller passes should reach something rather than sit in a\n // destructure.\n disabled={disabled}\n error={Boolean(error)}\n // Third prop this component declared and dropped. A table cell\n // draws no visible label — the column header is the only thing\n // naming it, and a header is not an accessible name for the input\n // underneath — so without this every date cell reads as an unnamed\n // \"date entry\" to a screen reader, one per row per date column.\n aria-label={name}\n invisible={true}\n pickerButton={pickerButton}\n inputRef={inputRef}\n // Without this the field falls back to DateTimeField's own default of\n // `size=\"large\"` (min-h-64px), which overflows a table cell and makes\n // the value collide with the cell border.\n size={small ? \"small\" : \"medium\"}\n inputClassName={cls(\"w-full h-full\",\n focusedDisabled,\n !pickerButton && \"px-0\",\n empty && !focused && \"text-transparent\")}\n className={cls(\"w-full h-full\", focusedDisabled)}\n mode={mode}\n timezone={timezone}\n locale={locale}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,sBAAsB,OAoBnC;CACC,MAAM,EAAE,MAAM,UAAU,OAAO,MAAM,UAAU,eAAe,aAAa,QAAQ,OAAO,QAAQ,eAAe,MAAM,aAAa;CAKpI,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,aAAa,OAAO,KAAK;CAQ/B,MAAM,CAAC,OAAO,YAAY,SAAwC,IAAI;CACtE,MAAM,WAAW,OAAsC,IAAI;CAC3D,MAAM,WAAW,OAAkD,KAAA,CAAS;CAC5E,MAAM,iBAAiB,OAAO,WAAW;CACzC,gBAAgB;EACZ,eAAe,UAAU;CAC7B,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,SAAS,kBAAkB;EAC7B,aAAa,SAAS,OAAO;EAC7B,MAAM,UAAU,SAAS;EACzB,IAAI,CAAC,SAAS;EACd,SAAS,UAAU;EACnB,SAAS,IAAI;EACb,eAAe,QAAQ,QAAQ,KAAK;CACxC,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAgB,cAA2B;EAC7C,MAAM,UAAU,EAAE,OAAO,aAAa,KAAK;EAC3C,SAAS,UAAU;EACnB,SAAS,OAAO;EAChB,aAAa,SAAS,OAAO;EAC7B,IAAI,CAAC,WAAW,SACZ,OAAO;OACJ,IAAI,CAAC,QAAQ,SAAS,QAAQ,MAAM,YAAY,KAAK,KACxD,SAAS,UAAU,WAAW,QAAQ,GAAG;CAEjD;CAEA,sBAAsB;EAClB,aAAa,SAAS,OAAO;EAC7B,IAAI,SAAS,SAAS,eAAe,QAAQ,SAAS,QAAQ,KAAK;CACvE,GAAG,CAAC,CAAC;CAEL,MAAM,aAAa,QAAQ,MAAM,QAAQ;CAGzC,OACI,oBAAC,OAAD;EAAK,WAAW;EACZ,eAAe;GACX,WAAW,UAAU;GACrB,WAAW,IAAI;EACnB;EACA,cAAc;GACV,WAAW,UAAU;GACrB,WAAW,KAAK;GAChB,OAAO;EACX;YACA,oBAAC,eAAD;GACI,OAAO,cAAc,KAAA;GACrB,UAAU;GAMA;GACV,OAAO,QAAQ,KAAK;GAMpB,cAAY;GACZ,WAAW;GACG;GACJ;GAIV,MAAM,QAAQ,UAAU;GACxB,gBAAgB,IAAI,iBAChB,iBACA,CAAC,gBAAgB,QACjB,CAvCD,cAuCU,CAAC,WAAW,kBAAkB;GAC3C,WAAW,IAAI,iBAAiB,eAAe;GACzC;GACI;GACF;EACX,CAAA;CACA,CAAA;AAEb"}
@@ -0,0 +1,73 @@
1
+ import { focusedDisabled } from "../../../styles.es.js";
2
+ import { useDebouncedCallback } from "../../../hooks/useDebouncedCallback.es.js";
3
+ import { TextareaAutosize } from "../../TextareaAutosize.es.js";
4
+ import React, { useEffect, useRef, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/VirtualTable/fields/VirtualTableInput.tsx
7
+ function VirtualTableInput(props) {
8
+ const ref = React.useRef(null);
9
+ const { disabled, value, multiline = false, updateValue, focused } = props;
10
+ const prevValue = useRef(value);
11
+ const [internalValue, setInternalValue] = useState(value);
12
+ const focusedState = useRef(false);
13
+ useEffect(() => {
14
+ if (prevValue.current !== value && value !== internalValue) setInternalValue(value);
15
+ prevValue.current = value;
16
+ }, [value]);
17
+ const doUpdate = React.useCallback(() => {
18
+ if (!value && !internalValue) return;
19
+ if (internalValue !== value && internalValue !== prevValue.current) {
20
+ prevValue.current = internalValue;
21
+ updateValue(internalValue);
22
+ }
23
+ }, [
24
+ internalValue,
25
+ updateValue,
26
+ value
27
+ ]);
28
+ useDebouncedCallback(internalValue, doUpdate, !focused, 400);
29
+ useEffect(() => {
30
+ if (ref.current && focused && !focusedState.current) {
31
+ focusedState.current = true;
32
+ ref.current.focus({ preventScroll: true });
33
+ ref.current.selectionStart = ref.current.value.length;
34
+ ref.current.selectionEnd = ref.current.value.length;
35
+ } else focusedState.current = focused;
36
+ }, [focused, ref]);
37
+ return /* @__PURE__ */ jsx(TextareaAutosize, {
38
+ className: focusedDisabled,
39
+ ref,
40
+ disabled,
41
+ readOnly: disabled,
42
+ style: {
43
+ padding: 0,
44
+ margin: 0,
45
+ width: "100%",
46
+ color: "unset",
47
+ fontWeight: "unset",
48
+ fontSize: "unset",
49
+ fontFamily: "unset",
50
+ background: "unset",
51
+ border: "unset",
52
+ resize: "none",
53
+ outline: "none"
54
+ },
55
+ value: internalValue ?? "",
56
+ onChange: (evt) => {
57
+ const newValue = evt.target.value;
58
+ if (multiline || !newValue.endsWith("\n")) setInternalValue(newValue);
59
+ },
60
+ onFocus: () => {
61
+ focusedState.current = true;
62
+ },
63
+ onBlur: () => {
64
+ focusedState.current = false;
65
+ doUpdate();
66
+ if (props.onBlur) props.onBlur();
67
+ }
68
+ });
69
+ }
70
+ //#endregion
71
+ export { VirtualTableInput };
72
+
73
+ //# sourceMappingURL=VirtualTableInput.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualTableInput.es.js","names":[],"sources":["../../../../src/components/VirtualTable/fields/VirtualTableInput.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { TextareaAutosize } from \"../../TextareaAutosize\";\n\nexport function VirtualTableInput(props: {\n error?: Error;\n value: string;\n multiline?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (string | null)) => void;\n onBlur?: () => void;\n}) {\n const ref = React.useRef<HTMLTextAreaElement>(null);\n const { disabled, value, multiline = false, updateValue, focused } = props;\n const prevValue = useRef<string | null>(value);\n const [internalValue, setInternalValue] = useState<typeof value>(value);\n const focusedState = useRef<boolean>(false);\n\n useEffect(() => {\n if (prevValue.current !== value && value !== internalValue)\n setInternalValue(value);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n const emptyInitialValue = !value;\n if (emptyInitialValue && !internalValue) return;\n if (internalValue !== value && internalValue !== prevValue.current) {\n prevValue.current = internalValue;\n updateValue(internalValue);\n }\n }, [internalValue, updateValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (ref.current && focused && !focusedState.current) {\n focusedState.current = true;\n ref.current.focus({ preventScroll: true });\n ref.current.selectionStart = ref.current.value.length;\n ref.current.selectionEnd = ref.current.value.length;\n } else {\n focusedState.current = focused;\n }\n }, [focused, ref]);\n\n return (\n <TextareaAutosize\n className={focusedDisabled}\n ref={ref}\n // Destructured above and passed to nothing, so a property carrying\n // `admin: { disabled: true }` stayed typeable in the table and the\n // debounced write fired on blur. `readOnly` as well as `disabled`:\n // a disabled textarea is skipped by keyboard navigation, and a cell\n // you cannot tab through is worse than one you cannot edit.\n disabled={disabled}\n readOnly={disabled}\n style={{\n padding: 0,\n margin: 0,\n width: \"100%\",\n color: \"unset\",\n fontWeight: \"unset\",\n fontSize: \"unset\",\n fontFamily: \"unset\",\n background: \"unset\",\n border: \"unset\",\n resize: \"none\",\n outline: \"none\"\n }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value as string;\n if (multiline || !newValue.endsWith(\"\\n\"))\n setInternalValue(newValue);\n }}\n onFocus={() => {\n focusedState.current = true;\n }}\n onBlur={() => {\n focusedState.current = false;\n doUpdate();\n if (props.onBlur) props.onBlur();\n }}\n />\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,kBAAkB,OAQ/B;CACC,MAAM,MAAM,MAAM,OAA4B,IAAI;CAClD,MAAM,EAAE,UAAU,OAAO,YAAY,OAAO,aAAa,YAAY;CACrE,MAAM,YAAY,OAAsB,KAAK;CAC7C,MAAM,CAAC,eAAe,oBAAoB,SAAuB,KAAK;CACtE,MAAM,eAAe,OAAgB,KAAK;CAE1C,gBAAgB;EACZ,IAAI,UAAU,YAAY,SAAS,UAAU,eACzC,iBAAiB,KAAK;EAC1B,UAAU,UAAU;CACxB,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,WAAW,MAAM,kBAAkB;EAErC,IAAI,CADuB,SACF,CAAC,eAAe;EACzC,IAAI,kBAAkB,SAAS,kBAAkB,UAAU,SAAS;GAChE,UAAU,UAAU;GACpB,YAAY,aAAa;EAC7B;CACJ,GAAG;EAAC;EAAe;EAAa;CAAK,CAAC;CAEtC,qBAAqB,eAAe,UAAU,CAAC,SAAS,GAAG;CAE3D,gBAAgB;EACZ,IAAI,IAAI,WAAW,WAAW,CAAC,aAAa,SAAS;GACjD,aAAa,UAAU;GACvB,IAAI,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;GACzC,IAAI,QAAQ,iBAAiB,IAAI,QAAQ,MAAM;GAC/C,IAAI,QAAQ,eAAe,IAAI,QAAQ,MAAM;EACjD,OACI,aAAa,UAAU;CAE/B,GAAG,CAAC,SAAS,GAAG,CAAC;CAEjB,OACI,oBAAC,kBAAD;EACI,WAAW;EACN;EAMK;EACV,UAAU;EACV,OAAO;GACH,SAAS;GACT,QAAQ;GACR,OAAO;GACP,OAAO;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,QAAQ;GACR,QAAQ;GACR,SAAS;EACb;EACA,OAAO,iBAAiB;EACxB,WAAW,QAAQ;GACf,MAAM,WAAW,IAAI,OAAO;GAC5B,IAAI,aAAa,CAAC,SAAS,SAAS,IAAI,GACpC,iBAAiB,QAAQ;EACjC;EACA,eAAe;GACX,aAAa,UAAU;EAC3B;EACA,cAAc;GACV,aAAa,UAAU;GACvB,SAAS;GACT,IAAI,MAAM,QAAQ,MAAM,OAAO;EACnC;CACH,CAAA;AAET"}
@@ -0,0 +1,47 @@
1
+ import { focusedDisabled } from "../../../styles.es.js";
2
+ import { cls } from "../../../util/cls.es.js";
3
+ import { useDebouncedCallback } from "../../../hooks/useDebouncedCallback.es.js";
4
+ import React, { useEffect, useRef, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/VirtualTable/fields/VirtualTableNumberInput.tsx
7
+ function VirtualTableNumberInput(props) {
8
+ const { align = "left", value, updateValue, focused, disabled } = props;
9
+ const propStringValue = typeof value === "number" ? value.toString() : "";
10
+ const [internalValue, setInternalValue] = useState(propStringValue);
11
+ const prevValue = useRef(value);
12
+ useEffect(() => {
13
+ if (prevValue.current !== value && String(value) !== internalValue) setInternalValue(value !== void 0 && value !== null ? value.toString() : null);
14
+ prevValue.current = value;
15
+ }, [value]);
16
+ useDebouncedCallback(internalValue, React.useCallback(() => {
17
+ if (internalValue !== propStringValue) if (internalValue !== void 0 && internalValue !== null) {
18
+ const numberValue = parseFloat(internalValue);
19
+ if (isNaN(numberValue)) return;
20
+ updateValue(numberValue);
21
+ } else updateValue(null);
22
+ }, [internalValue, value]), !focused, 400);
23
+ useEffect(() => {
24
+ if (!focused && propStringValue !== internalValue) setInternalValue(value !== void 0 && value !== null ? value.toString() : null);
25
+ }, [value, focused]);
26
+ const inputRef = React.useRef(null);
27
+ useEffect(() => {
28
+ if (inputRef.current && focused) inputRef.current.focus({ preventScroll: true });
29
+ }, [focused, inputRef]);
30
+ const regexp = /^-?[0-9]+[,.]?[0-9]*$/;
31
+ return /* @__PURE__ */ jsx("input", {
32
+ ref: inputRef,
33
+ disabled,
34
+ className: cls("w-full p-0 m-0 bg-transparent border-none outline-none font-mono tabular-nums", focusedDisabled),
35
+ style: { textAlign: align },
36
+ value: internalValue ?? "",
37
+ onChange: (evt) => {
38
+ const newValue = evt.target.value.replace(",", ".");
39
+ if (newValue.length === 0) setInternalValue(null);
40
+ if (regexp.test(newValue) || newValue.startsWith("-")) setInternalValue(newValue);
41
+ }
42
+ });
43
+ }
44
+ //#endregion
45
+ export { VirtualTableNumberInput };
46
+
47
+ //# sourceMappingURL=VirtualTableNumberInput.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualTableNumberInput.es.js","names":[],"sources":["../../../../src/components/VirtualTable/fields/VirtualTableNumberInput.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\n\nexport function VirtualTableNumberInput(props: {\n error?: Error;\n value: number;\n align?: \"right\" | \"left\" | \"center\";\n updateValue: (newValue: (number | null)) => void;\n focused: boolean;\n disabled: boolean;\n}) {\n const { align = \"left\", value, updateValue, focused, disabled } = props;\n // Not `value && …`: 0 is a value, and it used to render as an empty cell.\n const propStringValue = typeof value === \"number\" ? value.toString() : \"\";\n const [internalValue, setInternalValue] = useState<string | null>(propStringValue);\n const prevValue = useRef<number | null>(value);\n\n useEffect(() => {\n if (prevValue.current !== value && String(value) !== internalValue)\n setInternalValue(value !== undefined && value !== null ? value.toString() : null);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n if (internalValue !== propStringValue) {\n if (internalValue !== undefined && internalValue !== null) {\n const numberValue = parseFloat(internalValue);\n if (isNaN(numberValue)) return;\n updateValue(numberValue);\n } else {\n updateValue(null);\n }\n }\n }, [internalValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (!focused && propStringValue !== internalValue)\n setInternalValue(value !== undefined && value !== null ? value.toString() : null);\n }, [value, focused]);\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (inputRef.current && focused) {\n inputRef.current.focus({ preventScroll: true });\n }\n }, [focused, inputRef]);\n\n const regexp = /^-?[0-9]+[,.]?[0-9]*$/;\n\n // A bare input, not a `TextField`: the cell frames it, and a field's box\n // is taller than a row's line, so the value jumped as the cell was\n // selected. The number at rest is a line of mono, tabular figures in the\n // cell's type; this is that same line, so selecting the cell moves nothing.\n return (\n <input\n ref={inputRef}\n disabled={disabled}\n className={cls(\"w-full p-0 m-0 bg-transparent border-none outline-none font-mono tabular-nums\", focusedDisabled)}\n style={{ textAlign: align }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value.replace(\",\", \".\");\n if (newValue.length === 0) setInternalValue(null);\n if (regexp.test(newValue) || newValue.startsWith(\"-\")) setInternalValue(newValue);\n }}\n />\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,wBAAwB,OAOrC;CACC,MAAM,EAAE,QAAQ,QAAQ,OAAO,aAAa,SAAS,aAAa;CAElE,MAAM,kBAAkB,OAAO,UAAU,WAAW,MAAM,SAAS,IAAI;CACvE,MAAM,CAAC,eAAe,oBAAoB,SAAwB,eAAe;CACjF,MAAM,YAAY,OAAsB,KAAK;CAE7C,gBAAgB;EACZ,IAAI,UAAU,YAAY,SAAS,OAAO,KAAK,MAAM,eACjD,iBAAiB,UAAU,KAAA,KAAa,UAAU,OAAO,MAAM,SAAS,IAAI,IAAI;EACpF,UAAU,UAAU;CACxB,GAAG,CAAC,KAAK,CAAC;CAcV,qBAAqB,eAZJ,MAAM,kBAAkB;EACrC,IAAI,kBAAkB,iBAClB,IAAI,kBAAkB,KAAA,KAAa,kBAAkB,MAAM;GACvD,MAAM,cAAc,WAAW,aAAa;GAC5C,IAAI,MAAM,WAAW,GAAG;GACxB,YAAY,WAAW;EAC3B,OACI,YAAY,IAAI;CAG5B,GAAG,CAAC,eAAe,KAAK,CAEY,GAAU,CAAC,SAAS,GAAG;CAE3D,gBAAgB;EACZ,IAAI,CAAC,WAAW,oBAAoB,eAChC,iBAAiB,UAAU,KAAA,KAAa,UAAU,OAAO,MAAM,SAAS,IAAI,IAAI;CACxF,GAAG,CAAC,OAAO,OAAO,CAAC;CAEnB,MAAM,WAAW,MAAM,OAAyB,IAAI;CAEpD,gBAAgB;EACZ,IAAI,SAAS,WAAW,SACpB,SAAS,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;CAEtD,GAAG,CAAC,SAAS,QAAQ,CAAC;CAEtB,MAAM,SAAS;CAMf,OACI,oBAAC,SAAD;EACI,KAAK;EACK;EACV,WAAW,IAAI,iFAAiF,eAAe;EAC/G,OAAO,EAAE,WAAW,MAAM;EAC1B,OAAO,iBAAiB;EACxB,WAAW,QAAQ;GACf,MAAM,WAAW,IAAI,OAAO,MAAM,QAAQ,KAAK,GAAG;GAClD,IAAI,SAAS,WAAW,GAAG,iBAAiB,IAAI;GAChD,IAAI,OAAO,KAAK,QAAQ,KAAK,SAAS,WAAW,GAAG,GAAG,iBAAiB,QAAQ;EACpF;CACH,CAAA;AAET"}
@@ -0,0 +1,83 @@
1
+ import { Chip } from "../../Chip.es.js";
2
+ import { MultiSelect, MultiSelectItem } from "../../MultiSelect.es.js";
3
+ import { Select, SelectItem } from "../../Select.es.js";
4
+ import { useCallback, useEffect, useRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/VirtualTable/fields/VirtualTableSelect.tsx
7
+ function VirtualTableSelect(props) {
8
+ const { options, value, disabled, small = false, focused, updateValue, multiple = false } = props;
9
+ const validValue = Array.isArray(value) && multiple || !Array.isArray(value) && !multiple;
10
+ const ref = useRef(null);
11
+ useEffect(() => {
12
+ if (ref.current && focused) ref.current?.focus({ preventScroll: true });
13
+ }, [focused, ref]);
14
+ const onChange = useCallback((updatedValue) => {
15
+ if (multiple) {
16
+ const isNumber = options.some((o) => typeof o.value === "number");
17
+ const newValue = updatedValue.map((v) => {
18
+ return typeof options.find((o) => String(o.value) === v)?.value === "number" ? parseFloat(v) : v;
19
+ });
20
+ if (isNumber) updateValue(newValue);
21
+ else updateValue(newValue);
22
+ } else {
23
+ const opt = options.find((o) => String(o.value) === updatedValue);
24
+ updateValue(typeof opt?.value === "number" ? parseFloat(updatedValue) : updatedValue || null);
25
+ }
26
+ }, [
27
+ multiple,
28
+ updateValue,
29
+ options
30
+ ]);
31
+ const renderValue = (val) => {
32
+ const option = options.find((o) => o.value === val);
33
+ return /* @__PURE__ */ jsx(Chip, {
34
+ size: small ? "small" : "medium",
35
+ children: option ? option.label : String(val)
36
+ });
37
+ };
38
+ const handleOpenChange = useCallback((open) => {
39
+ if (!open && ref.current) setTimeout(() => {
40
+ ref.current?.focus({ preventScroll: true });
41
+ }, 0);
42
+ }, []);
43
+ return multiple ? /* @__PURE__ */ jsx(MultiSelect, {
44
+ inputRef: ref,
45
+ className: "w-full h-full p-0 bg-transparent outline-none",
46
+ disabled,
47
+ includeClear: false,
48
+ useChips: false,
49
+ value: validValue ? value.map((v) => String(v)) : [],
50
+ onValueChange: onChange,
51
+ onOpenChange: handleOpenChange,
52
+ children: options.map((opt) => /* @__PURE__ */ jsx(MultiSelectItem, {
53
+ value: String(opt.value),
54
+ children: /* @__PURE__ */ jsx(Chip, {
55
+ size: small ? "small" : "medium",
56
+ children: opt.label
57
+ })
58
+ }, String(opt.value)))
59
+ }) : /* @__PURE__ */ jsx(Select, {
60
+ inputRef: ref,
61
+ fullWidth: true,
62
+ className: "w-full h-full p-0 bg-transparent outline-none [&_button]:ring-0 [&_button]:ring-offset-0",
63
+ inputClassName: "ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-offset-0",
64
+ position: "item-aligned",
65
+ disabled,
66
+ padding: false,
67
+ value: validValue ? String(value) : "",
68
+ onValueChange: onChange,
69
+ onOpenChange: handleOpenChange,
70
+ renderValue,
71
+ children: options.map((opt) => /* @__PURE__ */ jsx(SelectItem, {
72
+ value: String(opt.value),
73
+ children: /* @__PURE__ */ jsx(Chip, {
74
+ size: small ? "small" : "medium",
75
+ children: opt.label
76
+ })
77
+ }, String(opt.value)))
78
+ });
79
+ }
80
+ //#endregion
81
+ export { VirtualTableSelect };
82
+
83
+ //# sourceMappingURL=VirtualTableSelect.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualTableSelect.es.js","names":[],"sources":["../../../../src/components/VirtualTable/fields/VirtualTableSelect.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { Select, SelectItem } from \"../../Select\";\nimport { MultiSelect, MultiSelectItem } from \"../../MultiSelect\";\nimport { Chip } from \"../../Chip\";\n\nexport interface VirtualTableSelectOption {\n value: string | number;\n label: string;\n color?: string;\n}\n\nexport function VirtualTableSelect(props: {\n options: VirtualTableSelectOption[];\n error?: Error;\n multiple?: boolean;\n disabled: boolean;\n small?: boolean;\n value: string | number | string[] | number[] | undefined;\n updateValue: (newValue: (string | number | string[] | number[] | null)) => void;\n focused: boolean;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { options, value, disabled, small = false, focused, updateValue, multiple = false } = props;\n const validValue = (Array.isArray(value) && multiple) || (!Array.isArray(value) && !multiple);\n const ref = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current?.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n const onChange = useCallback((updatedValue: string | string[]) => {\n if (multiple) {\n const isNumber = options.some(o => typeof o.value === \"number\");\n const newValue = (updatedValue as string[]).map((v) => {\n const opt = options.find(o => String(o.value) === v);\n return typeof opt?.value === \"number\" ? parseFloat(v) : v;\n });\n if (isNumber) {\n updateValue(newValue as number[]);\n } else {\n updateValue(newValue as string[]);\n }\n } else {\n const opt = options.find(o => String(o.value) === updatedValue);\n updateValue(typeof opt?.value === \"number\" ? parseFloat(updatedValue as string) : (updatedValue as string || null));\n }\n }, [multiple, updateValue, options]);\n\n const renderValue = (val?: string | number) => {\n const option = options.find(o => o.value === val);\n return (\n <Chip size={small ? \"small\" : \"medium\"}>\n {option ? option.label : String(val)}\n </Chip>\n );\n };\n\n const handleOpenChange = useCallback((open: boolean) => {\n if (!open && ref.current) {\n setTimeout(() => {\n ref.current?.focus({ preventScroll: true });\n }, 0);\n }\n }, []);\n\n return multiple ? (\n <MultiSelect\n inputRef={ref}\n className=\"w-full h-full p-0 bg-transparent outline-none\"\n disabled={disabled}\n includeClear={false}\n useChips={false}\n value={validValue ? (value as (string | number)[]).map(v => String(v)) : []}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n >\n {options.map((opt) => (\n <MultiSelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </MultiSelectItem>\n ))}\n </MultiSelect>\n ) : (\n <Select\n inputRef={ref}\n fullWidth\n className=\"w-full h-full p-0 bg-transparent outline-none [&_button]:ring-0 [&_button]:ring-offset-0\"\n inputClassName=\"ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-offset-0\"\n position={\"item-aligned\"}\n disabled={disabled}\n padding={false}\n value={validValue ? String(value) : \"\"}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n renderValue={renderValue}\n >\n {options.map((opt) => (\n <SelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </SelectItem>\n ))}\n </Select>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAgB,mBAAmB,OAUhC;CACC,MAAM,EAAE,SAAS,OAAO,UAAU,QAAQ,OAAO,SAAS,aAAa,WAAW,UAAU;CAC5F,MAAM,aAAc,MAAM,QAAQ,KAAK,KAAK,YAAc,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC;CACpF,MAAM,MAAM,OAA0B,IAAI;CAE1C,gBAAgB;EACZ,IAAI,IAAI,WAAW,SACf,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;CAElD,GAAG,CAAC,SAAS,GAAG,CAAC;CAEjB,MAAM,WAAW,aAAa,iBAAoC;EAC9D,IAAI,UAAU;GACV,MAAM,WAAW,QAAQ,MAAK,MAAK,OAAO,EAAE,UAAU,QAAQ;GAC9D,MAAM,WAAY,aAA0B,KAAK,MAAM;IAEnD,OAAO,OADK,QAAQ,MAAK,MAAK,OAAO,EAAE,KAAK,MAAM,CACpC,CAAA,EAAK,UAAU,WAAW,WAAW,CAAC,IAAI;GAC5D,CAAC;GACD,IAAI,UACA,YAAY,QAAoB;QAEhC,YAAY,QAAoB;EAExC,OAAO;GACH,MAAM,MAAM,QAAQ,MAAK,MAAK,OAAO,EAAE,KAAK,MAAM,YAAY;GAC9D,YAAY,OAAO,KAAK,UAAU,WAAW,WAAW,YAAsB,IAAK,gBAA0B,IAAK;EACtH;CACJ,GAAG;EAAC;EAAU;EAAa;CAAO,CAAC;CAEnC,MAAM,eAAe,QAA0B;EAC3C,MAAM,SAAS,QAAQ,MAAK,MAAK,EAAE,UAAU,GAAG;EAChD,OACI,oBAAC,MAAD;GAAM,MAAM,QAAQ,UAAU;aACzB,SAAS,OAAO,QAAQ,OAAO,GAAG;EACjC,CAAA;CAEd;CAEA,MAAM,mBAAmB,aAAa,SAAkB;EACpD,IAAI,CAAC,QAAQ,IAAI,SACb,iBAAiB;GACb,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;EAC9C,GAAG,CAAC;CAEZ,GAAG,CAAC,CAAC;CAEL,OAAO,WACH,oBAAC,aAAD;EACI,UAAU;EACV,WAAU;EACA;EACV,cAAc;EACd,UAAU;EACV,OAAO,aAAc,MAA8B,KAAI,MAAK,OAAO,CAAC,CAAC,IAAI,CAAC;EAC1E,eAAe;EACf,cAAc;YAEb,QAAQ,KAAK,QACV,oBAAC,iBAAD;GAAyC,OAAO,OAAO,IAAI,KAAK;aAC5D,oBAAC,MAAD;IAAM,MAAM,QAAQ,UAAU;cAAW,IAAI;GAAY,CAAA;EAC5C,GAFK,OAAO,IAAI,KAAK,CAErB,CACpB;CACQ,CAAA,IAEb,oBAAC,QAAD;EACI,UAAU;EACV,WAAA;EACA,WAAU;EACV,gBAAe;EACf,UAAU;EACA;EACV,SAAS;EACT,OAAO,aAAa,OAAO,KAAK,IAAI;EACpC,eAAe;EACf,cAAc;EACD;YAEZ,QAAQ,KAAK,QACV,oBAAC,YAAD;GAAoC,OAAO,OAAO,IAAI,KAAK;aACvD,oBAAC,MAAD;IAAM,MAAM,QAAQ,UAAU;cAAW,IAAI;GAAY,CAAA;EACjD,GAFK,OAAO,IAAI,KAAK,CAErB,CACf;CACG,CAAA;AAEhB"}
@@ -0,0 +1,22 @@
1
+ import { BooleanSwitch } from "../../BooleanSwitch.es.js";
2
+ import React, { useEffect } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/components/VirtualTable/fields/VirtualTableSwitch.tsx
5
+ function VirtualTableSwitch(props) {
6
+ const { internalValue, updateValue, focused, disabled } = props;
7
+ const ref = React.useRef(null);
8
+ useEffect(() => {
9
+ if (ref.current && focused) ref.current.focus({ preventScroll: true });
10
+ }, [focused, ref]);
11
+ return /* @__PURE__ */ jsx(BooleanSwitch, {
12
+ ref,
13
+ size: "small",
14
+ value: Boolean(internalValue),
15
+ disabled,
16
+ onValueChange: updateValue
17
+ });
18
+ }
19
+ //#endregion
20
+ export { VirtualTableSwitch };
21
+
22
+ //# sourceMappingURL=VirtualTableSwitch.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualTableSwitch.es.js","names":[],"sources":["../../../../src/components/VirtualTable/fields/VirtualTableSwitch.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { BooleanSwitch } from \"../../BooleanSwitch\";\n\nexport function VirtualTableSwitch(props: {\n error?: Error;\n internalValue?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (boolean | null)) => void;\n}) {\n const { internalValue, updateValue, focused, disabled } = props;\n const ref = React.useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n return (\n <BooleanSwitch\n ref={ref}\n size={\"small\"}\n value={Boolean(internalValue)}\n disabled={disabled}\n onValueChange={updateValue}\n />\n );\n}\n"],"mappings":";;;;AAGA,SAAgB,mBAAmB,OAMhC;CACC,MAAM,EAAE,eAAe,aAAa,SAAS,aAAa;CAC1D,MAAM,MAAM,MAAM,OAA0B,IAAI;CAEhD,gBAAgB;EACZ,IAAI,IAAI,WAAW,SACf,IAAI,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;CAEjD,GAAG,CAAC,SAAS,GAAG,CAAC;CAEjB,OACI,oBAAC,eAAD;EACS;EACL,MAAM;EACN,OAAO,QAAQ,aAAa;EAClB;EACV,eAAe;CAClB,CAAA;AAET"}
@@ -0,0 +1,23 @@
1
+ import React, { createContext, useContext } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/VirtualTable/selection/SelectionContext.tsx
4
+ var SelectionContext = createContext(null);
5
+ var VirtualTableSelectionProvider = ({ store, children }) => {
6
+ const value = React.useMemo(() => ({
7
+ selectionStore: store,
8
+ select: store.select
9
+ }), [store]);
10
+ return /* @__PURE__ */ jsx(SelectionContext.Provider, {
11
+ value,
12
+ children
13
+ });
14
+ };
15
+ var useVirtualTableSelection = () => {
16
+ const context = useContext(SelectionContext);
17
+ if (!context) throw new Error("useVirtualTableSelection must be used within a VirtualTableSelectionProvider");
18
+ return context;
19
+ };
20
+ //#endregion
21
+ export { VirtualTableSelectionProvider, useVirtualTableSelection };
22
+
23
+ //# sourceMappingURL=SelectionContext.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionContext.es.js","names":[],"sources":["../../../../src/components/VirtualTable/selection/SelectionContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport { VirtualTableSelectionStore, SelectedCell } from \"./SelectionStore\";\n\nexport interface VirtualTableSelectionContextProps<T extends SelectedCell = SelectedCell> {\n selectionStore: VirtualTableSelectionStore<T>;\n select: (cell: T | undefined) => void;\n}\n\nconst SelectionContext = createContext<VirtualTableSelectionContextProps<any> | null>(null);\n\nexport const VirtualTableSelectionProvider = <T extends SelectedCell = SelectedCell>({\n store,\n children\n}: {\n store: VirtualTableSelectionStore<T>;\n children: React.ReactNode;\n}) => {\n const value = React.useMemo(() => ({\n selectionStore: store,\n select: store.select\n }), [store]);\n\n return (\n <SelectionContext.Provider value={value}>\n {children}\n </SelectionContext.Provider>\n );\n};\n\nexport const useVirtualTableSelection = <T extends SelectedCell = SelectedCell>() => {\n const context = useContext(SelectionContext);\n if (!context) {\n throw new Error(\"useVirtualTableSelection must be used within a VirtualTableSelectionProvider\");\n }\n return context as VirtualTableSelectionContextProps<T>;\n};\n"],"mappings":";;;AAQA,IAAM,mBAAmB,cAA6D,IAAI;AAE1F,IAAa,iCAAwE,EACjF,OACA,eAIE;CACF,MAAM,QAAQ,MAAM,eAAe;EAC/B,gBAAgB;EAChB,QAAQ,MAAM;CAClB,IAAI,CAAC,KAAK,CAAC;CAEX,OACI,oBAAC,iBAAiB,UAAlB;EAAkC;EAC7B;CACsB,CAAA;AAEnC;AAEA,IAAa,iCAAwE;CACjF,MAAM,UAAU,WAAW,gBAAgB;CAC3C,IAAI,CAAC,SACD,MAAM,IAAI,MAAM,8EAA8E;CAElG,OAAO;AACX"}
@@ -0,0 +1,43 @@
1
+ import { useCallback, useRef, useSyncExternalStore } from "react";
2
+ //#region src/components/VirtualTable/selection/SelectionStore.ts
3
+ function createVirtualTableSelectionStore() {
4
+ let selectedCell = void 0;
5
+ const listeners = /* @__PURE__ */ new Set();
6
+ function getEntity() {
7
+ return selectedCell;
8
+ }
9
+ function subscribe(listener) {
10
+ listeners.add(listener);
11
+ return () => listeners.delete(listener);
12
+ }
13
+ function select(cell) {
14
+ selectedCell = cell;
15
+ listeners.forEach((l) => l());
16
+ }
17
+ return {
18
+ getEntity,
19
+ subscribe,
20
+ select
21
+ };
22
+ }
23
+ function useVirtualTableCellSelected(store, columnKey, id) {
24
+ const selectorRef = useRef({
25
+ columnKey,
26
+ id
27
+ });
28
+ selectorRef.current = {
29
+ columnKey,
30
+ id
31
+ };
32
+ const getEntity = useCallback(() => {
33
+ const cell = store.getEntity();
34
+ if (!cell) return false;
35
+ const s = selectorRef.current;
36
+ return cell.columnKey === s.columnKey && cell.id === s.id;
37
+ }, [store]);
38
+ return useSyncExternalStore(store.subscribe, getEntity, getEntity);
39
+ }
40
+ //#endregion
41
+ export { createVirtualTableSelectionStore, useVirtualTableCellSelected };
42
+
43
+ //# sourceMappingURL=SelectionStore.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionStore.es.js","names":[],"sources":["../../../../src/components/VirtualTable/selection/SelectionStore.ts"],"sourcesContent":["import { useSyncExternalStore, useCallback, useRef } from \"react\";\n\nexport interface SelectedCell {\n columnKey: string;\n id: string | number;\n cellRect?: DOMRect;\n width?: number;\n height?: number;\n}\n\nexport function createVirtualTableSelectionStore<T extends SelectedCell = SelectedCell>() {\n let selectedCell: T | undefined = undefined;\n const listeners = new Set<() => void>();\n\n function getEntity(): T | undefined {\n return selectedCell;\n }\n\n function subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n function select(cell: T | undefined) {\n selectedCell = cell;\n listeners.forEach(l => l());\n }\n\n return {\n getEntity,\n subscribe,\n select\n };\n}\n\nexport type VirtualTableSelectionStore<T extends SelectedCell = SelectedCell> = ReturnType<typeof createVirtualTableSelectionStore<T>>;\n\nexport function useVirtualTableCellSelected<T extends SelectedCell = SelectedCell>(\n store: VirtualTableSelectionStore<T>,\n columnKey: string,\n id: string | number\n): boolean {\n const selectorRef = useRef({ columnKey, id });\n selectorRef.current = { columnKey, id };\n\n const getEntity = useCallback(() => {\n const cell = store.getEntity();\n if (!cell) return false;\n const s = selectorRef.current;\n return cell.columnKey === s.columnKey && cell.id === s.id;\n }, [store]);\n\n return useSyncExternalStore(store.subscribe, getEntity, getEntity);\n}\n"],"mappings":";;AAUA,SAAgB,mCAA0E;CACtF,IAAI,eAA8B,KAAA;CAClC,MAAM,4BAAY,IAAI,IAAgB;CAEtC,SAAS,YAA2B;EAChC,OAAO;CACX;CAEA,SAAS,UAAU,UAAkC;EACjD,UAAU,IAAI,QAAQ;EACtB,aAAa,UAAU,OAAO,QAAQ;CAC1C;CAEA,SAAS,OAAO,MAAqB;EACjC,eAAe;EACf,UAAU,SAAQ,MAAK,EAAE,CAAC;CAC9B;CAEA,OAAO;EACH;EACA;EACA;CACJ;AACJ;AAIA,SAAgB,4BACZ,OACA,WACA,IACO;CACP,MAAM,cAAc,OAAO;EAAE;EAAW;CAAG,CAAC;CAC5C,YAAY,UAAU;EAAE;EAAW;CAAG;CAEtC,MAAM,YAAY,kBAAkB;EAChC,MAAM,OAAO,MAAM,UAAU;EAC7B,IAAI,CAAC,MAAM,OAAO;EAClB,MAAM,IAAI,YAAY;EACtB,OAAO,KAAK,cAAc,EAAE,aAAa,KAAK,OAAO,EAAE;CAC3D,GAAG,CAAC,KAAK,CAAC;CAEV,OAAO,qBAAqB,MAAM,WAAW,WAAW,SAAS;AACrE"}
@@ -22,7 +22,7 @@ export type VirtualTableRowProps<T extends object> = {
22
22
  rowClassName?: (rowData: T) => string | undefined;
23
23
  };
24
24
  export type VirtualTableContextProps<T extends object> = {
25
- data?: T[];
25
+ data?: (T | undefined)[];
26
26
  rowHeight?: number;
27
27
  headerHeight?: number;
28
28
  columns: VirtualTableColumn[];
@@ -0,0 +1,28 @@
1
+ import { cls } from "../../util/cls.es.js";
2
+ import "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/components/common/SelectInputLabel.tsx
5
+ /**
6
+ * The label above a Select or MultiSelect.
7
+ *
8
+ * It used `text-surface-accent-500` — a SURFACE scale, borrowed for type. The
9
+ * label above a TextField has always used `text-text-secondary`, and the two are
10
+ * the same role, so a form mixing the components showed two different label
11
+ * colours: `#64748b` blue-grey over a Select, `#757575` neutral over a TextField.
12
+ * Measured side by side on /debug/ui, which is where it is most obvious, because
13
+ * the reference puts them in adjacent columns.
14
+ *
15
+ * The text tokens are also the tuned ones: `--color-surface-500` was moved to
16
+ * #797979 precisely so muted type clears AA on both grounds. The slate scale
17
+ * carries no such guarantee — it is for surfaces.
18
+ */
19
+ function SelectInputLabel({ children, error }) {
20
+ return /* @__PURE__ */ jsx("div", {
21
+ className: cls("text-sm font-medium ml-3.5 mb-1", error ? "text-red-600 dark:text-red-500" : "text-text-secondary dark:text-text-secondary-dark"),
22
+ children
23
+ });
24
+ }
25
+ //#endregion
26
+ export { SelectInputLabel };
27
+
28
+ //# sourceMappingURL=SelectInputLabel.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInputLabel.es.js","names":[],"sources":["../../../src/components/common/SelectInputLabel.tsx"],"sourcesContent":["import React from \"react\";\nimport { cls } from \"../../util\";\n\n/**\n * The label above a Select or MultiSelect.\n *\n * It used `text-surface-accent-500` — a SURFACE scale, borrowed for type. The\n * label above a TextField has always used `text-text-secondary`, and the two are\n * the same role, so a form mixing the components showed two different label\n * colours: `#64748b` blue-grey over a Select, `#757575` neutral over a TextField.\n * Measured side by side on /debug/ui, which is where it is most obvious, because\n * the reference puts them in adjacent columns.\n *\n * The text tokens are also the tuned ones: `--color-surface-500` was moved to\n * #797979 precisely so muted type clears AA on both grounds. The slate scale\n * carries no such guarantee — it is for surfaces.\n */\nexport function SelectInputLabel({ children, error }: { children: React.ReactNode, error?: boolean }) {\n return <div className={cls(\"text-sm font-medium ml-3.5 mb-1\",\n error ? \"text-red-600 dark:text-red-500\" : \"text-text-secondary dark:text-text-secondary-dark\")}>\n {children}\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgB,iBAAiB,EAAE,UAAU,SAAyD;CAClG,OAAO,oBAAC,OAAD;EAAK,WAAW,IAAI,mCACvB,QAAQ,mCAAmC,mDAAmD;EAC7F;CACA,CAAA;AACT"}
@@ -0,0 +1,64 @@
1
+ import { Collapse } from "./Collapse.es.js";
2
+ import { Autocomplete, AutocompleteItem, useAutoComplete } from "./Autocomplete.es.js";
3
+ import { Alert } from "./Alert.es.js";
4
+ import { Avatar } from "./Avatar.es.js";
5
+ import { BooleanSwitch } from "./BooleanSwitch.es.js";
6
+ import { BooleanSwitchWithLabel } from "./BooleanSwitchWithLabel.es.js";
7
+ import { Button } from "./Button.es.js";
8
+ import { Card } from "./Card.es.js";
9
+ import { Container } from "./Container.es.js";
10
+ import { CenteredView } from "./CenteredView.es.js";
11
+ import { CircularProgress } from "./CircularProgress.es.js";
12
+ import { Typography } from "./Typography.es.js";
13
+ import { CircularProgressCenter } from "./CircularProgressCenter.es.js";
14
+ import { ErrorBoundary } from "./ErrorBoundary.es.js";
15
+ import { Checkbox } from "./Checkbox.es.js";
16
+ import { Chip } from "./Chip.es.js";
17
+ import { IconButton } from "./IconButton.es.js";
18
+ import { Tooltip, TooltipProvider } from "./Tooltip.es.js";
19
+ import { ColorPicker } from "./ColorPicker.es.js";
20
+ import { InputLabel } from "./InputLabel.es.js";
21
+ import { DateTimeField } from "./DateTimeField.es.js";
22
+ import { Dialog } from "./Dialog.es.js";
23
+ import { DialogActions } from "./DialogActions.es.js";
24
+ import { DialogContent } from "./DialogContent.es.js";
25
+ import { DialogTitle } from "./DialogTitle.es.js";
26
+ import { ExpandablePanel } from "./ExpandablePanel.es.js";
27
+ import { FileUpload } from "./FileUpload.es.js";
28
+ import { FilterChip } from "./FilterChip.es.js";
29
+ import { InfoLabel } from "./InfoLabel.es.js";
30
+ import { Label } from "./Label.es.js";
31
+ import { LoadingButton } from "./LoadingButton.es.js";
32
+ import { Markdown } from "./Markdown.es.js";
33
+ import { Menu, MenuItem } from "./Menu.es.js";
34
+ import { Menubar, MenubarCheckboxItem, MenubarContent, MenubarItem, MenubarItemIndicator, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarSubTriggerIndicator, MenubarTrigger } from "./Menubar.es.js";
35
+ import { Separator } from "./Separator.es.js";
36
+ import { MultiSelect, MultiSelectContext, MultiSelectItem } from "./MultiSelect.es.js";
37
+ import { Paper } from "./Paper.es.js";
38
+ import { RadioGroup, RadioGroupItem } from "./RadioGroup.es.js";
39
+ import { ResizablePanels } from "./ResizablePanels.es.js";
40
+ import { SearchBar } from "./SearchBar.es.js";
41
+ import { Select, SelectGroup, SelectItem } from "./Select.es.js";
42
+ import { Slider } from "./Slider.es.js";
43
+ import { Sheet } from "./Sheet.es.js";
44
+ import { TextareaAutosize } from "./TextareaAutosize.es.js";
45
+ import { TextField } from "./TextField.es.js";
46
+ import { Tab, Tabs } from "./Tabs.es.js";
47
+ import { Table, TableBody, TableCell, TableHeader, TableRow } from "./Table.es.js";
48
+ import { Popover } from "./Popover.es.js";
49
+ import { Badge } from "./Badge.es.js";
50
+ import { DebouncedTextField } from "./DebouncedTextField.es.js";
51
+ import { Skeleton } from "./Skeleton.es.js";
52
+ import { ToggleButtonGroup } from "./ToggleButtonGroup.es.js";
53
+ import { VirtualTable } from "./VirtualTable/VirtualTable.es.js";
54
+ import { createVirtualTableSelectionStore, useVirtualTableCellSelected } from "./VirtualTable/selection/SelectionStore.es.js";
55
+ import { VirtualTableSelectionProvider, useVirtualTableSelection } from "./VirtualTable/selection/SelectionContext.es.js";
56
+ import { VirtualTableInput } from "./VirtualTable/fields/VirtualTableInput.es.js";
57
+ import { VirtualTableNumberInput } from "./VirtualTable/fields/VirtualTableNumberInput.es.js";
58
+ import { VirtualTableSwitch } from "./VirtualTable/fields/VirtualTableSwitch.es.js";
59
+ import { VirtualTableDateField } from "./VirtualTable/fields/VirtualTableDateField.es.js";
60
+ import { VirtualTableSelect } from "./VirtualTable/fields/VirtualTableSelect.es.js";
61
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
62
+ import * as Portal from "@radix-ui/react-portal";
63
+ import { Slot } from "@radix-ui/react-slot";
64
+ export { Alert, Autocomplete, AutocompleteItem, Avatar, Badge, BooleanSwitch, BooleanSwitchWithLabel, Button, Card, CenteredView, Checkbox, Chip, CircularProgress, CircularProgressCenter, Collapse, ColorPicker, Container, DateTimeField, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, FileUpload, FilterChip, IconButton, InfoLabel, InputLabel, Label, LoadingButton, Markdown, Menu, MenuItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarItem, MenubarItemIndicator, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarSubTriggerIndicator, MenubarTrigger, MultiSelect, MultiSelectContext, MultiSelectItem, Paper, Popover, PopoverPrimitive, Portal, RadioGroup, RadioGroupItem, ResizablePanels, SearchBar, Select, SelectGroup, SelectItem, Separator, Sheet, Skeleton, Slider, Slot, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TextField, TextareaAutosize, ToggleButtonGroup, Tooltip, TooltipProvider, Typography, VirtualTable, VirtualTableDateField, VirtualTableInput, VirtualTableNumberInput, VirtualTableSelect, VirtualTableSelectionProvider, VirtualTableSwitch, createVirtualTableSelectionStore, useAutoComplete, useVirtualTableCellSelected, useVirtualTableSelection };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { createContext, useContext, useMemo } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/hooks/PortalContainerContext.tsx
5
+ var PortalContainerContext = createContext(void 0);
6
+ /**
7
+ * Provider component that sets the portal container for all descendants.
8
+ * This can be used at any level of the tree to specify where portals should be attached.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const containerRef = useRef<HTMLDivElement>(null);
13
+ *
14
+ * <div ref={containerRef}>
15
+ * <PortalContainerProvider container={containerRef.current}>
16
+ * <YourComponents />
17
+ * </PortalContainerProvider>
18
+ * </div>
19
+ * ```
20
+ */
21
+ function PortalContainerProvider({ container, children }) {
22
+ const contextValue = useMemo(() => ({ container }), [container]);
23
+ return /* @__PURE__ */ jsx(PortalContainerContext.Provider, {
24
+ value: contextValue,
25
+ children
26
+ });
27
+ }
28
+ /**
29
+ * Hook to access the portal container from context.
30
+ * Returns null if no provider is found in the tree.
31
+ *
32
+ * @returns The portal container element or null
33
+ */
34
+ function usePortalContainer() {
35
+ return useContext(PortalContainerContext)?.container ?? null;
36
+ }
37
+ //#endregion
38
+ export { PortalContainerProvider, usePortalContainer };
39
+
40
+ //# sourceMappingURL=PortalContainerContext.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PortalContainerContext.es.js","names":[],"sources":["../../src/hooks/PortalContainerContext.tsx"],"sourcesContent":["\"use client\";\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nexport interface PortalContainerContextType {\n container: HTMLElement | null;\n}\n\nconst PortalContainerContext = createContext<PortalContainerContextType | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n container: HTMLElement | null;\n children: React.ReactNode;\n}\n\n/**\n * Provider component that sets the portal container for all descendants.\n * This can be used at any level of the tree to specify where portals should be attached.\n *\n * @example\n * ```tsx\n * const containerRef = useRef<HTMLDivElement>(null);\n *\n * <div ref={containerRef}>\n * <PortalContainerProvider container={containerRef.current}>\n * <YourComponents />\n * </PortalContainerProvider>\n * </div>\n * ```\n */\nexport function PortalContainerProvider({ container, children }: PortalContainerProviderProps) {\n const contextValue = useMemo(() => ({ container }), [container]);\n\n return (\n <PortalContainerContext.Provider value={contextValue}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Hook to access the portal container from context.\n * Returns null if no provider is found in the tree.\n *\n * @returns The portal container element or null\n */\nexport function usePortalContainer(): HTMLElement | null {\n const context = useContext(PortalContainerContext);\n return context?.container ?? null;\n}\n\n"],"mappings":";;;;AAOA,IAAM,yBAAyB,cAAsD,KAAA,CAAS;;;;;;;;;;;;;;;;AAsB9F,SAAgB,wBAAwB,EAAE,WAAW,YAA0C;CAC3F,MAAM,eAAe,eAAe,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC;CAE/D,OACI,oBAAC,uBAAuB,UAAxB;EAAiC,OAAO;EACnC;CAC4B,CAAA;AAEzC;;;;;;;AAQA,SAAgB,qBAAyC;CAErD,OADgB,WAAW,sBACpB,CAAA,EAAS,aAAa;AACjC"}
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ /**
3
+ * The words the kit itself puts on screen: the list and card views' notices,
4
+ * the table's error title, the search bar's names, and the relative-time
5
+ * phrases of `formatRelativeTime` (`@rebasepro/utils`).
6
+ *
7
+ * A label that carries a value is a function of it, so a translation can
8
+ * choose its own plural form.
9
+ */
10
+ export interface UiLabels {
11
+ /** A list or card view that could not load its first page: "Error loading data: <message>". */
12
+ errorLoadingData: (message: string) => string;
13
+ /** A list or card view with no rows. */
14
+ noEntriesFound: string;
15
+ /** Under the last row of a list or card view: "All <count> entries loaded". */
16
+ allEntriesLoaded: (count: number) => string;
17
+ /** The title of a table that could not load its rows. */
18
+ error: string;
19
+ /** The search bar's name, and its placeholder when none is given. */
20
+ search: string;
21
+ /** The search bar's clear button. */
22
+ clearSearch: string;
23
+ /** A row's or card's selection checkbox in the collection views. */
24
+ select: string;
25
+ /** The button that opens a time-of-day field's picker (`DateTimeField mode="time"`). */
26
+ openTimePicker: string;
27
+ /** The phrases `formatRelativeTime` (`@rebasepro/utils`) takes as `labels`. */
28
+ relativeTime: UiRelativeTimeLabels;
29
+ }
30
+ /** Relative-time phrases, as `formatRelativeTime`'s `labels` option takes them. */
31
+ export interface UiRelativeTimeLabels {
32
+ justNow: string;
33
+ inAMoment: string;
34
+ minutesAgo: (count: number) => string;
35
+ inMinutes: (count: number) => string;
36
+ hoursAgo: (count: number) => string;
37
+ inHours: (count: number) => string;
38
+ daysAgo: (count: number) => string;
39
+ inDays: (count: number) => string;
40
+ }
41
+ /** The English labels: exactly the strings the kit rendered before it took any. */
42
+ export declare const defaultUiLabels: UiLabels;
43
+ export interface UiLabelsProviderProps {
44
+ /** The labels to use; any left out keep their English default. */
45
+ labels: Partial<Omit<UiLabels, "relativeTime">> & {
46
+ relativeTime?: Partial<UiRelativeTimeLabels>;
47
+ };
48
+ children: React.ReactNode;
49
+ }
50
+ /**
51
+ * Gives the kit's own words in another language. `@rebasepro/app` mounts one
52
+ * filled from its translations; without a provider the kit speaks English.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <UiLabelsProvider labels={{ noEntriesFound: "Nessun elemento" }}>
57
+ * <ListView …/>
58
+ * </UiLabelsProvider>
59
+ * ```
60
+ */
61
+ export declare function UiLabelsProvider({ labels, children }: UiLabelsProviderProps): React.JSX.Element;
62
+ /** The labels in effect: the nearest {@link UiLabelsProvider}'s, or English. */
63
+ export declare function useUiLabels(): UiLabels;