@payfit/unity-components 1.1.1-beta.1 → 2.0.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 +60 -62
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +58 -45
- package/dist/esm/components/app-layout/AppLayout.js +17 -17
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
- 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/breadcrumbs/Breadcrumbs.context.js +3 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
- 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/client-side-pagination/ClientSidePagination.d.ts +103 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
- package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
- package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
- package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
- package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
- package/dist/esm/components/code/Code.d.ts +31 -1
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- 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/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 +208 -0
- package/dist/esm/components/error-state/ErrorState.js +194 -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/fieldset/Fieldset.d.ts +19 -0
- package/dist/esm/components/fieldset/Fieldset.js +32 -26
- package/dist/esm/components/flex/Flex.js +52 -37
- 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 +18 -17
- package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
- package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
- 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/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/icon/Icon.js +23 -19
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
- package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
- package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
- package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
- 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.d.ts +3 -3
- package/dist/esm/components/nav/parts/NavGroup.js +63 -52
- package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
- package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
- 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/page/Page.js +1 -1
- package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
- package/dist/esm/components/page/parts/PageHeader.js +22 -20
- package/dist/esm/components/pagination/Pagination.d.ts +23 -44
- package/dist/esm/components/pagination/Pagination.js +89 -167
- package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
- package/dist/esm/components/pagination/PaginationContext.js +15 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
- package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
- package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
- package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
- package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
- package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
- 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/Select.js +63 -45
- package/dist/esm/components/select/parts/SelectOption.js +9 -9
- 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 +1 -1
- package/dist/esm/components/table/Table.d.ts +1 -0
- package/dist/esm/components/table/Table.js +110 -98
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +34 -31
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +21 -18
- package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
- package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
- 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.d.ts → RawSubTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +74 -74
- package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text/Text.js +30 -27
- 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-container-query-level.d.ts +42 -0
- package/dist/esm/hooks/use-container-query-level.js +33 -0
- 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 +21 -10
- package/dist/esm/index.js +424 -396
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
- package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router.js +34 -0
- package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
- package/dist/esm/providers/router/RouterProvider.js +14 -10
- package/dist/esm/types/DataAttributes.d.ts +1 -1
- 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 +56 -31
- package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
- package/dist/esm/components/link/Link.d.ts +0 -93
- package/dist/esm/components/link/Link.js +0 -68
- package/dist/esm/components/nav/parts/NavItem.js +0 -95
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import { StandardSchema, StandardSchemaField } from '../types/schema.js';
|
|
3
|
+
export declare class StandardSchemaAdapter implements StandardSchema {
|
|
4
|
+
private standardSchema;
|
|
5
|
+
constructor(standardSchema: StandardSchemaV1);
|
|
6
|
+
getField(path: string): StandardSchemaField | null;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class r {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
this.standardSchema = t;
|
|
4
|
+
}
|
|
5
|
+
getField(t) {
|
|
6
|
+
try {
|
|
7
|
+
return this.standardSchema ? {
|
|
8
|
+
isOptional: !1,
|
|
9
|
+
// Default to required - can be enhanced with actual validation logic
|
|
10
|
+
type: "unknown",
|
|
11
|
+
shape: void 0
|
|
12
|
+
} : null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
r as StandardSchemaAdapter
|
|
20
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StandardSchema, StandardSchemaField } from '../types/schema.js';
|
|
2
|
+
import { z as z3 } from 'zod/v3';
|
|
3
|
+
import { z as z4 } from 'zod/v4';
|
|
4
|
+
export declare class ZodV3SchemaAdapter implements StandardSchema {
|
|
5
|
+
private zodSchema;
|
|
6
|
+
constructor(zodSchema: z3.ZodObject<z3.ZodRawShape>);
|
|
7
|
+
getField(path: string): StandardSchemaField | null;
|
|
8
|
+
}
|
|
9
|
+
export declare class ZodV4SchemaAdapter implements StandardSchema {
|
|
10
|
+
private zodSchema;
|
|
11
|
+
constructor(zodSchema: z4.ZodObject<z4.ZodRawShape>);
|
|
12
|
+
getField(path: string): StandardSchemaField | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z as c } from "zod/v3";
|
|
2
|
+
import { z as p } from "zod/v4";
|
|
3
|
+
class u {
|
|
4
|
+
constructor(n) {
|
|
5
|
+
this.zodSchema = n;
|
|
6
|
+
}
|
|
7
|
+
getField(n) {
|
|
8
|
+
try {
|
|
9
|
+
if (!this.zodSchema) return null;
|
|
10
|
+
const a = n.split(".");
|
|
11
|
+
let r = this.zodSchema.shape, e;
|
|
12
|
+
for (let t = 0; t < a.length; t++) {
|
|
13
|
+
const l = a[t];
|
|
14
|
+
if (e = r[l], !e) return null;
|
|
15
|
+
if (t < a.length - 1) {
|
|
16
|
+
const i = e instanceof c.ZodOptional ? e._def.innerType.shape : e.shape;
|
|
17
|
+
if (!i) return null;
|
|
18
|
+
r = i;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const s = e instanceof c.ZodOptional, o = s ? e._def.innerType : e;
|
|
22
|
+
return {
|
|
23
|
+
isOptional: s,
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
25
|
+
type: o._def?.typeName || "unknown",
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
|
+
shape: o instanceof c.ZodObject ? (
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
o.shape
|
|
30
|
+
) : void 0
|
|
31
|
+
};
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class m {
|
|
38
|
+
constructor(n) {
|
|
39
|
+
this.zodSchema = n;
|
|
40
|
+
}
|
|
41
|
+
getField(n) {
|
|
42
|
+
try {
|
|
43
|
+
if (!this.zodSchema) return null;
|
|
44
|
+
const a = n.split(".");
|
|
45
|
+
let r = this.zodSchema.shape, e;
|
|
46
|
+
for (let t = 0; t < a.length; t++) {
|
|
47
|
+
const l = a[t];
|
|
48
|
+
if (e = r[l], !e) return null;
|
|
49
|
+
if (t < a.length - 1) {
|
|
50
|
+
const i = e instanceof p.ZodOptional ? e.def.innerType.shape : e.shape;
|
|
51
|
+
if (!i) return null;
|
|
52
|
+
r = i;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const s = e instanceof p.ZodOptional, o = s ? e.def.innerType : e;
|
|
56
|
+
return {
|
|
57
|
+
isOptional: s,
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
59
|
+
type: o.def?.typeName || "unknown",
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
61
|
+
shape: o instanceof p.ZodObject ? (
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
o.shape
|
|
64
|
+
) : void 0
|
|
65
|
+
};
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
u as ZodV3SchemaAdapter,
|
|
73
|
+
m as ZodV4SchemaAdapter
|
|
74
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as n, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { Toolbar as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { IconButton as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Menu as
|
|
10
|
-
import { MenuContent as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { ActionBarAction as
|
|
14
|
-
const
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import P, { forwardRef as T, useCallback as R, isValidElement as j } from "react";
|
|
3
|
+
import { uyTv as z } from "@payfit/unity-themes";
|
|
4
|
+
import { Toolbar as D, Group as y } from "react-aria-components";
|
|
5
|
+
import { useIntl as S, FormattedMessage as l } from "react-intl";
|
|
6
|
+
import { Button as _ } from "../button/Button.js";
|
|
7
|
+
import { IconButton as E } from "../icon-button/IconButton.js";
|
|
8
|
+
import { Icon as F } from "../icon/Icon.js";
|
|
9
|
+
import { Menu as G } from "../menu/Menu.js";
|
|
10
|
+
import { MenuContent as K } from "../menu/parts/MenuContent.js";
|
|
11
|
+
import { MenuTrigger as L } from "../menu/parts/MenuTrigger.js";
|
|
12
|
+
import { RawMenuItem as O } from "../menu/parts/RawMenuItem.js";
|
|
13
|
+
import { ActionBarAction as U } from "./parts/ActionBarAction.js";
|
|
14
|
+
const V = z({
|
|
15
15
|
slots: {
|
|
16
16
|
base: [
|
|
17
17
|
"uy:bg-surface-inverted uy:text-content-inverted",
|
|
@@ -30,59 +30,58 @@ const q = R({
|
|
|
30
30
|
"uy:md:not-sr-only"
|
|
31
31
|
]
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), q = T(
|
|
34
34
|
({
|
|
35
|
-
id:
|
|
35
|
+
id: d,
|
|
36
36
|
selectionCount: u,
|
|
37
|
-
onClearSelection:
|
|
37
|
+
onClearSelection: f,
|
|
38
38
|
children: r,
|
|
39
39
|
actions: a,
|
|
40
40
|
renderSelectionText: c,
|
|
41
|
-
"aria-label":
|
|
42
|
-
onFocus:
|
|
43
|
-
onBlur:
|
|
41
|
+
"aria-label": p,
|
|
42
|
+
onFocus: b,
|
|
43
|
+
onBlur: h,
|
|
44
44
|
...i
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
const { base: x, selectionArea: A, selectionCountText: M, actionArea: k } = q(), m = _(), s = a !== void 0 && typeof r == "function", B = i["aria-keyshortcuts"] !== void 0, I = b ?? m.formatMessage({
|
|
45
|
+
}, v) => {
|
|
46
|
+
const { base: g, selectionArea: x, selectionCountText: A, actionArea: M } = V(), m = S(), s = a !== void 0 && typeof r == "function", k = i["aria-keyshortcuts"] !== void 0, B = p ?? m.formatMessage({
|
|
48
47
|
id: "unity:component:action-bar:toolbar-label",
|
|
49
48
|
defaultMessage: "Bulk actions toolbar"
|
|
50
|
-
}),
|
|
49
|
+
}), I = R(() => {
|
|
51
50
|
if (s) {
|
|
52
51
|
const e = r;
|
|
53
|
-
return a.map((
|
|
52
|
+
return a.map((o, N) => e(o, N));
|
|
54
53
|
}
|
|
55
54
|
return r;
|
|
56
|
-
}, [r, a, s]), w = !!r || "actions" in i && i.actions.length > 0,
|
|
57
|
-
if (!
|
|
55
|
+
}, [r, a, s]), w = !!r || "actions" in i && i.actions.length > 0, C = s ? a.filter((e) => e.variant !== "primary") : P.Children.map(r, (e) => {
|
|
56
|
+
if (!j(e) || e.type !== U)
|
|
58
57
|
return null;
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
...
|
|
62
|
-
id: e.key ??
|
|
63
|
-
onPress:
|
|
64
|
-
label:
|
|
65
|
-
variant:
|
|
66
|
-
prefixIcon:
|
|
58
|
+
const o = e.props;
|
|
59
|
+
return o.variant === "primary" ? null : {
|
|
60
|
+
...o,
|
|
61
|
+
id: e.key ?? o.id,
|
|
62
|
+
onPress: o.onPress,
|
|
63
|
+
label: o.children,
|
|
64
|
+
variant: o.variant,
|
|
65
|
+
prefixIcon: o.prefixIcon
|
|
67
66
|
};
|
|
68
|
-
})
|
|
67
|
+
})?.filter(Boolean);
|
|
69
68
|
return /* @__PURE__ */ n(
|
|
70
|
-
|
|
69
|
+
D,
|
|
71
70
|
{
|
|
72
71
|
...i,
|
|
73
|
-
id:
|
|
74
|
-
ref:
|
|
75
|
-
className:
|
|
76
|
-
"aria-label":
|
|
72
|
+
id: d,
|
|
73
|
+
ref: v,
|
|
74
|
+
className: g(),
|
|
75
|
+
"aria-label": B,
|
|
77
76
|
orientation: "horizontal",
|
|
78
77
|
tabIndex: -1,
|
|
79
|
-
onFocus:
|
|
80
|
-
onBlur:
|
|
78
|
+
onFocus: b,
|
|
79
|
+
onBlur: h,
|
|
81
80
|
children: [
|
|
82
81
|
/* @__PURE__ */ n(
|
|
83
|
-
|
|
82
|
+
y,
|
|
84
83
|
{
|
|
85
|
-
className:
|
|
84
|
+
className: x(),
|
|
86
85
|
"aria-label": m.formatMessage({
|
|
87
86
|
id: "unity:component:action-bar:group:label",
|
|
88
87
|
defaultMessage: "Selection information"
|
|
@@ -91,12 +90,12 @@ const q = R({
|
|
|
91
90
|
/* @__PURE__ */ n(
|
|
92
91
|
"div",
|
|
93
92
|
{
|
|
94
|
-
className:
|
|
93
|
+
className: A(),
|
|
95
94
|
role: "status",
|
|
96
95
|
"aria-live": "polite",
|
|
97
96
|
"aria-atomic": "true",
|
|
98
97
|
children: [
|
|
99
|
-
c ? c(u) : /* @__PURE__ */
|
|
98
|
+
c ? c(u) : /* @__PURE__ */ t(
|
|
100
99
|
l,
|
|
101
100
|
{
|
|
102
101
|
id: "unity:component:action-bar:selection-count-text",
|
|
@@ -104,7 +103,7 @@ const q = R({
|
|
|
104
103
|
values: { selectionCount: u }
|
|
105
104
|
}
|
|
106
105
|
),
|
|
107
|
-
|
|
106
|
+
k && /* @__PURE__ */ t("span", { className: "uy:sr-only", children: /* @__PURE__ */ t(
|
|
108
107
|
l,
|
|
109
108
|
{
|
|
110
109
|
id: "unity:component:action-bar:key-shortcuts-text",
|
|
@@ -117,7 +116,7 @@ const q = R({
|
|
|
117
116
|
]
|
|
118
117
|
}
|
|
119
118
|
),
|
|
120
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ t(_, { color: "inverted", variant: "ghost", onPress: f, children: /* @__PURE__ */ t(
|
|
121
120
|
l,
|
|
122
121
|
{
|
|
123
122
|
id: "unity:component:action-bar:clear-selection-button",
|
|
@@ -128,16 +127,16 @@ const q = R({
|
|
|
128
127
|
}
|
|
129
128
|
),
|
|
130
129
|
w && /* @__PURE__ */ n(
|
|
131
|
-
|
|
130
|
+
y,
|
|
132
131
|
{
|
|
133
|
-
className:
|
|
132
|
+
className: M(),
|
|
134
133
|
role: "group",
|
|
135
134
|
"aria-label": "Available actions",
|
|
136
135
|
children: [
|
|
137
|
-
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
136
|
+
I(),
|
|
137
|
+
/* @__PURE__ */ t("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ n(G, { children: [
|
|
138
|
+
/* @__PURE__ */ t(L, { asChild: !0, children: /* @__PURE__ */ t(
|
|
139
|
+
E,
|
|
141
140
|
{
|
|
142
141
|
icon: "DotsThreeOutlined",
|
|
143
142
|
label: "More actions",
|
|
@@ -145,14 +144,13 @@ const q = R({
|
|
|
145
144
|
color: "inverted"
|
|
146
145
|
}
|
|
147
146
|
) }),
|
|
148
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ t(K, { children: C.map((e) => /* @__PURE__ */ t(
|
|
149
148
|
O,
|
|
150
149
|
{
|
|
151
150
|
onAction: () => {
|
|
152
|
-
|
|
153
|
-
(t = e.onPress) == null || t.call(e, {});
|
|
151
|
+
e.onPress?.({});
|
|
154
152
|
},
|
|
155
|
-
prefix: e.prefixIcon ? /* @__PURE__ */
|
|
153
|
+
prefix: e.prefixIcon ? /* @__PURE__ */ t(F, { src: e.prefixIcon, size: 20 }) : void 0,
|
|
156
154
|
children: e.label
|
|
157
155
|
},
|
|
158
156
|
e.id
|
|
@@ -166,8 +164,8 @@ const q = R({
|
|
|
166
164
|
);
|
|
167
165
|
}
|
|
168
166
|
);
|
|
169
|
-
|
|
167
|
+
q.displayName = "ActionBar";
|
|
170
168
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
q as ActionBar,
|
|
170
|
+
V as actionBar
|
|
173
171
|
};
|
|
@@ -5,10 +5,57 @@ export interface ActionableProps extends AriaButtonProps {
|
|
|
5
5
|
/** set to true to remove the Actionable's base styles */
|
|
6
6
|
isUnstyled?: boolean;
|
|
7
7
|
/** The HTML element to render the actionable as. */
|
|
8
|
-
asElement?: 'span' | 'div';
|
|
8
|
+
asElement?: 'span' | 'div' | 'button';
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Actionable primitive creates interactive surfaces that behave like buttons while allowing complete control over appearance and content.
|
|
12
|
+
* Use this component when you need to build complex interactive elements that require custom styling or dynamic content based on interaction states, and when standard Unity button components are insufficient for your use case.
|
|
13
|
+
* @param {ActionableProps} props - Button behavior props from React Aria, plus styling and element configuration
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic usage with custom styling
|
|
17
|
+
* import { Actionable } from '@payfit/unity-components'
|
|
18
|
+
*
|
|
19
|
+
* function Example() {
|
|
20
|
+
* return (
|
|
21
|
+
* <Actionable
|
|
22
|
+
* className="uy:p-100 uy:rounded-100 uy:border uy:border-border-neutral uy:hover:bg-surface-neutral-hover"
|
|
23
|
+
* onPress={() => console.log('Pressed!')}
|
|
24
|
+
* >
|
|
25
|
+
* Click me
|
|
26
|
+
* </Actionable>
|
|
27
|
+
* )
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Dynamic content based on interaction state
|
|
33
|
+
* import { Actionable, Icon } from '@payfit/unity-components'
|
|
34
|
+
*
|
|
35
|
+
* function Example() {
|
|
36
|
+
* return (
|
|
37
|
+
* <Actionable asElement="button" className="uy:p-100 uy:flex uy:items-center uy:gap-100">
|
|
38
|
+
* {({ isHovered, isPressed }) => (
|
|
39
|
+
* <>
|
|
40
|
+
* <Icon src={isHovered || isPressed ? 'CakeFilled' : 'CakeOutlined'} />
|
|
41
|
+
* <span>Interactive content</span>
|
|
42
|
+
* </>
|
|
43
|
+
* )}
|
|
44
|
+
* </Actionable>
|
|
45
|
+
* )
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
* @remarks
|
|
49
|
+
* - Provides button-like interaction behavior using React Aria hooks for accessibility
|
|
50
|
+
* - Supports rendering as `div`, `span`, or `button` elements via the `asElement` prop
|
|
51
|
+
* - Includes built-in state management for hover, focus, and press interactions
|
|
52
|
+
* - Automatically applies appropriate ARIA attributes and keyboard navigation
|
|
53
|
+
* - Supports both static children and render prop pattern for dynamic content
|
|
54
|
+
* - Use data attributes (`data-hovered`, `data-pressed`, `data-focused`, `data-disabled`, `data-focus-visible`) for styling non-button elements
|
|
55
|
+
* - Marked as `uy:group` for styling child elements based on parent state
|
|
56
|
+
* @see {@link ActionableProps} for all available props
|
|
57
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/actionable GitHub}
|
|
58
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/primitives-actionable--docs unity-components.payfit.io}
|
|
12
59
|
*/
|
|
13
|
-
declare const Actionable: import('react').ForwardRefExoticComponent<ActionableProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
60
|
+
declare const Actionable: import('react').ForwardRefExoticComponent<ActionableProps & import('react').RefAttributes<HTMLButtonElement | HTMLDivElement | HTMLSpanElement>>;
|
|
14
61
|
export { Actionable };
|
|
@@ -1,71 +1,84 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useFocusVisible as
|
|
5
|
-
import { useObjectRef as
|
|
6
|
-
import { useButton as
|
|
7
|
-
const
|
|
8
|
-
base: "uy:group
|
|
1
|
+
import { jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, useState as F, useMemo as E } from "react";
|
|
3
|
+
import { uyTv as N } from "@payfit/unity-themes";
|
|
4
|
+
import { useFocusVisible as x, useHover as S, useFocus as U } from "@react-aria/interactions";
|
|
5
|
+
import { useObjectRef as V, mergeProps as f } from "@react-aria/utils";
|
|
6
|
+
import { useButton as j } from "react-aria";
|
|
7
|
+
const w = N({
|
|
8
|
+
base: "uy:group",
|
|
9
9
|
variants: {
|
|
10
10
|
isUnstyled: {
|
|
11
11
|
true: "",
|
|
12
|
-
false:
|
|
12
|
+
false: [
|
|
13
|
+
"uy:cursor-pointer",
|
|
14
|
+
"uy:aria-disabled:cursor-not-allowed",
|
|
15
|
+
"uy:aria-disabled:text-content-neutral-disabled"
|
|
16
|
+
]
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
defaultVariants: {
|
|
16
20
|
isUnstyled: !1
|
|
17
21
|
}
|
|
18
|
-
}),
|
|
22
|
+
}), A = k((v, e) => {
|
|
19
23
|
const {
|
|
20
|
-
asElement:
|
|
21
|
-
isUnstyled:
|
|
22
|
-
className:
|
|
24
|
+
asElement: l = "div",
|
|
25
|
+
isUnstyled: d = !1,
|
|
26
|
+
className: c,
|
|
23
27
|
children: o,
|
|
24
|
-
...
|
|
25
|
-
} =
|
|
26
|
-
|
|
27
|
-
const { isFocusVisible:
|
|
28
|
-
onHoverStart:
|
|
29
|
-
onHoverEnd:
|
|
30
|
-
onHoverChange:
|
|
31
|
-
isDisabled:
|
|
32
|
-
}), [
|
|
33
|
-
onFocusChange:
|
|
34
|
-
isDisabled:
|
|
35
|
-
}), { buttonProps:
|
|
28
|
+
...s
|
|
29
|
+
} = v;
|
|
30
|
+
e = V(e);
|
|
31
|
+
const { isFocusVisible: i } = x(), { isHovered: a, hoverProps: u } = S({
|
|
32
|
+
onHoverStart: s.onHoverStart,
|
|
33
|
+
onHoverEnd: s.onHoverEnd,
|
|
34
|
+
onHoverChange: s.onHoverChange,
|
|
35
|
+
isDisabled: s.isDisabled
|
|
36
|
+
}), [t, D] = F(!1), { focusProps: b } = U({
|
|
37
|
+
onFocusChange: D,
|
|
38
|
+
isDisabled: s.isDisabled
|
|
39
|
+
}), { buttonProps: m, isPressed: n } = j(
|
|
36
40
|
{
|
|
37
|
-
...
|
|
38
|
-
|
|
41
|
+
...s,
|
|
42
|
+
isDisabled: s.isDisabled,
|
|
43
|
+
elementType: l
|
|
39
44
|
},
|
|
40
|
-
|
|
41
|
-
),
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
e
|
|
46
|
+
), y = E(
|
|
47
|
+
() => w({ isUnstyled: d, className: c }),
|
|
48
|
+
[c, d]
|
|
49
|
+
), g = l, C = (r) => {
|
|
50
|
+
if (s.isDisabled) {
|
|
51
|
+
r.preventDefault(), r.stopPropagation();
|
|
44
52
|
return;
|
|
45
53
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
return /* @__PURE__ */
|
|
54
|
+
const p = f(m, u, b);
|
|
55
|
+
p.onClick && p.onClick(r);
|
|
56
|
+
}, P = f(m, u, b), { onClick: M, ...h } = P;
|
|
57
|
+
return /* @__PURE__ */ H(
|
|
50
58
|
g,
|
|
51
59
|
{
|
|
52
60
|
...h,
|
|
53
|
-
onClick:
|
|
54
|
-
className:
|
|
55
|
-
|
|
61
|
+
onClick: C,
|
|
62
|
+
className: y,
|
|
63
|
+
...n && { "data-pressed": n },
|
|
64
|
+
...t && { "data-focused": t },
|
|
65
|
+
...a && { "data-hovered": a },
|
|
66
|
+
...s.isDisabled && { "data-disabled": s.isDisabled },
|
|
67
|
+
...i && { "data-focus-visible": i },
|
|
68
|
+
ref: e,
|
|
56
69
|
children: typeof o == "function" ? o({
|
|
57
|
-
isHovered:
|
|
58
|
-
isPressed:
|
|
59
|
-
isFocused:
|
|
60
|
-
isDisabled: !!
|
|
61
|
-
isFocusVisible:
|
|
70
|
+
isHovered: a,
|
|
71
|
+
isPressed: n,
|
|
72
|
+
isFocused: t,
|
|
73
|
+
isDisabled: !!s.isDisabled,
|
|
74
|
+
isFocusVisible: i,
|
|
62
75
|
isPending: !1,
|
|
63
76
|
defaultChildren: null
|
|
64
77
|
}) : o
|
|
65
78
|
}
|
|
66
79
|
);
|
|
67
80
|
});
|
|
68
|
-
|
|
81
|
+
A.displayName = "Actionable";
|
|
69
82
|
export {
|
|
70
|
-
|
|
83
|
+
A as Actionable
|
|
71
84
|
};
|
|
@@ -37,36 +37,36 @@ const w = x({
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
function R({
|
|
40
|
-
children:
|
|
41
|
-
menu:
|
|
42
|
-
header:
|
|
40
|
+
children: l,
|
|
41
|
+
menu: a,
|
|
42
|
+
header: r,
|
|
43
43
|
footer: u,
|
|
44
|
-
withoutContentPadding:
|
|
44
|
+
withoutContentPadding: p = !1
|
|
45
45
|
}) {
|
|
46
|
-
const
|
|
47
|
-
ref:
|
|
46
|
+
const o = v(null), { height: y = 0 } = g({
|
|
47
|
+
ref: o,
|
|
48
48
|
box: "border-box"
|
|
49
|
-
}), { body:
|
|
50
|
-
withoutContentPadding:
|
|
49
|
+
}), { body: s, header: n, menu: d, layoutWrapper: i, contentWrapper: c, content: f, footer: h } = w({
|
|
50
|
+
withoutContentPadding: p
|
|
51
51
|
}), m = {
|
|
52
|
-
"--uy-app-layout-menu-height": `calc(100dvh - ${
|
|
53
|
-
"--uy-app-layout-header-sticky-offset": `${
|
|
52
|
+
"--uy-app-layout-menu-height": `calc(100dvh - ${y}px)`,
|
|
53
|
+
"--uy-app-layout-header-sticky-offset": `${y}px`
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */ t("div", { className:
|
|
56
|
-
|
|
55
|
+
return /* @__PURE__ */ t("div", { className: s(), style: m, children: [
|
|
56
|
+
r && /* @__PURE__ */ e(
|
|
57
57
|
"div",
|
|
58
58
|
{
|
|
59
|
-
ref:
|
|
60
|
-
className:
|
|
59
|
+
ref: o,
|
|
60
|
+
className: n(),
|
|
61
61
|
role: "alert",
|
|
62
62
|
"aria-live": "assertive",
|
|
63
|
-
children:
|
|
63
|
+
children: r
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
66
|
/* @__PURE__ */ t("div", { className: i(), children: [
|
|
67
|
-
/* @__PURE__ */ e("div", { className: d(), children:
|
|
67
|
+
a && /* @__PURE__ */ e("div", { className: d(), children: a }),
|
|
68
68
|
/* @__PURE__ */ t("div", { className: c(), children: [
|
|
69
|
-
/* @__PURE__ */ e("div", { className: f(), children:
|
|
69
|
+
/* @__PURE__ */ e("div", { className: f(), children: l }),
|
|
70
70
|
u && /* @__PURE__ */ e("footer", { className: h(), children: u })
|
|
71
71
|
] })
|
|
72
72
|
] })
|