@payfit/unity-components 1.1.0 → 1.2.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 (104) hide show
  1. package/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
  2. package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
  3. package/dist/esm/adapters/zodAdapter.d.ts +13 -0
  4. package/dist/esm/adapters/zodAdapter.js +74 -0
  5. package/dist/esm/components/action-bar/ActionBar.js +62 -64
  6. package/dist/esm/components/actionable/Actionable.d.ts +50 -3
  7. package/dist/esm/components/actionable/Actionable.js +49 -39
  8. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
  9. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  10. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
  11. package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
  12. package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
  13. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
  14. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
  15. package/dist/esm/components/code/Code.d.ts +37 -0
  16. package/dist/esm/components/code/Code.js +39 -0
  17. package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
  18. package/dist/esm/components/code/copyToClipboard.js +10 -0
  19. package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
  20. package/dist/esm/components/collapsible/Collapsible.js +14 -13
  21. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
  22. package/dist/esm/components/data-table/DataTable.d.ts +76 -10
  23. package/dist/esm/components/data-table/DataTable.js +81 -78
  24. package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
  25. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
  26. package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
  27. package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
  28. package/dist/esm/components/date-picker/DatePicker.js +64 -64
  29. package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
  30. package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
  31. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
  32. package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
  33. package/dist/esm/components/error-state/ErrorState.js +153 -0
  34. package/dist/esm/components/error-state/initConfig.d.ts +16 -0
  35. package/dist/esm/components/error-state/initConfig.js +149 -0
  36. package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
  37. package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
  38. package/dist/esm/components/form/Form.d.ts +15 -9
  39. package/dist/esm/components/form/Form.js +53 -50
  40. package/dist/esm/components/form-field/FormField.js +24 -23
  41. package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
  42. package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
  43. package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
  44. package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
  45. package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
  46. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
  47. package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
  48. package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
  49. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  50. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
  51. package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
  52. package/dist/esm/components/input/Input.js +28 -28
  53. package/dist/esm/components/label/Label.js +19 -19
  54. package/dist/esm/components/multi-select/MultiSelect.js +94 -94
  55. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
  56. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
  57. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
  58. package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
  59. package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
  60. package/dist/esm/components/nav/parts/NavGroup.js +21 -21
  61. package/dist/esm/components/number-field/NumberField.d.ts +3 -3
  62. package/dist/esm/components/number-input/NumberInput.js +58 -58
  63. package/dist/esm/components/pagination/Pagination.js +97 -101
  64. package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
  65. package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
  66. package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
  67. package/dist/esm/components/select-field/SelectField.d.ts +2 -2
  68. package/dist/esm/components/select-field/SelectField.js +4 -1
  69. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
  70. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
  71. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
  72. package/dist/esm/components/skip-links/SkipLinks.js +50 -43
  73. package/dist/esm/components/table/Table.js +79 -76
  74. package/dist/esm/components/table/parts/TableBody.js +6 -6
  75. package/dist/esm/components/table/parts/TableCell.js +25 -25
  76. package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
  77. package/dist/esm/components/table/parts/TablePagination.js +61 -59
  78. package/dist/esm/components/table/parts/TableRow.js +16 -16
  79. package/dist/esm/components/tabs/parts/TabList.js +50 -54
  80. package/dist/esm/components/task-menu/parts/Content.js +24 -24
  81. package/dist/esm/components/task-menu/parts/Header.js +24 -24
  82. package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
  83. package/dist/esm/components/task-menu/parts/Task.js +69 -69
  84. package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
  85. package/dist/esm/components/text-area/TextArea.js +30 -31
  86. package/dist/esm/components/text-field/TextField.d.ts +2 -2
  87. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
  88. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
  89. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
  90. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
  91. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
  92. package/dist/esm/hooks/use-form.d.ts +5 -5
  93. package/dist/esm/hooks/use-form.types.d.ts +2 -2
  94. package/dist/esm/hooks/use-resizable.js +13 -14
  95. package/dist/esm/index.d.ts +1 -0
  96. package/dist/esm/index.js +22 -19
  97. package/dist/esm/types/schema.d.ts +8 -0
  98. package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
  99. package/dist/esm/utils/createSchemaAdapter.js +13 -0
  100. package/dist/esm/utils/platform.js +2 -3
  101. package/i18n/en-GB.json +16 -0
  102. package/i18n/es-ES.json +16 -0
  103. package/i18n/fr-FR.json +16 -0
  104. package/package.json +25 -19
