@povio/ui 3.3.0-rc.3 → 3.3.0

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.
Files changed (84) hide show
  1. package/README.md +15 -1
  2. package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
  3. package/dist/components/buttons/Button/button.cva.d.ts +1 -1
  4. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  5. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  6. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  7. package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +5 -1
  8. package/dist/components/inputs/Checkbox/CheckboxGroup.js +234 -201
  9. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +93 -227
  10. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  11. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +170 -273
  12. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +60 -147
  13. package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
  14. package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
  15. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
  16. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
  17. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
  18. package/dist/components/inputs/DateTime/shared/DateField.js +135 -301
  19. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +142 -338
  20. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  21. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +144 -134
  22. package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +2 -0
  23. package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +33 -0
  24. package/dist/components/inputs/File/FileUpload.js +1 -1
  25. package/dist/components/inputs/File/InputUpload.js +65 -261
  26. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
  27. package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
  28. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
  29. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
  30. package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
  31. package/dist/components/inputs/FormField/FormField.js +34 -47
  32. package/dist/components/inputs/Input/NumberInput/NumberInput.js +2 -1
  33. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +77 -314
  34. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +23 -83
  35. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +56 -2
  36. package/dist/components/inputs/Selection/Select/QuerySelect.js +82 -94
  37. package/dist/components/inputs/Selection/Select/Select.js +3 -3
  38. package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
  39. package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
  40. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
  41. package/dist/components/inputs/Selection/shared/querySelect.utils.js +1 -0
  42. package/dist/components/inputs/Selection/shared/select.context.js +19 -9
  43. package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
  44. package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
  45. package/dist/components/inputs/TextEditor/TextEditor.js +87 -389
  46. package/dist/components/inputs/shared/InputClear.js +24 -40
  47. package/dist/components/inputs/shared/input.cva.js +1 -1
  48. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  49. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  50. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  51. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  52. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
  53. package/dist/components/shared/pagination/Pagination.js +22 -108
  54. package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
  55. package/dist/components/status/Alert/Alert.js +30 -97
  56. package/dist/components/table/InfiniteTable.js +16 -67
  57. package/dist/components/table/Table.d.ts +2 -8
  58. package/dist/components/table/Table.js +33 -55
  59. package/dist/components/text/Typography/Typography.js +8 -23
  60. package/dist/config/confirmation.context.js +1 -1
  61. package/dist/config/theme.context.js +45 -98
  62. package/dist/config/uiConfig.context.d.ts +1 -0
  63. package/dist/config/uiConfig.context.js +10 -40
  64. package/dist/config/uiOverrides.context.d.ts +0 -1
  65. package/dist/helpers/dynamicColumns.js +2 -1
  66. package/dist/hooks/useDebounceCallback.js +17 -51
  67. package/dist/hooks/useFormAutosave.js +33 -120
  68. package/dist/hooks/useLongPressRepeat.js +20 -55
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.js +2 -2
  71. package/dist/utils/date-time.utils.d.ts +0 -1
  72. package/dist/utils/date-time.utils.js +21 -45
  73. package/dist/utils/intl.utils.d.ts +7 -0
  74. package/dist/utils/intl.utils.js +38 -0
  75. package/dist/utils/intl.utils.spec.d.ts +1 -0
  76. package/package.json +2 -2
  77. package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
  78. package/dist/components/inputs/FormField/formField.cva.js +0 -16
  79. package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
  80. package/dist/components/table/TableColumnFilterInput.js +0 -108
  81. package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
  82. package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
  83. package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
  84. package/dist/components/table/TableColumnFilterRow.js +0 -68
@@ -13,7 +13,6 @@ import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
13
  import { InputFrame } from "../../Skeleton/InputFrame.js";
14
14
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
15
15
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
16
- import { c } from "react/compiler-runtime";
17
16
  import { jsx, jsxs } from "react/jsx-runtime";
18
17
  import { clsx } from "clsx";
19
18
  import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -157,24 +156,25 @@ var DateTimePickerBase = (props) => {
157
156
  dialogState.setValue(null);
158
157
  if (fireBlurOnChange) handleBlur(null);
159
158
  };
