@povio/ui 2.2.11 → 2.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.
- package/dist/components/inputs/DateTime/shared/Calendar.js +26 -2
- package/dist/components/overlays/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/segment/Segment.js +2 -1
- package/dist/components/segment/SegmentItem.d.ts +1 -1
- package/dist/components/segment/SegmentItem.js +5 -2
- package/dist/components/segment/segment.types.d.ts +1 -0
- package/dist/config/router.context.d.ts +3 -4
- package/dist/config/router.context.js +1 -3
- package/dist/hooks/useFilters.js +27 -23
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +11 -5
- package/dist/hooks/usePagination.js +8 -4
- package/dist/hooks/useSorting.js +7 -4
- package/dist/index.js +1 -1
- package/dist/utils/routing.utils.d.ts +1 -0
- package/dist/utils/routing.utils.js +14 -0
- package/package.json +4 -4
|
@@ -52,6 +52,30 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
|
|
|
52
52
|
}
|
|
53
53
|
setToggleState("year");
|
|
54
54
|
};
|
|
55
|
+
const handleHeaderMonthNavigation = (months) => {
|
|
56
|
+
if (toggleState) return;
|
|
57
|
+
if (!onMonthYearChange) return;
|
|
58
|
+
const focusedDate = props.state.focusedDate;
|
|
59
|
+
if (months === -1) {
|
|
60
|
+
onMonthYearChange(focusedDate.subtract({ months: 1 }));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
onMonthYearChange(focusedDate.add({ months: 1 }));
|
|
64
|
+
};
|
|
65
|
+
const headerPrevButtonProps = {
|
|
66
|
+
...prevButtonProps,
|
|
67
|
+
onPress: (event) => {
|
|
68
|
+
prevButtonProps.onPress?.(event);
|
|
69
|
+
handleHeaderMonthNavigation(-1);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const headerNextButtonProps = {
|
|
73
|
+
...nextButtonProps,
|
|
74
|
+
onPress: (event) => {
|
|
75
|
+
nextButtonProps.onPress?.(event);
|
|
76
|
+
handleHeaderMonthNavigation(1);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
55
79
|
const handleDateChange = () => {
|
|
56
80
|
if (includesTime && !datePickerState.value) setToggleState("time");
|
|
57
81
|
else onApply();
|
|
@@ -112,8 +136,8 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
|
|
|
112
136
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
113
137
|
calendarState: props.state,
|
|
114
138
|
datePickerState,
|
|
115
|
-
prevButtonProps,
|
|
116
|
-
nextButtonProps,
|
|
139
|
+
prevButtonProps: headerPrevButtonProps,
|
|
140
|
+
nextButtonProps: headerNextButtonProps,
|
|
117
141
|
includesTime,
|
|
118
142
|
hourCycle,
|
|
119
143
|
granularity,
|
|
@@ -188,7 +188,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
|
|
|
188
188
|
initial: { opacity: 0 },
|
|
189
189
|
exit: { opacity: 0 },
|
|
190
190
|
ref: setFooterElement,
|
|
191
|
-
className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-
|
|
191
|
+
className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-[100dvh] left-0 translate-y-[calc(-100%-var(--scroll-position,0px))]"),
|
|
192
192
|
children: footer
|
|
193
193
|
})
|
|
194
194
|
] })
|
|
@@ -11,7 +11,7 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
11
11
|
import { Controller } from "react-hook-form";
|
|
12
12
|
import { useToggleGroupState } from "react-stately";
|
|
13
13
|
//#region src/components/segment/Segment.tsx
|
|
14
|
-
var SegmentBase = ({ className, items, error, onChange, value, defaultValue, ...rest }) => {
|
|
14
|
+
var SegmentBase = ({ className, items, error, onChange, value, defaultValue, segmentItemClassName, ...rest }) => {
|
|
15
15
|
const props = {
|
|
16
16
|
...rest,
|
|
17
17
|
defaultSelectedKeys: defaultValue ? Array.isArray(defaultValue) ? defaultValue : [defaultValue] : void 0,
|
|
@@ -49,6 +49,7 @@ var SegmentBase = ({ className, items, error, onChange, value, defaultValue, ...
|
|
|
49
49
|
style: { gridTemplateColumns },
|
|
50
50
|
children: items.map((item, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SegmentItem, {
|
|
51
51
|
...item,
|
|
52
|
+
className: clsx(item.className, segmentItemClassName),
|
|
52
53
|
isDisabled: item.isDisabled || props.isDisabled,
|
|
53
54
|
isSelected: state.selectedKeys.has(item.id),
|
|
54
55
|
onPress: () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SegmentItem as SegmentItemProps } from './segment.types';
|
|
2
|
-
export declare const SegmentItem: ({ label, icon, id, isDisabled, ...props }: SegmentItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SegmentItem: ({ label, icon, id, isDisabled, className, ...props }: SegmentItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,14 +4,17 @@ import { segmentItemCva } from "./segment.cva.js";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { ToggleButton } from "react-aria-components";
|
|
6
6
|
//#region src/components/segment/SegmentItem.tsx
|
|
7
|
-
var SegmentItem = ({ label, icon, id, isDisabled, ...props }) => {
|
|
7
|
+
var SegmentItem = ({ label, icon, id, isDisabled, className, ...props }) => {
|
|
8
8
|
const IconComponent = icon;
|
|
9
9
|
const iconOnly = !!(icon && !label);
|
|
10
10
|
const segmentItemCva$1 = UIStyle.useCva("segment.itemCva", segmentItemCva);
|
|
11
11
|
return /* @__PURE__ */ jsxs(ToggleButton, {
|
|
12
12
|
...props,
|
|
13
13
|
id,
|
|
14
|
-
className: segmentItemCva$1({
|
|
14
|
+
className: segmentItemCva$1({
|
|
15
|
+
iconOnly,
|
|
16
|
+
className
|
|
17
|
+
}),
|
|
15
18
|
isDisabled,
|
|
16
19
|
children: [icon && /* @__PURE__ */ jsx(IconComponent, { className: "size-6" }), label && /* @__PURE__ */ jsx(Typography, {
|
|
17
20
|
size: "label-2",
|
|
@@ -30,6 +30,7 @@ export type SegmentProps<TKey extends Key = Key> = Omit<ToggleButtonGroupProps &
|
|
|
30
30
|
ref?: Ref<HTMLElement>;
|
|
31
31
|
items: SegmentItem<TKey>[];
|
|
32
32
|
className?: string;
|
|
33
|
+
segmentItemClassName?: string;
|
|
33
34
|
error?: string;
|
|
34
35
|
} & GroupedSegmentProps<TKey>;
|
|
35
36
|
export type ControlledSegmentProps<TFieldValues extends FieldValues, TKey extends Key = Key> = SegmentProps<TKey> & GroupedSegmentControlProps<TFieldValues, TKey>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
interface UIRouterProviderProps {
|
|
3
|
-
push: (
|
|
4
|
-
replace: (
|
|
5
|
-
pathname: string;
|
|
3
|
+
push: (path: string, params?: Record<string, unknown>) => Promise<boolean>;
|
|
4
|
+
replace: (path: string, params?: Record<string, unknown>) => Promise<boolean>;
|
|
6
5
|
searchString: string;
|
|
7
6
|
}
|
|
8
7
|
interface UIRouterContextValue extends UIRouterProviderProps {
|
|
9
8
|
searchParams: URLSearchParams;
|
|
10
9
|
}
|
|
11
10
|
export declare namespace UIRouter {
|
|
12
|
-
const UIRouterProvider: ({ children,
|
|
11
|
+
const UIRouterProvider: ({ children, push, replace, searchString, }: PropsWithChildren<UIRouterProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
const useUIRouter: () => UIRouterContextValue;
|
|
14
13
|
}
|
|
15
14
|
export {};
|
|
@@ -5,20 +5,18 @@ import { RouterProvider } from "react-aria";
|
|
|
5
5
|
var UIRouter;
|
|
6
6
|
(function(_UIRouter) {
|
|
7
7
|
const UIRouterContext = createContext(null);
|
|
8
|
-
_UIRouter.UIRouterProvider = ({ children,
|
|
8
|
+
_UIRouter.UIRouterProvider = ({ children, push, replace, searchString }) => {
|
|
9
9
|
const searchParams = useMemo(() => {
|
|
10
10
|
return new URLSearchParams(searchString);
|
|
11
11
|
}, [searchString]);
|
|
12
12
|
return /* @__PURE__ */ jsx(UIRouterContext, {
|
|
13
13
|
value: useMemo(() => ({
|
|
14
14
|
searchParams,
|
|
15
|
-
pathname,
|
|
16
15
|
push,
|
|
17
16
|
searchString,
|
|
18
17
|
replace
|
|
19
18
|
}), [
|
|
20
19
|
searchParams,
|
|
21
|
-
pathname,
|
|
22
20
|
push,
|
|
23
21
|
searchString,
|
|
24
22
|
replace
|
package/dist/hooks/useFilters.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UIRouter } from "../config/router.context.js";
|
|
2
|
+
import { RoutingUtils } from "../utils/routing.utils.js";
|
|
2
3
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
//#region src/hooks/useFilters.ts
|
|
@@ -18,43 +19,47 @@ var serializeFiltersToQuery = (filterData, prefix) => {
|
|
|
18
19
|
for (const [key, value] of Object.entries(filterData)) {
|
|
19
20
|
if (value === null || value === void 0) continue;
|
|
20
21
|
const filterKey = `filter[${prefix && `${prefix}-`}${key}]`;
|
|
21
|
-
|
|
22
|
-
else if (typeof value === "boolean") query[filterKey] = value ? "true" : "false";
|
|
23
|
-
else query[filterKey] = value.toString();
|
|
22
|
+
query[filterKey] = value;
|
|
24
23
|
}
|
|
25
24
|
return query;
|
|
26
25
|
};
|
|
26
|
+
function normalizeBooleanQueryValue(value) {
|
|
27
|
+
if (value === "\"true\"") return "true";
|
|
28
|
+
if (value === "\"false\"") return "false";
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
27
31
|
var parseFilterFromQuery = (searchParams, schema) => {
|
|
28
32
|
const filter = {};
|
|
29
33
|
for (const [key, value] of searchParams.entries()) {
|
|
34
|
+
const normalizedValue = normalizeBooleanQueryValue(value);
|
|
30
35
|
const match = /^filter\[(.+?)\]$/.exec(key);
|
|
31
36
|
if (!match) continue;
|
|
32
37
|
const filterKey = match[1];
|
|
33
|
-
const isArray =
|
|
34
|
-
const isObject =
|
|
35
|
-
const isNumber = !Number.isNaN(Number(
|
|
36
|
-
const isBoolean = ["true", "false"].includes(
|
|
37
|
-
if (isArray || isObject || isNumber) filter[filterKey] = JSON.parse(
|
|
38
|
-
else if (isBoolean) filter[filterKey] =
|
|
38
|
+
const isArray = normalizedValue.startsWith("[") && normalizedValue.endsWith("]");
|
|
39
|
+
const isObject = normalizedValue.startsWith("{") && normalizedValue.endsWith("}");
|
|
40
|
+
const isNumber = !Number.isNaN(Number(normalizedValue)) && normalizedValue !== "";
|
|
41
|
+
const isBoolean = ["true", "false"].includes(normalizedValue);
|
|
42
|
+
if (isArray || isObject || isNumber) filter[filterKey] = JSON.parse(normalizedValue);
|
|
43
|
+
else if (isBoolean) filter[filterKey] = normalizedValue === "true";
|
|
39
44
|
else {
|
|
40
45
|
const expectedType = getFieldType(schema, filterKey);
|
|
41
|
-
if (expectedType === "number" && !Number.isNaN(Number(
|
|
42
|
-
else if (expectedType === "boolean" && ["true", "false"].includes(
|
|
43
|
-
else filter[filterKey] =
|
|
46
|
+
if (expectedType === "number" && !Number.isNaN(Number(normalizedValue)) && normalizedValue !== "" && normalizedValue !== null) filter[filterKey] = Number(normalizedValue);
|
|
47
|
+
else if (expectedType === "boolean" && ["true", "false"].includes(normalizedValue)) filter[filterKey] = normalizedValue === "true";
|
|
48
|
+
else filter[filterKey] = normalizedValue;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
return filter;
|
|
47
52
|
};
|
|
48
53
|
var useFilters = (defaultFilterValues, prefix = "", schema) => {
|
|
49
|
-
const { searchParams,
|
|
54
|
+
const { searchParams, replace } = UIRouter.useUIRouter();
|
|
50
55
|
const [filterData, setFilterData] = useState(() => parseFilterFromQuery(searchParams, schema));
|
|
51
56
|
useEffect(() => {
|
|
52
57
|
const setUrlToDefaultFilters = () => {
|
|
53
58
|
const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
|
|
54
|
-
replace(
|
|
55
|
-
...
|
|
59
|
+
replace(".", {
|
|
60
|
+
...RoutingUtils.toRouterSearch(searchParams),
|
|
56
61
|
...flatFilterQuery
|
|
57
|
-
})
|
|
62
|
+
});
|
|
58
63
|
};
|
|
59
64
|
const currentFilters = parseFilterFromQuery(searchParams, schema);
|
|
60
65
|
const hasFiltersSet = Object.keys(currentFilters).length > 0;
|
|
@@ -77,20 +82,19 @@ var useFilters = (defaultFilterValues, prefix = "", schema) => {
|
|
|
77
82
|
else newFilters[key] = value;
|
|
78
83
|
});
|
|
79
84
|
const prefixPart = prefix ? `${prefix}-` : "";
|
|
80
|
-
const cleanedQuery =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
85
|
+
const cleanedQuery = RoutingUtils.toRouterSearch(searchParams);
|
|
86
|
+
Object.keys(cleanedQuery).forEach((key) => {
|
|
87
|
+
if (key.startsWith(`filter[${prefixPart}`)) delete cleanedQuery[key];
|
|
88
|
+
});
|
|
84
89
|
const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
|
|
85
|
-
replace(
|
|
90
|
+
replace(".", {
|
|
86
91
|
...cleanedQuery,
|
|
87
92
|
...flatFilterQuery
|
|
88
|
-
})
|
|
93
|
+
});
|
|
89
94
|
setFilterData(newFilters);
|
|
90
95
|
}, [
|
|
91
96
|
filterData,
|
|
92
97
|
prefix,
|
|
93
|
-
pathname,
|
|
94
98
|
replace,
|
|
95
99
|
defaultFilterValues,
|
|
96
100
|
searchParams
|
|
@@ -3,6 +3,6 @@ type UseIntersectionObserverProps = {
|
|
|
3
3
|
onIntersectionChange?: (entry: IntersectionObserverEntry) => void;
|
|
4
4
|
} & IntersectionObserverInit;
|
|
5
5
|
export declare const useIntersectionObserver: <T extends HTMLElement>({ onIntersection, onIntersectionChange, root, rootMargin, threshold, }: UseIntersectionObserverProps) => {
|
|
6
|
-
ref:
|
|
6
|
+
ref: (node: T | null) => void;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { useEffect,
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
//#region src/hooks/useIntersectionObserver.ts
|
|
3
3
|
var useIntersectionObserver = ({ onIntersection, onIntersectionChange, root, rootMargin, threshold }) => {
|
|
4
|
-
const
|
|
4
|
+
const [element, setElement] = useState(null);
|
|
5
|
+
const ref = useCallback((node) => {
|
|
6
|
+
setElement(node);
|
|
7
|
+
}, []);
|
|
5
8
|
useEffect(() => {
|
|
9
|
+
if (!element) return;
|
|
6
10
|
const observer = new IntersectionObserver((entries) => {
|
|
7
11
|
if (entries.some((entry) => entry.isIntersecting)) onIntersection?.();
|
|
8
12
|
onIntersectionChange?.(entries[0]);
|
|
@@ -11,13 +15,15 @@ var useIntersectionObserver = ({ onIntersection, onIntersectionChange, root, roo
|
|
|
11
15
|
rootMargin,
|
|
12
16
|
threshold
|
|
13
17
|
});
|
|
14
|
-
|
|
18
|
+
observer.observe(element);
|
|
15
19
|
return () => observer.disconnect();
|
|
16
20
|
}, [
|
|
17
|
-
|
|
21
|
+
element,
|
|
18
22
|
root,
|
|
19
23
|
onIntersection,
|
|
20
|
-
onIntersectionChange
|
|
24
|
+
onIntersectionChange,
|
|
25
|
+
rootMargin,
|
|
26
|
+
threshold
|
|
21
27
|
]);
|
|
22
28
|
return { ref };
|
|
23
29
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UIRouter } from "../config/router.context.js";
|
|
2
|
+
import { RoutingUtils } from "../utils/routing.utils.js";
|
|
2
3
|
import { useEffect, useState } from "react";
|
|
3
4
|
//#region src/hooks/usePagination.ts
|
|
4
5
|
var DEFAULT_STATE = {
|
|
@@ -6,16 +7,19 @@ var DEFAULT_STATE = {
|
|
|
6
7
|
pageSize: 20
|
|
7
8
|
};
|
|
8
9
|
function usePagination(defaultPagination) {
|
|
9
|
-
const {
|
|
10
|
+
const { replace, searchParams } = UIRouter.useUIRouter();
|
|
10
11
|
const [pagination, setPagination] = useState(defaultPagination ?? {
|
|
11
12
|
pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
|
|
12
13
|
pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
|
|
13
14
|
});
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
const params = new URLSearchParams(searchParams);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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));
|
|
19
23
|
}, [pagination]);
|
|
20
24
|
return {
|
|
21
25
|
pagination,
|
package/dist/hooks/useSorting.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { UIRouter } from "../config/router.context.js";
|
|
2
|
+
import { RoutingUtils } from "../utils/routing.utils.js";
|
|
2
3
|
import { useEffect, useMemo, useState } from "react";
|
|
3
4
|
//#region src/hooks/useSorting.ts
|
|
4
5
|
function useSorting(defaultSorting, prefix = "") {
|
|
5
|
-
const {
|
|
6
|
+
const { replace, searchParams } = UIRouter.useUIRouter();
|
|
6
7
|
const [sorting, setSorting] = useState(defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map((item) => {
|
|
7
8
|
if (item.startsWith("-")) return {
|
|
8
9
|
id: item.slice(1),
|
|
@@ -22,9 +23,11 @@ function useSorting(defaultSorting, prefix = "") {
|
|
|
22
23
|
}, [sorting]);
|
|
23
24
|
useEffect(() => {
|
|
24
25
|
const params = new URLSearchParams(searchParams);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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));
|
|
28
31
|
}, [order]);
|
|
29
32
|
return {
|
|
30
33
|
sorting,
|
package/dist/index.js
CHANGED
|
@@ -126,6 +126,7 @@ import { ThemeContext } from "./config/theme.context.js";
|
|
|
126
126
|
import { DateUtils } from "./utils/date.utils.js";
|
|
127
127
|
import { dynamicColumns } from "./helpers/dynamicColumns.js";
|
|
128
128
|
import { useAutosave } from "./hooks/useAutosave.js";
|
|
129
|
+
import { RoutingUtils } from "./utils/routing.utils.js";
|
|
129
130
|
import { useFilters } from "./hooks/useFilters.js";
|
|
130
131
|
import { useForm } from "./hooks/useForm.js";
|
|
131
132
|
import { useFormAutosave } from "./hooks/useFormAutosave.js";
|
|
@@ -134,5 +135,4 @@ import { useSorting } from "./hooks/useSorting.js";
|
|
|
134
135
|
import { useTableColumnConfig } from "./hooks/useTableColumnConfig.js";
|
|
135
136
|
import { ArrayUtils } from "./utils/array.utils.js";
|
|
136
137
|
import { QueriesUtils } from "./utils/queries.utils.js";
|
|
137
|
-
import { RoutingUtils } from "./utils/routing.utils.js";
|
|
138
138
|
export { Accordion, ActionModal, Alert, AlignCenterIcon, AlignLeftIcon, AlignLeftRightIcon, AlignRightIcon, ArrayUtils, ArrowDropDownIcon, ArrowDropUpIcon, ArrowLeftIcon, ArrowRightIcon, Autocomplete, BoldIcon, BottomSheet, Breadcrumbs, BulletedListIcon, Button, CalendarIcon, CellText, CheckIcon, Checkbox, CheckboxCheckmarkIcon, 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, NumberedListIcon, ObjectUtils, PaginatedTable, Pagination, PaginationList, PasswordInput, PillButton, PointerHorizontalIcon, PointerVerticalIcon, ProgressBar, QueriesUtils, QueryAutocomplete, 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, UIRouter, UIStyle, UnderlinedIcon, VisibilityIcon, VisibilityOffIcon, compoundMapper, dynamicColumns, dynamicInputs, isEqual, logger, ns, resources, uiOutlineClass, useAutosave, useBreakpoint, useDebounceCallback, useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo, useFilters, useForm, useFormAutosave, useIntersectionObserver, useLocalStorage, useLongPressRepeat, usePagination, useScrollableListBox, useSorting, useStateAndRef, useTableColumnConfig, useTableNav, useToast, useTranslationMemo };
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
//#region src/utils/routing.utils.ts
|
|
2
2
|
var RoutingUtils;
|
|
3
3
|
(function(_RoutingUtils) {
|
|
4
|
+
const isNumericString = (value) => {
|
|
5
|
+
return /^-?(0|[1-9]\d*)(\.\d+)?$/.test(value);
|
|
6
|
+
};
|
|
7
|
+
const coerceQueryValue = (value) => {
|
|
8
|
+
if (value === "true") return true;
|
|
9
|
+
if (value === "false") return false;
|
|
10
|
+
if (isNumericString(value)) return Number(value);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
_RoutingUtils.toRouterSearch = (params) => {
|
|
14
|
+
const search = {};
|
|
15
|
+
for (const [key, value] of params.entries()) search[key] = coerceQueryValue(value);
|
|
16
|
+
return search;
|
|
17
|
+
};
|
|
4
18
|
_RoutingUtils.addQueryParams = (path, params) => {
|
|
5
19
|
const sParams = new URLSearchParams();
|
|
6
20
|
for (const [key, value] of Object.entries(params)) if (value) sParams.append(key, value.toString());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"react-responsive": "^10.0.1",
|
|
48
48
|
"react-stately": "^3.44.0",
|
|
49
49
|
"react-toastify": "^11.0.5",
|
|
50
|
-
"tailwindcss": "^4.2.
|
|
51
|
-
"tailwindcss-react-aria-components": "^2.0
|
|
52
|
-
"zod": "^4.3
|
|
50
|
+
"tailwindcss": "^4.2.4",
|
|
51
|
+
"tailwindcss-react-aria-components": "^2.1.0",
|
|
52
|
+
"zod": "^4.4.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@casl/ability": "^6.7.3",
|