@povio/ui 2.3.0-rc.11 → 2.3.0-rc.13
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 +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +99 -75
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +4 -4
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +10 -10
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +5 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +2 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +163 -148
- package/dist/config/uiConfig.context.d.ts +2 -2
- package/dist/config/uiConfig.context.js +6 -2
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ interface CheckboxBaseProps extends FormFieldErrorProps, CheckboxVariantProps, O
|
|
|
8
8
|
ref?: Ref<HTMLLabelElement>;
|
|
9
9
|
children: string | ReactElement;
|
|
10
10
|
hideLabel?: boolean;
|
|
11
|
+
fireBlurOnChange?: boolean;
|
|
11
12
|
selectedIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
12
13
|
indeterminateIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
13
14
|
isDirty?: boolean;
|
|
@@ -12,72 +12,94 @@ 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(46);
|
|
16
16
|
const ui = UIConfig.useConfig();
|
|
17
17
|
const checkboxTypographyMap = UIStyle.useMapper("checkbox.typography", checkboxTypography);
|
|
18
18
|
const checkboxContentClassNameMap = UIStyle.useMapper("checkbox.contentClassName", checkboxContentClassName);
|
|
19
19
|
let children;
|
|
20
20
|
let className;
|
|
21
21
|
let error;
|
|
22
|
+
let fireBlurOnChangeProp;
|
|
22
23
|
let hideLabelProp;
|
|
23
24
|
let isDisabled;
|
|
25
|
+
let onBlur;
|
|
26
|
+
let onChange;
|
|
24
27
|
let rest;
|
|
25
28
|
let variantProp;
|
|
26
29
|
if ($[0] !== props) {
|
|
27
|
-
({className, children, isDisabled, error, variant: variantProp, hideLabel: hideLabelProp, ...rest} = props);
|
|
30
|
+
({className, children, isDisabled, error, variant: variantProp, hideLabel: hideLabelProp, fireBlurOnChange: fireBlurOnChangeProp, onChange, onBlur, ...rest} = props);
|
|
28
31
|
$[0] = props;
|
|
29
32
|
$[1] = children;
|
|
30
33
|
$[2] = className;
|
|
31
34
|
$[3] = error;
|
|
32
|
-
$[4] =
|
|
33
|
-
$[5] =
|
|
34
|
-
$[6] =
|
|
35
|
-
$[7] =
|
|
35
|
+
$[4] = fireBlurOnChangeProp;
|
|
36
|
+
$[5] = hideLabelProp;
|
|
37
|
+
$[6] = isDisabled;
|
|
38
|
+
$[7] = onBlur;
|
|
39
|
+
$[8] = onChange;
|
|
40
|
+
$[9] = rest;
|
|
41
|
+
$[10] = variantProp;
|
|
36
42
|
} else {
|
|
37
43
|
children = $[1];
|
|
38
44
|
className = $[2];
|
|
39
45
|
error = $[3];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
fireBlurOnChangeProp = $[4];
|
|
47
|
+
hideLabelProp = $[5];
|
|
48
|
+
isDisabled = $[6];
|
|
49
|
+
onBlur = $[7];
|
|
50
|
+
onChange = $[8];
|
|
51
|
+
rest = $[9];
|
|
52
|
+
variantProp = $[10];
|
|
44
53
|
}
|
|
45
54
|
const variant = variantProp ?? ui.checkbox.variant;
|
|
46
55
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
56
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.checkbox.fireBlurOnChange;
|
|
47
57
|
let t0;
|
|
48
|
-
if ($[
|
|
58
|
+
if ($[11] !== error || $[12] !== isDisabled) {
|
|
49
59
|
t0 = {
|
|
50
60
|
error,
|
|
51
61
|
isDisabled
|
|
52
62
|
};
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
} else t0 = $[
|
|
63
|
+
$[11] = error;
|
|
64
|
+
$[12] = isDisabled;
|
|
65
|
+
$[13] = t0;
|
|
66
|
+
} else t0 = $[13];
|
|
57
67
|
const formFieldErrorProps = t0;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
67
|
-
|
|
68
|
+
let t1;
|
|
69
|
+
if ($[14] !== fireBlurOnChange || $[15] !== onBlur || $[16] !== onChange) {
|
|
70
|
+
t1 = (isSelected) => {
|
|
71
|
+
onChange?.(isSelected);
|
|
72
|
+
if (fireBlurOnChange) onBlur?.({});
|
|
73
|
+
};
|
|
74
|
+
$[14] = fireBlurOnChange;
|
|
75
|
+
$[15] = onBlur;
|
|
76
|
+
$[16] = onChange;
|
|
77
|
+
$[17] = t1;
|
|
78
|
+
} else t1 = $[17];
|
|
79
|
+
const handleChange = t1;
|
|
80
|
+
const t2 = !!error;
|
|
81
|
+
const t3 = error || void 0;
|
|
82
|
+
const t4 = props.isDirty || void 0;
|
|
83
|
+
const t5 = props.isRequired || void 0;
|
|
68
84
|
let t6;
|
|
69
|
-
if ($[
|
|
70
|
-
t6 =
|
|
85
|
+
if ($[18] !== className) {
|
|
86
|
+
t6 = clsx("relative", checkboxIndicatorClass, className);
|
|
87
|
+
$[18] = className;
|
|
88
|
+
$[19] = t6;
|
|
89
|
+
} else t6 = $[19];
|
|
90
|
+
let t7;
|
|
91
|
+
if ($[20] !== rest || $[21] !== variant) {
|
|
92
|
+
t7 = /* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
71
93
|
variant,
|
|
72
94
|
...rest
|
|
73
95
|
});
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
} else
|
|
78
|
-
let
|
|
79
|
-
if ($[
|
|
80
|
-
|
|
96
|
+
$[20] = rest;
|
|
97
|
+
$[21] = variant;
|
|
98
|
+
$[22] = t7;
|
|
99
|
+
} else t7 = $[22];
|
|
100
|
+
let t8;
|
|
101
|
+
if ($[23] !== checkboxContentClassNameMap || $[24] !== checkboxTypographyMap || $[25] !== children || $[26] !== hideLabel || $[27] !== rest || $[28] !== variant) {
|
|
102
|
+
t8 = !hideLabel && /* @__PURE__ */ jsx(CheckContent, {
|
|
81
103
|
typography: checkboxTypographyMap({
|
|
82
104
|
variant,
|
|
83
105
|
...rest
|
|
@@ -88,51 +110,53 @@ var CheckboxBase = (props) => {
|
|
|
88
110
|
}),
|
|
89
111
|
children
|
|
90
112
|
});
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
} else
|
|
99
|
-
let
|
|
100
|
-
if ($[
|
|
101
|
-
|
|
113
|
+
$[23] = checkboxContentClassNameMap;
|
|
114
|
+
$[24] = checkboxTypographyMap;
|
|
115
|
+
$[25] = children;
|
|
116
|
+
$[26] = hideLabel;
|
|
117
|
+
$[27] = rest;
|
|
118
|
+
$[28] = variant;
|
|
119
|
+
$[29] = t8;
|
|
120
|
+
} else t8 = $[29];
|
|
121
|
+
let t9;
|
|
122
|
+
if ($[30] !== handleChange || $[31] !== isDisabled || $[32] !== rest || $[33] !== t2 || $[34] !== t3 || $[35] !== t4 || $[36] !== t5 || $[37] !== t6 || $[38] !== t7 || $[39] !== t8) {
|
|
123
|
+
t9 = /* @__PURE__ */ jsxs(Checkbox, {
|
|
102
124
|
...rest,
|
|
103
125
|
isDisabled,
|
|
104
|
-
isInvalid:
|
|
105
|
-
"aria-errormessage":
|
|
106
|
-
"data-is-dirty":
|
|
107
|
-
"data-is-required":
|
|
108
|
-
|
|
109
|
-
|
|
126
|
+
isInvalid: t2,
|
|
127
|
+
"aria-errormessage": t3,
|
|
128
|
+
"data-is-dirty": t4,
|
|
129
|
+
"data-is-required": t5,
|
|
130
|
+
onChange: handleChange,
|
|
131
|
+
className: t6,
|
|
132
|
+
children: [t7, t8]
|
|
110
133
|
});
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if ($[33] !== formFieldErrorProps) {
|
|
124
|
-
t9 = /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
125
|
-
$[33] = formFieldErrorProps;
|
|
126
|
-
$[34] = t9;
|
|
127
|
-
} else t9 = $[34];
|
|
134
|
+
$[30] = handleChange;
|
|
135
|
+
$[31] = isDisabled;
|
|
136
|
+
$[32] = rest;
|
|
137
|
+
$[33] = t2;
|
|
138
|
+
$[34] = t3;
|
|
139
|
+
$[35] = t4;
|
|
140
|
+
$[36] = t5;
|
|
141
|
+
$[37] = t6;
|
|
142
|
+
$[38] = t7;
|
|
143
|
+
$[39] = t8;
|
|
144
|
+
$[40] = t9;
|
|
145
|
+
} else t9 = $[40];
|
|
128
146
|
let t10;
|
|
129
|
-
if ($[
|
|
130
|
-
t10 = /* @__PURE__ */
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
if ($[41] !== formFieldErrorProps) {
|
|
148
|
+
t10 = /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
149
|
+
$[41] = formFieldErrorProps;
|
|
150
|
+
$[42] = t10;
|
|
151
|
+
} else t10 = $[42];
|
|
152
|
+
let t11;
|
|
153
|
+
if ($[43] !== t10 || $[44] !== t9) {
|
|
154
|
+
t11 = /* @__PURE__ */ jsxs(Fragment, { children: [t9, t10] });
|
|
155
|
+
$[43] = t10;
|
|
156
|
+
$[44] = t9;
|
|
157
|
+
$[45] = t11;
|
|
158
|
+
} else t11 = $[45];
|
|
159
|
+
return t11;
|
|
136
160
|
};
|
|
137
161
|
var Checkbox$1 = (props) => {
|
|
138
162
|
const $ = c(15);
|
|
@@ -267,14 +267,14 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
267
267
|
if (calendarDate === null) return null;
|
|
268
268
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
269
269
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
270
|
-
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
271
|
-
return DateTime.fromJSDate(date_0).toISODate();
|
|
270
|
+
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
|
|
271
|
+
return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
|
|
272
272
|
};
|
|
273
273
|
const parseCalendarDate = (formattedDate) => {
|
|
274
274
|
if (formattedDate == null) return formattedDate;
|
|
275
275
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
276
|
-
const date_1 = DateTime.fromISO(formattedDate).toJSDate();
|
|
277
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1)));
|
|
276
|
+
const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
277
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
|
|
278
278
|
};
|
|
279
279
|
const dateLimits = {
|
|
280
280
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -590,11 +590,11 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
590
590
|
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
591
591
|
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
592
592
|
};
|
|
593
|
-
const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
|
|
594
|
-
const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
|
|
593
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
594
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
595
595
|
return {
|
|
596
|
-
start: DateTime.fromJSDate(startDate).toISODate(),
|
|
597
|
-
end: DateTime.fromJSDate(endDate).toISODate()
|
|
596
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
597
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
598
598
|
};
|
|
599
599
|
};
|
|
600
600
|
const parseDateRange = (formattedRange) => {
|
|
@@ -603,10 +603,10 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
603
603
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
604
604
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
605
605
|
};
|
|
606
|
-
const startDate_0 = DateTime.fromISO(formattedRange.start).toJSDate();
|
|
607
|
-
const endDate_0 = DateTime.fromISO(formattedRange.end).toJSDate();
|
|
608
|
-
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0);
|
|
609
|
-
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0);
|
|
606
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
607
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
608
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
609
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
610
610
|
return {
|
|
611
611
|
start: toCalendarDate(startZonedDateTime),
|
|
612
612
|
end: toCalendarDate(endZonedDateTime)
|
|
@@ -615,8 +615,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
615
615
|
const parseCalendarDate = (formattedDate) => {
|
|
616
616
|
if (formattedDate == null) return formattedDate;
|
|
617
617
|
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
618
|
-
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
619
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
618
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
619
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
620
620
|
};
|
|
621
621
|
const dateLimits = {
|
|
622
622
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -19,12 +19,12 @@ import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react
|
|
|
19
19
|
import { useDatePicker, useLocale } from "react-aria";
|
|
20
20
|
import { mergeRefs } from "@react-aria/utils";
|
|
21
21
|
import { Controller, useWatch } from "react-hook-form";
|
|
22
|
-
import { Time, createCalendar,
|
|
22
|
+
import { Time, createCalendar, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
23
23
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
24
24
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
25
25
|
var DateTimePickerBase = (props) => {
|
|
26
26
|
const ui = UIConfig.useConfig();
|
|
27
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
27
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: _timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
28
28
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
29
29
|
const variant = variantProp ?? ui.input.variant;
|
|
30
30
|
const as = asProp ?? ui.input.as;
|
|
@@ -38,8 +38,7 @@ var DateTimePickerBase = (props) => {
|
|
|
38
38
|
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
39
39
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
40
40
|
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
41
|
-
|
|
42
|
-
if (timeZone) effectiveTimeZone = timeZone;
|
|
41
|
+
const effectiveTimeZone = "UTC";
|
|
43
42
|
const formFieldProps = {
|
|
44
43
|
error,
|
|
45
44
|
label,
|
|
@@ -85,7 +84,7 @@ var DateTimePickerBase = (props) => {
|
|
|
85
84
|
onChange: (val_0) => {
|
|
86
85
|
onChange?.(val_0);
|
|
87
86
|
dialogState.setValue(val_0);
|
|
88
|
-
calendarState.setFocusedDate(val_0 || today(
|
|
87
|
+
calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
|
|
89
88
|
debouncedBlur(val_0);
|
|
90
89
|
},
|
|
91
90
|
shouldCloseOnSelect: false,
|
|
@@ -257,8 +256,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
257
256
|
let isFormControlDisabled = false;
|
|
258
257
|
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
259
258
|
const rawValue = watchedValue ?? props.value ?? null;
|
|
260
|
-
|
|
261
|
-
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
259
|
+
const effectiveTimeZone = "UTC";
|
|
262
260
|
const formatDateValue = (dateValue) => {
|
|
263
261
|
if (dateValue === null) return null;
|
|
264
262
|
if (fullIso) return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
@@ -17,7 +17,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
17
17
|
import { useLocale, useTimeField } from "react-aria";
|
|
18
18
|
import { mergeRefs } from "@react-aria/utils";
|
|
19
19
|
import { Controller, useWatch } from "react-hook-form";
|
|
20
|
-
import {
|
|
20
|
+
import { now, toTime } from "@internationalized/date";
|
|
21
21
|
import { DateTime } from "luxon";
|
|
22
22
|
import { useTimeFieldState } from "react-stately";
|
|
23
23
|
//#region src/components/inputs/DateTime/TimePicker/TimePicker.tsx
|
|
@@ -415,8 +415,7 @@ var TimePickerBase = (props) => {
|
|
|
415
415
|
};
|
|
416
416
|
var TimePicker = ({ renderStaticInput, ...props }) => {
|
|
417
417
|
const ui = UIConfig.useConfig();
|
|
418
|
-
|
|
419
|
-
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
418
|
+
const effectiveTimeZone = "UTC";
|
|
420
419
|
const { locale } = useLocale();
|
|
421
420
|
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
422
421
|
const inputRef = useRef(null);
|
|
@@ -14,6 +14,7 @@ interface RadioGroupBaseProps extends Omit<FormFieldProps, "variant">, RadioVari
|
|
|
14
14
|
isDirty?: boolean;
|
|
15
15
|
inputClassName?: string;
|
|
16
16
|
labelClassName?: string;
|
|
17
|
+
fireBlurOnChange?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface RadioGroupProps extends RadioGroupBaseProps {
|
|
19
20
|
}
|
|
@@ -15,7 +15,7 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
15
15
|
import { Controller } from "react-hook-form";
|
|
16
16
|
//#region src/components/inputs/RadioGroup/RadioGroup.tsx
|
|
17
17
|
var RadioGroupBase = (props) => {
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(96);
|
|
19
19
|
const ui = UIConfig.useConfig();
|
|
20
20
|
const radioCva = UIStyle.useCva("radio.cva", radio);
|
|
21
21
|
const radioContentWrapperCva = UIStyle.useCva("radio.contentWrapperCva", radioContentWrapper);
|
|
@@ -24,11 +24,12 @@ var RadioGroupBase = (props) => {
|
|
|
24
24
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
25
25
|
const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
|
|
26
26
|
const radioContentClassNameMap = UIStyle.useMapper("radio.contentClassName", radioContentClassName);
|
|
27
|
-
const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
|
|
27
|
+
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;
|
|
28
28
|
const as = asProp ?? ui.input.as;
|
|
29
29
|
const size = sizeProp ?? ui.input.size;
|
|
30
30
|
const variant = variantProp ?? ui.radioGroup.variant;
|
|
31
31
|
const hideLabel = hideLabelProp ?? ui.radioGroup.hideLabel;
|
|
32
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.radioGroup.fireBlurOnChange;
|
|
32
33
|
const radioClassName = radioCva({
|
|
33
34
|
variant,
|
|
34
35
|
...rest
|
|
@@ -108,42 +109,54 @@ var RadioGroupBase = (props) => {
|
|
|
108
109
|
const headerProps = t4;
|
|
109
110
|
const selectedValue = value ?? defaultValue;
|
|
110
111
|
const shouldRenderInputFrame = as !== "default";
|
|
112
|
+
let t5;
|
|
113
|
+
if ($[25] !== fireBlurOnChange || $[26] !== onBlur || $[27] !== onChange) {
|
|
114
|
+
t5 = (nextValue) => {
|
|
115
|
+
onChange?.(nextValue);
|
|
116
|
+
if (fireBlurOnChange) onBlur?.({});
|
|
117
|
+
};
|
|
118
|
+
$[25] = fireBlurOnChange;
|
|
119
|
+
$[26] = onBlur;
|
|
120
|
+
$[27] = onChange;
|
|
121
|
+
$[28] = t5;
|
|
122
|
+
} else t5 = $[28];
|
|
123
|
+
const handleChange = t5;
|
|
111
124
|
const T0 = TooltipWrapper;
|
|
112
|
-
const
|
|
125
|
+
const t6 = as === "inline" ? -1 : void 0;
|
|
113
126
|
const T1 = RadioGroup;
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
127
|
+
const t7 = !!error;
|
|
128
|
+
const t8 = isDirty || void 0;
|
|
129
|
+
const t9 = isRequired || void 0;
|
|
117
130
|
const T2 = FormField;
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
if ($[
|
|
121
|
-
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else
|
|
126
|
-
const
|
|
127
|
-
let
|
|
128
|
-
if ($[
|
|
129
|
-
|
|
131
|
+
const t10 = as === "inline" && "h-full";
|
|
132
|
+
let t11;
|
|
133
|
+
if ($[29] !== className || $[30] !== t10) {
|
|
134
|
+
t11 = clsx("w-full", t10, className);
|
|
135
|
+
$[29] = className;
|
|
136
|
+
$[30] = t10;
|
|
137
|
+
$[31] = t11;
|
|
138
|
+
} else t11 = $[31];
|
|
139
|
+
const t12 = as === "inline" ? -1 : void 0;
|
|
140
|
+
let t13;
|
|
141
|
+
if ($[32] !== as || $[33] !== inputBaseCva || $[34] !== inputClassName || $[35] !== shouldRenderInputFrame || $[36] !== ui) {
|
|
142
|
+
t13 = clsx("group/radio-group-content relative", shouldRenderInputFrame && inputBaseCva({
|
|
130
143
|
variant: ui.input.variant,
|
|
131
144
|
as
|
|
132
145
|
}), inputClassName);
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
} else
|
|
140
|
-
const
|
|
141
|
-
const t14 = isDisabled || void 0;
|
|
146
|
+
$[32] = as;
|
|
147
|
+
$[33] = inputBaseCva;
|
|
148
|
+
$[34] = inputClassName;
|
|
149
|
+
$[35] = shouldRenderInputFrame;
|
|
150
|
+
$[36] = ui;
|
|
151
|
+
$[37] = t13;
|
|
152
|
+
} else t13 = $[37];
|
|
153
|
+
const t14 = "";
|
|
142
154
|
const t15 = isDisabled || void 0;
|
|
143
|
-
const t16 =
|
|
144
|
-
const t17 =
|
|
145
|
-
const t18 = "";
|
|
146
|
-
const t19 =
|
|
155
|
+
const t16 = isDisabled || void 0;
|
|
156
|
+
const t17 = !!error || void 0;
|
|
157
|
+
const t18 = selectedValue != null && selectedValue !== "" ? true : void 0;
|
|
158
|
+
const t19 = "";
|
|
159
|
+
const t20 = clsx(radioContentWrapperCva({
|
|
147
160
|
variant,
|
|
148
161
|
as,
|
|
149
162
|
hasInputFrame: shouldRenderInputFrame,
|
|
@@ -152,31 +165,31 @@ var RadioGroupBase = (props) => {
|
|
|
152
165
|
as,
|
|
153
166
|
size
|
|
154
167
|
}));
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
if ($[
|
|
159
|
-
|
|
168
|
+
const t21 = isDirty || void 0;
|
|
169
|
+
const t22 = isRequired || void 0;
|
|
170
|
+
let t23;
|
|
171
|
+
if ($[38] !== as || $[39] !== headerProps || $[40] !== size) {
|
|
172
|
+
t23 = as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
160
173
|
as,
|
|
161
174
|
size,
|
|
162
175
|
...headerProps
|
|
163
176
|
});
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
} else
|
|
169
|
-
const
|
|
177
|
+
$[38] = as;
|
|
178
|
+
$[39] = headerProps;
|
|
179
|
+
$[40] = size;
|
|
180
|
+
$[41] = t23;
|
|
181
|
+
} else t23 = $[41];
|
|
182
|
+
const t24 = radioContentRowCva({
|
|
170
183
|
variant,
|
|
171
184
|
as,
|
|
172
185
|
hasInputFrame: shouldRenderInputFrame,
|
|
173
186
|
...rest
|
|
174
187
|
});
|
|
175
|
-
let
|
|
176
|
-
if ($[
|
|
177
|
-
let
|
|
178
|
-
if ($[
|
|
179
|
-
|
|
188
|
+
let t25;
|
|
189
|
+
if ($[42] !== labelClassName || $[43] !== options || $[44] !== radioClassName || $[45] !== radioContentClassNameValue || $[46] !== radioTypographyProps) {
|
|
190
|
+
let t26;
|
|
191
|
+
if ($[48] !== labelClassName || $[49] !== radioClassName || $[50] !== radioContentClassNameValue || $[51] !== radioTypographyProps) {
|
|
192
|
+
t26 = (option) => /* @__PURE__ */ jsxs(Radio, {
|
|
180
193
|
value: option.value,
|
|
181
194
|
className: clsx("relative", radioIndicatorClass),
|
|
182
195
|
children: [/* @__PURE__ */ jsx("div", { className: radioClassName }), /* @__PURE__ */ jsx(CheckContent, {
|
|
@@ -186,127 +199,129 @@ var RadioGroupBase = (props) => {
|
|
|
186
199
|
children: option.label
|
|
187
200
|
})]
|
|
188
201
|
}, option.value);
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
} else
|
|
195
|
-
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
} else
|
|
203
|
-
let t25;
|
|
204
|
-
if ($[49] !== t23 || $[50] !== t24) {
|
|
205
|
-
t25 = /* @__PURE__ */ jsx("div", {
|
|
206
|
-
className: t23,
|
|
207
|
-
children: t24
|
|
208
|
-
});
|
|
209
|
-
$[49] = t23;
|
|
210
|
-
$[50] = t24;
|
|
211
|
-
$[51] = t25;
|
|
212
|
-
} else t25 = $[51];
|
|
202
|
+
$[48] = labelClassName;
|
|
203
|
+
$[49] = radioClassName;
|
|
204
|
+
$[50] = radioContentClassNameValue;
|
|
205
|
+
$[51] = radioTypographyProps;
|
|
206
|
+
$[52] = t26;
|
|
207
|
+
} else t26 = $[52];
|
|
208
|
+
t25 = options.map(t26);
|
|
209
|
+
$[42] = labelClassName;
|
|
210
|
+
$[43] = options;
|
|
211
|
+
$[44] = radioClassName;
|
|
212
|
+
$[45] = radioContentClassNameValue;
|
|
213
|
+
$[46] = radioTypographyProps;
|
|
214
|
+
$[47] = t25;
|
|
215
|
+
} else t25 = $[47];
|
|
213
216
|
let t26;
|
|
214
|
-
if ($[
|
|
215
|
-
t26 = /* @__PURE__ */
|
|
216
|
-
className:
|
|
217
|
-
|
|
218
|
-
"data-is-required": t21,
|
|
219
|
-
children: [t22, t25]
|
|
217
|
+
if ($[53] !== t24 || $[54] !== t25) {
|
|
218
|
+
t26 = /* @__PURE__ */ jsx("div", {
|
|
219
|
+
className: t24,
|
|
220
|
+
children: t25
|
|
220
221
|
});
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
|
|
225
|
-
$[56] = t25;
|
|
226
|
-
$[57] = t26;
|
|
227
|
-
} else t26 = $[57];
|
|
222
|
+
$[53] = t24;
|
|
223
|
+
$[54] = t25;
|
|
224
|
+
$[55] = t26;
|
|
225
|
+
} else t26 = $[55];
|
|
228
226
|
let t27;
|
|
229
|
-
if ($[
|
|
230
|
-
t27 = /* @__PURE__ */
|
|
231
|
-
className:
|
|
232
|
-
"data-
|
|
233
|
-
"data-
|
|
234
|
-
|
|
235
|
-
"data-invalid": t16,
|
|
236
|
-
"data-has-selection": t17,
|
|
237
|
-
"data-radio-group-content": t18,
|
|
238
|
-
children: t26
|
|
227
|
+
if ($[56] !== t20 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23 || $[60] !== t26) {
|
|
228
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
229
|
+
className: t20,
|
|
230
|
+
"data-is-dirty": t21,
|
|
231
|
+
"data-is-required": t22,
|
|
232
|
+
children: [t23, t26]
|
|
239
233
|
});
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
|
|
247
|
-
} else t27 = $[64];
|
|
234
|
+
$[56] = t20;
|
|
235
|
+
$[57] = t21;
|
|
236
|
+
$[58] = t22;
|
|
237
|
+
$[59] = t23;
|
|
238
|
+
$[60] = t26;
|
|
239
|
+
$[61] = t27;
|
|
240
|
+
} else t27 = $[61];
|
|
248
241
|
let t28;
|
|
249
|
-
if ($[
|
|
250
|
-
t28 = /* @__PURE__ */ jsx(
|
|
242
|
+
if ($[62] !== t13 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t18 || $[67] !== t27) {
|
|
243
|
+
t28 = /* @__PURE__ */ jsx("div", {
|
|
244
|
+
className: t13,
|
|
245
|
+
"data-rac": t14,
|
|
246
|
+
"data-disabled": t15,
|
|
247
|
+
"data-is-disabled": t16,
|
|
248
|
+
"data-invalid": t17,
|
|
249
|
+
"data-has-selection": t18,
|
|
250
|
+
"data-radio-group-content": t19,
|
|
251
|
+
children: t27
|
|
252
|
+
});
|
|
253
|
+
$[62] = t13;
|
|
254
|
+
$[63] = t15;
|
|
255
|
+
$[64] = t16;
|
|
256
|
+
$[65] = t17;
|
|
257
|
+
$[66] = t18;
|
|
258
|
+
$[67] = t27;
|
|
259
|
+
$[68] = t28;
|
|
260
|
+
} else t28 = $[68];
|
|
261
|
+
let t29;
|
|
262
|
+
if ($[69] !== T2 || $[70] !== as || $[71] !== formFieldProps || $[72] !== labelProps || $[73] !== t11 || $[74] !== t12 || $[75] !== t28) {
|
|
263
|
+
t29 = /* @__PURE__ */ jsx(T2, {
|
|
251
264
|
...formFieldProps,
|
|
252
265
|
as,
|
|
253
266
|
labelProps,
|
|
254
|
-
className:
|
|
255
|
-
tabIndex:
|
|
256
|
-
children:
|
|
267
|
+
className: t11,
|
|
268
|
+
tabIndex: t12,
|
|
269
|
+
children: t28
|
|
257
270
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
} else
|
|
267
|
-
let
|
|
268
|
-
if ($[
|
|
269
|
-
|
|
271
|
+
$[69] = T2;
|
|
272
|
+
$[70] = as;
|
|
273
|
+
$[71] = formFieldProps;
|
|
274
|
+
$[72] = labelProps;
|
|
275
|
+
$[73] = t11;
|
|
276
|
+
$[74] = t12;
|
|
277
|
+
$[75] = t28;
|
|
278
|
+
$[76] = t29;
|
|
279
|
+
} else t29 = $[76];
|
|
280
|
+
let t30;
|
|
281
|
+
if ($[77] !== T1 || $[78] !== defaultValue || $[79] !== fieldProps || $[80] !== handleChange || $[81] !== isDisabled || $[82] !== ref || $[83] !== rest || $[84] !== t29 || $[85] !== t7 || $[86] !== t8 || $[87] !== t9 || $[88] !== value) {
|
|
282
|
+
t30 = /* @__PURE__ */ jsx(T1, {
|
|
270
283
|
...rest,
|
|
271
284
|
...fieldProps,
|
|
272
285
|
ref,
|
|
273
286
|
value,
|
|
274
287
|
defaultValue,
|
|
288
|
+
onChange: handleChange,
|
|
275
289
|
isDisabled,
|
|
276
|
-
isInvalid:
|
|
277
|
-
"data-is-dirty":
|
|
278
|
-
"data-is-required":
|
|
279
|
-
children:
|
|
290
|
+
isInvalid: t7,
|
|
291
|
+
"data-is-dirty": t8,
|
|
292
|
+
"data-is-required": t9,
|
|
293
|
+
children: t29
|
|
280
294
|
});
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[80] = t6;
|
|
289
|
-
$[81] = t7;
|
|
290
|
-
$[82] = t8;
|
|
291
|
-
$[83] = value;
|
|
295
|
+
$[77] = T1;
|
|
296
|
+
$[78] = defaultValue;
|
|
297
|
+
$[79] = fieldProps;
|
|
298
|
+
$[80] = handleChange;
|
|
299
|
+
$[81] = isDisabled;
|
|
300
|
+
$[82] = ref;
|
|
301
|
+
$[83] = rest;
|
|
292
302
|
$[84] = t29;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
303
|
+
$[85] = t7;
|
|
304
|
+
$[86] = t8;
|
|
305
|
+
$[87] = t9;
|
|
306
|
+
$[88] = value;
|
|
307
|
+
$[89] = t30;
|
|
308
|
+
} else t30 = $[89];
|
|
309
|
+
let t31;
|
|
310
|
+
if ($[90] !== T0 || $[91] !== as || $[92] !== error || $[93] !== t30 || $[94] !== t6) {
|
|
311
|
+
t31 = /* @__PURE__ */ jsx(T0, {
|
|
297
312
|
as,
|
|
298
313
|
error,
|
|
299
|
-
triggerTabIndex:
|
|
300
|
-
children:
|
|
314
|
+
triggerTabIndex: t6,
|
|
315
|
+
children: t30
|
|
301
316
|
});
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
} else
|
|
309
|
-
return
|
|
317
|
+
$[90] = T0;
|
|
318
|
+
$[91] = as;
|
|
319
|
+
$[92] = error;
|
|
320
|
+
$[93] = t30;
|
|
321
|
+
$[94] = t6;
|
|
322
|
+
$[95] = t31;
|
|
323
|
+
} else t31 = $[95];
|
|
324
|
+
return t31;
|
|
310
325
|
};
|
|
311
326
|
var RadioGroup$1 = (props) => {
|
|
312
327
|
const $ = c(15);
|
|
@@ -23,8 +23,8 @@ export declare namespace UIConfig {
|
|
|
23
23
|
input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size">;
|
|
24
24
|
button: Pick<ButtonProps, "variant" | "size">;
|
|
25
25
|
numberInput: Pick<NumberInputProps, "formatOptions">;
|
|
26
|
-
radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
|
|
27
|
-
checkbox: Pick<CheckboxProps, "variant">;
|
|
26
|
+
radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel" | "fireBlurOnChange">;
|
|
27
|
+
checkbox: Pick<CheckboxProps, "variant" | "fireBlurOnChange">;
|
|
28
28
|
select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon" | "fireBlurOnChange">;
|
|
29
29
|
queryAutocomplete: {
|
|
30
30
|
isInitialQueryDisabled?: boolean;
|
|
@@ -28,9 +28,13 @@ var UIConfig;
|
|
|
28
28
|
} },
|
|
29
29
|
radioGroup: {
|
|
30
30
|
variant: "default",
|
|
31
|
-
hideLabel: false
|
|
31
|
+
hideLabel: false,
|
|
32
|
+
fireBlurOnChange: false
|
|
33
|
+
},
|
|
34
|
+
checkbox: {
|
|
35
|
+
variant: "default",
|
|
36
|
+
fireBlurOnChange: false
|
|
32
37
|
},
|
|
33
|
-
checkbox: { variant: "default" },
|
|
34
38
|
select: {
|
|
35
39
|
selectionMode: "single",
|
|
36
40
|
isSearchable: false,
|