@povio/ui 3.2.0 → 3.2.2-rc.1
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/components/inputs/Checkbox/Checkbox.d.ts +4 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +83 -69
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +23 -0
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +363 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +62 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +103 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +1 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +1 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +1 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +1 -1
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +167 -149
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -132
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +1 -1
- package/dist/components/inputs/FormField/FormFieldHeader.js +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.js +2 -2
- package/dist/components/inputs/Input/TextInput/TextInput.js +1 -1
- package/dist/components/inputs/Input/shared/InputContent.js +1 -1
- package/dist/components/inputs/Inputs/InputItem.d.ts +1 -0
- package/dist/components/inputs/Inputs/InputItem.js +2 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -1
- package/dist/components/inputs/Skeleton/InputFrame.js +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.js +1 -1
- package/dist/config/uiOverrides.context.d.ts +3 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -7
- package/dist/tw-ui-plugin.js +2 -0
- package/package.json +5 -5
|
@@ -4,16 +4,18 @@ import { FieldValues } from 'react-hook-form';
|
|
|
4
4
|
import { CheckboxVariantProps } from './checkbox.cva';
|
|
5
5
|
import { FormFieldErrorProps } from '../FormField/FormFieldError';
|
|
6
6
|
import { ControlProps } from '../shared/form.types';
|
|
7
|
-
interface CheckboxBaseProps extends FormFieldErrorProps, CheckboxVariantProps, Omit<AriaCheckboxProps, "className"> {
|
|
7
|
+
export interface CheckboxBaseProps extends FormFieldErrorProps, CheckboxVariantProps, Omit<AriaCheckboxProps, "className"> {
|
|
8
8
|
ref?: Ref<HTMLLabelElement>;
|
|
9
9
|
children: string | ReactElement;
|
|
10
10
|
hideLabel?: boolean;
|
|
11
|
+
hideError?: boolean;
|
|
11
12
|
fireBlurOnChange?: boolean;
|
|
12
13
|
selectedIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
13
14
|
indeterminateIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
14
15
|
isDirty?: boolean;
|
|
16
|
+
labelClassName?: string;
|
|
15
17
|
}
|
|
18
|
+
export declare const CheckboxBase: (props: CheckboxBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
19
|
export type CheckboxProps = CheckboxBaseProps;
|
|
17
20
|
export type ControlledCheckboxProps<TFieldValues extends FieldValues> = ControlProps<CheckboxProps, TFieldValues, "isSelected">;
|
|
18
21
|
export declare const Checkbox: <TFieldValues extends FieldValues>(props: ControlledCheckboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export {};
|
|
@@ -12,7 +12,7 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
12
12
|
import { Controller } from "react-hook-form";
|
|
13
13
|
//#region src/components/inputs/Checkbox/Checkbox.tsx
|
|
14
14
|
var CheckboxBase = (props) => {
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(54);
|
|
16
16
|
const ui = UIConfig.useConfig();
|
|
17
17
|
const checkboxTypographyMap = UIOverrides.useMapper("checkbox.typography", checkboxTypography);
|
|
18
18
|
const checkboxContentClassNameMap = UIOverrides.useMapper("checkbox.contentClassName", checkboxContentClassName);
|
|
@@ -20,62 +20,71 @@ var CheckboxBase = (props) => {
|
|
|
20
20
|
let className;
|
|
21
21
|
let error;
|
|
22
22
|
let fireBlurOnChangeProp;
|
|
23
|
+
let hideError;
|
|
23
24
|
let hideLabelProp;
|
|
24
25
|
let isDisabled;
|
|
26
|
+
let isRequired;
|
|
27
|
+
let labelClassName;
|
|
25
28
|
let onBlur;
|
|
26
29
|
let onChange;
|
|
27
30
|
let rest;
|
|
28
31
|
let variantProp;
|
|
29
32
|
if ($[0] !== props) {
|
|
30
|
-
({className, children, isDisabled, error, variant: variantProp, hideLabel: hideLabelProp, fireBlurOnChange: fireBlurOnChangeProp, onChange, onBlur, ...rest} = props);
|
|
33
|
+
({className, children, isDisabled, isRequired, error, hideError, labelClassName, variant: variantProp, hideLabel: hideLabelProp, fireBlurOnChange: fireBlurOnChangeProp, onChange, onBlur, ...rest} = props);
|
|
31
34
|
$[0] = props;
|
|
32
35
|
$[1] = children;
|
|
33
36
|
$[2] = className;
|
|
34
37
|
$[3] = error;
|
|
35
38
|
$[4] = fireBlurOnChangeProp;
|
|
36
|
-
$[5] =
|
|
37
|
-
$[6] =
|
|
38
|
-
$[7] =
|
|
39
|
-
$[8] =
|
|
40
|
-
$[9] =
|
|
41
|
-
$[10] =
|
|
39
|
+
$[5] = hideError;
|
|
40
|
+
$[6] = hideLabelProp;
|
|
41
|
+
$[7] = isDisabled;
|
|
42
|
+
$[8] = isRequired;
|
|
43
|
+
$[9] = labelClassName;
|
|
44
|
+
$[10] = onBlur;
|
|
45
|
+
$[11] = onChange;
|
|
46
|
+
$[12] = rest;
|
|
47
|
+
$[13] = variantProp;
|
|
42
48
|
} else {
|
|
43
49
|
children = $[1];
|
|
44
50
|
className = $[2];
|
|
45
51
|
error = $[3];
|
|
46
52
|
fireBlurOnChangeProp = $[4];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
hideError = $[5];
|
|
54
|
+
hideLabelProp = $[6];
|
|
55
|
+
isDisabled = $[7];
|
|
56
|
+
isRequired = $[8];
|
|
57
|
+
labelClassName = $[9];
|
|
58
|
+
onBlur = $[10];
|
|
59
|
+
onChange = $[11];
|
|
60
|
+
rest = $[12];
|
|
61
|
+
variantProp = $[13];
|
|
53
62
|
}
|
|
54
63
|
const variant = variantProp ?? ui.checkbox.variant;
|
|
55
64
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
56
65
|
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.checkbox.fireBlurOnChange;
|
|
57
66
|
let t0;
|
|
58
|
-
if ($[
|
|
67
|
+
if ($[14] !== error || $[15] !== isDisabled) {
|
|
59
68
|
t0 = {
|
|
60
69
|
error,
|
|
61
70
|
isDisabled
|
|
62
71
|
};
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
} else t0 = $[
|
|
72
|
+
$[14] = error;
|
|
73
|
+
$[15] = isDisabled;
|
|
74
|
+
$[16] = t0;
|
|
75
|
+
} else t0 = $[16];
|
|
67
76
|
const formFieldErrorProps = t0;
|
|
68
77
|
let t1;
|
|
69
|
-
if ($[
|
|
78
|
+
if ($[17] !== fireBlurOnChange || $[18] !== onBlur || $[19] !== onChange) {
|
|
70
79
|
t1 = (isSelected) => {
|
|
71
80
|
onChange?.(isSelected);
|
|
72
81
|
if (fireBlurOnChange) onBlur?.({});
|
|
73
82
|
};
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
} else t1 = $[
|
|
83
|
+
$[17] = fireBlurOnChange;
|
|
84
|
+
$[18] = onBlur;
|
|
85
|
+
$[19] = onChange;
|
|
86
|
+
$[20] = t1;
|
|
87
|
+
} else t1 = $[20];
|
|
79
88
|
const handleChange = t1;
|
|
80
89
|
const t2 = !!error;
|
|
81
90
|
const t3 = hideLabel && typeof children === "string" ? children : void 0;
|
|
@@ -83,23 +92,23 @@ var CheckboxBase = (props) => {
|
|
|
83
92
|
const t5 = props.isDirty || void 0;
|
|
84
93
|
const t6 = props.isRequired || void 0;
|
|
85
94
|
let t7;
|
|
86
|
-
if ($[
|
|
95
|
+
if ($[21] !== className) {
|
|
87
96
|
t7 = clsx("relative", checkboxIndicatorClass, className);
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
} else t7 = $[
|
|
97
|
+
$[21] = className;
|
|
98
|
+
$[22] = t7;
|
|
99
|
+
} else t7 = $[22];
|
|
91
100
|
let t8;
|
|
92
|
-
if ($[
|
|
101
|
+
if ($[23] !== rest || $[24] !== variant) {
|
|
93
102
|
t8 = /* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
94
103
|
variant,
|
|
95
104
|
...rest
|
|
96
105
|
});
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
} else t8 = $[
|
|
106
|
+
$[23] = rest;
|
|
107
|
+
$[24] = variant;
|
|
108
|
+
$[25] = t8;
|
|
109
|
+
} else t8 = $[25];
|
|
101
110
|
let t9;
|
|
102
|
-
if ($[
|
|
111
|
+
if ($[26] !== checkboxContentClassNameMap || $[27] !== checkboxTypographyMap || $[28] !== children || $[29] !== hideLabel || $[30] !== labelClassName || $[31] !== rest || $[32] !== variant) {
|
|
103
112
|
t9 = !hideLabel && /* @__PURE__ */ jsx(CheckContent, {
|
|
104
113
|
typography: checkboxTypographyMap({
|
|
105
114
|
variant,
|
|
@@ -109,22 +118,25 @@ var CheckboxBase = (props) => {
|
|
|
109
118
|
variant,
|
|
110
119
|
...rest
|
|
111
120
|
}),
|
|
121
|
+
className: labelClassName,
|
|
112
122
|
children
|
|
113
123
|
});
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
|
|
124
|
+
$[26] = checkboxContentClassNameMap;
|
|
125
|
+
$[27] = checkboxTypographyMap;
|
|
126
|
+
$[28] = children;
|
|
127
|
+
$[29] = hideLabel;
|
|
128
|
+
$[30] = labelClassName;
|
|
129
|
+
$[31] = rest;
|
|
130
|
+
$[32] = variant;
|
|
131
|
+
$[33] = t9;
|
|
132
|
+
} else t9 = $[33];
|
|
122
133
|
let t10;
|
|
123
|
-
if ($[
|
|
134
|
+
if ($[34] !== handleChange || $[35] !== isDisabled || $[36] !== isRequired || $[37] !== onBlur || $[38] !== rest || $[39] !== t2 || $[40] !== t3 || $[41] !== t4 || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9) {
|
|
124
135
|
t10 = /* @__PURE__ */ jsxs(Checkbox, {
|
|
125
136
|
...rest,
|
|
126
137
|
isDisabled,
|
|
127
138
|
isInvalid: t2,
|
|
139
|
+
isRequired,
|
|
128
140
|
"aria-label": t3,
|
|
129
141
|
"aria-errormessage": t4,
|
|
130
142
|
"data-is-dirty": t5,
|
|
@@ -134,33 +146,35 @@ var CheckboxBase = (props) => {
|
|
|
134
146
|
className: t7,
|
|
135
147
|
children: [t8, t9]
|
|
136
148
|
});
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
|
|
149
|
+
$[34] = handleChange;
|
|
150
|
+
$[35] = isDisabled;
|
|
151
|
+
$[36] = isRequired;
|
|
152
|
+
$[37] = onBlur;
|
|
153
|
+
$[38] = rest;
|
|
154
|
+
$[39] = t2;
|
|
155
|
+
$[40] = t3;
|
|
156
|
+
$[41] = t4;
|
|
157
|
+
$[42] = t5;
|
|
158
|
+
$[43] = t6;
|
|
159
|
+
$[44] = t7;
|
|
160
|
+
$[45] = t8;
|
|
161
|
+
$[46] = t9;
|
|
162
|
+
$[47] = t10;
|
|
163
|
+
} else t10 = $[47];
|
|
151
164
|
let t11;
|
|
152
|
-
if ($[
|
|
153
|
-
t11 = /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
|
|
165
|
+
if ($[48] !== formFieldErrorProps || $[49] !== hideError) {
|
|
166
|
+
t11 = !hideError && /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
167
|
+
$[48] = formFieldErrorProps;
|
|
168
|
+
$[49] = hideError;
|
|
169
|
+
$[50] = t11;
|
|
170
|
+
} else t11 = $[50];
|
|
157
171
|
let t12;
|
|
158
|
-
if ($[
|
|
172
|
+
if ($[51] !== t10 || $[52] !== t11) {
|
|
159
173
|
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t10, t11] });
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
} else t12 = $[
|
|
174
|
+
$[51] = t10;
|
|
175
|
+
$[52] = t11;
|
|
176
|
+
$[53] = t12;
|
|
177
|
+
} else t12 = $[53];
|
|
164
178
|
return t12;
|
|
165
179
|
};
|
|
166
180
|
var Checkbox$1 = (props) => {
|
|
@@ -226,4 +240,4 @@ var Checkbox$1 = (props) => {
|
|
|
226
240
|
return t0;
|
|
227
241
|
};
|
|
228
242
|
//#endregion
|
|
229
|
-
export { Checkbox$1 as Checkbox };
|
|
243
|
+
export { Checkbox$1 as Checkbox, CheckboxBase };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement, Ref } from 'react';
|
|
2
|
+
import { CheckboxGroupProps as AriaCheckboxGroupProps } from 'react-aria-components';
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
|
+
import { CheckboxVariantProps } from './checkbox.cva';
|
|
5
|
+
import { FormFieldProps } from '../FormField/FormField';
|
|
6
|
+
import { ControlProps } from '../shared/form.types';
|
|
7
|
+
import { InputVariantProps } from '../shared/input.cva';
|
|
8
|
+
interface CheckboxGroupBaseProps extends Omit<FormFieldProps, "variant">, CheckboxVariantProps, Omit<InputVariantProps, "variant">, Omit<AriaCheckboxGroupProps, "children" | "className" | "label"> {
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
options: {
|
|
11
|
+
label: string | ReactElement;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
isDirty?: boolean;
|
|
15
|
+
inputClassName?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
fireBlurOnChange?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface CheckboxGroupProps extends CheckboxGroupBaseProps {
|
|
20
|
+
}
|
|
21
|
+
export type ControlledCheckboxGroupProps<TFieldValues extends FieldValues> = ControlProps<CheckboxGroupProps, TFieldValues>;
|
|
22
|
+
export declare const CheckboxGroup: <TFieldValues extends FieldValues>(props: ControlledCheckboxGroupProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
|
+
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
|
+
import { checkboxContentRowDefinition, checkboxContentWrapperDefinition, checkboxGroupLabelDefinition } from "./checkbox.cva.js";
|
|
4
|
+
import { CheckboxBase } from "./Checkbox.js";
|
|
5
|
+
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
6
|
+
import { FormField } from "../FormField/FormField.js";
|
|
7
|
+
import { inputBaseDefinition, inputSizeDefinition } from "../shared/input.cva.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { clsx } from "clsx";
|
|
11
|
+
import { CheckboxGroup } from "react-aria-components";
|
|
12
|
+
import { useLabel } from "react-aria";
|
|
13
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
15
|
+
//#region src/components/inputs/Checkbox/CheckboxGroup.tsx
|
|
16
|
+
var CheckboxGroupBase = (props) => {
|
|
17
|
+
const $ = c(92);
|
|
18
|
+
const ui = UIConfig.useConfig();
|
|
19
|
+
const checkboxContentWrapperCva = UIOverrides.useCva("checkbox.contentWrapperCva", checkboxContentWrapperDefinition);
|
|
20
|
+
const checkboxContentRowCva = UIOverrides.useCva("checkbox.contentRowCva", checkboxContentRowDefinition);
|
|
21
|
+
const checkboxGroupLabelCva = UIOverrides.useCva("checkbox.groupLabelCva", checkboxGroupLabelDefinition);
|
|
22
|
+
const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
|
|
23
|
+
const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
|
|
24
|
+
const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, onChange, onBlur, fireBlurOnChange: fireBlurOnChangeProp, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
|
|
25
|
+
const as = asProp ?? ui.input.as;
|
|
26
|
+
const size = sizeProp ?? ui.input.size;
|
|
27
|
+
const variant = variantProp ?? ui.checkbox.variant;
|
|
28
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
29
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.checkbox.fireBlurOnChange;
|
|
30
|
+
const selectedValue = value ?? defaultValue;
|
|
31
|
+
const shouldRenderInputFrame = as !== "default";
|
|
32
|
+
let t0;
|
|
33
|
+
if ($[0] !== label) {
|
|
34
|
+
t0 = { label };
|
|
35
|
+
$[0] = label;
|
|
36
|
+
$[1] = t0;
|
|
37
|
+
} else t0 = $[1];
|
|
38
|
+
const { labelProps, fieldProps } = useLabel(t0);
|
|
39
|
+
const t1 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[2] !== className || $[3] !== error || $[4] !== errorClassName || $[5] !== headerClassName || $[6] !== helperText || $[7] !== hideLabel || $[8] !== isDisabled || $[9] !== isRequired || $[10] !== label || $[11] !== rightContent || $[12] !== t1 || $[13] !== tooltipText) {
|
|
42
|
+
t2 = {
|
|
43
|
+
className,
|
|
44
|
+
error,
|
|
45
|
+
errorClassName,
|
|
46
|
+
headerClassName,
|
|
47
|
+
helperText,
|
|
48
|
+
hideLabel,
|
|
49
|
+
isDisabled,
|
|
50
|
+
isHeaderHidden: t1,
|
|
51
|
+
isRequired,
|
|
52
|
+
label,
|
|
53
|
+
rightContent,
|
|
54
|
+
tooltipText
|
|
55
|
+
};
|
|
56
|
+
$[2] = className;
|
|
57
|
+
$[3] = error;
|
|
58
|
+
$[4] = errorClassName;
|
|
59
|
+
$[5] = headerClassName;
|
|
60
|
+
$[6] = helperText;
|
|
61
|
+
$[7] = hideLabel;
|
|
62
|
+
$[8] = isDisabled;
|
|
63
|
+
$[9] = isRequired;
|
|
64
|
+
$[10] = label;
|
|
65
|
+
$[11] = rightContent;
|
|
66
|
+
$[12] = t1;
|
|
67
|
+
$[13] = tooltipText;
|
|
68
|
+
$[14] = t2;
|
|
69
|
+
} else t2 = $[14];
|
|
70
|
+
const formFieldProps = t2;
|
|
71
|
+
const t3 = hideLabel || isHeaderHidden;
|
|
72
|
+
let t4;
|
|
73
|
+
if ($[15] !== headerClassName || $[16] !== helperText || $[17] !== isDisabled || $[18] !== isRequired || $[19] !== label || $[20] !== labelProps || $[21] !== rightContent || $[22] !== t3 || $[23] !== tooltipText) {
|
|
74
|
+
t4 = {
|
|
75
|
+
className: headerClassName,
|
|
76
|
+
helperText,
|
|
77
|
+
isDisabled,
|
|
78
|
+
isHeaderHidden: t3,
|
|
79
|
+
isRequired,
|
|
80
|
+
label,
|
|
81
|
+
labelProps,
|
|
82
|
+
rightContent,
|
|
83
|
+
tooltipText
|
|
84
|
+
};
|
|
85
|
+
$[15] = headerClassName;
|
|
86
|
+
$[16] = helperText;
|
|
87
|
+
$[17] = isDisabled;
|
|
88
|
+
$[18] = isRequired;
|
|
89
|
+
$[19] = label;
|
|
90
|
+
$[20] = labelProps;
|
|
91
|
+
$[21] = rightContent;
|
|
92
|
+
$[22] = t3;
|
|
93
|
+
$[23] = tooltipText;
|
|
94
|
+
$[24] = t4;
|
|
95
|
+
} else t4 = $[24];
|
|
96
|
+
const headerProps = t4;
|
|
97
|
+
let t5;
|
|
98
|
+
if ($[25] !== fireBlurOnChange || $[26] !== onBlur || $[27] !== onChange) {
|
|
99
|
+
t5 = (nextValue) => {
|
|
100
|
+
onChange?.(nextValue);
|
|
101
|
+
if (fireBlurOnChange) onBlur?.({});
|
|
102
|
+
};
|
|
103
|
+
$[25] = fireBlurOnChange;
|
|
104
|
+
$[26] = onBlur;
|
|
105
|
+
$[27] = onChange;
|
|
106
|
+
$[28] = t5;
|
|
107
|
+
} else t5 = $[28];
|
|
108
|
+
const handleChange = t5;
|
|
109
|
+
const T0 = CheckboxGroup;
|
|
110
|
+
const t6 = !!error;
|
|
111
|
+
const t7 = isDirty || void 0;
|
|
112
|
+
const t8 = isRequired || void 0;
|
|
113
|
+
const t9 = "group";
|
|
114
|
+
const T1 = FormField;
|
|
115
|
+
const t10 = as === "inline" && "h-full";
|
|
116
|
+
let t11;
|
|
117
|
+
if ($[29] !== className || $[30] !== t10) {
|
|
118
|
+
t11 = clsx("w-full", t10, className);
|
|
119
|
+
$[29] = className;
|
|
120
|
+
$[30] = t10;
|
|
121
|
+
$[31] = t11;
|
|
122
|
+
} else t11 = $[31];
|
|
123
|
+
const t12 = as === "inline" ? -1 : void 0;
|
|
124
|
+
let t13;
|
|
125
|
+
if ($[32] !== as || $[33] !== inputBaseCva || $[34] !== inputClassName || $[35] !== shouldRenderInputFrame || $[36] !== ui) {
|
|
126
|
+
t13 = clsx("group/checkbox-group-content relative", shouldRenderInputFrame && inputBaseCva({
|
|
127
|
+
variant: ui.input.variant,
|
|
128
|
+
as
|
|
129
|
+
}), inputClassName);
|
|
130
|
+
$[32] = as;
|
|
131
|
+
$[33] = inputBaseCva;
|
|
132
|
+
$[34] = inputClassName;
|
|
133
|
+
$[35] = shouldRenderInputFrame;
|
|
134
|
+
$[36] = ui;
|
|
135
|
+
$[37] = t13;
|
|
136
|
+
} else t13 = $[37];
|
|
137
|
+
const t14 = "";
|
|
138
|
+
const t15 = isDisabled || void 0;
|
|
139
|
+
const t16 = isDisabled || void 0;
|
|
140
|
+
const t17 = !!error || void 0;
|
|
141
|
+
const t18 = selectedValue?.length ? true : void 0;
|
|
142
|
+
const t19 = "";
|
|
143
|
+
const t20 = clsx(checkboxContentWrapperCva({
|
|
144
|
+
variant,
|
|
145
|
+
as,
|
|
146
|
+
size,
|
|
147
|
+
hasInputFrame: shouldRenderInputFrame,
|
|
148
|
+
...rest
|
|
149
|
+
}), shouldRenderInputFrame && as !== "floating" && inputSizeCva({
|
|
150
|
+
as,
|
|
151
|
+
size
|
|
152
|
+
}));
|
|
153
|
+
const t21 = isDirty || void 0;
|
|
154
|
+
const t22 = isRequired || void 0;
|
|
155
|
+
let t23;
|
|
156
|
+
if ($[38] !== as || $[39] !== checkboxGroupLabelCva || $[40] !== headerClassName || $[41] !== headerProps || $[42] !== size) {
|
|
157
|
+
t23 = as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
158
|
+
...headerProps,
|
|
159
|
+
as: as === "floating" ? "filter" : as,
|
|
160
|
+
size,
|
|
161
|
+
className: clsx(headerClassName, checkboxGroupLabelCva({ as }))
|
|
162
|
+
});
|
|
163
|
+
$[38] = as;
|
|
164
|
+
$[39] = checkboxGroupLabelCva;
|
|
165
|
+
$[40] = headerClassName;
|
|
166
|
+
$[41] = headerProps;
|
|
167
|
+
$[42] = size;
|
|
168
|
+
$[43] = t23;
|
|
169
|
+
} else t23 = $[43];
|
|
170
|
+
const t24 = checkboxContentRowCva({
|
|
171
|
+
variant,
|
|
172
|
+
as,
|
|
173
|
+
hasInputFrame: shouldRenderInputFrame,
|
|
174
|
+
...rest
|
|
175
|
+
});
|
|
176
|
+
let t25;
|
|
177
|
+
if ($[44] !== hideLabel || $[45] !== labelClassName || $[46] !== options || $[47] !== variant) {
|
|
178
|
+
let t26;
|
|
179
|
+
if ($[49] !== hideLabel || $[50] !== labelClassName || $[51] !== variant) {
|
|
180
|
+
t26 = (option) => /* @__PURE__ */ jsx(CheckboxBase, {
|
|
181
|
+
value: option.value,
|
|
182
|
+
variant,
|
|
183
|
+
hideLabel,
|
|
184
|
+
hideError: true,
|
|
185
|
+
labelClassName,
|
|
186
|
+
children: option.label
|
|
187
|
+
}, option.value);
|
|
188
|
+
$[49] = hideLabel;
|
|
189
|
+
$[50] = labelClassName;
|
|
190
|
+
$[51] = variant;
|
|
191
|
+
$[52] = t26;
|
|
192
|
+
} else t26 = $[52];
|
|
193
|
+
t25 = options.map(t26);
|
|
194
|
+
$[44] = hideLabel;
|
|
195
|
+
$[45] = labelClassName;
|
|
196
|
+
$[46] = options;
|
|
197
|
+
$[47] = variant;
|
|
198
|
+
$[48] = t25;
|
|
199
|
+
} else t25 = $[48];
|
|
200
|
+
let t26;
|
|
201
|
+
if ($[53] !== t24 || $[54] !== t25) {
|
|
202
|
+
t26 = /* @__PURE__ */ jsx("div", {
|
|
203
|
+
className: t24,
|
|
204
|
+
children: t25
|
|
205
|
+
});
|
|
206
|
+
$[53] = t24;
|
|
207
|
+
$[54] = t25;
|
|
208
|
+
$[55] = t26;
|
|
209
|
+
} else t26 = $[55];
|
|
210
|
+
let t27;
|
|
211
|
+
if ($[56] !== t20 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23 || $[60] !== t26) {
|
|
212
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
213
|
+
className: t20,
|
|
214
|
+
"data-is-dirty": t21,
|
|
215
|
+
"data-is-required": t22,
|
|
216
|
+
children: [t23, t26]
|
|
217
|
+
});
|
|
218
|
+
$[56] = t20;
|
|
219
|
+
$[57] = t21;
|
|
220
|
+
$[58] = t22;
|
|
221
|
+
$[59] = t23;
|
|
222
|
+
$[60] = t26;
|
|
223
|
+
$[61] = t27;
|
|
224
|
+
} else t27 = $[61];
|
|
225
|
+
let t28;
|
|
226
|
+
if ($[62] !== t13 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t18 || $[67] !== t27) {
|
|
227
|
+
t28 = /* @__PURE__ */ jsx("div", {
|
|
228
|
+
className: t13,
|
|
229
|
+
"data-rac": t14,
|
|
230
|
+
"data-disabled": t15,
|
|
231
|
+
"data-is-disabled": t16,
|
|
232
|
+
"data-invalid": t17,
|
|
233
|
+
"data-has-selection": t18,
|
|
234
|
+
"data-checkbox-group-content": t19,
|
|
235
|
+
children: t27
|
|
236
|
+
});
|
|
237
|
+
$[62] = t13;
|
|
238
|
+
$[63] = t15;
|
|
239
|
+
$[64] = t16;
|
|
240
|
+
$[65] = t17;
|
|
241
|
+
$[66] = t18;
|
|
242
|
+
$[67] = t27;
|
|
243
|
+
$[68] = t28;
|
|
244
|
+
} else t28 = $[68];
|
|
245
|
+
let t29;
|
|
246
|
+
if ($[69] !== T1 || $[70] !== as || $[71] !== formFieldProps || $[72] !== labelProps || $[73] !== t11 || $[74] !== t12 || $[75] !== t28) {
|
|
247
|
+
t29 = /* @__PURE__ */ jsx(T1, {
|
|
248
|
+
...formFieldProps,
|
|
249
|
+
as,
|
|
250
|
+
labelProps,
|
|
251
|
+
className: t11,
|
|
252
|
+
tabIndex: t12,
|
|
253
|
+
children: t28
|
|
254
|
+
});
|
|
255
|
+
$[69] = T1;
|
|
256
|
+
$[70] = as;
|
|
257
|
+
$[71] = formFieldProps;
|
|
258
|
+
$[72] = labelProps;
|
|
259
|
+
$[73] = t11;
|
|
260
|
+
$[74] = t12;
|
|
261
|
+
$[75] = t28;
|
|
262
|
+
$[76] = t29;
|
|
263
|
+
} else t29 = $[76];
|
|
264
|
+
let t30;
|
|
265
|
+
if ($[77] !== T0 || $[78] !== defaultValue || $[79] !== fieldProps || $[80] !== handleChange || $[81] !== isDisabled || $[82] !== isRequired || $[83] !== onBlur || $[84] !== ref || $[85] !== rest || $[86] !== t29 || $[87] !== t6 || $[88] !== t7 || $[89] !== t8 || $[90] !== value) {
|
|
266
|
+
t30 = /* @__PURE__ */ jsx(T0, {
|
|
267
|
+
...rest,
|
|
268
|
+
...fieldProps,
|
|
269
|
+
ref,
|
|
270
|
+
value,
|
|
271
|
+
defaultValue,
|
|
272
|
+
onChange: handleChange,
|
|
273
|
+
onBlur,
|
|
274
|
+
isDisabled,
|
|
275
|
+
isInvalid: t6,
|
|
276
|
+
isRequired,
|
|
277
|
+
"data-is-dirty": t7,
|
|
278
|
+
"data-is-required": t8,
|
|
279
|
+
className: t9,
|
|
280
|
+
children: t29
|
|
281
|
+
});
|
|
282
|
+
$[77] = T0;
|
|
283
|
+
$[78] = defaultValue;
|
|
284
|
+
$[79] = fieldProps;
|
|
285
|
+
$[80] = handleChange;
|
|
286
|
+
$[81] = isDisabled;
|
|
287
|
+
$[82] = isRequired;
|
|
288
|
+
$[83] = onBlur;
|
|
289
|
+
$[84] = ref;
|
|
290
|
+
$[85] = rest;
|
|
291
|
+
$[86] = t29;
|
|
292
|
+
$[87] = t6;
|
|
293
|
+
$[88] = t7;
|
|
294
|
+
$[89] = t8;
|
|
295
|
+
$[90] = value;
|
|
296
|
+
$[91] = t30;
|
|
297
|
+
} else t30 = $[91];
|
|
298
|
+
return t30;
|
|
299
|
+
};
|
|
300
|
+
var CheckboxGroup$1 = (props) => {
|
|
301
|
+
const $ = c(15);
|
|
302
|
+
if ("formControl" in props && props.formControl) {
|
|
303
|
+
let formControl;
|
|
304
|
+
let innerProps;
|
|
305
|
+
let ref;
|
|
306
|
+
if ($[0] !== props) {
|
|
307
|
+
({formControl, ref, ...innerProps} = props);
|
|
308
|
+
$[0] = props;
|
|
309
|
+
$[1] = formControl;
|
|
310
|
+
$[2] = innerProps;
|
|
311
|
+
$[3] = ref;
|
|
312
|
+
} else {
|
|
313
|
+
formControl = $[1];
|
|
314
|
+
innerProps = $[2];
|
|
315
|
+
ref = $[3];
|
|
316
|
+
}
|
|
317
|
+
let t0;
|
|
318
|
+
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
319
|
+
t0 = (t1) => {
|
|
320
|
+
const { field, fieldState: t2 } = t1;
|
|
321
|
+
const { error, isDirty } = t2;
|
|
322
|
+
return /* @__PURE__ */ jsx(CheckboxGroupBase, {
|
|
323
|
+
...innerProps,
|
|
324
|
+
ref: mergeRefs(ref, field.ref),
|
|
325
|
+
value: field.value,
|
|
326
|
+
onChange: field.onChange,
|
|
327
|
+
onBlur: field.onBlur,
|
|
328
|
+
name: field.name,
|
|
329
|
+
isDirty,
|
|
330
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
331
|
+
error: props.error ?? error?.message
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
$[4] = innerProps;
|
|
335
|
+
$[5] = props.error;
|
|
336
|
+
$[6] = props.isDisabled;
|
|
337
|
+
$[7] = ref;
|
|
338
|
+
$[8] = t0;
|
|
339
|
+
} else t0 = $[8];
|
|
340
|
+
let t1;
|
|
341
|
+
if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
|
|
342
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
343
|
+
control: formControl.control,
|
|
344
|
+
name: formControl.name,
|
|
345
|
+
render: t0
|
|
346
|
+
});
|
|
347
|
+
$[9] = formControl.control;
|
|
348
|
+
$[10] = formControl.name;
|
|
349
|
+
$[11] = t0;
|
|
350
|
+
$[12] = t1;
|
|
351
|
+
} else t1 = $[12];
|
|
352
|
+
return t1;
|
|
353
|
+
}
|
|
354
|
+
let t0;
|
|
355
|
+
if ($[13] !== props) {
|
|
356
|
+
t0 = /* @__PURE__ */ jsx(CheckboxGroupBase, { ...props });
|
|
357
|
+
$[13] = props;
|
|
358
|
+
$[14] = t0;
|
|
359
|
+
} else t0 = $[14];
|
|
360
|
+
return t0;
|
|
361
|
+
};
|
|
362
|
+
//#endregion
|
|
363
|
+
export { CheckboxGroup$1 as CheckboxGroup };
|