@payfit/unity-components 1.0.0 → 1.1.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 (254) hide show
  1. package/dist/esm/components/action-bar/ActionBar.d.ts +153 -0
  2. package/dist/esm/components/action-bar/ActionBar.js +173 -0
  3. package/dist/esm/components/action-bar/parts/ActionBarAction.d.ts +44 -0
  4. package/dist/esm/components/action-bar/parts/ActionBarAction.js +45 -0
  5. package/dist/esm/components/action-bar/parts/ActionBarRoot.d.ts +44 -0
  6. package/dist/esm/components/action-bar/parts/ActionBarRoot.js +46 -0
  7. package/dist/esm/components/actionable/Actionable.js +20 -21
  8. package/dist/esm/components/alert/Alert.d.ts +1 -1
  9. package/dist/esm/components/alert/Alert.js +1 -1
  10. package/dist/esm/components/alert/parts/AlertActions.d.ts +1 -1
  11. package/dist/esm/components/alert/parts/AlertActions.js +1 -1
  12. package/dist/esm/components/alert/parts/AlertContent.d.ts +1 -1
  13. package/dist/esm/components/alert/parts/AlertTitle.d.ts +1 -1
  14. package/dist/esm/components/anchor/Anchor.js +1 -1
  15. package/dist/esm/components/app-layout/AppLayout.js +6 -6
  16. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +30 -30
  17. package/dist/esm/components/app-menu/parts/AppMenuNavContent.js +1 -1
  18. package/dist/esm/components/autocomplete/Autocomplete.d.ts +1 -1
  19. package/dist/esm/components/autocomplete/Autocomplete.js +14 -14
  20. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  21. package/dist/esm/components/autocomplete/parts/AutocompleteItem.d.ts +1 -1
  22. package/dist/esm/components/autocomplete/parts/AutocompleteItem.js +4 -4
  23. package/dist/esm/components/autocomplete/parts/AutocompleteItemGroup.d.ts +1 -1
  24. package/dist/esm/components/autocomplete/parts/AutocompleteItemGroup.js +12 -12
  25. package/dist/esm/components/autocomplete/parts/AutocompletePanel.d.ts +1 -1
  26. package/dist/esm/components/autocomplete/parts/AutocompletePanel.js +7 -7
  27. package/dist/esm/components/avatar/Avatar.d.ts +1 -1
  28. package/dist/esm/components/avatar/Avatar.js +15 -16
  29. package/dist/esm/components/avatar/Avatar.variants.js +1 -1
  30. package/dist/esm/components/avatar/parts/AvatarFallback.d.ts +1 -1
  31. package/dist/esm/components/avatar/parts/AvatarFallback.js +9 -10
  32. package/dist/esm/components/avatar/parts/AvatarImage.js +12 -12
  33. package/dist/esm/components/avatar/parts/AvatarPair.d.ts +1 -1
  34. package/dist/esm/components/avatar/parts/AvatarPair.js +4 -4
  35. package/dist/esm/components/badge/Badge.d.ts +1 -1
  36. package/dist/esm/components/badge/Badge.js +31 -35
  37. package/dist/esm/components/bottom-sheet/BottomSheet.d.ts +1 -1
  38. package/dist/esm/components/bottom-sheet/BottomSheet.js +14 -14
  39. package/dist/esm/components/bottom-sheet/parts/BottomSheetContent.d.ts +1 -1
  40. package/dist/esm/components/bottom-sheet/parts/BottomSheetContent.js +4 -4
  41. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +11 -11
  42. package/dist/esm/components/bottom-sheet/parts/BottomSheetFooter.d.ts +1 -1
  43. package/dist/esm/components/bottom-sheet/parts/BottomSheetFooter.js +4 -4
  44. package/dist/esm/components/bottom-sheet/parts/BottomSheetHeader.d.ts +4 -4
  45. package/dist/esm/components/bottom-sheet/parts/BottomSheetHeader.js +6 -6
  46. package/dist/esm/components/breadcrumbs/Breadcrumbs.context.d.ts +1 -1
  47. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
  48. package/dist/esm/components/breadcrumbs/Breadcrumbs.variant.js +3 -3
  49. package/dist/esm/components/button/Button.js +33 -41
  50. package/dist/esm/components/button/Button.variants.d.ts +1 -1
  51. package/dist/esm/components/button/Button.variants.js +1 -1
  52. package/dist/esm/components/checkbox/Checkbox.js +53 -49
  53. package/dist/esm/components/checkbox/Checkbox.variants.js +1 -1
  54. package/dist/esm/components/checkbox/parts/CheckboxIndicator.js +1 -1
  55. package/dist/esm/components/checkbox-field/CheckboxField.js +39 -34
  56. package/dist/esm/components/checkbox-group/CheckboxGroup.d.ts +1 -1
  57. package/dist/esm/components/checkbox-group/CheckboxGroup.js +12 -12
  58. package/dist/esm/components/collapsible/Collapsible.js +22 -16
  59. package/dist/esm/components/collapsible/parts/CollapsibleContent.js +16 -7
  60. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +23 -23
  61. package/dist/esm/components/data-table/DataTable.d.ts +48 -17
  62. package/dist/esm/components/data-table/DataTable.js +104 -60
  63. package/dist/esm/components/data-table/mocks/employee-columns.d.ts +4 -0
  64. package/dist/esm/components/data-table/parts/DataTableBulkActions.d.ts +55 -0
  65. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +65 -0
  66. package/dist/esm/components/data-table/parts/DataTableRoot.d.ts +37 -0
  67. package/dist/esm/components/data-table/parts/DataTableRoot.js +13 -0
  68. package/dist/esm/components/date-calendar/DateCalendar.js +8 -8
  69. package/dist/esm/components/date-picker/DatePicker.js +9 -9
  70. package/dist/esm/components/date-picker/parts/DateInput.js +7 -7
  71. package/dist/esm/components/date-picker-field/DatePickerField.js +12 -12
  72. package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +4 -4
  73. package/dist/esm/components/dialog/Dialog.d.ts +1 -1
  74. package/dist/esm/components/dialog/Dialog.js +9 -9
  75. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +1 -1
  76. package/dist/esm/components/fieldset/Fieldset.d.ts +1 -1
  77. package/dist/esm/components/fieldset/Fieldset.js +4 -4
  78. package/dist/esm/components/flex/Flex.d.ts +1 -1
  79. package/dist/esm/components/flex/Flex.variants.js +189 -207
  80. package/dist/esm/components/flex/FlexItem.d.ts +1 -1
  81. package/dist/esm/components/form/Form.context.d.ts +1 -4
  82. package/dist/esm/components/form/Form.context.js +11 -13
  83. package/dist/esm/components/form/Form.d.ts +13 -11
  84. package/dist/esm/components/form/Form.js +45 -48
  85. package/dist/esm/components/form-field/FormField.context.d.ts +1 -6
  86. package/dist/esm/components/form-field/FormField.context.js +39 -47
  87. package/dist/esm/components/form-field/FormField.d.ts +0 -2
  88. package/dist/esm/components/form-field/FormField.js +37 -42
  89. package/dist/esm/components/form-field/parts/FormContextualLink.js +17 -17
  90. package/dist/esm/components/form-field/parts/FormControl.js +39 -35
  91. package/dist/esm/components/form-field/parts/FormFeedbackText.js +15 -17
  92. package/dist/esm/components/full-page-loader/FullPageLoader.js +7 -7
  93. package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +2 -2
  94. package/dist/esm/components/funnel-layout/FunnelLayout.js +26 -26
  95. package/dist/esm/components/funnel-layout/parts/FunnelBody.d.ts +2 -2
  96. package/dist/esm/components/funnel-layout/parts/FunnelBody.js +4 -4
  97. package/dist/esm/components/funnel-layout/parts/FunnelPage.d.ts +2 -2
  98. package/dist/esm/components/funnel-layout/parts/FunnelPage.js +10 -10
  99. package/dist/esm/components/funnel-layout/parts/FunnelPageAction.d.ts +1 -1
  100. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.d.ts +2 -2
  101. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +13 -13
  102. package/dist/esm/components/funnel-layout/parts/FunnelPageContent.d.ts +2 -2
  103. package/dist/esm/components/funnel-layout/parts/FunnelPageContent.js +1 -1
  104. package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.d.ts +2 -2
  105. package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +7 -7
  106. package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
  107. package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.js +4 -4
  108. package/dist/esm/components/funnel-layout/parts/FunnelProgressBar.d.ts +1 -1
  109. package/dist/esm/components/funnel-layout/parts/FunnelProgressBar.js +4 -4
  110. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  111. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +7 -7
  112. package/dist/esm/components/funnel-layout/parts/FunnelTopBar.d.ts +2 -2
  113. package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +9 -9
  114. package/dist/esm/components/grid/Grid.d.ts +1 -1
  115. package/dist/esm/components/grid/Grid.variants.d.ts +1 -1
  116. package/dist/esm/components/grid/Grid.variants.js +3 -3
  117. package/dist/esm/components/grid/GridItem.d.ts +1 -1
  118. package/dist/esm/components/icon/Icon.d.ts +1 -1
  119. package/dist/esm/components/icon/Icon.js +1 -1
  120. package/dist/esm/components/icon-button/CircularIconButton.d.ts +1 -1
  121. package/dist/esm/components/icon-button/CircularIconButton.js +21 -20
  122. package/dist/esm/components/icon-button/IconButton.variants.d.ts +1 -1
  123. package/dist/esm/components/icon-button/IconButton.variants.js +2 -2
  124. package/dist/esm/components/input/Input.js +6 -6
  125. package/dist/esm/components/label/Label.js +13 -13
  126. package/dist/esm/components/link/Link.d.ts +11 -1
  127. package/dist/esm/components/link/Link.js +32 -30
  128. package/dist/esm/components/link/Link.variants.d.ts +141 -30
  129. package/dist/esm/components/link/Link.variants.js +44 -16
  130. package/dist/esm/components/menu/parts/MenuItem.js +8 -8
  131. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +14 -14
  132. package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.js +5 -5
  133. package/dist/esm/components/multi-select/parts/MultiSelectOption.js +3 -3
  134. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +1 -1
  135. package/dist/esm/components/multi-select-field/MultiSelectField.js +6 -6
  136. package/dist/esm/components/nav/parts/NavGroup.js +28 -29
  137. package/dist/esm/components/nav/parts/NavItem.d.ts +1 -1
  138. package/dist/esm/components/nav/parts/NavItem.js +13 -14
  139. package/dist/esm/components/number-field/NumberField.js +14 -14
  140. package/dist/esm/components/number-input/NumberInput.d.ts +2 -2
  141. package/dist/esm/components/number-input/NumberInput.js +37 -37
  142. package/dist/esm/components/page/Page.d.ts +1 -1
  143. package/dist/esm/components/page/Page.js +5 -5
  144. package/dist/esm/components/page/parts/PageHeader.d.ts +1 -1
  145. package/dist/esm/components/page/parts/PageHeader.js +4 -4
  146. package/dist/esm/components/pagination/Pagination.d.ts +1 -1
  147. package/dist/esm/components/pagination/Pagination.js +16 -16
  148. package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +1 -1
  149. package/dist/esm/components/pagination/parts/PaginationEllipsis.js +8 -8
  150. package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +9 -9
  151. package/dist/esm/components/pagination/parts/PaginationLink.d.ts +1 -1
  152. package/dist/esm/components/pagination/parts/PaginationLink.js +6 -6
  153. package/dist/esm/components/payfit-brand/PayFitBrand.js +4 -4
  154. package/dist/esm/components/pill/Pill.d.ts +1 -1
  155. package/dist/esm/components/pill/Pill.js +1 -1
  156. package/dist/esm/components/popover/Popover.js +5 -5
  157. package/dist/esm/components/popover/parts/PopoverHeader.js +7 -7
  158. package/dist/esm/components/progress-bar/ProgressBar.js +11 -11
  159. package/dist/esm/components/radio-button-group/parts/RadioButton.d.ts +1 -1
  160. package/dist/esm/components/radio-button-group/parts/RadioButton.js +5 -5
  161. package/dist/esm/components/search/Search.d.ts +1 -1
  162. package/dist/esm/components/search/Search.js +14 -14
  163. package/dist/esm/components/segmented-button-group/parts/ToggleButton.js +10 -10
  164. package/dist/esm/components/select/Select.js +12 -12
  165. package/dist/esm/components/select/parts/SearchInput.js +7 -7
  166. package/dist/esm/components/select/parts/SelectButton.js +17 -14
  167. package/dist/esm/components/select/parts/SelectOption.js +4 -4
  168. package/dist/esm/components/select/parts/SelectOptionGroup.js +8 -8
  169. package/dist/esm/components/select/parts/SelectOptionHelper.js +1 -1
  170. package/dist/esm/components/select-field/SelectField.d.ts +1 -1
  171. package/dist/esm/components/select-field/SelectField.js +16 -16
  172. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +1 -1
  173. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +8 -8
  174. package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +10 -10
  175. package/dist/esm/components/selectable-card/internals/Content.js +5 -5
  176. package/dist/esm/components/selectable-card/internals/Description.js +1 -1
  177. package/dist/esm/components/selectable-card/internals/Illustration.js +3 -3
  178. package/dist/esm/components/selectable-card/internals/SelectedIndicator.js +4 -4
  179. package/dist/esm/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.d.ts +1 -1
  180. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/RadioIndicator.js +3 -3
  181. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.d.ts +1 -1
  182. package/dist/esm/components/selectable-card/selectableCard.variant.js +1 -1
  183. package/dist/esm/components/selectable-card-radio-group-field/SelectableCardRadioGroupField.js +22 -22
  184. package/dist/esm/components/side-panel/SidePanel.d.ts +1 -1
  185. package/dist/esm/components/side-panel/SidePanel.js +6 -6
  186. package/dist/esm/components/side-panel/parts/SidePanelContent.d.ts +1 -1
  187. package/dist/esm/components/side-panel/parts/SidePanelContent.js +9 -9
  188. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +11 -11
  189. package/dist/esm/components/side-panel/parts/SidePanelFooter.d.ts +1 -1
  190. package/dist/esm/components/side-panel/parts/SidePanelFooter.js +4 -4
  191. package/dist/esm/components/side-panel/parts/SidePanelHeader.d.ts +4 -4
  192. package/dist/esm/components/side-panel/parts/SidePanelHeader.js +6 -6
  193. package/dist/esm/components/skip-links/SkipLinks.d.ts +79 -0
  194. package/dist/esm/components/skip-links/SkipLinks.js +80 -0
  195. package/dist/esm/components/spinner/Spinner.js +5 -5
  196. package/dist/esm/components/table/Table.js +101 -100
  197. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.d.ts +1 -19
  198. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +147 -95
  199. package/dist/esm/components/table/parts/TableBody.js +1 -1
  200. package/dist/esm/components/table/parts/TableCell.d.ts +17 -1
  201. package/dist/esm/components/table/parts/TableCell.js +45 -41
  202. package/dist/esm/components/table/parts/TableColumnHeader.d.ts +2 -1
  203. package/dist/esm/components/table/parts/TableColumnHeader.js +63 -57
  204. package/dist/esm/components/table/parts/TableEmptyState.d.ts +1 -1
  205. package/dist/esm/components/table/parts/TableEmptyState.js +1 -1
  206. package/dist/esm/components/table/parts/TableHeader.d.ts +3 -3
  207. package/dist/esm/components/table/parts/TableHeader.js +28 -26
  208. package/dist/esm/components/table/parts/TablePagination.d.ts +1 -1
  209. package/dist/esm/components/table/parts/TablePagination.js +9 -9
  210. package/dist/esm/components/table/parts/TableRow.d.ts +1 -1
  211. package/dist/esm/components/table/parts/TableRow.js +36 -34
  212. package/dist/esm/components/tabs/Tabs.context.d.ts +1 -1
  213. package/dist/esm/components/tabs/Tabs.d.ts +1 -1
  214. package/dist/esm/components/tabs/Tabs.variant.js +1 -1
  215. package/dist/esm/components/tabs/parts/NavigationButton.js +12 -12
  216. package/dist/esm/components/tabs/parts/Tab.d.ts +3 -2
  217. package/dist/esm/components/tabs/parts/Tab.js +12 -12
  218. package/dist/esm/components/tabs/parts/TabPanel.d.ts +4 -2
  219. package/dist/esm/components/tabs/parts/TabPanel.js +7 -7
  220. package/dist/esm/components/task-menu/TaskMenu.d.ts +1 -1
  221. package/dist/esm/components/task-menu/TaskMenu.js +7 -7
  222. package/dist/esm/components/task-menu/parts/Content.js +6 -6
  223. package/dist/esm/components/task-menu/parts/Header.js +7 -7
  224. package/dist/esm/components/task-menu/parts/SubTask.js +6 -6
  225. package/dist/esm/components/task-menu/parts/Task.d.ts +1 -1
  226. package/dist/esm/components/task-menu/parts/Task.js +12 -12
  227. package/dist/esm/components/task-menu/parts/TaskGroup.js +7 -7
  228. package/dist/esm/components/task-menu/parts/task.variants.js +1 -1
  229. package/dist/esm/components/text/Text.d.ts +1 -1
  230. package/dist/esm/components/text/Text.variants.js +1 -1
  231. package/dist/esm/components/text-area/TextArea.js +6 -6
  232. package/dist/esm/components/text-field/TextField.js +5 -5
  233. package/dist/esm/components/toast/UnityToast.d.ts +1 -1
  234. package/dist/esm/components/toast/UnityToast.js +11 -11
  235. package/dist/esm/components/toggle-switch/ToggleSwitch.d.ts +1 -1
  236. package/dist/esm/components/toggle-switch/ToggleSwitch.js +4 -4
  237. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +35 -31
  238. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.d.ts +1 -1
  239. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +5 -5
  240. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +43 -38
  241. package/dist/esm/components/tooltip/Tooltip.d.ts +2 -0
  242. package/dist/esm/components/tooltip/Tooltip.js +27 -19
  243. package/dist/esm/hooks/use-form.js +7 -7
  244. package/dist/esm/index.d.ts +6 -1
  245. package/dist/esm/index.js +366 -352
  246. package/dist/esm/integrations/react-router/v5/UnityReactRouterV5Provider.js +28 -0
  247. package/dist/esm/integrations/react-router/v5/index.d.ts +1 -0
  248. package/dist/esm/integrations/react-router/v5.js +4 -0
  249. package/i18n/en-GB.json +6 -0
  250. package/i18n/es-ES.json +6 -0
  251. package/i18n/fr-FR.json +6 -0
  252. package/package.json +38 -35
  253. package/dist/esm/providers/router/integrations/UnityReactRouterV5Provider.js +0 -28
  254. /package/dist/esm/{providers/router/integrations → integrations/react-router/v5}/UnityReactRouterV5Provider.d.ts +0 -0
