@payfit/unity-components 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
- package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
- package/dist/esm/adapters/zodAdapter.d.ts +13 -0
- package/dist/esm/adapters/zodAdapter.js +74 -0
- package/dist/esm/components/action-bar/ActionBar.js +62 -64
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +49 -39
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
- package/dist/esm/components/code/Code.d.ts +37 -0
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/esm/components/collapsible/Collapsible.js +14 -13
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
- package/dist/esm/components/data-table/DataTable.d.ts +76 -10
- package/dist/esm/components/data-table/DataTable.js +81 -78
- package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
- package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
- package/dist/esm/components/date-picker/DatePicker.js +64 -64
- package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
- package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
- package/dist/esm/components/error-state/ErrorState.js +153 -0
- package/dist/esm/components/error-state/initConfig.d.ts +16 -0
- package/dist/esm/components/error-state/initConfig.js +149 -0
- package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
- package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
- package/dist/esm/components/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +24 -23
- package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
- package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
- package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
- package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
- package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/multi-select/MultiSelect.js +94 -94
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
- package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
- package/dist/esm/components/nav/parts/NavGroup.js +21 -21
- package/dist/esm/components/number-field/NumberField.d.ts +3 -3
- package/dist/esm/components/number-input/NumberInput.js +58 -58
- package/dist/esm/components/pagination/Pagination.js +97 -101
- package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
- package/dist/esm/components/select-field/SelectField.d.ts +2 -2
- package/dist/esm/components/select-field/SelectField.js +4 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
- package/dist/esm/components/skip-links/SkipLinks.js +50 -43
- package/dist/esm/components/table/Table.js +79 -76
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +25 -25
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +16 -16
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/parts/Content.js +24 -24
- package/dist/esm/components/task-menu/parts/Header.js +24 -24
- package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
- package/dist/esm/components/task-menu/parts/Task.js +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text-area/TextArea.js +30 -31
- package/dist/esm/components/text-field/TextField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
- package/dist/esm/hooks/use-form.d.ts +5 -5
- package/dist/esm/hooks/use-form.types.d.ts +2 -2
- package/dist/esm/hooks/use-resizable.js +13 -14
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +22 -19
- package/dist/esm/types/schema.d.ts +8 -0
- package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
- package/dist/esm/utils/createSchemaAdapter.js +13 -0
- package/dist/esm/utils/platform.js +2 -3
- package/i18n/en-GB.json +16 -0
- package/i18n/es-ES.json +16 -0
- package/i18n/fr-FR.json +16 -0
- package/package.json +25 -19
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as a, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m } from "react";
|
|
3
|
-
import { today as I, getLocalTimeZone as
|
|
3
|
+
import { today as I, getLocalTimeZone as f, isToday as T } from "@internationalized/date";
|
|
4
4
|
import { uyTv as k } from "@payfit/unity-themes";
|
|
5
|
-
import { Calendar as B, Heading as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
import { useMonthsList as
|
|
8
|
-
import { useYearsList as
|
|
9
|
-
import { DateSegmentSelect as
|
|
10
|
-
const
|
|
5
|
+
import { Calendar as B, Heading as F, CalendarGrid as M, CalendarGridHeader as O, CalendarHeaderCell as W, CalendarGridBody as P, CalendarCell as R } from "react-aria-components";
|
|
6
|
+
import { IconButton as b } from "../icon-button/IconButton.js";
|
|
7
|
+
import { useMonthsList as Z } from "./hooks/useMonthsList.js";
|
|
8
|
+
import { useYearsList as $ } from "./hooks/useYearsList.js";
|
|
9
|
+
import { DateSegmentSelect as h } from "./parts/DateSegmentSelect.js";
|
|
10
|
+
const q = k({
|
|
11
11
|
slots: {
|
|
12
12
|
base: "",
|
|
13
13
|
calendarWrapper: "uy:flex uy:flex-col uy:gap-100",
|
|
@@ -39,80 +39,80 @@ const z = k({
|
|
|
39
39
|
isDisabled: !1
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
function
|
|
43
|
-
value:
|
|
44
|
-
defaultValue:
|
|
45
|
-
minValue:
|
|
46
|
-
maxValue:
|
|
47
|
-
onChange:
|
|
48
|
-
onFocusChange:
|
|
42
|
+
function z({
|
|
43
|
+
value: n,
|
|
44
|
+
defaultValue: d,
|
|
45
|
+
minValue: i,
|
|
46
|
+
maxValue: u,
|
|
47
|
+
onChange: p,
|
|
48
|
+
onFocusChange: g,
|
|
49
49
|
...t
|
|
50
50
|
}) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
), [
|
|
54
|
-
|
|
55
|
-
),
|
|
56
|
-
startYear:
|
|
57
|
-
endYear:
|
|
51
|
+
const y = I(f()), [v, C] = m(
|
|
52
|
+
n ?? d ?? y
|
|
53
|
+
), [l, s] = m(
|
|
54
|
+
n ?? d ?? y
|
|
55
|
+
), x = Z(), D = $({
|
|
56
|
+
startYear: i?.year,
|
|
57
|
+
endYear: u?.year
|
|
58
58
|
}), N = (e) => {
|
|
59
|
-
|
|
60
|
-
(
|
|
59
|
+
s(
|
|
60
|
+
(o) => o.set({ month: parseInt(e, 10) })
|
|
61
61
|
);
|
|
62
62
|
}, H = (e) => {
|
|
63
|
-
|
|
64
|
-
(
|
|
63
|
+
s(
|
|
64
|
+
(o) => o.set({ year: parseInt(e, 10) })
|
|
65
65
|
);
|
|
66
66
|
}, {
|
|
67
67
|
base: w,
|
|
68
68
|
calendarWrapper: G,
|
|
69
69
|
dialogHeader: L,
|
|
70
|
-
dialogHeaderGroup:
|
|
70
|
+
dialogHeaderGroup: c,
|
|
71
71
|
calendarGrid: S,
|
|
72
72
|
calendarHeaderCell: Y,
|
|
73
73
|
calendarCell: j
|
|
74
|
-
} =
|
|
74
|
+
} = q({ isDisabled: t.isDisabled });
|
|
75
75
|
return /* @__PURE__ */ a("div", { className: w(), "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
|
|
76
76
|
B,
|
|
77
77
|
{
|
|
78
78
|
...t,
|
|
79
|
-
minValue:
|
|
80
|
-
maxValue:
|
|
81
|
-
value:
|
|
82
|
-
defaultValue:
|
|
79
|
+
minValue: i,
|
|
80
|
+
maxValue: u,
|
|
81
|
+
value: v,
|
|
82
|
+
defaultValue: d,
|
|
83
83
|
onChange: (e) => {
|
|
84
|
-
|
|
84
|
+
C(e), p?.(e);
|
|
85
85
|
},
|
|
86
|
-
focusedValue:
|
|
86
|
+
focusedValue: l,
|
|
87
87
|
onFocusChange: (e) => {
|
|
88
|
-
|
|
88
|
+
s(e), g?.(e);
|
|
89
89
|
},
|
|
90
90
|
children: /* @__PURE__ */ r("div", { className: G(), children: [
|
|
91
91
|
/* @__PURE__ */ r("header", { className: L(), children: [
|
|
92
|
-
/* @__PURE__ */ a(
|
|
92
|
+
/* @__PURE__ */ a(F, { className: "uy:sr-only" }),
|
|
93
93
|
/* @__PURE__ */ r(
|
|
94
94
|
"div",
|
|
95
95
|
{
|
|
96
|
-
className:
|
|
96
|
+
className: c({
|
|
97
97
|
className: "uy:pl-100 uy:gap-200"
|
|
98
98
|
}),
|
|
99
99
|
children: [
|
|
100
100
|
/* @__PURE__ */ a(
|
|
101
|
-
|
|
101
|
+
h,
|
|
102
102
|
{
|
|
103
103
|
type: "month",
|
|
104
|
-
items:
|
|
105
|
-
value:
|
|
104
|
+
items: x,
|
|
105
|
+
value: l.month.toString(),
|
|
106
106
|
onChange: N,
|
|
107
107
|
isDisabled: t.isDisabled
|
|
108
108
|
}
|
|
109
109
|
),
|
|
110
110
|
/* @__PURE__ */ a(
|
|
111
|
-
|
|
111
|
+
h,
|
|
112
112
|
{
|
|
113
113
|
type: "year",
|
|
114
|
-
items:
|
|
115
|
-
value:
|
|
114
|
+
items: D,
|
|
115
|
+
value: l.year.toString(),
|
|
116
116
|
onChange: H,
|
|
117
117
|
isDisabled: t.isDisabled
|
|
118
118
|
}
|
|
@@ -123,12 +123,12 @@ function A({
|
|
|
123
123
|
/* @__PURE__ */ r(
|
|
124
124
|
"div",
|
|
125
125
|
{
|
|
126
|
-
className:
|
|
126
|
+
className: c({
|
|
127
127
|
className: "uy:ml-auto uy:gap-100"
|
|
128
128
|
}),
|
|
129
129
|
children: [
|
|
130
130
|
/* @__PURE__ */ a(
|
|
131
|
-
|
|
131
|
+
b,
|
|
132
132
|
{
|
|
133
133
|
slot: "previous",
|
|
134
134
|
icon: "CaretLeftOutlined",
|
|
@@ -139,7 +139,7 @@ function A({
|
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
141
|
/* @__PURE__ */ a(
|
|
142
|
-
|
|
142
|
+
b,
|
|
143
143
|
{
|
|
144
144
|
slot: "next",
|
|
145
145
|
icon: "CaretRightOutlined",
|
|
@@ -153,13 +153,13 @@ function A({
|
|
|
153
153
|
}
|
|
154
154
|
)
|
|
155
155
|
] }),
|
|
156
|
-
/* @__PURE__ */ r(
|
|
157
|
-
/* @__PURE__ */ a(
|
|
158
|
-
/* @__PURE__ */ a(
|
|
159
|
-
|
|
156
|
+
/* @__PURE__ */ r(M, { className: S(), weekdayStyle: "short", children: [
|
|
157
|
+
/* @__PURE__ */ a(O, { children: (e) => /* @__PURE__ */ a(W, { className: Y(), children: e }) }),
|
|
158
|
+
/* @__PURE__ */ a(P, { children: (e) => /* @__PURE__ */ a(
|
|
159
|
+
R,
|
|
160
160
|
{
|
|
161
161
|
date: e,
|
|
162
|
-
"data-today": T(e,
|
|
162
|
+
"data-today": T(e, f()) ? !0 : void 0,
|
|
163
163
|
className: j()
|
|
164
164
|
}
|
|
165
165
|
) })
|
|
@@ -168,7 +168,7 @@ function A({
|
|
|
168
168
|
}
|
|
169
169
|
) });
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
z.displayName = "DateCalendar";
|
|
172
172
|
export {
|
|
173
|
-
|
|
173
|
+
z as DateCalendar
|
|
174
174
|
};
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { IconSprite as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
function
|
|
7
|
-
items:
|
|
8
|
-
value:
|
|
9
|
-
onChange:
|
|
1
|
+
import { jsxs as b, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I } from "react";
|
|
3
|
+
import { IconSprite as v } from "@payfit/unity-icons";
|
|
4
|
+
import { useId as $ } from "react-aria";
|
|
5
|
+
import { useIntl as w } from "react-intl";
|
|
6
|
+
function x({
|
|
7
|
+
items: a,
|
|
8
|
+
value: o,
|
|
9
|
+
onChange: m,
|
|
10
10
|
type: e,
|
|
11
|
-
isDisabled:
|
|
11
|
+
isDisabled: i = !1
|
|
12
12
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
return (a == null ? void 0 : a.name) ?? Array.from({ length: 3 }).join("\0");
|
|
16
|
-
}, r = x(), c = I(), [p, f] = $(l(i)), d = `${r}-calendar-${e}-select-label`, u = `${r}-calendar-${e}-select`, m = `${r}-calendar-${e}-select-description`, h = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:label" : "unity:component:form-field:date-picker:segment-select:year:label", g = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:description" : "unity:component:form-field:date-picker:segment-select:year:description";
|
|
17
|
-
return /* @__PURE__ */ v("div", { className: "uy:isolation-isolate uy:relative uy:inline-flex uy:items-center uy:cursor-pointer", children: [
|
|
13
|
+
const s = (t) => () => a.find((g) => g.id === t)?.name ?? Array.from({ length: 3 }).join("\0"), r = $(), l = w(), [y, p] = I(s(o)), c = `${r}-calendar-${e}-select-label`, d = `${r}-calendar-${e}-select`, u = `${r}-calendar-${e}-select-description`, f = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:label" : "unity:component:form-field:date-picker:segment-select:year:label", h = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:description" : "unity:component:form-field:date-picker:segment-select:year:description";
|
|
14
|
+
return /* @__PURE__ */ b("div", { className: "uy:isolation-isolate uy:relative uy:inline-flex uy:items-center uy:cursor-pointer", children: [
|
|
18
15
|
/* @__PURE__ */ n(
|
|
19
16
|
"label",
|
|
20
17
|
{
|
|
21
|
-
id:
|
|
22
|
-
htmlFor:
|
|
18
|
+
id: c,
|
|
19
|
+
htmlFor: d,
|
|
23
20
|
className: "uy:sr-only",
|
|
24
21
|
"aria-hidden": "true",
|
|
25
|
-
children:
|
|
26
|
-
id:
|
|
22
|
+
children: l.formatMessage({
|
|
23
|
+
id: f,
|
|
27
24
|
defaultMessage: `Change current ${e}`
|
|
28
25
|
})
|
|
29
26
|
}
|
|
@@ -31,39 +28,39 @@ function N({
|
|
|
31
28
|
/* @__PURE__ */ n(
|
|
32
29
|
"select",
|
|
33
30
|
{
|
|
34
|
-
id:
|
|
35
|
-
value:
|
|
31
|
+
id: d,
|
|
32
|
+
value: o,
|
|
36
33
|
onChange: (t) => {
|
|
37
|
-
|
|
34
|
+
m(t.target.value), p(s(t.target.value));
|
|
38
35
|
},
|
|
39
|
-
disabled:
|
|
36
|
+
disabled: i,
|
|
40
37
|
className: "uy:appearance-none uy:box-border uy:w-[var(--uy-selected-item-width)] uy:bg-transparent uy:border-none uy:rounded-50 uy:capitalize uy:text-content-form-enabled uy:typography-action-large uy:cursor-pointer uy:pr-300 uy:disabled:text-content-form-disabled uy:focus-visible:outline-2 uy:focus-visible:outline-offset-2 uy:focus-visible:outline-utility-focus-ring [-webkit-tap-highlight-color:transparent] [background-color:transparent]",
|
|
41
38
|
style: {
|
|
42
|
-
"--uy-selected-item-width": `calc(var(--uy-spacing-300) + ${
|
|
39
|
+
"--uy-selected-item-width": `calc(var(--uy-spacing-300) + ${y.length}ch)`
|
|
43
40
|
},
|
|
44
|
-
"aria-labelledby":
|
|
45
|
-
"aria-describedby":
|
|
46
|
-
children:
|
|
41
|
+
"aria-labelledby": c,
|
|
42
|
+
"aria-describedby": u,
|
|
43
|
+
children: a.map((t) => /* @__PURE__ */ n("option", { value: t.id, children: t.name }, t.id))
|
|
47
44
|
}
|
|
48
45
|
),
|
|
49
46
|
/* @__PURE__ */ n("div", { className: "uy:absolute uy:right-0 uy:pointer-events-none uy:text-content-neutral-low", children: /* @__PURE__ */ n(
|
|
50
|
-
|
|
47
|
+
v,
|
|
51
48
|
{
|
|
52
49
|
src: "CaretDownOutlined",
|
|
53
50
|
width: 20,
|
|
54
51
|
height: 20,
|
|
55
52
|
color: "inherit",
|
|
56
53
|
role: "presentation",
|
|
57
|
-
className:
|
|
54
|
+
className: i ? "uy:text-content-form-disabled" : ""
|
|
58
55
|
}
|
|
59
56
|
) }),
|
|
60
|
-
/* @__PURE__ */ n("span", { id:
|
|
61
|
-
id:
|
|
57
|
+
/* @__PURE__ */ n("span", { id: u, className: "uy:sr-only", "aria-hidden": "true", children: l.formatMessage({
|
|
58
|
+
id: h,
|
|
62
59
|
defaultMessage: `Press Enter or Space to change ${e}, then use up and down arrows to select a ${e}`
|
|
63
60
|
}) })
|
|
64
61
|
] });
|
|
65
62
|
}
|
|
66
|
-
|
|
63
|
+
x.displayName = "DateSegmentSelect";
|
|
67
64
|
export {
|
|
68
|
-
|
|
65
|
+
x as DateSegmentSelect
|
|
69
66
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { DatePicker as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { DateCalendar as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { DateInput as
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V } from "react";
|
|
3
|
+
import { uyTv as b } from "@payfit/unity-themes";
|
|
4
|
+
import { DatePicker as N, Group as O, Button as W, Popover as I, Dialog as U } from "react-aria-components";
|
|
5
|
+
import { useIntl as B } from "react-intl";
|
|
6
|
+
import { DateCalendar as j } from "../date-calendar/DateCalendar.js";
|
|
7
|
+
import { Icon as E } from "../icon/Icon.js";
|
|
8
|
+
import { DateInput as M } from "./parts/DateInput.js";
|
|
9
|
+
const R = b({
|
|
10
10
|
slots: {
|
|
11
11
|
base: [
|
|
12
|
-
"uy:group uy:flex uy:h-500 uy:border uy:border-solid uy:rounded-
|
|
12
|
+
"uy:group uy:flex uy:h-500 uy:border uy:border-solid uy:rounded-75",
|
|
13
13
|
"uy:active:border-border-form-active uy:data-[focus-visible]:border-border-form-active"
|
|
14
14
|
],
|
|
15
15
|
inputWrapper: [
|
|
@@ -20,7 +20,7 @@ const T = m({
|
|
|
20
20
|
"uy:group-[:has(button:focus)]:data-[focus-within]:outline-none uy:group-[:has(button:focus)]:data-[focus-within]:outline-offset-0 uy:group-[:has(button:focus)]:data-[focus-within]:outline-transparent"
|
|
21
21
|
],
|
|
22
22
|
suffix: [
|
|
23
|
-
"uy:flex-grow-0 uy:content-center uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:border-l uy:border-solid uy:rounded-r-
|
|
23
|
+
"uy:flex-grow-0 uy:content-center uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:border-l uy:border-solid uy:rounded-r-75 uy:text-content-neutral-low",
|
|
24
24
|
"uy:hover:bg-surface-neutral-hover uy:active:bg-surface-neutral-pressed uy:active:border-border-form-active uy:data-[pressed]:bg-surface-neutral-pressed uy:data-[pressed]:border-border-form-active",
|
|
25
25
|
"uy:focus-visible:outline-2 uy:focus-visible:outline-utility-focus-ring uy:focus-visible:outline-offset-[3px]"
|
|
26
26
|
]
|
|
@@ -58,7 +58,7 @@ const T = m({
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
]
|
|
61
|
-
}),
|
|
61
|
+
}), G = b({
|
|
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,68 +68,68 @@ const T = m({
|
|
|
68
68
|
true: "uy:animate-out uy:fade-out uy:data-[placement-bottom]:slide-out-to-top-1 uy:data-[placement-top]:slide-out-to-bottom-1 uy:duration-150 uy:ease-in"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
}),
|
|
71
|
+
}), T = V(
|
|
72
72
|
({
|
|
73
|
-
value:
|
|
74
|
-
defaultValue:
|
|
75
|
-
isInvalid:
|
|
76
|
-
isLoading:
|
|
77
|
-
isDisabled:
|
|
78
|
-
isReadOnly:
|
|
79
|
-
onClearButtonPress:
|
|
80
|
-
onBlur:
|
|
81
|
-
onFocus:
|
|
82
|
-
onChange:
|
|
83
|
-
onOpenChange:
|
|
84
|
-
id:
|
|
73
|
+
value: u,
|
|
74
|
+
defaultValue: i,
|
|
75
|
+
isInvalid: n,
|
|
76
|
+
isLoading: y,
|
|
77
|
+
isDisabled: o,
|
|
78
|
+
isReadOnly: t,
|
|
79
|
+
onClearButtonPress: c,
|
|
80
|
+
onBlur: s,
|
|
81
|
+
onFocus: d,
|
|
82
|
+
onChange: m,
|
|
83
|
+
onOpenChange: p,
|
|
84
|
+
id: g,
|
|
85
85
|
...e
|
|
86
|
-
},
|
|
87
|
-
const
|
|
88
|
-
isInvalid: !!
|
|
89
|
-
isReadOnly: !!
|
|
90
|
-
isDisabled: !!
|
|
91
|
-
}),
|
|
92
|
-
|
|
86
|
+
}, $) => {
|
|
87
|
+
const h = B(), { base: v, inputWrapper: x, suffix: D } = R({
|
|
88
|
+
isInvalid: !!n,
|
|
89
|
+
isReadOnly: !!t,
|
|
90
|
+
isDisabled: !!o
|
|
91
|
+
}), l = (r) => {
|
|
92
|
+
m?.(r);
|
|
93
93
|
}, w = (r) => {
|
|
94
|
-
|
|
95
|
-
}, k = (r) => e.isDateUnavailable ? e.isDateUnavailable(r) : !1,
|
|
96
|
-
|
|
94
|
+
p?.(r), r ? d?.() : s?.();
|
|
95
|
+
}, k = (r) => e.isDateUnavailable ? e.isDateUnavailable(r) : !1, C = () => {
|
|
96
|
+
c?.();
|
|
97
97
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
98
|
+
return /* @__PURE__ */ f(
|
|
99
|
+
N,
|
|
100
100
|
{
|
|
101
101
|
"data-dd-privacy": "mask",
|
|
102
102
|
...e,
|
|
103
|
-
className:
|
|
104
|
-
value:
|
|
105
|
-
defaultValue:
|
|
103
|
+
className: v(),
|
|
104
|
+
value: u,
|
|
105
|
+
defaultValue: i,
|
|
106
106
|
minValue: e.minValue,
|
|
107
107
|
maxValue: e.maxValue,
|
|
108
|
-
isReadOnly: !!
|
|
109
|
-
isDisabled: !!
|
|
110
|
-
onChange:
|
|
111
|
-
onFocus:
|
|
112
|
-
onBlur:
|
|
108
|
+
isReadOnly: !!t,
|
|
109
|
+
isDisabled: !!o,
|
|
110
|
+
onChange: l,
|
|
111
|
+
onFocus: d,
|
|
112
|
+
onBlur: s,
|
|
113
113
|
onOpenChange: w,
|
|
114
114
|
isDateUnavailable: k,
|
|
115
115
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ f(O, { className: x(), id: g, children: [
|
|
117
117
|
/* @__PURE__ */ a(
|
|
118
|
-
|
|
118
|
+
M,
|
|
119
119
|
{
|
|
120
|
-
isLoading:
|
|
121
|
-
isDisabled:
|
|
122
|
-
isReadOnly:
|
|
123
|
-
isInvalid:
|
|
124
|
-
onClearButtonPress:
|
|
120
|
+
isLoading: y,
|
|
121
|
+
isDisabled: o,
|
|
122
|
+
isReadOnly: t,
|
|
123
|
+
isInvalid: n,
|
|
124
|
+
onClearButtonPress: C
|
|
125
125
|
}
|
|
126
126
|
),
|
|
127
|
-
/* @__PURE__ */ a(
|
|
128
|
-
|
|
127
|
+
/* @__PURE__ */ a(W, { className: D(), isDisabled: t || o, children: /* @__PURE__ */ a(
|
|
128
|
+
E,
|
|
129
129
|
{
|
|
130
130
|
src: "CalendarBlankOutlined",
|
|
131
131
|
color: "inherit",
|
|
132
|
-
alt:
|
|
132
|
+
alt: h.formatMessage({
|
|
133
133
|
id: "unity:component:form-field:date-picker:calendar-button",
|
|
134
134
|
defaultMessage: "Open Calendar"
|
|
135
135
|
})
|
|
@@ -137,17 +137,17 @@ const T = m({
|
|
|
137
137
|
) })
|
|
138
138
|
] }),
|
|
139
139
|
/* @__PURE__ */ a(
|
|
140
|
-
|
|
140
|
+
I,
|
|
141
141
|
{
|
|
142
|
-
className: ({ isEntering: r, isExiting:
|
|
143
|
-
children: /* @__PURE__ */ a(
|
|
144
|
-
|
|
142
|
+
className: ({ isEntering: r, isExiting: P }) => G({ isEntering: r, isExiting: P }),
|
|
143
|
+
children: /* @__PURE__ */ a(U, { className: "uy:p-150", "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
|
|
144
|
+
j,
|
|
145
145
|
{
|
|
146
|
-
value:
|
|
147
|
-
defaultValue:
|
|
146
|
+
value: u,
|
|
147
|
+
defaultValue: i,
|
|
148
148
|
minValue: e.minValue,
|
|
149
149
|
maxValue: e.maxValue,
|
|
150
|
-
onChange:
|
|
150
|
+
onChange: l,
|
|
151
151
|
firstDayOfWeek: e.firstDayOfWeek
|
|
152
152
|
}
|
|
153
153
|
) })
|
|
@@ -158,7 +158,7 @@ const T = m({
|
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
);
|
|
161
|
-
|
|
161
|
+
T.displayName = "DatePicker";
|
|
162
162
|
export {
|
|
163
|
-
|
|
163
|
+
T as DatePicker
|
|
164
164
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as b } from "react";
|
|
3
|
-
import { uyTv as
|
|
3
|
+
import { uyTv as i } from "@payfit/unity-themes";
|
|
4
4
|
import { DatePickerStateContext as g, DateInput as x, DateSegment as v } from "react-aria-components";
|
|
5
5
|
import { useIntl as I } from "react-intl";
|
|
6
6
|
import { CircularIconButton as h } from "../../icon-button/CircularIconButton.js";
|
|
7
7
|
import { Icon as D } from "../../icon/Icon.js";
|
|
8
|
-
import { Spinner as
|
|
9
|
-
const
|
|
8
|
+
import { Spinner as C } from "../../spinner/Spinner.js";
|
|
9
|
+
const M = i({
|
|
10
10
|
base: "uy:group uy:box-content uy:rounded-25 uy:px-25 uy:text-end uy:tabular-nums! uy:outline-none uy:typography-body uy:focus:bg-surface-form-active uy:focus:rounded-25 uy:focus:text-content-inverted uy:data-[disabled]:text-content-form-disabled",
|
|
11
11
|
variants: {
|
|
12
12
|
isPlaceholder: {
|
|
@@ -18,7 +18,7 @@ const N = d({
|
|
|
18
18
|
false: ""
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
}),
|
|
21
|
+
}), N = i({
|
|
22
22
|
slots: {
|
|
23
23
|
base: "uy:flex uy:gap-50 uy:flex-grow uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:rounded-100",
|
|
24
24
|
input: "uy:flex uy:gap-25 uy:w-fit uy:grow",
|
|
@@ -54,47 +54,47 @@ const N = d({
|
|
|
54
54
|
}
|
|
55
55
|
]
|
|
56
56
|
});
|
|
57
|
-
function
|
|
58
|
-
isLoading:
|
|
59
|
-
isInvalid:
|
|
60
|
-
isReadOnly:
|
|
61
|
-
isDisabled:
|
|
62
|
-
onClearButtonPress:
|
|
57
|
+
function P({
|
|
58
|
+
isLoading: r,
|
|
59
|
+
isInvalid: o,
|
|
60
|
+
isReadOnly: n,
|
|
61
|
+
isDisabled: s,
|
|
62
|
+
onClearButtonPress: d
|
|
63
63
|
}) {
|
|
64
|
-
const
|
|
65
|
-
isInvalid: !!
|
|
66
|
-
isReadOnly: !!
|
|
67
|
-
isDisabled: !!
|
|
68
|
-
}), p = c && !
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */ e(x, { className: y(), children: (
|
|
64
|
+
const t = I(), u = b(g), { dateValue: c } = u, { base: m, input: y, state: f } = N({
|
|
65
|
+
isInvalid: !!o,
|
|
66
|
+
isReadOnly: !!n,
|
|
67
|
+
isDisabled: !!s
|
|
68
|
+
}), p = c && !r && !n && !s;
|
|
69
|
+
return /* @__PURE__ */ l("div", { className: m(), children: [
|
|
70
|
+
/* @__PURE__ */ e(x, { className: y(), children: (a) => /* @__PURE__ */ e(
|
|
71
71
|
v,
|
|
72
72
|
{
|
|
73
|
-
segment:
|
|
74
|
-
className:
|
|
75
|
-
isPlaceholder:
|
|
76
|
-
isLiteral:
|
|
73
|
+
segment: a,
|
|
74
|
+
className: M({
|
|
75
|
+
isPlaceholder: a.isPlaceholder,
|
|
76
|
+
isLiteral: a.type === "literal"
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
) }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
/* @__PURE__ */ l("div", { className: f(), children: [
|
|
81
|
+
r && /* @__PURE__ */ e(
|
|
82
|
+
C,
|
|
83
83
|
{
|
|
84
84
|
color: "inherit",
|
|
85
85
|
size: "small",
|
|
86
|
-
label:
|
|
86
|
+
label: t.formatMessage({
|
|
87
87
|
id: "unity:component:common:loading:label",
|
|
88
88
|
defaultMessage: "Loading..."
|
|
89
89
|
})
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
|
|
92
|
+
o && /* @__PURE__ */ e(
|
|
93
93
|
D,
|
|
94
94
|
{
|
|
95
95
|
src: "WarningCircleOutlined",
|
|
96
96
|
color: "content.form.invalid",
|
|
97
|
-
alt:
|
|
97
|
+
alt: t.formatMessage({
|
|
98
98
|
id: "unity:component:form-field:form-input:error:alt",
|
|
99
99
|
defaultMessage: "Error"
|
|
100
100
|
})
|
|
@@ -104,21 +104,21 @@ function O({
|
|
|
104
104
|
h,
|
|
105
105
|
{
|
|
106
106
|
slot: null,
|
|
107
|
-
title:
|
|
107
|
+
title: t.formatMessage({
|
|
108
108
|
id: "unity:component:common:clear:title",
|
|
109
109
|
defaultMessage: "Clear"
|
|
110
110
|
}),
|
|
111
111
|
icon: "CloseOutlined",
|
|
112
112
|
onPress: () => {
|
|
113
|
-
|
|
113
|
+
u?.setValue(null), d?.();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
)
|
|
117
117
|
] })
|
|
118
118
|
] });
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
P.displayName = "DateInput";
|
|
121
121
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
P as DateInput,
|
|
123
|
+
N as dateInput
|
|
124
124
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import { ForwardedRef, ReactNode } from 'react';
|
|
3
4
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
-
import { infer as ZodInfer } from 'zod';
|
|
5
5
|
import { Schema } from '../../hooks/use-form.types.js';
|
|
6
6
|
import { DatePickerProps } from '../date-picker/DatePicker.js';
|
|
7
7
|
import { LabelProps } from '../label/Label.js';
|
|
@@ -45,7 +45,7 @@ export type TypedDatePickerFieldProps<TFieldValues extends FieldValues = FieldVa
|
|
|
45
45
|
name: TName;
|
|
46
46
|
};
|
|
47
47
|
type DatePickerFieldComponent = {
|
|
48
|
-
<TSchema extends Schema>(props: TypedDatePickerFieldProps<
|
|
48
|
+
<TSchema extends Schema>(props: TypedDatePickerFieldProps<StandardSchemaV1.InferOutput<TSchema>> & {
|
|
49
49
|
ref?: ForwardedRef<HTMLDivElement>;
|
|
50
50
|
}): React.JSX.Element;
|
|
51
51
|
displayName?: string;
|