160
- const onOpenChange = (isOpen) => {
161
- state.toggle();
162
- calendarState.setFocusedDate(state.value || today(effectiveTimeZone));
163
- if (!isOpen) dialogState.setValue(state.value);
164
- };
165
- const onInputBlur = (e) => {
166
- if (!isTimeOptional) return;
159
+ const syncDialogFromControlledValue = () => {
160
+ dialogState.setValue(state.value);
167
161
  if (state.value) {
168
- dialogState.setValue(state.value);
162
+ calendarState.setFocusedDate(state.value);
169
163
  return;
170
164
  }
171
- const textValue = e?.currentTarget?.textContent ?? null;
172
- const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
173
- if (dateTimeValue) {
174
- state.setValue(dateTimeValue);
175
- dialogState.setValue(dateTimeValue);
176
- dialogState.setTimeValue(new Time(0, 0));
177
- }
165
+ calendarState.setFocusedDate(today(effectiveTimeZone));
166
+ };
167
+ useEffect(() => {
168
+ if (!state.isOpen) return;
169
+ syncDialogFromControlledValue();
170
+ }, [state.isOpen]);
171
+ const onOpenChange = (_isOpen) => {
172
+ state.toggle();
173
+ syncDialogFromControlledValue();
174
+ };
175
+ const onOpenDropdown = () => {
176
+ syncDialogFromControlledValue();
177
+ state.toggle();
178
178
  };
179
179
  return /* @__PURE__ */ jsx(TooltipWrapper, {
180
180
  as,
@@ -192,10 +192,9 @@ var DateTimePickerBase = (props) => {
192
192
  groupProps,
193
193
  fieldProps: {
194
194
  ...fieldProps,
195
- onBlur: (e_0) => {
196
- fieldProps.onBlur?.(e_0);
195
+ onBlur: (e) => {
196
+ fieldProps.onBlur?.(e);
197
197
  handleBlur(state.value);
198
- onInputBlur(e_0);
199
198
  }
200
199
  },
201
200
  fieldValue: normalizedValue,
@@ -220,7 +219,7 @@ var DateTimePickerBase = (props) => {
220
219
  disableManualEntry,
221
220
  autoFixYear,
222
221
  placeholder,
223
- onOpenDropdown: () => state.toggle(),
222
+ onOpenDropdown,
224
223
  className: inputClassName,
225
224
  timeZone: effectiveTimeZone,
226
225
  isTimeOptional,
@@ -254,9 +253,7 @@ var DateTimePickerBase = (props) => {
254
253
  })
255
254
  });
256
255
  };
257
- var DateTimePickerInner = (t0) => {
258
- const $ = c(9);
259
- const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
256
+ var DateTimePickerInner = ({ fullIso: _fullIso = true, renderStaticInput, isFormControlDisabled, ...props }) => {
260
257
  const ui = UIConfig.useConfig();
261
258
  const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
262
259
  const { locale } = useLocale();
@@ -267,8 +264,15 @@ var DateTimePickerInner = (t0) => {
267
264
  inputRef,
268
265
  renderInput,
269
266
  setRenderInput,
270
- getFocusTarget: _temp,
271
- getPressTarget: _temp2
267
+ getFocusTarget: (input, staticTarget) => {
268
+ const container = input.getContainer?.() ?? input;
269
+ return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
270
+ },
271
+ getPressTarget: (input_0) => {
272
+ const container_0 = input_0.getContainer?.() ?? input_0;
273
+ if (!(container_0 instanceof HTMLElement)) return null;
274
+ return container_0.querySelector("[data-static-press-action]");
275
+ }
272
276
  });
273
277
  const normalizedValue = props.value ?? null;
274
278
  const timeZone = props.timeZone ?? ui.dateInput.timeZone;
@@ -338,137 +342,46 @@ var DateTimePickerInner = (t0) => {
338
342
  trailingClassName: "py-0! pl-0!",
339
343
  action: showDropdown ? {
340
344
  icon: ui.dateInput.dateTimeIcon,
341
- onClick: _temp3,
345
+ onClick: () => {},
342
346
  altText: ""
343
347
  } : void 0,
344
348
  children: staticSegments
345
349
  });
346
350
  }
347
- const T0 = DateTimePickerBase;
348
- const t2 = mergeRefs(props.ref, inputRef);
349
- const t3 = parseDateValue(normalizedValue);
350
- let t4;
351
- if ($[0] !== formatDateValue || $[1] !== props) {
352
- t4 = (value) => props.onChange?.(formatDateValue(value));
353
- $[0] = formatDateValue;
354
- $[1] = props;
355
- $[2] = t4;
356
- } else t4 = $[2];
357
- let t5;
358
- if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
359
- t5 = /* @__PURE__ */ jsx(T0, {
360
- ...props,
361
- ref: t2,
362
- value: t3,
363
- onChange: t4
364
- });
365
- $[3] = T0;
366
- $[4] = props;
367
- $[5] = t2;
368
- $[6] = t3;
369
- $[7] = t4;
370
- $[8] = t5;
371
- } else t5 = $[8];
372
- return t5;
351
+ return /* @__PURE__ */ jsx(DateTimePickerBase, {
352
+ ...props,
353
+ ref: mergeRefs(props.ref, inputRef),
354
+ value: parseDateValue(normalizedValue),
355
+ onChange: (value) => props.onChange?.(formatDateValue(value))
356
+ });
373
357
  };
