@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.
Files changed (104) hide show
  1. package/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
  2. package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
  3. package/dist/esm/adapters/zodAdapter.d.ts +13 -0
  4. package/dist/esm/adapters/zodAdapter.js +74 -0
  5. package/dist/esm/components/action-bar/ActionBar.js +62 -64
  6. package/dist/esm/components/actionable/Actionable.d.ts +50 -3
  7. package/dist/esm/components/actionable/Actionable.js +49 -39
  8. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
  9. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  10. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
  11. package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
  12. package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
  13. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
  14. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
  15. package/dist/esm/components/code/Code.d.ts +37 -0
  16. package/dist/esm/components/code/Code.js +39 -0
  17. package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
  18. package/dist/esm/components/code/copyToClipboard.js +10 -0
  19. package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
  20. package/dist/esm/components/collapsible/Collapsible.js +14 -13
  21. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
  22. package/dist/esm/components/data-table/DataTable.d.ts +76 -10
  23. package/dist/esm/components/data-table/DataTable.js +81 -78
  24. package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
  25. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
  26. package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
  27. package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
  28. package/dist/esm/components/date-picker/DatePicker.js +64 -64
  29. package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
  30. package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
  31. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
  32. package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
  33. package/dist/esm/components/error-state/ErrorState.js +153 -0
  34. package/dist/esm/components/error-state/initConfig.d.ts +16 -0
  35. package/dist/esm/components/error-state/initConfig.js +149 -0
  36. package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
  37. package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
  38. package/dist/esm/components/form/Form.d.ts +15 -9
  39. package/dist/esm/components/form/Form.js +53 -50
  40. package/dist/esm/components/form-field/FormField.js +24 -23
  41. package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
  42. package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
  43. package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
  44. package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
  45. package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
  46. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
  47. package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
  48. package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
  49. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  50. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
  51. package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
  52. package/dist/esm/components/input/Input.js +28 -28
  53. package/dist/esm/components/label/Label.js +19 -19
  54. package/dist/esm/components/multi-select/MultiSelect.js +94 -94
  55. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
  56. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
  57. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
  58. package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
  59. package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
  60. package/dist/esm/components/nav/parts/NavGroup.js +21 -21
  61. package/dist/esm/components/number-field/NumberField.d.ts +3 -3
  62. package/dist/esm/components/number-input/NumberInput.js +58 -58
  63. package/dist/esm/components/pagination/Pagination.js +97 -101
  64. package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
  65. package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
  66. package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
  67. package/dist/esm/components/select-field/SelectField.d.ts +2 -2
  68. package/dist/esm/components/select-field/SelectField.js +4 -1
  69. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
  70. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
  71. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
  72. package/dist/esm/components/skip-links/SkipLinks.js +50 -43
  73. package/dist/esm/components/table/Table.js +79 -76
  74. package/dist/esm/components/table/parts/TableBody.js +6 -6
  75. package/dist/esm/components/table/parts/TableCell.js +25 -25
  76. package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
  77. package/dist/esm/components/table/parts/TablePagination.js +61 -59
  78. package/dist/esm/components/table/parts/TableRow.js +16 -16
  79. package/dist/esm/components/tabs/parts/TabList.js +50 -54
  80. package/dist/esm/components/task-menu/parts/Content.js +24 -24
  81. package/dist/esm/components/task-menu/parts/Header.js +24 -24
  82. package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
  83. package/dist/esm/components/task-menu/parts/Task.js +69 -69
  84. package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
  85. package/dist/esm/components/text-area/TextArea.js +30 -31
  86. package/dist/esm/components/text-field/TextField.d.ts +2 -2
  87. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
  88. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
  89. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
  90. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
  91. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
  92. package/dist/esm/hooks/use-form.d.ts +5 -5
  93. package/dist/esm/hooks/use-form.types.d.ts +2 -2
  94. package/dist/esm/hooks/use-resizable.js +13 -14
  95. package/dist/esm/index.d.ts +1 -0
  96. package/dist/esm/index.js +22 -19
  97. package/dist/esm/types/schema.d.ts +8 -0
  98. package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
  99. package/dist/esm/utils/createSchemaAdapter.js +13 -0
  100. package/dist/esm/utils/platform.js +2 -3
  101. package/i18n/en-GB.json +16 -0
  102. package/i18n/es-ES.json +16 -0
  103. package/i18n/fr-FR.json +16 -0
  104. package/package.json +25 -19
