@povio/ui 2.3.0-rc.1 → 2.3.0-rc.10

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 (206) hide show
  1. package/dist/assets/icons/AlignCenter.js +26 -11
  2. package/dist/assets/icons/AlignLeft.js +26 -11
  3. package/dist/assets/icons/AlignLeftRight.js +26 -11
  4. package/dist/assets/icons/AlignRight.js +26 -11
  5. package/dist/assets/icons/ArrowDropDown.js +26 -11
  6. package/dist/assets/icons/ArrowDropUp.js +26 -11
  7. package/dist/assets/icons/ArrowLeft.js +26 -11
  8. package/dist/assets/icons/ArrowRight.js +26 -11
  9. package/dist/assets/icons/Bold.js +26 -11
  10. package/dist/assets/icons/BulletedList.js +26 -11
  11. package/dist/assets/icons/Calendar.js +28 -13
  12. package/dist/assets/icons/Check.js +28 -13
  13. package/dist/assets/icons/CheckCircle.js +26 -11
  14. package/dist/assets/icons/CheckboxCheckmark.js +29 -14
  15. package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
  16. package/dist/assets/icons/ChevronDown.js +28 -13
  17. package/dist/assets/icons/ChevronLeft.js +28 -13
  18. package/dist/assets/icons/ChevronRight.js +28 -13
  19. package/dist/assets/icons/ChevronUp.js +28 -13
  20. package/dist/assets/icons/ChevronsLeft.js +28 -13
  21. package/dist/assets/icons/ChevronsRight.js +28 -13
  22. package/dist/assets/icons/Clock.js +26 -11
  23. package/dist/assets/icons/Close.js +26 -11
  24. package/dist/assets/icons/DateTime.js +35 -14
  25. package/dist/assets/icons/DragIndicator.js +26 -11
  26. package/dist/assets/icons/File.js +28 -13
  27. package/dist/assets/icons/Highlight.js +26 -11
  28. package/dist/assets/icons/HighlightOn.js +49 -15
  29. package/dist/assets/icons/Home.js +26 -11
  30. package/dist/assets/icons/Info.js +37 -16
  31. package/dist/assets/icons/Italic.js +26 -11
  32. package/dist/assets/icons/Link.js +26 -11
  33. package/dist/assets/icons/Menu.js +26 -11
  34. package/dist/assets/icons/NumberedList.js +26 -11
  35. package/dist/assets/icons/PointerHorizontal.js +26 -11
  36. package/dist/assets/icons/PointerVertical.js +26 -11
  37. package/dist/assets/icons/Search.js +26 -11
  38. package/dist/assets/icons/Send.js +28 -13
  39. package/dist/assets/icons/Strikethrough.js +26 -11
  40. package/dist/assets/icons/TextColor.js +48 -14
  41. package/dist/assets/icons/Today.js +26 -11
  42. package/dist/assets/icons/Underlined.js +28 -13
  43. package/dist/assets/icons/Upload.js +35 -14
  44. package/dist/assets/icons/Visibility.js +26 -11
  45. package/dist/assets/icons/VisibilityOff.js +26 -11
  46. package/dist/assets/icons/WarningFilled.js +28 -13
  47. package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
  48. package/dist/components/Menu/Menu.js +18 -2
  49. package/dist/components/Menu/MenuDesktop.js +41 -7
  50. package/dist/components/Menu/MenuItem.js +32 -9
  51. package/dist/components/Menu/MenuMobile.js +97 -38
  52. package/dist/components/Menu/MenuPopover.js +105 -29
  53. package/dist/components/buttons/IconButton/IconButton.js +40 -8
  54. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
  55. package/dist/components/buttons/PillButton/PillButton.js +55 -17
  56. package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
  57. package/dist/components/buttons/TextButton/TextButton.js +30 -8
  58. package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
  59. package/dist/components/buttons/shared/ButtonContent.js +80 -22
  60. package/dist/components/inputs/Checkbox/Checkbox.js +166 -34
  61. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  62. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +35 -14
  63. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +125 -109
  64. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +33 -15
  65. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +391 -117
  66. package/dist/components/inputs/DateTime/shared/Calendar.js +331 -137
  67. package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
  68. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -33
  69. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +249 -93
  70. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  71. package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
  72. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +345 -142
  73. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
  74. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  75. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  76. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  77. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  78. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  79. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  80. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +205 -70
  81. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  82. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +4 -8
  83. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +8 -8
  84. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
  85. package/dist/components/inputs/File/FileUpload.js +86 -44
  86. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  87. package/dist/components/inputs/File/InputUpload.js +317 -79
  88. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  89. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  90. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  91. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  92. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  93. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  94. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  95. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  96. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  97. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  98. package/dist/components/inputs/FormField/FormField.js +119 -37
  99. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  100. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  101. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  102. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  103. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  104. package/dist/components/inputs/Input/NumberInput/NumberInput.js +261 -84
  105. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  106. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +321 -77
  107. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  108. package/dist/components/inputs/Input/TextArea/TextArea.js +303 -90
  109. package/dist/components/inputs/Input/TextInput/TextInput.js +250 -84
  110. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  111. package/dist/components/inputs/Inputs/Form.js +40 -11
  112. package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
  113. package/dist/components/inputs/Inputs/InputItem.js +65 -16
  114. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  115. package/dist/components/inputs/RadioGroup/RadioGroup.js +317 -106
  116. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +11 -4
  117. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
  118. package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
  119. package/dist/components/inputs/Selection/Select/Select.js +24 -7
  120. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  121. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  122. package/dist/components/inputs/Selection/shared/SelectInput.js +335 -136
  123. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  124. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  125. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  126. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  127. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  128. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  129. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  130. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  131. package/dist/components/inputs/Selection/shared/select.context.js +35 -35
  132. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  133. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  134. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  135. package/dist/components/inputs/Skeleton/InputFrame.d.ts +2 -0
  136. package/dist/components/inputs/Skeleton/InputFrame.js +442 -116
  137. package/dist/components/inputs/Slider/Slider.js +250 -74
  138. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  139. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  140. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  141. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  142. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  143. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  144. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  145. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  146. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  147. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  148. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  149. package/dist/components/inputs/Toggle/Toggle.js +187 -40
  150. package/dist/components/inputs/shared/CheckContent.js +21 -10
  151. package/dist/components/inputs/shared/InputClear.js +78 -21
  152. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  153. package/dist/components/inputs/shared/input.cva.js +13 -3
  154. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
  155. package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
  156. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  157. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  158. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  159. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  160. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  161. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  162. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  163. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  164. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  165. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  166. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  167. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  168. package/dist/components/segment/Segment.js +218 -57
  169. package/dist/components/segment/SegmentItem.js +67 -10
  170. package/dist/components/shared/pagination/Pagination.js +108 -22
  171. package/dist/components/shared/pagination/PaginationList.js +167 -64
  172. package/dist/components/status/Alert/Alert.js +97 -30
  173. package/dist/components/status/Loader/Loader.js +77 -22
  174. package/dist/components/status/Toast/Toast.js +21 -13
  175. package/dist/components/status/Toast/useToast.js +62 -57
  176. package/dist/components/table/ColumnConfig.js +158 -54
  177. package/dist/components/table/InfiniteTable.js +67 -16
  178. package/dist/components/table/PaginatedTable.js +84 -18
  179. package/dist/components/table/Table.js +28 -27
  180. package/dist/components/text/Link/Link.js +19 -7
  181. package/dist/components/text/Typography/Typography.js +23 -8
  182. package/dist/config/confirmation.context.js +1 -1
  183. package/dist/config/link.context.js +23 -9
  184. package/dist/config/router.context.js +42 -16
  185. package/dist/config/theme.context.js +98 -45
  186. package/dist/config/uiConfig.context.js +39 -8
  187. package/dist/config/uiStyle.context.js +15 -5
  188. package/dist/helpers/dynamicInputs.d.ts +1 -1
  189. package/dist/hooks/useBreakpoint.js +16 -3
  190. package/dist/hooks/useDebounceCallback.js +51 -17
  191. package/dist/hooks/useFilters.js +125 -64
  192. package/dist/hooks/useForm.js +42 -8
  193. package/dist/hooks/useFormAutosave.js +101 -30
  194. package/dist/hooks/useIntersectionObserver.js +86 -32
  195. package/dist/hooks/useLocalStorage.js +43 -10
  196. package/dist/hooks/useLongPressRepeat.js +55 -20
  197. package/dist/hooks/usePagination.js +49 -19
  198. package/dist/hooks/useQueryAutocomplete.js +1 -0
  199. package/dist/hooks/useScrollableListBox.js +37 -16
  200. package/dist/hooks/useSorting.js +69 -28
  201. package/dist/hooks/useStateAndRef.js +21 -7
  202. package/dist/hooks/useTableColumnConfig.js +124 -31
  203. package/dist/hooks/useTranslationMemo.js +25 -5
  204. package/dist/index.js +2 -2
  205. package/dist/utils/date-time.utils.js +7 -13
  206. package/package.json +1 -1
