@povio/ui 3.2.4-rc.1 → 3.2.4-rc.11
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/DateTime/shared/DatePickerInput.js +2 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +2 -2
- 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/SelectDesktop.js +160 -390
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -1
- package/dist/components/inputs/Selection/shared/SelectInput.js +142 -131
- 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/helpers/dynamicColumns.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/date-time.utils.js +21 -11
- 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
- package/dist/components/inputs/DateTime/shared/usePreserveExternalFocusOnUnmount.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/usePreserveExternalFocusOnUnmount.js +0 -32
|
@@ -18,8 +18,8 @@ import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
|
18
18
|
import { useTranslation } from "react-i18next";
|
|
19
19
|
//#region src/components/inputs/Selection/shared/SelectInput.tsx
|
|
20
20
|
var SelectInput = (t0) => {
|
|
21
|
-
const $0 = c(
|
|
22
|
-
const { ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props } = t0;
|
|
21
|
+
const $0 = c(139);
|
|
22
|
+
const { ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onTriggerPointerDown, onBlur, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props } = t0;
|
|
23
23
|
const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
|
|
24
24
|
const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
|
|
25
25
|
const inputClearClassCva = UIOverrides.useCva("input.clearClassCva", inputClearClassDefinition);
|
|
@@ -240,35 +240,44 @@ var SelectInput = (t0) => {
|
|
|
240
240
|
const t30 = isRequired || void 0;
|
|
241
241
|
const t31 = isDirty || void 0;
|
|
242
242
|
const t32 = "";
|
|
243
|
-
|
|
243
|
+
let t33;
|
|
244
|
+
if ($0[50] !== onTriggerPointerDown) {
|
|
245
|
+
t33 = (event) => {
|
|
246
|
+
const trigger = event.currentTarget.querySelector("[aria-expanded]");
|
|
247
|
+
onTriggerPointerDown?.(trigger?.getAttribute("aria-expanded") === "true");
|
|
248
|
+
};
|
|
249
|
+
$0[50] = onTriggerPointerDown;
|
|
250
|
+
$0[51] = t33;
|
|
251
|
+
} else t33 = $0[51];
|
|
252
|
+
const t34 = clsx("relative flex flex-1 items-center gap-input-gap-input-text-to-elements truncate", !isDisabled && isSearchable && "cursor-text", !isDisabled && !isSearchable && "cursor-pointer", inputSizeCva({
|
|
244
253
|
as,
|
|
245
254
|
size,
|
|
246
255
|
...props
|
|
247
256
|
}));
|
|
248
|
-
let
|
|
249
|
-
if ($0[
|
|
250
|
-
|
|
257
|
+
let t35;
|
|
258
|
+
if ($0[52] !== as || $0[53] !== headerProps || $0[54] !== labelProps) {
|
|
259
|
+
t35 = as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
251
260
|
as,
|
|
252
261
|
...headerProps,
|
|
253
262
|
labelProps
|
|
254
263
|
});
|
|
255
|
-
$0[
|
|
256
|
-
$0[
|
|
257
|
-
$0[
|
|
258
|
-
$0[53] = t34;
|
|
259
|
-
} else t34 = $0[53];
|
|
260
|
-
let t35;
|
|
261
|
-
if ($0[54] !== leadingContent) {
|
|
262
|
-
t35 = leadingContent && /* @__PURE__ */ jsx("div", {
|
|
263
|
-
className: "ml-input-side-default flex shrink-0 items-center",
|
|
264
|
-
children: leadingContent
|
|
265
|
-
});
|
|
266
|
-
$0[54] = leadingContent;
|
|
264
|
+
$0[52] = as;
|
|
265
|
+
$0[53] = headerProps;
|
|
266
|
+
$0[54] = labelProps;
|
|
267
267
|
$0[55] = t35;
|
|
268
268
|
} else t35 = $0[55];
|
|
269
269
|
let t36;
|
|
270
|
-
if ($0[56] !==
|
|
271
|
-
t36 =
|
|
270
|
+
if ($0[56] !== leadingContent) {
|
|
271
|
+
t36 = leadingContent && /* @__PURE__ */ jsx("div", {
|
|
272
|
+
className: "ml-input-side-default flex shrink-0 items-center",
|
|
273
|
+
children: leadingContent
|
|
274
|
+
});
|
|
275
|
+
$0[56] = leadingContent;
|
|
276
|
+
$0[57] = t36;
|
|
277
|
+
} else t36 = $0[57];
|
|
278
|
+
let t37;
|
|
279
|
+
if ($0[58] !== as || $0[59] !== collapseAfter || $0[60] !== fieldProps || $0[61] !== inputClassName || $0[62] !== isDisabled || $0[63] !== isSearchable || $0[64] !== onBlur || $0[65] !== onKeyDown || $0[66] !== onRemove || $0[67] !== placeholder || $0[68] !== selectInputTagsContentWrapperCva || $0[69] !== selectedItems || $0[70] !== selectedTagsType || $0[71] !== showTags) {
|
|
280
|
+
t37 = (showTags || isSearchable) && /* @__PURE__ */ jsxs("div", {
|
|
272
281
|
className: selectInputTagsContentWrapperCva({ isSearchable }),
|
|
273
282
|
children: [showTags && /* @__PURE__ */ jsx(SelectInputTags, {
|
|
274
283
|
selectedItems,
|
|
@@ -285,25 +294,25 @@ var SelectInput = (t0) => {
|
|
|
285
294
|
...fieldProps
|
|
286
295
|
})]
|
|
287
296
|
});
|
|
288
|
-
$0[
|
|
289
|
-
$0[
|
|
290
|
-
$0[
|
|
291
|
-
$0[
|
|
292
|
-
$0[
|
|
293
|
-
$0[
|
|
294
|
-
$0[
|
|
295
|
-
$0[
|
|
296
|
-
$0[
|
|
297
|
-
$0[
|
|
298
|
-
$0[
|
|
299
|
-
$0[
|
|
300
|
-
$0[
|
|
301
|
-
$0[
|
|
302
|
-
$0[
|
|
303
|
-
} else
|
|
304
|
-
let
|
|
305
|
-
if ($0[
|
|
306
|
-
|
|
297
|
+
$0[58] = as;
|
|
298
|
+
$0[59] = collapseAfter;
|
|
299
|
+
$0[60] = fieldProps;
|
|
300
|
+
$0[61] = inputClassName;
|
|
301
|
+
$0[62] = isDisabled;
|
|
302
|
+
$0[63] = isSearchable;
|
|
303
|
+
$0[64] = onBlur;
|
|
304
|
+
$0[65] = onKeyDown;
|
|
305
|
+
$0[66] = onRemove;
|
|
306
|
+
$0[67] = placeholder;
|
|
307
|
+
$0[68] = selectInputTagsContentWrapperCva;
|
|
308
|
+
$0[69] = selectedItems;
|
|
309
|
+
$0[70] = selectedTagsType;
|
|
310
|
+
$0[71] = showTags;
|
|
311
|
+
$0[72] = t37;
|
|
312
|
+
} else t37 = $0[72];
|
|
313
|
+
let t38;
|
|
314
|
+
if ($0[73] !== as || $0[74] !== fieldProps || $0[75] !== isDisabled || $0[76] !== isEmpty || $0[77] !== isMultiple || $0[78] !== isOpen || $0[79] !== isSearchable || $0[80] !== onBlur || $0[81] !== onTriggerKeyDown || $0[82] !== placeholder || $0[83] !== selectedItems[0] || $0[84] !== setIsOpen || $0[85] !== showSelectionContent || $0[86] !== showTags) {
|
|
315
|
+
t38 = !isSearchable && /* @__PURE__ */ jsxs(Button, {
|
|
307
316
|
isDisabled,
|
|
308
317
|
onPress: () => setIsOpen(!isOpen),
|
|
309
318
|
onBlur,
|
|
@@ -317,71 +326,71 @@ var SelectInput = (t0) => {
|
|
|
317
326
|
children: [isEmpty && placeholder, !isEmpty && (showSelectionContent ? selectedItems[0].content : selectedItems[0].label)]
|
|
318
327
|
})]
|
|
319
328
|
});
|
|
320
|
-
$0[
|
|
321
|
-
$0[
|
|
322
|
-
$0[
|
|
323
|
-
$0[
|
|
324
|
-
$0[
|
|
325
|
-
$0[
|
|
326
|
-
$0[
|
|
327
|
-
$0[
|
|
328
|
-
$0[
|
|
329
|
-
$0[
|
|
330
|
-
$0[
|
|
331
|
-
$0[
|
|
332
|
-
$0[
|
|
333
|
-
$0[
|
|
334
|
-
$0[
|
|
335
|
-
} else
|
|
336
|
-
let
|
|
337
|
-
if ($0[
|
|
338
|
-
|
|
339
|
-
className:
|
|
329
|
+
$0[73] = as;
|
|
330
|
+
$0[74] = fieldProps;
|
|
331
|
+
$0[75] = isDisabled;
|
|
332
|
+
$0[76] = isEmpty;
|
|
333
|
+
$0[77] = isMultiple;
|
|
334
|
+
$0[78] = isOpen;
|
|
335
|
+
$0[79] = isSearchable;
|
|
336
|
+
$0[80] = onBlur;
|
|
337
|
+
$0[81] = onTriggerKeyDown;
|
|
338
|
+
$0[82] = placeholder;
|
|
339
|
+
$0[83] = selectedItems[0];
|
|
340
|
+
$0[84] = setIsOpen;
|
|
341
|
+
$0[85] = showSelectionContent;
|
|
342
|
+
$0[86] = showTags;
|
|
343
|
+
$0[87] = t38;
|
|
344
|
+
} else t38 = $0[87];
|
|
345
|
+
let t39;
|
|
346
|
+
if ($0[88] !== onClick || $0[89] !== t34 || $0[90] !== t35 || $0[91] !== t36 || $0[92] !== t37 || $0[93] !== t38) {
|
|
347
|
+
t39 = /* @__PURE__ */ jsxs("div", {
|
|
348
|
+
className: t34,
|
|
340
349
|
onClick,
|
|
341
350
|
children: [
|
|
342
|
-
t34,
|
|
343
351
|
t35,
|
|
344
352
|
t36,
|
|
345
|
-
t37
|
|
353
|
+
t37,
|
|
354
|
+
t38
|
|
346
355
|
]
|
|
347
356
|
});
|
|
348
|
-
$0[
|
|
349
|
-
$0[
|
|
350
|
-
$0[
|
|
351
|
-
$0[
|
|
352
|
-
$0[
|
|
353
|
-
$0[
|
|
354
|
-
$0[
|
|
355
|
-
} else
|
|
356
|
-
let
|
|
357
|
-
if ($0[
|
|
358
|
-
|
|
357
|
+
$0[88] = onClick;
|
|
358
|
+
$0[89] = t34;
|
|
359
|
+
$0[90] = t35;
|
|
360
|
+
$0[91] = t36;
|
|
361
|
+
$0[92] = t37;
|
|
362
|
+
$0[93] = t38;
|
|
363
|
+
$0[94] = t39;
|
|
364
|
+
} else t39 = $0[94];
|
|
365
|
+
let t40;
|
|
366
|
+
if ($0[95] !== as || $0[96] !== inputClearClassCva || $0[97] !== isClearable || $0[98] !== isDisabled || $0[99] !== onClear || $0[100] !== showClearButton) {
|
|
367
|
+
t40 = isClearable && !isDisabled && /* @__PURE__ */ jsx(InputClear, {
|
|
359
368
|
onClear: () => {
|
|
360
369
|
onClear();
|
|
361
370
|
},
|
|
362
371
|
className: inputClearClassCva({ as }),
|
|
363
372
|
show: showClearButton
|
|
364
373
|
});
|
|
365
|
-
$0[
|
|
366
|
-
$0[
|
|
367
|
-
$0[
|
|
368
|
-
$0[
|
|
369
|
-
$0[
|
|
370
|
-
$0[
|
|
371
|
-
$0[99] = t39;
|
|
372
|
-
} else t39 = $0[99];
|
|
373
|
-
let t40;
|
|
374
|
-
if ($0[100] !== trailingContent) {
|
|
375
|
-
t40 = trailingContent && /* @__PURE__ */ jsx("div", {
|
|
376
|
-
className: "flex shrink-0 items-center",
|
|
377
|
-
children: trailingContent
|
|
378
|
-
});
|
|
379
|
-
$0[100] = trailingContent;
|
|
374
|
+
$0[95] = as;
|
|
375
|
+
$0[96] = inputClearClassCva;
|
|
376
|
+
$0[97] = isClearable;
|
|
377
|
+
$0[98] = isDisabled;
|
|
378
|
+
$0[99] = onClear;
|
|
379
|
+
$0[100] = showClearButton;
|
|
380
380
|
$0[101] = t40;
|
|
381
381
|
} else t40 = $0[101];
|
|
382
382
|
let t41;
|
|
383
|
-
if ($0[102] !==
|
|
384
|
-
t41 =
|
|
383
|
+
if ($0[102] !== trailingContent) {
|
|
384
|
+
t41 = trailingContent && /* @__PURE__ */ jsx("div", {
|
|
385
|
+
className: "flex shrink-0 items-center",
|
|
386
|
+
children: trailingContent
|
|
387
|
+
});
|
|
388
|
+
$0[102] = trailingContent;
|
|
389
|
+
$0[103] = t41;
|
|
390
|
+
} else t41 = $0[103];
|
|
391
|
+
let t42;
|
|
392
|
+
if ($0[104] !== hideDropdownIcon || $0[105] !== inputSizeCva || $0[106] !== isDisabled || $0[107] !== isOpen || $0[108] !== isSearchable || $0[109] !== setIsOpen || $0[110] !== size || $0[111] !== t) {
|
|
393
|
+
t42 = !hideDropdownIcon && /* @__PURE__ */ jsx(Button, {
|
|
385
394
|
excludeFromTabOrder: true,
|
|
386
395
|
"aria-label": t(($) => isOpen ? $.ui.closeAlt : $.ui.openAlt),
|
|
387
396
|
className: clsx("self-stretch pl-1-5 outline-none", inputSizeCva({ size })),
|
|
@@ -394,19 +403,19 @@ var SelectInput = (t0) => {
|
|
|
394
403
|
"aria-hidden": "true"
|
|
395
404
|
})
|
|
396
405
|
});
|
|
397
|
-
$0[
|
|
398
|
-
$0[
|
|
399
|
-
$0[
|
|
400
|
-
$0[
|
|
401
|
-
$0[
|
|
402
|
-
$0[
|
|
403
|
-
$0[
|
|
404
|
-
$0[
|
|
405
|
-
$0[
|
|
406
|
-
} else
|
|
407
|
-
let
|
|
408
|
-
if ($0[
|
|
409
|
-
|
|
406
|
+
$0[104] = hideDropdownIcon;
|
|
407
|
+
$0[105] = inputSizeCva;
|
|
408
|
+
$0[106] = isDisabled;
|
|
409
|
+
$0[107] = isOpen;
|
|
410
|
+
$0[108] = isSearchable;
|
|
411
|
+
$0[109] = setIsOpen;
|
|
412
|
+
$0[110] = size;
|
|
413
|
+
$0[111] = t;
|
|
414
|
+
$0[112] = t42;
|
|
415
|
+
} else t42 = $0[112];
|
|
416
|
+
let t43;
|
|
417
|
+
if ($0[113] !== focusWithinProps || $0[114] !== hoverProps || $0[115] !== onFocusCapture || $0[116] !== onMouseEnter || $0[117] !== ref || $0[118] !== t16 || $0[119] !== t18 || $0[120] !== t19 || $0[121] !== t20 || $0[122] !== t21 || $0[123] !== t22 || $0[124] !== t23 || $0[125] !== t24 || $0[126] !== t25 || $0[127] !== t26 || $0[128] !== t27 || $0[129] !== t28 || $0[130] !== t29 || $0[131] !== t30 || $0[132] !== t31 || $0[133] !== t33 || $0[134] !== t39 || $0[135] !== t40 || $0[136] !== t41 || $0[137] !== t42) {
|
|
418
|
+
t43 = /* @__PURE__ */ jsxs("div", {
|
|
410
419
|
ref,
|
|
411
420
|
className: t16,
|
|
412
421
|
"data-rac": t17,
|
|
@@ -426,43 +435,45 @@ var SelectInput = (t0) => {
|
|
|
426
435
|
"data-is-dirty": t31,
|
|
427
436
|
"data-select-input": t32,
|
|
428
437
|
onMouseEnter,
|
|
438
|
+
onPointerDownCapture: t33,
|
|
429
439
|
onFocusCapture,
|
|
430
440
|
...hoverProps,
|
|
431
441
|
...focusWithinProps,
|
|
432
442
|
children: [
|
|
433
|
-
t38,
|
|
434
443
|
t39,
|
|
435
444
|
t40,
|
|
436
|
-
t41
|
|
445
|
+
t41,
|
|
446
|
+
t42
|
|
437
447
|
]
|
|
438
448
|
});
|
|
439
|
-
$0[
|
|
440
|
-
$0[
|
|
441
|
-
$0[
|
|
442
|
-
$0[
|
|
443
|
-
$0[
|
|
444
|
-
$0[
|
|
445
|
-
$0[
|
|
446
|
-
$0[
|
|
447
|
-
$0[
|
|
448
|
-
$0[
|
|
449
|
-
$0[
|
|
450
|
-
$0[
|
|
451
|
-
$0[
|
|
452
|
-
$0[
|
|
453
|
-
$0[
|
|
454
|
-
$0[
|
|
455
|
-
$0[
|
|
456
|
-
$0[
|
|
457
|
-
$0[
|
|
458
|
-
$0[
|
|
459
|
-
$0[
|
|
460
|
-
$0[
|
|
461
|
-
$0[
|
|
462
|
-
$0[
|
|
463
|
-
$0[
|
|
464
|
-
|
|
465
|
-
|
|
449
|
+
$0[113] = focusWithinProps;
|
|
450
|
+
$0[114] = hoverProps;
|
|
451
|
+
$0[115] = onFocusCapture;
|
|
452
|
+
$0[116] = onMouseEnter;
|
|
453
|
+
$0[117] = ref;
|
|
454
|
+
$0[118] = t16;
|
|
455
|
+
$0[119] = t18;
|
|
456
|
+
$0[120] = t19;
|
|
457
|
+
$0[121] = t20;
|
|
458
|
+
$0[122] = t21;
|
|
459
|
+
$0[123] = t22;
|
|
460
|
+
$0[124] = t23;
|
|
461
|
+
$0[125] = t24;
|
|
462
|
+
$0[126] = t25;
|
|
463
|
+
$0[127] = t26;
|
|
464
|
+
$0[128] = t27;
|
|
465
|
+
$0[129] = t28;
|
|
466
|
+
$0[130] = t29;
|
|
467
|
+
$0[131] = t30;
|
|
468
|
+
$0[132] = t31;
|
|
469
|
+
$0[133] = t33;
|
|
470
|
+
$0[134] = t39;
|
|
471
|
+
$0[135] = t40;
|
|
472
|
+
$0[136] = t41;
|
|
473
|
+
$0[137] = t42;
|
|
474
|
+
$0[138] = t43;
|
|
475
|
+
} else t43 = $0[138];
|
|
476
|
+
return t43;
|
|
466
477
|
};
|
|
467
478
|
//#endregion
|
|
468
479
|
export { SelectInput };
|
|
@@ -9,6 +9,7 @@ export declare const getSelectionIdsToResolve: <TInitialSelectItem, TKey extends
|
|
|
9
9
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
10
10
|
}) => {
|
|
11
11
|
count: number;
|
|
12
|
+
isResolvedByInitialSelection: boolean;
|
|
12
13
|
items: TKey[];
|
|
13
14
|
};
|
|
14
15
|
export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
|
|
@@ -26,6 +26,7 @@ var getSelectionIdsToResolve = ({ initialSelection, value, mapInitialToSelectIte
|
|
|
26
26
|
const items = Array.from(new Set([...missingLabelInitialSelectionIds, ...values.filter((id) => !labeledInitialSelectionIds.has(id))]));
|
|
27
27
|
return {
|
|
28
28
|
count: items.length,
|
|
29
|
+
isResolvedByInitialSelection: values.length > 0 && values.every((id) => labeledInitialSelectionIds.has(id)),
|
|
29
30
|
items
|
|
30
31
|
};
|
|
31
32
|
};
|
|
@@ -135,16 +135,26 @@ var SelectContext;
|
|
|
135
135
|
triggerBlurOnChange
|
|
136
136
|
]);
|
|
137
137
|
const onClear = useCallback(() => {
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
...
|
|
141
|
-
inputValue: ""
|
|
142
|
-
|
|
138
|
+
if (selectedIds.length === 0) {
|
|
139
|
+
const newFieldState_2 = {
|
|
140
|
+
...fieldState,
|
|
141
|
+
inputValue: "",
|
|
142
|
+
searchValue: ""
|
|
143
|
+
};
|
|
144
|
+
setFieldState(newFieldState_2);
|
|
145
|
+
emitStateChanges(newFieldState_2, true);
|
|
146
|
+
setShowAll(true);
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
if (isMultiple) onChange([]);
|
|
146
150
|
else onChange(null);
|
|
147
|
-
}, [
|
|
151
|
+
}, [
|
|
152
|
+
emitStateChanges,
|
|
153
|
+
fieldState,
|
|
154
|
+
isMultiple,
|
|
155
|
+
onChange,
|
|
156
|
+
selectedIds.length
|
|
157
|
+
]);
|
|
148
158
|
const onSelectAll = useCallback(() => {
|
|
149
159
|
onChange(selectableListItems.map(({ id: id_4 }) => id_4));
|
|
150
160
|
}, [selectableListItems, onChange]);
|
|
@@ -157,13 +167,13 @@ var SelectContext;
|
|
|
157
167
|
]);
|
|
158
168
|
const onBlur = useCallback(() => {
|
|
159
169
|
if (props.isSearchable && isMultiple && fieldState.searchValue !== "") {
|
|
160
|
-
const
|
|
170
|
+
const newFieldState_3 = {
|
|
161
171
|
...fieldState,
|
|
162
172
|
inputValue: "",
|
|
163
173
|
searchValue: ""
|
|
164
174
|
};
|
|
165
|
-
setFieldState(
|
|
166
|
-
emitStateChanges(
|
|
175
|
+
setFieldState(newFieldState_3);
|
|
176
|
+
emitStateChanges(newFieldState_3);
|
|
167
177
|
setShowAll(true);
|
|
168
178
|
}
|
|
169
179
|
fieldOnBlur?.({});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IntlUtils } from "../utils/intl.utils.js";
|
|
1
2
|
import { StringUtils } from "../utils/string.utils.js";
|
|
2
3
|
import { ZodUtils } from "../utils/zod.utils.js";
|
|
3
4
|
import { DateUtils } from "../utils/date.utils.js";
|
|
@@ -11,7 +12,7 @@ var FORMAT_MAP = {
|
|
|
11
12
|
return `${DateUtils.formatDate(new Date(value.start))} - ${DateUtils.formatDate(new Date(value.end))}`;
|
|
12
13
|
},
|
|
13
14
|
enum: (value) => StringUtils.capitalize(value),
|
|
14
|
-
number: (value) =>
|
|
15
|
+
number: (value) => IntlUtils.getNumberFormatter(i18next.language).format(value),
|
|
15
16
|
string: (value) => String(value),
|
|
16
17
|
boolean: (value) => {
|
|
17
18
|
const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
|
package/dist/index.d.ts
CHANGED
|
@@ -253,6 +253,7 @@ export { DateTimeUtils } from './utils/date-time.utils';
|
|
|
253
253
|
export { DomUtils } from './utils/dom.utils';
|
|
254
254
|
export { FileUtils } from './utils/file.utils';
|
|
255
255
|
export { isEqual } from './utils/isEqual';
|
|
256
|
+
export { IntlUtils } from './utils/intl.utils';
|
|
256
257
|
export { logger } from './utils/logger';
|
|
257
258
|
export { ObjectUtils } from './utils/object.utils';
|
|
258
259
|
export { QueriesUtils } from './utils/queries.utils';
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ import { inputBaseDefinition, inputClearClassDefinition, inputContentWrapperDefi
|
|
|
82
82
|
import { CheckboxGroup } from "./components/inputs/Checkbox/CheckboxGroup.js";
|
|
83
83
|
import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
|
|
84
84
|
import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
|
|
85
|
+
import { IntlUtils } from "./utils/intl.utils.js";
|
|
85
86
|
import { DateTimeUtils } from "./utils/date-time.utils.js";
|
|
86
87
|
import { datePickerInputContentRowDefinition } from "./components/inputs/DateTime/shared/datePickerInput.cva.js";
|
|
87
88
|
import { popoverDefinition } from "./components/shared/popover.cva.js";
|
|
@@ -176,4 +177,4 @@ import { useSorting } from "./hooks/useSorting.js";
|
|
|
176
177
|
import { useTableColumnConfig } from "./hooks/useTableColumnConfig.js";
|
|
177
178
|
import { ArrayUtils } from "./utils/array.utils.js";
|
|
178
179
|
import { QueriesUtils } from "./utils/queries.utils.js";
|
|
179
|
-
export { Accordion, ActionModal, Alert, AlignCenterIcon, AlignLeftIcon, AlignLeftRightIcon, AlignRightIcon, ArrayUtils, ArrowDropDownIcon, ArrowDropUpIcon, ArrowLeftIcon, ArrowRightIcon, Autocomplete, BoldIcon, BottomSheet, Breadcrumbs, BulletedListIcon, Button, CalendarIcon, CellText, CheckIcon, Checkbox, CheckboxCheckmarkIcon, CheckboxGroup, CheckboxIndeterminateIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ClockIcon, CloseIcon, ColumnConfigModal, Confirmation, DatePicker, DateRangePicker, DateTimeIcon, DateTimePicker, DateTimeUtils, DateUtils, DomUtils, Drawer, FileUpload, FileUploadContainer, FileUtils, Form, FormField, HeaderText, HighlightIcon, HighlightOnIcon, HomeIcon, IconButton, InfiniteTable, InfoIcon, InlineIconButton, InputUpload, Inputs, ItalicIcon, Link, LinkContext, LinkIcon, Loader, Menu, MenuIcon, MenuItem, MenuPopover, Modal, NumberInput, NumberRangeInput, NumberedListIcon, ObjectUtils, PaginatedTable, Pagination, PaginationList, PasswordInput, Pill, PillButton, PointerHorizontalIcon, PointerVerticalIcon, ProgressBar, QueriesUtils, QueryAutocomplete, QuerySelect, RadioGroup, ResponsivePopover, RestUtils, RoutingUtils, Segment, Select, SendIcon, Slider, SplitButton, Stepper, StrikethroughIcon, StringUtils, Table, Tag, TextArea, TextButton, TextColorIcon, TextInput, ThemeContext, TimePicker, Toast, ToastContainer, Toggle, ToggleButton, Tooltip, TooltipEllipsis, Typography, UIConfig, UIOverrides, UIRouter, UnderlinedIcon, VisibilityIcon, VisibilityOffIcon, ZodUtils, accordionChevronDefinition, accordionDefinition, accordionHeadingDefinition, accordionHeadingSubtitleDefinition, accordionHeadingTitleDefinition, accordionIconDefinition, accordionItemDefinition, accordionPanelContentDefinition, accordionPanelDefinition, accordionTriggerDefinition, alertDefinition, breadcrumbChevronDefinition, breadcrumbIconDefinition, breadcrumbItemDefinition, breadcrumbSegmentDefinition, breadcrumbsDefinition, buttonContentDefinition, buttonDefinition, buttonIconSizeDefinition, buttonSizeDefinition, checkboxContentRowDefinition, checkboxContentWrapperDefinition, checkboxDefinition, checkboxGroupLabelDefinition, checkboxIconDefinition, compoundMapper, createKeyInteractionsHandler, datePickerInputContentRowDefinition, dynamicColumns, dynamicInputs, fileUploadDropZoneDefinition, formFieldErrorDefinition, formFieldHeaderDefinition, formFieldHelperDefinition, getKeyInteractionAction, inputBaseDefinition, inputClearClassDefinition, inputContentWrapperDefinition, inputSideDefinition, inputSizeDefinition, inputUploadButtonDefinition, inputUploadDropZoneDefinition, isEqual, labelDefinition, linkDefinition, loaderDefinition, loaderWrapperDefinition, logger, menuDefinition, menuItemDefinition, menuPopoverDefinition, menuPopoverWrapperDefinition, modalContentDefinition, modalMainDefinition, modalOverlayDefinition, ns, pillButtonContentDefinition, pillButtonDefinition, popoverDefinition, progressBarDefinition, progressBarFillDefinition, progressBarTrackDefinition, progressBarTrackWrapperDefinition, progressBarValueDefinition, radioContentRowDefinition, radioContentWrapperDefinition, radioDefinition, resources, segmentDefinition, segmentItemDefinition, selectInputTagsContentWrapperDefinition, selectListBoxItemDefinition, selectPopoverDefinition, statusIconDefinition, statusSeparatorDefinition, stepperDefinition, stepperIconDefinition, stepperItemDefinition, stepperNumberDefinition, stepperSeparatorDefinition, stepperSubtextDefinition, stepperTitleDefinition, tableCellTextDefinition, tableDataDefinition, tableHeadDataDefinition, tableHeadRowDefinition, tableHeaderTextDefinition, tableRowDefinition, tagDefinition, textAreaWrapperDefinition, toastDefinition, statusIconDefinition$1 as toastStatusIconDefinition, statusSeparatorDefinition$1 as toastStatusSeparatorDefinition, toggleDefinition, tooltipDefinition, tooltipPointerHorizontalDefinition, tooltipPointerVerticalDefinition, tooltipTextDefinition, tooltipWrapperTriggerDefinition, typographyDefinition, uiOutlineClass, useAutosave, useBreakpoint, useDebounceCallback, useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo, useFilters, useForm, useFormAutosave, useIntersectionObserver, useKeyInteractions, useLocalStorage, useLongPressRepeat, usePagination, useScrollableListBox, useSorting, useStateAndRef, useTableColumnConfig, useTableNav, useToast, useTranslationMemo };
|
|
180
|
+
export { Accordion, ActionModal, Alert, AlignCenterIcon, AlignLeftIcon, AlignLeftRightIcon, AlignRightIcon, ArrayUtils, ArrowDropDownIcon, ArrowDropUpIcon, ArrowLeftIcon, ArrowRightIcon, Autocomplete, BoldIcon, BottomSheet, Breadcrumbs, BulletedListIcon, Button, CalendarIcon, CellText, CheckIcon, Checkbox, CheckboxCheckmarkIcon, CheckboxGroup, CheckboxIndeterminateIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ClockIcon, CloseIcon, ColumnConfigModal, Confirmation, DatePicker, DateRangePicker, DateTimeIcon, DateTimePicker, DateTimeUtils, DateUtils, DomUtils, Drawer, FileUpload, FileUploadContainer, FileUtils, Form, FormField, HeaderText, HighlightIcon, HighlightOnIcon, HomeIcon, IconButton, InfiniteTable, InfoIcon, InlineIconButton, InputUpload, Inputs, IntlUtils, ItalicIcon, Link, LinkContext, LinkIcon, Loader, Menu, MenuIcon, MenuItem, MenuPopover, Modal, NumberInput, NumberRangeInput, NumberedListIcon, ObjectUtils, PaginatedTable, Pagination, PaginationList, PasswordInput, Pill, PillButton, PointerHorizontalIcon, PointerVerticalIcon, ProgressBar, QueriesUtils, QueryAutocomplete, QuerySelect, RadioGroup, ResponsivePopover, RestUtils, RoutingUtils, Segment, Select, SendIcon, Slider, SplitButton, Stepper, StrikethroughIcon, StringUtils, Table, Tag, TextArea, TextButton, TextColorIcon, TextInput, ThemeContext, TimePicker, Toast, ToastContainer, Toggle, ToggleButton, Tooltip, TooltipEllipsis, Typography, UIConfig, UIOverrides, UIRouter, UnderlinedIcon, VisibilityIcon, VisibilityOffIcon, ZodUtils, accordionChevronDefinition, accordionDefinition, accordionHeadingDefinition, accordionHeadingSubtitleDefinition, accordionHeadingTitleDefinition, accordionIconDefinition, accordionItemDefinition, accordionPanelContentDefinition, accordionPanelDefinition, accordionTriggerDefinition, alertDefinition, breadcrumbChevronDefinition, breadcrumbIconDefinition, breadcrumbItemDefinition, breadcrumbSegmentDefinition, breadcrumbsDefinition, buttonContentDefinition, buttonDefinition, buttonIconSizeDefinition, buttonSizeDefinition, checkboxContentRowDefinition, checkboxContentWrapperDefinition, checkboxDefinition, checkboxGroupLabelDefinition, checkboxIconDefinition, compoundMapper, createKeyInteractionsHandler, datePickerInputContentRowDefinition, dynamicColumns, dynamicInputs, fileUploadDropZoneDefinition, formFieldErrorDefinition, formFieldHeaderDefinition, formFieldHelperDefinition, getKeyInteractionAction, inputBaseDefinition, inputClearClassDefinition, inputContentWrapperDefinition, inputSideDefinition, inputSizeDefinition, inputUploadButtonDefinition, inputUploadDropZoneDefinition, isEqual, labelDefinition, linkDefinition, loaderDefinition, loaderWrapperDefinition, logger, menuDefinition, menuItemDefinition, menuPopoverDefinition, menuPopoverWrapperDefinition, modalContentDefinition, modalMainDefinition, modalOverlayDefinition, ns, pillButtonContentDefinition, pillButtonDefinition, popoverDefinition, progressBarDefinition, progressBarFillDefinition, progressBarTrackDefinition, progressBarTrackWrapperDefinition, progressBarValueDefinition, radioContentRowDefinition, radioContentWrapperDefinition, radioDefinition, resources, segmentDefinition, segmentItemDefinition, selectInputTagsContentWrapperDefinition, selectListBoxItemDefinition, selectPopoverDefinition, statusIconDefinition, statusSeparatorDefinition, stepperDefinition, stepperIconDefinition, stepperItemDefinition, stepperNumberDefinition, stepperSeparatorDefinition, stepperSubtextDefinition, stepperTitleDefinition, tableCellTextDefinition, tableDataDefinition, tableHeadDataDefinition, tableHeadRowDefinition, tableHeaderTextDefinition, tableRowDefinition, tagDefinition, textAreaWrapperDefinition, toastDefinition, statusIconDefinition$1 as toastStatusIconDefinition, statusSeparatorDefinition$1 as toastStatusSeparatorDefinition, toggleDefinition, tooltipDefinition, tooltipPointerHorizontalDefinition, tooltipPointerVerticalDefinition, tooltipTextDefinition, tooltipWrapperTriggerDefinition, typographyDefinition, uiOutlineClass, useAutosave, useBreakpoint, useDebounceCallback, useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo, useFilters, useForm, useFormAutosave, useIntersectionObserver, useKeyInteractions, useLocalStorage, useLongPressRepeat, usePagination, useScrollableListBox, useSorting, useStateAndRef, useTableColumnConfig, useTableNav, useToast, useTranslationMemo };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IntlUtils } from "./intl.utils.js";
|
|
1
2
|
import { CalendarDate, CalendarDateTime, DateFormatter, fromDate, getLocalTimeZone, parseAbsolute } from "@internationalized/date";
|
|
2
3
|
import { DateTime } from "luxon";
|
|
3
4
|
//#region src/utils/date-time.utils.ts
|
|
@@ -5,33 +6,42 @@ var DateTimeUtils;
|
|
|
5
6
|
(function(_DateTimeUtils) {
|
|
6
7
|
const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
|
|
7
8
|
const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 6, 45));
|
|
9
|
+
const timeFormatters = /* @__PURE__ */ new Map();
|
|
8
10
|
const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
|
|
9
11
|
const getTimeHourFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
|
|
10
|
-
const getDatePlaceholderFormatter = (locale, options) =>
|
|
12
|
+
const getDatePlaceholderFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(locale, {
|
|
11
13
|
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
12
14
|
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
13
15
|
year: "numeric"
|
|
14
16
|
});
|
|
15
|
-
const getTimePlaceholderFormatter = (locale) =>
|
|
17
|
+
const getTimePlaceholderFormatter = (locale) => IntlUtils.getDateTimeFormatter(locale, {
|
|
16
18
|
hour: "2-digit",
|
|
17
19
|
minute: "2-digit"
|
|
18
20
|
});
|
|
19
21
|
const getResolvedLocale = (locale) => {
|
|
20
22
|
if (locale) return locale;
|
|
21
|
-
return
|
|
23
|
+
return IntlUtils.getDateTimeFormatter().resolvedOptions().locale;
|
|
22
24
|
};
|
|
23
|
-
const getDateFormatter = (locale, options) =>
|
|
25
|
+
const getDateFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(getResolvedLocale(locale), {
|
|
24
26
|
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
25
27
|
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
26
28
|
year: "numeric",
|
|
27
29
|
timeZone: "UTC"
|
|
28
30
|
});
|
|
29
|
-
const getTimeFormatter = (locale, options) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const getTimeFormatter = (locale, options) => {
|
|
32
|
+
const resolvedLocale = getResolvedLocale(locale);
|
|
33
|
+
const key = `${resolvedLocale}|${options?.shouldForceLeadingZeros ?? false}`;
|
|
34
|
+
const cachedFormatter = timeFormatters.get(key);
|
|
35
|
+
if (cachedFormatter) return cachedFormatter;
|
|
36
|
+
const formatter = new DateFormatter(resolvedLocale, {
|
|
37
|
+
hour: getTimeHourFormat(options?.shouldForceLeadingZeros),
|
|
38
|
+
minute: "2-digit",
|
|
39
|
+
timeZone: "UTC"
|
|
40
|
+
});
|
|
41
|
+
timeFormatters.set(key, formatter);
|
|
42
|
+
return formatter;
|
|
43
|
+
};
|
|
44
|
+
const getDateTimeFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(getResolvedLocale(locale), {
|
|
35
45
|
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
36
46
|
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
37
47
|
year: "numeric",
|
|
@@ -40,7 +50,7 @@ var DateTimeUtils;
|
|
|
40
50
|
timeZone: "UTC"
|
|
41
51
|
});
|
|
42
52
|
const repeatLocalizedFieldLabel = (type, length, locale) => {
|
|
43
|
-
const placeholderChar =
|
|
53
|
+
const placeholderChar = IntlUtils.getDisplayNamesFormatter(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
|
|
44
54
|
if (!placeholderChar) return null;
|
|
45
55
|
return placeholderChar.repeat(length);
|
|
46
56
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type IntlLocale = Intl.LocalesArgument;
|
|
2
|
+
export declare namespace IntlUtils {
|
|
3
|
+
const getDateTimeFormatter: (locale?: IntlLocale, options?: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
4
|
+
const getDisplayNamesFormatter: (locale: IntlLocale, options: Intl.DisplayNamesOptions) => Intl.DisplayNames;
|
|
5
|
+
const getNumberFormatter: (locale?: IntlLocale, options?: Intl.NumberFormatOptions) => Intl.NumberFormat;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/utils/intl.utils.ts
|
|
2
|
+
var formatterCacheKey = (locale, options) => {
|
|
3
|
+
const locales = Array.isArray(locale) ? locale.map(String) : locale ? [String(locale)] : [];
|
|
4
|
+
const normalizedOptions = Object.entries(options ?? {}).sort(([left], [right]) => left.localeCompare(right));
|
|
5
|
+
return JSON.stringify([locales, normalizedOptions]);
|
|
6
|
+
};
|
|
7
|
+
var IntlUtils;
|
|
8
|
+
(function(_IntlUtils) {
|
|
9
|
+
const dateTimeFormatters = /* @__PURE__ */ new Map();
|
|
10
|
+
const displayNamesFormatters = /* @__PURE__ */ new Map();
|
|
11
|
+
const numberFormatters = /* @__PURE__ */ new Map();
|
|
12
|
+
_IntlUtils.getDateTimeFormatter = (locale, options) => {
|
|
13
|
+
const key = formatterCacheKey(locale, options);
|
|
14
|
+
const cachedFormatter = dateTimeFormatters.get(key);
|
|
15
|
+
if (cachedFormatter) return cachedFormatter;
|
|
16
|
+
const formatter = new Intl.DateTimeFormat(locale, options);
|
|
17
|
+
dateTimeFormatters.set(key, formatter);
|
|
18
|
+
return formatter;
|
|
19
|
+
};
|
|
20
|
+
_IntlUtils.getDisplayNamesFormatter = (locale, options) => {
|
|
21
|
+
const key = formatterCacheKey(locale, options);
|
|
22
|
+
const cachedFormatter = displayNamesFormatters.get(key);
|
|
23
|
+
if (cachedFormatter) return cachedFormatter;
|
|
24
|
+
const formatter = new Intl.DisplayNames(locale, options);
|
|
25
|
+
displayNamesFormatters.set(key, formatter);
|
|
26
|
+
return formatter;
|
|
27
|
+
};
|
|
28
|
+
_IntlUtils.getNumberFormatter = (locale, options) => {
|
|
29
|
+
const key = formatterCacheKey(locale, options);
|
|
30
|
+
const cachedFormatter = numberFormatters.get(key);
|
|
31
|
+
if (cachedFormatter) return cachedFormatter;
|
|
32
|
+
const formatter = new Intl.NumberFormat(locale, options);
|
|
33
|
+
numberFormatters.set(key, formatter);
|
|
34
|
+
return formatter;
|
|
35
|
+
};
|
|
36
|
+
})(IntlUtils || (IntlUtils = {}));
|
|
37
|
+
//#endregion
|
|
38
|
+
export { IntlUtils };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED