@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.
Files changed (206) 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 +60 -62
  6. package/dist/esm/components/actionable/Actionable.d.ts +50 -3
  7. package/dist/esm/components/actionable/Actionable.js +58 -45
  8. package/dist/esm/components/app-layout/AppLayout.js +17 -17
  9. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
  10. package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
  11. package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
  12. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  13. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
  14. package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
  15. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
  16. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
  17. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
  18. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
  19. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
  20. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
  21. package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
  22. package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
  23. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
  24. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
  25. package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
  26. package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
  27. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
  28. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
  29. package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
  30. package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +39 -40
  31. package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
  32. package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
  33. package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
  34. package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
  35. package/dist/esm/components/code/Code.d.ts +31 -1
  36. package/dist/esm/components/code/Code.js +39 -0
  37. package/dist/esm/components/code/copyToClipboard.js +10 -0
  38. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
  39. package/dist/esm/components/data-table/DataTable.d.ts +76 -10
  40. package/dist/esm/components/data-table/DataTable.js +81 -78
  41. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
  42. package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
  43. package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
  44. package/dist/esm/components/date-picker/DatePicker.js +64 -64
  45. package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
  46. package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
  47. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
  48. package/dist/esm/components/error-state/ErrorState.d.ts +208 -0
  49. package/dist/esm/components/error-state/ErrorState.js +194 -0
  50. package/dist/esm/components/error-state/initConfig.d.ts +16 -0
  51. package/dist/esm/components/error-state/initConfig.js +149 -0
  52. package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
  53. package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
  54. package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
  55. package/dist/esm/components/fieldset/Fieldset.js +32 -26
  56. package/dist/esm/components/flex/Flex.js +52 -37
  57. package/dist/esm/components/form/Form.d.ts +15 -9
  58. package/dist/esm/components/form/Form.js +53 -50
  59. package/dist/esm/components/form-field/FormField.js +18 -17
  60. package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
  61. package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
  62. package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
  63. package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
  64. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
  65. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  66. package/dist/esm/components/icon/Icon.js +23 -19
  67. package/dist/esm/components/input/Input.js +28 -28
  68. package/dist/esm/components/label/Label.js +19 -19
  69. package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
  70. package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
  71. package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
  72. package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
  73. package/dist/esm/components/multi-select/MultiSelect.js +94 -94
  74. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
  75. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
  76. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
  77. package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
  78. package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
  79. package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
  80. package/dist/esm/components/nav/parts/NavGroup.js +63 -52
  81. package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
  82. package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
  83. package/dist/esm/components/number-field/NumberField.d.ts +3 -3
  84. package/dist/esm/components/number-input/NumberInput.js +58 -58
  85. package/dist/esm/components/page/Page.js +1 -1
  86. package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
  87. package/dist/esm/components/page/parts/PageHeader.js +22 -20
  88. package/dist/esm/components/pagination/Pagination.d.ts +23 -44
  89. package/dist/esm/components/pagination/Pagination.js +89 -167
  90. package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
  91. package/dist/esm/components/pagination/PaginationContext.js +15 -0
  92. package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
  93. package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
  94. package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
  95. package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
  96. package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
  97. package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
  98. package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
  99. package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
  100. package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
  101. package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
  102. package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
  103. package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
  104. package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
  105. package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
  106. package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
  107. package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
  108. package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
  109. package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
  110. package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
  111. package/dist/esm/components/select/Select.js +63 -45
  112. package/dist/esm/components/select/parts/SelectOption.js +9 -9
  113. package/dist/esm/components/select-field/SelectField.d.ts +2 -2
  114. package/dist/esm/components/select-field/SelectField.js +4 -1
  115. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
  116. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
  117. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
  118. package/dist/esm/components/skip-links/SkipLinks.js +1 -1
  119. package/dist/esm/components/table/Table.d.ts +1 -0
  120. package/dist/esm/components/table/Table.js +110 -98
  121. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
  122. package/dist/esm/components/table/parts/TableBody.js +6 -6
  123. package/dist/esm/components/table/parts/TableCell.js +34 -31
  124. package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
  125. package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
  126. package/dist/esm/components/table/parts/TablePagination.js +61 -59
  127. package/dist/esm/components/table/parts/TableRow.js +21 -18
  128. package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
  129. package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
  130. package/dist/esm/components/tabs/parts/TabList.js +50 -54
  131. package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
  132. package/dist/esm/components/task-menu/parts/Content.js +24 -24
  133. package/dist/esm/components/task-menu/parts/Header.js +24 -24
  134. package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
  135. package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +74 -74
  136. package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
  137. package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +69 -69
  138. package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
  139. package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
  140. package/dist/esm/components/text/Text.js +30 -27
  141. package/dist/esm/components/text-area/TextArea.js +30 -31
  142. package/dist/esm/components/text-field/TextField.d.ts +2 -2
  143. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
  144. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
  145. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
  146. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
  147. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
  148. package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
  149. package/dist/esm/hooks/use-container-query-level.js +33 -0
  150. package/dist/esm/hooks/use-form.d.ts +5 -5
  151. package/dist/esm/hooks/use-form.types.d.ts +2 -2
  152. package/dist/esm/hooks/use-resizable.js +13 -14
  153. package/dist/esm/index.d.ts +21 -10
  154. package/dist/esm/index.js +424 -396
  155. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
  156. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
  157. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
  158. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
  159. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
  160. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
  161. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
  162. package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
  163. package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
  164. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
  165. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
  166. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
  167. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
  168. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
  169. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
  170. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
  171. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
  172. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
  173. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
  174. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
  175. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
  176. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
  177. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
  178. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
  179. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
  180. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
  181. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
  182. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
  183. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
  184. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
  185. package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
  186. package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
  187. package/dist/esm/integrations/tanstack-router.js +34 -0
  188. package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
  189. package/dist/esm/providers/router/RouterProvider.js +14 -10
  190. package/dist/esm/types/DataAttributes.d.ts +1 -1
  191. package/dist/esm/types/schema.d.ts +8 -0
  192. package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
  193. package/dist/esm/utils/createSchemaAdapter.js +13 -0
  194. package/dist/esm/utils/platform.js +2 -3
  195. package/i18n/en-GB.json +16 -0
  196. package/i18n/es-ES.json +16 -0
  197. package/i18n/fr-FR.json +16 -0
  198. package/package.json +56 -31
  199. package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
  200. package/dist/esm/components/link/Link.d.ts +0 -93
  201. package/dist/esm/components/link/Link.js +0 -68
  202. package/dist/esm/components/nav/parts/NavItem.js +0 -95
  203. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
  204. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
  205. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
  206. /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 o } from "react/jsx-runtime";
