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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/cjs/components/button/Button.d.cts +5 -2
  2. package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
  3. package/dist/cjs/components/data-table/DataTable.cjs +1 -1
  4. package/dist/cjs/components/data-table/DataTable.d.cts +3 -6
  5. package/dist/cjs/components/date-calendar/DateCalendar.cjs +1 -0
  6. package/dist/cjs/components/date-calendar/DateCalendar.d.cts +23 -0
  7. package/dist/cjs/components/date-calendar/hooks/useMonthsList.d.cts +4 -0
  8. package/dist/cjs/components/date-calendar/hooks/useYearsList.d.cts +10 -0
  9. package/dist/cjs/components/date-picker/DatePicker.cjs +1 -1
  10. package/dist/cjs/components/date-picker/DatePicker.d.cts +3 -3
  11. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.cjs +1 -0
  12. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.d.cts +23 -0
  13. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.cjs +1 -1
  14. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.d.cts +2 -2
  15. package/dist/cjs/components/icon-button/CircularIconButton.cjs +1 -1
  16. package/dist/cjs/components/icon-button/CircularIconButton.d.cts +0 -21
  17. package/dist/cjs/components/icon-button/IconButton.d.cts +1 -1
  18. package/dist/cjs/components/number-field/NumberField.cjs +1 -0
  19. package/dist/cjs/components/number-field/NumberField.d.cts +47 -0
  20. package/dist/cjs/components/number-input/NumberInput.cjs +1 -0
  21. package/dist/cjs/components/number-input/NumberInput.d.cts +216 -0
  22. package/dist/cjs/components/pagination/Pagination.cjs +1 -1
  23. package/dist/cjs/components/pagination/hooks/use-pagination.cjs +1 -1
  24. package/dist/cjs/components/pagination/hooks/use-pagination.d.cts +2 -1
  25. package/dist/cjs/components/popover/Popover.cjs +1 -1
  26. package/dist/cjs/components/popover/parts/PopoverHeader.cjs +1 -1
  27. package/dist/cjs/components/radio-button-group/parts/RadioButton.cjs +1 -1
  28. package/dist/cjs/components/select-field/test-utils.cjs +1 -0
  29. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.cjs +1 -1
  30. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.context.d.cts +5 -1
  31. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.d.cts +7 -1
  32. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.cjs +1 -1
  33. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.d.cts +35 -0
  34. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.cjs +1 -0
  35. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.d.cts +59 -0
  36. package/dist/cjs/components/side-panel/SidePanel.cjs +1 -1
  37. package/dist/cjs/components/side-panel/SidePanel.d.cts +6 -0
  38. package/dist/cjs/components/table/Table.cjs +1 -1
  39. package/dist/cjs/components/table/Table.d.cts +4 -0
  40. package/dist/cjs/components/table/parts/TableCell.cjs +1 -1
  41. package/dist/cjs/components/tabs/parts/NavigationButton.cjs +1 -1
  42. package/dist/cjs/components/tabs/parts/TabList.cjs +1 -1
  43. package/dist/cjs/components/text/Text.cjs +1 -1
  44. package/dist/cjs/components/text/Text.d.cts +1 -1
  45. package/dist/cjs/components/text/Text.variants.cjs +1 -1
  46. package/dist/cjs/components/text/Text.variants.d.cts +7 -0
  47. package/dist/cjs/components/tooltip/Tooltip.cjs +1 -1
  48. package/dist/cjs/components/tooltip/Tooltip.d.cts +4 -3
  49. package/dist/cjs/index.cjs +1 -1
  50. package/dist/cjs/index.d.cts +5 -0
  51. package/dist/cjs/index.storybook-testing.d.cts +1 -0
  52. package/dist/cjs/storybook-testing.cjs +1 -1
  53. package/dist/esm/components/button/Button.d.ts +5 -2
  54. package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
  55. package/dist/esm/components/data-table/DataTable.d.ts +3 -6
  56. package/dist/esm/components/data-table/DataTable.js +61 -56
  57. package/dist/esm/components/date-calendar/DateCalendar.d.ts +23 -0
  58. package/dist/esm/components/{date-picker/parts → date-calendar}/DateCalendar.js +62 -60
  59. package/dist/esm/components/date-calendar/hooks/useMonthsList.d.ts +4 -0
  60. package/dist/esm/components/date-calendar/hooks/useYearsList.d.ts +10 -0
  61. package/dist/esm/components/date-picker/DatePicker.d.ts +3 -3
  62. package/dist/esm/components/date-picker/DatePicker.js +22 -22
  63. package/dist/esm/components/definition-tooltip/DefinitionTooltip.d.ts +23 -0
  64. package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +29 -0
  65. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +2 -2
  66. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +31 -27
  67. package/dist/esm/components/icon-button/CircularIconButton.d.ts +0 -21
  68. package/dist/esm/components/icon-button/CircularIconButton.js +23 -26
  69. package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
  70. package/dist/esm/components/number-field/NumberField.d.ts +47 -0
  71. package/dist/esm/components/number-field/NumberField.js +71 -0
  72. package/dist/esm/components/number-input/NumberInput.d.ts +216 -0
  73. package/dist/esm/components/number-input/NumberInput.js +214 -0
  74. package/dist/esm/components/pagination/Pagination.js +17 -16
  75. package/dist/esm/components/pagination/hooks/use-pagination.d.ts +2 -1
  76. package/dist/esm/components/pagination/hooks/use-pagination.js +12 -11
  77. package/dist/esm/components/popover/Popover.js +25 -21
  78. package/dist/esm/components/popover/parts/PopoverHeader.js +17 -15
  79. package/dist/esm/components/radio-button-group/parts/RadioButton.js +1 -1
  80. package/dist/esm/components/select-field/test-utils.js +25 -0
  81. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +5 -1
  82. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +7 -1
  83. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -16
  84. package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +35 -0
  85. package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +44 -36
  86. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +59 -0
  87. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.js +45 -0
  88. package/dist/esm/components/side-panel/SidePanel.d.ts +6 -0
  89. package/dist/esm/components/side-panel/SidePanel.js +38 -35
  90. package/dist/esm/components/table/Table.d.ts +4 -0
  91. package/dist/esm/components/table/Table.js +96 -71
  92. package/dist/esm/components/table/parts/TableCell.js +5 -5
  93. package/dist/esm/components/tabs/parts/NavigationButton.js +4 -4
  94. package/dist/esm/components/tabs/parts/TabList.js +44 -35
  95. package/dist/esm/components/text/Text.d.ts +1 -1
  96. package/dist/esm/components/text/Text.js +6 -5
  97. package/dist/esm/components/text/Text.variants.d.ts +7 -0
  98. package/dist/esm/components/text/Text.variants.js +2 -1
  99. package/dist/esm/components/tooltip/Tooltip.d.ts +4 -3
  100. package/dist/esm/components/tooltip/Tooltip.js +13 -12
  101. package/dist/esm/index.d.ts +5 -0
  102. package/dist/esm/index.js +237 -225
  103. package/dist/esm/index.storybook-testing.d.ts +1 -0
  104. package/dist/esm/storybook-testing.js +3 -1
  105. package/i18n/en-GB.json +2 -0
  106. package/i18n/es-ES.json +2 -0
  107. package/i18n/fr-FR.json +2 -0
  108. package/package.json +7 -6
  109. package/dist/cjs/components/date-picker/parts/DateCalendar.cjs +0 -1
  110. package/dist/cjs/components/date-picker/parts/DateCalendar.d.cts +0 -9
  111. package/dist/cjs/components/popover/parts/PopoverContent.cjs +0 -1
  112. package/dist/esm/components/date-picker/parts/DateCalendar.d.ts +0 -9
  113. package/dist/esm/components/popover/parts/PopoverContent.js +0 -9
  114. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useMonthsList.cjs +0 -0
  115. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useYearsList.cjs +0 -0
  116. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.cjs +0 -0
  117. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.cts +0 -0
  118. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useMonthsList.js +0 -0
  119. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useYearsList.js +0 -0
  120. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.ts +0 -0
  121. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.js +0 -0
