@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
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as G } from "react";
|
|
3
|
+
import { NumberField as W, Group as q, Input as A } from "react-aria-components";
|
|
4
|
+
import { tv as C } from "tailwind-variants";
|
|
5
|
+
import { Icon as H } from "../icon/Icon.js";
|
|
6
|
+
import "@payfit/unity-icons";
|
|
7
|
+
import { useIntl as J } from "react-intl";
|
|
8
|
+
import { CircularIconButton as s } from "../icon-button/CircularIconButton.js";
|
|
9
|
+
import { Spinner as K } from "../spinner/Spinner.js";
|
|
10
|
+
const Q = C({
|
|
11
|
+
slots: {
|
|
12
|
+
base: [
|
|
13
|
+
"uy-group uy-flex uy-h-500 uy-border uy-border-solid uy-rounded-100",
|
|
14
|
+
"focus-within:uy-outline-none focus-within:uy-ring-2 focus-within:uy-ring-utility-focus-ring focus-within:uy-ring-offset-2",
|
|
15
|
+
"active:uy-border-border-form-active"
|
|
16
|
+
],
|
|
17
|
+
wrapper: [
|
|
18
|
+
"uy-flex uy-gap-50 uy-flex-grow uy-flex-nowrap uy-pt-100 uy-pb-100 uy-pl-150 uy-pr-150 uy-rounded-75 uy-max-w-full uy-justify-between uy-items-center"
|
|
19
|
+
],
|
|
20
|
+
input: [
|
|
21
|
+
"uy-w-full uy-flex-1 uy-outline-none uy-typography-body uy-min-w-0 uy-max-w-full",
|
|
22
|
+
"placeholder:uy-text-content-neutral-lowest"
|
|
23
|
+
],
|
|
24
|
+
prefix: [
|
|
25
|
+
"uy-flex-grow-0 uy-content-center uy-pt-100 uy-pb-100 uy-pl-150 uy-pr-150 uy-border-r uy-border-solid uy-rounded-l-100",
|
|
26
|
+
"active:uy-border-border-form-active"
|
|
27
|
+
],
|
|
28
|
+
suffix: [
|
|
29
|
+
"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-100",
|
|
30
|
+
"active:uy-border-border-form-active"
|
|
31
|
+
],
|
|
32
|
+
state: [
|
|
33
|
+
"uy-flex uy-gap-50 uy-items-center uy-shrink-0 uy-text-content-neutral-disabled"
|
|
34
|
+
],
|
|
35
|
+
controls: ["uy-flex uy-gap-50"]
|
|
36
|
+
},
|
|
37
|
+
variants: {
|
|
38
|
+
isReadOnly: {
|
|
39
|
+
true: {
|
|
40
|
+
base: ["uy-border-border-form-disabled uy-bg-surface-form-disabled"],
|
|
41
|
+
prefix: [
|
|
42
|
+
"uy-bg-surface-form-disabled uy-border-border-form-disabled uy-text-content-form-read-only"
|
|
43
|
+
],
|
|
44
|
+
wrapper: [
|
|
45
|
+
"uy-bg-surface-form-disabled uy-text-content-form-disabled",
|
|
46
|
+
"group-data-[invalid=true]:uy-bg-surface-form-error"
|
|
47
|
+
],
|
|
48
|
+
input: ["uy-bg-surface-form-disabled uy-text-content-form-read-only"],
|
|
49
|
+
suffix: [
|
|
50
|
+
"uy-bg-surface-form-disabled uy-border-border-form-disabled uy-text-content-form-read-only"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
false: {
|
|
54
|
+
base: [
|
|
55
|
+
"uy-border-border-form-enabled uy-bg-surface-form-enabled",
|
|
56
|
+
"data-[invalid=true]:uy-border-border-form-error data-[invalid=true]:uy-bg-surface-form-error",
|
|
57
|
+
"data-[disabled=true]:uy-border-border-form-disabled data-[disabled=true]:uy-bg-surface-form-disabled data-[disabled=true]:uy-cursor-not-allowed"
|
|
58
|
+
],
|
|
59
|
+
prefix: [
|
|
60
|
+
"uy-bg-surface-neutral-low uy-border-border-form-enabled uy-text-content-form-enabled",
|
|
61
|
+
"group-data-[invalid=true]:uy-bg-surface-form-error group-data-[invalid=true]:uy-border-border-form-error",
|
|
62
|
+
"group-data-[disabled=true]:uy-bg-surface-form-disabled group-data-[disabled=true]:uy-border-border-form-disabled group-data-[disabled=true]:uy-text-content-form-disabled data-[disabled=true]:uy-cursor-not-allowed"
|
|
63
|
+
],
|
|
64
|
+
suffix: [
|
|
65
|
+
"uy-bg-surface-neutral-low uy-border-border-form-enabled uy-text-content-form-enabled",
|
|
66
|
+
"group-data-[invalid=true]:uy-bg-surface-form-error group-data-[invalid=true]:uy-border-border-form-error",
|
|
67
|
+
"group-data-[disabled=true]:uy-bg-surface-form-disabled group-data-[disabled=true]:uy-border-border-form-disabled group-data-[disabled=true]:uy-text-content-form-disabled data-[disabled=true]:uy-cursor-not-allowed"
|
|
68
|
+
],
|
|
69
|
+
wrapper: [
|
|
70
|
+
"uy-border-border-form-enabled uy-bg-surface-form-enabled",
|
|
71
|
+
"group-data-[invalid=true]:uy-bg-surface-form-error group-data-[invalid=true]:uy-border-border-form-error",
|
|
72
|
+
"group-data-[disabled=true]:uy-bg-surface-form-disabled group-data-[disabled=true]:uy-text-content-form-disabled data-[disabled=true]:uy-cursor-not-allowed"
|
|
73
|
+
],
|
|
74
|
+
input: [
|
|
75
|
+
"uy-text-content-form-enabled uy-bg-surface-form-enabled",
|
|
76
|
+
"group-data-[invalid=true]:uy-bg-surface-form-error",
|
|
77
|
+
"group-data-[disabled=true]:uy-bg-surface-form-disabled group-data-[disabled=true]:uy-text-content-form-disabled data-[disabled=true]:uy-cursor-not-allowed"
|
|
78
|
+
],
|
|
79
|
+
state: ["group-data-[invalid=true]:uy-text-content-form-error"],
|
|
80
|
+
button: "data-[disabled=true]:uy-cursor-not-allowed"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}), R = G(
|
|
85
|
+
({
|
|
86
|
+
withControls: b = !1,
|
|
87
|
+
defaultValue: u,
|
|
88
|
+
formatOptions: p,
|
|
89
|
+
isDisabled: f,
|
|
90
|
+
isInvalid: y,
|
|
91
|
+
isLoading: a,
|
|
92
|
+
isReadOnly: d,
|
|
93
|
+
isRequired: g,
|
|
94
|
+
maxValue: n,
|
|
95
|
+
minValue: i,
|
|
96
|
+
prefix: m,
|
|
97
|
+
onBlur: x,
|
|
98
|
+
onChange: w,
|
|
99
|
+
onClearButtonPress: l,
|
|
100
|
+
step: v,
|
|
101
|
+
suffix: c,
|
|
102
|
+
value: r,
|
|
103
|
+
...h
|
|
104
|
+
}, N) => {
|
|
105
|
+
const {
|
|
106
|
+
base: M,
|
|
107
|
+
wrapper: I,
|
|
108
|
+
input: j,
|
|
109
|
+
prefix: E,
|
|
110
|
+
suffix: O,
|
|
111
|
+
state: S,
|
|
112
|
+
controls: D
|
|
113
|
+
} = Q({ isReadOnly: d }), t = J(), k = r !== void 0 && !isNaN(r), z = u !== void 0 && !isNaN(u), F = (k || z) && !b && !a && !d && !f;
|
|
114
|
+
return /* @__PURE__ */ o(
|
|
115
|
+
W,
|
|
116
|
+
{
|
|
117
|
+
ref: N,
|
|
118
|
+
className: M(),
|
|
119
|
+
value: r,
|
|
120
|
+
defaultValue: u,
|
|
121
|
+
minValue: i,
|
|
122
|
+
maxValue: n,
|
|
123
|
+
step: v,
|
|
124
|
+
isDisabled: f,
|
|
125
|
+
isReadOnly: d,
|
|
126
|
+
isInvalid: y,
|
|
127
|
+
isRequired: g,
|
|
128
|
+
"aria-busy": a,
|
|
129
|
+
onChange: w,
|
|
130
|
+
formatOptions: p,
|
|
131
|
+
onBlur: x,
|
|
132
|
+
...h,
|
|
133
|
+
children: [
|
|
134
|
+
m ? /* @__PURE__ */ e("span", { className: E(), children: m }) : null,
|
|
135
|
+
/* @__PURE__ */ o(q, { className: I(), children: [
|
|
136
|
+
/* @__PURE__ */ e(A, { className: j() }),
|
|
137
|
+
/* @__PURE__ */ o("div", { className: S(), children: [
|
|
138
|
+
a && /* @__PURE__ */ e(
|
|
139
|
+
K,
|
|
140
|
+
{
|
|
141
|
+
color: "inherit",
|
|
142
|
+
size: "small",
|
|
143
|
+
label: t.formatMessage({
|
|
144
|
+
id: "unity:component:common:loading:label",
|
|
145
|
+
defaultMessage: "Loading..."
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
y && /* @__PURE__ */ e(
|
|
150
|
+
H,
|
|
151
|
+
{
|
|
152
|
+
src: "WarningCircleOutlined",
|
|
153
|
+
color: "content.form.invalid",
|
|
154
|
+
alt: t.formatMessage({
|
|
155
|
+
id: "unity:component:form-field:form-input:error:alt",
|
|
156
|
+
defaultMessage: "Error"
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
F && /* @__PURE__ */ e(
|
|
161
|
+
s,
|
|
162
|
+
{
|
|
163
|
+
title: t.formatMessage({
|
|
164
|
+
id: "unity:component:common:clear:title",
|
|
165
|
+
defaultMessage: "Clear"
|
|
166
|
+
}),
|
|
167
|
+
className: "uy-text-content-neutral-enabled",
|
|
168
|
+
icon: "CloseOutlined",
|
|
169
|
+
onPress: () => {
|
|
170
|
+
l == null || l();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] }),
|
|
175
|
+
b && /* @__PURE__ */ o("div", { className: D(), children: [
|
|
176
|
+
/* @__PURE__ */ e(
|
|
177
|
+
s,
|
|
178
|
+
{
|
|
179
|
+
asElement: "button",
|
|
180
|
+
icon: "MinusOutlined",
|
|
181
|
+
slot: "decrement",
|
|
182
|
+
isDisabled: i !== void 0 && r === i,
|
|
183
|
+
title: t.formatMessage({
|
|
184
|
+
id: "unity:component:form-field:number-input:decrement:title",
|
|
185
|
+
defaultMessage: "decrement"
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ e(
|
|
190
|
+
s,
|
|
191
|
+
{
|
|
192
|
+
asElement: "button",
|
|
193
|
+
icon: "PlusOutlined",
|
|
194
|
+
slot: "increment",
|
|
195
|
+
isDisabled: n !== void 0 && r === n,
|
|
196
|
+
title: t.formatMessage({
|
|
197
|
+
id: "unity:component:form-field:number-input:increment:title",
|
|
198
|
+
defaultMessage: "increment"
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
] })
|
|
203
|
+
] }),
|
|
204
|
+
c ? /* @__PURE__ */ e("span", { className: O(), children: c }) : null
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
R.displayName = "NumberInput";
|
|
211
|
+
export {
|
|
212
|
+
R as NumberInput,
|
|
213
|
+
Q as numberInput
|
|
214
|
+
};
|
|
@@ -8,7 +8,7 @@ import { usePagination as J } from "./hooks/use-pagination.js";
|
|
|
8
8
|
import { PaginationEllipsis as K } from "./parts/PaginationEllipsis.js";
|
|
9
9
|
import { PaginationJumpDialog as O } from "./parts/PaginationJumpDialog.js";
|
|
10
10
|
import { PaginationLink as S } from "./parts/PaginationLink.js";
|
|
11
|
-
import { PaginationNavButton as
|
|
11
|
+
import { PaginationNavButton as D } from "./parts/PaginationNavButton.js";
|
|
12
12
|
import { generatePaginationWithWindow as x } from "./utils/pagination-window.js";
|
|
13
13
|
const _ = j({
|
|
14
14
|
slots: {
|
|
@@ -24,12 +24,13 @@ const _ = j({
|
|
|
24
24
|
onPageChange: g,
|
|
25
25
|
onNextPress: m,
|
|
26
26
|
onPreviousPress: c,
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
const v = R(), u = W(),
|
|
27
|
+
...A
|
|
28
|
+
}, L) => {
|
|
29
|
+
const v = R(), u = W(), y = d !== void 0 && g !== void 0 && p === void 0, { currentPage: s, goToPage: n } = J({
|
|
30
30
|
pageCount: i,
|
|
31
|
-
initialPage:
|
|
32
|
-
onPageChange: g
|
|
31
|
+
initialPage: y ? d : p,
|
|
32
|
+
onPageChange: g,
|
|
33
|
+
isControlled: y
|
|
33
34
|
}), f = $({}), r = E(/* @__PURE__ */ new Map()), h = N(
|
|
34
35
|
() => x(
|
|
35
36
|
i,
|
|
@@ -44,7 +45,7 @@ const _ = j({
|
|
|
44
45
|
const e = r.current.get(a);
|
|
45
46
|
e && e.focus();
|
|
46
47
|
});
|
|
47
|
-
},
|
|
48
|
+
}, b = (a, e) => {
|
|
48
49
|
switch (a.key) {
|
|
49
50
|
case "ArrowLeft":
|
|
50
51
|
case "ArrowUp":
|
|
@@ -73,7 +74,7 @@ const _ = j({
|
|
|
73
74
|
});
|
|
74
75
|
break;
|
|
75
76
|
}
|
|
76
|
-
},
|
|
77
|
+
}, w = {
|
|
77
78
|
paginationLabel: u.formatMessage({
|
|
78
79
|
id: "unity:component:pagination:label",
|
|
79
80
|
defaultMessage: "Pagination"
|
|
@@ -93,10 +94,10 @@ const _ = j({
|
|
|
93
94
|
"nav",
|
|
94
95
|
{
|
|
95
96
|
"data-dd-privacy": "allow",
|
|
96
|
-
...
|
|
97
|
-
ref:
|
|
97
|
+
...A,
|
|
98
|
+
ref: L,
|
|
98
99
|
className: I(),
|
|
99
|
-
"aria-labelledby":
|
|
100
|
+
"aria-labelledby": w.paginationLabel,
|
|
100
101
|
children: [
|
|
101
102
|
/* @__PURE__ */ o(
|
|
102
103
|
O,
|
|
@@ -107,7 +108,7 @@ const _ = j({
|
|
|
107
108
|
}
|
|
108
109
|
),
|
|
109
110
|
/* @__PURE__ */ o(
|
|
110
|
-
|
|
111
|
+
D,
|
|
111
112
|
{
|
|
112
113
|
variant: "previous",
|
|
113
114
|
isDisabled: s === 1,
|
|
@@ -116,7 +117,7 @@ const _ = j({
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
),
|
|
119
|
-
/* @__PURE__ */ o("ul", { className: M(), "aria-label":
|
|
120
|
+
/* @__PURE__ */ o("ul", { className: M(), "aria-label": w.pageListLabel, children: h.map(
|
|
120
121
|
(a, e) => a.type === "page" ? /* @__PURE__ */ o(
|
|
121
122
|
"li",
|
|
122
123
|
{
|
|
@@ -135,7 +136,7 @@ const _ = j({
|
|
|
135
136
|
t && (l == null || l(a.value));
|
|
136
137
|
},
|
|
137
138
|
onKeyDown: (t) => {
|
|
138
|
-
|
|
139
|
+
b(t, a.value);
|
|
139
140
|
},
|
|
140
141
|
isActive: a.value === s,
|
|
141
142
|
value: a.value,
|
|
@@ -149,7 +150,7 @@ const _ = j({
|
|
|
149
150
|
{
|
|
150
151
|
value: a.value,
|
|
151
152
|
onKeyDown: (t) => {
|
|
152
|
-
|
|
153
|
+
b(t, -1);
|
|
153
154
|
},
|
|
154
155
|
onPress: () => {
|
|
155
156
|
f.open();
|
|
@@ -158,7 +159,7 @@ const _ = j({
|
|
|
158
159
|
) }, `uy-pagination-${v}-item-${e}`)
|
|
159
160
|
) }),
|
|
160
161
|
/* @__PURE__ */ o(
|
|
161
|
-
|
|
162
|
+
D,
|
|
162
163
|
{
|
|
163
164
|
variant: "next",
|
|
164
165
|
isDisabled: s === i,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export interface PaginationOptions {
|
|
2
2
|
pageCount: number;
|
|
3
3
|
initialPage?: number;
|
|
4
|
+
isControlled?: boolean;
|
|
4
5
|
onPageChange?: (page: number, previous: number, direction: -1 | 1) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare function usePagination({ pageCount, initialPage, onPageChange, }: PaginationOptions): {
|
|
7
|
+
export declare function usePagination({ isControlled, pageCount, initialPage, onPageChange, }: PaginationOptions): {
|
|
7
8
|
currentPage: number;
|
|
8
9
|
previousPage: number;
|
|
9
10
|
nextPage: number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
import { useState as m, useCallback as a } from "react";
|
|
2
|
+
function h({
|
|
3
|
+
isControlled: c = !1,
|
|
4
|
+
pageCount: o,
|
|
4
5
|
initialPage: r = 1,
|
|
5
6
|
onPageChange: n
|
|
6
7
|
}) {
|
|
7
|
-
const [
|
|
8
|
+
const [i, u] = m(r), t = c ? r : i, f = t - 1, l = t + 1, s = a(
|
|
8
9
|
(e) => {
|
|
9
|
-
n && n(e, t, Math.sign(e - t)),
|
|
10
|
+
n && n(e, t, Math.sign(e - t)), u(Math.max(1, Math.min(o, e)));
|
|
10
11
|
},
|
|
11
|
-
[t,
|
|
12
|
-
),
|
|
12
|
+
[t, o, n]
|
|
13
|
+
), P = a(
|
|
13
14
|
(e) => {
|
|
14
15
|
s(e === "previous" ? t - 1 : e === "next" ? t + 1 : e);
|
|
15
16
|
},
|
|
@@ -17,11 +18,11 @@ function m({
|
|
|
17
18
|
);
|
|
18
19
|
return {
|
|
19
20
|
currentPage: t,
|
|
20
|
-
previousPage:
|
|
21
|
-
nextPage:
|
|
22
|
-
goToPage:
|
|
21
|
+
previousPage: f,
|
|
22
|
+
nextPage: l,
|
|
23
|
+
goToPage: P
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
h as usePagination
|
|
27
28
|
};
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { DialogTrigger as
|
|
5
|
-
import { tv as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const x = g({
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u } from "react";
|
|
3
|
+
import { Popover as p, Dialog as g, DialogTrigger as m } from "react-aria-components";
|
|
4
|
+
import { DialogTrigger as j } from "react-aria-components";
|
|
5
|
+
import { tv as c } from "tailwind-variants";
|
|
6
|
+
import { PopoverHeader as f } from "./parts/PopoverHeader.js";
|
|
7
|
+
const x = c({
|
|
9
8
|
slots: {
|
|
10
9
|
base: [
|
|
11
|
-
"uy-border uy-border-solid uy-border-border-neutral uy-bg-surface-neutral uy-rounded-200 uy-p-200 uy-shadow-floating uy-min-w-[320px] uy-max-w-[800px]"
|
|
10
|
+
"uy-border uy-border-solid uy-border-border-neutral uy-bg-surface-neutral uy-rounded-200 uy-p-200 uy-shadow-floating uy-min-w-[320px] uy-max-w-[800px] uy-overflow-auto",
|
|
11
|
+
"uy-transition-all uy-duration-200 uy-linear data-[entering]:uy-opacity-100 data-[exiting]:uy-opacity-0",
|
|
12
|
+
'data-[entering]:data-[placement="bottom"]:-uy-translate-y-100 data-[entering]:data-[placement="bottom"]:uy-translate-x-0 data-[exiting]:data-[placement="bottom"]:uy-translate-y-0',
|
|
13
|
+
'data-[entering]:data-[placement="top"]:uy-translate-y-100 data-[entering]:data-[placement="top"]:uy-translate-x-0 data-[exiting]:data-[placement="top"]:uy-translate-y-0',
|
|
14
|
+
'data-[entering]:data-[placement="left"]:uy-translate-x-100 data-[entering]:data-[placement="left"]:uy-translate-y-0 data-[exiting]:data-[placement="bottom"]:uy-translate-x-0',
|
|
15
|
+
'data-[entering]:data-[placement="right"]:-uy-translate-x-100 data-[entering]:data-[placement="right"]:uy-translate-y-0 data-[exiting]:data-[placement="right"]:uy-translate-y-0'
|
|
12
16
|
],
|
|
13
17
|
dialog: [
|
|
14
18
|
"uy-flex uy-flex-col",
|
|
15
19
|
"focus:uy-outline-2 focus:uy-outline-offset-2"
|
|
16
20
|
]
|
|
17
21
|
}
|
|
18
|
-
}),
|
|
19
|
-
const { children:
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
}), b = u((a, e) => {
|
|
23
|
+
const { children: r, title: o, isTitleSrOnly: n, displayCloseButton: l, ...i } = a, { base: d, dialog: y } = x();
|
|
24
|
+
return /* @__PURE__ */ t(p, { ref: e, className: d(), offset: 8, ...i, children: /* @__PURE__ */ s(g, { className: y(), role: "dialog", children: [
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
f,
|
|
23
27
|
{
|
|
24
|
-
title:
|
|
25
|
-
isTitleSrOnly:
|
|
28
|
+
title: o,
|
|
29
|
+
isTitleSrOnly: n,
|
|
26
30
|
displayCloseButton: l
|
|
27
31
|
}
|
|
28
32
|
),
|
|
29
|
-
|
|
33
|
+
r
|
|
30
34
|
] }) });
|
|
31
35
|
});
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
b.displayName = "Popover";
|
|
37
|
+
m.displayName = "PopoverTrigger";
|
|
34
38
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
b as Popover,
|
|
40
|
+
j as PopoverTrigger
|
|
37
41
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { OverlayTriggerStateContext as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { tv as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
const
|
|
2
|
+
import { forwardRef as u, useContext as d } from "react";
|
|
3
|
+
import { OverlayTriggerStateContext as y, Heading as p } from "react-aria-components";
|
|
4
|
+
import { useIntl as f } from "react-intl";
|
|
5
|
+
import { tv as g } from "tailwind-variants";
|
|
6
|
+
import { IconButton as h } from "../../icon-button/IconButton.js";
|
|
7
|
+
const v = g({
|
|
8
8
|
slots: {
|
|
9
9
|
base: "uy-flex uy-justify-between",
|
|
10
|
-
heading: "uy-content-center"
|
|
10
|
+
heading: "uy-content-center",
|
|
11
|
+
iconButton: "uy-ml-200"
|
|
11
12
|
},
|
|
12
13
|
variants: {
|
|
13
14
|
isTitleSrOnly: {
|
|
@@ -20,14 +21,14 @@ const h = f({
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
}),
|
|
24
|
-
({ title: t, isTitleSrOnly:
|
|
25
|
-
const e = d(
|
|
24
|
+
}), b = u(
|
|
25
|
+
({ title: t, isTitleSrOnly: n, displayCloseButton: a }, r) => {
|
|
26
|
+
const e = d(y), s = f(), { base: l, heading: i, iconButton: c } = v({ isTitleSrOnly: n });
|
|
26
27
|
return /* @__PURE__ */ m("div", { className: l(), children: [
|
|
27
28
|
/* @__PURE__ */ o(
|
|
28
|
-
|
|
29
|
+
p,
|
|
29
30
|
{
|
|
30
|
-
ref:
|
|
31
|
+
ref: r,
|
|
31
32
|
slot: "title",
|
|
32
33
|
className: i(),
|
|
33
34
|
"data-dd-privacy": "allow",
|
|
@@ -35,10 +36,11 @@ const h = f({
|
|
|
35
36
|
}
|
|
36
37
|
),
|
|
37
38
|
a && /* @__PURE__ */ o(
|
|
38
|
-
|
|
39
|
+
h,
|
|
39
40
|
{
|
|
40
41
|
variant: "ghost",
|
|
41
42
|
color: "neutral",
|
|
43
|
+
className: c(),
|
|
42
44
|
label: s.formatMessage({
|
|
43
45
|
id: "unity:component:common:close:label",
|
|
44
46
|
defaultMessage: "Close"
|
|
@@ -50,7 +52,7 @@ const h = f({
|
|
|
50
52
|
] });
|
|
51
53
|
}
|
|
52
54
|
);
|
|
53
|
-
|
|
55
|
+
b.displayName = "PopoverTitle";
|
|
54
56
|
export {
|
|
55
|
-
|
|
57
|
+
b as PopoverHeader
|
|
56
58
|
};
|
|
@@ -10,7 +10,7 @@ import { RadioButtonHelper as w } from "./RadioButtonHelper.js";
|
|
|
10
10
|
const F = x({
|
|
11
11
|
slots: {
|
|
12
12
|
base: [
|
|
13
|
-
"uy-group uy-flex uy-gap-100 uy-rounded-50 uy-items-center",
|
|
13
|
+
"uy-group uy-flex uy-gap-100 uy-rounded-50 uy-items-center uy-cursor-pointer",
|
|
14
14
|
"data-[disabled]:uy-cursor-not-allowed",
|
|
15
15
|
"data-[readonly]:uy-cursor-not-allowed"
|
|
16
16
|
],
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { within as i, userEvent as t, screen as o } from "storybook/test";
|
|
2
|
+
const r = (n) => ({ selectOption: async ({
|
|
3
|
+
labelText: e,
|
|
4
|
+
optionName: a
|
|
5
|
+
}) => {
|
|
6
|
+
await n.step(
|
|
7
|
+
`Select option "${a}" in "${e}"`,
|
|
8
|
+
async () => {
|
|
9
|
+
const c = i(n.canvasElement).getByLabelText(e, {
|
|
10
|
+
exact: !1
|
|
11
|
+
});
|
|
12
|
+
if (!c)
|
|
13
|
+
throw new Error(`Select not found for label ${e}`);
|
|
14
|
+
await t.click(c, { delay: 100 }), await t.click(
|
|
15
|
+
o.getByRole("option", { name: a }),
|
|
16
|
+
{
|
|
17
|
+
delay: 100
|
|
18
|
+
}
|
|
19
|
+
), await t.tab({ delay: 100 });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
} });
|
|
23
|
+
export {
|
|
24
|
+
r as getTestingUtilsSelect
|
|
25
|
+
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { ToggleGroupState } from 'react-stately';
|
|
2
|
-
export
|
|
2
|
+
export interface SelectableButtonGroupContextValue {
|
|
3
|
+
state: ToggleGroupState;
|
|
4
|
+
isInvalid?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const SelectableButtonGroupContext: import('react').Context<SelectableButtonGroupContextValue | null>;
|
|
@@ -2,7 +2,7 @@ import { AriaToggleButtonGroupProps } from 'react-aria';
|
|
|
2
2
|
import { Key } from 'react-stately';
|
|
3
3
|
import { VariantProps } from 'tailwind-variants';
|
|
4
4
|
export declare const selectableButtonGroup: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, "uy-flex uy-gap-100", import('tailwind-variants/dist/config.js').TVConfig<unknown, {} | {}>, {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, "uy-flex uy-gap-100", import('tailwind-variants/dist/config.js').TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
5
|
-
export interface SelectableButtonGroupProps extends VariantProps<typeof selectableButtonGroup>, Omit<AriaToggleButtonGroupProps, 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | '
|
|
5
|
+
export interface SelectableButtonGroupProps extends VariantProps<typeof selectableButtonGroup>, Omit<AriaToggleButtonGroupProps, 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'style'> {
|
|
6
6
|
/**
|
|
7
7
|
* The SelectableButton components to render within the group.
|
|
8
8
|
* Each child must be a SelectableButton component with a unique value prop.
|
|
@@ -26,6 +26,12 @@ export interface SelectableButtonGroupProps extends VariantProps<typeof selectab
|
|
|
26
26
|
* Required when using the component in controlled mode.
|
|
27
27
|
*/
|
|
28
28
|
onChange?: (keys: Key[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Marks the group and all contained buttons as invalid, applying error styles.
|
|
31
|
+
* Use this to indicate a validation error for the group.
|
|
32
|
+
*/
|
|
33
|
+
isInvalid?: boolean;
|
|
34
|
+
className?: string;
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
31
37
|
* A group component that manages the selection state of multiple SelectableButton components.
|
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useToggleButtonGroup as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d, useRef as m } from "react";
|
|
3
|
+
import { useToggleButtonGroup as f, mergeProps as s } from "react-aria";
|
|
4
4
|
import { useToggleGroupState as g } from "react-stately";
|
|
5
|
-
import { tv as
|
|
6
|
-
import { SelectableButtonGroupContext as
|
|
7
|
-
const G =
|
|
5
|
+
import { tv as v } from "tailwind-variants";
|
|
6
|
+
import { SelectableButtonGroupContext as y } from "./SelectableButtonGroup.context.js";
|
|
7
|
+
const G = v({
|
|
8
8
|
base: "uy-flex uy-gap-100"
|
|
9
|
-
}), S =
|
|
10
|
-
const t =
|
|
9
|
+
}), S = d((e, r) => {
|
|
10
|
+
const t = m(null), a = g({
|
|
11
11
|
...e,
|
|
12
12
|
selectedKeys: e.value,
|
|
13
13
|
defaultSelectedKeys: e.defaultValue,
|
|
14
|
-
onSelectionChange: (
|
|
15
|
-
var
|
|
16
|
-
(
|
|
14
|
+
onSelectionChange: (c) => {
|
|
15
|
+
var l;
|
|
16
|
+
(l = e.onChange) == null || l.call(e, Array.from(c));
|
|
17
17
|
}
|
|
18
|
-
}), { groupProps: n } =
|
|
19
|
-
return /* @__PURE__ */
|
|
18
|
+
}), { groupProps: n } = f(e, a, t), i = G({ className: e.className }), { ref: u } = s({ ref: t }, { ref: r });
|
|
19
|
+
return /* @__PURE__ */ o(
|
|
20
20
|
"div",
|
|
21
21
|
{
|
|
22
22
|
...n,
|
|
23
|
-
className:
|
|
24
|
-
ref:
|
|
23
|
+
className: i,
|
|
24
|
+
ref: u,
|
|
25
25
|
"data-dd-privacy": "allow",
|
|
26
|
-
|
|
26
|
+
"aria-invalid": e.isInvalid,
|
|
27
|
+
children: /* @__PURE__ */ o(
|
|
28
|
+
y.Provider,
|
|
29
|
+
{
|
|
30
|
+
value: { state: a, isInvalid: e.isInvalid },
|
|
31
|
+
children: e.children
|
|
32
|
+
}
|
|
33
|
+
)
|
|
27
34
|
}
|
|
28
35
|
);
|
|
29
36
|
});
|