2
- import T, { forwardRef as j, useCallback as z, isValidElement as D } from "react";
3
- import { uyTv as R } from "@payfit/unity-themes";
4
- import { Toolbar as S, Group as d } from "react-aria-components";
5
- import { useIntl as _, FormattedMessage as l } from "react-intl";
6
- import { Button as E } from "../button/Button.js";
7
- import { IconButton as F } from "../icon-button/IconButton.js";
8
- import { Icon as G } from "../icon/Icon.js";
9
- import { Menu as K } from "../menu/Menu.js";
10
- import { MenuContent as L } from "../menu/parts/MenuContent.js";
11
- import { MenuItem as O } from "../menu/parts/MenuItem.js";
12
- import { MenuTrigger as U } from "../menu/parts/MenuTrigger.js";
13
- import { ActionBarAction as V } from "./parts/ActionBarAction.js";
14
- const q = R({
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
- }), H = j(
33
+ }), q = T(
34
34
  ({
35
- id: f,
35
+ id: d,
36
36
  selectionCount: u,
37
- onClearSelection: p,
37
+ onClearSelection: f,
38
38
  children: r,
39
39
  actions: a,
40
40
  renderSelectionText: c,
41
- "aria-label": b,
42
- onFocus: h,
43
- onBlur: v,
41
+ "aria-label": p,
42
+ onFocus: b,
43
+ onBlur: h,
44
44
  ...i
45
- }, g) => {
46
- var y;
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
- }), C = z(() => {
49
+ }), I = R(() => {
51
50
  if (s) {
52
51
  const e = r;
53
- return a.map((t, P) => e(t, P));
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, N = s ? a.filter((e) => e.variant !== "primary") : (y = T.Children.map(r, (e) => {
57
- if (!D(e) || e.type !== V)
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 t = e.props;
60
- return t.variant === "primary" ? null : {
61
- ...t,
62
- id: e.key ?? t.id,
63
- onPress: t.onPress,
64
- label: t.children,
65
- variant: t.variant,
66
- prefixIcon: t.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
- })) == null ? void 0 : y.filter(Boolean);
67
+ })?.filter(Boolean);
69
68
  return /* @__PURE__ */ n(
70
- S,
69
+ D,
71
70
  {
72
71
  ...i,
73
- id: f,
74
- ref: g,
75
- className: x(),
76
- "aria-label": I,
72
+ id: d,
73
+ ref: v,
74
+ className: g(),
75
+ "aria-label": B,
77
76
  orientation: "horizontal",
78
77
  tabIndex: -1,
79
- onFocus: h,
80
- onBlur: v,
78
+ onFocus: b,
79
+ onBlur: h,
81
80
  children: [
82
81
  /* @__PURE__ */ n(
83
- d,
82
+ y,
84
83
  {
85
- className: A(),
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: M(),
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__ */ o(
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
- B && /* @__PURE__ */ o("span", { className: "uy:sr-only", children: /* @__PURE__ */ o(
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__ */ o(E, { color: "inverted", variant: "ghost", onPress: p, children: /* @__PURE__ */ o(
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
- d,
130
+ y,
132
131
  {
133
- className: k(),
132
+ className: M(),
134
133
  role: "group",
135
134
  "aria-label": "Available actions",
136
135
  children: [
137
- C(),
138
- /* @__PURE__ */ o("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ n(K, { children: [
139
- /* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
140
- F,
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__ */ o(L, { children: N.map((e) => /* @__PURE__ */ o(
147
+ /* @__PURE__ */ t(K, { children: C.map((e) => /* @__PURE__ */ t(
149
148
  O,
150
149
  {
151
150
  onAction: () => {
152
- var t;
153
- (t = e.onPress) == null || t.call(e, {});
151
+ e.onPress?.({});
154
152
  },
155
- prefix: e.prefixIcon ? /* @__PURE__ */ o(G, { src: e.prefixIcon, size: 20 }) : void 0,
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
- H.displayName = "ActionBar";
167
+ q.displayName = "ActionBar";
170
168
  export {
171
- H as ActionBar,
172
- q as actionBar
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
- * The Actionable primitive is a component that helps you build interactive surfaces of any kind.
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 D } from "react/jsx-runtime";
2
- import { forwardRef as H, useState as k } from "react";
3
- import { uyTv as F } from "@payfit/unity-themes";
4
- import { useFocusVisible as E, useHover as x, useFocus as N } from "@react-aria/interactions";
5
- import { useObjectRef as S, mergeProps as c } from "@react-aria/utils";
6
- import { useButton as U } from "react-aria";
7
- const V = F({
8
- base: "uy:group uy:cursor-pointer",
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: "uy:aria-disabled:cursor-not-allowed uy:aria-disabled:text-content-neutral-disabled"
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
- }), j = H((d, s) => {
22
+ }), A = k((v, e) => {
19
23
  const {
20
- asElement: i = "div",
21
- isUnstyled: u = !1,
22
- className: p,
24
+ asElement: l = "div",
25
+ isUnstyled: d = !1,
26
+ className: c,
23
27
  children: o,
24
- ...e
25
- } = d;
26
- s = S(s);
27
- const { isFocusVisible: m } = E(), { isHovered: f, hoverProps: n } = x({
28
- onHoverStart: e.onHoverStart,
29
- onHoverEnd: e.onHoverEnd,
30
- onHoverChange: e.onHoverChange,
31
- isDisabled: e.isDisabled
32
- }), [b, v] = k(!1), { focusProps: r } = N({
33
- onFocusChange: v,
34
- isDisabled: e.isDisabled
35
- }), { buttonProps: a, isPressed: y } = U(
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
- ...e,
38
- elementType: i
41
+ ...s,
42
+ isDisabled: s.isDisabled,
43
+ elementType: l
39
44
  },
40
- s
41
- ), g = i, P = (t) => {
42
- if (e.isDisabled) {
43
- t.preventDefault(), t.stopPropagation();
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 l = c(a, n, r);
47
- l.onClick && l.onClick(t);
48
- }, C = c(a, n, r), { onClick: w, ...h } = C;
49
- return /* @__PURE__ */ D(
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: P,
54
- className: V({ isUnstyled: u, className: p }),
55
- ref: s,
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: f,
58
- isPressed: y,
59
- isFocused: b,
60
- isDisabled: !!e.isDisabled,
61
- isFocusVisible: m,
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
- j.displayName = "Actionable";
81
+ A.displayName = "Actionable";
69
82
  export {
70
- j as Actionable
83
+ A as Actionable
71
84
  };
@@ -37,36 +37,36 @@ const w = x({
37
37
  }
38
38
  });
39
39
  function R({
40
- children: y,
41
- menu: l,
42
- header: a,
40
+ children: l,
41
+ menu: a,
42
+ header: r,
43
43
  footer: u,
44
- withoutContentPadding: n = !1
44
+ withoutContentPadding: p = !1
45
45
  }) {
46
- const r = v(null), { height: o = 0 } = g({
47
- ref: r,
46
+ const o = v(null), { height: y = 0 } = g({
47
+ ref: o,
48
48
  box: "border-box"
49
- }), { body: p, header: s, menu: d, layoutWrapper: i, contentWrapper: c, content: f, footer: h } = w({
50
- withoutContentPadding: n
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 - ${o}px)`,
53
- "--uy-app-layout-header-sticky-offset": `${o}px`
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: p(), style: m, children: [
56
- a && /* @__PURE__ */ e(
55
+ return /* @__PURE__ */ t("div", { className: s(), style: m, children: [
56
+ r && /* @__PURE__ */ e(
57
57
  "div",
58
58
  {
59
- ref: r,
60
- className: s(),
59
+ ref: o,
60
+ className: n(),
61
61
  role: "alert",
62
62
  "aria-live": "assertive",
63
- children: a
63
+ children: r
64
64
  }
65
65
  ),
66
66
  /* @__PURE__ */ t("div", { className: i(), children: [
67
- /* @__PURE__ */ e("div", { className: d(), children: l }),
67
+ a && /* @__PURE__ */ e("div", { className: d(), children: a }),
68
68
  /* @__PURE__ */ t("div", { className: c(), children: [
69
- /* @__PURE__ */ e("div", { className: f(), children: y }),
69
+ /* @__PURE__ */ e("div", { className: f(), children: l }),
70
70
  u && /* @__PURE__ */ e("footer", { className: h(), children: u })
71
71
  ] })
72
72
  ] })