@@ -1,10 +1,10 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { useRef as x, useContext as D } from "react";
3
- import { uyTv as b } from "@payfit/unity-themes";
4
- import { useDrag as h } from "@use-gesture/react";
5
- import { OverlayTriggerStateContext as v } from "react-aria-components";
6
- import { useBreakpointListener as P } from "../../../hooks/use-breakpoint-listener.js";
7
- const S = b({
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useRef as g, useContext as x } from "react";
3
+ import { uyTv as D } from "@payfit/unity-themes";
4
+ import { useDrag as b } from "@use-gesture/react";
5
+ import { OverlayTriggerStateContext as h } from "react-aria-components";
6
+ import { useBreakpointListener as v } from "../../../hooks/use-breakpoint-listener.js";
7
+ const P = D({
8
8
  slots: {
9
9
  base: [
10
10
  "uy:md:hidden uy:mx-auto uy:pt-300 uy:w-500",
@@ -12,25 +12,24 @@ const S = b({
12
12
  ],
13
13
  indicator: "uy:h-50 uy:rounded-pill uy:bg-content-neutral-lowest"
14
14
  }
15
- }), T = 100;
16
- function I() {
17
- const r = x(null), n = D(v), s = P(), { base: i, indicator: l } = S(), u = s === "xs" || s === "sm", c = h(
18
- (d) => {
19
- var o;
15
+ }), S = 100;
16
+ function T() {
17
+ const r = g(null), n = x(h), s = v(), { base: a, indicator: i } = P(), l = s === "xs" || s === "sm", u = b(
18
+ (c) => {
20
19
  const {
21
- movement: [N, e],
22
- direction: [E, m],
23
- intentional: f,
24
- cancel: y,
25
- last: p,
26
- event: g
27
- } = d;
28
- if (!u) {
29
- y();
20
+ movement: [I, e],
21
+ direction: [N, d],
22
+ intentional: m,
23
+ cancel: f,
24
+ last: y,
25
+ event: p
26
+ } = c;
27
+ if (!l) {
28
+ f();
30
29
  return;
31
30
  }
32
- g.preventDefault();
33
- const t = (o = r.current) == null ? void 0 : o.closest(
31
+ p.preventDefault();
32
+ const t = r.current?.closest(
34
33
  "[data-unity-side-panel]"
35
34
  );
36
35
  if (t) {
@@ -38,7 +37,7 @@ function I() {
38
37
  t.style.transform = "translate3d(0, 0, 0)";
39
38
  return;
40
39
  }
41
- t.style.transform = `translate3d(0, ${e}px, 0)`, t.style.transition = "none", p && f && (e > T || m > 0 ? n && setTimeout(() => {
40
+ t.style.transform = `translate3d(0, ${e}px, 0)`, t.style.transition = "none", y && m && (e > S || d > 0 ? n && setTimeout(() => {
42
41
  n.close();
43
42
  }, 50) : (t.style.transform = "translate3d(0, 0, 0)", t.style.transition = "transform 0.3s ease"));
44
43
  }
@@ -49,19 +48,19 @@ function I() {
49
48
  threshold: 5
50
49
  }
51
50
  );
52
- return /* @__PURE__ */ a(
51
+ return /* @__PURE__ */ o(
53
52
  "div",
54
53
  {
55
- className: i(),
54
+ className: a(),
56
55
  "aria-hidden": "true",
57
56
  ref: r,
58
- ...c(),
59
- children: /* @__PURE__ */ a("div", { className: l() })
57
+ ...u(),
58
+ children: /* @__PURE__ */ o("div", { className: i() })
60
59
  }
61
60
  );
62
61
  }
63
- I.displayName = "SidePanelDragIndicator";
62
+ T.displayName = "SidePanelDragIndicator";
64
63
  export {
65
- I as SidePanelDragIndicator,
66
- S as sidePanelDragIndicator
64
+ T as SidePanelDragIndicator,
65
+ P as sidePanelDragIndicator
67
66
  };
@@ -1,14 +1,16 @@
1
- import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as l, useId as y } from "react";
3
- import { uyTv as p } from "@payfit/unity-themes";
4
- import { FormattedMessage as m } from "react-intl";
5
- import { Link as f } from "../link/Link.js";
6
- const b = p({
1
+ import { jsxs as y, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as l, useId as p } from "react";
3
+ import { uyTv as f } from "@payfit/unity-themes";
4
+ import { Link as m } from "react-aria-components";
5
+ import { FormattedMessage as b } from "react-intl";
6
+ import { link as k } from "../link/Link.variants.js";
7
+ const h = f({
7
8
  slots: {
8
9
  base: [
9
10
  "uy:sr-only",
10
11
  "uy:focus-within:p-200",
11
12
  "uy:focus-within:bg-surface-neutral",
13
+ "uy:focus-within:border-border-neutral uy:focus-within:border-solid uy:focus-within:border-1",
12
14
  "uy:focus-within:shadow-raising",
13
15
  "uy:focus-within:rounded-100",
14
16
  "uy:focus-within:not-sr-only",
@@ -20,61 +22,66 @@ const b = p({
20
22
  label: "uy:typography-h4",
21
23
  list: "uy:mt-1 uy:space-y-1 uy:list-none"
22
24
  }
23
- }), k = l(
24
- ({ label: s, className: e, children: n, ...a }, i) => {
25
- const o = `skip-links-label-${y()}`;
26
- if (!n)
25
+ }), w = l(
26
+ ({ label: s, className: n, children: e, ...o }, a) => {
27
+ const r = `skip-links-label-${p()}`;
28
+ if (!e)
27
29
  return null;
28
- const { base: r, label: u, list: c } = b();
29
- return /* @__PURE__ */ d(
30
+ const { base: u, label: c, list: d } = h();
31
+ return /* @__PURE__ */ y(
30
32
  "nav",
31
33
  {
32
34
  "data-dd-privacy": "allow",
33
- ...a,
34
- ref: i,
35
- className: r({ className: e }),
35
+ ...o,
36
+ ref: a,
37
+ className: u({ className: n }),
36
38
  role: "navigation",
37
- "aria-labelledby": o,
39
+ "aria-labelledby": r,
38
40
  "data-unity-component": "SkipLinks",
39
41
  children: [
40
- /* @__PURE__ */ t("span", { id: o, className: u(), children: s || /* @__PURE__ */ t(
41
- m,
42
+ /* @__PURE__ */ t("span", { id: r, className: c(), children: s || /* @__PURE__ */ t(
43
+ b,
42
44
  {
43
45
  id: "unity:component:skip-links:label",
44
46
  defaultMessage: "Skip to:"
45
47
  }
46
48
  ) }),
47
- /* @__PURE__ */ t("ol", { className: c(), children: n })
49
+ /* @__PURE__ */ t("ol", { className: d(), children: e })
48
50
  ]
49
51
  }
50
52
  );
51
53
  }
52
- ), h = l(
53
- ({ targetId: s, children: e, ...n }, a) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
54
- f,
55
- {
56
- ...n,
57
- ref: a,
54
+ ), g = l(
55
+ ({ targetId: s, children: n, ...e }, o) => {
56
+ const { base: a } = k({
58
57
  size: "small",
59
58
  color: "primary",
60
- variant: "standalone",
61
- onPress: () => {
62
- const i = document.getElementById(s);
63
- i && (i.focus(), i.hasAttribute("tabindex") || (i.setAttribute("tabindex", "-1"), i.addEventListener(
64
- "blur",
65
- () => {
66
- i.removeAttribute("tabindex");
67
- },
68
- { once: !0 }
69
- )));
70
- },
71
- children: e
72
- }
73
- ) })
59
+ variant: "standalone"
60
+ });
61
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
62
+ m,
63
+ {
64
+ ...e,
65
+ ref: o,
66
+ className: a(),
67
+ onPress: () => {
68
+ const i = document.getElementById(s);
69
+ i && (i.focus(), i.hasAttribute("tabindex") || (i.setAttribute("tabindex", "-1"), i.addEventListener(
70
+ "blur",
71
+ () => {
72
+ i.removeAttribute("tabindex");
73
+ },
74
+ { once: !0 }
75
+ )));
76
+ },
77
+ children: n
78
+ }
79
+ ) });
80
+ }
74
81
  );
75
- k.displayName = "SkipLinks";
76
- h.displayName = "SkipLink";
82
+ w.displayName = "SkipLinks";
83
+ g.displayName = "SkipLink";
77
84
  export {
78
- h as SkipLink,
79
- k as SkipLinks
85
+ g as SkipLink,
86
+ w as SkipLinks
80
87
  };
@@ -1,9 +1,9 @@
1
- import { jsx as b, jsxs as R } from "react/jsx-runtime";
2
- import a, { forwardRef as E, useRef as z, useMemo as S, useImperativeHandle as V, useCallback as $ } from "react";
3
- import { uyTv as N } from "@payfit/unity-themes";
4
- import { useResizeObserver as D } from "usehooks-ts";
5
- import { TableContextProvider as P, useTableContext as j } from "./Table.context.js";
6
- const A = N({
1
+ import { jsx as d, jsxs as x } from "react/jsx-runtime";
2
+ import n, { forwardRef as C, useRef as N, useMemo as T, useImperativeHandle as z, useCallback as k } from "react";
3
+ import { uyTv as R } from "@payfit/unity-themes";
4
+ import { useResizeObserver as S } from "usehooks-ts";
5
+ import { TableContextProvider as V, useTableContext as D } from "./Table.context.js";
6
+ const K = R({
7
7
  base: [
8
8
  "uy:w-full uy:border uy:border-solid uy:border-border-neutral uy:rounded-100",
9
9
  "uy:relative uy:flex uy:flex-col",
@@ -13,23 +13,23 @@ const A = N({
13
13
  "uy:overflow-x-auto"
14
14
  // Handle horizontal scrolling too
15
15
  ]
16
- }), K = E(
17
- ({ minRows: i = 10, maxRows: u = 50, children: t }, o) => /* @__PURE__ */ b(
16
+ }), U = C(
17
+ ({ minRows: i = 10, maxRows: s = 50, children: t }, o) => /* @__PURE__ */ d(
18
18
  "div",
19
19
  {
20
20
  ref: o,
21
- className: A(),
21
+ className: K(),
22
22
  "data-unity-slot": "table-root",
23
23
  style: {
24
24
  "--uy-table-min-rows": `calc(var(--uy-spacing-600) * ${i})`,
25
- "--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${u})`
25
+ "--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${s})`
26
26
  },
27
27
  children: t
28
28
  }
29
29
  )
30
30
  );
31
- K.displayName = "TableRoot";
32
- const M = N({
31
+ U.displayName = "TableRoot";
32
+ const $ = R({
33
33
  slots: {
34
34
  wrapper: [
35
35
  "uy:flex-1 uy:bg-surface-neutral",
@@ -56,105 +56,108 @@ const M = N({
56
56
  defaultVariants: {
57
57
  horizontalScroll: !0
58
58
  }
59
- }), U = E((i, u) => {
59
+ }), P = C((i, s) => {
60
60
  const {
61
61
  children: t,
62
62
  label: o,
63
- description: d,
64
- isHorizontalScrollEnabled: x = !0,
65
- ...p
66
- } = i, c = z(null), { height: n = 0 } = D({
67
- ref: c,
63
+ description: m,
64
+ isHorizontalScrollEnabled: g = !0,
65
+ ...c
66
+ } = i, u = N(null), { height: f = 0 } = S({
67
+ ref: u,
68
68
  box: "border-box"
69
- }), { rowCount: f, columnCount: m } = S(() => {
69
+ }), { rowCount: h, columnCount: p } = T(() => {
70
70
  let e = 0, l = 0;
71
- return a.Children.forEach(t, (h) => {
72
- if (!a.isValidElement(h)) return;
73
- const s = a.Children.toArray(
74
- h.props.children
75
- ).filter((r) => a.isValidElement(r));
76
- l += s.length, s.forEach((r) => {
77
- if (!a.isValidElement(r)) return;
78
- const w = a.Children.toArray(
71
+ return n.Children.forEach(t, (w) => {
72
+ if (!n.isValidElement(w)) return;
73
+ const a = n.Children.toArray(
74
+ w.props.children
75
+ ).filter((r) => n.isValidElement(r));
76
+ l += a.length, a.forEach((r) => {
77
+ if (!n.isValidElement(r)) return;
78
+ const v = n.Children.toArray(
79
79
  r.props.children
80
- ).filter((y) => a.isValidElement(y));
81
- e = Math.max(e, w.length);
80
+ ).filter((y) => n.isValidElement(y));
81
+ e = Math.max(e, v.length);
82
82
  });
83
83
  }), { rowCount: l, columnCount: e };
84
84
  }, [t]);
85
- return V(u, () => ({
85
+ return z(s, () => ({
86
86
  scrollToTop: () => {
87
- const e = c.current, l = e == null ? void 0 : e.closest(
87
+ const e = u.current, l = e?.closest(
88
88
  '[data-unity-slot="table-root"]'
89
89
  );
90
90
  l ? l.scrollTo({ top: 0, behavior: "smooth" }) : e && e.scrollTo({ top: 0, behavior: "smooth" });
91
91
  }
92
- })), /* @__PURE__ */ b(P, { rowCount: f, columnCount: m, children: /* @__PURE__ */ b(
93
- H,
92
+ })), /* @__PURE__ */ d(V, { rowCount: h, columnCount: p, children: /* @__PURE__ */ d(
93
+ E,
94
94
  {
95
- scrollContainerRef: c,
96
- containerHeight: n,
97
- rowCount: f,
98
- columnCount: m,
95
+ scrollContainerRef: u,
96
+ containerHeight: f,
97
+ rowCount: h,
98
+ columnCount: p,
99
99
  label: o,
100
- description: d,
101
- isHorizontalScrollEnabled: x,
102
- ...p,
100
+ description: m,
101
+ isHorizontalScrollEnabled: g,
102
+ ...c,
103
103
  children: t
104
104
  }
105
105
  ) });
106
106
  });
107
- U.displayName = "Table";
108
- const H = (i) => {
109
- var g, C, T;
107
+ P.displayName = "Table";
108
+ const E = (i) => {
110
109
  const {
111
- children: u,
110
+ children: s,
112
111
  label: t,
113
112
  description: o,
114
- scrollContainerRef: d,
115
- containerHeight: x,
116
- rowCount: p,
117
- columnCount: c,
118
- onKeyDown: n,
119
- isHorizontalScrollEnabled: f = !0,
120
- ...m
121
- } = i, { wrapper: e, table: l } = M({
122
- horizontalScroll: f
123
- }), { keyboardNavigation: h } = j(), { tableRef: s, handleTableKeyDown: r } = h, w = $(
124
- (v) => {
125
- v.key !== "Tab" && (r(v), n == null || n(v));
113
+ scrollContainerRef: m,
114
+ containerHeight: g,
115
+ rowCount: c,
116
+ columnCount: u,
117
+ onKeyDown: f,
118
+ isHorizontalScrollEnabled: h = !0,
119
+ ...p
120
+ } = i, { wrapper: e, table: l } = $({
121
+ horizontalScroll: h
122
+ }), { keyboardNavigation: w } = D(), { tableRef: a, handleTableKeyDown: r } = w, v = k(
123
+ (b) => {
124
+ b.key !== "Tab" && (r(b), f?.(b));
126
125
  },
127
- [r, n]
128
- ), y = (g = d.current) == null ? void 0 : g.closest(
126
+ [r, f]
127
+ ), y = m.current?.closest(
129
128
  '[data-unity-slot="table-root"]'
130
- ), k = y ? y.scrollHeight > y.clientHeight : !1;
131
- return /* @__PURE__ */ R(
129
+ ), H = T(() => {
130
+ if (!y || c === 0) return !1;
131
+ const b = y.clientHeight;
132
+ return (a.current?.clientHeight ?? 0) / b < 0.9;
133
+ }, [y, c]);
134
+ return /* @__PURE__ */ x(
132
135
  "div",
133
136
  {
134
137
  className: e(),
135
- ref: d,
138
+ ref: m,
136
139
  style: {
137
- "--uy-table-is-scrollable": k ? "1" : "0"
140
+ "--uy-table-has-remaining-space": H ? "1" : "0"
138
141
  },
139
142
  children: [
140
- /* @__PURE__ */ R(
143
+ /* @__PURE__ */ x(
141
144
  "table",
142
145
  {
143
- ref: s,
146
+ ref: a,
144
147
  className: l(),
145
148
  role: "grid",
146
- "aria-rowcount": p,
147
- "aria-colcount": c,
149
+ "aria-rowcount": c,
150
+ "aria-colcount": u,
148
151
  "aria-label": t,
149
- "aria-describedby": o ? `table-desc-${(C = s.current) == null ? void 0 : C.id}` : void 0,
150
- onKeyDown: w,
151
- ...m,
152
+ "aria-describedby": o ? `table-desc-${a.current?.id}` : void 0,
153
+ onKeyDown: v,
154
+ ...p,
152
155
  children: [
153
- u,
154
- o && /* @__PURE__ */ b(
156
+ s,
157
+ o && /* @__PURE__ */ d(
155
158
  "caption",
156
159
  {
157
- id: `table-desc-${(T = s.current) == null ? void 0 : T.id}`,
160
+ id: `table-desc-${a.current?.id}`,
158
161
  className: "uy:sr-only",
159
162
  children: o
160
163
  }
@@ -162,13 +165,13 @@ const H = (i) => {
162
165
  ]
163
166
  }
164
167
  ),
165
- /* @__PURE__ */ b("div", { className: "uy:sr-only", "aria-live": "polite", children: "Table navigation: Use arrow keys to move between cells. Tab key exits the table. Home and End keys navigate to the first and last cell in a row. Page Up and Page Down move between rows." })
168
+ /* @__PURE__ */ d("div", { className: "uy:sr-only", "aria-live": "polite", children: "Table navigation: Use arrow keys to move between cells. Tab key exits the table. Home and End keys navigate to the first and last cell in a row. Page Up and Page Down move between rows." })
166
169
  ]
167
170
  }
168
171
  );
169
172
  };
170
- H.displayName = "TableContent";
173
+ E.displayName = "TableContent";
171
174
  export {
172
- U as Table,
173
- K as TableRoot
175
+ P as Table,
176
+ U as TableRoot
174
177
  };
@@ -8,19 +8,19 @@ const C = v({
8
8
  true: ["uy:h-[var(--uy-table-min-rows)]"],
9
9
  false: [
10
10
  "uy:[&_tr:last-child]:border-b",
11
- "uy:[&_tr:last-child]:border-b-[length:calc(1px*(1-var(--uy-table-is-scrollable,0)))]"
11
+ "uy:[&_tr:last-child]:border-b-[length:calc(1px*var(--uy-table-has-remaining-space,0))]"
12
12
  ]
13
13
  }
14
14
  }
15
15
  }), x = b(
16
16
  ({ children: c, renderEmptyState: l, renderDataState: s, ...u }, y) => {
17
- const i = s ? s() : void 0, t = i !== void 0, n = t ? [] : f.map(c, (o, m) => p.isValidElement(o) ? h(
18
- o,
17
+ const i = s ? s() : void 0, t = i !== void 0, o = t ? [] : f.map(c, (n, m) => p.isValidElement(n) ? h(
18
+ n,
19
19
  {
20
20
  rowIndex: m,
21
- ...o.props
21
+ ...n.props
22
22
  }
23
- ) : o), e = !n || n.length === 0 || t, d = e && l ? l() : null;
23
+ ) : n), e = !o || o.length === 0 || t, d = e && l ? l() : null;
24
24
  let a = null;
25
25
  return t ? a = i : e && d && (a = d), /* @__PURE__ */ r(
26
26
  "tbody",
@@ -30,7 +30,7 @@ const C = v({
30
30
  "data-dd-privacy": "mask",
31
31
  "data-empty": e || t || void 0,
32
32
  ...u,
33
- children: a ? /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: 1e3, className: "uy:p-0", children: a }) }) : n
33
+ children: a ? /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: 1e3, className: "uy:p-0", children: a }) }) : o
34
34
  }
35
35
  );
36
36
  }
@@ -2,7 +2,7 @@ import { jsx as h } from "react/jsx-runtime";
2
2
  import { memo as v, forwardRef as g } from "react";
3
3
  import { uyTv as C } from "@payfit/unity-themes";
4
4
  import { useTableContext as T } from "../Table.context.js";
5
- const k = C({
5
+ const w = 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,46 +14,46 @@ const k = C({
14
14
  right: "uy:text-right"
15
15
  }
16
16
  }
17
- }), N = v(
17
+ }), k = v(
18
18
  g(
19
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,
20
+ children: a,
21
+ colIndex: t = 0,
22
+ rowIndex: n = 0,
23
+ align: i,
24
+ onKeyDown: u,
25
+ onFocus: r,
26
+ className: s,
27
+ isRowHeader: o = !1,
28
+ isFocusable: l = !0,
29
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));
30
+ }, c) => {
31
+ const { keyboardNavigation: f } = T(), { isCellFocused: d, handleCellKeyDown: b, handleCellFocus: m } = f, p = l && d(n, t), x = (e) => {
32
+ e.key !== "Tab" && (b(e), u?.(e));
33
33
  };
34
34
  return /* @__PURE__ */ h(
35
- i ? "th" : "td",
35
+ o ? "th" : "td",
36
36
  {
37
- ref: f,
38
- role: i ? "rowheader" : "gridcell",
39
- "aria-colindex": a + 1,
37
+ ref: c,
38
+ role: o ? "rowheader" : "gridcell",
39
+ "aria-colindex": t + 1,
40
40
  tabIndex: p ? 0 : -1,
41
- "data-focusable": r,
42
- className: k({ align: s, className: n }),
41
+ "data-focusable": l,
42
+ className: w({ align: i, className: s }),
43
43
  onKeyDown: x,
44
44
  onFocus: (e) => {
45
- m(e), l == null || l(e);
45
+ m(e), r?.(e);
46
46
  },
47
47
  "data-dd-privacy": "mask",
48
48
  ...y,
49
- children: o
49
+ children: a
50
50
  }
51
51
  );
52
52
  }
53
53
  )
54
54
  );
55
- N.displayName = "TableCell";
55
+ k.displayName = "TableCell";
56
56
  export {
57
- N as TableCell,
58
- k as tableCell
57
+ k as TableCell,
58
+ w as tableCell
59
59
  };