@payfit/unity-components 0.0.0-alpha.12 → 0.0.0-alpha.13

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 (121) hide show
  1. package/dist/cjs/components/button/Button.d.cts +5 -2
  2. package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
  3. package/dist/cjs/components/data-table/DataTable.cjs +1 -1
  4. package/dist/cjs/components/data-table/DataTable.d.cts +3 -6
  5. package/dist/cjs/components/date-calendar/DateCalendar.cjs +1 -0
  6. package/dist/cjs/components/date-calendar/DateCalendar.d.cts +23 -0
  7. package/dist/cjs/components/date-calendar/hooks/useMonthsList.d.cts +4 -0
  8. package/dist/cjs/components/date-calendar/hooks/useYearsList.d.cts +10 -0
  9. package/dist/cjs/components/date-picker/DatePicker.cjs +1 -1
  10. package/dist/cjs/components/date-picker/DatePicker.d.cts +3 -3
  11. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.cjs +1 -0
  12. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.d.cts +23 -0
  13. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.cjs +1 -1
  14. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.d.cts +2 -2
  15. package/dist/cjs/components/icon-button/CircularIconButton.cjs +1 -1
  16. package/dist/cjs/components/icon-button/CircularIconButton.d.cts +0 -21
  17. package/dist/cjs/components/icon-button/IconButton.d.cts +1 -1
  18. package/dist/cjs/components/number-field/NumberField.cjs +1 -0
  19. package/dist/cjs/components/number-field/NumberField.d.cts +47 -0
  20. package/dist/cjs/components/number-input/NumberInput.cjs +1 -0
  21. package/dist/cjs/components/number-input/NumberInput.d.cts +216 -0
  22. package/dist/cjs/components/pagination/Pagination.cjs +1 -1
  23. package/dist/cjs/components/pagination/hooks/use-pagination.cjs +1 -1
  24. package/dist/cjs/components/pagination/hooks/use-pagination.d.cts +2 -1
  25. package/dist/cjs/components/popover/Popover.cjs +1 -1
  26. package/dist/cjs/components/popover/parts/PopoverHeader.cjs +1 -1
  27. package/dist/cjs/components/radio-button-group/parts/RadioButton.cjs +1 -1
  28. package/dist/cjs/components/select-field/test-utils.cjs +1 -0
  29. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.cjs +1 -1
  30. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.context.d.cts +5 -1
  31. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.d.cts +7 -1
  32. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.cjs +1 -1
  33. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.d.cts +35 -0
  34. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.cjs +1 -0
  35. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.d.cts +59 -0
  36. package/dist/cjs/components/side-panel/SidePanel.cjs +1 -1
  37. package/dist/cjs/components/side-panel/SidePanel.d.cts +6 -0
  38. package/dist/cjs/components/table/Table.cjs +1 -1
  39. package/dist/cjs/components/table/Table.d.cts +4 -0
  40. package/dist/cjs/components/table/parts/TableCell.cjs +1 -1
  41. package/dist/cjs/components/tabs/parts/NavigationButton.cjs +1 -1
  42. package/dist/cjs/components/tabs/parts/TabList.cjs +1 -1
  43. package/dist/cjs/components/text/Text.cjs +1 -1
  44. package/dist/cjs/components/text/Text.d.cts +1 -1
  45. package/dist/cjs/components/text/Text.variants.cjs +1 -1
  46. package/dist/cjs/components/text/Text.variants.d.cts +7 -0
  47. package/dist/cjs/components/tooltip/Tooltip.cjs +1 -1
  48. package/dist/cjs/components/tooltip/Tooltip.d.cts +4 -3
  49. package/dist/cjs/index.cjs +1 -1
  50. package/dist/cjs/index.d.cts +5 -0
  51. package/dist/cjs/index.storybook-testing.d.cts +1 -0
  52. package/dist/cjs/storybook-testing.cjs +1 -1
  53. package/dist/esm/components/button/Button.d.ts +5 -2
  54. package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
  55. package/dist/esm/components/data-table/DataTable.d.ts +3 -6
  56. package/dist/esm/components/data-table/DataTable.js +61 -56
  57. package/dist/esm/components/date-calendar/DateCalendar.d.ts +23 -0
  58. package/dist/esm/components/{date-picker/parts → date-calendar}/DateCalendar.js +62 -60
  59. package/dist/esm/components/date-calendar/hooks/useMonthsList.d.ts +4 -0
  60. package/dist/esm/components/date-calendar/hooks/useYearsList.d.ts +10 -0
  61. package/dist/esm/components/date-picker/DatePicker.d.ts +3 -3
  62. package/dist/esm/components/date-picker/DatePicker.js +22 -22
  63. package/dist/esm/components/definition-tooltip/DefinitionTooltip.d.ts +23 -0
  64. package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +29 -0
  65. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +2 -2
  66. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +31 -27
  67. package/dist/esm/components/icon-button/CircularIconButton.d.ts +0 -21
  68. package/dist/esm/components/icon-button/CircularIconButton.js +23 -26
  69. package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
  70. package/dist/esm/components/number-field/NumberField.d.ts +47 -0
  71. package/dist/esm/components/number-field/NumberField.js +71 -0
  72. package/dist/esm/components/number-input/NumberInput.d.ts +216 -0
  73. package/dist/esm/components/number-input/NumberInput.js +214 -0
  74. package/dist/esm/components/pagination/Pagination.js +17 -16
  75. package/dist/esm/components/pagination/hooks/use-pagination.d.ts +2 -1
  76. package/dist/esm/components/pagination/hooks/use-pagination.js +12 -11
  77. package/dist/esm/components/popover/Popover.js +25 -21
  78. package/dist/esm/components/popover/parts/PopoverHeader.js +17 -15
  79. package/dist/esm/components/radio-button-group/parts/RadioButton.js +1 -1
  80. package/dist/esm/components/select-field/test-utils.js +25 -0
  81. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +5 -1
  82. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +7 -1
  83. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -16
  84. package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +35 -0
  85. package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +44 -36
  86. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +59 -0
  87. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.js +45 -0
  88. package/dist/esm/components/side-panel/SidePanel.d.ts +6 -0
  89. package/dist/esm/components/side-panel/SidePanel.js +38 -35
  90. package/dist/esm/components/table/Table.d.ts +4 -0
  91. package/dist/esm/components/table/Table.js +96 -71
  92. package/dist/esm/components/table/parts/TableCell.js +5 -5
  93. package/dist/esm/components/tabs/parts/NavigationButton.js +4 -4
  94. package/dist/esm/components/tabs/parts/TabList.js +44 -35
  95. package/dist/esm/components/text/Text.d.ts +1 -1
  96. package/dist/esm/components/text/Text.js +6 -5
  97. package/dist/esm/components/text/Text.variants.d.ts +7 -0
  98. package/dist/esm/components/text/Text.variants.js +2 -1
  99. package/dist/esm/components/tooltip/Tooltip.d.ts +4 -3
  100. package/dist/esm/components/tooltip/Tooltip.js +13 -12
  101. package/dist/esm/index.d.ts +5 -0
  102. package/dist/esm/index.js +237 -225
  103. package/dist/esm/index.storybook-testing.d.ts +1 -0
  104. package/dist/esm/storybook-testing.js +3 -1
  105. package/i18n/en-GB.json +2 -0
  106. package/i18n/es-ES.json +2 -0
  107. package/i18n/fr-FR.json +2 -0
  108. package/package.json +7 -6
  109. package/dist/cjs/components/date-picker/parts/DateCalendar.cjs +0 -1
  110. package/dist/cjs/components/date-picker/parts/DateCalendar.d.cts +0 -9
  111. package/dist/cjs/components/popover/parts/PopoverContent.cjs +0 -1
  112. package/dist/esm/components/date-picker/parts/DateCalendar.d.ts +0 -9
  113. package/dist/esm/components/popover/parts/PopoverContent.js +0 -9
  114. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useMonthsList.cjs +0 -0
  115. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useYearsList.cjs +0 -0
  116. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.cjs +0 -0
  117. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.cts +0 -0
  118. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useMonthsList.js +0 -0
  119. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useYearsList.js +0 -0
  120. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.ts +0 -0
  121. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.js +0 -0