@@ -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 w } from "./parts/PaginationNavButton.js";
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
- ...D
28
- }, A) => {
29
- const v = R(), u = W(), L = d !== void 0 && g !== void 0 && p === void 0, { currentPage: s, goToPage: n } = J({
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: L ? d : p,
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
- }, y = (a, e) => {
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
- }, b = {
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
- ...D,
97
- ref: A,
97
+ ...A,
98
+ ref: L,
98
99
  className: I(),
99
- "aria-labelledby": b.paginationLabel,
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
- w,
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": b.pageListLabel, children: h.map(
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
- y(t, a.value);
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
- y(t, -1);
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
- w,
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 l, useCallback as o } from "react";
2
- function m({
3
- pageCount: i,
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 [t, a] = l(r), c = t - 1, u = t + 1, s = o(
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)), a(Math.max(1, Math.min(i, e)));
10
+ n && n(e, t, Math.sign(e - t)), u(Math.max(1, Math.min(o, e)));
10
11
  },
11
- [t, i, n]
12
- ), f = o(
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: c,
21
- nextPage: u,
22
- goToPage: f
21
+ previousPage: f,
22
+ nextPage: l,
23
+ goToPage: P
23
24
  };
24
25
  }
25
26
  export {
26
- m as usePagination
27
+ h as usePagination
27
28
  };
