@povio/ui 3.3.0-rc.3 → 3.3.0-rc.4
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/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +5 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +234 -201
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +142 -127
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +2 -17
- package/dist/components/inputs/DateTime/shared/DateField.js +92 -87
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +2 -0
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +144 -134
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +33 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +2 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +2 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +56 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +69 -15
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +1 -0
- package/dist/components/inputs/Selection/shared/select.context.js +19 -9
- package/dist/components/inputs/shared/input.cva.js +1 -1
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/config/uiConfig.context.d.ts +1 -0
- package/dist/config/uiConfig.context.js +2 -1
- package/dist/helpers/dynamicColumns.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/date-time.utils.d.ts +0 -1
- package/dist/utils/date-time.utils.js +21 -45
- package/dist/utils/intl.utils.d.ts +7 -0
- package/dist/utils/intl.utils.js +38 -0
- package/dist/utils/intl.utils.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { useDateFieldState } from "react-stately";
|
|
|
11
11
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
12
12
|
var omitNullValue = ({ value: _value, ...props }) => props;
|
|
13
13
|
var DateField = (t0) => {
|
|
14
|
-
const $ = c(
|
|
14
|
+
const $ = c(65);
|
|
15
15
|
const { ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity: t1, isTimeOptional: t2, format, timeZone, segmentGroup, shouldAutoFixYear: t3, ...props } = t0;
|
|
16
16
|
const dateGranularity = t1 === void 0 ? "day" : t1;
|
|
17
17
|
const isTimeOptional = t2 === void 0 ? false : t2;
|
|
@@ -84,7 +84,7 @@ var DateField = (t0) => {
|
|
|
84
84
|
const segmentsToRender = t8;
|
|
85
85
|
const getSegmentNumber = _temp;
|
|
86
86
|
let t9;
|
|
87
|
-
if ($[16] !== isTimeOptional || $[17] !== props || $[18] !== state) {
|
|
87
|
+
if ($[16] !== isTimeOptional || $[17] !== props || $[18] !== shouldAutoFixYear || $[19] !== state) {
|
|
88
88
|
t9 = () => {
|
|
89
89
|
const monthSegment = state.segments.find(_temp2);
|
|
90
90
|
const daySegment = state.segments.find(_temp3);
|
|
@@ -94,10 +94,14 @@ var DateField = (t0) => {
|
|
|
94
94
|
const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
|
|
95
95
|
const isDayFilled = daySegment && !daySegment.isPlaceholder;
|
|
96
96
|
const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
|
|
97
|
+
const isYearComplete = isYearFilled && yearSegment.text?.length === 4;
|
|
97
98
|
const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
|
|
98
99
|
const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
|
|
99
100
|
const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
|
|
100
101
|
const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
|
|
102
|
+
const month = getSegmentNumber(monthSegment);
|
|
103
|
+
const day = getSegmentNumber(daySegment);
|
|
104
|
+
const segmentYear = getSegmentNumber(yearSegment);
|
|
101
105
|
let correctedValue = null;
|
|
102
106
|
if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
|
|
103
107
|
let minute = minuteSegment?.value || 0;
|
|
@@ -115,24 +119,23 @@ var DateField = (t0) => {
|
|
|
115
119
|
}
|
|
116
120
|
state.setSegment("hour", hour);
|
|
117
121
|
}
|
|
118
|
-
if (isMonthFilled && isDayFilled && isYearEmpty) {
|
|
119
|
-
let
|
|
120
|
-
if (yearSegment?.text?.length && yearSegment?.text?.length === 2)
|
|
121
|
-
state.setSegment("year",
|
|
122
|
-
const month = getSegmentNumber(monthSegment);
|
|
123
|
-
const day = getSegmentNumber(daySegment);
|
|
122
|
+
if (shouldAutoFixYear && isMonthFilled && isDayFilled && isYearEmpty) {
|
|
123
|
+
let correctedYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
124
|
+
if (yearSegment?.text?.length && yearSegment?.text?.length === 2) correctedYear = parseInt(`20${yearSegment?.text}`);
|
|
125
|
+
state.setSegment("year", correctedYear);
|
|
124
126
|
const hasDateSegments = month !== null && day !== null;
|
|
125
127
|
const hasTimeSegment = !!(hourSegment || minuteSegment);
|
|
126
|
-
if (state.value) correctedValue = state.value.set({ year });
|
|
127
|
-
else if (hasDateSegments && hasTimeSegment) correctedValue = new CalendarDateTime(
|
|
128
|
-
else if (hasDateSegments) correctedValue = new CalendarDate(
|
|
128
|
+
if (state.value) correctedValue = state.value.set({ year: correctedYear });
|
|
129
|
+
else if (hasDateSegments && hasTimeSegment) correctedValue = new CalendarDateTime(correctedYear, month, day, getSegmentNumber(hourSegment) ?? 0, getSegmentNumber(minuteSegment) ?? 0);
|
|
130
|
+
else if (hasDateSegments) correctedValue = new CalendarDate(correctedYear, month, day);
|
|
129
131
|
}
|
|
132
|
+
if (isTimeOptional && !state.value && isMonthFilled && isDayFilled && isYearComplete && hourSegment?.isPlaceholder && minuteSegment?.isPlaceholder && month !== null && day !== null && segmentYear !== null) correctedValue = new CalendarDateTime(segmentYear, month, day, 0, 0, 0, 0);
|
|
130
133
|
const valueToCorrect = correctedValue ?? state.value;
|
|
131
134
|
if (!valueToCorrect) return;
|
|
132
|
-
const { year
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
correctedValue = valueToCorrect.set({ year:
|
|
135
|
+
const { year } = valueToCorrect;
|
|
136
|
+
if (shouldAutoFixYear && year >= 0 && year <= 99) {
|
|
137
|
+
const correctedYear_0 = year <= 50 ? 2e3 + year : 1900 + year;
|
|
138
|
+
correctedValue = valueToCorrect.set({ year: correctedYear_0 });
|
|
136
139
|
}
|
|
137
140
|
if (correctedValue) {
|
|
138
141
|
state.setValue(correctedValue);
|
|
@@ -141,72 +144,74 @@ var DateField = (t0) => {
|
|
|
141
144
|
};
|
|
142
145
|
$[16] = isTimeOptional;
|
|
143
146
|
$[17] = props;
|
|
144
|
-
$[18] =
|
|
145
|
-
$[19] =
|
|
146
|
-
|
|
147
|
+
$[18] = shouldAutoFixYear;
|
|
148
|
+
$[19] = state;
|
|
149
|
+
$[20] = t9;
|
|
150
|
+
} else t9 = $[20];
|
|
147
151
|
const autoFixYear = t9;
|
|
148
152
|
let t10;
|
|
149
|
-
if ($[
|
|
153
|
+
if ($[21] !== autoFixYear || $[22] !== fieldProps || $[23] !== isTimeOptional || $[24] !== shouldAutoFixYear) {
|
|
150
154
|
t10 = (e) => {
|
|
151
|
-
if (shouldAutoFixYear && !e.currentTarget.contains(e.relatedTarget)) autoFixYear();
|
|
155
|
+
if ((shouldAutoFixYear || isTimeOptional) && !e.currentTarget.contains(e.relatedTarget)) autoFixYear();
|
|
152
156
|
fieldProps.onBlur?.(e);
|
|
153
157
|
};
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
|
|
158
|
+
$[21] = autoFixYear;
|
|
159
|
+
$[22] = fieldProps;
|
|
160
|
+
$[23] = isTimeOptional;
|
|
161
|
+
$[24] = shouldAutoFixYear;
|
|
162
|
+
$[25] = t10;
|
|
163
|
+
} else t10 = $[25];
|
|
159
164
|
const handleBlur = t10;
|
|
160
165
|
let t11;
|
|
161
|
-
if ($[
|
|
166
|
+
if ($[26] !== autoFixYear || $[27] !== state) {
|
|
162
167
|
t11 = () => ({
|
|
163
168
|
clearField: () => {
|
|
164
169
|
state.setValue(null);
|
|
165
170
|
},
|
|
166
171
|
autoFixYear
|
|
167
172
|
});
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
} else t11 = $[
|
|
173
|
+
$[26] = autoFixYear;
|
|
174
|
+
$[27] = state;
|
|
175
|
+
$[28] = t11;
|
|
176
|
+
} else t11 = $[28];
|
|
172
177
|
useImperativeHandle(ref, t11);
|
|
173
178
|
let t12;
|
|
174
|
-
if ($[
|
|
179
|
+
if ($[29] !== previousValueRef || $[30] !== props.value || $[31] !== state) {
|
|
175
180
|
t12 = () => {
|
|
176
181
|
if (previousValueRef.current != null && props.value == null && state.value !== null) state.setValue(null);
|
|
177
182
|
previousValueRef.current = props.value;
|
|
178
183
|
};
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
} else t12 = $[
|
|
184
|
+
$[29] = previousValueRef;
|
|
185
|
+
$[30] = props.value;
|
|
186
|
+
$[31] = state;
|
|
187
|
+
$[32] = t12;
|
|
188
|
+
} else t12 = $[32];
|
|
184
189
|
let t13;
|
|
185
|
-
if ($[
|
|
190
|
+
if ($[33] !== props.value || $[34] !== state) {
|
|
186
191
|
t13 = [props.value, state];
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
} else t13 = $[
|
|
192
|
+
$[33] = props.value;
|
|
193
|
+
$[34] = state;
|
|
194
|
+
$[35] = t13;
|
|
195
|
+
} else t13 = $[35];
|
|
191
196
|
useEffect(t12, t13);
|
|
192
197
|
let t14;
|
|
193
198
|
let t15;
|
|
194
|
-
if ($[
|
|
199
|
+
if ($[36] !== onClearChange || $[37] !== state.segments) {
|
|
195
200
|
t14 = () => {
|
|
196
201
|
onClearChange?.(state.segments.some(_temp7));
|
|
197
202
|
};
|
|
198
203
|
t15 = [state.segments, onClearChange];
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
204
|
+
$[36] = onClearChange;
|
|
205
|
+
$[37] = state.segments;
|
|
206
|
+
$[38] = t14;
|
|
207
|
+
$[39] = t15;
|
|
203
208
|
} else {
|
|
204
|
-
t14 = $[
|
|
205
|
-
t15 = $[
|
|
209
|
+
t14 = $[38];
|
|
210
|
+
t15 = $[39];
|
|
206
211
|
}
|
|
207
212
|
useEffect(t14, t15);
|
|
208
213
|
let t16;
|
|
209
|
-
if ($[
|
|
214
|
+
if ($[40] !== disableManualEntry || $[41] !== format || $[42] !== state.value || $[43] !== timeZone) {
|
|
210
215
|
const getFormattedDisplayValue = () => {
|
|
211
216
|
if (!disableManualEntry) return null;
|
|
212
217
|
if (!format) return null;
|
|
@@ -217,15 +222,15 @@ var DateField = (t0) => {
|
|
|
217
222
|
return formattedDate.toFormat(format);
|
|
218
223
|
};
|
|
219
224
|
t16 = getFormattedDisplayValue();
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
} else t16 = $[
|
|
225
|
+
$[40] = disableManualEntry;
|
|
226
|
+
$[41] = format;
|
|
227
|
+
$[42] = state.value;
|
|
228
|
+
$[43] = timeZone;
|
|
229
|
+
$[44] = t16;
|
|
230
|
+
} else t16 = $[44];
|
|
226
231
|
const formattedDisplayValue = t16;
|
|
227
232
|
let t17;
|
|
228
|
-
if ($[
|
|
233
|
+
if ($[45] !== hidePlaceholder || $[46] !== isDisabled || $[47] !== segmentGroup || $[48] !== segmentsToRender || $[49] !== state) {
|
|
229
234
|
t17 = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment_7, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
|
|
230
235
|
segment: segment_7,
|
|
231
236
|
segmentGroup,
|
|
@@ -233,52 +238,52 @@ var DateField = (t0) => {
|
|
|
233
238
|
isDisabled,
|
|
234
239
|
hidePlaceholder
|
|
235
240
|
}, i)) });
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
} else t17 = $[
|
|
241
|
+
$[45] = hidePlaceholder;
|
|
242
|
+
$[46] = isDisabled;
|
|
243
|
+
$[47] = segmentGroup;
|
|
244
|
+
$[48] = segmentsToRender;
|
|
245
|
+
$[49] = state;
|
|
246
|
+
$[50] = t17;
|
|
247
|
+
} else t17 = $[50];
|
|
243
248
|
let fieldContent = t17;
|
|
244
249
|
if (formattedDisplayValue) {
|
|
245
250
|
const t18 = isDisabled && "text-interactive-text-secondary-disabled";
|
|
246
251
|
let t19;
|
|
247
|
-
if ($[
|
|
252
|
+
if ($[51] !== t18) {
|
|
248
253
|
t19 = clsx("select-none", t18);
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
} else t19 = $[
|
|
254
|
+
$[51] = t18;
|
|
255
|
+
$[52] = t19;
|
|
256
|
+
} else t19 = $[52];
|
|
252
257
|
let t20;
|
|
253
|
-
if ($[
|
|
258
|
+
if ($[53] !== formattedDisplayValue || $[54] !== t19) {
|
|
254
259
|
t20 = /* @__PURE__ */ jsx("span", {
|
|
255
260
|
className: t19,
|
|
256
261
|
children: formattedDisplayValue
|
|
257
262
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
} else t20 = $[
|
|
263
|
+
$[53] = formattedDisplayValue;
|
|
264
|
+
$[54] = t19;
|
|
265
|
+
$[55] = t20;
|
|
266
|
+
} else t20 = $[55];
|
|
262
267
|
fieldContent = t20;
|
|
263
268
|
}
|
|
264
269
|
const t18 = disableManualEntry && "pointer-events-none";
|
|
265
270
|
let t19;
|
|
266
|
-
if ($[
|
|
271
|
+
if ($[56] !== t18) {
|
|
267
272
|
t19 = clsx("relative w-full", t18);
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
} else t19 = $[
|
|
273
|
+
$[56] = t18;
|
|
274
|
+
$[57] = t19;
|
|
275
|
+
} else t19 = $[57];
|
|
271
276
|
let t20;
|
|
272
|
-
if ($[
|
|
277
|
+
if ($[58] !== fieldContent) {
|
|
273
278
|
t20 = /* @__PURE__ */ jsx("div", {
|
|
274
279
|
className: "flex",
|
|
275
280
|
children: fieldContent
|
|
276
281
|
});
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
} else t20 = $[
|
|
282
|
+
$[58] = fieldContent;
|
|
283
|
+
$[59] = t20;
|
|
284
|
+
} else t20 = $[59];
|
|
280
285
|
let t21;
|
|
281
|
-
if ($[
|
|
286
|
+
if ($[60] !== fieldProps || $[61] !== handleBlur || $[62] !== t19 || $[63] !== t20) {
|
|
282
287
|
t21 = /* @__PURE__ */ jsx("div", {
|
|
283
288
|
...fieldProps,
|
|
284
289
|
ref: dataFieldRef,
|
|
@@ -286,12 +291,12 @@ var DateField = (t0) => {
|
|
|
286
291
|
className: t19,
|
|
287
292
|
children: t20
|
|
288
293
|
});
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
} else t21 = $[
|
|
294
|
+
$[60] = fieldProps;
|
|
295
|
+
$[61] = handleBlur;
|
|
296
|
+
$[62] = t19;
|
|
297
|
+
$[63] = t20;
|
|
298
|
+
$[64] = t21;
|
|
299
|
+
} else t21 = $[64];
|
|
295
300
|
return t21;
|
|
296
301
|
};
|
|
297
302
|
function _temp(segment_0) {
|
|
@@ -8,6 +8,7 @@ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
|
8
8
|
import { DateField } from "./DateField.js";
|
|
9
9
|
import { datePickerInputContentRowDefinition } from "./datePickerInput.cva.js";
|
|
10
10
|
import { renderDatePickerTodayIcon } from "./datePickerTodayIcon.js";
|
|
11
|
+
import { useFirefoxDateSegmentSelectionGuard } from "./useFirefoxDateSegmentSelectionGuard.js";
|
|
11
12
|
import { InputClear } from "../../shared/InputClear.js";
|
|
12
13
|
import { c } from "react/compiler-runtime";
|
|
13
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -58,6 +59,7 @@ var DatePickerInput = (t0) => {
|
|
|
58
59
|
const dateFieldRef = useRef(null);
|
|
59
60
|
const endDateFieldRef = useRef(null);
|
|
60
61
|
const containerRef = useRef(null);
|
|
62
|
+
useFirefoxDateSegmentSelectionGuard(containerRef);
|
|
61
63
|
const t8 = isValueControlled ? fieldValue ?? null : fieldProps.value ?? null;
|
|
62
64
|
let t9;
|
|
63
65
|
if ($[4] !== autoFixYear || $[5] !== fieldProps || $[6] !== t8) {
|