@@ -1,29 +1,64 @@
1
+ import { c } from "react/compiler-runtime";
1
2
  import { useEffect, useRef } from "react";
2
3
  //#region src/hooks/useLongPressRepeat.ts
3
- var useLongPressRepeat = ({ onPress, enabled = true, interval = 85, timeout = 500 }) => {
4
+ var useLongPressRepeat = (t0) => {
5
+ const $ = c(10);
6
+ const { onPress, enabled: t1, interval: t2, timeout: t3 } = t0;
7
+ const enabled = t1 === void 0 ? true : t1;
8
+ const interval = t2 === void 0 ? 85 : t2;
9
+ const timeout = t3 === void 0 ? 500 : t3;
4
10
  const intervalRef = useRef(void 0);
5
- useEffect(() => {
6
- return () => {
11
+ let t4;
12
+ let t5;
13
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
14
+ t4 = () => () => {
7
15
  clearInterval(intervalRef.current);
8
16
  };
9
- }, []);
10
- const onPressStart = () => {
11
- onPress(false);
12
- if (!enabled) return;
13
- intervalRef.current = setTimeout(() => {
14
- onPress(true);
15
- intervalRef.current = setInterval(() => {
17
+ t5 = [];
18
+ $[0] = t4;
19
+ $[1] = t5;
20
+ } else {
21
+ t4 = $[0];
22
+ t5 = $[1];
23
+ }
24
+ useEffect(t4, t5);
25
+ let t6;
26
+ if ($[2] !== enabled || $[3] !== interval || $[4] !== onPress || $[5] !== timeout) {
27
+ t6 = () => {
28
+ onPress(false);
29
+ if (!enabled) return;
30
+ intervalRef.current = setTimeout(() => {
16
31
  onPress(true);
17
- }, interval);
18
- }, timeout);
19
- };
20
- const onPressEnd = () => {
21
- clearInterval(intervalRef.current);
22
- };
23
- return {
24
- onPressStart,
25
- onPressEnd
26
- };
32
+ intervalRef.current = setInterval(() => {
33
+ onPress(true);
34
+ }, interval);
35
+ }, timeout);
36
+ };
37
+ $[2] = enabled;
38
+ $[3] = interval;
39
+ $[4] = onPress;
40
+ $[5] = timeout;
41
+ $[6] = t6;
42
+ } else t6 = $[6];
43
+ const onPressStart = t6;
44
+ let t7;
45
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t7 = () => {
47
+ clearInterval(intervalRef.current);
48
+ };
49
+ $[7] = t7;
50
+ } else t7 = $[7];
51
+ const onPressEnd = t7;
52
+ let t8;
53
+ if ($[8] !== onPressStart) {
54
+ t8 = {
55
+ onPressStart,
56
+ onPressEnd
57
+ };
58
+ $[8] = onPressStart;
59
+ $[9] = t8;
60
+ } else t8 = $[9];
61
+ return t8;
27
62
  };
