@payfit/unity-components 2.46.20 → 2.46.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/checkbox/Checkbox.d.ts +2 -2
- package/dist/esm/components/checkbox/Checkbox.js +41 -42
- package/dist/esm/components/checkbox/CheckboxStandalone.d.ts +2 -2
- package/dist/esm/components/checkbox/CheckboxStandalone.js +14 -15
- package/dist/esm/components/radio-button-group/parts/RadioButton.d.ts +2 -2
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +18 -19
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.d.ts +2 -2
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.js +27 -22
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.d.ts +2 -2
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.js +18 -18
- package/dist/esm/components/toggle-switch/ToggleSwitch.d.ts +2 -2
- package/dist/esm/components/toggle-switch/ToggleSwitch.js +48 -66
- package/package.json +15 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface CheckboxProps extends Omit<
|
|
2
|
+
import { CheckboxFieldProps as AriaCheckboxFieldProps } from 'react-aria-components/Checkbox';
|
|
3
|
+
export interface CheckboxProps extends Omit<AriaCheckboxFieldProps, 'className'> {
|
|
4
4
|
/**
|
|
5
5
|
* The content to display as the checkbox label.
|
|
6
6
|
* This is required for accessibility.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as r, jsx as
|
|
1
|
+
import { jsxs as r, jsx as a, Fragment as B } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as R, isValidElement as h, cloneElement as f } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { useId as
|
|
3
|
+
import { CheckboxField as D, CheckboxButton as E } from "react-aria-components/Checkbox";
|
|
4
|
+
import { useId as F } from "react-aria/useId";
|
|
5
5
|
import { Text as N } from "../text/Text.js";
|
|
6
6
|
import { checkbox as V } from "./Checkbox.variants.js";
|
|
7
|
-
import { CheckboxIndicator as
|
|
8
|
-
const
|
|
9
|
-
({ children:
|
|
10
|
-
const
|
|
11
|
-
isDisabled:
|
|
12
|
-
isReadOnly:
|
|
13
|
-
isInvalid:
|
|
14
|
-
isRequired:
|
|
7
|
+
import { CheckboxIndicator as L } from "./parts/CheckboxIndicator.js";
|
|
8
|
+
const O = R(
|
|
9
|
+
({ children: u, helperText: i, feedbackText: l, ...o }, v) => {
|
|
10
|
+
const e = F(), {
|
|
11
|
+
isDisabled: s,
|
|
12
|
+
isReadOnly: n,
|
|
13
|
+
isInvalid: t,
|
|
14
|
+
isRequired: d,
|
|
15
15
|
requiredVariant: c = "required",
|
|
16
16
|
...x
|
|
17
17
|
} = o, {
|
|
@@ -24,83 +24,82 @@ const L = R(
|
|
|
24
24
|
helperText: m,
|
|
25
25
|
feedbackText: b
|
|
26
26
|
} = V({
|
|
27
|
-
isDisabled:
|
|
28
|
-
isReadOnly:
|
|
29
|
-
isInvalid:
|
|
30
|
-
}),
|
|
27
|
+
isDisabled: s,
|
|
28
|
+
isReadOnly: n,
|
|
29
|
+
isInvalid: t
|
|
30
|
+
}), y = [o["aria-labelledby"], `${e}-label`].filter(Boolean), p = [
|
|
31
31
|
o["aria-describedby"],
|
|
32
|
-
typeof i == "string" ? `${
|
|
33
|
-
typeof l == "string" ? `${
|
|
34
|
-
].filter(Boolean), I =
|
|
32
|
+
typeof i == "string" ? `${e}-helper-text` : void 0,
|
|
33
|
+
typeof l == "string" ? `${e}-feedback-text` : void 0
|
|
34
|
+
].filter(Boolean), I = y.length > 0 ? y.join(" ") : void 0, S = p.length > 0 ? p.join(" ") : void 0;
|
|
35
35
|
return /* @__PURE__ */ r("div", { className: g(), children: [
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ a(
|
|
37
37
|
D,
|
|
38
38
|
{
|
|
39
39
|
...x,
|
|
40
|
-
isInvalid:
|
|
41
|
-
|
|
42
|
-
className: $(),
|
|
40
|
+
isInvalid: t,
|
|
41
|
+
className: "uy:contents",
|
|
43
42
|
"aria-labelledby": I,
|
|
44
43
|
"aria-describedby": S,
|
|
45
|
-
isDisabled:
|
|
46
|
-
isReadOnly:
|
|
47
|
-
children: (j) => /* @__PURE__ */ r(B, { children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
44
|
+
isDisabled: s,
|
|
45
|
+
isReadOnly: n,
|
|
46
|
+
children: /* @__PURE__ */ a(E, { ref: v, className: $(), children: (j) => /* @__PURE__ */ r(B, { children: [
|
|
47
|
+
/* @__PURE__ */ a(
|
|
48
|
+
L,
|
|
50
49
|
{
|
|
51
50
|
...j,
|
|
52
51
|
className: "uy:mt-25 uy:ml-0"
|
|
53
52
|
}
|
|
54
53
|
),
|
|
55
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ a(
|
|
56
55
|
"span",
|
|
57
56
|
{
|
|
58
|
-
id: `${
|
|
57
|
+
id: `${e}-label`,
|
|
59
58
|
className: k(),
|
|
60
59
|
"data-dd-privacy": "allow",
|
|
61
|
-
children:
|
|
60
|
+
children: u
|
|
62
61
|
}
|
|
63
62
|
),
|
|
64
|
-
c === "required" &&
|
|
63
|
+
c === "required" && d && /* @__PURE__ */ r("span", { className: C(), children: [
|
|
65
64
|
"*",
|
|
66
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ a("span", { className: "uy:sr-only", children: "required" })
|
|
67
66
|
] }),
|
|
68
|
-
c === "optional" && !
|
|
69
|
-
] })
|
|
67
|
+
c === "optional" && !d && /* @__PURE__ */ a("span", { className: q(), children: "(optional)" })
|
|
68
|
+
] }) })
|
|
70
69
|
}
|
|
71
70
|
),
|
|
72
71
|
(i || l) && /* @__PURE__ */ r("div", { className: w(), "data-dd-privacy": "allow", children: [
|
|
73
|
-
typeof i == "string" ? /* @__PURE__ */
|
|
72
|
+
typeof i == "string" ? /* @__PURE__ */ a(
|
|
74
73
|
N,
|
|
75
74
|
{
|
|
76
75
|
variant: "bodySmall",
|
|
77
76
|
color: "content.neutral.low",
|
|
78
|
-
id: `${
|
|
77
|
+
id: `${e}-helper-text`,
|
|
79
78
|
className: m(),
|
|
80
79
|
children: i
|
|
81
80
|
}
|
|
82
81
|
) : h(i) && f(i, {
|
|
83
|
-
"data-id": `${
|
|
82
|
+
"data-id": `${e}-helper-text`,
|
|
84
83
|
className: m()
|
|
85
84
|
}),
|
|
86
|
-
|
|
85
|
+
t && (typeof l == "string" ? /* @__PURE__ */ a(
|
|
87
86
|
N,
|
|
88
87
|
{
|
|
89
88
|
variant: "bodySmallStrong",
|
|
90
89
|
color: "content.form.invalid",
|
|
91
|
-
id: `${
|
|
90
|
+
id: `${e}-feedback-text`,
|
|
92
91
|
className: b(),
|
|
93
92
|
children: l
|
|
94
93
|
}
|
|
95
94
|
) : h(l) && f(l, {
|
|
96
|
-
"data-id": `${
|
|
95
|
+
"data-id": `${e}-feedback-text`,
|
|
97
96
|
className: b()
|
|
98
97
|
}))
|
|
99
98
|
] })
|
|
100
99
|
] });
|
|
101
100
|
}
|
|
102
101
|
);
|
|
103
|
-
|
|
102
|
+
O.displayName = "Checkbox";
|
|
104
103
|
export {
|
|
105
|
-
|
|
104
|
+
O as Checkbox
|
|
106
105
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface CheckboxStandaloneProps extends
|
|
2
|
+
import { CheckboxFieldProps as AriaCheckboxFieldProps } from 'react-aria-components/Checkbox';
|
|
3
|
+
export interface CheckboxStandaloneProps extends AriaCheckboxFieldProps {
|
|
4
4
|
/**
|
|
5
5
|
* The content to display as the checkbox label.
|
|
6
6
|
* This is required for accessibility.
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as f } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as x } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { useId as
|
|
5
|
-
import { checkbox as
|
|
3
|
+
import { CheckboxField as y, CheckboxButton as p } from "react-aria-components/Checkbox";
|
|
4
|
+
import { useId as k } from "react-aria/useId";
|
|
5
|
+
import { checkbox as u } from "./Checkbox.variants.js";
|
|
6
6
|
import { CheckboxIndicator as C } from "./parts/CheckboxIndicator.js";
|
|
7
|
-
const
|
|
8
|
-
const o =
|
|
7
|
+
const N = x(({ children: r, ...a }, i) => {
|
|
8
|
+
const o = k(), { isDisabled: n, isReadOnly: s, isInvalid: t } = a, { base: c, wrapper: d } = u({
|
|
9
9
|
isDisabled: n,
|
|
10
10
|
isReadOnly: s,
|
|
11
|
-
isInvalid:
|
|
11
|
+
isInvalid: t
|
|
12
12
|
}), l = [a["aria-labelledby"], `${o}-label`].filter(Boolean), m = l.length > 0 ? l.join(" ") : void 0;
|
|
13
|
-
return /* @__PURE__ */ e("div", { className:
|
|
14
|
-
|
|
13
|
+
return /* @__PURE__ */ e("div", { className: c(), children: /* @__PURE__ */ e(
|
|
14
|
+
y,
|
|
15
15
|
{
|
|
16
16
|
...a,
|
|
17
|
-
|
|
18
|
-
className: c(),
|
|
17
|
+
className: "uy:contents",
|
|
19
18
|
"aria-labelledby": m,
|
|
20
|
-
children: (b) => /* @__PURE__ */ f
|
|
19
|
+
children: /* @__PURE__ */ e(p, { ref: i, className: d(), children: (b) => /* @__PURE__ */ h(f, { children: [
|
|
21
20
|
/* @__PURE__ */ e(C, { ...b }),
|
|
22
21
|
/* @__PURE__ */ e("span", { id: `${o}-label`, className: "uy:sr-only", children: r })
|
|
23
|
-
] })
|
|
22
|
+
] }) })
|
|
24
23
|
}
|
|
25
24
|
) });
|
|
26
25
|
});
|
|
27
|
-
|
|
26
|
+
N.displayName = "CheckboxStandalone";
|
|
28
27
|
export {
|
|
29
|
-
|
|
28
|
+
N as CheckboxStandalone
|
|
30
29
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { RadioFieldProps } from 'react-aria-components/RadioGroup';
|
|
4
4
|
export { RadioIndicator } from './RadioIndicator.js';
|
|
5
5
|
export type { RadioIndicatorProps, RadioState } from './RadioIndicator.js';
|
|
6
6
|
export declare const radioButton: import('tailwind-variants').TVReturnType<{
|
|
@@ -64,7 +64,7 @@ export declare const radioButton: import('tailwind-variants').TVReturnType<{
|
|
|
64
64
|
* @see {@link RadioButtonGroup} for the parent component
|
|
65
65
|
*/
|
|
66
66
|
declare const RadioButton: import('react').ForwardRefExoticComponent<RadioButtonProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
67
|
-
export interface RadioButtonProps extends Omit<
|
|
67
|
+
export interface RadioButtonProps extends Omit<RadioFieldProps, 'children'>, VariantProps<typeof radioButton> {
|
|
68
68
|
/**
|
|
69
69
|
* The content to display as the radio button's label.
|
|
70
70
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as a, jsx as t
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { RadioGroupStateContext as w,
|
|
5
|
-
import { Flex as
|
|
6
|
-
import { Text as
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f, useContext as x } from "react";
|
|
3
|
+
import { uyTv as g, useUnityTheme as h } from "@payfit/unity-themes";
|
|
4
|
+
import { RadioGroupStateContext as R, RadioField as w, RadioButton as B } from "react-aria-components/RadioGroup";
|
|
5
|
+
import { Flex as N } from "../../flex/Flex.js";
|
|
6
|
+
import { Text as v } from "../../text/Text.js";
|
|
7
7
|
import { RadioButtonHelper as S } from "./RadioButtonHelper.js";
|
|
8
8
|
import { RadioIndicator as j } from "./RadioIndicator.js";
|
|
9
|
-
const C =
|
|
9
|
+
const C = g({
|
|
10
10
|
slots: {
|
|
11
11
|
container: [
|
|
12
12
|
"uy:group uy:inline-flex uy:flex-col uy:gap-50",
|
|
@@ -29,29 +29,28 @@ const C = h({
|
|
|
29
29
|
"uy:group-data-[readonly=true]:text-content-neutral uy:group-data-[readonly]:cursor-text"
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
|
-
}), F =
|
|
33
|
-
({ children: u, value: d, isDisabled:
|
|
34
|
-
const { base: l, label: s, container: y, radio:
|
|
35
|
-
return /* @__PURE__ */ a(
|
|
32
|
+
}), F = f(
|
|
33
|
+
({ children: u, value: d, isDisabled: e, helperText: r, ...n }, i) => {
|
|
34
|
+
const { base: l, label: s, container: y, radio: c } = C(), o = x(R), { theme: m } = h(), p = o?.isReadOnly ? "readonly" : o?.isDisabled || e ? "disabled" : o?.isInvalid ? "invalid" : "enabled";
|
|
35
|
+
return /* @__PURE__ */ a(N, { direction: "col", gap: "50", className: y(), children: [
|
|
36
36
|
/* @__PURE__ */ t(
|
|
37
|
-
|
|
37
|
+
w,
|
|
38
38
|
{
|
|
39
39
|
...n,
|
|
40
40
|
value: d,
|
|
41
|
-
isDisabled:
|
|
42
|
-
className:
|
|
43
|
-
ref: i,
|
|
44
|
-
children: ({ isSelected: b }) => /* @__PURE__ */ a(f, { children: [
|
|
41
|
+
isDisabled: e,
|
|
42
|
+
className: "uy:contents",
|
|
43
|
+
children: ({ isSelected: b }) => /* @__PURE__ */ a(B, { ref: i, className: () => l(), children: [
|
|
45
44
|
/* @__PURE__ */ t(
|
|
46
45
|
j,
|
|
47
46
|
{
|
|
48
47
|
isSelected: b,
|
|
49
48
|
state: p,
|
|
50
|
-
theme:
|
|
51
|
-
className:
|
|
49
|
+
theme: m,
|
|
50
|
+
className: c()
|
|
52
51
|
}
|
|
53
52
|
),
|
|
54
|
-
/* @__PURE__ */ t(
|
|
53
|
+
/* @__PURE__ */ t(v, { variant: "body", className: s(), children: u })
|
|
55
54
|
] })
|
|
56
55
|
}
|
|
57
56
|
),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { CheckboxFieldProps as AriaCheckboxFieldProps } from 'react-aria-components/Checkbox';
|
|
4
4
|
import { selectableCard } from '../../selectableCard.variant.js';
|
|
5
|
-
export interface SelectableCardCheckboxProps extends Omit<
|
|
5
|
+
export interface SelectableCardCheckboxProps extends Omit<AriaCheckboxFieldProps, 'children'>, VariantProps<typeof selectableCard> {
|
|
6
6
|
/**
|
|
7
7
|
* The title of the selectable card.
|
|
8
8
|
*/
|
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
import { jsx as r, jsxs as m, Fragment as d } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import { useId as
|
|
5
|
-
import { CheckboxIndicator as
|
|
6
|
-
import { Text as
|
|
7
|
-
import { Content as
|
|
8
|
-
import { Description as
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { CheckboxField as h, CheckboxButton as f } from "react-aria-components/Checkbox";
|
|
4
|
+
import { useId as p } from "react-aria/useId";
|
|
5
|
+
import { CheckboxIndicator as b } from "../../../checkbox/parts/CheckboxIndicator.js";
|
|
6
|
+
import { Text as x } from "../../../text/Text.js";
|
|
7
|
+
import { Content as C } from "../../internals/Content.js";
|
|
8
|
+
import { Description as u } from "../../internals/Description.js";
|
|
9
9
|
import { Illustration as k } from "../../internals/Illustration.js";
|
|
10
|
-
import { SelectedIndicator as
|
|
11
|
-
import { selectableCard as
|
|
12
|
-
const
|
|
13
|
-
const { base: l } =
|
|
14
|
-
return /* @__PURE__ */ r(
|
|
15
|
-
|
|
10
|
+
import { SelectedIndicator as g } from "../../internals/SelectedIndicator.js";
|
|
11
|
+
import { selectableCard as y } from "../../selectableCard.variant.js";
|
|
12
|
+
const I = s(({ title: c, description: o, illustration: t, ...i }, a) => {
|
|
13
|
+
const { base: l } = y(), n = p();
|
|
14
|
+
return /* @__PURE__ */ r(h, { className: "uy:contents", ...i, children: /* @__PURE__ */ r(
|
|
15
|
+
f,
|
|
16
16
|
{
|
|
17
|
-
ref: a,
|
|
18
17
|
className: ({ isFocusVisible: e }) => l({ isFocusVisible: e }),
|
|
19
|
-
|
|
18
|
+
ref: a,
|
|
20
19
|
children: (e) => /* @__PURE__ */ m(d, { children: [
|
|
21
|
-
/* @__PURE__ */ r(
|
|
22
|
-
|
|
20
|
+
/* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(
|
|
21
|
+
b,
|
|
22
|
+
{
|
|
23
|
+
className: "uy:group-hover:border-border-form-hover",
|
|
24
|
+
...e
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ m(C, { children: [
|
|
23
28
|
t && /* @__PURE__ */ r(k, { children: t }),
|
|
24
|
-
/* @__PURE__ */ r(
|
|
25
|
-
o && /* @__PURE__ */ r(
|
|
29
|
+
/* @__PURE__ */ r(x, { variant: "bodyLargeStrong", asElement: "h3", id: `${n}-label`, children: c }),
|
|
30
|
+
o && /* @__PURE__ */ r(u, { children: o })
|
|
26
31
|
] })
|
|
27
32
|
] })
|
|
28
33
|
}
|
|
29
|
-
);
|
|
34
|
+
) });
|
|
30
35
|
});
|
|
31
|
-
|
|
36
|
+
I.displayName = "SelectableCardCheckbox";
|
|
32
37
|
export {
|
|
33
|
-
|
|
38
|
+
I as SelectableCardCheckbox
|
|
34
39
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { RadioFieldProps } from 'react-aria-components/RadioGroup';
|
|
4
4
|
import { selectableCard } from '../../selectableCard.variant.js';
|
|
5
|
-
export interface SelectableCardRadioProps extends Omit<
|
|
5
|
+
export interface SelectableCardRadioProps extends Omit<RadioFieldProps, 'children'>, PropsWithChildren<VariantProps<typeof selectableCard>> {
|
|
6
6
|
/**
|
|
7
7
|
* The title of the selectable card.
|
|
8
8
|
*/
|
package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { useUnityTheme as
|
|
4
|
-
import { RadioGroupStateContext as
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { useId as b, useContext as u } from "react";
|
|
3
|
+
import { useUnityTheme as y } from "@payfit/unity-themes";
|
|
4
|
+
import { RadioGroupStateContext as R, RadioField as S, RadioButton as x } from "react-aria-components/RadioGroup";
|
|
5
5
|
import { RadioIndicator as C } from "../../../radio-button-group/parts/RadioIndicator.js";
|
|
6
6
|
import { Text as I } from "../../../text/Text.js";
|
|
7
|
-
import { Content as
|
|
8
|
-
import { Description as
|
|
9
|
-
import { Illustration as
|
|
7
|
+
import { Content as g } from "../../internals/Content.js";
|
|
8
|
+
import { Description as v } from "../../internals/Description.js";
|
|
9
|
+
import { Illustration as N } from "../../internals/Illustration.js";
|
|
10
10
|
import { SelectedIndicator as j } from "../../internals/SelectedIndicator.js";
|
|
11
|
-
import { selectableCard as
|
|
11
|
+
import { selectableCard as F } from "../../selectableCard.variant.js";
|
|
12
12
|
const T = ({
|
|
13
13
|
title: l,
|
|
14
|
-
description:
|
|
14
|
+
description: r,
|
|
15
15
|
illustration: a,
|
|
16
16
|
isDisabled: i,
|
|
17
17
|
...m
|
|
18
18
|
}) => {
|
|
19
|
-
const s =
|
|
19
|
+
const s = b(), { theme: c } = y(), { base: p } = F(), t = u(R), f = t?.isReadOnly ? "readonly" : t?.isDisabled || i ? "disabled" : t?.isInvalid ? "invalid" : "enabled", d = `selectable-card-radio-${s}__title`;
|
|
20
20
|
return /* @__PURE__ */ e(
|
|
21
|
-
|
|
21
|
+
S,
|
|
22
22
|
{
|
|
23
|
-
className: ({ isFocusVisible: r }) => p({ isFocusVisible: r }),
|
|
24
23
|
"aria-labelledby": d,
|
|
25
24
|
isDisabled: i,
|
|
25
|
+
className: "uy:contents",
|
|
26
26
|
...m,
|
|
27
|
-
children: ({ isSelected:
|
|
27
|
+
children: /* @__PURE__ */ e(x, { className: ({ isFocusVisible: o }) => p({ isFocusVisible: o }), children: ({ isSelected: o }) => /* @__PURE__ */ n(h, { children: [
|
|
28
28
|
/* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
29
29
|
C,
|
|
30
30
|
{
|
|
31
|
-
isSelected:
|
|
31
|
+
isSelected: o,
|
|
32
32
|
state: f,
|
|
33
33
|
theme: c
|
|
34
34
|
}
|
|
35
35
|
) }),
|
|
36
|
-
/* @__PURE__ */ n(
|
|
37
|
-
a && /* @__PURE__ */ e(
|
|
36
|
+
/* @__PURE__ */ n(g, { children: [
|
|
37
|
+
a && /* @__PURE__ */ e(N, { children: a }),
|
|
38
38
|
/* @__PURE__ */ e(I, { asElement: "h3", variant: "bodyLargeStrong", id: d, children: l }),
|
|
39
|
-
|
|
39
|
+
r && /* @__PURE__ */ e(v, { children: r })
|
|
40
40
|
] })
|
|
41
|
-
] })
|
|
41
|
+
] }) })
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
-
import {
|
|
2
|
+
import { SwitchFieldProps as AriaSwitchFieldProps } from 'react-aria-components/Switch';
|
|
3
3
|
export declare const toggleSwitch: import('tailwind-variants').TVReturnType<{
|
|
4
4
|
isDisabled: {
|
|
5
5
|
false: {
|
|
@@ -58,7 +58,7 @@ export declare const toggleSwitch: import('tailwind-variants').TVReturnType<{
|
|
|
58
58
|
indicator: string[];
|
|
59
59
|
knob: string[];
|
|
60
60
|
}, undefined, unknown, unknown, undefined>>;
|
|
61
|
-
export interface ToggleSwitchProps extends Omit<
|
|
61
|
+
export interface ToggleSwitchProps extends Omit<AriaSwitchFieldProps, 'children' | 'className' | 'style'>, VariantProps<typeof toggleSwitch> {
|
|
62
62
|
/** The label for the toggle switch. */
|
|
63
63
|
label: string;
|
|
64
64
|
/** Whether the label is visually hidden and accessible only to screen readers. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import {
|
|
5
|
-
import { useBreakpointListener as
|
|
6
|
-
const x =
|
|
2
|
+
import { forwardRef as v } from "react";
|
|
3
|
+
import { uyTv as w } from "@payfit/unity-themes";
|
|
4
|
+
import { SwitchField as m, SwitchButton as b } from "react-aria-components/Switch";
|
|
5
|
+
import { useBreakpointListener as N } from "../../hooks/use-breakpoint-listener.js";
|
|
6
|
+
const x = w({
|
|
7
7
|
slots: {
|
|
8
8
|
container: ["uy:flex uy:flex-col uy:sm:flex-row uy:gap-100 uy:group"],
|
|
9
9
|
mobileContainer: [
|
|
@@ -55,76 +55,58 @@ const x = v({
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
}),
|
|
58
|
+
}), k = v(
|
|
59
59
|
({
|
|
60
|
-
label:
|
|
60
|
+
label: s,
|
|
61
61
|
helperText: r,
|
|
62
|
-
isLabelSrOnly:
|
|
62
|
+
isLabelSrOnly: u = !1,
|
|
63
63
|
isDisabled: d,
|
|
64
|
-
...
|
|
65
|
-
},
|
|
64
|
+
...g
|
|
65
|
+
}, o) => {
|
|
66
66
|
const {
|
|
67
67
|
container: t,
|
|
68
|
-
indicator:
|
|
69
|
-
knob:
|
|
68
|
+
indicator: l,
|
|
69
|
+
knob: i,
|
|
70
70
|
textWrapper: y,
|
|
71
71
|
label: c,
|
|
72
|
-
hintText:
|
|
73
|
-
mobileContainer:
|
|
74
|
-
} = x({ isDisabled: d }),
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
children: [
|
|
107
|
-
/* @__PURE__ */ e("div", { className: i(), "data-dd-privacy": "mask", children: /* @__PURE__ */ e("div", { className: l() }) }),
|
|
108
|
-
/* @__PURE__ */ a(
|
|
109
|
-
"div",
|
|
110
|
-
{
|
|
111
|
-
className: y({
|
|
112
|
-
className: o ? "uy:sr-only" : ""
|
|
113
|
-
}),
|
|
114
|
-
"data-dd-privacy": "allow",
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ e("span", { className: c(), children: u }),
|
|
117
|
-
r && /* @__PURE__ */ e("span", { className: p(), children: r })
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
);
|
|
72
|
+
hintText: n,
|
|
73
|
+
mobileContainer: f
|
|
74
|
+
} = x({ isDisabled: d }), h = N() === "xs", p = { ...g, role: "switch" };
|
|
75
|
+
return h ? /* @__PURE__ */ e(m, { ...p, className: "uy:contents", isDisabled: d, children: /* @__PURE__ */ e(b, { ref: o, className: t(), children: /* @__PURE__ */ a("div", { className: f(), children: [
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: y({
|
|
80
|
+
className: u ? "uy:sr-only" : ""
|
|
81
|
+
}),
|
|
82
|
+
"data-dd-privacy": "allow",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ e("span", { className: c(), children: s }),
|
|
85
|
+
r && /* @__PURE__ */ e("span", { className: n(), children: r })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ e("div", { className: l(), "data-dd-privacy": "mask", children: /* @__PURE__ */ e("div", { className: i() }) })
|
|
90
|
+
] }) }) }) : /* @__PURE__ */ e(m, { ...p, className: "uy:contents", isDisabled: d, children: /* @__PURE__ */ a(b, { className: t(), ref: o, children: [
|
|
91
|
+
/* @__PURE__ */ e("div", { className: l(), "data-dd-privacy": "mask", children: /* @__PURE__ */ e("div", { className: i() }) }),
|
|
92
|
+
/* @__PURE__ */ a(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
className: y({
|
|
96
|
+
className: u ? "uy:sr-only" : ""
|
|
97
|
+
}),
|
|
98
|
+
"data-dd-privacy": "allow",
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ e("span", { className: c(), children: s }),
|
|
101
|
+
r && /* @__PURE__ */ e("span", { className: n(), children: r })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }) });
|
|
124
106
|
}
|
|
125
107
|
);
|
|
126
|
-
|
|
108
|
+
k.displayName = "ToggleSwitch";
|
|
127
109
|
export {
|
|
128
|
-
|
|
110
|
+
k as ToggleSwitch,
|
|
129
111
|
x as toggleSwitch
|
|
130
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "2.46.
|
|
3
|
+
"version": "2.46.22",
|
|
4
4
|
"module": "./dist/esm/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"@formatjs/intl": "4.1.12",
|
|
63
63
|
"@hookform/devtools": "4.4.0",
|
|
64
64
|
"@hookform/resolvers": "5.2.1",
|
|
65
|
-
"@internationalized/date": "3.12.
|
|
65
|
+
"@internationalized/date": "3.12.2",
|
|
66
66
|
"@radix-ui/react-avatar": "1.1.11",
|
|
67
67
|
"@radix-ui/react-slot": "1.2.4",
|
|
68
|
-
"@react-aria/interactions": "3.28.
|
|
69
|
-
"@react-aria/utils": "3.34.
|
|
68
|
+
"@react-aria/interactions": "3.28.1",
|
|
69
|
+
"@react-aria/utils": "3.34.1",
|
|
70
70
|
"@react-types/shared": "3.26.0",
|
|
71
71
|
"@standard-schema/spec": "1.1.0",
|
|
72
72
|
"@tanstack/form-core": "1.33.0",
|
|
@@ -79,20 +79,20 @@
|
|
|
79
79
|
"embla-carousel-react": "9.0.0-rc02",
|
|
80
80
|
"prettier": "3.8.3",
|
|
81
81
|
"react": "18.3.1",
|
|
82
|
-
"react-aria": "3.
|
|
83
|
-
"react-aria-components": "1.
|
|
82
|
+
"react-aria": "3.49.0",
|
|
83
|
+
"react-aria-components": "1.18.0",
|
|
84
84
|
"react-dom": "18.3.1",
|
|
85
85
|
"react-hook-form": "7.62.0",
|
|
86
86
|
"react-hot-toast": "2.5.1",
|
|
87
87
|
"react-hotkeys-hook": "5.1.0",
|
|
88
88
|
"react-international-phone": "4.5.0",
|
|
89
89
|
"react-intl": "7.1.14",
|
|
90
|
-
"react-stately": "3.
|
|
90
|
+
"react-stately": "3.47.0",
|
|
91
91
|
"storybook": "10.4.1",
|
|
92
92
|
"tailwind-variants": "3.2.2",
|
|
93
93
|
"usehooks-ts": "3.1.1",
|
|
94
94
|
"zod": "4.4.3",
|
|
95
|
-
"@payfit/unity-illustrations": "2.46.
|
|
95
|
+
"@payfit/unity-illustrations": "2.46.22"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@hookform/devtools": "^4",
|
|
@@ -104,14 +104,14 @@
|
|
|
104
104
|
"react-hook-form": "^7",
|
|
105
105
|
"react-router-dom": "^5",
|
|
106
106
|
"zod": "^3 || ^4",
|
|
107
|
-
"@payfit/unity-icons": "2.46.
|
|
108
|
-
"@payfit/unity-themes": "2.46.
|
|
107
|
+
"@payfit/unity-icons": "2.46.22",
|
|
108
|
+
"@payfit/unity-themes": "2.46.22"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@figma/code-connect": "1.4.3",
|
|
112
112
|
"@github-ui/storybook-addon-performance-panel": "1.1.4",
|
|
113
113
|
"@hookform/devtools": "4.4.0",
|
|
114
|
-
"@internationalized/date": "3.12.
|
|
114
|
+
"@internationalized/date": "3.12.2",
|
|
115
115
|
"@storybook/addon-a11y": "10.4.1",
|
|
116
116
|
"@storybook/addon-designs": "11.1.3",
|
|
117
117
|
"@storybook/addon-docs": "10.4.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"@tanstack/intent": "0.0.40",
|
|
124
124
|
"@tanstack/react-devtools": "0.10.5",
|
|
125
125
|
"@tanstack/react-form-devtools": "0.2.29",
|
|
126
|
-
"@tanstack/react-query": "5.
|
|
126
|
+
"@tanstack/react-query": "5.101.0",
|
|
127
127
|
"@tanstack/react-router": "1.170.10",
|
|
128
128
|
"@tanstack/react-router-devtools": "1.167.0",
|
|
129
129
|
"@testing-library/dom": "10.4.0",
|
|
@@ -154,9 +154,9 @@
|
|
|
154
154
|
"@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
|
|
155
155
|
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
156
156
|
"@payfit/storybook-config": "0.0.0-use.local",
|
|
157
|
-
"@payfit/unity-icons": "2.46.
|
|
158
|
-
"@payfit/unity-illustrations": "2.46.
|
|
159
|
-
"@payfit/unity-themes": "2.46.
|
|
157
|
+
"@payfit/unity-icons": "2.46.22",
|
|
158
|
+
"@payfit/unity-illustrations": "2.46.22",
|
|
159
|
+
"@payfit/unity-themes": "2.46.22",
|
|
160
160
|
"@payfit/vite-configs": "0.0.0-use.local"
|
|
161
161
|
},
|
|
162
162
|
"peerDependenciesMeta": {
|