@payfit/unity-components 2.31.0 → 2.31.2

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 (27) hide show
  1. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +114 -102
  2. package/dist/esm/components/app-menu/parts/AppMenuHeader.js +43 -33
  3. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +2 -2
  4. package/dist/esm/components/menu/Menu.d.ts +6 -2
  5. package/dist/esm/components/menu/Menu.js +26 -4
  6. package/dist/esm/components/menu/parts/MenuContent.d.ts +6 -0
  7. package/dist/esm/components/menu/parts/MenuContent.js +22 -15
  8. package/dist/esm/components/menu/parts/RawMenuItem.js +29 -21
  9. package/dist/esm/components/nav/parts/NavGroup.js +40 -30
  10. package/dist/esm/components/nav/parts/RawNavItem.d.ts +4 -4
  11. package/dist/esm/components/nav/parts/RawNavItem.js +45 -34
  12. package/dist/esm/components/radio-button-group/parts/RadioButton.d.ts +2 -0
  13. package/dist/esm/components/radio-button-group/parts/RadioButton.js +33 -47
  14. package/dist/esm/components/radio-button-group/parts/RadioIndicator.d.ts +11 -0
  15. package/dist/esm/components/radio-button-group/parts/RadioIndicator.js +131 -0
  16. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.d.ts +1 -1
  17. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.js +38 -28
  18. package/dist/esm/components/selectable-card/selectableCard.variant.js +1 -1
  19. package/dist/esm/index.js +4 -2
  20. package/i18n/en-GB.json +2 -2
  21. package/i18n/es-ES.json +2 -2
  22. package/i18n/fr-FR.json +2 -2
  23. package/package.json +7 -7
  24. package/dist/esm/components/radio-button-group/parts/radio-input-selected.svg.js +0 -5
  25. package/dist/esm/components/radio-button-group/parts/radio-input-unselected.svg.js +0 -5
  26. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/RadioIndicator.d.ts +0 -8
  27. package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/RadioIndicator.js +0 -68
@@ -1,18 +1,19 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as v, useRef as C, isValidElement as I, cloneElement as O } from "react";
3
3
  import { uyMerge as g } from "@payfit/unity-themes";
4
4
  import { FormattedMessage as h, useIntl as V } from "react-intl";
5
- import { Actionable as x } from "../../actionable/Actionable.js";
5
+ import { Actionable as w } from "../../actionable/Actionable.js";
6
6
  import { Avatar as z } from "../../avatar/Avatar.js";
7
7
  import { AvatarFallback as F } from "../../avatar/parts/AvatarFallback.js";
8
8
  import { AvatarImage as H } from "../../avatar/parts/AvatarImage.js";
9
9
  import { Badge as j } from "../../badge/Badge.js";
10
- import { Icon as M } from "../../icon/Icon.js";
10
+ import { Icon as x } from "../../icon/Icon.js";
11
11
  import { Menu as k } from "../../menu/Menu.js";
12
12
  import { MenuContent as E } from "../../menu/parts/MenuContent.js";
13
13
  import { MenuHeader as S } from "../../menu/parts/MenuHeader.js";
14
- import { useAppMenuContext as B } from "./AppMenu.context.js";
15
- const w = (t) => /* @__PURE__ */ l(
14
+ import { MenuTrigger as B } from "../../menu/parts/MenuTrigger.js";
15
+ import { useAppMenuContext as R } from "./AppMenu.context.js";
16
+ const M = (t) => /* @__PURE__ */ n(
16
17
  z,
17
18
  {
18
19
  "aria-label": `${t.title} avatar`,
@@ -27,48 +28,48 @@ const w = (t) => /* @__PURE__ */ l(
27
28
  })
28
29
  ]
29
30
  }
30
- ), R = ({
31
+ ), q = ({
31
32
  avatar: t,
32
- avatarPair: a,
33
- title: n,
34
- uploadAvatarCallback: y,
33
+ avatarPair: r,
34
+ title: u,
35
+ uploadAvatarCallback: d,
35
36
  uploadAvatarLabel: s,
36
- uploadAvatarDescription: r
37
+ uploadAvatarDescription: i
37
38
  }) => {
38
- const [o, u] = v(!0), c = V(), i = () => {
39
- a && u((f) => !f);
40
- }, d = g(
39
+ const [o, l] = v(!0), c = V(), a = () => {
40
+ r && l((m) => !m);
41
+ }, y = g(
41
42
  "uy:group/avatar uy:cursor-pointer uy:relative uy:leading-[0] uy:rounded-75 uy:focus-visible:outline-none uy:focus-visible:ring-2 uy:focus-visible:ring-utility-focus-ring uy:focus-visible:ring-offset-2"
42
43
  );
43
- return /* @__PURE__ */ l(
44
- x,
44
+ return /* @__PURE__ */ n(
45
+ w,
45
46
  {
46
47
  "aria-describedby": "profile-picture-change-desc",
47
48
  "aria-label": s || c.formatMessage({
48
49
  id: "unity:component:app-menu:footer:profile-button:avatar:change",
49
50
  defaultMessage: "Change profile picture"
50
51
  }),
51
- className: d,
52
- onHoverStart: i,
53
- onHoverEnd: i,
54
- onFocus: i,
55
- onBlur: i,
52
+ className: y,
53
+ onHoverStart: a,
54
+ onHoverEnd: a,
55
+ onFocus: a,
56
+ onBlur: a,
56
57
  onPress: () => {
57
- y?.();
58
+ d?.();
58
59
  },
59
60
  children: [
60
61
  /* @__PURE__ */ e(
61
- w,
62
+ M,
62
63
  {
63
64
  avatar: t,
64
- avatarPair: a,
65
- title: n,
65
+ avatarPair: r,
66
+ title: u,
66
67
  isPairAvatarVisible: o
67
68
  }
68
69
  ),
69
- /* @__PURE__ */ l("div", { className: "uy:flex uy:pointer-events-none uy:opacity-0 uy:group-hover/avatar:opacity-90 uy:group-hover/avatar:pointer-events-auto uy:group-focus-visible/avatar:opacity-90 uy:group-focus-visible/avatar:pointer-events-auto uy:bg-utility-backdrop uy:rounded-75 uy:absolute uy:top-0 uy:left-0 uy:w-full uy:h-full uy:transition-all uy:duration-200 uy:items-center uy:justify-center", children: [
70
+ /* @__PURE__ */ n("div", { className: "uy:flex uy:pointer-events-none uy:opacity-0 uy:group-hover/avatar:opacity-90 uy:group-hover/avatar:pointer-events-auto uy:group-focus-visible/avatar:opacity-90 uy:group-focus-visible/avatar:pointer-events-auto uy:bg-utility-backdrop uy:rounded-75 uy:absolute uy:top-0 uy:left-0 uy:w-full uy:h-full uy:transition-all uy:duration-200 uy:items-center uy:justify-center", children: [
70
71
  /* @__PURE__ */ e(
71
- M,
72
+ x,
72
73
  {
73
74
  alt: "Camera",
74
75
  color: "content.inverted",
@@ -76,7 +77,7 @@ const w = (t) => /* @__PURE__ */ l(
76
77
  src: "CameraOutlined"
77
78
  }
78
79
  ),
79
- /* @__PURE__ */ e("span", { className: "uy:sr-only", id: "profile-picture-change-desc", children: r || /* @__PURE__ */ e(
80
+ /* @__PURE__ */ e("span", { className: "uy:sr-only", id: "profile-picture-change-desc", children: i || /* @__PURE__ */ e(
80
81
  h,
81
82
  {
82
83
  id: "unity:component:app-menu:footer:profile-button:avatar:change-description",
@@ -89,36 +90,36 @@ const w = (t) => /* @__PURE__ */ l(
89
90
  );
90
91
  }, b = ({
91
92
  asMenuHeader: t = !1,
92
- avatar: a,
93
- avatarPair: n,
94
- badgeLabel: y,
93
+ avatar: r,
94
+ avatarPair: u,
95
+ badgeLabel: d,
95
96
  description: s,
96
- menuTriggerDescription: r,
97
+ menuTriggerDescription: i,
97
98
  title: o,
98
- uploadAvatarCallback: u,
99
+ uploadAvatarCallback: l,
99
100
  uploadAvatarLabel: c,
100
- uploadAvatarDescription: i
101
- }) => /* @__PURE__ */ l("div", { className: "uy:min-w-[240px] uy:w-full uy:flex uy:items-center", children: [
102
- /* @__PURE__ */ e("div", { className: "uy:mr-150 uy:flex uy:items-center", children: u ? /* @__PURE__ */ e(
103
- R,
101
+ uploadAvatarDescription: a
102
+ }) => /* @__PURE__ */ n("div", { className: "uy:min-w-[240px] uy:w-full uy:flex uy:items-center", children: [
103
+ /* @__PURE__ */ e("div", { className: "uy:mr-150 uy:flex uy:items-center", children: l ? /* @__PURE__ */ e(
104
+ q,
104
105
  {
105
- avatar: a,
106
- avatarPair: n,
106
+ avatar: r,
107
+ avatarPair: u,
107
108
  title: o,
108
109
  uploadAvatarLabel: c,
109
- uploadAvatarDescription: i,
110
- uploadAvatarCallback: u
110
+ uploadAvatarDescription: a,
111
+ uploadAvatarCallback: l
111
112
  }
112
113
  ) : /* @__PURE__ */ e(
113
- w,
114
+ M,
114
115
  {
115
- avatar: a,
116
- avatarPair: n,
116
+ avatar: r,
117
+ avatarPair: u,
117
118
  title: o,
118
119
  isPairAvatarVisible: !0
119
120
  }
120
121
  ) }),
121
- /* @__PURE__ */ l("div", { className: "uy:flex uy:flex-col uy:text-left uy:leading-[1.25] uy:min-w-[50%] uy:flex-grow", children: [
122
+ /* @__PURE__ */ n("div", { className: "uy:flex uy:flex-col uy:text-left uy:leading-[1.25] uy:min-w-[50%] uy:flex-grow", children: [
122
123
  /* @__PURE__ */ e(
123
124
  "span",
124
125
  {
@@ -136,7 +137,7 @@ const w = (t) => /* @__PURE__ */ l(
136
137
  children: s
137
138
  }
138
139
  ),
139
- !t && /* @__PURE__ */ e("span", { id: "profile-button-description", className: "uy:sr-only", children: r || /* @__PURE__ */ e(
140
+ !t && /* @__PURE__ */ e("span", { id: "profile-button-description", className: "uy:sr-only", children: i || /* @__PURE__ */ e(
140
141
  h,
141
142
  {
142
143
  id: "unity:component:app-menu:footer:profile-button:description",
@@ -144,8 +145,8 @@ const w = (t) => /* @__PURE__ */ l(
144
145
  }
145
146
  ) })
146
147
  ] }),
147
- /* @__PURE__ */ e("div", { className: "uy:p-100", children: t ? /* @__PURE__ */ e(j, { className: "uy:capitalize", variant: "neutral", children: y }) : /* @__PURE__ */ e(
148
- M,
148
+ /* @__PURE__ */ e("div", { className: "uy:p-100", children: t ? /* @__PURE__ */ e(j, { className: "uy:capitalize", variant: "neutral", children: d }) : /* @__PURE__ */ e(
149
+ x,
149
150
  {
150
151
  src: "CaretUpDownOutlined",
151
152
  alt: "open",
@@ -153,27 +154,27 @@ const w = (t) => /* @__PURE__ */ l(
153
154
  color: "content.neutral.low"
154
155
  }
155
156
  ) })
156
- ] }), L = ({
157
+ ] }), te = ({
157
158
  avatar: t,
158
- avatarPair: a,
159
- badgeLabel: n,
160
- children: y,
159
+ avatarPair: r,
160
+ badgeLabel: u,
161
+ children: d,
161
162
  computeSlot: s,
162
- description: r,
163
+ description: i,
163
164
  title: o,
164
- menuTriggerDescription: u,
165
+ menuTriggerDescription: l,
165
166
  uploadAvatarCallback: c,
166
- uploadAvatarLabel: i,
167
- uploadAvatarDescription: d,
168
- updateNotificationSlot: f
167
+ uploadAvatarLabel: a,
168
+ uploadAvatarDescription: y,
169
+ updateNotificationSlot: m
169
170
  }) => {
170
- const { isMobileMenuOpen: N } = B(), [P, p] = v(!1), m = C(null), A = g(
171
+ const { isMobileMenuOpen: N } = R(), [P, f] = v(!1), p = C(null), A = g(
171
172
  "uy:fixed uy:bottom-0 uy:left-0 uy:right-0 uy:z-10 uy:bg-canvas",
172
173
  "uy:p-150",
173
174
  "uy:md:static uy:md:mt-auto uy:md:p-0 uy:md:bg-[transparent]",
174
175
  "uy:data-[mobile-open=false]:hidden uy:md:data-[mobile-open=false]:block uy:data-[mobile-open=true]:block"
175
176
  );
176
- return /* @__PURE__ */ l(
177
+ return /* @__PURE__ */ n(
177
178
  "aside",
178
179
  {
179
180
  className: A,
@@ -181,55 +182,66 @@ const w = (t) => /* @__PURE__ */ l(
181
182
  id: "app-menu-profile-button",
182
183
  children: [
183
184
  s,
184
- f,
185
- /* @__PURE__ */ e(
186
- x,
185
+ m,
186
+ /* @__PURE__ */ n(
187
+ k,
187
188
  {
188
- ref: m,
189
- className: "uy:transition-colors uy:rounded-75 uy:px-150 uy:py-100 uy:w-full uy:not-aria-disabled:hover:bg-surface-neutral-low-hover uy:not-aria-disabled:active:bg-surface-neutral-low-active uy:not-aria-disabled:data-[pressed=true]:bg-surface-neutral-low-active uy:not-aria-disabled:focus-visible:outline-none uy:not-aria-disabled:focus-visible:ring-2 uy:not-aria-disabled:focus-visible:ring-utility-focus-ring uy:not-aria-disabled:focus-visible:ring-offset-2",
190
- "aria-labelledby": "profile-button-label",
191
- "aria-describedby": "profile-button-description",
192
- onPress: () => {
193
- p(!0);
194
- },
195
- children: /* @__PURE__ */ e(
196
- b,
197
- {
198
- avatar: t,
199
- avatarPair: a,
200
- badgeLabel: n,
201
- description: r,
202
- menuTriggerDescription: u,
203
- title: o,
204
- uploadAvatarCallback: c,
205
- uploadAvatarLabel: i,
206
- uploadAvatarDescription: d
207
- }
208
- )
189
+ isOpen: P,
190
+ onOpenChange: f,
191
+ placement: "top left",
192
+ triggerRef: p,
193
+ children: [
194
+ /* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
195
+ w,
196
+ {
197
+ ref: p,
198
+ className: "uy:transition-colors uy:rounded-75 uy:px-150 uy:py-100 uy:w-full uy:theme-legacy:not-aria-disabled:hover:bg-surface-neutral-low-hover uy:theme-rebrand:not-aria-disabled:hover:bg-surface-neutral-lowest-hover uy:theme-legacy:not-aria-disabled:active:bg-surface-neutral-low-active uy:theme-rebrand:not-aria-disabled:active:bg-surface-neutral-lowest-active uy:theme-legacy:not-aria-disabled:data-[pressed=true]:bg-surface-neutral-low-pressed uy:theme-rebrand:not-aria-disabled:data-[pressed=true]:bg-surface-neutral-lowest-pressed uy:not-aria-disabled:focus-visible:outline-none uy:not-aria-disabled:focus-visible:ring-2 uy:not-aria-disabled:focus-visible:ring-utility-focus-ring uy:not-aria-disabled:focus-visible:ring-offset-2",
199
+ "aria-labelledby": "profile-button-label",
200
+ "aria-describedby": "profile-button-description",
201
+ onPress: () => {
202
+ f(!0);
203
+ },
204
+ children: /* @__PURE__ */ e(
205
+ b,
206
+ {
207
+ avatar: t,
208
+ avatarPair: r,
209
+ badgeLabel: u,
210
+ description: i,
211
+ menuTriggerDescription: l,
212
+ title: o,
213
+ uploadAvatarCallback: c,
214
+ uploadAvatarLabel: a,
215
+ uploadAvatarDescription: y
216
+ }
217
+ )
218
+ }
219
+ ) }),
220
+ /* @__PURE__ */ n(E, { width: 312, children: [
221
+ /* @__PURE__ */ e(S, { className: "uy:rounded-75", children: /* @__PURE__ */ e(
222
+ b,
223
+ {
224
+ asMenuHeader: !0,
225
+ avatar: t,
226
+ avatarPair: r,
227
+ badgeLabel: u,
228
+ description: i,
229
+ menuTriggerDescription: l,
230
+ title: o,
231
+ uploadAvatarCallback: c,
232
+ uploadAvatarLabel: a,
233
+ uploadAvatarDescription: y
234
+ }
235
+ ) }),
236
+ d
237
+ ] })
238
+ ]
209
239
  }
210
- ),
211
- /* @__PURE__ */ e(k, { isOpen: P, onOpenChange: p, children: /* @__PURE__ */ l(E, { width: 312, placement: "top left", triggerRef: m, children: [
212
- /* @__PURE__ */ e(S, { className: "uy:rounded-75", children: /* @__PURE__ */ e(
213
- b,
214
- {
215
- asMenuHeader: !0,
216
- avatar: t,
217
- avatarPair: a,
218
- badgeLabel: n,
219
- description: r,
220
- menuTriggerDescription: u,
221
- title: o,
222
- uploadAvatarCallback: c,
223
- uploadAvatarLabel: i,
224
- uploadAvatarDescription: d
225
- }
226
- ) }),
227
- y
228
- ] }) })
240
+ )
229
241
  ]
230
242
  }
231
243
  );
232
244
  };
233
245
  export {
234
- L as AppMenuFooter
246
+ te as AppMenuFooter
235
247
  };
@@ -1,41 +1,51 @@
1
- import { jsxs as r, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
2
  import { Link as m } from "react-aria-components/Link";
3
- import { useIntl as s } from "react-intl";
4
- import { IconButton as c } from "../../icon-button/IconButton.js";
5
- import { PayFitBrand as y } from "../../payfit-brand/PayFitBrand.js";
6
- import { PayFitBrandPreprod as f } from "../../payfit-brand/PayFitPreprod.js";
7
- import { useAppMenuContext as h } from "./AppMenu.context.js";
8
- const O = ({
9
- environment: o,
10
- brandLabel: a,
3
+ import { useIntl as c } from "react-intl";
4
+ import { useBreakpointListener as y, isMobileBreakpoint as f } from "../../../hooks/use-breakpoint-listener.js";
5
+ import { Button as h } from "../../button/Button.js";
6
+ import { PayFitBrand as b } from "../../payfit-brand/PayFitBrand.js";
7
+ import { PayFitBrandPreprod as g } from "../../payfit-brand/PayFitPreprod.js";
8
+ import { useAppMenuContext as x } from "./AppMenu.context.js";
9
+ const j = ({
10
+ environment: r,
11
+ brandLabel: i,
11
12
  notificationsComponent: t,
12
- searchComponent: i,
13
- renderLink: l = ({ children: e }) => /* @__PURE__ */ n(m, { href: "/", children: e })
13
+ searchComponent: l,
14
+ renderLink: s = ({ children: n }) => /* @__PURE__ */ e(m, { href: "/", children: n })
14
15
  }) => {
15
- const { isMobileMenuOpen: e, toggleMobileMenu: u } = h(), d = s(), p = o === "prod" ? /* @__PURE__ */ n(y, { label: a, width: 104 }) : /* @__PURE__ */ n(f, { label: a, env: o });
16
- return /* @__PURE__ */ r("header", { className: "uy:flex uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25", children: [
17
- /* @__PURE__ */ n("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ n(
18
- c,
19
- {
20
- variant: "ghost",
21
- color: "neutral",
22
- icon: e ? "CloseOutlined" : "ListOutlined",
23
- label: d.formatMessage({
24
- id: e ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
25
- defaultMessage: e ? "Close navigation" : "Open navigation"
26
- }),
27
- onClick: u,
28
- "aria-expanded": e,
29
- "aria-controls": "app-menu-nav-container app-menu-profile-button"
30
- }
31
- ) }),
32
- /* @__PURE__ */ r("div", { className: "uy:hidden uy:justify-between uy:items-center uy:md:flex", children: [
33
- l({ children: p }),
34
- t
16
+ const { isMobileMenuOpen: n, toggleMobileMenu: p } = x(), d = c(), u = y(), a = f(u);
17
+ return /* @__PURE__ */ o("header", { className: "uy:flex uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25", children: [
18
+ /* @__PURE__ */ o("div", { className: "uy:flex uy:items-center", children: [
19
+ /* @__PURE__ */ e("div", { className: "uy:flex-1", children: s({ children: r === "prod" ? /* @__PURE__ */ e(
20
+ b,
21
+ {
22
+ label: i,
23
+ width: a ? 36 : 104,
24
+ showOnlyMonogram: a
25
+ }
26
+ ) : /* @__PURE__ */ e(g, { label: i, env: r }) }) }),
27
+ /* @__PURE__ */ o("div", { className: "uy:flex uy:gap-150", children: [
28
+ t,
29
+ /* @__PURE__ */ e("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ e(
30
+ h,
31
+ {
32
+ variant: "ghost",
33
+ color: "neutral",
34
+ prefixIcon: n ? "CloseOutlined" : "ListOutlined",
35
+ onPress: p,
36
+ "aria-expanded": n,
37
+ "aria-controls": "app-menu-nav-container app-menu-profile-button",
38
+ children: d.formatMessage({
39
+ id: n ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
40
+ defaultMessage: n ? "Close navigation" : "Open navigation"
41
+ })
42
+ }
43
+ ) })
44
+ ] })
35
45
  ] }),
36
- /* @__PURE__ */ n("div", { className: "uy:hidden uy:md:flex", children: i })
46
+ /* @__PURE__ */ e("div", { className: "uy:hidden uy:md:flex", children: l })
37
47
  ] });
38
48
  };
39
49
  export {
40
- O as AppMenuHeader
50
+ j as AppMenuHeader
41
51
  };
@@ -58,7 +58,7 @@ function G({
58
58
  triggerAriaLabel: o
59
59
  }) {
60
60
  return /* @__PURE__ */ b(R, { className: n, children: [
61
- /* @__PURE__ */ b(T, { children: [
61
+ /* @__PURE__ */ b(T, { placement: "bottom start", children: [
62
62
  /* @__PURE__ */ a(K, { asChild: !0, children: /* @__PURE__ */ a(
63
63
  $,
64
64
  {
@@ -75,7 +75,7 @@ function G({
75
75
  )
76
76
  }
77
77
  ) }),
78
- /* @__PURE__ */ a(H, { width: 248, placement: "bottom start", children: r.map((e) => /* @__PURE__ */ a(
78
+ /* @__PURE__ */ a(H, { width: 248, children: r.map((e) => /* @__PURE__ */ a(
79
79
  L,
80
80
  {
81
81
  ...e.menuItemProps,
@@ -1,6 +1,10 @@
1
1
  import { MenuTriggerProps } from 'react-aria-components/Menu';
2
- type MenuProps = Omit<MenuTriggerProps, 'className' | 'style'>;
3
- export declare function Menu({ defaultOpen, children, ...rest }: MenuProps): import("react/jsx-runtime").JSX.Element;
2
+ import { PopoverProps } from 'react-aria-components/Popover';
3
+ type MenuProps = Omit<MenuTriggerProps, 'className' | 'style'> & {
4
+ placement?: PopoverProps['placement'];
5
+ triggerRef?: PopoverProps['triggerRef'];
6
+ };
7
+ export declare function Menu({ defaultOpen, children, triggerRef, placement, ...rest }: MenuProps): import("react/jsx-runtime").JSX.Element;
4
8
  export declare namespace Menu {
5
9
  var displayName: string;
6
10
  }
@@ -1,7 +1,29 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { MenuTrigger as i } from "react-aria-components/Menu";
3
- function m({ defaultOpen: r, children: e, ...n }) {
4
- return /* @__PURE__ */ o(i, { defaultOpen: r, ...n, children: e });
1
+ import { jsxs as d, jsx as i } from "react/jsx-runtime";
2
+ import y from "react";
3
+ import { MenuTrigger as l, Popover as s } from "react-aria-components/Menu";
4
+ function m({
5
+ defaultOpen: u,
6
+ children: o,
7
+ triggerRef: t,
8
+ placement: n,
9
+ ...a
10
+ }) {
11
+ const [r, e] = y.Children.toArray(o);
12
+ if (!r || !e)
13
+ throw new Error("Menu must have a trigger and a menu content");
14
+ return /* @__PURE__ */ d(l, { defaultOpen: u, ...a, children: [
15
+ r,
16
+ /* @__PURE__ */ i(
17
+ s,
18
+ {
19
+ triggerRef: t,
20
+ placement: n,
21
+ className: "uy:flex uy:flex-col uy:justify-end uy:items-start uy:p-100 uy:rounded-100 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:shadow-300",
22
+ "data-dd-privacy": "allow",
23
+ children: e
24
+ }
25
+ )
26
+ ] });
5
27
  }
6
28
  m.displayName = "Menu";
7
29
  export {
@@ -1,8 +1,14 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { PopoverProps } from 'react-aria-components/Popover';
3
3
  interface MenuContent {
4
+ /**
5
+ * @deprecated move it to the root Menu component
6
+ */
4
7
  placement?: PopoverProps['placement'];
5
8
  width?: number;
9
+ /**
10
+ * @deprecated move it to the root Menu component
11
+ */
6
12
  triggerRef?: PopoverProps['triggerRef'];
7
13
  }
8
14
  export declare function MenuContent({ children, placement, width, triggerRef, }: PropsWithChildren<MenuContent>): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +1,31 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { Popover as a, Menu as y } from "react-aria-components/Menu";
3
- function d({
4
- children: r,
5
- placement: o,
6
- width: u,
7
- triggerRef: t
2
+ import { uyTv as u } from "@payfit/unity-themes";
3
+ import { Menu as o } from "react-aria-components/Menu";
4
+ const m = u({
5
+ base: [
6
+ "uy:outline-none",
7
+ "uy:w-(--uy-menu-content-width) uy:min-w-(--uy-menu-content-min-width)"
8
+ ]
9
+ });
10
+ function i({
11
+ children: t,
12
+ placement: r,
13
+ width: n,
14
+ triggerRef: c
8
15
  }) {
9
- const n = u ? `uy:w-[${u}px] uy:min-w-[${u}px]` : "";
10
16
  return /* @__PURE__ */ e(
11
- a,
17
+ o,
12
18
  {
13
- triggerRef: t,
14
- placement: o,
15
- className: "uy:flex uy:flex-col uy:justify-end uy:items-start uy:p-100 uy:rounded-100 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:shadow-300",
16
- "data-dd-privacy": "allow",
17
- children: /* @__PURE__ */ e(y, { autoFocus: "first", className: `${u ? "" : "uy:min-w-[320px]"} ${n}`, children: r })
19
+ className: m(),
20
+ style: {
21
+ "--uy-menu-content-width": n ? `${n}px` : "auto",
22
+ "--uy-menu-content-min-width": n ? "" : "calc(var(--uy-spacing) * 40)"
23
+ },
24
+ children: t
18
25
  }
19
26
  );
20
27
  }
21
- d.displayName = "MenuContent";
28
+ i.displayName = "MenuContent";
22
29
  export {
23
- d as MenuContent
30
+ i as MenuContent
24
31
  };
@@ -1,29 +1,37 @@
1
- import { jsxs as s, jsx as y } from "react/jsx-runtime";
2
- import { uyMerge as i } from "@payfit/unity-themes";
3
- import { MenuItem as l } from "react-aria-components/Menu";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { uyTv as l } from "@payfit/unity-themes";
3
+ import { MenuItem as d } from "react-aria-components/Menu";
4
+ const y = l({
5
+ base: [
6
+ "uy:cursor-pointer",
7
+ "uy:flex uy:p-100 uy:items-start uy:gap-100 uy:rounded-25 uy:typography-body uy:text-content-neutral",
8
+ "uy:not-aria-disabled:data-[hovered=true]:bg-surface-neutral-hover",
9
+ "uy:not-aria-disabled:data-[pressed=true]:bg-surface-neutral-pressed",
10
+ "uy:active:bg-surface-neutral-active",
11
+ "uy:focus-visible:outline-none uy:data-[focus-visible=true]:outline-2 uy:data-[focus-visible=true]:outline-offset-2 uy:data-[focus-visible=true]:outline-utility-focus-ring",
12
+ "uy:aria-disabled:text-content-neutral-disabled uy:aria-disabled:cursor-not-allowed"
13
+ ]
14
+ });
4
15
  function c({
5
16
  prefix: e,
6
- children: u,
7
- href: t,
8
- onAction: r,
9
- className: a,
10
- isDisabled: n,
11
- ...o
17
+ children: t,
18
+ href: u,
19
+ onAction: a,
20
+ className: r,
21
+ isDisabled: o,
22
+ ...s
12
23
  }) {
13
- return /* @__PURE__ */ s(
14
- l,
24
+ return /* @__PURE__ */ i(
25
+ d,
15
26
  {
16
- href: t,
17
- isDisabled: n,
18
- onAction: r,
19
- className: i(
20
- "uy:cursor-pointer uy:flex uy:p-100 uy:items-start uy:gap-100 uy:rounded-25 uy:typography-body uy:text-content-neutral uy:hover:bg-surface-neutral-hover uy:data-[pressed]:bg-surface-neutral-pressed uy:focus-visible:outline-utility-focus-ring uy:active:bg-surface-neutral-active",
21
- a
22
- ),
23
- ...o,
27
+ href: u,
28
+ isDisabled: o,
29
+ onAction: a,
30
+ className: y({ className: r }),
31
+ ...s,
24
32
  children: [
25
- /* @__PURE__ */ y("div", { className: "uy:text-content-neutral-low", children: e || null }),
26
- u
33
+ /* @__PURE__ */ n("div", { className: "uy:text-content-neutral-low", children: e || null }),
34
+ t
27
35
  ]
28
36
  }
29
37
  );