28
63
  //#endregion
29
64
  export { useLongPressRepeat };
@@ -1,5 +1,6 @@
1
1
  import { UIRouter } from "../config/router.context.js";
2
2
  import { RoutingUtils } from "../utils/routing.utils.js";
3
+ import { c } from "react/compiler-runtime";
3
4
  import { useEffect, useState } from "react";
4
5
  //#region src/hooks/usePagination.ts
5
6
  var DEFAULT_STATE = {
@@ -7,26 +8,55 @@ var DEFAULT_STATE = {
7
8
  pageSize: 20
8
9
  };
9
10
  function usePagination(defaultPagination) {
11
+ const $ = c(12);
10
12
  const { replace, searchParams } = UIRouter.useUIRouter();
11
- const [pagination, setPagination] = useState(defaultPagination ?? {
12
- pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
13
- pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
14
- });
15
- useEffect(() => {
16
- const params = new URLSearchParams(searchParams);
17
- params.delete("size");
18
- params.delete("page");
19
- if (pagination.pageSize !== DEFAULT_STATE.pageSize) params.set("size", pagination.pageSize.toString());
20
- if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) params.set("page", pagination.pageIndex.toString());
21
- if (params.toString() === searchParams.toString()) return;
22
- replace(".", RoutingUtils.toRouterSearch(params));
23
- }, [pagination]);
24
- return {
25
- pagination,
26
- setPagination,
27
- pageIndex: pagination.pageIndex,
28
- pageSize: pagination.pageSize
29
- };
13
+ let t0;
14
+ if ($[0] !== defaultPagination || $[1] !== searchParams) {
15
+ t0 = defaultPagination ?? {
16
+ pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
17
+ pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
18
+ };
19
+ $[0] = defaultPagination;
20
+ $[1] = searchParams;
21
+ $[2] = t0;
22
+ } else t0 = $[2];
23
+ const [pagination, setPagination] = useState(t0);
24
+ let t1;
25
+ if ($[3] !== pagination.pageIndex || $[4] !== pagination.pageSize || $[5] !== replace || $[6] !== searchParams) {
26
+ t1 = () => {
27
+ const params = new URLSearchParams(searchParams);
28
+ params.delete("size");
29
+ params.delete("page");
30
+ if (pagination.pageSize !== DEFAULT_STATE.pageSize) params.set("size", pagination.pageSize.toString());
31
+ if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) params.set("page", pagination.pageIndex.toString());
32
+ if (params.toString() === searchParams.toString()) return;
33
+ replace(".", RoutingUtils.toRouterSearch(params));
34
+ };
35
+ $[3] = pagination.pageIndex;
36
+ $[4] = pagination.pageSize;
37
+ $[5] = replace;
38
+ $[6] = searchParams;
39
+ $[7] = t1;
40
+ } else t1 = $[7];
41
+ let t2;
42
+ if ($[8] !== pagination) {
43
+ t2 = [pagination];
44
+ $[8] = pagination;
45
+ $[9] = t2;
46
+ } else t2 = $[9];
47
+ useEffect(t1, t2);
48
+ let t3;
49
+ if ($[10] !== pagination) {
50
+ t3 = {
51
+ pagination,
52
+ setPagination,
53
+ pageIndex: pagination.pageIndex,
54
+ pageSize: pagination.pageSize
55
+ };
56
+ $[10] = pagination;
57
+ $[11] = t3;
58
+ } else t3 = $[11];
59
+ return t3;
30
60
  }