@@ -60,6 +60,7 @@ export * from './components/grid/Grid.variants.cjs';
60
60
  export * from './components/grid/GridItem.cjs';
61
61
  export * from './components/icon/Icon.cjs';
62
62
  export * from './components/icon-button/IconButton.cjs';
63
+ export * from './components/definition-tooltip/DefinitionTooltip.cjs';
63
64
  export * from './components/input/Input.cjs';
64
65
  export * from './components/label/Label.cjs';
65
66
  export * from './components/link/Link.cjs';
@@ -83,6 +84,8 @@ export * from './components/pagination/Pagination.cjs';
83
84
  export * from './components/payfit-brand/PayFitBrand.cjs';
84
85
  export * from './components/payfit-brand/PayFitPreprod.cjs';
85
86
  export * from './components/pill/Pill.cjs';
87
+ export * from './components/number-field/NumberField.cjs';
88
+ export * from './components/number-input/NumberInput.cjs';
86
89
  export * from './components/popover/Popover.cjs';
87
90
  export * from './components/progress-bar/ProgressBar.cjs';
88
91
  export * from './components/radio-button-group/RadioButtonGroup.cjs';
@@ -140,3 +143,5 @@ export * from './components/toggle-switch/ToggleSwitch.cjs';
140
143
  export * from './components/toggle-switch-group/ToggleSwitchGroup.cjs';
141
144
  export * from './components/toggle-switch-field/ToggleSwitchField.cjs';
142
145
  export * from './components/toggle-switch-group-field/ToggleSwitchGroupField.cjs';
