@payfit/unity-components 0.0.0-alpha.11 → 0.0.0-alpha.12
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/cjs/components/checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
- package/dist/cjs/components/checkbox/parts/CheckboxIndicator.cjs +1 -1
- package/dist/cjs/components/date-picker-field/test-utils.cjs +1 -0
- package/dist/cjs/components/date-picker-field/test-utils.d.cts +12 -0
- package/dist/cjs/components/select-field/test-utils.d.cts +11 -0
- package/dist/cjs/components/toggle-switch/ToggleSwitch.cjs +1 -1
- package/dist/cjs/components/toggle-switch/ToggleSwitch.d.cts +71 -49
- package/dist/cjs/components/toggle-switch-field/ToggleSwitchField.cjs +1 -1
- package/dist/cjs/components/toggle-switch-field/ToggleSwitchField.d.cts +2 -7
- package/dist/cjs/index.storybook-testing.d.cts +1 -0
- package/dist/cjs/storybook-testing.cjs +1 -0
- package/dist/cjs/storybook-utilities/breadcrumbs/transform.d.cts +2 -0
- package/dist/cjs/storybook-utilities/previewTransform.d.cts +1 -0
- package/dist/cjs/types/testing.d.cts +2 -0
- package/dist/esm/components/checkbox/Checkbox.js +21 -29
- package/dist/esm/components/checkbox/Checkbox.variants.js +1 -1
- package/dist/esm/components/checkbox/parts/CheckboxIndicator.js +1 -1
- package/dist/esm/components/date-picker-field/test-utils.d.ts +12 -0
- package/dist/esm/components/date-picker-field/test-utils.js +35 -0
- package/dist/esm/components/select-field/test-utils.d.ts +11 -0
- package/dist/esm/components/toggle-switch/ToggleSwitch.d.ts +71 -49
- package/dist/esm/components/toggle-switch/ToggleSwitch.js +50 -29
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -7
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +41 -55
- package/dist/esm/index.storybook-testing.d.ts +1 -0
- package/dist/esm/storybook-testing.js +4 -0
- package/dist/esm/storybook-utilities/breadcrumbs/transform.d.ts +2 -0
- package/dist/esm/storybook-utilities/previewTransform.d.ts +1 -0
- package/dist/esm/types/testing.d.ts +2 -0
- package/package.json +43 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),S=require("react-aria"),I=require("react-aria-components"),b=require("../text/Text.cjs"),w=require("./Checkbox.variants.cjs"),R=require("./parts/CheckboxIndicator.cjs"),x=r.forwardRef(({children:y,helperText:i,feedbackText:s,...t},m)=>{const a=S.useId(),{isDisabled:u,isReadOnly:h,isInvalid:n,isRequired:l,requiredVariant:o="required"}=t,{base:j,wrapper:p,asterisk:v,optionalTag:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),S=require("react-aria"),I=require("react-aria-components"),b=require("../text/Text.cjs"),w=require("./Checkbox.variants.cjs"),R=require("./parts/CheckboxIndicator.cjs"),x=r.forwardRef(({children:y,helperText:i,feedbackText:s,...t},m)=>{const a=S.useId(),{isDisabled:u,isReadOnly:h,isInvalid:n,isRequired:l,requiredVariant:o="required"}=t,{base:j,wrapper:p,asterisk:v,optionalTag:q,descriptionsContainer:g,helperText:f,feedbackText:N}=w.checkbox({isDisabled:u,isReadOnly:h,isInvalid:n}),c=[t["aria-labelledby"],`${a}-label`].filter(Boolean),d=[t["aria-describedby"],typeof i=="string"?`${a}-helper-text`:void 0,typeof s=="string"?`${a}-feedback-text`:void 0].filter(Boolean),k=c.length>0?c.join(" "):void 0,C=d.length>0?d.join(" "):void 0;return e.jsxs("div",{className:j(),children:[e.jsx(I.Checkbox,{...t,ref:m,className:p(),"aria-labelledby":k,"aria-describedby":C,children:$=>e.jsxs(e.Fragment,{children:[e.jsx(R.CheckboxIndicator,{...$,className:"uy-mr-[6px]"}),e.jsx("span",{id:`${a}-label`,"data-dd-privacy":"allow",children:y}),o==="required"&&l&&e.jsxs("span",{className:v(),children:["*",e.jsx("span",{className:"uy-sr-only",children:"required"})]}),o==="optional"&&!l&&e.jsx("span",{className:q(),children:"(optional)"})]})}),(i||s)&&e.jsxs("div",{className:g(),"data-dd-privacy":"allow",children:[typeof i=="string"?e.jsx(b.Text,{variant:"bodySmall",color:"content.neutral.low",id:`${a}-helper-text`,children:i}):r.isValidElement(i)&&r.cloneElement(i,{"data-id":`${a}-helper-text`,className:f()}),n&&(typeof s=="string"?e.jsx(b.Text,{variant:"bodySmallStrong",color:"content.form.invalid",id:`${a}-feedback-text`,children:s}):r.isValidElement(s)&&r.cloneElement(s,{"data-id":`${a}-feedback-text`,className:N()}))]})]})});x.displayName="Checkbox";exports.Checkbox=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("tailwind-variants"),a=e.tv({slots:{base:"uy-group uy-inline-flex uy-flex-col uy-gap-50 uy-py-[1px]",wrapper:"uy-inline-flex uy-items-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("tailwind-variants"),a=e.tv({slots:{base:"uy-group uy-inline-flex uy-flex-col uy-gap-50 uy-py-[1px]",wrapper:"uy-inline-flex uy-items-start uy-gap-[2px] uy-typography-body uy-text-content-form-enabled data-[focus-visible]:uy-outline data-[focus-visible]:uy-outline-[2px] data-[focus-visible]:uy-outline-utility-focus-ring data-[focus-visible]:uy-outline-offset-2 uy-rounded-25",asterisk:"uy-text-content-danger",optionalTag:"uy-typography-body",descriptionsContainer:"uy-ml-300 uy-leading-0 uy-inline-flex uy-flex-col uy-gap-50",helperText:"uy-typography-body-small uy-text-content-neutral-low",feedbackText:"uy-typography-body-small-strong uy-text-content-form-invalid"},variants:{isDisabled:{true:{base:"!uy-text-content-form-disabled"}},isInvalid:{true:{}},isReadOnly:{true:{base:"uy-cursor-not-allowed"}}},defaultVariants:{isDisabled:!1,isInvalid:!1,isReadOnly:!1},compoundVariants:[{isDisabled:!1,isReadOnly:!1,className:{wrapper:"uy-cursor-pointer"}},{isDisabled:!0,isReadOnly:!1,className:{wrapper:"uy-cursor-not-allowed"}},{isDisabled:!1,isReadOnly:!0,className:{wrapper:"uy-cursor-not-allowed"}},{isDisabled:!0,isReadOnly:!0,className:{wrapper:"uy-cursor-not-allowed"}}]});exports.checkbox=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("tailwind-variants"),c=n.tv({slots:{base:["uy-flex uy-items-center uy-justify-center uy-rounded-50 uy-w-200 uy-h-200 uy-text-content-inverted uy-border uy-border-solid uy-transition-all uy-duration-100"],checkmark:["uy-w-[16px] uy-fill-none uy-stroke-[2px] uy-stroke-content-inverted uy-transition-all uy-duration-500"]},variants:{isSelected:{true:{base:"uy-border-border-form-active uy-bg-surface-form-active"}},isDisabled:{true:""},isReadOnly:{true:""},isInvalid:{true:""}},defaultVariants:{isSelected:!1,isDisabled:!1,isInvalid:!1,isReadOnly:!1},compoundVariants:[{isSelected:!1,isDisabled:!1,isInvalid:!1,isReadOnly:!1,className:{base:"uy-border-border-form-enabled uy-bg-surface-form-enabled"}},{isSelected:!1,isDisabled:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isDisabled:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-border-form-disabled"}},{isSelected:!1,isInvalid:!0,className:{base:"uy-border-border-form-error uy-bg-surface-form-enabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isInvalid:!0,className:{base:"!uy-border-border-danger !uy-bg-surface-danger",checkmark:"uy-text-content-inverted"}},{isSelected:!1,isReadOnly:!0,className:{base:"uy-border-border-form-disabled uy-bg-surface-form-disabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isReadOnly:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-border-form-read-only"}}]});function s({isSelected:r,isDisabled:t,isIndeterminate:a,isInvalid:d,isReadOnly:i,className:o}){const{base:l,checkmark:u}=c({isSelected:r||a,isDisabled:t,isInvalid:d,isReadOnly:i});return e.jsx("div",{className:l({className:o}),"data-dd-privacy":"mask",children:e.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 16 16","aria-hidden":"true",className:u(),style:{strokeDashoffset:r?44:66},children:a?e.jsx("rect",{x:"3",y:"7",width:"10",height:"2",rx:"0.5",stroke:"none",fill:"currentColor"}):e.jsx("polyline",{points:"3.5,8 6.5,11 12.5,5",stroke:"currentColor",strokeDasharray:"22",strokeLinecap:"butt",strokeLinejoin:"bevel"})})})}s.displayName="CheckboxIndicator";exports.CheckboxIndicator=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("tailwind-variants"),c=n.tv({slots:{base:["uy-flex uy-items-center uy-justify-center uy-rounded-50 uy-m-25 uy-w-200 uy-h-200 uy-text-content-inverted uy-border uy-border-solid uy-transition-all uy-duration-100"],checkmark:["uy-w-[16px] uy-fill-none uy-stroke-[2px] uy-stroke-content-inverted uy-transition-all uy-duration-500"]},variants:{isSelected:{true:{base:"uy-border-border-form-active uy-bg-surface-form-active"}},isDisabled:{true:""},isReadOnly:{true:""},isInvalid:{true:""}},defaultVariants:{isSelected:!1,isDisabled:!1,isInvalid:!1,isReadOnly:!1},compoundVariants:[{isSelected:!1,isDisabled:!1,isInvalid:!1,isReadOnly:!1,className:{base:"uy-border-border-form-enabled uy-bg-surface-form-enabled"}},{isSelected:!1,isDisabled:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isDisabled:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-border-form-disabled"}},{isSelected:!1,isInvalid:!0,className:{base:"uy-border-border-form-error uy-bg-surface-form-enabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isInvalid:!0,className:{base:"!uy-border-border-danger !uy-bg-surface-danger",checkmark:"uy-text-content-inverted"}},{isSelected:!1,isReadOnly:!0,className:{base:"uy-border-border-form-disabled uy-bg-surface-form-disabled",checkmark:"uy-text-transparent"}},{isSelected:!0,isReadOnly:!0,className:{base:"!uy-bg-surface-form-disabled uy-border-border-form-disabled",checkmark:"uy-text-border-form-read-only"}}]});function s({isSelected:r,isDisabled:t,isIndeterminate:a,isInvalid:d,isReadOnly:i,className:o}){const{base:l,checkmark:u}=c({isSelected:r||a,isDisabled:t,isInvalid:d,isReadOnly:i});return e.jsx("div",{className:l({className:o}),"data-dd-privacy":"mask",children:e.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 16 16","aria-hidden":"true",className:u(),style:{strokeDashoffset:r?44:66},children:a?e.jsx("rect",{x:"3",y:"7",width:"10",height:"2",rx:"0.5",stroke:"none",fill:"currentColor"}):e.jsx("polyline",{points:"3.5,8 6.5,11 12.5,5",stroke:"currentColor",strokeDasharray:"22",strokeLinecap:"butt",strokeLinejoin:"bevel"})})})}s.displayName="CheckboxIndicator";exports.CheckboxIndicator=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("storybook/test"),s=r=>({fillCalendarDate:async({labelText:a,calendarDate:n})=>{await r.step(`Fill date picker ${a}`,async()=>{const e=i.within(r.canvasElement).getAllByLabelText(a,{exact:!1,selector:"span"});if(e.length!==3)throw new Error(`Date field for ${a} not found`);await i.userEvent.type(e.find(t=>t.getAttribute("data-type")==="day"),String(n.day)),await i.userEvent.type(e.find(t=>t.getAttribute("data-type")==="month"),String(n.month)),await i.userEvent.type(e.find(t=>t.getAttribute("data-type")==="year"),String(n.year))})}});exports.getTestingUtilsDatePicker=s;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { PlayCtx } from '../../types/testing.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Factory to get date picker testing utils
|
|
5
|
+
* @param context the story context
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTestingUtilsDatePicker: (context: PlayCtx) => {
|
|
8
|
+
fillCalendarDate: ({ labelText, calendarDate, }: {
|
|
9
|
+
labelText: string;
|
|
10
|
+
calendarDate: CalendarDate;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PlayCtx } from '../../types/testing.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Factory to get select testing utils
|
|
4
|
+
* @param context the story context
|
|
5
|
+
*/
|
|
6
|
+
export declare const getTestingUtilsSelect: (context: PlayCtx) => {
|
|
7
|
+
selectOption: ({ labelText, optionName, }: {
|
|
8
|
+
labelText: string;
|
|
9
|
+
optionName: string;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),m=require("react-aria-components"),h=require("tailwind-variants"),o=h.tv({slots:{container:["uy-flex uy-gap-100 uy-group"],textWrapper:["uy-flex uy-flex-col uy-gap-50"],label:["uy-typography-body uy-text-content-form-enabled"],hintText:["uy-typography-body-small uy-text-content-neutral-low"],indicator:["uy-p-50 uy-w-500 uy-h-300 uy-flex uy-items-center","uy-rounded-pill","uy-border uy-border-solid uy-border-border-form-disabled uy-bg-surface-form-disabled","uy-cursor-pointer uy-transition-colors uy-duration-200 uy-ease-in-out","group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed","group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled group-data-[disabled]:uy-cursor-not-allowed","group-data-[focus-visible]:uy-outline-2 group-data-[focus-visible]:uy-outline group-data-[focus-visible]:uy-outline-offset-2 group-data-[focus-visible]:uy-outline-utility-focus-ring"],knob:["uy-w-200 uy-h-200 uy-rounded-circle","uy-border uy-border-solid uy-border-border-form-enabled uy-bg-surface-form-enabled","uy-transition-all uy-duration-200 uy-ease-in-out",'group-data-[selected="true"]:uy-translate-x-[90%]',"group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed","group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled"]},variants:{isDisabled:{false:{indicator:'group-data-[selected="true"]:uy-bg-surface-form-active group-data-[selected="true"]:uy-border-border-form-active group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-active group-data-[selected="true"]:group-data-[pressed]:uy-border-border-form-active',knob:'group-data-[selected="true"]:uy-border-border-inverted-enabled group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-pressed group-data-[selected="true"]:group-data-[pressed]:uy-border-border-inverted-pressed'},true:{indicator:"",knob:""}}}}),d=f.forwardRef(({label:t,helperText:r,isLabelSrOnly:u=!1,isDisabled:a,...s},i)=>{const{container:l,indicator:c,knob:y,textWrapper:n,label:b,hintText:p}=o({isDisabled:a}),g={...s,role:"switch"};return e.jsxs(m.Switch,{...g,ref:i,className:l(),isDisabled:a,children:[e.jsx("div",{className:c(),"data-dd-privacy":"mask",children:e.jsx("div",{className:y()})}),e.jsxs("div",{className:n({className:u?"uy-sr-only":""}),"data-dd-privacy":"allow",children:[e.jsx("span",{className:b(),children:t}),r&&e.jsx("span",{className:p(),children:r})]})]})});d.displayName="ToggleSwitch";exports.ToggleSwitch=d;exports.toggleSwitch=o;
|
|
@@ -1,82 +1,104 @@
|
|
|
1
1
|
import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
export declare const toggleSwitch: import('tailwind-variants').TVReturnType<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
indicator
|
|
7
|
-
|
|
8
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
9
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
10
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
11
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
4
|
+
isDisabled: {
|
|
5
|
+
false: {
|
|
6
|
+
indicator: string;
|
|
7
|
+
knob: string;
|
|
12
8
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
17
|
-
indicator?: import('tailwind-merge').ClassNameValue;
|
|
18
|
-
label?: import('tailwind-merge').ClassNameValue;
|
|
19
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
20
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
21
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
22
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
9
|
+
true: {
|
|
10
|
+
indicator: string;
|
|
11
|
+
knob: string;
|
|
23
12
|
};
|
|
24
13
|
};
|
|
25
|
-
}
|
|
14
|
+
}, {
|
|
26
15
|
container: string[];
|
|
27
16
|
textWrapper: string[];
|
|
28
17
|
label: string[];
|
|
29
18
|
hintText: string[];
|
|
30
19
|
indicator: string[];
|
|
31
20
|
knob: string[];
|
|
32
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
indicator
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
knob
|
|
21
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
22
|
+
isDisabled: {
|
|
23
|
+
false: {
|
|
24
|
+
indicator: string;
|
|
25
|
+
knob: string;
|
|
26
|
+
};
|
|
27
|
+
true: {
|
|
28
|
+
indicator: string;
|
|
29
|
+
knob: string;
|
|
41
30
|
};
|
|
42
31
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
indicator
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
knob
|
|
32
|
+
}, {
|
|
33
|
+
isDisabled: {
|
|
34
|
+
false: {
|
|
35
|
+
indicator: string;
|
|
36
|
+
knob: string;
|
|
37
|
+
};
|
|
38
|
+
true: {
|
|
39
|
+
indicator: string;
|
|
40
|
+
knob: string;
|
|
52
41
|
};
|
|
53
42
|
};
|
|
54
|
-
}
|
|
43
|
+
}>, {
|
|
44
|
+
isDisabled: {
|
|
45
|
+
false: {
|
|
46
|
+
indicator: string;
|
|
47
|
+
knob: string;
|
|
48
|
+
};
|
|
49
|
+
true: {
|
|
50
|
+
indicator: string;
|
|
51
|
+
knob: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
55
|
container: string[];
|
|
56
56
|
textWrapper: string[];
|
|
57
57
|
label: string[];
|
|
58
58
|
hintText: string[];
|
|
59
59
|
indicator: string[];
|
|
60
60
|
knob: string[];
|
|
61
|
-
}, import('tailwind-variants').TVReturnType<
|
|
61
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
62
|
+
isDisabled: {
|
|
63
|
+
false: {
|
|
64
|
+
indicator: string;
|
|
65
|
+
knob: string;
|
|
66
|
+
};
|
|
67
|
+
true: {
|
|
68
|
+
indicator: string;
|
|
69
|
+
knob: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
62
73
|
container: string[];
|
|
63
74
|
textWrapper: string[];
|
|
64
75
|
label: string[];
|
|
65
76
|
hintText: string[];
|
|
66
77
|
indicator: string[];
|
|
67
78
|
knob: string[];
|
|
68
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
indicator
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
knob
|
|
79
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
80
|
+
isDisabled: {
|
|
81
|
+
false: {
|
|
82
|
+
indicator: string;
|
|
83
|
+
knob: string;
|
|
84
|
+
};
|
|
85
|
+
true: {
|
|
86
|
+
indicator: string;
|
|
87
|
+
knob: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
isDisabled: {
|
|
92
|
+
false: {
|
|
93
|
+
indicator: string;
|
|
94
|
+
knob: string;
|
|
95
|
+
};
|
|
96
|
+
true: {
|
|
97
|
+
indicator: string;
|
|
98
|
+
knob: string;
|
|
77
99
|
};
|
|
78
100
|
};
|
|
79
|
-
}
|
|
101
|
+
}>, unknown, unknown, undefined>>;
|
|
80
102
|
interface ToggleSwitchProps extends Omit<AriaSwitchProps, 'children' | 'className' | 'style'>, VariantProps<typeof toggleSwitch> {
|
|
81
103
|
/** The label for the toggle switch. */
|
|
82
104
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),w=require("react"),T=require("react-hook-form"),x=require("../form-field/FormField.cjs"),f=require("../form-field/parts/FormControl.cjs"),y=require("../toggle-switch/ToggleSwitch.cjs");function p({name:e,label:o,defaultSelected:t,switchHelperText:i,isInvalid:l,isLoading:n,isDisabled:s,isReadOnly:u,isLabelSrOnly:g,...d},F){const{control:m,watch:a}=T.useFormContext(),h=a(e),S={isInvalid:l,isLoading:n,isDisabled:s,isReadOnly:u};return r.jsx(x.FormField,{control:m,name:e,className:"uy-flex uy-flex-col uy-gap-100",...S,children:r.jsx(f.FormControl,{children:r.jsx(y.ToggleSwitch,{ref:F,defaultSelected:t,isSelected:h,label:o,isLabelSrOnly:g,helperText:i,...d})})})}const c=w.forwardRef(function(o,t){return p(o,t)});c.displayName="ToggleSwitchField";exports.ToggleSwitchField=c;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { ForwardedRef, JSX
|
|
1
|
+
import { ForwardedRef, JSX } from 'react';
|
|
2
2
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
3
|
import { infer as ZodInfer } from 'zod';
|
|
4
4
|
import { Schema } from '../../hooks/use-form.types.cjs';
|
|
5
|
-
|
|
6
|
-
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Pick<LabelProps, 'isRequired' | 'requiredVariant'> {
|
|
5
|
+
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
|
7
6
|
/** The name of the field, which should match the form schema. */
|
|
8
7
|
name: TName;
|
|
9
8
|
/** The label for the toggle switch. */
|
|
10
9
|
label: string;
|
|
11
|
-
/** Helper text to display below form field. */
|
|
12
|
-
helperText?: ReactNode;
|
|
13
10
|
/** Helper text to display below the toggle switch. */
|
|
14
11
|
switchHelperText?: string;
|
|
15
|
-
/** A contextual link to display below the toggle switch. */
|
|
16
|
-
contextualLink?: ReactNode;
|
|
17
12
|
/** The default selected value of the toggle switch. */
|
|
18
13
|
defaultSelected?: boolean;
|
|
19
14
|
/** Whether the toggle switch is disabled. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getTestingUtilsDatePicker } from './components/date-picker-field/test-utils.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./components/date-picker-field/test-utils.cjs");exports.getTestingUtilsDatePicker=e.getTestingUtilsDatePicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const previewTransform: (code: string) => Promise<string>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as a, Fragment as S } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as j, isValidElement as m, cloneElement as b } from "react";
|
|
3
3
|
import { useId as B } from "react-aria";
|
|
4
4
|
import { Checkbox as R } from "react-aria-components";
|
|
5
|
-
import { Text as
|
|
5
|
+
import { Text as p } from "../text/Text.js";
|
|
6
6
|
import { checkbox as D } from "./Checkbox.variants.js";
|
|
7
7
|
import { CheckboxIndicator as E } from "./parts/CheckboxIndicator.js";
|
|
8
8
|
const V = j(
|
|
9
|
-
({ children:
|
|
9
|
+
({ children: y, helperText: i, feedbackText: r, ...o }, h) => {
|
|
10
10
|
const e = B(), {
|
|
11
11
|
isDisabled: f,
|
|
12
12
|
isReadOnly: v,
|
|
13
13
|
isInvalid: t,
|
|
14
|
-
isRequired:
|
|
15
|
-
requiredVariant:
|
|
16
|
-
} =
|
|
17
|
-
base:
|
|
18
|
-
wrapper:
|
|
14
|
+
isRequired: d,
|
|
15
|
+
requiredVariant: n = "required"
|
|
16
|
+
} = o, {
|
|
17
|
+
base: x,
|
|
18
|
+
wrapper: u,
|
|
19
19
|
asterisk: N,
|
|
20
20
|
optionalTag: g,
|
|
21
21
|
descriptionsContainer: $,
|
|
@@ -25,42 +25,34 @@ const V = j(
|
|
|
25
25
|
isDisabled: f,
|
|
26
26
|
isReadOnly: v,
|
|
27
27
|
isInvalid: t
|
|
28
|
-
}),
|
|
29
|
-
|
|
28
|
+
}), s = [o["aria-labelledby"], `${e}-label`].filter(Boolean), c = [
|
|
29
|
+
o["aria-describedby"],
|
|
30
30
|
typeof i == "string" ? `${e}-helper-text` : void 0,
|
|
31
31
|
typeof r == "string" ? `${e}-feedback-text` : void 0
|
|
32
|
-
].filter(Boolean), q =
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
].filter(Boolean), q = s.length > 0 ? s.join(" ") : void 0, w = c.length > 0 ? c.join(" ") : void 0;
|
|
33
|
+
return /* @__PURE__ */ l("div", { className: x(), children: [
|
|
34
34
|
/* @__PURE__ */ a(
|
|
35
35
|
R,
|
|
36
36
|
{
|
|
37
|
-
...
|
|
37
|
+
...o,
|
|
38
38
|
ref: h,
|
|
39
|
-
className:
|
|
39
|
+
className: u(),
|
|
40
40
|
"aria-labelledby": q,
|
|
41
41
|
"aria-describedby": w,
|
|
42
|
-
children: (I) => /* @__PURE__ */
|
|
42
|
+
children: (I) => /* @__PURE__ */ l(S, { children: [
|
|
43
43
|
/* @__PURE__ */ a(E, { ...I, className: "uy-mr-[6px]" }),
|
|
44
|
-
/* @__PURE__ */ a(
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
id: `${e}-label`,
|
|
48
|
-
className: "uy-leading-100",
|
|
49
|
-
"data-dd-privacy": "allow",
|
|
50
|
-
children: p
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
d === "required" && s && /* @__PURE__ */ o("span", { className: N(), children: [
|
|
44
|
+
/* @__PURE__ */ a("span", { id: `${e}-label`, "data-dd-privacy": "allow", children: y }),
|
|
45
|
+
n === "required" && d && /* @__PURE__ */ l("span", { className: N(), children: [
|
|
54
46
|
"*",
|
|
55
47
|
/* @__PURE__ */ a("span", { className: "uy-sr-only", children: "required" })
|
|
56
48
|
] }),
|
|
57
|
-
|
|
49
|
+
n === "optional" && !d && /* @__PURE__ */ a("span", { className: g(), children: "(optional)" })
|
|
58
50
|
] })
|
|
59
51
|
}
|
|
60
52
|
),
|
|
61
|
-
(i || r) && /* @__PURE__ */
|
|
53
|
+
(i || r) && /* @__PURE__ */ l("div", { className: $(), "data-dd-privacy": "allow", children: [
|
|
62
54
|
typeof i == "string" ? /* @__PURE__ */ a(
|
|
63
|
-
|
|
55
|
+
p,
|
|
64
56
|
{
|
|
65
57
|
variant: "bodySmall",
|
|
66
58
|
color: "content.neutral.low",
|
|
@@ -72,7 +64,7 @@ const V = j(
|
|
|
72
64
|
className: k()
|
|
73
65
|
}),
|
|
74
66
|
t && (typeof r == "string" ? /* @__PURE__ */ a(
|
|
75
|
-
|
|
67
|
+
p,
|
|
76
68
|
{
|
|
77
69
|
variant: "bodySmallStrong",
|
|
78
70
|
color: "content.form.invalid",
|
|
@@ -2,7 +2,7 @@ import { tv as e } from "tailwind-variants";
|
|
|
2
2
|
const s = e({
|
|
3
3
|
slots: {
|
|
4
4
|
base: "uy-group uy-inline-flex uy-flex-col uy-gap-50 uy-py-[1px]",
|
|
5
|
-
wrapper: "uy-inline-flex uy-items-
|
|
5
|
+
wrapper: "uy-inline-flex uy-items-start uy-gap-[2px] uy-typography-body uy-text-content-form-enabled data-[focus-visible]:uy-outline data-[focus-visible]:uy-outline-[2px] data-[focus-visible]:uy-outline-utility-focus-ring data-[focus-visible]:uy-outline-offset-2 uy-rounded-25",
|
|
6
6
|
asterisk: "uy-text-content-danger",
|
|
7
7
|
optionalTag: "uy-typography-body",
|
|
8
8
|
descriptionsContainer: "uy-ml-300 uy-leading-0 uy-inline-flex uy-flex-col uy-gap-50",
|
|
@@ -3,7 +3,7 @@ import { tv as u } from "tailwind-variants";
|
|
|
3
3
|
const c = u({
|
|
4
4
|
slots: {
|
|
5
5
|
base: [
|
|
6
|
-
"uy-flex uy-items-center uy-justify-center uy-rounded-50 uy-w-200 uy-h-200 uy-text-content-inverted uy-border uy-border-solid uy-transition-all uy-duration-100"
|
|
6
|
+
"uy-flex uy-items-center uy-justify-center uy-rounded-50 uy-m-25 uy-w-200 uy-h-200 uy-text-content-inverted uy-border uy-border-solid uy-transition-all uy-duration-100"
|
|
7
7
|
],
|
|
8
8
|
checkmark: [
|
|
9
9
|
"uy-w-[16px] uy-fill-none uy-stroke-[2px] uy-stroke-content-inverted uy-transition-all uy-duration-500"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { PlayCtx } from '../../types/testing.js';
|
|
3
|
+
/**
|
|
4
|
+
* Factory to get date picker testing utils
|
|
5
|
+
* @param context the story context
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTestingUtilsDatePicker: (context: PlayCtx) => {
|
|
8
|
+
fillCalendarDate: ({ labelText, calendarDate, }: {
|
|
9
|
+
labelText: string;
|
|
10
|
+
calendarDate: CalendarDate;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { within as s, userEvent as n } from "storybook/test";
|
|
2
|
+
const y = (r) => ({
|
|
3
|
+
fillCalendarDate: async ({
|
|
4
|
+
labelText: a,
|
|
5
|
+
calendarDate: i
|
|
6
|
+
}) => {
|
|
7
|
+
await r.step(`Fill date picker ${a}`, async () => {
|
|
8
|
+
const e = s(r.canvasElement).getAllByLabelText(
|
|
9
|
+
a,
|
|
10
|
+
{
|
|
11
|
+
exact: !1,
|
|
12
|
+
selector: "span"
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
if (e.length !== 3)
|
|
16
|
+
throw new Error(`Date field for ${a} not found`);
|
|
17
|
+
await n.type(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
|
+
e.find((t) => t.getAttribute("data-type") === "day"),
|
|
20
|
+
String(i.day)
|
|
21
|
+
), await n.type(
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
e.find((t) => t.getAttribute("data-type") === "month"),
|
|
24
|
+
String(i.month)
|
|
25
|
+
), await n.type(
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
e.find((t) => t.getAttribute("data-type") === "year"),
|
|
28
|
+
String(i.year)
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
y as getTestingUtilsDatePicker
|
|
35
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PlayCtx } from '../../types/testing.js';
|
|
2
|
+
/**
|
|
3
|
+
* Factory to get select testing utils
|
|
4
|
+
* @param context the story context
|
|
5
|
+
*/
|
|
6
|
+
export declare const getTestingUtilsSelect: (context: PlayCtx) => {
|
|
7
|
+
selectOption: ({ labelText, optionName, }: {
|
|
8
|
+
labelText: string;
|
|
9
|
+
optionName: string;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
};
|
|
@@ -1,82 +1,104 @@
|
|
|
1
1
|
import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
export declare const toggleSwitch: import('tailwind-variants').TVReturnType<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
indicator
|
|
7
|
-
|
|
8
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
9
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
10
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
11
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
4
|
+
isDisabled: {
|
|
5
|
+
false: {
|
|
6
|
+
indicator: string;
|
|
7
|
+
knob: string;
|
|
12
8
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
17
|
-
indicator?: import('tailwind-merge').ClassNameValue;
|
|
18
|
-
label?: import('tailwind-merge').ClassNameValue;
|
|
19
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
20
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
21
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
22
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
9
|
+
true: {
|
|
10
|
+
indicator: string;
|
|
11
|
+
knob: string;
|
|
23
12
|
};
|
|
24
13
|
};
|
|
25
|
-
}
|
|
14
|
+
}, {
|
|
26
15
|
container: string[];
|
|
27
16
|
textWrapper: string[];
|
|
28
17
|
label: string[];
|
|
29
18
|
hintText: string[];
|
|
30
19
|
indicator: string[];
|
|
31
20
|
knob: string[];
|
|
32
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
indicator
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
knob
|
|
21
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
22
|
+
isDisabled: {
|
|
23
|
+
false: {
|
|
24
|
+
indicator: string;
|
|
25
|
+
knob: string;
|
|
26
|
+
};
|
|
27
|
+
true: {
|
|
28
|
+
indicator: string;
|
|
29
|
+
knob: string;
|
|
41
30
|
};
|
|
42
31
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
indicator
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
knob
|
|
32
|
+
}, {
|
|
33
|
+
isDisabled: {
|
|
34
|
+
false: {
|
|
35
|
+
indicator: string;
|
|
36
|
+
knob: string;
|
|
37
|
+
};
|
|
38
|
+
true: {
|
|
39
|
+
indicator: string;
|
|
40
|
+
knob: string;
|
|
52
41
|
};
|
|
53
42
|
};
|
|
54
|
-
}
|
|
43
|
+
}>, {
|
|
44
|
+
isDisabled: {
|
|
45
|
+
false: {
|
|
46
|
+
indicator: string;
|
|
47
|
+
knob: string;
|
|
48
|
+
};
|
|
49
|
+
true: {
|
|
50
|
+
indicator: string;
|
|
51
|
+
knob: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
55
|
container: string[];
|
|
56
56
|
textWrapper: string[];
|
|
57
57
|
label: string[];
|
|
58
58
|
hintText: string[];
|
|
59
59
|
indicator: string[];
|
|
60
60
|
knob: string[];
|
|
61
|
-
}, import('tailwind-variants').TVReturnType<
|
|
61
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
62
|
+
isDisabled: {
|
|
63
|
+
false: {
|
|
64
|
+
indicator: string;
|
|
65
|
+
knob: string;
|
|
66
|
+
};
|
|
67
|
+
true: {
|
|
68
|
+
indicator: string;
|
|
69
|
+
knob: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
62
73
|
container: string[];
|
|
63
74
|
textWrapper: string[];
|
|
64
75
|
label: string[];
|
|
65
76
|
hintText: string[];
|
|
66
77
|
indicator: string[];
|
|
67
78
|
knob: string[];
|
|
68
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
indicator
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
knob
|
|
79
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
80
|
+
isDisabled: {
|
|
81
|
+
false: {
|
|
82
|
+
indicator: string;
|
|
83
|
+
knob: string;
|
|
84
|
+
};
|
|
85
|
+
true: {
|
|
86
|
+
indicator: string;
|
|
87
|
+
knob: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
isDisabled: {
|
|
92
|
+
false: {
|
|
93
|
+
indicator: string;
|
|
94
|
+
knob: string;
|
|
95
|
+
};
|
|
96
|
+
true: {
|
|
97
|
+
indicator: string;
|
|
98
|
+
knob: string;
|
|
77
99
|
};
|
|
78
100
|
};
|
|
79
|
-
}
|
|
101
|
+
}>, unknown, unknown, undefined>>;
|
|
80
102
|
interface ToggleSwitchProps extends Omit<AriaSwitchProps, 'children' | 'className' | 'style'>, VariantProps<typeof toggleSwitch> {
|
|
81
103
|
/** The label for the toggle switch. */
|
|
82
104
|
label: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
3
|
import { Switch as g } from "react-aria-components";
|
|
4
|
-
import { tv as
|
|
5
|
-
const
|
|
4
|
+
import { tv as m } from "tailwind-variants";
|
|
5
|
+
const v = m({
|
|
6
6
|
slots: {
|
|
7
7
|
container: ["uy-flex uy-gap-100 uy-group"],
|
|
8
8
|
textWrapper: ["uy-flex uy-flex-col uy-gap-50"],
|
|
@@ -14,7 +14,6 @@ const m = f({
|
|
|
14
14
|
"uy-border uy-border-solid uy-border-border-form-disabled uy-bg-surface-form-disabled",
|
|
15
15
|
"uy-cursor-pointer uy-transition-colors uy-duration-200 uy-ease-in-out",
|
|
16
16
|
"group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed",
|
|
17
|
-
'group-data-[selected="true"]:uy-bg-surface-form-active group-data-[selected="true"]:uy-border-border-form-active group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-active group-data-[selected="true"]:group-data-[pressed]:uy-border-border-form-active',
|
|
18
17
|
"group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled group-data-[disabled]:uy-cursor-not-allowed",
|
|
19
18
|
"group-data-[focus-visible]:uy-outline-2 group-data-[focus-visible]:uy-outline group-data-[focus-visible]:uy-outline-offset-2 group-data-[focus-visible]:uy-outline-utility-focus-ring"
|
|
20
19
|
],
|
|
@@ -22,39 +21,61 @@ const m = f({
|
|
|
22
21
|
"uy-w-200 uy-h-200 uy-rounded-circle",
|
|
23
22
|
"uy-border uy-border-solid uy-border-border-form-enabled uy-bg-surface-form-enabled",
|
|
24
23
|
"uy-transition-all uy-duration-200 uy-ease-in-out",
|
|
24
|
+
'group-data-[selected="true"]:uy-translate-x-[90%]',
|
|
25
25
|
"group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed",
|
|
26
|
-
'group-data-[selected="true"]:uy-translate-x-[90%] group-data-[selected="true"]:uy-border-border-inverted-enabled group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-pressed group-data-[selected="true"]:group-data-[pressed]:uy-border-border-inverted-pressed',
|
|
27
26
|
"group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled"
|
|
28
27
|
]
|
|
28
|
+
},
|
|
29
|
+
variants: {
|
|
30
|
+
isDisabled: {
|
|
31
|
+
false: {
|
|
32
|
+
indicator: 'group-data-[selected="true"]:uy-bg-surface-form-active group-data-[selected="true"]:uy-border-border-form-active group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-active group-data-[selected="true"]:group-data-[pressed]:uy-border-border-form-active',
|
|
33
|
+
knob: 'group-data-[selected="true"]:uy-border-border-inverted-enabled group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-pressed group-data-[selected="true"]:group-data-[pressed]:uy-border-border-inverted-pressed'
|
|
34
|
+
},
|
|
35
|
+
true: {
|
|
36
|
+
indicator: "",
|
|
37
|
+
knob: ""
|
|
38
|
+
}
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
}), h =
|
|
41
|
+
}), h = f(
|
|
31
42
|
({
|
|
32
|
-
label:
|
|
43
|
+
label: d,
|
|
33
44
|
helperText: r,
|
|
34
|
-
isLabelSrOnly:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
isLabelSrOnly: u = !1,
|
|
46
|
+
isDisabled: a,
|
|
47
|
+
...t
|
|
48
|
+
}, s) => {
|
|
49
|
+
const { container: l, indicator: i, knob: y, textWrapper: c, label: p, hintText: b } = v({ isDisabled: a }), n = { ...t, role: "switch" };
|
|
50
|
+
return /* @__PURE__ */ o(
|
|
51
|
+
g,
|
|
52
|
+
{
|
|
53
|
+
...n,
|
|
54
|
+
ref: s,
|
|
55
|
+
className: l(),
|
|
56
|
+
isDisabled: a,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ e("div", { className: i(), "data-dd-privacy": "mask", children: /* @__PURE__ */ e("div", { className: y() }) }),
|
|
59
|
+
/* @__PURE__ */ o(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: c({
|
|
63
|
+
className: u ? "uy-sr-only" : ""
|
|
64
|
+
}),
|
|
65
|
+
"data-dd-privacy": "allow",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e("span", { className: p(), children: d }),
|
|
68
|
+
r && /* @__PURE__ */ e("span", { className: b(), children: r })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
54
75
|
}
|
|
55
76
|
);
|
|
56
77
|
h.displayName = "ToggleSwitch";
|
|
57
78
|
export {
|
|
58
79
|
h as ToggleSwitch,
|
|
59
|
-
|
|
80
|
+
v as toggleSwitch
|
|
60
81
|
};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { ForwardedRef, JSX
|
|
1
|
+
import { ForwardedRef, JSX } from 'react';
|
|
2
2
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
3
|
import { infer as ZodInfer } from 'zod';
|
|
4
4
|
import { Schema } from '../../hooks/use-form.types.js';
|
|
5
|
-
|
|
6
|
-
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Pick<LabelProps, 'isRequired' | 'requiredVariant'> {
|
|
5
|
+
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
|
7
6
|
/** The name of the field, which should match the form schema. */
|
|
8
7
|
name: TName;
|
|
9
8
|
/** The label for the toggle switch. */
|
|
10
9
|
label: string;
|
|
11
|
-
/** Helper text to display below form field. */
|
|
12
|
-
helperText?: ReactNode;
|
|
13
10
|
/** Helper text to display below the toggle switch. */
|
|
14
11
|
switchHelperText?: string;
|
|
15
|
-
/** A contextual link to display below the toggle switch. */
|
|
16
|
-
contextualLink?: ReactNode;
|
|
17
12
|
/** The default selected value of the toggle switch. */
|
|
18
13
|
defaultSelected?: boolean;
|
|
19
14
|
/** Whether the toggle switch is disabled. */
|
|
@@ -1,67 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useFormContext as
|
|
4
|
-
import { FormField as
|
|
5
|
-
import { FormControl as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { ToggleSwitch as b } from "../toggle-switch/ToggleSwitch.js";
|
|
10
|
-
function k({
|
|
11
|
-
name: e,
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u } from "react";
|
|
3
|
+
import { useFormContext as F } from "react-hook-form";
|
|
4
|
+
import { FormField as a } from "../form-field/FormField.js";
|
|
5
|
+
import { FormControl as w } from "../form-field/parts/FormControl.js";
|
|
6
|
+
import { ToggleSwitch as x } from "../toggle-switch/ToggleSwitch.js";
|
|
7
|
+
function S({
|
|
8
|
+
name: o,
|
|
12
9
|
label: r,
|
|
13
|
-
defaultSelected:
|
|
14
|
-
helperText: m,
|
|
10
|
+
defaultSelected: e,
|
|
15
11
|
switchHelperText: i,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const { control: u, watch: x } = S(), a = x(e);
|
|
27
|
-
return /* @__PURE__ */ T(
|
|
28
|
-
y,
|
|
12
|
+
isInvalid: l,
|
|
13
|
+
isLoading: m,
|
|
14
|
+
isDisabled: c,
|
|
15
|
+
isReadOnly: n,
|
|
16
|
+
isLabelSrOnly: p,
|
|
17
|
+
...f
|
|
18
|
+
}, s) {
|
|
19
|
+
const { control: g, watch: d } = F(), h = d(o);
|
|
20
|
+
return /* @__PURE__ */ t(
|
|
21
|
+
a,
|
|
29
22
|
{
|
|
30
|
-
control:
|
|
31
|
-
name:
|
|
23
|
+
control: g,
|
|
24
|
+
name: o,
|
|
32
25
|
className: "uy-flex uy-flex-col uy-gap-100",
|
|
33
26
|
...{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
isReadOnly: s
|
|
27
|
+
isInvalid: l,
|
|
28
|
+
isLoading: m,
|
|
29
|
+
isDisabled: c,
|
|
30
|
+
isReadOnly: n
|
|
39
31
|
},
|
|
40
|
-
children:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
...g
|
|
53
|
-
}
|
|
54
|
-
) }),
|
|
55
|
-
/* @__PURE__ */ o(C, {}),
|
|
56
|
-
l
|
|
57
|
-
]
|
|
32
|
+
children: /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t(
|
|
33
|
+
x,
|
|
34
|
+
{
|
|
35
|
+
ref: s,
|
|
36
|
+
defaultSelected: e,
|
|
37
|
+
isSelected: h,
|
|
38
|
+
label: r,
|
|
39
|
+
isLabelSrOnly: p,
|
|
40
|
+
helperText: i,
|
|
41
|
+
...f
|
|
42
|
+
}
|
|
43
|
+
) })
|
|
58
44
|
}
|
|
59
45
|
);
|
|
60
46
|
}
|
|
61
|
-
const
|
|
62
|
-
return
|
|
47
|
+
const T = u(function(r, e) {
|
|
48
|
+
return S(r, e);
|
|
63
49
|
});
|
|
64
|
-
|
|
50
|
+
T.displayName = "ToggleSwitchField";
|
|
65
51
|
export {
|
|
66
|
-
|
|
52
|
+
T as ToggleSwitchField
|
|
67
53
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getTestingUtilsDatePicker } from './components/date-picker-field/test-utils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const previewTransform: (code: string) => Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.12",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.cts",
|
|
@@ -10,14 +10,29 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
12
|
"types": "./dist/esm/index.d.ts",
|
|
13
|
+
"hrAppsLocalDev": "./src/index.ts",
|
|
13
14
|
"default": "./dist/esm/index.js"
|
|
14
15
|
},
|
|
15
16
|
"require": {
|
|
16
17
|
"types": "./dist/cjs/index.d.cts",
|
|
18
|
+
"hrAppsLocalDev": "./src/index.ts",
|
|
17
19
|
"default": "./dist/cjs/index.cjs"
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
|
-
"./
|
|
22
|
+
"./testing-utils/storybook": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/esm/index.storybook-testing.d.ts",
|
|
25
|
+
"hrAppsLocalDev": "./src/index.storybook-testing.ts",
|
|
26
|
+
"default": "./dist/esm/storybook-testing.js"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/cjs/index.storybook-testing.d.cts",
|
|
30
|
+
"hrAppsLocalDev": "./src/index.storybook-testing.ts",
|
|
31
|
+
"default": "./dist/cjs/storybook-testing.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./i18n/*.json": "./i18n/*.json",
|
|
35
|
+
"./package.json": "./package.json"
|
|
21
36
|
},
|
|
22
37
|
"files": [
|
|
23
38
|
"dist",
|
|
@@ -33,42 +48,45 @@
|
|
|
33
48
|
"@react-types/shared": "3.26.0",
|
|
34
49
|
"@use-gesture/react": "10.3.1",
|
|
35
50
|
"react": "18.3.1",
|
|
36
|
-
"react-aria": "3.41.
|
|
37
|
-
"react-aria-components": "1.10.
|
|
51
|
+
"react-aria": "3.41.1",
|
|
52
|
+
"react-aria-components": "1.10.1",
|
|
38
53
|
"react-dom": "18.3.1",
|
|
39
54
|
"react-hook-form": "7.50.1",
|
|
40
55
|
"react-hot-toast": "2.5.1",
|
|
41
|
-
"react-intl": "
|
|
56
|
+
"react-intl": "7.1.3",
|
|
42
57
|
"react-stately": "3.36.1",
|
|
43
58
|
"tailwind-merge": "2.5.2",
|
|
44
59
|
"tailwind-variants": "0.2.1",
|
|
45
60
|
"usehooks-ts": "3.1.0",
|
|
46
|
-
"zod": "3.25.
|
|
61
|
+
"zod": "3.25.67"
|
|
47
62
|
},
|
|
48
63
|
"peerDependencies": {
|
|
49
64
|
"@hookform/devtools": "4.3.3",
|
|
50
|
-
"@payfit/unity-icons": "0.0.0-alpha.
|
|
51
|
-
"@payfit/unity-themes": "0.0.0-alpha.
|
|
65
|
+
"@payfit/unity-icons": "0.0.0-alpha.12",
|
|
66
|
+
"@payfit/unity-themes": "0.0.0-alpha.12",
|
|
67
|
+
"@storybook/react-vite": "^9",
|
|
52
68
|
"@tanstack/react-table": "8.21.3",
|
|
53
69
|
"history": "4.10.1",
|
|
54
|
-
"
|
|
55
|
-
"react-
|
|
56
|
-
"react-hook-form": "7.50.1",
|
|
70
|
+
"prettier": "^3",
|
|
71
|
+
"react-hook-form": "^7",
|
|
57
72
|
"react-router-dom": "5.3.4",
|
|
58
|
-
"
|
|
73
|
+
"storybook": "^9",
|
|
74
|
+
"zod": "3.25.67"
|
|
59
75
|
},
|
|
60
76
|
"devDependencies": {
|
|
61
77
|
"@fontsource/inter": "5.0.19",
|
|
62
78
|
"@fontsource/source-serif-4": "5.0.19",
|
|
63
79
|
"@hookform/devtools": "4.3.3",
|
|
64
80
|
"@internationalized/date": "3.8.2",
|
|
65
|
-
"@payfit/
|
|
66
|
-
"@payfit/unity-
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@storybook/addon-
|
|
70
|
-
"@storybook/addon-
|
|
71
|
-
"@storybook/
|
|
81
|
+
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
82
|
+
"@payfit/unity-icons": "0.0.0-alpha.12",
|
|
83
|
+
"@payfit/unity-illustrations": "0.0.0-alpha.12",
|
|
84
|
+
"@payfit/unity-themes": "0.0.0-alpha.12",
|
|
85
|
+
"@storybook/addon-a11y": "9.0.11",
|
|
86
|
+
"@storybook/addon-docs": "9.0.11",
|
|
87
|
+
"@storybook/addon-links": "9.0.11",
|
|
88
|
+
"@storybook/addon-vitest": "9.0.11",
|
|
89
|
+
"@storybook/react-vite": "9.0.11",
|
|
72
90
|
"@testing-library/dom": "10.4.0",
|
|
73
91
|
"@testing-library/react": "16.2.0",
|
|
74
92
|
"@types/react": "18.3.18",
|
|
@@ -81,11 +99,13 @@
|
|
|
81
99
|
"msw": "2.8.4",
|
|
82
100
|
"msw-storybook-addon": "2.0.4",
|
|
83
101
|
"playwright": "1.49.1",
|
|
102
|
+
"prettier": "3.1.0",
|
|
84
103
|
"react-docgen-typescript": "2.2.2",
|
|
85
104
|
"react-hot-toast": "2.5.1",
|
|
86
|
-
"storybook": "9.0.
|
|
105
|
+
"storybook": "9.0.11",
|
|
87
106
|
"storybook-addon-pseudo-states": "9.0.6",
|
|
88
107
|
"storybook-addon-tag-badges": "2.0.0",
|
|
108
|
+
"storybook-mock-date-decorator": "3.0.0",
|
|
89
109
|
"tailwindcss": "3.4.10",
|
|
90
110
|
"typescript": "5.7.3",
|
|
91
111
|
"vite": "6.3.5",
|
|
@@ -102,6 +122,9 @@
|
|
|
102
122
|
"history": {
|
|
103
123
|
"optional": true
|
|
104
124
|
},
|
|
125
|
+
"prettier": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
105
128
|
"react-router-dom": {
|
|
106
129
|
"optional": true
|
|
107
130
|
},
|