31
61
  //#endregion
32
62
  export { usePagination };
@@ -5,6 +5,7 @@ var isFilterSearchParams = (params) => {
5
5
  return typeof params === "object" && params !== null && "filter" in params;
6
6
  };
7
7
  var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initialQueryState, search }) => {
8
+ "use no memo";
8
9
  const [isQueryEnabled, setIsQueryEnabled] = useState(!initialQueryState);
9
10
  const queryResult = query(search === void 0 ? queryParams : {
10
11
  ...queryParams,
@@ -1,26 +1,47 @@
1
1
  import { useBreakpoint } from "./useBreakpoint.js";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { useEffect, useRef } from "react";
3
4
  //#region src/hooks/useScrollableListBox.ts
4
5
  function useScrollableListBox() {
6
+ const $ = c(4);
5
7
  const ref = useRef(null);
6
8
  const isDesktop = useBreakpoint("md");
7
- useEffect(() => {
8
- const node = ref.current;
9
- if (!node || isDesktop) return;
10
- const onPointerDownCapture = (e) => {
11
- e.stopPropagation();
9
+ let t0;
10
+ let t1;
11
+ if ($[0] !== isDesktop) {
12
+ t0 = () => {
13
+ const node = ref.current;
14
+ if (!node || isDesktop) return;
15
+ const onPointerDownCapture = _temp;
16
+ const onClickCapture = _temp2;
17
+ node.addEventListener("pointerdown", onPointerDownCapture);
18
+ node.addEventListener("click", onClickCapture);
19
+ return () => {
20
+ node.removeEventListener("pointerdown", onPointerDownCapture);
21
+ node.removeEventListener("click", onClickCapture);
22
+ };
12
23
  };
13
- const onClickCapture = (e) => {
14
- if (e.currentTarget?.contains(e.target) && e.target !== e.currentTarget) e.target.click();
15
- };
16
- node.addEventListener("pointerdown", onPointerDownCapture);
17
- node.addEventListener("click", onClickCapture);
18
- return () => {
19
- node.removeEventListener("pointerdown", onPointerDownCapture);
20
- node.removeEventListener("click", onClickCapture);
21
- };
22
- }, [ref, isDesktop]);
23
- return { ref };
24
+ t1 = [ref, isDesktop];
25
+ $[0] = isDesktop;
26
+ $[1] = t0;
27
+ $[2] = t1;
28
+ } else {
29
+ t0 = $[1];
30
+ t1 = $[2];
31
+ }
32
+ useEffect(t0, t1);
33
+ let t2;
34
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
35
+ t2 = { ref };
36
+ $[3] = t2;
37
+ } else t2 = $[3];
38
+ return t2;
39
+ }
40
+ function _temp2(e_0) {
41
+ if (e_0.currentTarget?.contains(e_0.target) && e_0.target !== e_0.currentTarget) e_0.target.click();
42
+ }
43
+ function _temp(e) {
44
+ e.stopPropagation();
24
45
  }
25
46
  //#endregion
26
47
  export { useScrollableListBox };
@@ -1,38 +1,79 @@
1
1
  import { UIRouter } from "../config/router.context.js";
2
2
  import { RoutingUtils } from "../utils/routing.utils.js";
3
- import { useEffect, useMemo, useState } from "react";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useEffect, useState } from "react";
4
5
  //#region src/hooks/useSorting.ts
5
- function useSorting(defaultSorting, prefix = "") {
6
+ function useSorting(defaultSorting, t0) {
7
+ const $ = c(16);
8
+ const prefix = t0 === void 0 ? "" : t0;
6
9
  const { replace, searchParams } = UIRouter.useUIRouter();
7
- const [sorting, setSorting] = useState(defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map((item) => {
8
- if (item.startsWith("-")) return {
9
- id: item.slice(1),
10
- desc: true
10
+ let t1;
11
+ if ($[0] !== defaultSorting || $[1] !== prefix || $[2] !== searchParams) {
12
+ t1 = defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map(_temp) ?? [];
13
+ $[0] = defaultSorting;
14
+ $[1] = prefix;
15
+ $[2] = searchParams;
16
+ $[3] = t1;
17
+ } else t1 = $[3];
18
+ const [sorting, setSorting] = useState(t1);
19
+ let t2;
20
+ if ($[4] !== sorting) {
21
+ t2 = sorting.map(_temp2).join(",");
22
+ $[4] = sorting;
23
+ $[5] = t2;
24
+ } else t2 = $[5];
25
+ const order = t2;
26
+ let t3;
27
+ if ($[6] !== order || $[7] !== prefix || $[8] !== replace || $[9] !== searchParams) {
28
+ t3 = () => {
29
+ const params = new URLSearchParams(searchParams);
30
+ const orderKey = prefix ? `order-${prefix}` : "order";
31
+ params.delete(orderKey);
32
+ if (order) params.set(orderKey, order);
33
+ if (params.toString() === searchParams.toString()) return;
34
+ replace(".", RoutingUtils.toRouterSearch(params));
11
35
  };
12
- if (item.startsWith("+")) return {
13
- id: item.slice(1),
14
- desc: false
36
+ $[6] = order;
37
+ $[7] = prefix;
38
+ $[8] = replace;
39
+ $[9] = searchParams;
40
+ $[10] = t3;
41
+ } else t3 = $[10];
42
+ let t4;
43
+ if ($[11] !== order) {
44
+ t4 = [order];
45
+ $[11] = order;
46
+ $[12] = t4;
47
+ } else t4 = $[12];
48
+ useEffect(t3, t4);
49
+ let t5;
50
+ if ($[13] !== order || $[14] !== sorting) {
51
+ t5 = {
52
+ sorting,
53
+ setSorting,
54
+ order
15
55
  };
16
- return {
17
- id: item,
18
- desc: false
19
- };
20
- }) ?? []);
21
- const order = useMemo(() => {
22
- return sorting.map((field) => `${field.desc ? "-" : "+"}${field.id}`).join(",");
23
- }, [sorting]);
24
- useEffect(() => {
25
- const params = new URLSearchParams(searchParams);
26
- const orderKey = prefix ? `order-${prefix}` : "order";
27
- params.delete(orderKey);
28
- if (order) params.set(orderKey, order);
29
- if (params.toString() === searchParams.toString()) return;
30
- replace(".", RoutingUtils.toRouterSearch(params));
31
- }, [order]);
56
+ $[13] = order;
57
+ $[14] = sorting;
58
+ $[15] = t5;
59
+ } else t5 = $[15];
60
+ return t5;
61
+ }
62
+ function _temp2(field) {
63
+ return `${field.desc ? "-" : "+"}${field.id}`;
64
+ }
65
+ function _temp(item) {
66
+ if (item.startsWith("-")) return {
67
+ id: item.slice(1),
68
+ desc: true
69
+ };
70
+ if (item.startsWith("+")) return {
71
+ id: item.slice(1),
72
+ desc: false
73
+ };
32
74
  return {
33
- sorting,
34
- setSorting,
35
- order
75
+ id: item,
76
+ desc: false
36
77
  };
37
78
  }
38
79
  //#endregion
@@ -1,17 +1,31 @@
1
1
  import { ObjectUtils } from "../utils/object.utils.js";
2
- import { useCallback, useRef, useState } from "react";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useRef, useState } from "react";
3
4
  //#region src/hooks/useStateAndRef.ts
4
5
  var useStateAndRef = (initialState) => {
6
+ const $ = c(3);
5
7
  const [state, setState] = useState(initialState);
6
8
  const ref = useRef(state);
7
- return [
8
- state,
9
- ref,
10
- useCallback((value) => {
9
+ let t0;
10
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
+ t0 = (value) => {
11
12
  ref.current = ObjectUtils.isFunction(value) ? value(ref.current) : value;
12
13
  setState(ref.current);
13
- }, [setState])
14
- ];
14
+ };
15
+ $[0] = t0;
16
+ } else t0 = $[0];
17
+ const updateValue = t0;
18
+ let t1;
19
+ if ($[1] !== state) {
20
+ t1 = [
21
+ state,
22
+ ref,
23
+ updateValue
24
+ ];
25
+ $[1] = state;
26
+ $[2] = t1;
27
+ } else t1 = $[2];
28
+ return t1;
15
29
  };
16
30
  //#endregion
17
31
  export { useStateAndRef };
@@ -1,40 +1,133 @@
1
- import { useCallback, useEffect, useMemo, useState } from "react";
1
+ import { c } from "react/compiler-runtime";
2
+ import { useEffect, useState } from "react";
2
3
  //#region src/hooks/useTableColumnConfig.ts
3
4
  function sortByKeyOrder(data, orderedKeys = []) {
4
5
  return [...data].sort((a, b) => {
5
6
  return orderedKeys.findIndex((key) => key === (a.id ?? a.accessorKey)) - orderedKeys.findIndex((key) => key === (b.id ?? b.accessorKey));
6
7
  });
7
8
  }
8
- function useTableColumnConfig(defaultColumns, options = {}) {
9
- const [internalVisibleColumns, setInternalVisibleColumns] = useState(() => defaultColumns.reduce((acc, col) => {
10
- const key = col.id ?? col.accessorKey;
11
- acc[key] = true;
12
- return acc;
13
- }, {}));
14
- const [internalColumnOrder, setInternalColumnOrder] = useState(() => defaultColumns.map((col) => col.id ?? col.accessorKey));
15
- useEffect(() => {
16
- if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
17
- }, [options.visibleColumns]);
18
- useEffect(() => {
19
- if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
20
- }, [options.columnOrder]);
21
- const handleVisibilityChange = useCallback((value) => {
22
- setInternalVisibleColumns(value);
23
- options?.onVisibilityChange?.(value);
24
- }, [options]);
25
- const handleOrderChange = useCallback((value) => {
26
- setInternalColumnOrder(value);
27
- options?.onOrderChange?.(value);
28
- }, [options]);
29
- const configColumns = useMemo(() => sortByKeyOrder(defaultColumns, internalColumnOrder), [defaultColumns, internalColumnOrder]);
30
- return {
31
- configColumns,
32
- columns: useMemo(() => configColumns.filter((col) => internalVisibleColumns?.[col.id ?? col.accessorKey] ?? true), [configColumns, internalVisibleColumns]),
33
- visibleColumns: internalVisibleColumns,
34
- columnOrder: internalColumnOrder,
35
- onVisibilityChange: handleVisibilityChange,
36
- onOrderChange: handleOrderChange
37
- };
9
+ function useTableColumnConfig(defaultColumns, t0) {
10
+ const $ = c(31);
11
+ let t1;
12
+ if ($[0] !== t0) {
13
+ t1 = t0 === void 0 ? {} : t0;
14
+ $[0] = t0;
15
+ $[1] = t1;
16
+ } else t1 = $[1];
17
+ const options = t1;
18
+ let t2;
19
+ if ($[2] !== defaultColumns) {
20
+ t2 = () => defaultColumns.reduce(_temp, {});
21
+ $[2] = defaultColumns;
22
+ $[3] = t2;
23
+ } else t2 = $[3];
24
+ const [internalVisibleColumns, setInternalVisibleColumns] = useState(t2);
25
+ let t3;
26
+ if ($[4] !== defaultColumns) {
27
+ t3 = () => defaultColumns.map(_temp2);
28
+ $[4] = defaultColumns;
29
+ $[5] = t3;
30
+ } else t3 = $[5];
31
+ const [internalColumnOrder, setInternalColumnOrder] = useState(t3);
32
+ let t4;
33
+ let t5;
34
+ if ($[6] !== options.visibleColumns) {
35
+ t4 = () => {
36
+ if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
37
+ };
38
+ t5 = [options.visibleColumns];
39
+ $[6] = options.visibleColumns;
40
+ $[7] = t4;
41
+ $[8] = t5;
42
+ } else {
43
+ t4 = $[7];
44
+ t5 = $[8];
45
+ }
46
+ useEffect(t4, t5);
47
+ let t6;
48
+ let t7;
49
+ if ($[9] !== options.columnOrder) {
50
+ t6 = () => {
51
+ if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
52
+ };
53
+ t7 = [options.columnOrder];
54
+ $[9] = options.columnOrder;
55
+ $[10] = t6;
56
+ $[11] = t7;
57
+ } else {
58
+ t6 = $[10];
59
+ t7 = $[11];
60
+ }
61
+ useEffect(t6, t7);
62
+ let t8;
63
+ if ($[12] !== options) {
64
+ t8 = (value) => {
65
+ setInternalVisibleColumns(value);
66
+ options?.onVisibilityChange?.(value);
67
+ };
68
+ $[12] = options;
69
+ $[13] = t8;
70
+ } else t8 = $[13];
71
+ const handleVisibilityChange = t8;
72
+ let t9;
73
+ if ($[14] !== options) {
74
+ t9 = (value_0) => {
75
+ setInternalColumnOrder(value_0);
76
+ options?.onOrderChange?.(value_0);
77
+ };
78
+ $[14] = options;
79
+ $[15] = t9;
80
+ } else t9 = $[15];
81
+ const handleOrderChange = t9;
82
+ let t10;
83
+ if ($[16] !== defaultColumns || $[17] !== internalColumnOrder) {
84
+ t10 = sortByKeyOrder(defaultColumns, internalColumnOrder);
85
+ $[16] = defaultColumns;
86
+ $[17] = internalColumnOrder;
87
+ $[18] = t10;
88
+ } else t10 = $[18];
89
+ const configColumns = t10;
90
+ let t11;
91
+ if ($[19] !== configColumns || $[20] !== internalVisibleColumns) {
92
+ let t12;
93
+ if ($[22] !== internalVisibleColumns) {
94
+ t12 = (col_1) => internalVisibleColumns?.[col_1.id ?? col_1.accessorKey] ?? true;
95
+ $[22] = internalVisibleColumns;
96
+ $[23] = t12;
97
+ } else t12 = $[23];
98
+ t11 = configColumns.filter(t12);
99
+ $[19] = configColumns;
100
+ $[20] = internalVisibleColumns;
101
+ $[21] = t11;
102
+ } else t11 = $[21];
103
+ const columns = t11;
104
+ let t12;
105
+ if ($[24] !== columns || $[25] !== configColumns || $[26] !== handleOrderChange || $[27] !== handleVisibilityChange || $[28] !== internalColumnOrder || $[29] !== internalVisibleColumns) {
106
+ t12 = {
107
+ configColumns,
108
+ columns,
109
+ visibleColumns: internalVisibleColumns,
110
+ columnOrder: internalColumnOrder,
111
+ onVisibilityChange: handleVisibilityChange,
112
+ onOrderChange: handleOrderChange
113
+ };
114
+ $[24] = columns;
115
+ $[25] = configColumns;
116
+ $[26] = handleOrderChange;
117
+ $[27] = handleVisibilityChange;
118
+ $[28] = internalColumnOrder;
119
+ $[29] = internalVisibleColumns;
120
+ $[30] = t12;
121
+ } else t12 = $[30];
122
+ return t12;
123
+ }
124
+ function _temp2(col_0) {
125
+ return col_0.id ?? col_0.accessorKey;
126
+ }
127
+ function _temp(acc, col) {
128
+ const key = col.id ?? col.accessorKey;
129
+ acc[key] = true;
130
+ return acc;
38
131
  }
39
132
  //#endregion
40
133
  export { useTableColumnConfig };
@@ -1,12 +1,32 @@
1
- import { useMemo } from "react";
1
+ import { c } from "react/compiler-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  //#region src/hooks/useTranslationMemo.ts
4
4
  function useTranslationMemo(func) {
5
+ const $ = c(5);
5
6
  const { t } = useTranslation();
6
- return useMemo(() => {
7
- if (func.length === 1) return func(t);
8
- return func();
9
- }, [func, t]);
7
+ let t0;
8
+ bb0: {
9
+ if (func.length === 1) {
10
+ let t1;
11
+ if ($[0] !== func || $[1] !== t) {
12
+ t1 = func(t);
13
+ $[0] = func;
14
+ $[1] = t;
15
+ $[2] = t1;
16
+ } else t1 = $[2];
17
+ t0 = t1;
18
+ break bb0;
19
+ }
20
+ const t1 = func;
21
+ let t2;
22
+ if ($[3] !== t1) {
23
+ t2 = t1();
24
+ $[3] = t1;
25
+ $[4] = t2;
26
+ } else t2 = $[4];
27
+ t0 = t2;
28
+ }
29
+ return t0;
10
30
  }
11
31
  //#endregion
12
32
  export { useTranslationMemo };
package/dist/index.js CHANGED
@@ -69,9 +69,9 @@ import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
69
69
  import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
70
70
  import { DateTimeUtils } from "./utils/date-time.utils.js";
71
71
  import { FormField } from "./components/inputs/FormField/FormField.js";
72
+ import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
72
73
  import { DatePicker } from "./components/inputs/DateTime/DatePicker/DatePicker.js";
73
74
  import { Tag } from "./components/text/Tag/Tag.js";
74
- import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
75
75
  import { useIntersectionObserver } from "./hooks/useIntersectionObserver.js";
76
76
  import { TextInput } from "./components/inputs/Input/TextInput/TextInput.js";
77
77
  import { Select } from "./components/inputs/Selection/Select/Select.js";
@@ -94,7 +94,6 @@ import { Slider } from "./components/inputs/Slider/Slider.js";
94
94
  import { Toggle } from "./components/inputs/Toggle/Toggle.js";
95
95
  import { Segment } from "./components/segment/Segment.js";
96
96
  import { QuerySelect } from "./components/inputs/Selection/Select/QuerySelect.js";
97
- import { ResponsivePopover } from "./components/overlays/ResponsivePopover/ResponsivePopover.js";
98
97
  import { StringUtils } from "./utils/string.utils.js";
99
98
  import { dynamicInputs } from "./helpers/dynamicInputs.js";
100
99
  import { Form } from "./components/inputs/Inputs/Form.js";
@@ -105,6 +104,7 @@ import { Stepper } from "./components/navigation/Stepper/Stepper.js";
105
104
  import { Modal } from "./components/overlays/Modal/Modal.js";
106
105
  import { ActionModal } from "./components/overlays/ActionModal/ActionModal.js";
107
106
  import { Drawer } from "./components/overlays/Drawer/Drawer.js";
107
+ import { ResponsivePopover } from "./components/overlays/ResponsivePopover/ResponsivePopover.js";
108
108
  import { TooltipEllipsis } from "./components/overlays/Tooltip/TooltipEllipsis.js";
109
109
  import { PaginationList } from "./components/shared/pagination/PaginationList.js";
110
110
  import { Pagination } from "./components/shared/pagination/Pagination.js";
@@ -73,22 +73,16 @@ var DateTimeUtils;
73
73
  const formatPlaceholder = (formatter, sampleDate) => {
74
74
  return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value.replace(/\s+/gu, "")).join("");
75
75
  };
76
- const removeLeadingZero = (value) => value.replace(/^0+(?=\d)/u, "");
77
76
  const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=\d)/gu, "$1");
78
- const formatLocalizedDateParts = (formatter, date, options) => {
79
- if (options?.shouldForceLeadingZeros !== false) return removeDateSeparatorSpacing(formatter.format(date));
80
- return removeDateSeparatorSpacing(formatter.formatToParts(date).map((part) => {
81
- if (part.type === "day" || part.type === "month") return removeLeadingZero(part.value);
82
- return part.value;
83
- }).join(""));
77
+ const formatLocalizedDateParts = (formatter, date) => {
78
+ return removeDateSeparatorSpacing(formatter.format(date));
84
79
  };
85
- const formatLocalizedDatePartList = (formatter, date, isPlaceholder, options) => {
80
+ const formatLocalizedDatePartList = (formatter, date, isPlaceholder) => {
86
81
  const locale = formatter.resolvedOptions().locale;
87
82
  return formatter.formatToParts(date).map((part) => {
88
- const value = options?.shouldForceLeadingZeros === false && (part.type === "day" || part.type === "month") ? removeLeadingZero(part.value) : part.value.replace(/\s+/gu, "");
89
83
  return {
90
84
  type: part.type,
91
- value,
85
+ value: part.value.replace(/\s+/gu, ""),
92
86
  placeholder: mapTypeToPlaceholder(part.type, locale) ?? part.value.replace(/\s+/gu, ""),
93
87
  isPlaceholder
94
88
  };
@@ -112,11 +106,11 @@ var DateTimeUtils;
112
106
  }
113
107
  _DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
114
108
  function formatCalendarDateLocalized(calendarDate, locale, options) {
115
- return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"), options);
109
+ return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"));
116
110
  }
117
111
  _DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
118
112
  function formatCalendarDatePartsLocalized(calendarDate, locale, options) {
119
- return formatLocalizedDatePartList(getDateFormatter(locale, options), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate, options);
113
+ return formatLocalizedDatePartList(getDateFormatter(locale, options), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate);
120
114
  }
121
115
  _DateTimeUtils.formatCalendarDatePartsLocalized = formatCalendarDatePartsLocalized;
122
116
  function formatTimeLocalized(timeValue, locale) {
@@ -126,7 +120,7 @@ var DateTimeUtils;
126
120
  _DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
127
121
  function formatCalendarDateTimeLocalized(calendarDateTime, locale, options) {
128
122
  const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
129
- return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"), options);
123
+ return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"));
130
124
  }
131
125
  _DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
132
126
  function resolveTimeZone(timeZone) {