146
+ export * from './components/selectable-button-group-field/SelectableButtonGroupField.cjs';
147
+ export * from './components/date-calendar/DateCalendar.cjs';
@@ -1 +1,2 @@
1
1
  export { getTestingUtilsDatePicker } from './components/date-picker-field/test-utils.cjs';
2
+ export { getTestingUtilsSelect } from './components/select-field/test-utils.cjs';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./components/date-picker-field/test-utils.cjs");exports.getTestingUtilsDatePicker=e.getTestingUtilsDatePicker;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components/date-picker-field/test-utils.cjs"),e=require("./components/select-field/test-utils.cjs");exports.getTestingUtilsDatePicker=t.getTestingUtilsDatePicker;exports.getTestingUtilsSelect=e.getTestingUtilsSelect;
@@ -28,15 +28,18 @@ type UnityButtonProps = AriaButtonProps & ButtonBase & {
28
28
  */
29
29
  isLoading?: boolean;
30
30
  };
31
- export type ButtonProps = (UnityButtonProps & {
31
+ type UnionButtonProps = (UnityButtonProps & {
32
32
  variant: 'primary';
33
33
  } & ButtonFilled) | (UnityButtonProps & {
34
34
  variant: 'secondary';
35
35
  } & ButtonOutlined) | (UnityButtonProps & {
36
36
  variant: 'ghost';
37
37
  } & ButtonGhost);
38
+ export type ButtonProps = PropsWithChildren<Omit<UnionButtonProps, 'style'>>;
38
39
  /**
39
40
  * Buttons allow users to take actions, and make choices, with a single tap.
40
41
  */
41
- declare const Button: import('react').ForwardRefExoticComponent<PropsWithChildren<ButtonProps> & import('react').RefAttributes<HTMLButtonElement>>;
42
+ declare const Button: import('react').ForwardRefExoticComponent<Omit<UnionButtonProps, "style"> & {
43
+ children?: import('react').ReactNode | undefined;
44
+ } & import('react').RefAttributes<HTMLButtonElement>>;
42
45
  export { Button };
@@ -1,10 +1,10 @@
1
1
  import { tv as e } from "tailwind-variants";
2
- const s = e({
2
+ const l = e({
3
3
  slots: {
4
4
  base: "uy-group uy-inline-flex uy-flex-col uy-gap-50 uy-py-[1px]",
5
- wrapper: "uy-inline-flex uy-items-start uy-gap-[2px] uy-typography-body uy-text-content-form-enabled data-[focus-visible]:uy-outline data-[focus-visible]:uy-outline-[2px] data-[focus-visible]:uy-outline-utility-focus-ring data-[focus-visible]:uy-outline-offset-2 uy-rounded-25",
5
+ wrapper: "uy-inline-flex uy-items-start uy-gap-[2px] uy-typography-body uy-text-content-form-enabled data-[focus-visible]:uy-outline data-[focus-visible]:uy-outline-[2px] data-[focus-visible]:uy-outline-utility-focus-ring data-[focus-visible]:uy-outline-offset-2 uy-rounded-25 uy-leading-[1lh]",
6
6
  asterisk: "uy-text-content-danger",
7
- optionalTag: "uy-typography-body",
7
+ optionalTag: "uy-typography-body uy-leading-[1lh]",
8
8
  descriptionsContainer: "uy-ml-300 uy-leading-0 uy-inline-flex uy-flex-col uy-gap-50",
9
9
  helperText: "uy-typography-body-small uy-text-content-neutral-low",
10
10
  feedbackText: "uy-typography-body-small-strong uy-text-content-form-invalid"
@@ -61,5 +61,5 @@ const s = e({
61
61
  ]
62
62
  });
63
63
  export {
64
- s as checkbox
64
+ l as checkbox
65
65
  };
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { Row, Table as TableType } from '@tanstack/react-table';
3
3
  import { TablePaginationProps } from '../table/parts/TablePagination.js';
4
+ import { TableProps, TableRootProps } from '../table/Table.js';
4
5
  export interface DataTablePaginationLabels {
5
6
  /** Label for the "rows per page" and pagination label dropdown */
6
7
  itemLabel?: string;
@@ -11,13 +12,9 @@ export interface DataTablePaginationOptions {
11
12
  /** Custom labels for pagination */
12
13
  labels?: DataTablePaginationLabels;
13
14
  }
14
- export interface DataTableProps<TData> {
15
+ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>, Omit<TableProps, 'children'> {
15
16
  /** The table instance from @tanstack/react-table */
16
17
  table: TableType<TData>;
17
- /** The minimum number of rows to display, affecting the minimum height */
18
- minRows?: number;
19
- /** The maximum number of rows to display, affecting the maximum height */
20
- maxRows?: number;
21
18
  /** Optional loading state */
22
19
  isLoading?: boolean;
23
20
  /** Optional error state */
@@ -87,7 +84,7 @@ export interface DataTableProps<TData> {
87
84
  * @remarks
88
85
  * [API](https://unity-components.payfit.io/?path=/docs/data-datatable--docs) • [Demo](https://unity-components.payfit.io/?path=/docs/data-datatable--docs)
89
86
  */
90
- declare function DataTable<TData extends object>({ table, isLoading, error, emptyState, loadingState, errorState, pagination, minRows, maxRows, children, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
87
+ declare function DataTable<TData extends object>({ table, isLoading, error, emptyState, loadingState, errorState, pagination, minRows, maxRows, children, ...rest }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
91
88
  declare namespace DataTable {
92
89
  var displayName: string;
93
90
  }
@@ -1,77 +1,82 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { useRef as w, useEffect as x } from "react";
1
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as x, useEffect as E } from "react";
3
3
  import { flexRender as g } from "@tanstack/react-table";
4
- import { TableBody as b } from "../table/parts/TableBody.js";
4
+ import { TableBody as z } from "../table/parts/TableBody.js";
5
5
  import { TableColumnHeader as R } from "../table/parts/TableColumnHeader.js";
6
- import { TableEmptyStateLoading as D, TableEmptyStateError as E, TableEmptyStateNoData as y } from "../table/parts/TableEmptyState.js";
7
- import { TableHeader as z } from "../table/parts/TableHeader.js";
8
- import { TablePagination as H } from "../table/parts/TablePagination.js";
9
- import { TableRoot as M, Table as j } from "../table/Table.js";
10
- import { ColumnSortHeader as I } from "./parts/ColumnSortHeader.js";
11
- function N({
12
- table: r,
13
- isLoading: m,
14
- error: l,
15
- emptyState: a,
16
- loadingState: i,
6
+ import { TableEmptyStateLoading as D, TableEmptyStateError as H, TableEmptyStateNoData as y } from "../table/parts/TableEmptyState.js";
7
+ import { TableHeader as M } from "../table/parts/TableHeader.js";
8
+ import { TablePagination as j } from "../table/parts/TablePagination.js";
9
+ import { TableRoot as I, Table as N } from "../table/Table.js";
10
+ import { ColumnSortHeader as O } from "./parts/ColumnSortHeader.js";
11
+ function v({
12
+ table: o,
13
+ isLoading: n,
14
+ error: a,
15
+ emptyState: i,
16
+ loadingState: S,
17
17
  errorState: T,
18
- pagination: n,
19
- minRows: S,
20
- maxRows: C,
21
- children: P
18
+ pagination: l,
19
+ minRows: b,
20
+ maxRows: P,
21
+ children: C,
22
+ ...m
22
23
  }) {
23
24
  var p;
24
- const u = w(null), { pageIndex: f, pageSize: c } = r.getState().pagination;
25
- x(() => {
26
- var t;
27
- (t = u.current) == null || t.scrollToTop();
28
- }, [f, c]);
29
- const s = () => {
30
- if (m)
31
- return i ?? /* @__PURE__ */ e(D, {});
32
- if (l)
33
- return T ?? /* @__PURE__ */ e(E, {});
34
- }, h = () => m || l ? s() : r.getRowModel().rows.length === 0 ? a ?? /* @__PURE__ */ e(y, {}) : a;
35
- return /* @__PURE__ */ d(M, { minRows: S, maxRows: C, children: [
36
- /* @__PURE__ */ d(j, { ref: u, children: [
37
- /* @__PURE__ */ e(z, { children: r.getHeaderGroups().map(
38
- (t) => t.headers.map((o) => /* @__PURE__ */ e(R, { children: o.column.getCanSort() ? /* @__PURE__ */ e(I, { header: o, children: /* @__PURE__ */ e("span", { children: g(
39
- o.column.columnDef.header,
40
- o.getContext()
25
+ const c = x(null), { pageIndex: s, pageSize: u } = o.getState().pagination;
26
+ E(() => {
27
+ var r;
28
+ (r = c.current) == null || r.scrollToTop();
29
+ }, [s, u]);
30
+ const h = {
31
+ label: m.label,
32
+ description: m.description,
33
+ isHorizontalScrollEnabled: m.isHorizontalScrollEnabled
34
+ }, d = () => {
35
+ if (n)
36
+ return S ?? /* @__PURE__ */ e(D, {});
37
+ if (a)
38
+ return T ?? /* @__PURE__ */ e(H, {});
39
+ }, w = () => n || a ? d() : o.getRowModel().rows.length === 0 ? i ?? /* @__PURE__ */ e(y, {}) : i;
40
+ return /* @__PURE__ */ f(I, { minRows: b, maxRows: P, children: [
41
+ /* @__PURE__ */ f(N, { ref: c, ...h, children: [
42
+ /* @__PURE__ */ e(M, { children: o.getHeaderGroups().map(
43
+ (r) => r.headers.map((t) => /* @__PURE__ */ e(R, { children: t.column.getCanSort() ? /* @__PURE__ */ e(O, { header: t, children: /* @__PURE__ */ e("span", { children: g(
44
+ t.column.columnDef.header,
45
+ t.getContext()
41
46
  ) }) }) : /* @__PURE__ */ e("span", { children: g(
42
- o.column.columnDef.header,
43
- o.getContext()
44
- ) }) }, o.id))
47
+ t.column.columnDef.header,
48
+ t.getContext()
49
+ ) }) }, t.id))
45
50
  ) }),
46
51
  /* @__PURE__ */ e(
47
- b,
52
+ z,
48
53
  {
49
- renderEmptyState: h,
50
- renderDataState: s,
51
- children: !m && !l && r.getRowModel().rows.map(P)
54
+ renderEmptyState: w,
55
+ renderDataState: d,
56
+ children: !n && !a && o.getRowModel().rows.map(C)
52
57
  }
53
58
  )
54
59
  ] }),
55
- r.getPageCount() > 1 && /* @__PURE__ */ e(
56
- H,
60
+ o.getPageCount() > 1 && /* @__PURE__ */ e(
61
+ j,
57
62
  {
58
- pageCount: r.getPageCount(),
59
- rowCount: r.getPaginationRowModel().rows.length,
60
- currentPage: f + 1,
61
- rowsPerPage: c,
62
- pageSizeOptions: n == null ? void 0 : n.pageSizeOptions,
63
- onPageChange: (t) => {
64
- r.setPageIndex(t - 1);
63
+ pageCount: o.getPageCount(),
64
+ rowCount: o.getPaginationRowModel().rows.length,
65
+ currentPage: s + 1,
66
+ rowsPerPage: u,
67
+ pageSizeOptions: l == null ? void 0 : l.pageSizeOptions,
68
+ onPageChange: (r) => {
69
+ o.setPageIndex(r - 1);
65
70
  },
66
- onPageSizeChange: (t) => {
67
- r.setPageSize(t);
71
+ onPageSizeChange: (r) => {
72
+ o.setPageSize(r);
68
73
  },
69
- itemLabel: (p = n == null ? void 0 : n.labels) == null ? void 0 : p.itemLabel
74
+ itemLabel: (p = l == null ? void 0 : l.labels) == null ? void 0 : p.itemLabel
70
75
  }
71
76
  )
72
77
  ] });
73
78
  }
74
- N.displayName = "DataTable";
79
+ v.displayName = "DataTable";
75
80
  export {
76
- N as DataTable
81
+ v as DataTable
77
82
  };
@@ -0,0 +1,23 @@
1
+ import { DateValue } from '@internationalized/date';
2
+ import { CalendarProps as AriaDateCalendarProps } from 'react-aria-components';
3
+ type PropsFromAriaCalendar<TDate extends DateValue> = AriaDateCalendarProps<TDate>;
4
+ export type DateCalendarProps<TDate extends DateValue> = PropsFromAriaCalendar<TDate>;
5
+ /**
6
+ * The `DateCalendar` component displays one or more date grids and allows users to navigate through dates select a single date.
7
+ * @param {DateCalendarProps} props - The props for the `DateCalendar` component
8
+ * @example
9
+ * ```tsx
10
+ * import { DateCalendar } from '@payfit/unity-components'
11
+ * import { CalendarDate } from '@internationalized/date'
12
+ *
13
+ * const [date, setDate] = useState(new CalendatDate(2022, 1, 1))
14
+ * <DateCalendar value={date} onChange={setDate} />
15
+ * ```
16
+ * @see {@link DateCalendarProps} for all available props
17
+ * @remarks [API and Demos](https://unity-components.payfit.io/?path=/docs/date-and-time-datecalendar--docs)
18
+ */
19
+ declare function DateCalendar<TDate extends DateValue>({ value, defaultValue, minValue, maxValue, onChange, onFocusChange, ...props }: DateCalendarProps<TDate>): import("react/jsx-runtime").JSX.Element;
20
+ declare namespace DateCalendar {
21
+ var displayName: string;
22
+ }
23
+ export { DateCalendar };
@@ -1,15 +1,15 @@
1
1
  import { jsx as a, jsxs as r } from "react/jsx-runtime";
2
- import { useState as f } from "react";
3
- import { today as Y, getLocalTimeZone as m, isToday as j } from "@internationalized/date";
4
- import { Dialog as I, Calendar as k, Heading as B, CalendarGrid as F, CalendarGridHeader as M, CalendarHeaderCell as O, CalendarGridBody as T, CalendarCell as W } from "react-aria-components";
5
- import { tv as P } from "tailwind-variants";
6
- import { IconButton as h } from "../../icon-button/IconButton.js";
7
- import { useMonthsList as R } from "../hooks/useMonthsList.js";
8
- import { useYearsList as Z } from "../hooks/useYearsList.js";
9
- import { DateSegmentSelect as b } from "./DateSegmentSelect.js";
10
- const $ = P({
2
+ import { useState as m } from "react";
3
+ import { today as I, getLocalTimeZone as p, isToday as k } from "@internationalized/date";
4
+ import { Calendar as B, Heading as M, CalendarGrid as O, CalendarGridHeader as T, CalendarHeaderCell as W, CalendarGridBody as P, CalendarCell as R } from "react-aria-components";
5
+ import { tv as Z } from "tailwind-variants";
6
+ import { IconButton as h } from "../icon-button/IconButton.js";
7
+ import { useMonthsList as $ } from "./hooks/useMonthsList.js";
8
+ import { useYearsList as q } from "./hooks/useYearsList.js";
9
+ import { DateSegmentSelect as v } from "./parts/DateSegmentSelect.js";
10
+ const z = Z({
11
11
  slots: {
12
- dialog: "uy-p-150",
12
+ base: "",
13
13
  calendarWrapper: "uy-flex uy-flex-col uy-gap-100",
14
14
  dialogHeader: "uy-flex uy-items-center uy-h-500 uy-w-full",
15
15
  dialogHeaderGroup: "uy-flex uy-items-center",
@@ -39,79 +39,81 @@ const $ = P({
39
39
  isDisabled: !1
40
40
  }
41
41
  });
42
- function q({
43
- value: u,
42
+ function A({
43
+ value: c,
44
44
  defaultValue: l,
45
45
  minValue: d,
46
- maxValue: o,
46
+ maxValue: s,
47
+ onChange: o,
48
+ onFocusChange: i,
47
49
  ...t
48
50
  }) {
49
- const y = Y(m()), [p, g] = f(
50
- u ?? l ?? y
51
- ), [s, n] = f(
52
- u ?? l ?? y
53
- ), v = R(), C = Z({
51
+ const f = I(p()), [g, x] = m(
52
+ c ?? l ?? f
53
+ ), [n, u] = m(
54
+ c ?? l ?? f
55
+ ), D = $(), C = q({
54
56
  startYear: d == null ? void 0 : d.year,
55
- endYear: o == null ? void 0 : o.year
56
- }), D = (e) => {
57
- n(
58
- (i) => i.set({ month: parseInt(e, 10) })
57
+ endYear: s == null ? void 0 : s.year
58
+ }), N = (e) => {
59
+ u(
60
+ (y) => y.set({ month: parseInt(e, 10) })
59
61
  );
60
- }, x = (e) => {
61
- n(
62
- (i) => i.set({ year: parseInt(e, 10) })
62
+ }, H = (e) => {
63
+ u(
64
+ (y) => y.set({ year: parseInt(e, 10) })
63
65
  );
64
66
  }, {
65
- dialog: N,
66
- calendarWrapper: w,
67
- dialogHeader: H,
68
- dialogHeaderGroup: c,
69
- calendarGrid: G,
70
- calendarHeaderCell: L,
71
- calendarCell: S
72
- } = $({ isDisabled: t.isDisabled });
73
- return /* @__PURE__ */ a(I, { className: N(), "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
74
- k,
67
+ base: w,
68
+ calendarWrapper: G,
69
+ dialogHeader: L,
70
+ dialogHeaderGroup: b,
71
+ calendarGrid: S,
72
+ calendarHeaderCell: Y,
73
+ calendarCell: j
74
+ } = z({ isDisabled: t.isDisabled });
75
+ return /* @__PURE__ */ a("div", { className: w(), "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
76
+ B,
75
77
  {
76
78
  ...t,
77
79
  minValue: d,
78
- maxValue: o,
79
- value: p,
80
+ maxValue: s,
81
+ value: g,
80
82
  defaultValue: l,
81
83
  onChange: (e) => {
82
- g(e);
84
+ x(e), o == null || o(e);
83
85
  },
84
- focusedValue: s,
86
+ focusedValue: n,
85
87
  onFocusChange: (e) => {
86
- n(e);
88
+ u(e), i == null || i(e);
87
89
  },
88
- children: /* @__PURE__ */ r("div", { className: w(), children: [
89
- /* @__PURE__ */ r("header", { className: H(), children: [
90
- /* @__PURE__ */ a(B, { className: "uy-sr-only" }),
90
+ children: /* @__PURE__ */ r("div", { className: G(), children: [
91
+ /* @__PURE__ */ r("header", { className: L(), children: [
92
+ /* @__PURE__ */ a(M, { className: "uy-sr-only" }),
91
93
  /* @__PURE__ */ r(
92
94
  "div",
93
95
  {
94
- className: c({
96
+ className: b({
95
97
  className: "uy-pl-100 uy-gap-200"
96
98
  }),
97
99
  children: [
98
100
  /* @__PURE__ */ a(
99
- b,
101
+ v,
100
102
  {
101
103
  type: "month",
102
- items: v,
103
- value: s.month.toString(),
104
- onChange: D,
104
+ items: D,
105
+ value: n.month.toString(),
106
+ onChange: N,
105
107
  isDisabled: t.isDisabled
106
108
  }
107
109
  ),
108
110
  /* @__PURE__ */ a(
109
- b,
111
+ v,
110
112
  {
111
113
  type: "year",
112
114
  items: C,
113
- value: s.year.toString(),
114
- onChange: x,
115
+ value: n.year.toString(),
116
+ onChange: H,
115
117
  isDisabled: t.isDisabled
116
118
  }
117
119
  )
@@ -121,7 +123,7 @@ function q({
121
123
  /* @__PURE__ */ r(
122
124
  "div",
123
125
  {
124
- className: c({
126
+ className: b({
125
127
  className: "uy-ml-auto uy-gap-100"
126
128
  }),
127
129
  children: [
@@ -151,14 +153,14 @@ function q({
151
153
  }
152
154
  )
153
155
  ] }),
154
- /* @__PURE__ */ r(F, { className: G(), weekdayStyle: "short", children: [
155
- /* @__PURE__ */ a(M, { children: (e) => /* @__PURE__ */ a(O, { className: L(), children: e }) }),
156
- /* @__PURE__ */ a(T, { children: (e) => /* @__PURE__ */ a(
157
- W,
156
+ /* @__PURE__ */ r(O, { className: S(), weekdayStyle: "short", children: [
157
+ /* @__PURE__ */ a(T, { children: (e) => /* @__PURE__ */ a(W, { className: Y(), children: e }) }),
158
+ /* @__PURE__ */ a(P, { children: (e) => /* @__PURE__ */ a(
159
+ R,
158
160
  {
159
161
  date: e,
160
- "data-today": j(e, m()) ? !0 : void 0,
161
- className: S()
162
+ "data-today": k(e, p()) ? !0 : void 0,
163
+ className: j()
162
164
  }
163
165
  ) })
164
166
  ] })
@@ -166,7 +168,7 @@ function q({
166
168
  }
167
169
  ) });
168
170
  }
169
- q.displayName = "DateCalendar";
171
+ A.displayName = "DateCalendar";
170
172
  export {
171
- q as DateCalendar
173
+ A as DateCalendar
172
174
  };
@@ -0,0 +1,4 @@
1
+ export declare function useMonthsList(): {
2
+ id: string;
3
+ name: string;
4
+ }[];
@@ -0,0 +1,10 @@
1
+ export interface UseYearsListOptions {
2
+ yearsBefore?: number;
3
+ yearsAfter?: number;
4
+ startYear?: number;
5
+ endYear?: number;
6
+ }
7
+ export declare function useYearsList({ yearsBefore, yearsAfter, startYear, endYear, }?: UseYearsListOptions): {
8
+ id: string;
9
+ name: string;
10
+ }[];
@@ -2,15 +2,15 @@ import { CalendarDate } from '@internationalized/date';
2
2
  import { DatePickerProps as AriaDatePickerProps } from 'react-aria-components';
3
3
  export interface DatePickerProps extends Pick<AriaDatePickerProps<CalendarDate>, 'id' | 'firstDayOfWeek'> {
4
4
  /** The currently selected date */
5
- value?: CalendarDate;
5
+ value?: CalendarDate | null;
6
6
  /** The default selected date (uncontrolled) */
7
- defaultValue?: CalendarDate;
7
+ defaultValue?: CalendarDate | null;
8
8
  /** The minimum allowed date */
9
9
  minValue?: CalendarDate;
10
10
  /** The maximum allowed date */
11
11
  maxValue?: CalendarDate;
12
12
  /** Callback fired when the date value changes */
13
- onChange?: (value: CalendarDate | undefined) => void;
13
+ onChange?: (value: CalendarDate | null) => void;
14
14
  /** Callback fired when the clear button is clicked */
15
15
  onClearButtonPress?: () => void;
16
16
  /** Callback fired when the picker loses focus */
@@ -1,12 +1,12 @@
1
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
2
  import { forwardRef as W } from "react";
3
- import { DatePicker as I, Group as P, Button as U, Popover as j } from "react-aria-components";
4
- import { useIntl as E } from "react-intl";
5
- import { tv as c } from "tailwind-variants";
6
- import { Icon as M } from "../icon/Icon.js";
7
- import { DateCalendar as O } from "./parts/DateCalendar.js";
8
- import { DateInput as R } from "./parts/DateInput.js";
9
- const G = c({
3
+ import { DatePicker as I, Group as P, Button as U, Popover as j, Dialog as E } from "react-aria-components";
4
+ import { useIntl as M } from "react-intl";
5
+ import { tv as m } from "tailwind-variants";
6
+ import { DateCalendar as O } from "../date-calendar/DateCalendar.js";
7
+ import { Icon as R } from "../icon/Icon.js";
8
+ import { DateInput as G } from "./parts/DateInput.js";
9
+ const $ = m({
10
10
  slots: {
11
11
  base: [
12
12
  "uy-group uy-flex uy-h-500 uy-border uy-border-solid uy-rounded-100",
@@ -58,7 +58,7 @@ const G = c({
58
58
  }
59
59
  }
60
60
  ]
61
- }), $ = c({
61
+ }), q = m({
62
62
  base: "uy-overflow-auto uy-shadow-floating uy-border uy-border-solid uy-border-border-neutral uy-bg-surface-neutral uy-rounded-75",
63
63
  variants: {
64
64
  isEntering: {
@@ -68,7 +68,7 @@ const G = c({
68
68
  true: "uy-animate-out uy-fade-out data-[placement-bottom]:uy-slide-out-to-top-1 data-[placement-top]:uy-slide-out-to-bottom-1 uy-duration-150 uy-ease-in"
69
69
  }
70
70
  }
71
- }), q = W(
71
+ }), z = W(
72
72
  ({
73
73
  value: l,
74
74
  defaultValue: n,
@@ -83,19 +83,19 @@ const G = c({
83
83
  onOpenChange: f,
84
84
  id: v,
85
85
  ...e
86
- }, z) => {
87
- const g = E(), { base: x, inputWrapper: h, suffix: D } = G({
86
+ }, A) => {
87
+ const g = M(), { base: x, inputWrapper: h, suffix: D } = $({
88
88
  isInvalid: !!b,
89
89
  isReadOnly: !!u,
90
90
  isDisabled: !!t
91
91
  }), y = (r) => {
92
- s == null || s(r ?? void 0);
92
+ s == null || s(r);
93
93
  }, w = (r) => {
94
94
  f == null || f(r), r ? i == null || i() : o == null || o();
95
95
  }, k = (r) => e.isDateUnavailable ? e.isDateUnavailable(r) : !1, V = () => {
96
96
  d == null || d();
97
97
  };
98
- return /* @__PURE__ */ m(
98
+ return /* @__PURE__ */ c(
99
99
  I,
100
100
  {
101
101
  "data-dd-privacy": "mask",
@@ -113,9 +113,9 @@ const G = c({
113
113
  onOpenChange: w,
114
114
  isDateUnavailable: k,
115
115
  children: [
116
- /* @__PURE__ */ m(P, { className: h(), id: v, children: [
116
+ /* @__PURE__ */ c(P, { className: h(), id: v, children: [
117
117
  /* @__PURE__ */ a(
118
- R,
118
+ G,
119
119
  {
120
120
  isLoading: p,
121
121
  isDisabled: t,
@@ -125,7 +125,7 @@ const G = c({
125
125
  }
126
126
  ),
127
127
  /* @__PURE__ */ a(U, { className: D(), isDisabled: u || t, children: /* @__PURE__ */ a(
128
- M,
128
+ R,
129
129
  {
130
130
  src: "CalendarBlankOutlined",
131
131
  color: "inherit",
@@ -139,8 +139,8 @@ const G = c({
139
139
  /* @__PURE__ */ a(
140
140
  j,
141
141
  {
142
- className: ({ isEntering: r, isExiting: N }) => $({ isEntering: r, isExiting: N }),
143
- children: /* @__PURE__ */ a(
142
+ className: ({ isEntering: r, isExiting: N }) => q({ isEntering: r, isExiting: N }),
143
+ children: /* @__PURE__ */ a(E, { className: "uy-p-150", "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
144
144
  O,
145
145
  {
146
146
  value: l,
@@ -150,7 +150,7 @@ const G = c({
150
150
  onChange: y,
151
151
  firstDayOfWeek: e.firstDayOfWeek
152
152
  }
153
- )
153
+ ) })
154
154
  }
155
155
  )
156
156
  ]
@@ -158,7 +158,7 @@ const G = c({
158
158
  );
159
159
  }
160
160
  );
161
- q.displayName = "DatePicker";
161
+ z.displayName = "DatePicker";
162
162
  export {
163
- q as DatePicker
163
+ z as DatePicker
164
164
  };
@@ -0,0 +1,23 @@
1
+ import { ValidTextElements } from '../text/Text.js';
2
+ import { TooltipProps } from '../tooltip/Tooltip.js';
3
+ export interface DefinitionTooltipProps extends Omit<TooltipProps, 'children'> {
4
+ /** The HTML element to render the definition tooltip as. Defaults to a `<span>`. */
5
+ asElement?: Extract<ValidTextElements, 'abbr' | 'dfn' | 'span'>;
6
+ /** The text to trigger the tooltip. */
7
+ children: string;
8
+ }
9
+ /**
10
+ * Definition tooltips provide brief definitions for words through a tooltip on hover.
11
+ * They may appear within a sentence or as standalone text, and should be used only to define terms or acronyms.
12
+ * @param {DefinitionTooltipProps} props - The props for the `DefinitionTooltip` component.
13
+ * @example
14
+ * ```tsx
15
+ * import { DefinitionTooltip } from '@payfit/unity-components'
16
+ *
17
+ * <DefinitionTooltip title="I am the description of the definition tooltip">I am an definition tooltip</DefinitionTooltip>
18
+ * ```
19
+ * @see {@link DefinitionTooltipProps} for all available props
20
+ * @remarks {@link https://www.payfit.design/24f360409/p/05d163-info-link|Design docs}
21
+ */
22
+ declare const DefinitionTooltip: import('react').ForwardRefExoticComponent<DefinitionTooltipProps & import('react').RefAttributes<HTMLDivElement>>;
23
+ export { DefinitionTooltip };