@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.
- package/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
- package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
- package/dist/esm/adapters/zodAdapter.d.ts +13 -0
- package/dist/esm/adapters/zodAdapter.js +74 -0
- package/dist/esm/components/action-bar/ActionBar.js +62 -64
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +49 -39
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
- package/dist/esm/components/code/Code.d.ts +37 -0
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/esm/components/collapsible/Collapsible.js +14 -13
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
- package/dist/esm/components/data-table/DataTable.d.ts +76 -10
- package/dist/esm/components/data-table/DataTable.js +81 -78
- package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
- package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
- package/dist/esm/components/date-picker/DatePicker.js +64 -64
- package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
- package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
- package/dist/esm/components/error-state/ErrorState.js +153 -0
- package/dist/esm/components/error-state/initConfig.d.ts +16 -0
- package/dist/esm/components/error-state/initConfig.js +149 -0
- package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
- package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
- package/dist/esm/components/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +24 -23
- package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
- package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
- package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
- package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
- package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/multi-select/MultiSelect.js +94 -94
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
- package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
- package/dist/esm/components/nav/parts/NavGroup.js +21 -21
- package/dist/esm/components/number-field/NumberField.d.ts +3 -3
- package/dist/esm/components/number-input/NumberInput.js +58 -58
- package/dist/esm/components/pagination/Pagination.js +97 -101
- package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
- package/dist/esm/components/select-field/SelectField.d.ts +2 -2
- package/dist/esm/components/select-field/SelectField.js +4 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
- package/dist/esm/components/skip-links/SkipLinks.js +50 -43
- package/dist/esm/components/table/Table.js +79 -76
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +25 -25
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +16 -16
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/parts/Content.js +24 -24
- package/dist/esm/components/task-menu/parts/Header.js +24 -24
- package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
- package/dist/esm/components/task-menu/parts/Task.js +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text-area/TextArea.js +30 -31
- package/dist/esm/components/text-field/TextField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
- package/dist/esm/hooks/use-form.d.ts +5 -5
- package/dist/esm/hooks/use-form.types.d.ts +2 -2
- package/dist/esm/hooks/use-resizable.js +13 -14
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +22 -19
- package/dist/esm/types/schema.d.ts +8 -0
- package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
- package/dist/esm/utils/createSchemaAdapter.js +13 -0
- package/dist/esm/utils/platform.js +2 -3
- package/i18n/en-GB.json +16 -0
- package/i18n/es-ES.json +16 -0
- package/i18n/fr-FR.json +16 -0
- package/package.json +25 -19
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useDrag as
|
|
5
|
-
import { OverlayTriggerStateContext as
|
|
6
|
-
import { useBreakpointListener as
|
|
7
|
-
const
|
|
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
|
-
}),
|
|
16
|
-
function
|
|
17
|
-
const r =
|
|
18
|
-
(
|
|
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: [
|
|
22
|
-
direction: [
|
|
23
|
-
intentional:
|
|
24
|
-
cancel:
|
|
25
|
-
last:
|
|
26
|
-
event:
|
|
27
|
-
} =
|
|
28
|
-
if (!
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
const t =
|
|
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",
|
|
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__ */
|
|
51
|
+
return /* @__PURE__ */ o(
|
|
53
52
|
"div",
|
|
54
53
|
{
|
|
55
|
-
className:
|
|
54
|
+
className: a(),
|
|
56
55
|
"aria-hidden": "true",
|
|
57
56
|
ref: r,
|
|
58
|
-
...
|
|
59
|
-
children: /* @__PURE__ */
|
|
57
|
+
...u(),
|
|
58
|
+
children: /* @__PURE__ */ o("div", { className: i() })
|
|
60
59
|
}
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
T.displayName = "SidePanelDragIndicator";
|
|
64
63
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
T as SidePanelDragIndicator,
|
|
65
|
+
P as sidePanelDragIndicator
|
|
67
66
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as l, useId as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
-
}),
|
|
24
|
-
({ label: s, className:
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
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:
|
|
29
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
34
|
-
ref:
|
|
35
|
-
className:
|
|
35
|
+
...o,
|
|
36
|
+
ref: a,
|
|
37
|
+
className: u({ className: n }),
|
|
36
38
|
role: "navigation",
|
|
37
|
-
"aria-labelledby":
|
|
39
|
+
"aria-labelledby": r,
|
|
38
40
|
"data-unity-component": "SkipLinks",
|
|
39
41
|
children: [
|
|
40
|
-
/* @__PURE__ */ t("span", { id:
|
|
41
|
-
|
|
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:
|
|
49
|
+
/* @__PURE__ */ t("ol", { className: d(), children: e })
|
|
48
50
|
]
|
|
49
51
|
}
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
|
-
),
|
|
53
|
-
({ targetId: s, children:
|
|
54
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
76
|
-
|
|
82
|
+
w.displayName = "SkipLinks";
|
|
83
|
+
g.displayName = "SkipLink";
|
|
77
84
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
g as SkipLink,
|
|
86
|
+
w as SkipLinks
|
|
80
87
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useResizeObserver as
|
|
5
|
-
import { TableContextProvider as
|
|
6
|
-
const
|
|
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
|
-
}),
|
|
17
|
-
({ minRows: i = 10, maxRows:
|
|
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:
|
|
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) * ${
|
|
25
|
+
"--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${s})`
|
|
26
26
|
},
|
|
27
27
|
children: t
|
|
28
28
|
}
|
|
29
29
|
)
|
|
30
30
|
);
|
|
31
|
-
|
|
32
|
-
const
|
|
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
|
-
}),
|
|
59
|
+
}), P = C((i, s) => {
|
|
60
60
|
const {
|
|
61
61
|
children: t,
|
|
62
62
|
label: o,
|
|
63
|
-
description:
|
|
64
|
-
isHorizontalScrollEnabled:
|
|
65
|
-
...
|
|
66
|
-
} = i,
|
|
67
|
-
ref:
|
|
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:
|
|
69
|
+
}), { rowCount: h, columnCount: p } = T(() => {
|
|
70
70
|
let e = 0, l = 0;
|
|
71
|
-
return
|
|
72
|
-
if (!
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
).filter((r) =>
|
|
76
|
-
l +=
|
|
77
|
-
if (!
|
|
78
|
-
const
|
|
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) =>
|
|
81
|
-
e = Math.max(e,
|
|
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
|
|
85
|
+
return z(s, () => ({
|
|
86
86
|
scrollToTop: () => {
|
|
87
|
-
const e =
|
|
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__ */
|
|
93
|
-
|
|
92
|
+
})), /* @__PURE__ */ d(V, { rowCount: h, columnCount: p, children: /* @__PURE__ */ d(
|
|
93
|
+
E,
|
|
94
94
|
{
|
|
95
|
-
scrollContainerRef:
|
|
96
|
-
containerHeight:
|
|
97
|
-
rowCount:
|
|
98
|
-
columnCount:
|
|
95
|
+
scrollContainerRef: u,
|
|
96
|
+
containerHeight: f,
|
|
97
|
+
rowCount: h,
|
|
98
|
+
columnCount: p,
|
|
99
99
|
label: o,
|
|
100
|
-
description:
|
|
101
|
-
isHorizontalScrollEnabled:
|
|
102
|
-
...
|
|
100
|
+
description: m,
|
|
101
|
+
isHorizontalScrollEnabled: g,
|
|
102
|
+
...c,
|
|
103
103
|
children: t
|
|
104
104
|
}
|
|
105
105
|
) });
|
|
106
106
|
});
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
var g, C, T;
|
|
107
|
+
P.displayName = "Table";
|
|
108
|
+
const E = (i) => {
|
|
110
109
|
const {
|
|
111
|
-
children:
|
|
110
|
+
children: s,
|
|
112
111
|
label: t,
|
|
113
112
|
description: o,
|
|
114
|
-
scrollContainerRef:
|
|
115
|
-
containerHeight:
|
|
116
|
-
rowCount:
|
|
117
|
-
columnCount:
|
|
118
|
-
onKeyDown:
|
|
119
|
-
isHorizontalScrollEnabled:
|
|
120
|
-
...
|
|
121
|
-
} = i, { wrapper: e, table: l } =
|
|
122
|
-
horizontalScroll:
|
|
123
|
-
}), { keyboardNavigation:
|
|
124
|
-
(
|
|
125
|
-
|
|
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,
|
|
128
|
-
), y =
|
|
126
|
+
[r, f]
|
|
127
|
+
), y = m.current?.closest(
|
|
129
128
|
'[data-unity-slot="table-root"]'
|
|
130
|
-
),
|
|
131
|
-
|
|
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:
|
|
138
|
+
ref: m,
|
|
136
139
|
style: {
|
|
137
|
-
"--uy-table-
|
|
140
|
+
"--uy-table-has-remaining-space": H ? "1" : "0"
|
|
138
141
|
},
|
|
139
142
|
children: [
|
|
140
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ x(
|
|
141
144
|
"table",
|
|
142
145
|
{
|
|
143
|
-
ref:
|
|
146
|
+
ref: a,
|
|
144
147
|
className: l(),
|
|
145
148
|
role: "grid",
|
|
146
|
-
"aria-rowcount":
|
|
147
|
-
"aria-colcount":
|
|
149
|
+
"aria-rowcount": c,
|
|
150
|
+
"aria-colcount": u,
|
|
148
151
|
"aria-label": t,
|
|
149
|
-
"aria-describedby": o ? `table-desc-${
|
|
150
|
-
onKeyDown:
|
|
151
|
-
...
|
|
152
|
+
"aria-describedby": o ? `table-desc-${a.current?.id}` : void 0,
|
|
153
|
+
onKeyDown: v,
|
|
154
|
+
...p,
|
|
152
155
|
children: [
|
|
153
|
-
|
|
154
|
-
o && /* @__PURE__ */
|
|
156
|
+
s,
|
|
157
|
+
o && /* @__PURE__ */ d(
|
|
155
158
|
"caption",
|
|
156
159
|
{
|
|
157
|
-
id: `table-desc-${
|
|
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__ */
|
|
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
|
-
|
|
173
|
+
E.displayName = "TableContent";
|
|
171
174
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
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*
|
|
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,
|
|
18
|
-
|
|
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
|
-
...
|
|
21
|
+
...n.props
|
|
22
22
|
}
|
|
23
|
-
) :
|
|
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 }) }) :
|
|
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
|
|
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
|
-
}),
|
|
17
|
+
}), k = v(
|
|
18
18
|
g(
|
|
19
19
|
({
|
|
20
|
-
children:
|
|
21
|
-
colIndex:
|
|
22
|
-
rowIndex:
|
|
23
|
-
align:
|
|
24
|
-
onKeyDown:
|
|
25
|
-
onFocus:
|
|
26
|
-
className:
|
|
27
|
-
isRowHeader:
|
|
28
|
-
isFocusable:
|
|
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
|
-
},
|
|
31
|
-
const { keyboardNavigation:
|
|
32
|
-
e.key !== "Tab" && (b(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
|
-
|
|
35
|
+
o ? "th" : "td",
|
|
36
36
|
{
|
|
37
|
-
ref:
|
|
38
|
-
role:
|
|
39
|
-
"aria-colindex":
|
|
37
|
+
ref: c,
|
|
38
|
+
role: o ? "rowheader" : "gridcell",
|
|
39
|
+
"aria-colindex": t + 1,
|
|
40
40
|
tabIndex: p ? 0 : -1,
|
|
41
|
-
"data-focusable":
|
|
42
|
-
className:
|
|
41
|
+
"data-focusable": l,
|
|
42
|
+
className: w({ align: i, className: s }),
|
|
43
43
|
onKeyDown: x,
|
|
44
44
|
onFocus: (e) => {
|
|
45
|
-
m(e),
|
|
45
|
+
m(e), r?.(e);
|
|
46
46
|
},
|
|
47
47
|
"data-dd-privacy": "mask",
|
|
48
48
|
...y,
|
|
49
|
-
children:
|
|
49
|
+
children: a
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
k.displayName = "TableCell";
|
|
56
56
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
k as TableCell,
|
|
58
|
+
w as tableCell
|
|
59
59
|
};
|