@@ -1,37 +1,41 @@
1
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import { Popover as m, Dialog as n, DialogTrigger as y } from "react-aria-components";
4
- import { DialogTrigger as B } from "react-aria-components";
5
- import { tv as g } from "tailwind-variants";
6
- import { PopoverContent as c } from "./parts/PopoverContent.js";
7
- import { PopoverHeader as v } from "./parts/PopoverHeader.js";
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
- }), P = f((r, e) => {
19
- const { children: i, title: s, isTitleSrOnly: t, displayCloseButton: l, ...a } = r, { base: p, dialog: u } = x();
20
- return /* @__PURE__ */ o(m, { ref: e, className: p(), offset: 8, ...a, children: /* @__PURE__ */ d(n, { className: u(), role: "dialog", children: [
21
- /* @__PURE__ */ o(
22
- v,
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: s,
25
- isTitleSrOnly: t,
28
+ title: o,
29
+ isTitleSrOnly: n,
26
30
  displayCloseButton: l
27
31
  }
28
32
  ),
29
- /* @__PURE__ */ o(c, { children: i })
33
+ r
30
34
  ] }) });
31
35
  });
32
- P.displayName = "Popover";
33
- y.displayName = "PopoverTrigger";
36
+ b.displayName = "Popover";
37
+ m.displayName = "PopoverTrigger";
34
38
  export {
35
- P as Popover,
36
- B as PopoverTrigger
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 c, useContext as d } from "react";
3
- import { OverlayTriggerStateContext as u, Heading as y } from "react-aria-components";
4
- import { useIntl as p } from "react-intl";
5
- import { tv as f } from "tailwind-variants";
6
- import { IconButton as g } from "../../icon-button/IconButton.js";
7
- const h = f({
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
- }), v = c(
24
- ({ title: t, isTitleSrOnly: r, displayCloseButton: a }, n) => {
25
- const e = d(u), s = p(), { base: l, heading: i } = h({ isTitleSrOnly: r });
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
- y,
29
+ p,
29
30
  {
30
- ref: n,
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
- g,
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
- v.displayName = "PopoverTitle";
55
+ b.displayName = "PopoverTitle";
54
56
  export {
55
- v as PopoverHeader
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 declare const SelectableButtonGroupContext: import('react').Context<ToggleGroupState | null>;
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' | 'className' | 'style'> {
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 l } from "react/jsx-runtime";
2
- import { forwardRef as m, useRef as d } from "react";
3
- import { useToggleButtonGroup as i, mergeProps as s } from "react-aria";
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 y } from "tailwind-variants";
6
- import { SelectableButtonGroupContext as v } from "./SelectableButtonGroup.context.js";
7
- const G = y({
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 = m((e, a) => {
10
- const t = d(null), o = g({
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: (f) => {
15
- var r;
16
- (r = e.onChange) == null || r.call(e, Array.from(f));
14
+ onSelectionChange: (c) => {
15
+ var l;
16
+ (l = e.onChange) == null || l.call(e, Array.from(c));
17
17
  }
18
- }), { groupProps: n } = i(e, o, t), u = G(), { ref: c } = s({ ref: t }, { ref: a });
19
- return /* @__PURE__ */ l(
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: u,
24
- ref: c,
23
+ className: i,
24
+ ref: u,
25
25
  "data-dd-privacy": "allow",
26
- children: /* @__PURE__ */ l(v.Provider, { value: o, children: e.children })
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
  });