@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.
- package/dist/esm/components/action-bar/ActionBar.d.ts +153 -0
- package/dist/esm/components/action-bar/ActionBar.js +173 -0
- package/dist/esm/components/action-bar/parts/ActionBarAction.d.ts +44 -0
- package/dist/esm/components/action-bar/parts/ActionBarAction.js +45 -0
- package/dist/esm/components/action-bar/parts/ActionBarRoot.d.ts +44 -0
- package/dist/esm/components/action-bar/parts/ActionBarRoot.js +46 -0
- package/dist/esm/components/actionable/Actionable.js +20 -21
- package/dist/esm/components/alert/Alert.d.ts +1 -1
- package/dist/esm/components/alert/Alert.js +1 -1
- package/dist/esm/components/alert/parts/AlertActions.d.ts +1 -1
- package/dist/esm/components/alert/parts/AlertActions.js +1 -1
- package/dist/esm/components/alert/parts/AlertContent.d.ts +1 -1
- package/dist/esm/components/alert/parts/AlertTitle.d.ts +1 -1
- package/dist/esm/components/anchor/Anchor.js +1 -1
- package/dist/esm/components/app-layout/AppLayout.js +6 -6
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +30 -30
- package/dist/esm/components/app-menu/parts/AppMenuNavContent.js +1 -1
- package/dist/esm/components/autocomplete/Autocomplete.d.ts +1 -1
- package/dist/esm/components/autocomplete/Autocomplete.js +14 -14
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/autocomplete/parts/AutocompleteItem.d.ts +1 -1
- package/dist/esm/components/autocomplete/parts/AutocompleteItem.js +4 -4
- package/dist/esm/components/autocomplete/parts/AutocompleteItemGroup.d.ts +1 -1
- package/dist/esm/components/autocomplete/parts/AutocompleteItemGroup.js +12 -12
- package/dist/esm/components/autocomplete/parts/AutocompletePanel.d.ts +1 -1
- package/dist/esm/components/autocomplete/parts/AutocompletePanel.js +7 -7
- package/dist/esm/components/avatar/Avatar.d.ts +1 -1
- package/dist/esm/components/avatar/Avatar.js +15 -16
- package/dist/esm/components/avatar/Avatar.variants.js +1 -1
- package/dist/esm/components/avatar/parts/AvatarFallback.d.ts +1 -1
- package/dist/esm/components/avatar/parts/AvatarFallback.js +9 -10
- package/dist/esm/components/avatar/parts/AvatarImage.js +12 -12
- package/dist/esm/components/avatar/parts/AvatarPair.d.ts +1 -1
- package/dist/esm/components/avatar/parts/AvatarPair.js +4 -4
- package/dist/esm/components/badge/Badge.d.ts +1 -1
- package/dist/esm/components/badge/Badge.js +31 -35
- package/dist/esm/components/bottom-sheet/BottomSheet.d.ts +1 -1
- package/dist/esm/components/bottom-sheet/BottomSheet.js +14 -14
- package/dist/esm/components/bottom-sheet/parts/BottomSheetContent.d.ts +1 -1
- package/dist/esm/components/bottom-sheet/parts/BottomSheetContent.js +4 -4
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +11 -11
- package/dist/esm/components/bottom-sheet/parts/BottomSheetFooter.d.ts +1 -1
- package/dist/esm/components/bottom-sheet/parts/BottomSheetFooter.js +4 -4
- package/dist/esm/components/bottom-sheet/parts/BottomSheetHeader.d.ts +4 -4
- package/dist/esm/components/bottom-sheet/parts/BottomSheetHeader.js +6 -6
- package/dist/esm/components/breadcrumbs/Breadcrumbs.context.d.ts +1 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.variant.js +3 -3
- package/dist/esm/components/button/Button.js +33 -41
- package/dist/esm/components/button/Button.variants.d.ts +1 -1
- package/dist/esm/components/button/Button.variants.js +1 -1
- package/dist/esm/components/checkbox/Checkbox.js +53 -49
- package/dist/esm/components/checkbox/Checkbox.variants.js +1 -1
- package/dist/esm/components/checkbox/parts/CheckboxIndicator.js +1 -1
- package/dist/esm/components/checkbox-field/CheckboxField.js +39 -34
- package/dist/esm/components/checkbox-group/CheckboxGroup.d.ts +1 -1
- package/dist/esm/components/checkbox-group/CheckboxGroup.js +12 -12
- package/dist/esm/components/collapsible/Collapsible.js +22 -16
- package/dist/esm/components/collapsible/parts/CollapsibleContent.js +16 -7
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +23 -23
- package/dist/esm/components/data-table/DataTable.d.ts +48 -17
- package/dist/esm/components/data-table/DataTable.js +104 -60
- package/dist/esm/components/data-table/mocks/employee-columns.d.ts +4 -0
- package/dist/esm/components/data-table/parts/DataTableBulkActions.d.ts +55 -0
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +65 -0
- package/dist/esm/components/data-table/parts/DataTableRoot.d.ts +37 -0
- package/dist/esm/components/data-table/parts/DataTableRoot.js +13 -0
- package/dist/esm/components/date-calendar/DateCalendar.js +8 -8
- package/dist/esm/components/date-picker/DatePicker.js +9 -9
- package/dist/esm/components/date-picker/parts/DateInput.js +7 -7
- package/dist/esm/components/date-picker-field/DatePickerField.js +12 -12
- package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +4 -4
- package/dist/esm/components/dialog/Dialog.d.ts +1 -1
- package/dist/esm/components/dialog/Dialog.js +9 -9
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +1 -1
- package/dist/esm/components/fieldset/Fieldset.d.ts +1 -1
- package/dist/esm/components/fieldset/Fieldset.js +4 -4
- package/dist/esm/components/flex/Flex.d.ts +1 -1
- package/dist/esm/components/flex/Flex.variants.js +189 -207
- package/dist/esm/components/flex/FlexItem.d.ts +1 -1
- package/dist/esm/components/form/Form.context.d.ts +1 -4
- package/dist/esm/components/form/Form.context.js +11 -13
- package/dist/esm/components/form/Form.d.ts +13 -11
- package/dist/esm/components/form/Form.js +45 -48
- package/dist/esm/components/form-field/FormField.context.d.ts +1 -6
- package/dist/esm/components/form-field/FormField.context.js +39 -47
- package/dist/esm/components/form-field/FormField.d.ts +0 -2
- package/dist/esm/components/form-field/FormField.js +37 -42
- package/dist/esm/components/form-field/parts/FormContextualLink.js +17 -17
- package/dist/esm/components/form-field/parts/FormControl.js +39 -35
- package/dist/esm/components/form-field/parts/FormFeedbackText.js +15 -17
- package/dist/esm/components/full-page-loader/FullPageLoader.js +7 -7
- package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +2 -2
- package/dist/esm/components/funnel-layout/FunnelLayout.js +26 -26
- package/dist/esm/components/funnel-layout/parts/FunnelBody.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelBody.js +4 -4
- package/dist/esm/components/funnel-layout/parts/FunnelPage.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelPage.js +10 -10
- package/dist/esm/components/funnel-layout/parts/FunnelPageAction.d.ts +1 -1
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +13 -13
- package/dist/esm/components/funnel-layout/parts/FunnelPageContent.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelPageContent.js +1 -1
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +7 -7
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.js +4 -4
- package/dist/esm/components/funnel-layout/parts/FunnelProgressBar.d.ts +1 -1
- package/dist/esm/components/funnel-layout/parts/FunnelProgressBar.js +4 -4
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +7 -7
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +9 -9
- package/dist/esm/components/grid/Grid.d.ts +1 -1
- package/dist/esm/components/grid/Grid.variants.d.ts +1 -1
- package/dist/esm/components/grid/Grid.variants.js +3 -3
- package/dist/esm/components/grid/GridItem.d.ts +1 -1
- package/dist/esm/components/icon/Icon.d.ts +1 -1
- package/dist/esm/components/icon/Icon.js +1 -1
- package/dist/esm/components/icon-button/CircularIconButton.d.ts +1 -1
- package/dist/esm/components/icon-button/CircularIconButton.js +21 -20
- package/dist/esm/components/icon-button/IconButton.variants.d.ts +1 -1
- package/dist/esm/components/icon-button/IconButton.variants.js +2 -2
- package/dist/esm/components/input/Input.js +6 -6
- package/dist/esm/components/label/Label.js +13 -13
- package/dist/esm/components/link/Link.d.ts +11 -1
- package/dist/esm/components/link/Link.js +32 -30
- package/dist/esm/components/link/Link.variants.d.ts +141 -30
- package/dist/esm/components/link/Link.variants.js +44 -16
- package/dist/esm/components/menu/parts/MenuItem.js +8 -8
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +14 -14
- package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.js +5 -5
- package/dist/esm/components/multi-select/parts/MultiSelectOption.js +3 -3
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +1 -1
- package/dist/esm/components/multi-select-field/MultiSelectField.js +6 -6
- package/dist/esm/components/nav/parts/NavGroup.js +28 -29
- package/dist/esm/components/nav/parts/NavItem.d.ts +1 -1
- package/dist/esm/components/nav/parts/NavItem.js +13 -14
- package/dist/esm/components/number-field/NumberField.js +14 -14
- package/dist/esm/components/number-input/NumberInput.d.ts +2 -2
- package/dist/esm/components/number-input/NumberInput.js +37 -37
- package/dist/esm/components/page/Page.d.ts +1 -1
- package/dist/esm/components/page/Page.js +5 -5
- package/dist/esm/components/page/parts/PageHeader.d.ts +1 -1
- package/dist/esm/components/page/parts/PageHeader.js +4 -4
- package/dist/esm/components/pagination/Pagination.d.ts +1 -1
- package/dist/esm/components/pagination/Pagination.js +16 -16
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +1 -1
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +8 -8
- package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +9 -9
- package/dist/esm/components/pagination/parts/PaginationLink.d.ts +1 -1
- package/dist/esm/components/pagination/parts/PaginationLink.js +6 -6
- package/dist/esm/components/payfit-brand/PayFitBrand.js +4 -4
- package/dist/esm/components/pill/Pill.d.ts +1 -1
- package/dist/esm/components/pill/Pill.js +1 -1
- package/dist/esm/components/popover/Popover.js +5 -5
- package/dist/esm/components/popover/parts/PopoverHeader.js +7 -7
- package/dist/esm/components/progress-bar/ProgressBar.js +11 -11
- package/dist/esm/components/radio-button-group/parts/RadioButton.d.ts +1 -1
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +5 -5
- package/dist/esm/components/search/Search.d.ts +1 -1
- package/dist/esm/components/search/Search.js +14 -14
- package/dist/esm/components/segmented-button-group/parts/ToggleButton.js +10 -10
- package/dist/esm/components/select/Select.js +12 -12
- package/dist/esm/components/select/parts/SearchInput.js +7 -7
- package/dist/esm/components/select/parts/SelectButton.js +17 -14
- package/dist/esm/components/select/parts/SelectOption.js +4 -4
- package/dist/esm/components/select/parts/SelectOptionGroup.js +8 -8
- package/dist/esm/components/select/parts/SelectOptionHelper.js +1 -1
- package/dist/esm/components/select-field/SelectField.d.ts +1 -1
- package/dist/esm/components/select-field/SelectField.js +16 -16
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +1 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +8 -8
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +10 -10
- package/dist/esm/components/selectable-card/internals/Content.js +5 -5
- package/dist/esm/components/selectable-card/internals/Description.js +1 -1
- package/dist/esm/components/selectable-card/internals/Illustration.js +3 -3
- package/dist/esm/components/selectable-card/internals/SelectedIndicator.js +4 -4
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.d.ts +1 -1
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/RadioIndicator.js +3 -3
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.d.ts +1 -1
- package/dist/esm/components/selectable-card/selectableCard.variant.js +1 -1
- package/dist/esm/components/selectable-card-radio-group-field/SelectableCardRadioGroupField.js +22 -22
- package/dist/esm/components/side-panel/SidePanel.d.ts +1 -1
- package/dist/esm/components/side-panel/SidePanel.js +6 -6
- package/dist/esm/components/side-panel/parts/SidePanelContent.d.ts +1 -1
- package/dist/esm/components/side-panel/parts/SidePanelContent.js +9 -9
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +11 -11
- package/dist/esm/components/side-panel/parts/SidePanelFooter.d.ts +1 -1
- package/dist/esm/components/side-panel/parts/SidePanelFooter.js +4 -4
- package/dist/esm/components/side-panel/parts/SidePanelHeader.d.ts +4 -4
- package/dist/esm/components/side-panel/parts/SidePanelHeader.js +6 -6
- package/dist/esm/components/skip-links/SkipLinks.d.ts +79 -0
- package/dist/esm/components/skip-links/SkipLinks.js +80 -0
- package/dist/esm/components/spinner/Spinner.js +5 -5
- package/dist/esm/components/table/Table.js +101 -100
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.d.ts +1 -19
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +147 -95
- package/dist/esm/components/table/parts/TableBody.js +1 -1
- package/dist/esm/components/table/parts/TableCell.d.ts +17 -1
- package/dist/esm/components/table/parts/TableCell.js +45 -41
- package/dist/esm/components/table/parts/TableColumnHeader.d.ts +2 -1
- package/dist/esm/components/table/parts/TableColumnHeader.js +63 -57
- package/dist/esm/components/table/parts/TableEmptyState.d.ts +1 -1
- package/dist/esm/components/table/parts/TableEmptyState.js +1 -1
- package/dist/esm/components/table/parts/TableHeader.d.ts +3 -3
- package/dist/esm/components/table/parts/TableHeader.js +28 -26
- package/dist/esm/components/table/parts/TablePagination.d.ts +1 -1
- package/dist/esm/components/table/parts/TablePagination.js +9 -9
- package/dist/esm/components/table/parts/TableRow.d.ts +1 -1
- package/dist/esm/components/table/parts/TableRow.js +36 -34
- package/dist/esm/components/tabs/Tabs.context.d.ts +1 -1
- package/dist/esm/components/tabs/Tabs.d.ts +1 -1
- package/dist/esm/components/tabs/Tabs.variant.js +1 -1
- package/dist/esm/components/tabs/parts/NavigationButton.js +12 -12
- package/dist/esm/components/tabs/parts/Tab.d.ts +3 -2
- package/dist/esm/components/tabs/parts/Tab.js +12 -12
- package/dist/esm/components/tabs/parts/TabPanel.d.ts +4 -2
- package/dist/esm/components/tabs/parts/TabPanel.js +7 -7
- package/dist/esm/components/task-menu/TaskMenu.d.ts +1 -1
- package/dist/esm/components/task-menu/TaskMenu.js +7 -7
- package/dist/esm/components/task-menu/parts/Content.js +6 -6
- package/dist/esm/components/task-menu/parts/Header.js +7 -7
- package/dist/esm/components/task-menu/parts/SubTask.js +6 -6
- package/dist/esm/components/task-menu/parts/Task.d.ts +1 -1
- package/dist/esm/components/task-menu/parts/Task.js +12 -12
- package/dist/esm/components/task-menu/parts/TaskGroup.js +7 -7
- package/dist/esm/components/task-menu/parts/task.variants.js +1 -1
- package/dist/esm/components/text/Text.d.ts +1 -1
- package/dist/esm/components/text/Text.variants.js +1 -1
- package/dist/esm/components/text-area/TextArea.js +6 -6
- package/dist/esm/components/text-field/TextField.js +5 -5
- package/dist/esm/components/toast/UnityToast.d.ts +1 -1
- package/dist/esm/components/toast/UnityToast.js +11 -11
- package/dist/esm/components/toggle-switch/ToggleSwitch.d.ts +1 -1
- package/dist/esm/components/toggle-switch/ToggleSwitch.js +4 -4
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +35 -31
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.d.ts +1 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +5 -5
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +43 -38
- package/dist/esm/components/tooltip/Tooltip.d.ts +2 -0
- package/dist/esm/components/tooltip/Tooltip.js +27 -19
- package/dist/esm/hooks/use-form.js +7 -7
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.js +366 -352
- package/dist/esm/integrations/react-router/v5/UnityReactRouterV5Provider.js +28 -0
- package/dist/esm/integrations/react-router/v5/index.d.ts +1 -0
- package/dist/esm/integrations/react-router/v5.js +4 -0
- package/i18n/en-GB.json +6 -0
- package/i18n/es-ES.json +6 -0
- package/i18n/fr-FR.json +6 -0
- package/package.json +38 -35
- package/dist/esm/providers/router/integrations/UnityReactRouterV5Provider.js +0 -28
- /package/dist/esm/{providers/router/integrations → integrations/react-router/v5}/UnityReactRouterV5Provider.d.ts +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
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({
|
|
7
|
+
slots: {
|
|
8
|
+
base: [
|
|
9
|
+
"uy:sr-only",
|
|
10
|
+
"uy:focus-within:p-200",
|
|
11
|
+
"uy:focus-within:bg-surface-neutral",
|
|
12
|
+
"uy:focus-within:shadow-raising",
|
|
13
|
+
"uy:focus-within:rounded-100",
|
|
14
|
+
"uy:focus-within:not-sr-only",
|
|
15
|
+
"uy:focus-within:absolute",
|
|
16
|
+
"uy:focus-within:top-100",
|
|
17
|
+
"uy:focus-within:left-100",
|
|
18
|
+
"uy:focus-within:z-50"
|
|
19
|
+
],
|
|
20
|
+
label: "uy:typography-h4",
|
|
21
|
+
list: "uy:mt-1 uy:space-y-1 uy:list-none"
|
|
22
|
+
}
|
|
23
|
+
}), k = l(
|
|
24
|
+
({ label: s, className: e, children: n, ...a }, i) => {
|
|
25
|
+
const o = `skip-links-label-${y()}`;
|
|
26
|
+
if (!n)
|
|
27
|
+
return null;
|
|
28
|
+
const { base: r, label: u, list: c } = b();
|
|
29
|
+
return /* @__PURE__ */ d(
|
|
30
|
+
"nav",
|
|
31
|
+
{
|
|
32
|
+
"data-dd-privacy": "allow",
|
|
33
|
+
...a,
|
|
34
|
+
ref: i,
|
|
35
|
+
className: r({ className: e }),
|
|
36
|
+
role: "navigation",
|
|
37
|
+
"aria-labelledby": o,
|
|
38
|
+
"data-unity-component": "SkipLinks",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ t("span", { id: o, className: u(), children: s || /* @__PURE__ */ t(
|
|
41
|
+
m,
|
|
42
|
+
{
|
|
43
|
+
id: "unity:component:skip-links:label",
|
|
44
|
+
defaultMessage: "Skip to:"
|
|
45
|
+
}
|
|
46
|
+
) }),
|
|
47
|
+
/* @__PURE__ */ t("ol", { className: c(), children: n })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
), h = l(
|
|
53
|
+
({ targetId: s, children: e, ...n }, a) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
54
|
+
f,
|
|
55
|
+
{
|
|
56
|
+
...n,
|
|
57
|
+
ref: a,
|
|
58
|
+
size: "small",
|
|
59
|
+
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
|
+
) })
|
|
74
|
+
);
|
|
75
|
+
k.displayName = "SkipLinks";
|
|
76
|
+
h.displayName = "SkipLink";
|
|
77
|
+
export {
|
|
78
|
+
h as SkipLink,
|
|
79
|
+
k as SkipLinks
|
|
80
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as t, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
import { uyTv as m } from "@payfit/unity-themes";
|
|
4
4
|
import f from "../../hooks/use-id.js";
|
|
5
5
|
const h = m({
|
|
6
6
|
slots: {
|
|
@@ -40,7 +40,7 @@ function n({ label: l, color: o, size: e, role: r = "status", ...s }, c) {
|
|
|
40
40
|
const a = `spinner-label-${f()}`, {
|
|
41
41
|
base: d,
|
|
42
42
|
indicator: y,
|
|
43
|
-
label:
|
|
43
|
+
label: u
|
|
44
44
|
} = h({
|
|
45
45
|
size: e,
|
|
46
46
|
color: o
|
|
@@ -90,7 +90,7 @@ function n({ label: l, color: o, size: e, role: r = "status", ...s }, c) {
|
|
|
90
90
|
"span",
|
|
91
91
|
{
|
|
92
92
|
id: a,
|
|
93
|
-
className:
|
|
93
|
+
className: u(),
|
|
94
94
|
"aria-hidden": e !== "small",
|
|
95
95
|
children: l
|
|
96
96
|
}
|
|
@@ -100,7 +100,7 @@ function n({ label: l, color: o, size: e, role: r = "status", ...s }, c) {
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
n.displayName = "Spinner";
|
|
103
|
-
const S =
|
|
103
|
+
const S = p(
|
|
104
104
|
n
|
|
105
105
|
);
|
|
106
106
|
export {
|
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { useResizeObserver as
|
|
5
|
-
import { TableContextProvider as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
({ minRows:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
) });
|
|
31
|
-
}
|
|
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({
|
|
7
|
+
base: [
|
|
8
|
+
"uy:w-full uy:border uy:border-solid uy:border-border-neutral uy:rounded-100",
|
|
9
|
+
"uy:relative uy:flex uy:flex-col",
|
|
10
|
+
"uy:min-h-[var(--uy-table-min-rows)] uy:max-h-[var(--uy-table-max-rows)]",
|
|
11
|
+
"uy:overflow-y-auto",
|
|
12
|
+
// Handle vertical scrolling
|
|
13
|
+
"uy:overflow-x-auto"
|
|
14
|
+
// Handle horizontal scrolling too
|
|
15
|
+
]
|
|
16
|
+
}), K = E(
|
|
17
|
+
({ minRows: i = 10, maxRows: u = 50, children: t }, o) => /* @__PURE__ */ b(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
ref: o,
|
|
21
|
+
className: A(),
|
|
22
|
+
"data-unity-slot": "table-root",
|
|
23
|
+
style: {
|
|
24
|
+
"--uy-table-min-rows": `calc(var(--uy-spacing-600) * ${i})`,
|
|
25
|
+
"--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${u})`
|
|
26
|
+
},
|
|
27
|
+
children: t
|
|
28
|
+
}
|
|
29
|
+
)
|
|
32
30
|
);
|
|
33
|
-
|
|
34
|
-
const
|
|
31
|
+
K.displayName = "TableRoot";
|
|
32
|
+
const M = N({
|
|
35
33
|
slots: {
|
|
36
34
|
wrapper: [
|
|
37
|
-
"uy:flex-1 uy:
|
|
38
|
-
"uy:overflow-y-auto",
|
|
39
|
-
// Always enable vertical scrolling
|
|
35
|
+
"uy:flex-1 uy:bg-surface-neutral",
|
|
40
36
|
"uy:w-full"
|
|
37
|
+
// No overflow handling - parent TableRoot handles all scrolling
|
|
41
38
|
],
|
|
42
39
|
table: [
|
|
43
40
|
"uy:min-w-full",
|
|
@@ -48,11 +45,10 @@ const A = E({
|
|
|
48
45
|
variants: {
|
|
49
46
|
horizontalScroll: {
|
|
50
47
|
true: {
|
|
51
|
-
|
|
48
|
+
// Only apply horizontal scroll to the table itself, not wrapper
|
|
52
49
|
table: "uy:w-max"
|
|
53
50
|
},
|
|
54
51
|
false: {
|
|
55
|
-
wrapper: "uy:overflow-x-hidden",
|
|
56
52
|
table: "uy:w-fit"
|
|
57
53
|
}
|
|
58
54
|
}
|
|
@@ -60,114 +56,119 @@ const A = E({
|
|
|
60
56
|
defaultVariants: {
|
|
61
57
|
horizontalScroll: !0
|
|
62
58
|
}
|
|
63
|
-
}),
|
|
59
|
+
}), U = E((i, u) => {
|
|
64
60
|
const {
|
|
65
|
-
children:
|
|
66
|
-
label:
|
|
67
|
-
description:
|
|
68
|
-
isHorizontalScrollEnabled:
|
|
61
|
+
children: t,
|
|
62
|
+
label: o,
|
|
63
|
+
description: d,
|
|
64
|
+
isHorizontalScrollEnabled: x = !0,
|
|
69
65
|
...p
|
|
70
|
-
} =
|
|
71
|
-
ref:
|
|
66
|
+
} = i, c = z(null), { height: n = 0 } = D({
|
|
67
|
+
ref: c,
|
|
72
68
|
box: "border-box"
|
|
73
|
-
}), { rowCount:
|
|
74
|
-
let
|
|
75
|
-
return
|
|
76
|
-
if (!
|
|
77
|
-
const s =
|
|
69
|
+
}), { rowCount: f, columnCount: m } = S(() => {
|
|
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(
|
|
78
74
|
h.props.children
|
|
79
|
-
).filter((
|
|
80
|
-
|
|
81
|
-
if (!
|
|
82
|
-
const w =
|
|
83
|
-
|
|
84
|
-
).filter((
|
|
85
|
-
|
|
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(
|
|
79
|
+
r.props.children
|
|
80
|
+
).filter((y) => a.isValidElement(y));
|
|
81
|
+
e = Math.max(e, w.length);
|
|
86
82
|
});
|
|
87
|
-
}), { rowCount:
|
|
88
|
-
}, [
|
|
89
|
-
return
|
|
83
|
+
}), { rowCount: l, columnCount: e };
|
|
84
|
+
}, [t]);
|
|
85
|
+
return V(u, () => ({
|
|
90
86
|
scrollToTop: () => {
|
|
91
|
-
|
|
87
|
+
const e = c.current, l = e == null ? void 0 : e.closest(
|
|
88
|
+
'[data-unity-slot="table-root"]'
|
|
89
|
+
);
|
|
90
|
+
l ? l.scrollTo({ top: 0, behavior: "smooth" }) : e && e.scrollTo({ top: 0, behavior: "smooth" });
|
|
92
91
|
}
|
|
93
|
-
})), /* @__PURE__ */
|
|
92
|
+
})), /* @__PURE__ */ b(P, { rowCount: f, columnCount: m, children: /* @__PURE__ */ b(
|
|
94
93
|
H,
|
|
95
94
|
{
|
|
96
|
-
scrollContainerRef:
|
|
95
|
+
scrollContainerRef: c,
|
|
97
96
|
containerHeight: n,
|
|
98
|
-
rowCount:
|
|
99
|
-
columnCount:
|
|
100
|
-
label:
|
|
101
|
-
description:
|
|
102
|
-
isHorizontalScrollEnabled:
|
|
97
|
+
rowCount: f,
|
|
98
|
+
columnCount: m,
|
|
99
|
+
label: o,
|
|
100
|
+
description: d,
|
|
101
|
+
isHorizontalScrollEnabled: x,
|
|
103
102
|
...p,
|
|
104
|
-
children:
|
|
103
|
+
children: t
|
|
105
104
|
}
|
|
106
105
|
) });
|
|
107
106
|
});
|
|
108
|
-
|
|
109
|
-
const H = (
|
|
107
|
+
U.displayName = "Table";
|
|
108
|
+
const H = (i) => {
|
|
110
109
|
var g, C, T;
|
|
111
110
|
const {
|
|
112
|
-
children:
|
|
113
|
-
label:
|
|
114
|
-
description:
|
|
115
|
-
scrollContainerRef:
|
|
116
|
-
containerHeight:
|
|
111
|
+
children: u,
|
|
112
|
+
label: t,
|
|
113
|
+
description: o,
|
|
114
|
+
scrollContainerRef: d,
|
|
115
|
+
containerHeight: x,
|
|
117
116
|
rowCount: p,
|
|
118
|
-
columnCount:
|
|
117
|
+
columnCount: c,
|
|
119
118
|
onKeyDown: n,
|
|
120
|
-
isHorizontalScrollEnabled:
|
|
121
|
-
...
|
|
122
|
-
} =
|
|
123
|
-
horizontalScroll:
|
|
124
|
-
}), { keyboardNavigation: h } =
|
|
125
|
-
(
|
|
126
|
-
|
|
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));
|
|
127
126
|
},
|
|
128
|
-
[
|
|
129
|
-
),
|
|
127
|
+
[r, n]
|
|
128
|
+
), y = (g = d.current) == null ? void 0 : g.closest(
|
|
129
|
+
'[data-unity-slot="table-root"]'
|
|
130
|
+
), k = y ? y.scrollHeight > y.clientHeight : !1;
|
|
130
131
|
return /* @__PURE__ */ R(
|
|
131
132
|
"div",
|
|
132
133
|
{
|
|
133
|
-
className:
|
|
134
|
-
ref:
|
|
134
|
+
className: e(),
|
|
135
|
+
ref: d,
|
|
135
136
|
style: {
|
|
136
|
-
"--uy-table-is-scrollable":
|
|
137
|
+
"--uy-table-is-scrollable": k ? "1" : "0"
|
|
137
138
|
},
|
|
138
139
|
children: [
|
|
139
140
|
/* @__PURE__ */ R(
|
|
140
141
|
"table",
|
|
141
142
|
{
|
|
142
143
|
ref: s,
|
|
143
|
-
className:
|
|
144
|
+
className: l(),
|
|
144
145
|
role: "grid",
|
|
145
146
|
"aria-rowcount": p,
|
|
146
|
-
"aria-colcount":
|
|
147
|
-
"aria-label":
|
|
148
|
-
"aria-describedby":
|
|
147
|
+
"aria-colcount": c,
|
|
148
|
+
"aria-label": t,
|
|
149
|
+
"aria-describedby": o ? `table-desc-${(C = s.current) == null ? void 0 : C.id}` : void 0,
|
|
149
150
|
onKeyDown: w,
|
|
150
|
-
...
|
|
151
|
+
...m,
|
|
151
152
|
children: [
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
u,
|
|
154
|
+
o && /* @__PURE__ */ b(
|
|
154
155
|
"caption",
|
|
155
156
|
{
|
|
156
157
|
id: `table-desc-${(T = s.current) == null ? void 0 : T.id}`,
|
|
157
158
|
className: "uy:sr-only",
|
|
158
|
-
children:
|
|
159
|
+
children: o
|
|
159
160
|
}
|
|
160
161
|
)
|
|
161
162
|
]
|
|
162
163
|
}
|
|
163
164
|
),
|
|
164
|
-
/* @__PURE__ */
|
|
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." })
|
|
165
166
|
]
|
|
166
167
|
}
|
|
167
168
|
);
|
|
168
169
|
};
|
|
169
170
|
H.displayName = "TableContent";
|
|
170
171
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
U as Table,
|
|
173
|
+
K as TableRoot
|
|
173
174
|
};
|
|
@@ -7,24 +7,6 @@ export interface CellPosition {
|
|
|
7
7
|
/** The column index (0-based) */
|
|
8
8
|
colIndex: number;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Hook that provides keyboard navigation functionality for tables.
|
|
12
|
-
* This hook implements the WAI-ARIA grid keyboard interaction pattern, allowing users to:
|
|
13
|
-
* - Navigate between cells using arrow keys
|
|
14
|
-
* - Jump to the first/last cell in a row using Home/End
|
|
15
|
-
* - Jump to the first/last cell in the table using Ctrl+Home/Ctrl+End
|
|
16
|
-
* - Move between pages of rows using Page Up/Page Down
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* const {
|
|
20
|
-
* focusedCell,
|
|
21
|
-
* isCellFocused,
|
|
22
|
-
* handleCellKeyDown,
|
|
23
|
-
* handleTableKeyDown,
|
|
24
|
-
* tableRef
|
|
25
|
-
* } = useTableKeyboardNavigation()
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
10
|
export declare function useTableKeyboardNavigation(): {
|
|
29
11
|
focusedCell: CellPosition;
|
|
30
12
|
setFocusedCell: import('react').Dispatch<import('react').SetStateAction<CellPosition>>;
|
|
@@ -34,6 +16,6 @@ export declare function useTableKeyboardNavigation(): {
|
|
|
34
16
|
handleTableFocus: (e: React.FocusEvent<HTMLTableElement>) => void;
|
|
35
17
|
handleCellFocus: (e: React.FocusEvent<HTMLTableCellElement>) => void;
|
|
36
18
|
tableRef: import('react').MutableRefObject<HTMLTableElement | null>;
|
|
37
|
-
focusCell: (rowIndex: number, colIndex: number) => void;
|
|
19
|
+
focusCell: (rowIndex: number, colIndex: number, direction?: "left" | "right") => void;
|
|
38
20
|
focusRow: (rowIndex: number) => void;
|
|
39
21
|
};
|