@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.
- package/dist/cjs/components/button/Button.d.cts +5 -2
- package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
- package/dist/cjs/components/data-table/DataTable.cjs +1 -1
- package/dist/cjs/components/data-table/DataTable.d.cts +3 -6
- package/dist/cjs/components/date-calendar/DateCalendar.cjs +1 -0
- package/dist/cjs/components/date-calendar/DateCalendar.d.cts +23 -0
- package/dist/cjs/components/date-calendar/hooks/useMonthsList.d.cts +4 -0
- package/dist/cjs/components/date-calendar/hooks/useYearsList.d.cts +10 -0
- package/dist/cjs/components/date-picker/DatePicker.cjs +1 -1
- package/dist/cjs/components/date-picker/DatePicker.d.cts +3 -3
- package/dist/cjs/components/definition-tooltip/DefinitionTooltip.cjs +1 -0
- package/dist/cjs/components/definition-tooltip/DefinitionTooltip.d.cts +23 -0
- package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.cjs +1 -1
- package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.d.cts +2 -2
- package/dist/cjs/components/icon-button/CircularIconButton.cjs +1 -1
- package/dist/cjs/components/icon-button/CircularIconButton.d.cts +0 -21
- package/dist/cjs/components/icon-button/IconButton.d.cts +1 -1
- package/dist/cjs/components/number-field/NumberField.cjs +1 -0
- package/dist/cjs/components/number-field/NumberField.d.cts +47 -0
- package/dist/cjs/components/number-input/NumberInput.cjs +1 -0
- package/dist/cjs/components/number-input/NumberInput.d.cts +216 -0
- package/dist/cjs/components/pagination/Pagination.cjs +1 -1
- package/dist/cjs/components/pagination/hooks/use-pagination.cjs +1 -1
- package/dist/cjs/components/pagination/hooks/use-pagination.d.cts +2 -1
- package/dist/cjs/components/popover/Popover.cjs +1 -1
- package/dist/cjs/components/popover/parts/PopoverHeader.cjs +1 -1
- package/dist/cjs/components/radio-button-group/parts/RadioButton.cjs +1 -1
- package/dist/cjs/components/select-field/test-utils.cjs +1 -0
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.cjs +1 -1
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.context.d.cts +5 -1
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.d.cts +7 -1
- package/dist/cjs/components/selectable-button-group/parts/SelectableButton.cjs +1 -1
- package/dist/cjs/components/selectable-button-group/parts/SelectableButton.d.cts +35 -0
- package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.cjs +1 -0
- package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.d.cts +59 -0
- package/dist/cjs/components/side-panel/SidePanel.cjs +1 -1
- package/dist/cjs/components/side-panel/SidePanel.d.cts +6 -0
- package/dist/cjs/components/table/Table.cjs +1 -1
- package/dist/cjs/components/table/Table.d.cts +4 -0
- package/dist/cjs/components/table/parts/TableCell.cjs +1 -1
- package/dist/cjs/components/tabs/parts/NavigationButton.cjs +1 -1
- package/dist/cjs/components/tabs/parts/TabList.cjs +1 -1
- package/dist/cjs/components/text/Text.cjs +1 -1
- package/dist/cjs/components/text/Text.d.cts +1 -1
- package/dist/cjs/components/text/Text.variants.cjs +1 -1
- package/dist/cjs/components/text/Text.variants.d.cts +7 -0
- package/dist/cjs/components/tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/components/tooltip/Tooltip.d.cts +4 -3
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +5 -0
- package/dist/cjs/index.storybook-testing.d.cts +1 -0
- package/dist/cjs/storybook-testing.cjs +1 -1
- package/dist/esm/components/button/Button.d.ts +5 -2
- package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
- package/dist/esm/components/data-table/DataTable.d.ts +3 -6
- package/dist/esm/components/data-table/DataTable.js +61 -56
- package/dist/esm/components/date-calendar/DateCalendar.d.ts +23 -0
- package/dist/esm/components/{date-picker/parts → date-calendar}/DateCalendar.js +62 -60
- package/dist/esm/components/date-calendar/hooks/useMonthsList.d.ts +4 -0
- package/dist/esm/components/date-calendar/hooks/useYearsList.d.ts +10 -0
- package/dist/esm/components/date-picker/DatePicker.d.ts +3 -3
- package/dist/esm/components/date-picker/DatePicker.js +22 -22
- package/dist/esm/components/definition-tooltip/DefinitionTooltip.d.ts +23 -0
- package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +29 -0
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +31 -27
- package/dist/esm/components/icon-button/CircularIconButton.d.ts +0 -21
- package/dist/esm/components/icon-button/CircularIconButton.js +23 -26
- package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
- package/dist/esm/components/number-field/NumberField.d.ts +47 -0
- package/dist/esm/components/number-field/NumberField.js +71 -0
- package/dist/esm/components/number-input/NumberInput.d.ts +216 -0
- package/dist/esm/components/number-input/NumberInput.js +214 -0
- package/dist/esm/components/pagination/Pagination.js +17 -16
- package/dist/esm/components/pagination/hooks/use-pagination.d.ts +2 -1
- package/dist/esm/components/pagination/hooks/use-pagination.js +12 -11
- package/dist/esm/components/popover/Popover.js +25 -21
- package/dist/esm/components/popover/parts/PopoverHeader.js +17 -15
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +1 -1
- package/dist/esm/components/select-field/test-utils.js +25 -0
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +5 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +7 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -16
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +35 -0
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +44 -36
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +59 -0
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.js +45 -0
- package/dist/esm/components/side-panel/SidePanel.d.ts +6 -0
- package/dist/esm/components/side-panel/SidePanel.js +38 -35
- package/dist/esm/components/table/Table.d.ts +4 -0
- package/dist/esm/components/table/Table.js +96 -71
- package/dist/esm/components/table/parts/TableCell.js +5 -5
- package/dist/esm/components/tabs/parts/NavigationButton.js +4 -4
- package/dist/esm/components/tabs/parts/TabList.js +44 -35
- package/dist/esm/components/text/Text.d.ts +1 -1
- package/dist/esm/components/text/Text.js +6 -5
- package/dist/esm/components/text/Text.variants.d.ts +7 -0
- package/dist/esm/components/text/Text.variants.js +2 -1
- package/dist/esm/components/tooltip/Tooltip.d.ts +4 -3
- package/dist/esm/components/tooltip/Tooltip.js +13 -12
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +237 -225
- package/dist/esm/index.storybook-testing.d.ts +1 -0
- package/dist/esm/storybook-testing.js +3 -1
- package/i18n/en-GB.json +2 -0
- package/i18n/es-ES.json +2 -0
- package/i18n/fr-FR.json +2 -0
- package/package.json +7 -6
- package/dist/cjs/components/date-picker/parts/DateCalendar.cjs +0 -1
- package/dist/cjs/components/date-picker/parts/DateCalendar.d.cts +0 -9
- package/dist/cjs/components/popover/parts/PopoverContent.cjs +0 -1
- package/dist/esm/components/date-picker/parts/DateCalendar.d.ts +0 -9
- package/dist/esm/components/popover/parts/PopoverContent.js +0 -9
- /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useMonthsList.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useYearsList.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.cts +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/hooks/useMonthsList.js +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/hooks/useYearsList.js +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.ts +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.js +0 -0
package/dist/cjs/index.d.cts
CHANGED
|
@@ -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 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
-
|
|
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<
|
|
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
|
|
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
|
-
|
|
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
|
|
2
|
-
import { useRef as
|
|
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
|
|
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
|
|
7
|
-
import { TableHeader as
|
|
8
|
-
import { TablePagination as
|
|
9
|
-
import { TableRoot as
|
|
10
|
-
import { ColumnSortHeader as
|
|
11
|
-
function
|
|
12
|
-
table:
|
|
13
|
-
isLoading:
|
|
14
|
-
error:
|
|
15
|
-
emptyState:
|
|
16
|
-
loadingState:
|
|
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:
|
|
19
|
-
minRows:
|
|
20
|
-
maxRows:
|
|
21
|
-
children:
|
|
18
|
+
pagination: l,
|
|
19
|
+
minRows: b,
|
|
20
|
+
maxRows: P,
|
|
21
|
+
children: C,
|
|
22
|
+
...m
|
|
22
23
|
}) {
|
|
23
24
|
var p;
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
(
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
) }) },
|
|
47
|
+
t.column.columnDef.header,
|
|
48
|
+
t.getContext()
|
|
49
|
+
) }) }, t.id))
|
|
45
50
|
) }),
|
|
46
51
|
/* @__PURE__ */ e(
|
|
47
|
-
|
|
52
|
+
z,
|
|
48
53
|
{
|
|
49
|
-
renderEmptyState:
|
|
50
|
-
renderDataState:
|
|
51
|
-
children: !
|
|
54
|
+
renderEmptyState: w,
|
|
55
|
+
renderDataState: d,
|
|
56
|
+
children: !n && !a && o.getRowModel().rows.map(C)
|
|
52
57
|
}
|
|
53
58
|
)
|
|
54
59
|
] }),
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
o.getPageCount() > 1 && /* @__PURE__ */ e(
|
|
61
|
+
j,
|
|
57
62
|
{
|
|
58
|
-
pageCount:
|
|
59
|
-
rowCount:
|
|
60
|
-
currentPage:
|
|
61
|
-
rowsPerPage:
|
|
62
|
-
pageSizeOptions:
|
|
63
|
-
onPageChange: (
|
|
64
|
-
|
|
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: (
|
|
67
|
-
|
|
71
|
+
onPageSizeChange: (r) => {
|
|
72
|
+
o.setPageSize(r);
|
|
68
73
|
},
|
|
69
|
-
itemLabel: (p =
|
|
74
|
+
itemLabel: (p = l == null ? void 0 : l.labels) == null ? void 0 : p.itemLabel
|
|
70
75
|
}
|
|
71
76
|
)
|
|
72
77
|
] });
|
|
73
78
|
}
|
|
74
|
-
|
|
79
|
+
v.displayName = "DataTable";
|
|
75
80
|
export {
|
|
76
|
-
|
|
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
|
|
3
|
-
import { today as
|
|
4
|
-
import {
|
|
5
|
-
import { tv as
|
|
6
|
-
import { IconButton as h } from "
|
|
7
|
-
import { useMonthsList as
|
|
8
|
-
import { useYearsList as
|
|
9
|
-
import { DateSegmentSelect as
|
|
10
|
-
const
|
|
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
|
-
|
|
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
|
|
43
|
-
value:
|
|
42
|
+
function A({
|
|
43
|
+
value: c,
|
|
44
44
|
defaultValue: l,
|
|
45
45
|
minValue: d,
|
|
46
|
-
maxValue:
|
|
46
|
+
maxValue: s,
|
|
47
|
+
onChange: o,
|
|
48
|
+
onFocusChange: i,
|
|
47
49
|
...t
|
|
48
50
|
}) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
), [
|
|
52
|
-
|
|
53
|
-
),
|
|
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:
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
(
|
|
57
|
+
endYear: s == null ? void 0 : s.year
|
|
58
|
+
}), N = (e) => {
|
|
59
|
+
u(
|
|
60
|
+
(y) => y.set({ month: parseInt(e, 10) })
|
|
59
61
|
);
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
(
|
|
62
|
+
}, H = (e) => {
|
|
63
|
+
u(
|
|
64
|
+
(y) => y.set({ year: parseInt(e, 10) })
|
|
63
65
|
);
|
|
64
66
|
}, {
|
|
65
|
-
|
|
66
|
-
calendarWrapper:
|
|
67
|
-
dialogHeader:
|
|
68
|
-
dialogHeaderGroup:
|
|
69
|
-
calendarGrid:
|
|
70
|
-
calendarHeaderCell:
|
|
71
|
-
calendarCell:
|
|
72
|
-
} =
|
|
73
|
-
return /* @__PURE__ */ a(
|
|
74
|
-
|
|
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:
|
|
79
|
-
value:
|
|
80
|
+
maxValue: s,
|
|
81
|
+
value: g,
|
|
80
82
|
defaultValue: l,
|
|
81
83
|
onChange: (e) => {
|
|
82
|
-
|
|
84
|
+
x(e), o == null || o(e);
|
|
83
85
|
},
|
|
84
|
-
focusedValue:
|
|
86
|
+
focusedValue: n,
|
|
85
87
|
onFocusChange: (e) => {
|
|
86
|
-
|
|
88
|
+
u(e), i == null || i(e);
|
|
87
89
|
},
|
|
88
|
-
children: /* @__PURE__ */ r("div", { className:
|
|
89
|
-
/* @__PURE__ */ r("header", { className:
|
|
90
|
-
/* @__PURE__ */ a(
|
|
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:
|
|
96
|
+
className: b({
|
|
95
97
|
className: "uy-pl-100 uy-gap-200"
|
|
96
98
|
}),
|
|
97
99
|
children: [
|
|
98
100
|
/* @__PURE__ */ a(
|
|
99
|
-
|
|
101
|
+
v,
|
|
100
102
|
{
|
|
101
103
|
type: "month",
|
|
102
|
-
items:
|
|
103
|
-
value:
|
|
104
|
-
onChange:
|
|
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
|
-
|
|
111
|
+
v,
|
|
110
112
|
{
|
|
111
113
|
type: "year",
|
|
112
114
|
items: C,
|
|
113
|
-
value:
|
|
114
|
-
onChange:
|
|
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:
|
|
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(
|
|
155
|
-
/* @__PURE__ */ a(
|
|
156
|
-
/* @__PURE__ */ a(
|
|
157
|
-
|
|
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":
|
|
161
|
-
className:
|
|
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
|
-
|
|
171
|
+
A.displayName = "DateCalendar";
|
|
170
172
|
export {
|
|
171
|
-
|
|
173
|
+
A as DateCalendar
|
|
172
174
|
};
|
|
@@ -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 |
|
|
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
|
|
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
|
|
5
|
-
import { tv as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DateInput as
|
|
9
|
-
const
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
87
|
-
const 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
|
|
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__ */
|
|
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__ */
|
|
116
|
+
/* @__PURE__ */ c(P, { className: h(), id: v, children: [
|
|
117
117
|
/* @__PURE__ */ a(
|
|
118
|
-
|
|
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
|
-
|
|
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 }) =>
|
|
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
|
-
|
|
161
|
+
z.displayName = "DatePicker";
|
|
162
162
|
export {
|
|
163
|
-
|
|
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 };
|