@@ -1,157 +1,209 @@
1
- import { useState as F, useRef as I, useCallback as i } from "react";
2
- function E() {
3
- const [w, f] = F({
1
+ import { useState as I, useRef as M, useCallback as i } from "react";
2
+ const U = 'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])';
3
+ function O() {
4
+ const [m, A] = I({
4
5
  rowIndex: 0,
5
6
  colIndex: 0
6
- }), c = I(null), r = i(
7
- (e, n) => {
8
- c.current && (f({ rowIndex: e, colIndex: n }), requestAnimationFrame(() => {
9
- if (!c.current) return;
10
- const l = Array.from(c.current.querySelectorAll("tr"));
11
- if (e >= 0 && e < l.length) {
12
- const o = l[e];
13
- if (!o) return;
14
- const t = Array.from(o.querySelectorAll("td, th"));
15
- if (n >= 0 && n < t.length) {
16
- const s = t[n];
17
- document.activeElement !== s && s.focus({ preventScroll: !1 });
7
+ }), a = M(null), d = i(
8
+ (e, t, s) => {
9
+ const c = e.querySelectorAll(
10
+ U
11
+ );
12
+ if (c.length > 0) {
13
+ const n = c[0];
14
+ return A({ rowIndex: t, colIndex: s }), requestAnimationFrame(() => {
15
+ n.focus({ preventScroll: !1 });
16
+ }), !0;
17
+ }
18
+ return !1;
19
+ },
20
+ [A]
21
+ ), b = i(
22
+ (e, t, s) => {
23
+ if (!a.current) return null;
24
+ const c = Array.from(a.current.querySelectorAll("tr"));
25
+ if (e < 0 || e >= c.length) return null;
26
+ const n = c[e];
27
+ if (!n) return null;
28
+ const r = Array.from(n.querySelectorAll("td, th"));
29
+ if (s === "right") {
30
+ for (let o = t + 1; o < r.length; o++)
31
+ if (r[o].dataset.focusable !== "false")
32
+ return { rowIndex: e, colIndex: o };
33
+ } else
34
+ for (let o = t - 1; o >= 0; o--)
35
+ if (r[o].dataset.focusable !== "false")
36
+ return { rowIndex: e, colIndex: o };
37
+ return null;
38
+ },
39
+ []
40
+ ), l = i(
41
+ (e, t, s) => {
42
+ if (!a.current) return;
43
+ const c = Array.from(a.current.querySelectorAll("tr"));
44
+ if (e < 0 || e >= c.length) return;
45
+ const n = c[e];
46
+ if (!n) return;
47
+ const r = Array.from(n.querySelectorAll("td, th"));
48
+ if (t < 0 || t >= r.length) return;
49
+ const o = r[t];
50
+ if (!(o.dataset.focusable !== "false")) {
51
+ if (d(o, e, t))
52
+ return;
53
+ if (s) {
54
+ const f = b(
55
+ e,
56
+ t,
57
+ s
58
+ );
59
+ if (f) {
60
+ l(f.rowIndex, f.colIndex);
61
+ return;
18
62
  }
19
63
  }
20
- }));
64
+ return;
65
+ }
66
+ A({ rowIndex: e, colIndex: t }), requestAnimationFrame(() => {
67
+ document.activeElement !== o && o.focus({ preventScroll: !1 });
68
+ });
21
69
  },
22
- [f]
23
- ), p = i(
70
+ [A, d, b]
71
+ ), v = i(
24
72
  (e) => {
25
- c.current && (f({ rowIndex: e, colIndex: 0 }), requestAnimationFrame(() => {
26
- if (!c.current) return;
27
- const n = Array.from(c.current.querySelectorAll("tr"));
28
- if (e >= 0 && e < n.length) {
29
- const l = n[e];
30
- document.activeElement !== l && l.focus();
31
- }
32
- }));
73
+ if (!a.current) return;
74
+ const t = Array.from(a.current.querySelectorAll("tr"));
75
+ e < 0 || e >= t.length || !t[e] || l(e, 0);
33
76
  },
34
- [f]
35
- ), b = i(
77
+ [l]
78
+ ), S = i(
36
79
  (e) => {
37
80
  e.target === e.currentTarget && (e.preventDefault(), requestAnimationFrame(() => {
38
- r(0, 0);
81
+ l(0, 0);
39
82
  }));
40
83
  },
41
- [r]
84
+ [l]
42
85
  ), k = i(
43
86
  (e) => {
44
- const n = e.target, l = n.closest("tr");
45
- if (!l || !c.current) return;
46
- const t = Array.from(c.current.querySelectorAll("tr")).indexOf(l), a = Array.from(l.querySelectorAll("td, th")).indexOf(n);
47
- t >= 0 && a >= 0 && (f({ rowIndex: t, colIndex: a }), requestAnimationFrame(() => {
48
- c.current && (c.current.querySelectorAll("td, th").forEach((m) => {
49
- m.setAttribute("tabindex", "-1");
50
- }), n && n.setAttribute("tabindex", "0"));
87
+ const t = e.target, s = e.currentTarget;
88
+ if (t !== s)
89
+ return;
90
+ const c = t.closest("tr");
91
+ if (!c || !a.current) return;
92
+ const r = Array.from(a.current.querySelectorAll("tr")).indexOf(c), u = Array.from(c.querySelectorAll("td, th")).indexOf(t);
93
+ r >= 0 && u >= 0 && (A({ rowIndex: r, colIndex: u }), requestAnimationFrame(() => {
94
+ a.current && (a.current.querySelectorAll("td, th").forEach((f) => {
95
+ f.setAttribute("tabindex", "-1");
96
+ }), t.setAttribute("tabindex", "0"));
51
97
  }));
52
98
  },
53
- [f]
54
- ), D = i(
55
- (e, n) => w.rowIndex === e && w.colIndex === n,
56
- [w]
99
+ [A]
57
100
  ), q = i(
101
+ (e, t) => m.rowIndex === e && m.colIndex === t,
102
+ [m]
103
+ ), D = i(
58
104
  (e) => {
59
- if (e.key !== "Tab" && e.target === e.currentTarget && c.current)
105
+ if (e.key !== "Tab" && e.target === e.currentTarget && a.current)
60
106
  switch (e.key) {
61
107
  case "ArrowDown":
62
108
  case "ArrowRight":
63
- e.preventDefault(), r(0, 0);
109
+ e.preventDefault(), l(0, 0);
64
110
  break;
65
111
  case "Home":
66
- e.preventDefault(), r(0, 0);
112
+ e.preventDefault(), l(0, 0);
67
113
  break;
68
114
  case "End":
69
115
  e.preventDefault();
70
- const n = Array.from(c.current.querySelectorAll("tr")), l = n.length - 1;
71
- if (l >= 0) {
72
- const o = n[l];
73
- if (!o) break;
74
- const t = Array.from(o.querySelectorAll("td, th"));
75
- r(l, t.length - 1);
116
+ const t = Array.from(a.current.querySelectorAll("tr")), s = t.length - 1;
117
+ if (s >= 0) {
118
+ const c = t[s];
119
+ if (!c) break;
120
+ const n = Array.from(c.querySelectorAll("td, th"));
121
+ l(s, n.length - 1);
76
122
  }
77
123
  break;
78
124
  }
79
125
  },
80
- [r]
81
- ), v = i(
126
+ [l]
127
+ ), x = i(
82
128
  (e) => {
83
- if (e.key === "Tab" || !c.current) return;
84
- const n = e.currentTarget, l = n.closest("tr");
85
- if (!l) return;
86
- const o = Array.from(c.current.querySelectorAll("tr")), t = o.indexOf(l), s = Array.from(l.querySelectorAll("td, th")), a = s.indexOf(n);
129
+ if (e.key === "Tab" || !a.current) return;
130
+ let t = e.currentTarget;
131
+ const s = e.target;
132
+ if (s !== t) {
133
+ const f = s.closest("td, th");
134
+ f && (t = f);
135
+ }
136
+ const c = t.closest("tr");
137
+ if (!c) return;
138
+ const n = Array.from(a.current.querySelectorAll("tr")), r = n.indexOf(c), o = Array.from(c.querySelectorAll("td, th")), u = o.indexOf(t);
87
139
  switch (e.key) {
88
140
  case "ArrowRight":
89
- e.preventDefault(), a < s.length - 1 ? r(t, a + 1) : r(t, 0);
141
+ e.preventDefault(), u < o.length - 1 ? l(r, u + 1, "right") : l(r, 0, "right");
90
142
  break;
91
143
  case "ArrowLeft":
92
- e.preventDefault(), a > 0 ? r(t, a - 1) : r(t, s.length - 1);
144
+ e.preventDefault(), u > 0 ? l(r, u - 1, "left") : l(r, o.length - 1, "left");
93
145
  break;
94
146
  case "ArrowDown":
95
- if (e.preventDefault(), t < o.length - 1) {
96
- const u = o[t + 1];
97
- if (!u) break;
98
- const h = Array.from(u.querySelectorAll("td, th")), A = Math.min(a, h.length - 1);
99
- r(t + 1, A);
147
+ if (e.preventDefault(), r < n.length - 1) {
148
+ const h = n[r + 1];
149
+ if (!h) break;
150
+ const g = Array.from(h.querySelectorAll("td, th")), y = Math.min(u, g.length - 1);
151
+ l(r + 1, y);
100
152
  }
101
153
  break;
102
154
  case "ArrowUp":
103
- if (e.preventDefault(), t > 0) {
104
- const u = o[t - 1];
105
- if (!u) break;
106
- const h = Array.from(u.querySelectorAll("td, th")), A = Math.min(a, h.length - 1);
107
- r(t - 1, A);
155
+ if (e.preventDefault(), r > 0) {
156
+ const h = n[r - 1];
157
+ if (!h) break;
158
+ const g = Array.from(h.querySelectorAll("td, th")), y = Math.min(u, g.length - 1);
159
+ l(r - 1, y);
108
160
  }
109
161
  break;
110
162
  case "Home":
111
- e.preventDefault(), e.ctrlKey ? r(0, 0) : r(t, 0);
163
+ e.preventDefault(), e.ctrlKey ? l(0, 0) : l(r, 0);
112
164
  break;
113
165
  case "End":
114
166
  if (e.preventDefault(), e.ctrlKey) {
115
- const u = o.length - 1, h = o[u];
116
- if (!h) break;
117
- const A = Array.from(h.querySelectorAll("td, th"));
118
- r(u, A.length - 1);
167
+ const h = n.length - 1, g = n[h];
168
+ if (!g) break;
169
+ const y = Array.from(g.querySelectorAll("td, th"));
170
+ l(h, y.length - 1);
119
171
  } else
120
- r(t, s.length - 1);
172
+ l(r, o.length - 1);
121
173
  break;
122
174
  case "PageUp":
123
175
  e.preventDefault();
124
- const m = Math.max(0, t - 5), y = o[m];
125
- if (!y) break;
126
- const x = Array.from(y.querySelectorAll("td, th")), R = Math.min(a, x.length - 1);
127
- r(m, R);
176
+ const f = Math.max(0, r - 5), p = n[f];
177
+ if (!p) break;
178
+ const R = Array.from(p.querySelectorAll("td, th")), E = Math.min(u, R.length - 1);
179
+ l(f, E);
128
180
  break;
129
181
  case "PageDown":
130
182
  e.preventDefault();
131
- const g = Math.min(o.length - 1, t + 5), d = o[g];
132
- if (!d) break;
133
- const S = Array.from(
134
- d.querySelectorAll("td, th")
135
- ), C = Math.min(a, S.length - 1);
136
- r(g, C);
183
+ const w = Math.min(n.length - 1, r + 5), C = n[w];
184
+ if (!C) break;
185
+ const T = Array.from(
186
+ C.querySelectorAll("td, th")
187
+ ), F = Math.min(u, T.length - 1);
188
+ l(w, F);
137
189
  break;
138
190
  }
139
191
  },
140
- [r]
192
+ [l]
141
193
  );
142
194
  return {
143
- focusedCell: w,
144
- setFocusedCell: f,
145
- isCellFocused: D,
146
- handleCellKeyDown: v,
147
- handleTableKeyDown: q,
148
- handleTableFocus: b,
195
+ focusedCell: m,
196
+ setFocusedCell: A,
197
+ isCellFocused: q,
198
+ handleCellKeyDown: x,
199
+ handleTableKeyDown: D,
200
+ handleTableFocus: S,
149
201
  handleCellFocus: k,
150
- tableRef: c,
151
- focusCell: r,
152
- focusRow: p
202
+ tableRef: a,
203
+ focusCell: l,
204
+ focusRow: v
153
205
  };
154
206
  }
155
207
  export {
156
- E as useTableKeyboardNavigation
208
+ O as useTableKeyboardNavigation
157
209
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import p, { forwardRef as b, Children as f, cloneElement as h } from "react";
3
- import { tv as v } from "tailwind-variants";
3
+ import { uyTv as v } from "@payfit/unity-themes";
4
4
  const C = v({
5
5
  base: ["uy:transition-all uy:duration-200 uy:ease-in-out"],
6
6
  variants: {
@@ -4,6 +4,12 @@ export interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElem
4
4
  rowIndex?: number;
5
5
  align?: 'left' | 'center' | 'right';
6
6
  isRowHeader?: boolean;
7
+ /**
8
+ * Whether this cell should be focusable for keyboard navigation.
9
+ * Set to false when the cell contains interactive elements like buttons, checkboxes, etc.
10
+ * @default true
11
+ */
12
+ isFocusable?: boolean;
7
13
  }
8
14
  export declare const tableCell: import('tailwind-variants').TVReturnType<{
9
15
  align: {
@@ -34,6 +40,7 @@ export declare const tableCell: import('tailwind-variants').TVReturnType<{
34
40
  * @param {number} [props.rowIndex=0] - The index of the row (automatically set by TableRow)
35
41
  * @param {'left' | 'center' | 'right'} [props.align] - The text alignment within the cell
36
42
  * @param {boolean} [props.isRowHeader=false] - Whether this cell is a row header (renders as `<th>` instead of `<td>`)
43
+ * @param {boolean} [props.isFocusable=true] - Whether this cell should be focusable for keyboard navigation. Set to false when the cell contains interactive elements.
37
44
  * @example
38
45
  * ```tsx
39
46
  * import { TableCell } from '@payfit/unity-components'
@@ -47,10 +54,19 @@ export declare const tableCell: import('tailwind-variants').TVReturnType<{
47
54
  *
48
55
  * <TableCell isRowHeader align="right">Employee ID</TableCell>
49
56
  * ```
57
+ * @example
58
+ * ```tsx
59
+ * // Cell with interactive content (checkbox) - not focusable
60
+ * import { TableCell, CheckboxStandalone } from '@payfit/unity-components'
61
+ *
62
+ * <TableCell isFocusable={false}>
63
+ * <CheckboxStandalone>Select item</CheckboxStandalone>
64
+ * </TableCell>
65
+ * ```
50
66
  * @see {@link TableCellProps} for all available props
51
67
  * @remarks
52
68
  * {@link https://unity-components.payfit.io/?path=/story/data-table-tablecell--docs|API and Demos} •
53
69
  * {@link https://payfit.design|Design docs}
54
70
  */
55
- declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
71
+ declare const TableCell: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>>;
56
72
  export { TableCell };
@@ -1,8 +1,8 @@
1
- import { jsx as x } from "react/jsx-runtime";
2
- import { forwardRef as h } from "react";
3
- import { tv as v } from "tailwind-variants";
4
- import { useTableContext as g } from "../Table.context.js";
5
- const C = v({
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { memo as v, forwardRef as g } from "react";
3
+ import { uyTv as C } from "@payfit/unity-themes";
4
+ import { useTableContext as T } from "../Table.context.js";
5
+ const k = C({
6
6
  base: [
7
7
  "uy:px-200 uy:py-150 uy:text-content-neutral uy:typography-body",
8
8
  "uy:focus-visible:outline-2 uy:focus-visible:outline-solid uy:focus-visible:outline-offset-[-2px] uy:focus-visible:outline-utility-focus-ring"
@@ -14,42 +14,46 @@ const C = v({
14
14
  right: "uy:text-right"
15
15
  }
16
16
  }
17
- }), T = h(
18
- ({
19
- children: r,
20
- colIndex: a = 0,
21
- rowIndex: o = 0,
22
- align: s,
23
- onKeyDown: t,
24
- onFocus: l,
25
- className: u,
26
- isRowHeader: i = !1,
27
- ...n
28
- }, y) => {
29
- const { keyboardNavigation: c } = g(), { isCellFocused: f, handleCellKeyDown: b, handleCellFocus: d } = c, m = f(o, a), p = (e) => {
30
- e.key !== "Tab" && (b(e), t == null || t(e));
31
- };
32
- return /* @__PURE__ */ x(
33
- i ? "th" : "td",
34
- {
35
- ref: y,
36
- role: i ? "rowheader" : "gridcell",
37
- "aria-colindex": a + 1,
38
- tabIndex: m ? 0 : -1,
39
- className: C({ align: s, className: u }),
40
- onKeyDown: p,
41
- onFocus: (e) => {
42
- d(e), l == null || l(e);
43
- },
44
- "data-dd-privacy": "mask",
45
- ...n,
46
- children: r
47
- }
48
- );
49
- }
17
+ }), N = v(
18
+ g(
19
+ ({
20
+ children: o,
21
+ colIndex: a = 0,
22
+ rowIndex: u = 0,
23
+ align: s,
24
+ onKeyDown: t,
25
+ onFocus: l,
26
+ className: n,
27
+ isRowHeader: i = !1,
28
+ isFocusable: r = !0,
29
+ ...y
30
+ }, f) => {
31
+ const { keyboardNavigation: c } = T(), { isCellFocused: d, handleCellKeyDown: b, handleCellFocus: m } = c, p = r && d(u, a), x = (e) => {
32
+ e.key !== "Tab" && (b(e), t == null || t(e));
33
+ };
34
+ return /* @__PURE__ */ h(
35
+ i ? "th" : "td",
36
+ {
37
+ ref: f,
38
+ role: i ? "rowheader" : "gridcell",
39
+ "aria-colindex": a + 1,
40
+ tabIndex: p ? 0 : -1,
41
+ "data-focusable": r,
42
+ className: k({ align: s, className: n }),
43
+ onKeyDown: x,
44
+ onFocus: (e) => {
45
+ m(e), l == null || l(e);
46
+ },
47
+ "data-dd-privacy": "mask",
48
+ ...y,
49
+ children: o
50
+ }
51
+ );
52
+ }
53
+ )
50
54
  );
51
- T.displayName = "TableCell";
55
+ N.displayName = "TableCell";
52
56
  export {
53
- T as TableCell,
54
- C as tableCell
57
+ N as TableCell,
58
+ k as tableCell
55
59
  };
@@ -4,6 +4,7 @@ type BaseTableColumnHeaderProps = {
4
4
  colIndex?: number;
5
5
  rowIndex?: number;
6
6
  align?: 'left' | 'center' | 'right';
7
+ isFocusable?: boolean;
7
8
  };
8
9
  type StaticTableColumnHeaderProps = BaseTableColumnHeaderProps & React.ThHTMLAttributes<HTMLTableCellElement>;
9
10
  type InteractiveTableColumnHeaderProps = BaseTableColumnHeaderProps & ActionableProps;
@@ -61,5 +62,5 @@ export declare const tableColumnHeader: import('tailwind-variants').TVReturnType
61
62
  * {@link https://unity-components.payfit.io/?path=/story/data-table-tablecolumnheader--docs|API and Demos} •
62
63
  * {@link https://payfit.design|Design docs}
63
64
  */
64
- declare const TableColumnHeader: React.ForwardRefExoticComponent<TableColumnHeaderProps & React.RefAttributes<HTMLTableCellElement>>;
65
+ declare const TableColumnHeader: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableColumnHeaderProps & React.RefAttributes<HTMLTableCellElement>>>;
65
66
  export { TableColumnHeader };
@@ -1,13 +1,14 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { tv as x } from "tailwind-variants";
4
- import { Actionable as g } from "../../actionable/Actionable.js";
5
- import { useTableContext as C } from "../Table.context.js";
6
- const c = x({
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { memo as x, forwardRef as g } from "react";
3
+ import { uyTv as C } from "@payfit/unity-themes";
4
+ import { Actionable as T } from "../../actionable/Actionable.js";
5
+ import { useTableContext as w } from "../Table.context.js";
6
+ const c = C({
7
7
  base: [
8
8
  "uy:align-middle uy:leading-[1.00]",
9
9
  "uy:px-200 uy:py-100 uy:typography-action uy:text-content-neutral",
10
- "uy:focus-visible:outline-2 uy:focus-visible:-outline-offset-2 uy:focus-visible:outline-utility-focus-ring"
10
+ "uy:focus-visible:outline-2 uy:focus-visible:outline-offset-2 uy:focus-visible:outline-utility-focus-ring",
11
+ "uy:hover:bg-surface-neutral-hover"
11
12
  ],
12
13
  variants: {
13
14
  align: {
@@ -16,57 +17,62 @@ const c = x({
16
17
  right: "uy:text-right"
17
18
  }
18
19
  }
19
- }), T = p(
20
- ({
21
- children: n,
22
- colIndex: a = 0,
23
- rowIndex: m = 0,
24
- align: o,
25
- onKeyDown: i,
26
- onFocus: t,
27
- className: u,
28
- ...l
29
- }, d) => {
30
- const { keyboardNavigation: f } = C(), { isCellFocused: b, handleCellKeyDown: h, handleCellFocus: s } = f, v = b(m, a), y = (e) => {
31
- e.key !== "Tab" && (h(e), i == null || i(
32
- e
33
- ));
34
- };
35
- return "onPress" in l ? /* @__PURE__ */ r(
36
- "th",
37
- {
38
- ref: d,
39
- role: "columnheader",
40
- "aria-colindex": a + 1,
41
- className: c({ align: o, className: u }),
42
- "data-dd-privacy": "allow",
43
- onKeyDown: y,
44
- onFocus: (e) => {
45
- s(e), t == null || t(e);
46
- },
47
- children: /* @__PURE__ */ r(g, { ...l, children: n })
48
- }
49
- ) : /* @__PURE__ */ r(
50
- "th",
51
- {
52
- ref: d,
53
- role: "columnheader",
54
- "aria-colindex": a + 1,
55
- tabIndex: v ? 0 : -1,
56
- className: c({ align: o, className: u }),
57
- onKeyDown: y,
58
- onFocus: (e) => {
59
- s(e), t == null || t(e);
60
- },
61
- "data-dd-privacy": "allow",
62
- ...l,
63
- children: n
64
- }
65
- );
66
- }
20
+ }), H = x(
21
+ g(
22
+ ({
23
+ children: n,
24
+ colIndex: a = 0,
25
+ rowIndex: f = 0,
26
+ align: u,
27
+ onKeyDown: r,
28
+ onFocus: t,
29
+ className: d,
30
+ isFocusable: l = !0,
31
+ ...i
32
+ }, y) => {
33
+ const { keyboardNavigation: b } = w(), { isCellFocused: h, handleCellKeyDown: v, handleCellFocus: m } = b, p = l && h(f, a), s = (e) => {
34
+ e.key !== "Tab" && (v(e), r == null || r(
35
+ e
36
+ ));
37
+ };
38
+ return "onPress" in i ? /* @__PURE__ */ o(
39
+ "th",
40
+ {
41
+ ref: y,
42
+ role: "columnheader",
43
+ "aria-colindex": a + 1,
44
+ "data-focusable": l,
45
+ className: c({ align: u, className: d }),
46
+ "data-dd-privacy": "allow",
47
+ onKeyDown: s,
48
+ onFocus: (e) => {
49
+ m(e), t == null || t(e);
50
+ },
51
+ children: /* @__PURE__ */ o(T, { ...i, children: n })
52
+ }
53
+ ) : /* @__PURE__ */ o(
54
+ "th",
55
+ {
56
+ ref: y,
57
+ role: "columnheader",
58
+ "aria-colindex": a + 1,
59
+ tabIndex: p ? 0 : -1,
60
+ "data-focusable": l,
61
+ className: c({ align: u, className: d }),
62
+ onKeyDown: s,
63
+ onFocus: (e) => {
64
+ m(e), t == null || t(e);
65
+ },
66
+ "data-dd-privacy": "allow",
67
+ ...i,
68
+ children: n
69
+ }
70
+ );
71
+ }
72
+ )
67
73
  );
68
- T.displayName = "TableColumnHeader";
74
+ H.displayName = "TableColumnHeader";
69
75
  export {
70
- T as TableColumnHeader,
76
+ H as TableColumnHeader,
71
77
  c as tableColumnHeader
72
78
  };
@@ -1,5 +1,5 @@
1
+ import { VariantProps } from '@payfit/unity-themes';
1
2
  import { PropsWithChildren } from 'react';
2
- import { VariantProps } from 'tailwind-variants';
3
3
  export declare const tableEmptyState: import('tailwind-variants').TVReturnType<{
4
4
  [key: string]: {
5
5
  [key: string]: import('tailwind-merge').ClassNameValue | {
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
2
  import { forwardRef as d, useMemo as c } from "react";
3
+ import { uyTv as y } from "@payfit/unity-themes";
3
4
  import { useIntl as m } from "react-intl";
4
- import { tv as y } from "tailwind-variants";
5
5
  import { Spinner as u } from "../../spinner/Spinner.js";
6
6
  import { Text as f } from "../../text/Text.js";
7
7
  import b from "../assets/EmptyStateError.svg.js";
@@ -1,5 +1,5 @@
1
1
  import { default as React, PropsWithChildren } from 'react';
2
- import { VariantProps } from 'tailwind-variants';
2
+ import { VariantProps } from '@payfit/unity-themes';
3
3
  export declare const tableHeader: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
4
4
  export type TableHeaderProps = PropsWithChildren<VariantProps<typeof tableHeader>>;
5
5
  /**
@@ -23,7 +23,7 @@ export type TableHeaderProps = PropsWithChildren<VariantProps<typeof tableHeader
23
23
  * {@link https://unity-components.payfit.io/?path=/story/data-table-tableheader--docs|API and Demos} •
24
24
  * {@link https://payfit.design|Design docs}
25
25
  */
26
- declare const TableHeader: React.ForwardRefExoticComponent<VariantProps<import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>> & {
26
+ declare const TableHeader: React.MemoExoticComponent<React.ForwardRefExoticComponent<VariantProps<import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>> & {
27
27
  children?: React.ReactNode | undefined;
28
- } & React.RefAttributes<HTMLTableSectionElement>>;
28
+ } & React.RefAttributes<HTMLTableSectionElement>>>;
29
29
  export { TableHeader };