374
- var DateTimePicker = (t0) => {
375
- const $ = c(24);
376
- let props;
377
- let renderStaticInput;
378
- let t1;
379
- if ($[0] !== t0) {
380
- ({fullIso: t1, renderStaticInput, ...props} = t0);
381
- $[0] = t0;
382
- $[1] = props;
383
- $[2] = renderStaticInput;
384
- $[3] = t1;
385
- } else {
386
- props = $[1];
387
- renderStaticInput = $[2];
388
- t1 = $[3];
389
- }
390
- const fullIso = t1 === void 0 ? true : t1;
358
+ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
391
359
  if ("formControl" in props && props.formControl) {
392
- let formControl;
393
- let innerProps;
394
- let ref;
395
- if ($[4] !== props) {
396
- ({formControl, ref, ...innerProps} = props);
397
- $[4] = props;
398
- $[5] = formControl;
399
- $[6] = innerProps;
400
- $[7] = ref;
401
- } else {
402
- formControl = $[5];
403
- innerProps = $[6];
404
- ref = $[7];
405
- }
360
+ const { formControl, ref, ...innerProps } = props;
406
361
  const controlWithOptions = formControl.control;
407
- let t2;
408
- if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
409
- t2 = (t3) => {
410
- const { field, fieldState: t4 } = t3;
411
- const { error, isDirty } = t4;
412
- return /* @__PURE__ */ jsx(DateTimePickerInner, {
413
- ...innerProps,
414
- ref: mergeRefs(ref, field.ref),
415
- value: field.value ?? null,
416
- onChange: field.onChange,
417
- onBlur: field.onBlur,
418
- isDirty,
419
- isDisabled: field.disabled || props.isDisabled,
420
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
421
- error: props.error ?? error?.message,
422
- fullIso,
423
- renderStaticInput
424
- });
425
- };
426
- $[8] = controlWithOptions._options?.disabled;
427
- $[9] = fullIso;
428
- $[10] = innerProps;
429
- $[11] = props.error;
430
- $[12] = props.isDisabled;
431
- $[13] = ref;
432
- $[14] = renderStaticInput;
433
- $[15] = t2;
434
- } else t2 = $[15];
435
- let t3;
436
- if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
437
- t3 = /* @__PURE__ */ jsx(Controller, {
438
- control: formControl.control,
439
- name: formControl.name,
440
- render: t2
441
- });
442
- $[16] = formControl.control;
443
- $[17] = formControl.name;
444
- $[18] = t2;
445
- $[19] = t3;
446
- } else t3 = $[19];
447
- return t3;
448
- }
449
- let t2;
450
- if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
451
- t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
452
- ...props,
453
- fullIso,
454
- renderStaticInput
362
+ return /* @__PURE__ */ jsx(Controller, {
363
+ control: formControl.control,
364
+ name: formControl.name,
365
+ render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerInner, {
366
+ ...innerProps,
367
+ ref: mergeRefs(ref, field.ref),
368
+ value: field.value ?? null,
369
+ onChange: field.onChange,
370
+ onBlur: field.onBlur,
371
+ isDirty,
372
+ isDisabled: field.disabled || props.isDisabled,
373
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
374
+ error: props.error ?? error?.message,
375
+ fullIso,
376
+ renderStaticInput
377
+ })
455
378
  });
456
- $[20] = fullIso;
457
- $[21] = props;
458
- $[22] = renderStaticInput;
459
- $[23] = t2;
460
- } else t2 = $[23];
461
- return t2;
379
+ }
380
+ return /* @__PURE__ */ jsx(DateTimePickerInner, {
381
+ ...props,
382
+ fullIso,
383
+ renderStaticInput
384
+ });
462
385
  };
463
- function _temp(input, staticTarget) {
464
- const container = input.getContainer?.() ?? input;
465
- return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
466
- }
467
- function _temp2(input_0) {
468
- const container_0 = input_0.getContainer?.() ?? input_0;
469
- if (!(container_0 instanceof HTMLElement)) return null;
470
- return container_0.querySelector("[data-static-press-action]");
471
- }
472
- function _temp3() {}
473
386
  //#endregion
474
387
  export { DateTimePicker };