@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,5 +1,5 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import o, { useState as j, useCallback as B, useMemo as D } from "react";
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import s, { useState as j, useCallback as B, useMemo as D } from "react";
3
3
  import { uyTv as S } from "@payfit/unity-themes";
4
4
  import { Button as _ } from "react-aria-components/Button";
5
5
  import $ from "../../../hooks/use-id.js";
@@ -8,6 +8,7 @@ import { navItemBase as z } from "./RawNavItem.js";
8
8
  const H = S({
9
9
  extend: z,
10
10
  slots: {
11
+ base: "uy:theme-rebrand:border-1 uy:theme-rebrand:border-solid",
11
12
  caret: "uy:transition-transform uy:duration-150 uy:delay-25 uy:ease-linear motion-reduce:transition-none",
12
13
  contentWrapper: "uy:transition-[max-height] uy:duration-200 uy:ease-linear motion-reduce:transition-none",
13
14
  content: "uy:list-none uy:flex uy:flex-col uy:gap-50 uy:transition-opacity uy:duration-150 uy:delay-25 uy:ease-linear"
@@ -15,6 +16,14 @@ const H = S({
15
16
  variants: {
16
17
  expanded: {
17
18
  true: {
19
+ base: [
20
+ "uy:theme-legacy:bg-surface-neutral-low-active",
21
+ "uy:theme-rebrand:bg-surface-neutral uy:theme-rebrand:border-border-neutral uy:theme-rebrand:shadow-100"
22
+ ],
23
+ prefix: [
24
+ "uy:theme-legacy:text-content-neutral",
25
+ "uy:theme-rebrand:text-content-primary"
26
+ ],
18
27
  caret: "uy:rotate-180",
19
28
  contentWrapper: "uy:max-h-[1000px] uy:overflow-visible",
20
29
  label: "uy:typography-body-strong",
@@ -24,30 +33,31 @@ const H = S({
24
33
  caret: "uy:rotate-0",
25
34
  contentWrapper: "uy:max-h-0 uy:overflow-hidden",
26
35
  content: "uy:opacity-0 uy:invisible uy:pointer-events-none",
27
- label: "uy:typography-body"
36
+ label: "uy:typography-body",
37
+ base: "uy:theme-rebrand:border-transparent"
28
38
  }
29
39
  }
30
40
  }
31
41
  });
32
42
  function M({
33
- children: d,
34
- label: p,
35
- prefix: l,
36
- suffix: y,
37
- defaultExpanded: f = !1,
38
- isExpanded: r,
43
+ children: m,
44
+ label: y,
45
+ prefix: o,
46
+ suffix: p,
47
+ defaultExpanded: b = !1,
48
+ isExpanded: l,
39
49
  onToggle: i,
40
- ...N
50
+ ...f
41
51
  }) {
42
- const u = $(), [x, b] = j(f), n = r !== void 0, a = n ? r : x, C = B(() => {
43
- n || b((e) => !e), i?.(!a);
44
- }, [n, a, i]), h = o.Children.map(d, (e) => o.isValidElement(e) ? o.cloneElement(e, { isDisabled: !a, level: 1 }) : e), c = `${u}-toggle`, m = `${u}-content`, {
52
+ const u = $(), [x, h] = j(b), n = l !== void 0, a = n ? l : x, N = B(() => {
53
+ n || h((e) => !e), i?.(!a);
54
+ }, [n, a, i]), C = s.Children.map(m, (e) => s.isValidElement(e) ? s.cloneElement(e, { isDisabled: !a, level: 1 }) : e), c = `${u}-toggle`, d = `${u}-content`, {
45
55
  baseClassName: v,
46
56
  prefixClassName: g,
47
- labelClassName: I,
48
- suffixClassName: W,
49
- contentClassName: E,
50
- contentWrapperClassName: w,
57
+ labelClassName: w,
58
+ suffixClassName: I,
59
+ contentClassName: W,
60
+ contentWrapperClassName: E,
51
61
  caretClassName: G
52
62
  } = D(() => {
53
63
  const e = H({ level: 0, expanded: a });
@@ -61,21 +71,21 @@ function M({
61
71
  caretClassName: e.caret()
62
72
  };
63
73
  }, [a]);
64
- return /* @__PURE__ */ s("li", { className: "uy:flex uy:flex-col uy:gap-50", children: [
65
- /* @__PURE__ */ s(
74
+ return /* @__PURE__ */ r("li", { className: "uy:flex uy:flex-col uy:gap-50", children: [
75
+ /* @__PURE__ */ r(
66
76
  _,
67
77
  {
68
78
  id: c,
69
79
  className: v,
70
- onPress: C,
80
+ onPress: N,
71
81
  "aria-expanded": a,
72
- "aria-controls": m,
73
- ...N,
82
+ "aria-controls": d,
83
+ ...f,
74
84
  children: [
75
- l && /* @__PURE__ */ t("span", { className: g, children: l({ isExpanded: a }) }),
76
- /* @__PURE__ */ t("span", { className: I, children: p }),
77
- /* @__PURE__ */ s("span", { className: W, role: "presentation", children: [
78
- y,
85
+ o && /* @__PURE__ */ t("span", { className: g, children: o({ isExpanded: a }) }),
86
+ /* @__PURE__ */ t("span", { className: w, children: y }),
87
+ /* @__PURE__ */ r("span", { className: I, role: "presentation", children: [
88
+ p,
79
89
  /* @__PURE__ */ t(
80
90
  k,
81
91
  {
@@ -93,16 +103,16 @@ function M({
93
103
  /* @__PURE__ */ t(
94
104
  "div",
95
105
  {
96
- className: w,
106
+ className: E,
97
107
  style: { maxHeight: a ? 1e3 : 0 },
98
108
  children: /* @__PURE__ */ t(
99
109
  "ul",
100
110
  {
101
- id: m,
102
- className: E,
111
+ id: d,
112
+ className: W,
103
113
  "aria-labelledby": c,
104
114
  "aria-hidden": !a,
105
- children: h
115
+ children: C
106
116
  }
107
117
  )
108
118
  }
@@ -57,8 +57,8 @@ export declare const navItemBase: import('tailwind-variants').TVReturnType<{
57
57
  declare const navItem: import('tailwind-variants').TVReturnType<{
58
58
  isActive: {
59
59
  true: {
60
- base: string;
61
- prefix: string;
60
+ base: string[];
61
+ prefix: string[];
62
62
  label: string;
63
63
  };
64
64
  false: {
@@ -160,8 +160,8 @@ export type NavItemProps = Pick<VariantProps<typeof navItem>, 'level'> & PropsWi
160
160
  export declare const RawNavItem: import('react').ForwardRefExoticComponent<Pick<VariantProps<import('tailwind-variants').TVReturnType<{
161
161
  isActive: {
162
162
  true: {
163
- base: string;
164
- prefix: string;
163
+ base: string[];
164
+ prefix: string[];
165
165
  label: string;
166
166
  };
167
167
  false: {
@@ -1,17 +1,21 @@
1
- import { jsx as u, jsxs as h } from "react/jsx-runtime";
1
+ import { jsx as u, jsxs as N } from "react/jsx-runtime";
2
2
  import { forwardRef as C, useMemo as I } from "react";
3
- import { uyTv as i, uyMerge as j } from "@payfit/unity-themes";
3
+ import { uyTv as y, uyMerge as j } from "@payfit/unity-themes";
4
4
  import { Button as R } from "react-aria-components/Button";
5
5
  import { Link as A } from "react-aria-components/Link";
6
6
  import { useRouter as k } from "../../../providers/router/RouterProvider.js";
7
- const B = i({
7
+ const B = y({
8
8
  slots: {
9
9
  base: [
10
- "uy:group uy:cursor-pointer uy:grid uy:w-full uy:grid-cols-[auto_1fr_auto] uy:items-center uy:py-100 uy:px-150 uy:gap-100 uy:rounded-75 uy:outline-0 uy:transition-all",
11
- "uy:hover:bg-surface-neutral-low-hover uy:active:bg-surface-neutral-low-active uy:data-[pressed]:bg-surface-neutral-low-pressed",
10
+ "uy:group uy:cursor-pointer uy:grid uy:w-full uy:grid-cols-[auto_1fr_auto] uy:items-center uy:py-100 uy:px-150 uy:gap-100 uy:theme-legacy:rounded-75 uy:theme-rebrand:rounded-100 uy:outline-0 uy:transition-all uy:min-h-5.5 uy:md:min-h-auto",
11
+ "uy:bg-transparent uy:theme-rebrand:border-1 uy:theme-rebrand:border-solid uy:theme-rebrand:border-transparent",
12
+ "uy:theme-legacy:data-[hovered]:bg-surface-neutral-low-hover",
13
+ "uy:theme-rebrand:data-[hovered]:bg-surface-neutral-lowest-hover uy:theme-rebrand:data-[hovered]:border-border-neutral-lowest-hover",
14
+ "uy:theme-legacy:active:bg-surface-neutral-low-active uy:theme-legacy:data-[pressed]:bg-surface-neutral-low-pressed",
15
+ "uy:theme-rebrand:active:bg-surface-neutral-lowest-active uy:theme-rebrand:active:border-border-neutral-lowest-pressed uy:theme-rebrand:data-[pressed]:bg-surface-neutral-lowest-pressed uy:theme-rebrand:data-[pressed]:border-border-neutral-lowest-pressed",
12
16
  "uy:focus:outline-0 uy:data-[focus-visible]:outline-none uy:data-[focus-visible]:ring-2 uy:data-[focus-visible]:ring-utility-focus-ring uy:data-[focus-visible]:ring-offset-2"
13
17
  ],
14
- prefix: "uy:p-25 uy:empty:hidden uy:text-content-neutral-low",
18
+ prefix: "uy:theme-legacy:p-25 uy:theme-rebrand:px-25 uy:empty:hidden uy:text-content-neutral-low",
15
19
  suffix: "uy:flex uy:gap-100 uy:items-center uy:text-content-neutral-low uy:justify-self-end uy:text-right uy:empty:hidden",
16
20
  label: [
17
21
  "uy:flex-1 uy:basis-full uy:text-left uy:truncate uy:overflow-hidden uy:whitespace-break-spaces uy:typography-body uy:text-content-neutral"
@@ -30,13 +34,19 @@ const B = i({
30
34
  false: ""
31
35
  }
32
36
  }
33
- }), M = i({
37
+ }), M = y({
34
38
  extend: B,
35
39
  variants: {
36
40
  isActive: {
37
41
  true: {
38
- base: "uy:bg-surface-neutral-low-active",
39
- prefix: "uy:text-content-neutral",
42
+ base: [
43
+ "uy:theme-legacy:bg-surface-neutral-low-active uy:theme-rebrand:data-[level=1]:bg-surface-neutral-lowest-active",
44
+ "uy:theme-rebrand:data-[level=0]:bg-surface-neutral uy:theme-rebrand:data-[level=0]:border-1 uy:theme-rebrand:data-[level=0]:border-solid uy:theme-rebrand:data-[level=0]:border-border-neutral uy:theme-rebrand:data-[level=0]:shadow-100"
45
+ ],
46
+ prefix: [
47
+ "uy:theme-legacy:text-content-neutral",
48
+ "uy:theme-rebrand:text-content-primary"
49
+ ],
40
50
  label: "uy:typography-body-strong"
41
51
  },
42
52
  false: {
@@ -48,53 +58,54 @@ const B = i({
48
58
  }
49
59
  }), _ = C(
50
60
  ({
51
- children: y,
52
- level: r = 0,
61
+ children: d,
62
+ level: s = 0,
53
63
  prefix: l,
54
64
  suffix: n,
55
- onPress: c,
65
+ onPress: i,
56
66
  href: t,
57
- isCurrent: f,
58
- isDisabled: s = !1,
59
- isExact: p = !1,
60
- ...m
61
- }, d) => {
62
- const o = k(), b = t ? A : R, e = o && t ? o.isActive(t, p) : f, {
63
- rawNavItemClassName: v,
64
- labelClassName: x,
67
+ isCurrent: c,
68
+ isDisabled: r = !1,
69
+ isExact: m = !1,
70
+ ...b
71
+ }, p) => {
72
+ const o = k(), f = t ? A : R, e = o && t ? o.isActive(t, m) : c, {
73
+ rawNavItemClassName: h,
74
+ labelClassName: v,
65
75
  prefixClassName: g,
66
- suffixClassName: N
76
+ suffixClassName: x
67
77
  } = I(() => {
68
- const a = M({ level: r, isActive: e, isDisabled: s });
78
+ const a = M({ level: s, isActive: e, isDisabled: r });
69
79
  return {
70
80
  rawNavItemClassName: j(a.base(), a.label()),
71
81
  prefixClassName: a.prefix(),
72
82
  suffixClassName: a.suffix(),
73
83
  labelClassName: a.label()
74
84
  };
75
- }, [e, s, r]), w = Object.assign(
85
+ }, [e, r, s]), w = Object.assign(
76
86
  {},
77
87
  e !== void 0 && {
78
88
  "data-current": e,
79
89
  "aria-current": e ? "page" : void 0
80
90
  },
81
- !t && { tabIndex: s ? -1 : void 0 }
91
+ !t && { tabIndex: r ? -1 : void 0 }
82
92
  );
83
- return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ h(
84
- b,
93
+ return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ N(
94
+ f,
85
95
  {
86
96
  ...w,
87
- ...m,
88
- ref: d,
89
- className: v,
97
+ ...b,
98
+ ref: p,
99
+ className: h,
90
100
  href: t,
91
- onPress: c,
92
- isDisabled: s,
93
- "data-level": r,
101
+ onPress: i,
102
+ isDisabled: r,
103
+ "data-level": s,
104
+ "data-selected": e,
94
105
  children: [
95
106
  l && /* @__PURE__ */ u("span", { className: g, children: l({ isCurrent: e ?? !1 }) }),
96
- /* @__PURE__ */ u("span", { className: x, children: y }),
97
- n && /* @__PURE__ */ u("span", { className: N, children: n })
107
+ /* @__PURE__ */ u("span", { className: v, children: d }),
108
+ n && /* @__PURE__ */ u("span", { className: x, children: n })
98
109
  ]
99
110
  }
100
111
  ) });
@@ -1,6 +1,8 @@
1
1
  import { VariantProps } from '@payfit/unity-themes';
2
2
  import { ReactNode } from 'react';
3
3
  import { RadioProps } from 'react-aria-components/RadioGroup';
4
+ export { RadioIndicator } from './RadioIndicator.js';
5
+ export type { RadioIndicatorProps, RadioState } from './RadioIndicator.js';
4
6
  export declare const radioButton: import('tailwind-variants').TVReturnType<{
5
7
  [key: string]: {
6
8
  [key: string]: import('tailwind-merge').ClassNameValue | {
@@ -1,13 +1,12 @@
1
- import { jsxs as u, jsx as o, Fragment as x } from "react/jsx-runtime";
2
- import { forwardRef as g, useContext as v, useMemo as l } from "react";
3
- import { uyTv as R } from "@payfit/unity-themes";
4
- import { RadioGroupStateContext as S, Radio as h } from "react-aria-components/RadioGroup";
5
- import { Flex as w } from "../../flex/Flex.js";
6
- import { Text as N } from "../../text/Text.js";
7
- import B from "./radio-input-selected.svg.js";
8
- import O from "./radio-input-unselected.svg.js";
9
- import { RadioButtonHelper as F } from "./RadioButtonHelper.js";
10
- const j = R({
1
+ import { jsxs as a, jsx as t, Fragment as f } from "react/jsx-runtime";
2
+ import { forwardRef as x, useContext as g } from "react";
3
+ import { uyTv as h, useUnityTheme as R } from "@payfit/unity-themes";
4
+ import { RadioGroupStateContext as w, Radio as N } from "react-aria-components/RadioGroup";
5
+ import { Flex as v } from "../../flex/Flex.js";
6
+ import { Text as B } from "../../text/Text.js";
7
+ import { RadioButtonHelper as S } from "./RadioButtonHelper.js";
8
+ import { RadioIndicator as j } from "./RadioIndicator.js";
9
+ const C = h({
11
10
  slots: {
12
11
  container: [
13
12
  "uy:group uy:inline-flex uy:flex-col uy:gap-50",
@@ -30,52 +29,39 @@ const j = R({
30
29
  "uy:group-data-[readonly=true]:text-content-neutral uy:group-data-[readonly]:cursor-text"
31
30
  ]
32
31
  }
33
- }), C = g(
34
- ({ children: i, value: n, isDisabled: e, helperText: t, ...s }, y) => {
35
- const { base: c, label: m, container: b, radio: a } = j(), r = v(S), p = l(() => r?.isReadOnly ? {
36
- "--radio-fill-color": "var(--uy-color-border-form-read-only)",
37
- "--radio-border-color": "var(--uy-color-border-form-disabled)"
38
- } : {
39
- "--radio-fill-color": "var(--uy-color-surface-primary-active)",
40
- "--radio-border-color": "var(--uy-color-border-form-active)"
41
- }, [r?.isReadOnly]), f = l(() => r?.isReadOnly || r?.isDisabled || e ? {
42
- "--radio-border-color": "var(--uy-color-border-form-disabled)"
43
- } : {
44
- "--radio-border-color": "var(--uy-color-border-form-enabled)"
45
- }, [e, r?.isDisabled, r?.isReadOnly]);
46
- return /* @__PURE__ */ u(w, { direction: "col", gap: "50", className: b(), children: [
47
- /* @__PURE__ */ o(
48
- h,
32
+ }), F = x(
33
+ ({ children: u, value: d, isDisabled: o, helperText: r, ...n }, i) => {
34
+ const { base: l, label: s, container: y, radio: m } = C(), e = g(w), { theme: c } = R(), p = e?.isReadOnly ? "readonly" : e?.isDisabled || o ? "disabled" : e?.isInvalid ? "invalid" : "enabled";
35
+ return /* @__PURE__ */ a(v, { direction: "col", gap: "50", className: y(), children: [
36
+ /* @__PURE__ */ t(
37
+ N,
49
38
  {
50
- ...s,
51
- value: n,
52
- isDisabled: e,
53
- className: ({ isFocusVisible: d }) => c(),
54
- ref: y,
55
- children: ({ isSelected: d }) => /* @__PURE__ */ u(x, { children: [
56
- d ? /* @__PURE__ */ o(
57
- B,
39
+ ...n,
40
+ value: d,
41
+ isDisabled: o,
42
+ className: () => l(),
43
+ ref: i,
44
+ children: ({ isSelected: b }) => /* @__PURE__ */ a(f, { children: [
45
+ /* @__PURE__ */ t(
46
+ j,
58
47
  {
59
- style: p,
60
- className: a()
61
- }
62
- ) : /* @__PURE__ */ o(
63
- O,
64
- {
65
- style: f,
66
- className: a()
48
+ isSelected: b,
49
+ state: p,
50
+ theme: c,
51
+ className: m()
67
52
  }
68
53
  ),
69
- /* @__PURE__ */ o(N, { variant: "body", className: m(), children: i })
54
+ /* @__PURE__ */ t(B, { variant: "body", className: s(), children: u })
70
55
  ] })
71
56
  }
72
57
  ),
73
- t ? /* @__PURE__ */ o(F, { children: t }) : null
58
+ r ? /* @__PURE__ */ t(S, { children: r }) : null
74
59
  ] });
75
60
  }
76
61
  );
77
- C.displayName = "RadioButton";
62
+ F.displayName = "RadioButton";
78
63
  export {
79
- C as RadioButton,
80
- j as radioButton
64
+ F as RadioButton,
65
+ j as RadioIndicator,
66
+ C as radioButton
81
67
  };
@@ -0,0 +1,11 @@
1
+ type EnabledState = 'enabled' | 'disabled' | 'readonly';
2
+ type ValidationState = 'valid' | 'invalid';
3
+ export type RadioState = EnabledState | ValidationState;
4
+ export interface RadioIndicatorProps {
5
+ isSelected: boolean;
6
+ state: RadioState;
7
+ theme: string;
8
+ className?: string;
9
+ }
10
+ export declare const RadioIndicator: ({ isSelected, state, theme, className, }: RadioIndicatorProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,131 @@
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ const c = {
3
+ unselected: {
4
+ enabled: { "--radio-border-color": "var(--uy-color-border-form-enabled)" },
5
+ valid: { "--radio-border-color": "var(--uy-color-border-form-enabled)" },
6
+ invalid: { "--radio-border-color": "var(--uy-color-border-form-error)" },
7
+ disabled: {
8
+ "--radio-border-color": "var(--uy-color-border-form-disabled)"
9
+ },
10
+ readonly: {
11
+ "--radio-border-color": "var(--uy-color-border-form-disabled)"
12
+ }
13
+ },
14
+ selected: {
15
+ enabled: {
16
+ "--radio-bg-color": "var(--uy-color-surface-form-active)",
17
+ "--radio-border-color": "var(--uy-color-surface-form-active)",
18
+ "--radio-dot-size": "3px",
19
+ "--radio-dot-color": "var(--uy-color-content-inverted)"
20
+ },
21
+ valid: {
22
+ "--radio-bg-color": "var(--uy-color-surface-form-active)",
23
+ "--radio-border-color": "var(--uy-color-surface-form-active)",
24
+ "--radio-dot-size": "3px",
25
+ "--radio-dot-color": "var(--uy-color-content-inverted)"
26
+ },
27
+ invalid: {
28
+ "--radio-bg-color": "var(--uy-color-surface-danger)",
29
+ "--radio-border-color": "transparent",
30
+ "--radio-dot-size": "3px",
31
+ "--radio-dot-color": "var(--uy-color-content-inverted)"
32
+ },
33
+ disabled: {
34
+ "--radio-bg-color": "var(--uy-color-surface-form-disabled)",
35
+ "--radio-border-color": "var(--uy-color-border-form-disabled)",
36
+ "--radio-dot-size": "3px",
37
+ "--radio-dot-color": "var(--uy-color-content-form-disabled)"
38
+ },
39
+ readonly: {
40
+ "--radio-bg-color": "var(--uy-color-surface-form-read-only)",
41
+ "--radio-border-color": "transparent",
42
+ "--radio-dot-size": "3px",
43
+ "--radio-dot-color": "var(--uy-color-surface-neutral-disabled)"
44
+ }
45
+ }
46
+ }, i = {
47
+ unselected: {
48
+ enabled: { "--radio-border-color": "var(--uy-color-border-form-enabled)" },
49
+ valid: { "--radio-border-color": "var(--uy-color-border-form-enabled)" },
50
+ invalid: { "--radio-border-color": "var(--uy-color-border-form-error)" },
51
+ disabled: {
52
+ "--radio-border-color": "var(--uy-color-border-form-disabled)"
53
+ },
54
+ readonly: {
55
+ "--radio-border-color": "var(--uy-color-border-form-disabled)"
56
+ }
57
+ },
58
+ selected: {
59
+ enabled: {
60
+ "--radio-border-color": "var(--uy-color-border-form-active)",
61
+ "--radio-dot-color": "var(--uy-color-surface-primary-active)"
62
+ },
63
+ valid: {
64
+ "--radio-border-color": "var(--uy-color-border-form-active)",
65
+ "--radio-dot-color": "var(--uy-color-surface-primary-active)"
66
+ },
67
+ invalid: {
68
+ "--radio-border-color": "var(--uy-color-border-form-error)",
69
+ "--radio-dot-color": "var(--uy-color-content-form-invalid)"
70
+ },
71
+ disabled: {
72
+ "--radio-border-color": "var(--uy-color-border-form-disabled)",
73
+ "--radio-dot-color": "var(--uy-color-border-form-disabled)"
74
+ },
75
+ readonly: {
76
+ "--radio-border-color": "var(--uy-color-border-form-disabled)",
77
+ "--radio-dot-color": "var(--uy-color-border-form-read-only)"
78
+ }
79
+ }
80
+ };
81
+ function t({
82
+ isSelected: r,
83
+ state: o,
84
+ theme: d
85
+ }) {
86
+ return (d === "rebrand" ? c : i)[r ? "selected" : "unselected"][o];
87
+ }
88
+ const n = ({
89
+ isSelected: r,
90
+ state: o,
91
+ theme: d,
92
+ className: a
93
+ }) => /* @__PURE__ */ e(
94
+ "svg",
95
+ {
96
+ width: "20",
97
+ height: "20",
98
+ viewBox: "0 0 20 20",
99
+ fill: "none",
100
+ xmlns: "http://www.w3.org/2000/svg",
101
+ style: t({ isSelected: r, state: o, theme: d }),
102
+ className: a,
103
+ children: /* @__PURE__ */ l("g", { id: "Radio input", children: [
104
+ /* @__PURE__ */ e(
105
+ "circle",
106
+ {
107
+ id: "Background",
108
+ cx: "10",
109
+ cy: "10",
110
+ r: "7",
111
+ fill: "var(--radio-bg-color, white)",
112
+ stroke: "var(--radio-border-color, #0157B2)",
113
+ strokeWidth: "1.25"
114
+ }
115
+ ),
116
+ /* @__PURE__ */ e(
117
+ "circle",
118
+ {
119
+ id: "Dot",
120
+ cx: "10",
121
+ cy: "10",
122
+ style: { r: "var(--radio-dot-size, 5px)" },
123
+ fill: "var(--radio-dot-color, transparent)"
124
+ }
125
+ )
126
+ ] })
127
+ }
128
+ );
129
+ export {
130
+ n as RadioIndicator
131
+ };
@@ -44,7 +44,7 @@ export interface SelectableCardRadioProps extends Omit<RadioProps, 'children'>,
44
44
  * @remarks [API Docs](https://unity-components.payfit.io/?path=/docs/inputs-selectablecardgroup-selectablecardradiogroup-selectablecardradio--docs) • [Design Docs](https://www.payfit.design/24f360409/p/05fc26-selectable-card)
45
45
  */
46
46
  declare const SelectableCardRadio: {
47
- ({ title, description, illustration, ...props }: SelectableCardRadioProps): import("react/jsx-runtime").JSX.Element;
47
+ ({ title, description, illustration, isDisabled, ...props }: SelectableCardRadioProps): import("react/jsx-runtime").JSX.Element;
48
48
  displayName: string;
49
49
  };
50
50
  export { SelectableCardRadio };
@@ -1,38 +1,48 @@
1
- import { jsx as r, jsxs as a, Fragment as n } from "react/jsx-runtime";
2
- import { useId as s } from "react";
3
- import { Radio as p } from "react-aria-components/RadioGroup";
4
- import { Text as f } from "../../../text/Text.js";
5
- import { Content as b } from "../../internals/Content.js";
6
- import { Description as h } from "../../internals/Description.js";
7
- import { Illustration as I } from "../../internals/Illustration.js";
8
- import { SelectedIndicator as x } from "../../internals/SelectedIndicator.js";
9
- import { selectableCard as C } from "../../selectableCard.variant.js";
10
- import R from "./RadioIndicator.js";
11
- const S = ({
12
- title: d,
1
+ import { jsx as e, jsxs as n, Fragment as b } from "react/jsx-runtime";
2
+ import { useId as h, useContext as S } from "react";
3
+ import { useUnityTheme as u } from "@payfit/unity-themes";
4
+ import { RadioGroupStateContext as x, Radio as y } from "react-aria-components/RadioGroup";
5
+ import { RadioIndicator as C } from "../../../radio-button-group/parts/RadioIndicator.js";
6
+ import { Text as I } from "../../../text/Text.js";
7
+ import { Content as R } from "../../internals/Content.js";
8
+ import { Description as g } from "../../internals/Description.js";
9
+ import { Illustration as v } from "../../internals/Illustration.js";
10
+ import { SelectedIndicator as j } from "../../internals/SelectedIndicator.js";
11
+ import { selectableCard as N } from "../../selectableCard.variant.js";
12
+ const T = ({
13
+ title: l,
13
14
  description: o,
14
- illustration: t,
15
- ...l
15
+ illustration: a,
16
+ isDisabled: i,
17
+ ...m
16
18
  }) => {
17
- const m = s(), { base: c } = C(), i = `selectable-card-radio-${m}__title`;
18
- return /* @__PURE__ */ r(
19
- p,
19
+ const s = h(), { theme: c } = u(), { base: p } = N(), t = S(x), f = t?.isReadOnly ? "readonly" : t?.isDisabled || i ? "disabled" : t?.isInvalid ? "invalid" : "enabled", d = `selectable-card-radio-${s}__title`;
20
+ return /* @__PURE__ */ e(
21
+ y,
20
22
  {
21
- className: ({ isFocusVisible: e }) => c({ isFocusVisible: e }),
22
- "aria-labelledby": i,
23
- ...l,
24
- children: ({ isSelected: e }) => /* @__PURE__ */ a(n, { children: [
25
- /* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(R, { isSelected: e }) }),
26
- /* @__PURE__ */ a(b, { children: [
27
- t && /* @__PURE__ */ r(I, { children: t }),
28
- /* @__PURE__ */ r(f, { asElement: "h3", variant: "bodyLargeStrong", id: i, children: d }),
29
- o && /* @__PURE__ */ r(h, { children: o })
23
+ className: ({ isFocusVisible: r }) => p({ isFocusVisible: r }),
24
+ "aria-labelledby": d,
25
+ isDisabled: i,
26
+ ...m,
27
+ children: ({ isSelected: r }) => /* @__PURE__ */ n(b, { children: [
28
+ /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
29
+ C,
30
+ {
31
+ isSelected: r,
32
+ state: f,
33
+ theme: c
34
+ }
35
+ ) }),
36
+ /* @__PURE__ */ n(R, { children: [
37
+ a && /* @__PURE__ */ e(v, { children: a }),
38
+ /* @__PURE__ */ e(I, { asElement: "h3", variant: "bodyLargeStrong", id: d, children: l }),
39
+ o && /* @__PURE__ */ e(g, { children: o })
30
40
  ] })
31
41
  ] })
32
42
  }
33
43
  );
34
44
  };
35
- S.displayName = "SelectableCardRadio";
45
+ T.displayName = "SelectableCardRadio";
36
46
  export {
37
- S as SelectableCardRadio
47
+ T as SelectableCardRadio
38
48
  };
@@ -8,7 +8,7 @@ const u = e({
8
8
  "uy:text-content-form-enabled",
9
9
  "uy:bg-surface-form-enabled",
10
10
  "uy:hover:border-border-form-hover",
11
- "uy:data-[selected=true]:border-border-form-active uy:data-[selected=true]:border-2 uy:data-[selected=true]:m-0",
11
+ "uy:data-[selected=true]:border-border-form-selected uy:data-[selected=true]:border-2 uy:data-[selected=true]:m-0",
12
12
  "uy:data-[invalid]:border-border-form-error uy:data-[invalid]:bg-surface-form-error",
13
13
  "uy:focus-visible:outline-2 uy:focus-visible:outline-solid uy:focus-visible:outline-offset-2 uy:focus-visible:outline-utility-focus-ring"
14
14
  ]