@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.
- package/README.md +15 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
- package/dist/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +5 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +234 -201
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +93 -227
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +170 -273
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +60 -147
- package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
- package/dist/components/inputs/DateTime/shared/DateField.js +135 -301
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +142 -338
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +144 -134
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +33 -0
- package/dist/components/inputs/File/FileUpload.js +1 -1
- package/dist/components/inputs/File/InputUpload.js +65 -261
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
- package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
- package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
- package/dist/components/inputs/FormField/FormField.js +34 -47
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +2 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +77 -314
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +23 -83
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +56 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +82 -94
- package/dist/components/inputs/Selection/Select/Select.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
- package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
- 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/Selection/shared/useSelectItems.js +48 -108
- package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
- package/dist/components/inputs/TextEditor/TextEditor.js +87 -389
- package/dist/components/inputs/shared/InputClear.js +24 -40
- package/dist/components/inputs/shared/input.cva.js +1 -1
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/Table.d.ts +2 -8
- package/dist/components/table/Table.js +33 -55
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +1 -0
- package/dist/config/uiConfig.context.js +10 -40
- package/dist/config/uiOverrides.context.d.ts +0 -1
- package/dist/helpers/dynamicColumns.js +2 -1
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useFormAutosave.js +33 -120
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/date-time.utils.d.ts +0 -1
- package/dist/utils/date-time.utils.js +21 -45
- package/dist/utils/intl.utils.d.ts +7 -0
- package/dist/utils/intl.utils.js +38 -0
- package/dist/utils/intl.utils.spec.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
- package/dist/components/inputs/FormField/formField.cva.js +0 -16
- package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
- package/dist/components/table/TableColumnFilterInput.js +0 -108
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
- package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
- package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
- package/dist/components/table/TableColumnFilterRow.js +0 -68
|
@@ -8,7 +8,6 @@ import { tableDataDefinition, tableHeadDataDefinition, tableHeadRowDefinition, t
|
|
|
8
8
|
import { CellText } from "./CellText.js";
|
|
9
9
|
import { DragIndicatorIcon } from "../../assets/icons/DragIndicator.js";
|
|
10
10
|
import { HeaderText } from "./HeaderText.js";
|
|
11
|
-
import { TableColumnFilterRow } from "./TableColumnFilterRow.js";
|
|
12
11
|
import { useTableNav } from "../../hooks/useTableNav.js";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
13
|
import { clsx } from "clsx";
|
|
@@ -75,7 +74,7 @@ var DraggableRow = ({ row, showCellBorder, onRowClick, onDoubleClick, tableRowCv
|
|
|
75
74
|
})
|
|
76
75
|
});
|
|
77
76
|
};
|
|
78
|
-
var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange,
|
|
77
|
+
var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, ...props }) => {
|
|
79
78
|
const tableRowCva = UIOverrides.useCva("table.rowCva", tableRowDefinition);
|
|
80
79
|
const theadCva = UIOverrides.useCva("table.theadCva", theadDefinition);
|
|
81
80
|
const tableHeadRowCva = UIOverrides.useCva("table.headRowCva", tableHeadRowDefinition);
|
|
@@ -173,71 +172,50 @@ var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, classN
|
|
|
173
172
|
const selectedRows = table.getSelectedRowModel().rows;
|
|
174
173
|
const columnCount = table.getHeaderGroups()[0].headers.length;
|
|
175
174
|
const isAnyRowSelected = selectedRows.length > 0 && !!ActionHeader;
|
|
176
|
-
const showFilterRow = !!filterForm && !!filterDefs?.length && !isAnyRowSelected;
|
|
177
175
|
const hasOnClick = !!onRowClick || !!onDoubleClick;
|
|
178
176
|
const tableElement = /* @__PURE__ */ jsxs("table", {
|
|
179
|
-
className: clsx("w-full",
|
|
177
|
+
className: clsx("w-full", className),
|
|
180
178
|
...listeners,
|
|
181
179
|
children: [/* @__PURE__ */ jsxs("thead", {
|
|
182
180
|
className: clsx(theadCva({})),
|
|
183
181
|
"data-is-sticky": isSticky || void 0,
|
|
184
|
-
children: [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
return /* @__PURE__ */ jsx("
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}),
|
|
212
|
-
desc: /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
213
|
-
width: 18,
|
|
214
|
-
height: 18
|
|
215
|
-
})
|
|
216
|
-
}[header_0.column.getIsSorted()] ?? null]
|
|
182
|
+
children: [/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("th", {
|
|
183
|
+
ref: stickyRef,
|
|
184
|
+
className: "-mt-px block"
|
|
185
|
+
}) }), table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", {
|
|
186
|
+
className: clsx(tableHeadRowCva({})),
|
|
187
|
+
children: headerGroup.headers.filter((header) => {
|
|
188
|
+
if (isAnyRowSelected && header.index > 0) return false;
|
|
189
|
+
return header.column.getIsVisible();
|
|
190
|
+
}).map((header_0, index) => {
|
|
191
|
+
const columnMeta = header_0.column.columnDef.meta ?? {};
|
|
192
|
+
return /* @__PURE__ */ jsx("th", {
|
|
193
|
+
colSpan: isAnyRowSelected ? columnCount : header_0.colSpan,
|
|
194
|
+
tabIndex: -1,
|
|
195
|
+
className: clsx(tableHeadDataCva({ hasRightBorder: index > 0 && showCellBorder }), columnMeta.headerClass, columnMeta.width),
|
|
196
|
+
children: isAnyRowSelected ? /* @__PURE__ */ jsx(ActionHeader, { table }) : /* @__PURE__ */ jsxs("button", {
|
|
197
|
+
type: "button",
|
|
198
|
+
"aria-label": "Sort column",
|
|
199
|
+
className: clsx("flex select-none items-center gap-1 text-text-default-1", header_0.column.getCanSort() ? "h-6 cursor-pointer rounded-xs px-1 hover:bg-elevation-fill-default-2" : "cursor-default", columnMeta.sortClass),
|
|
200
|
+
onClick: header_0.column.getToggleSortingHandler(),
|
|
201
|
+
children: [typeof header_0.column.columnDef.header === "function" ? flexRender(header_0.column.columnDef.header, header_0.getContext()) : /* @__PURE__ */ jsx(HeaderText, { children: header_0.column.columnDef.header }), {
|
|
202
|
+
asc: /* @__PURE__ */ jsx(ChevronUpIcon, {
|
|
203
|
+
width: 18,
|
|
204
|
+
height: 18
|
|
205
|
+
}),
|
|
206
|
+
desc: /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
207
|
+
width: 18,
|
|
208
|
+
height: 18
|
|
217
209
|
})
|
|
218
|
-
}
|
|
210
|
+
}[header_0.column.getIsSorted()] ?? null]
|
|
219
211
|
})
|
|
220
|
-
},
|
|
221
|
-
}),
|
|
222
|
-
showFilterRow && table.getHeaderGroups().map((headerGroup_0) => {
|
|
223
|
-
return /* @__PURE__ */ jsx(TableColumnFilterRow, {
|
|
224
|
-
headers: headerGroup_0.headers.filter((header_1) => header_1.column.getIsVisible()),
|
|
225
|
-
filterForm,
|
|
226
|
-
filterDefs,
|
|
227
|
-
tableHeadDataCva,
|
|
228
|
-
rowClassName: clsx(tableHeadRowCva({})),
|
|
229
|
-
cellClassName: headerFilterCellClassName,
|
|
230
|
-
showCellBorder
|
|
231
|
-
}, `${headerGroup_0.id}-filters`);
|
|
212
|
+
}, header_0.id);
|
|
232
213
|
})
|
|
233
|
-
]
|
|
214
|
+
}, headerGroup.id))]
|
|
234
215
|
}), /* @__PURE__ */ jsx("tbody", {
|
|
235
216
|
ref,
|
|
236
217
|
className: "relative",
|
|
237
|
-
children:
|
|
238
|
-
colSpan: columnCount,
|
|
239
|
-
children: emptyContent
|
|
240
|
-
}) }) : enableDragDrop ? /* @__PURE__ */ jsx(SortableContext, {
|
|
218
|
+
children: enableDragDrop ? /* @__PURE__ */ jsx(SortableContext, {
|
|
241
219
|
items: dataIds,
|
|
242
220
|
strategy: verticalListSortingStrategy,
|
|
243
221
|
children: table.getRowModel().rows.map((row_0) => /* @__PURE__ */ jsx(DraggableRow, {
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
2
|
import { typographyDefinition } from "./typography.cva.js";
|
|
3
|
-
import { c } from "react/compiler-runtime";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
//#region src/components/text/Typography/Typography.tsx
|
|
6
|
-
var Typography = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...props
|
|
14
|
-
sizeMobile: props.sizeMobile ?? props.size,
|
|
15
|
-
className
|
|
5
|
+
var Typography = ({ as = "p", className, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(as, {
|
|
7
|
+
className: UIOverrides.useCva("typography.cva", typographyDefinition)({
|
|
8
|
+
...props,
|
|
9
|
+
sizeMobile: props.sizeMobile ?? props.size,
|
|
10
|
+
className
|
|
11
|
+
}),
|
|
12
|
+
...props
|
|
16
13
|
});
|
|
17
|
-
let t3;
|
|
18
|
-
if ($[0] !== Tag || $[1] !== props || $[2] !== t2) {
|
|
19
|
-
t3 = /* @__PURE__ */ jsx(Tag, {
|
|
20
|
-
className: t2,
|
|
21
|
-
...props
|
|
22
|
-
});
|
|
23
|
-
$[0] = Tag;
|
|
24
|
-
$[1] = props;
|
|
25
|
-
$[2] = t2;
|
|
26
|
-
$[3] = t3;
|
|
27
|
-
} else t3 = $[3];
|
|
28
|
-
return t3;
|
|
29
14
|
};
|
|
30
15
|
//#endregion
|
|
31
16
|
export { Typography };
|
|
@@ -24,7 +24,7 @@ var Confirmation;
|
|
|
24
24
|
const [state, setState] = useState(DEFAULT_STATE);
|
|
25
25
|
const { t } = useTranslation("ui");
|
|
26
26
|
const onCancel = () => setState(DEFAULT_STATE);
|
|
27
|
-
const confirm = useCallback(async ({ heading, description, buttonSize, textAlign, modalClassName, cancelLabel = t(($) => $.ui.confirmation.cancel), confirmLabel = t(($
|
|
27
|
+
const confirm = useCallback(async ({ heading, description, buttonSize, textAlign, modalClassName, cancelLabel = t(($) => $.ui.confirmation.cancel), confirmLabel = t(($) => $.ui.confirmation.confirm), confirmVariant, confirmColor, cancelVariant, cancelColor }) => {
|
|
28
28
|
return new Promise((resolve) => {
|
|
29
29
|
setState({
|
|
30
30
|
heading,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useLocalStorage } from "../hooks/useLocalStorage.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, use, useEffect, useState } from "react";
|
|
3
|
+
import { createContext, use, useCallback, useEffect, useMemo, useState } from "react";
|
|
5
4
|
import { z } from "zod";
|
|
6
5
|
//#region src/config/theme.context.tsx
|
|
7
6
|
var ThemeContext;
|
|
@@ -13,108 +12,56 @@ var ThemeContext;
|
|
|
13
12
|
"system"
|
|
14
13
|
]);
|
|
15
14
|
const ThemeContext = createContext(null);
|
|
16
|
-
_ThemeContext.ThemeContextProvider = (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
_ThemeContext.ThemeContextProvider = ({ children, storageKey = DEFAULT_STORAGE_KEY }) => {
|
|
16
|
+
const [systemTheme, setSystemTheme] = useState(() => {
|
|
17
|
+
if (typeof window === "undefined") return;
|
|
18
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
19
|
+
});
|
|
20
|
+
const { value: theme, set } = useLocalStorage({
|
|
21
|
+
key: storageKey,
|
|
22
|
+
schema: ThemeSchema
|
|
23
|
+
});
|
|
24
|
+
const updateTheme = useCallback((theme_0) => {
|
|
25
|
+
set(theme_0);
|
|
26
|
+
}, [set]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (typeof window === "undefined") return;
|
|
29
|
+
const onChange = (event) => {
|
|
30
|
+
setSystemTheme(event.matches ? "dark" : "light");
|
|
26
31
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let t3;
|
|
32
|
-
if ($[2] !== set) {
|
|
33
|
-
t3 = (theme_0) => {
|
|
34
|
-
set(theme_0);
|
|
32
|
+
const media_0 = window.matchMedia("(prefers-color-scheme: dark)");
|
|
33
|
+
media_0.addEventListener("change", onChange);
|
|
34
|
+
return () => {
|
|
35
|
+
media_0.removeEventListener("change", onChange);
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
useEffect(t4, t5);
|
|
62
|
-
let t6;
|
|
63
|
-
let t7;
|
|
64
|
-
if ($[6] !== systemTheme || $[7] !== theme) {
|
|
65
|
-
t6 = () => {
|
|
66
|
-
document.documentElement.classList.remove("dark");
|
|
67
|
-
if ((!theme || theme === "system") && systemTheme === "dark" || theme === "dark") {
|
|
68
|
-
document.documentElement.classList.add("dark");
|
|
69
|
-
document.documentElement.style.colorScheme = "dark";
|
|
70
|
-
} else if (theme === "light") {
|
|
71
|
-
document.documentElement.classList.add("light");
|
|
72
|
-
document.documentElement.style.colorScheme = "light";
|
|
73
|
-
} else document.documentElement.style.colorScheme = "light";
|
|
74
|
-
};
|
|
75
|
-
t7 = [theme, systemTheme];
|
|
76
|
-
$[6] = systemTheme;
|
|
77
|
-
$[7] = theme;
|
|
78
|
-
$[8] = t6;
|
|
79
|
-
$[9] = t7;
|
|
80
|
-
} else {
|
|
81
|
-
t6 = $[8];
|
|
82
|
-
t7 = $[9];
|
|
83
|
-
}
|
|
84
|
-
useEffect(t6, t7);
|
|
85
|
-
const t8 = theme ?? "system";
|
|
86
|
-
let t9;
|
|
87
|
-
if ($[10] !== systemTheme || $[11] !== t8 || $[12] !== updateTheme) {
|
|
88
|
-
t9 = {
|
|
89
|
-
theme: t8,
|
|
90
|
-
systemTheme,
|
|
91
|
-
updateTheme
|
|
92
|
-
};
|
|
93
|
-
$[10] = systemTheme;
|
|
94
|
-
$[11] = t8;
|
|
95
|
-
$[12] = updateTheme;
|
|
96
|
-
$[13] = t9;
|
|
97
|
-
} else t9 = $[13];
|
|
98
|
-
const contextValue = t9;
|
|
99
|
-
let t10;
|
|
100
|
-
if ($[14] !== children || $[15] !== contextValue) {
|
|
101
|
-
t10 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
102
|
-
value: contextValue,
|
|
103
|
-
children
|
|
104
|
-
});
|
|
105
|
-
$[14] = children;
|
|
106
|
-
$[15] = contextValue;
|
|
107
|
-
$[16] = t10;
|
|
108
|
-
} else t10 = $[16];
|
|
109
|
-
return t10;
|
|
37
|
+
}, []);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
document.documentElement.classList.remove("dark");
|
|
40
|
+
if ((!theme || theme === "system") && systemTheme === "dark" || theme === "dark") {
|
|
41
|
+
document.documentElement.classList.add("dark");
|
|
42
|
+
document.documentElement.style.colorScheme = "dark";
|
|
43
|
+
} else if (theme === "light") {
|
|
44
|
+
document.documentElement.classList.add("light");
|
|
45
|
+
document.documentElement.style.colorScheme = "light";
|
|
46
|
+
} else document.documentElement.style.colorScheme = "light";
|
|
47
|
+
}, [theme, systemTheme]);
|
|
48
|
+
const contextValue = useMemo(() => ({
|
|
49
|
+
theme: theme ?? "system",
|
|
50
|
+
systemTheme,
|
|
51
|
+
updateTheme
|
|
52
|
+
}), [
|
|
53
|
+
theme,
|
|
54
|
+
systemTheme,
|
|
55
|
+
updateTheme
|
|
56
|
+
]);
|
|
57
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
58
|
+
value: contextValue,
|
|
59
|
+
children
|
|
60
|
+
});
|
|
110
61
|
};
|
|
111
62
|
_ThemeContext.useTheme = () => {
|
|
112
63
|
return use(ThemeContext);
|
|
113
64
|
};
|
|
114
65
|
})(ThemeContext || (ThemeContext = {}));
|
|
115
|
-
function _temp() {
|
|
116
|
-
if (typeof window === "undefined") return;
|
|
117
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
118
|
-
}
|
|
119
66
|
//#endregion
|
|
120
67
|
export { ThemeContext };
|
|
@@ -48,6 +48,7 @@ export declare namespace UIConfig {
|
|
|
48
48
|
setDateValueOnDateSelection?: boolean;
|
|
49
49
|
timeZone?: string;
|
|
50
50
|
todayIconButtonComponent?: DatePickerProps["todayIconButtonComponent"];
|
|
51
|
+
allowPartialRange?: boolean;
|
|
51
52
|
};
|
|
52
53
|
actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
|
|
53
54
|
bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
|
|
@@ -3,7 +3,6 @@ import { ClockIcon } from "../assets/icons/Clock.js";
|
|
|
3
3
|
import { DateTimeIcon } from "../assets/icons/DateTime.js";
|
|
4
4
|
import { ObjectUtils } from "../utils/object.utils.js";
|
|
5
5
|
import { useDeepCompareMemo } from "../hooks/useDeepCompare.js";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import { createContext, use } from "react";
|
|
9
8
|
//#region src/config/uiConfig.context.tsx
|
|
@@ -78,7 +77,8 @@ var UIConfig;
|
|
|
78
77
|
setDateValueOnDateSelection: false,
|
|
79
78
|
timeZone: "clientLocal",
|
|
80
79
|
granularity: "day",
|
|
81
|
-
shouldUpdateDateOnMonthYearChange: false
|
|
80
|
+
shouldUpdateDateOnMonthYearChange: false,
|
|
81
|
+
allowPartialRange: false
|
|
82
82
|
},
|
|
83
83
|
actionModal: {
|
|
84
84
|
titleTypography: {
|
|
@@ -114,42 +114,15 @@ var UIConfig;
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
const Context = createContext(DEFAULT_CONFIG);
|
|
117
|
-
_UIConfig.Provider = (
|
|
118
|
-
const $ = c(9);
|
|
119
|
-
const { config: t1, children } = t0;
|
|
120
|
-
let t2;
|
|
121
|
-
if ($[0] !== t1) {
|
|
122
|
-
t2 = t1 === void 0 ? {} : t1;
|
|
123
|
-
$[0] = t1;
|
|
124
|
-
$[1] = t2;
|
|
125
|
-
} else t2 = $[1];
|
|
126
|
-
const config = t2;
|
|
117
|
+
_UIConfig.Provider = ({ config = {}, children }) => {
|
|
127
118
|
const parentConfig = use(Context) || DEFAULT_CONFIG;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
$[4] = t3;
|
|
136
|
-
$[5] = t4;
|
|
137
|
-
} else {
|
|
138
|
-
t3 = $[4];
|
|
139
|
-
t4 = $[5];
|
|
140
|
-
}
|
|
141
|
-
const value = useDeepCompareMemo(t3, t4);
|
|
142
|
-
let t5;
|
|
143
|
-
if ($[6] !== children || $[7] !== value) {
|
|
144
|
-
t5 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
145
|
-
value,
|
|
146
|
-
children
|
|
147
|
-
});
|
|
148
|
-
$[6] = children;
|
|
149
|
-
$[7] = value;
|
|
150
|
-
$[8] = t5;
|
|
151
|
-
} else t5 = $[8];
|
|
152
|
-
return t5;
|
|
119
|
+
const value = useDeepCompareMemo(() => {
|
|
120
|
+
return ObjectUtils.deepConditionalMerge(parentConfig, config, (val) => val !== null && val !== void 0);
|
|
121
|
+
}, [config, parentConfig]);
|
|
122
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
123
|
+
value,
|
|
124
|
+
children
|
|
125
|
+
});
|
|
153
126
|
};
|
|
154
127
|
_UIConfig.useConfig = () => {
|
|
155
128
|
const context = use(Context);
|
|
@@ -157,8 +130,5 @@ var UIConfig;
|
|
|
157
130
|
return context;
|
|
158
131
|
};
|
|
159
132
|
})(UIConfig || (UIConfig = {}));
|
|
160
|
-
function _temp(val) {
|
|
161
|
-
return val !== null && val !== void 0;
|
|
162
|
-
}
|
|
163
133
|
//#endregion
|
|
164
134
|
export { UIConfig };
|
|
@@ -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"}`;
|
|
@@ -1,59 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
2
|
//#region src/hooks/useDebounceCallback.ts
|
|
4
|
-
function useDebounceCallback(callback,
|
|
5
|
-
const $ = c(10);
|
|
6
|
-
let t1;
|
|
7
|
-
if ($[0] !== t0) {
|
|
8
|
-
t1 = t0 === void 0 ? {} : t0;
|
|
9
|
-
$[0] = t0;
|
|
10
|
-
$[1] = t1;
|
|
11
|
-
} else t1 = $[1];
|
|
12
|
-
const { delay: t2 } = t1;
|
|
13
|
-
const delay = t2 === void 0 ? 500 : t2;
|
|
3
|
+
function useDebounceCallback(callback, { delay = 500 } = {}) {
|
|
14
4
|
const timeoutRef = useRef(null);
|
|
15
5
|
const [isDebouncing, setIsDebouncing] = useState(false);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const debouncedCallback = useCallback((...args) => {
|
|
7
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8
|
+
setIsDebouncing(true);
|
|
9
|
+
timeoutRef.current = setTimeout(() => {
|
|
10
|
+
setIsDebouncing(false);
|
|
11
|
+
callback?.(...args);
|
|
12
|
+
}, delay);
|
|
13
|
+
}, [callback, delay]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
return () => {
|
|
20
16
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
21
|
-
setIsDebouncing(true);
|
|
22
|
-
timeoutRef.current = setTimeout(() => {
|
|
23
|
-
setIsDebouncing(false);
|
|
24
|
-
callback?.(...args);
|
|
25
|
-
}, delay);
|
|
26
17
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let t4;
|
|
33
|
-
let t5;
|
|
34
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
35
|
-
t4 = () => () => {
|
|
36
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
37
|
-
};
|
|
38
|
-
t5 = [];
|
|
39
|
-
$[5] = t4;
|
|
40
|
-
$[6] = t5;
|
|
41
|
-
} else {
|
|
42
|
-
t4 = $[5];
|
|
43
|
-
t5 = $[6];
|
|
44
|
-
}
|
|
45
|
-
useEffect(t4, t5);
|
|
46
|
-
let t6;
|
|
47
|
-
if ($[7] !== debouncedCallback || $[8] !== isDebouncing) {
|
|
48
|
-
t6 = {
|
|
49
|
-
callback: debouncedCallback,
|
|
50
|
-
isDebouncing
|
|
51
|
-
};
|
|
52
|
-
$[7] = debouncedCallback;
|
|
53
|
-
$[8] = isDebouncing;
|
|
54
|
-
$[9] = t6;
|
|
55
|
-
} else t6 = $[9];
|
|
56
|
-
return t6;
|
|
18
|
+
}, []);
|
|
19
|
+
return {
|
|
20
|
+
callback: debouncedCallback,
|
|
21
|
+
isDebouncing
|
|
22
|
+
};
|
|
57
23
|
}
|
|
58
24
|
//#endregion
|
|
59
25
|
export { useDebounceCallback };
|