@@ -1,16 +1,16 @@
1
- import { jsxs as s, jsx as t, Fragment as f } from "react/jsx-runtime";
2
- import { forwardRef as O, useEffect as z } from "react";
3
- import { uyTv as E } from "@payfit/unity-themes";
4
- import { Link as F, Button as R } from "react-aria-components";
5
- import { useIntl as A, FormattedMessage as g } from "react-intl";
6
- import { useRouter as D } from "../../../providers/router/RouterProvider.js";
7
- import { Icon as y } from "../../icon/Icon.js";
8
- import { Text as I } from "../../text/Text.js";
9
- import { useTaskMenuContext as V } from "../TaskMenu.context.js";
10
- import G from "./dot.svg.js";
11
- import { commonTask as H } from "./task.variants.js";
12
- const J = E({
13
- extend: H,
1
+ import { jsxs as a, jsx as e, Fragment as d } from "react/jsx-runtime";
2
+ import { forwardRef as L, useEffect as j } from "react";
3
+ import { uyTv as O } from "@payfit/unity-themes";
4
+ import { Link as z, Button as E } from "react-aria-components";
5
+ import { useIntl as F, FormattedMessage as i } from "react-intl";
6
+ import { useRouter as P } from "../../../providers/router/RouterProvider.js";
7
+ import { Icon as p } from "../../icon/Icon.js";
8
+ import { Text as R } from "../../text/Text.js";
9
+ import { useTaskMenuContext as A } from "../TaskMenu.context.js";
10
+ import D from "./dot.svg.js";
11
+ import { commonTask as I } from "./task.variants.js";
12
+ const V = O({
13
+ extend: I,
14
14
  slots: {
15
15
  base: ["uy:gap-300 uy:py-100", "uy:md:py-50"],
16
16
  dot: ["uy:self-center"],
@@ -71,25 +71,25 @@ const J = E({
71
71
  }
72
72
  }
73
73
  ]
74
- }), K = (o, n, e) => {
75
- switch (o) {
74
+ }), B = (t, o, n) => {
75
+ switch (t) {
76
76
  case "completed":
77
- return /* @__PURE__ */ s(f, { children: [
78
- /* @__PURE__ */ t(
79
- y,
77
+ return /* @__PURE__ */ a(d, { children: [
78
+ /* @__PURE__ */ e(
79
+ p,
80
80
  {
81
- className: e == null ? void 0 : e.completed,
81
+ className: n?.completed,
82
82
  src: "CheckCircleOutlined",
83
83
  size: 20,
84
84
  color: "content.success",
85
- alt: n.formatMessage({
85
+ alt: o.formatMessage({
86
86
  id: "unity:component:task-menu:task:completed:label",
87
87
  defaultMessage: "Completed"
88
88
  })
89
89
  }
90
90
  ),
91
- /* @__PURE__ */ t("span", { className: "uy:sr-only", children: /* @__PURE__ */ t(
92
- g,
91
+ /* @__PURE__ */ e("span", { className: "uy:sr-only", children: /* @__PURE__ */ e(
92
+ i,
93
93
  {
94
94
  id: "unity:component:task-menu:task:completed:label",
95
95
  defaultMessage: "Completed"
@@ -97,23 +97,23 @@ const J = E({
97
97
  ) })
98
98
  ] });
99
99
  case "locked":
100
- return /* @__PURE__ */ s(f, { children: [
101
- /* @__PURE__ */ t(
102
- y,
100
+ return /* @__PURE__ */ a(d, { children: [
101
+ /* @__PURE__ */ e(
102
+ p,
103
103
  {
104
104
  "aria-hidden": "true",
105
- className: e == null ? void 0 : e.locked,
105
+ className: n?.locked,
106
106
  src: "LockOutlined",
107
107
  size: 20,
108
108
  color: "content.neutral.lowest",
109
- alt: n.formatMessage({
109
+ alt: o.formatMessage({
110
110
  id: "unity:component:task-menu:task:lock:label",
111
111
  defaultMessage: "Locked"
112
112
  })
113
113
  }
114
114
  ),
115
- /* @__PURE__ */ t("span", { className: "uy:sr-only", children: /* @__PURE__ */ t(
116
- g,
115
+ /* @__PURE__ */ e("span", { className: "uy:sr-only", children: /* @__PURE__ */ e(
116
+ i,
117
117
  {
118
118
  id: "unity:component:task-menu:task:lock:label",
119
119
  defaultMessage: "Locked"
@@ -123,63 +123,63 @@ const J = E({
123
123
  default:
124
124
  return null;
125
125
  }
126
- }, Q = O(
126
+ }, G = L(
127
127
  ({
128
- href: o,
129
- label: n,
130
- taskStatus: e = "uncompleted",
131
- isExact: i,
132
- isDisabled: b,
133
- onPress: d,
128
+ href: t,
129
+ label: o,
130
+ taskStatus: n = "uncompleted",
131
+ isExact: l,
132
+ isDisabled: y,
133
+ onPress: f,
134
134
  uniqueId: r,
135
- ...p
136
- }, h) => {
137
- const k = A(), u = D(), { currentTask: a, setCurrentTask: l, state: m } = V();
138
- z(() => {
139
- o && (u != null && u.isActive(o.toString(), i)) && (l == null || l({ uniqueId: r, label: n }));
140
- }, [o, i, u, r, n]);
141
- const c = (a == null ? void 0 : a.uniqueId) === r, { base: v, element: M, text: w, dot: L, lock: S } = J({
142
- isSelected: c,
143
- taskStatus: e
144
- }), j = Object.assign(
135
+ ...c
136
+ }, g) => {
137
+ const k = F(), u = P(), { currentTask: b, setCurrentTask: m, state: h } = A();
138
+ j(() => {
139
+ t && u?.isActive(t.toString(), l) && m?.({ uniqueId: r, label: o });
140
+ }, [t, l, u, r, o]);
141
+ const s = b?.uniqueId === r, { base: v, element: S, text: x, dot: N, lock: M } = V({
142
+ isSelected: s,
143
+ taskStatus: n
144
+ }), T = Object.assign(
145
145
  {},
146
- c !== void 0 && {
147
- "data-current": c,
148
- "aria-current": c ? "page" : void 0
146
+ s !== void 0 && {
147
+ "data-current": s,
148
+ "aria-current": s ? "page" : void 0
149
149
  }
150
- ), x = o ? F : R;
151
- return /* @__PURE__ */ s(
150
+ ), w = t ? z : E;
151
+ return /* @__PURE__ */ a(
152
152
  "li",
153
153
  {
154
- ref: h,
154
+ ref: g,
155
155
  className: v(),
156
- ...c ? { "data-current": !0 } : {},
157
- ...p,
156
+ ...s ? { "data-current": !0 } : {},
157
+ ...c,
158
158
  children: [
159
- /* @__PURE__ */ t(G, { width: 8, height: 8, className: L(), role: "presentation" }),
160
- /* @__PURE__ */ s(
161
- x,
159
+ /* @__PURE__ */ e(D, { width: 8, height: 8, className: N(), role: "presentation" }),
160
+ /* @__PURE__ */ a(
161
+ w,
162
162
  {
163
- className: M(),
164
- href: o,
165
- onPress: (N) => {
166
- l == null || l({ uniqueId: r, label: n }), m == null || m.toggle(), d == null || d(N);
163
+ className: S(),
164
+ href: t,
165
+ onPress: (C) => {
166
+ m?.({ uniqueId: r, label: o }), h?.toggle(), f?.(C);
167
167
  },
168
- isDisabled: b,
169
- ...j,
170
- ...p,
168
+ isDisabled: y,
169
+ ...T,
170
+ ...c,
171
171
  children: [
172
- /* @__PURE__ */ t(
173
- I,
172
+ /* @__PURE__ */ e(
173
+ R,
174
174
  {
175
175
  asElement: "span",
176
- className: w(),
177
- variant: c ? "bodyStrong" : "body",
178
- children: n
176
+ className: x(),
177
+ variant: s ? "bodyStrong" : "body",
178
+ children: o
179
179
  }
180
180
  ),
181
- K(e, k, {
182
- locked: S(),
181
+ B(n, k, {
182
+ locked: M(),
183
183
  completed: "uy:self-center"
184
184
  })
185
185
  ]
@@ -190,8 +190,8 @@ const J = E({
190
190
  );
191
191
  }
192
192
  );
193
- Q.displayName = "SubTask";
193
+ G.displayName = "SubTask";
194
194
  export {
195
- Q as SubTask,
196
- J as subTask
195
+ G as SubTask,
196
+ V as subTask
197
197
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as l, jsx as e, Fragment as k } from "react/jsx-runtime";
2
- import { forwardRef as w, useEffect as z } from "react";
3
- import { uyTv as A } from "@payfit/unity-themes";
4
- import { Link as B, Button as C } from "react-aria-components";
5
- import { useIntl as V, FormattedMessage as b } from "react-intl";
6
- import { useRouter as D } from "../../../providers/router/RouterProvider.js";
7
- import { Icon as h } from "../../icon/Icon.js";
8
- import { Text as v } from "../../text/Text.js";
9
- import { useTaskMenuContext as G } from "../TaskMenu.context.js";
10
- import { commonTask as H } from "./task.variants.js";
11
- const I = A({
12
- extend: H,
1
+ import { jsxs as r, jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { forwardRef as G, useEffect as P } from "react";
3
+ import { uyTv as R } from "@payfit/unity-themes";
4
+ import { Link as w, Button as z } from "react-aria-components";
5
+ import { useIntl as A, FormattedMessage as g } from "react-intl";
6
+ import { useRouter as B } from "../../../providers/router/RouterProvider.js";
7
+ import { Icon as y } from "../../icon/Icon.js";
8
+ import { Text as k } from "../../text/Text.js";
9
+ import { useTaskMenuContext as V } from "../TaskMenu.context.js";
10
+ import { commonTask as D } from "./task.variants.js";
11
+ const H = R({
12
+ extend: D,
13
13
  slots: {
14
14
  base: [],
15
15
  element: ["uy:p-200", "uy:md:p-0"],
@@ -55,103 +55,103 @@ const I = A({
55
55
  }
56
56
  }
57
57
  ]
58
- }), J = w(
58
+ }), I = G(
59
59
  ({
60
- href: n,
61
- isExact: p = !1,
62
- label: s,
63
- onPress: m,
64
- taskNumber: x,
65
- taskStatus: c = "uncompleted",
66
- children: N,
67
- uniqueId: o,
68
- ...y
69
- }, S) => {
70
- const r = D(), g = V(), {
71
- currentTask: u,
72
- setCurrentTask: t,
73
- state: d,
74
- expandedTaskGroup: f,
75
- toggleTaskGroup: i
76
- } = G(), M = n ? B : C;
77
- z(() => {
78
- n && (r != null && r.isActive(n.toString(), p)) && (t == null || t({ uniqueId: o, label: s }));
79
- }, [n, p, r, s, o]);
80
- const a = (u == null ? void 0 : u.uniqueId) === o, L = Object.assign(
60
+ href: s,
61
+ isExact: l = !1,
62
+ label: a,
63
+ onPress: f,
64
+ taskNumber: b,
65
+ taskStatus: o = "uncompleted",
66
+ children: h,
67
+ uniqueId: n,
68
+ ...u
69
+ }, v) => {
70
+ const c = B(), m = A(), {
71
+ currentTask: x,
72
+ setCurrentTask: d,
73
+ state: N,
74
+ expandedTaskGroup: i,
75
+ toggleTaskGroup: T
76
+ } = V(), S = s ? w : z;
77
+ P(() => {
78
+ s && c?.isActive(s.toString(), l) && d?.({ uniqueId: n, label: a });
79
+ }, [s, l, c, a, n]);
80
+ const t = x?.uniqueId === n, M = Object.assign(
81
81
  {},
82
- a !== void 0 && {
83
- "data-current": a,
84
- "aria-current": a ? "page" : void 0
82
+ t !== void 0 && {
83
+ "data-current": t,
84
+ "aria-current": t ? "page" : void 0
85
85
  }
86
- ), { base: j, number: E, element: O, text: F, lock: R } = I({
87
- isSelected: a,
88
- taskStatus: c
86
+ ), { base: C, number: L, element: j, text: E, lock: O } = H({
87
+ isSelected: t,
88
+ taskStatus: o
89
89
  });
90
- return /* @__PURE__ */ l("li", { ref: S, className: j(), ...y, children: [
91
- /* @__PURE__ */ l(
92
- M,
90
+ return /* @__PURE__ */ r("li", { ref: v, className: C(), ...u, children: [
91
+ /* @__PURE__ */ r(
92
+ S,
93
93
  {
94
- className: O(),
95
- href: n,
96
- onPress: (T) => {
97
- t == null || t({ uniqueId: o, label: s }), d == null || d.toggle(), f && (i == null || i(f)), m == null || m(T);
94
+ className: j(),
95
+ href: s,
96
+ onPress: (F) => {
97
+ d?.({ uniqueId: n, label: a }), N?.toggle(), i && T?.(i), f?.(F);
98
98
  },
99
- ...L,
100
- ...y,
99
+ ...M,
100
+ ...u,
101
101
  children: [
102
- /* @__PURE__ */ e("div", { className: E(), children: c === "completed" ? /* @__PURE__ */ l(k, { children: [
102
+ /* @__PURE__ */ e("div", { className: L(), children: o === "completed" ? /* @__PURE__ */ r(p, { children: [
103
103
  /* @__PURE__ */ e(
104
- h,
104
+ y,
105
105
  {
106
106
  size: 24,
107
107
  "aria-hidden": "true",
108
108
  src: "CheckOutlined",
109
- alt: g.formatMessage({
109
+ alt: m.formatMessage({
110
110
  id: "unity:component:task-menu:task:completed:label",
111
111
  defaultMessage: "Completed"
112
112
  })
113
113
  }
114
114
  ),
115
115
  /* @__PURE__ */ e("span", { className: "uy:sr-only", children: /* @__PURE__ */ e(
116
- b,
116
+ g,
117
117
  {
118
118
  id: "unity:component:task-menu:task:completed:label",
119
119
  defaultMessage: "Completed"
120
120
  }
121
121
  ) })
122
122
  ] }) : /* @__PURE__ */ e(
123
- v,
123
+ k,
124
124
  {
125
125
  asElement: "span",
126
- variant: a ? "bodyStrong" : "body",
126
+ variant: t ? "bodyStrong" : "body",
127
127
  className: "uy:leading-[1]",
128
- children: x
128
+ children: b
129
129
  }
130
130
  ) }),
131
131
  /* @__PURE__ */ e(
132
- v,
132
+ k,
133
133
  {
134
134
  asElement: "span",
135
- className: F(),
136
- variant: a ? "bodyStrong" : "body",
137
- children: s
135
+ className: E(),
136
+ variant: t ? "bodyStrong" : "body",
137
+ children: a
138
138
  }
139
139
  ),
140
- c === "locked" && /* @__PURE__ */ l(k, { children: [
140
+ o === "locked" && /* @__PURE__ */ r(p, { children: [
141
141
  /* @__PURE__ */ e(
142
- h,
142
+ y,
143
143
  {
144
144
  "aria-hidden": "true",
145
- className: R(),
145
+ className: O(),
146
146
  src: "LockOutlined",
147
- alt: g.formatMessage({
147
+ alt: m.formatMessage({
148
148
  id: "unity:component:task-menu:task:lock:label",
149
149
  defaultMessage: "Locked"
150
150
  })
151
151
  }
152
152
  ),
153
153
  /* @__PURE__ */ e("span", { className: "uy:sr-only", children: /* @__PURE__ */ e(
154
- b,
154
+ g,
155
155
  {
156
156
  id: "unity:component:task-menu:task:lock:label",
157
157
  defaultMessage: "Locked"
@@ -161,12 +161,12 @@ const I = A({
161
161
  ]
162
162
  }
163
163
  ),
164
- N
164
+ h
165
165
  ] });
166
166
  }
167
167
  );
168
- J.displayName = "Task";
168
+ I.displayName = "Task";
169
169
  export {
170
- J as Task,
171
- I as task
170
+ I as Task,
171
+ H as task
172
172
  };
@@ -1,11 +1,11 @@
1
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as j, Children as d, isValidElement as u, cloneElement as A } from "react";
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as j, Children as i, isValidElement as u, cloneElement as A } from "react";
3
3
  import { uyTv as V } from "@payfit/unity-themes";
4
4
  import { useId as $ } from "react-aria";
5
5
  import { Button as B } from "react-aria-components";
6
6
  import { useIntl as D } from "react-intl";
7
7
  import { Icon as F } from "../../icon/Icon.js";
8
- import { Text as g } from "../../text/Text.js";
8
+ import { Text as f } from "../../text/Text.js";
9
9
  import { useTaskMenuContext as H } from "../TaskMenu.context.js";
10
10
  import { commonTask as O } from "./task.variants.js";
11
11
  const P = V({
@@ -71,56 +71,56 @@ const P = V({
71
71
  }
72
72
  }
73
73
  ]
74
- }), R = (e, t) => e ? d.toArray(t).some(
75
- (r) => u(r) && r.props.uniqueId === e
76
- ) : !1, U = (e) => e ? d.toArray(e).find(
74
+ }), R = (e, t) => e ? i.toArray(t).some(
75
+ (s) => u(s) && s.props.uniqueId === e
76
+ ) : !1, U = (e) => e ? i.toArray(e).find(
77
77
  (t) => u(t) && t.props.taskStatus !== "completed" && t.props.taskStatus !== "locked"
78
78
  ) : null, J = j(
79
79
  ({
80
80
  children: e,
81
81
  label: t,
82
- taskNumber: r,
83
- taskStatus: p = "uncompleted",
84
- uniqueId: y,
85
- ...S
86
- }, h) => {
87
- const { currentTask: l, setCurrentTask: i, toggleTaskGroup: m, expandedTaskGroup: k } = H(), b = $(), T = D(), a = k === y, N = (o) => {
88
- if (m == null || m(y), !o) {
89
- const x = U(e);
90
- if (u(x)) {
91
- const { uniqueId: M, label: W } = x.props;
92
- i == null || i({ uniqueId: M, label: W });
82
+ taskNumber: s,
83
+ taskStatus: m = "uncompleted",
84
+ uniqueId: c,
85
+ ...g
86
+ }, k) => {
87
+ const { currentTask: v, setCurrentTask: x, toggleTaskGroup: S, expandedTaskGroup: h } = H(), d = $(), T = D(), a = h === c, N = (n) => {
88
+ if (S?.(c), !n) {
89
+ const b = U(e);
90
+ if (u(b)) {
91
+ const { uniqueId: M, label: W } = b.props;
92
+ x?.({ uniqueId: M, label: W });
93
93
  }
94
94
  }
95
- }, I = d.map(e, (o) => u(o) ? A(o, { isDisabled: !a }) : o), f = `${b}-toggle`, v = `${b}-content`, s = R(
96
- l == null ? void 0 : l.uniqueId,
95
+ }, I = i.map(e, (n) => u(n) ? A(n, { isDisabled: !a }) : n), p = `${d}-toggle`, y = `${d}-content`, o = R(
96
+ v?.uniqueId,
97
97
  e
98
- ), { base: w, number: E, text: z, bar: q, element: C, containerSubTasks: G } = P({
99
- taskStatus: p,
100
- hasSelectedSubTask: s,
98
+ ), { base: w, number: C, text: E, bar: G, element: z, containerSubTasks: q } = P({
99
+ taskStatus: m,
100
+ hasSelectedSubTask: o,
101
101
  expanded: a
102
102
  });
103
- return /* @__PURE__ */ c(
103
+ return /* @__PURE__ */ l(
104
104
  "li",
105
105
  {
106
- ref: h,
106
+ ref: k,
107
107
  "data-group": "true",
108
- "data-active-group": s,
108
+ "data-active-group": o,
109
109
  className: w(),
110
110
  children: [
111
- /* @__PURE__ */ c(
111
+ /* @__PURE__ */ l(
112
112
  B,
113
113
  {
114
- id: f,
115
- className: C(),
114
+ id: p,
115
+ className: z(),
116
116
  onPress: () => {
117
117
  N(a);
118
118
  },
119
119
  "aria-expanded": a,
120
- "aria-controls": v,
121
- ...S,
120
+ "aria-controls": y,
121
+ ...g,
122
122
  children: [
123
- /* @__PURE__ */ n("div", { className: E(), children: p === "completed" ? /* @__PURE__ */ n(
123
+ /* @__PURE__ */ r("div", { className: C(), children: m === "completed" ? /* @__PURE__ */ r(
124
124
  F,
125
125
  {
126
126
  size: 24,
@@ -130,39 +130,39 @@ const P = V({
130
130
  defaultMessage: "Completed"
131
131
  })
132
132
  }
133
- ) : /* @__PURE__ */ n(
134
- g,
133
+ ) : /* @__PURE__ */ r(
134
+ f,
135
135
  {
136
136
  asElement: "span",
137
- variant: s ? "bodyStrong" : "body",
137
+ variant: o ? "bodyStrong" : "body",
138
138
  className: "uy:leading-[1]",
139
- children: r
139
+ children: s
140
140
  }
141
141
  ) }),
142
- /* @__PURE__ */ n(
143
- g,
142
+ /* @__PURE__ */ r(
143
+ f,
144
144
  {
145
145
  asElement: "span",
146
- className: z(),
147
- variant: s ? "bodyStrong" : "body",
146
+ className: E(),
147
+ variant: o ? "bodyStrong" : "body",
148
148
  children: t
149
149
  }
150
150
  )
151
151
  ]
152
152
  }
153
153
  ),
154
- /* @__PURE__ */ c("div", { style: { maxHeight: a ? 1e3 : 0 }, children: [
155
- /* @__PURE__ */ n(
154
+ /* @__PURE__ */ l("div", { style: { maxHeight: a ? 1e3 : 0 }, children: [
155
+ /* @__PURE__ */ r(
156
156
  "ol",
157
157
  {
158
- id: v,
159
- "aria-labelledby": f,
158
+ id: y,
159
+ "aria-labelledby": p,
160
160
  "aria-hidden": !a,
161
- className: G(),
161
+ className: q(),
162
162
  children: I
163
163
  }
164
164
  ),
165
- /* @__PURE__ */ n("div", { role: "presentation", className: q() })
165
+ /* @__PURE__ */ r("div", { role: "presentation", className: G() })
166
166
  ] })
167
167
  ]
168
168
  }