@sustaina/shared-ui 1.11.0 → 1.13.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/index.d.mts +70 -6
- package/dist/index.d.ts +70 -6
- package/dist/index.js +693 -237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +573 -122
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
|
2
2
|
import clsx2, { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
5
|
+
import * as React4 from 'react';
|
|
6
|
+
import React4__default, { forwardRef, useRef, useMemo, useCallback, isValidElement, useState, useEffect, createElement } from 'react';
|
|
7
7
|
import { format, isValid, parseISO, isAfter, compareAsc, parse } from 'date-fns';
|
|
8
8
|
import { CircleX, CircleHelp, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Pilcrow, Heading1, Heading2, Heading3, List as List$1, ListOrdered, Quote, CodeSquare, Link, Link2Off, Image as Image$1, AlignLeft, AlignCenter, AlignRight, XIcon, ChevronRight, CheckIcon, Triangle, CalendarIcon, X, Search, ChevronUp, ChevronDown, Plus, ChevronLeft, CircleUserRound, PanelLeftIcon, Bug, GripVertical, Info, CircleMinus, Minus } from 'lucide-react';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
@@ -17,6 +17,9 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
|
17
17
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
18
18
|
import { reSplitAlphaNumeric, useReactTable, getCoreRowModel, getGroupedRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
|
|
19
19
|
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
20
|
+
import i18n from 'i18next';
|
|
21
|
+
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
22
|
+
import { create } from 'zustand';
|
|
20
23
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
21
24
|
import { SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
22
25
|
import { CSS } from '@dnd-kit/utilities';
|
|
@@ -24,7 +27,6 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
|
24
27
|
import { useSensors, useSensor, PointerSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
25
28
|
import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
26
29
|
import { z } from 'zod';
|
|
27
|
-
import { create } from 'zustand';
|
|
28
30
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
29
31
|
import { createCommand, DecoratorNode, $getSelection, $isRangeSelection, $getNodeByKey, $createTextNode, $insertNodes, CAN_UNDO_COMMAND, COMMAND_PRIORITY_NORMAL, CAN_REDO_COMMAND, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, $createParagraphNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, UNDO_COMMAND, REDO_COMMAND, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
30
32
|
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
@@ -940,7 +942,7 @@ var OPERATOR_LABEL = {
|
|
|
940
942
|
containsAll: "Contains all of"
|
|
941
943
|
};
|
|
942
944
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
943
|
-
|
|
945
|
+
React4__default.useEffect(() => {
|
|
944
946
|
if (!operators.length) return;
|
|
945
947
|
if (!operators.includes(row.operator)) {
|
|
946
948
|
onChangeOperator(operators[0]);
|
|
@@ -975,15 +977,15 @@ function Label2({ className, ...props }) {
|
|
|
975
977
|
);
|
|
976
978
|
}
|
|
977
979
|
var Form = FormProvider;
|
|
978
|
-
var FormFieldContext =
|
|
980
|
+
var FormFieldContext = React4.createContext({});
|
|
979
981
|
var FormField = ({
|
|
980
982
|
...props
|
|
981
983
|
}) => {
|
|
982
984
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
983
985
|
};
|
|
984
986
|
var useFormField = () => {
|
|
985
|
-
const fieldContext =
|
|
986
|
-
const itemContext =
|
|
987
|
+
const fieldContext = React4.useContext(FormFieldContext);
|
|
988
|
+
const itemContext = React4.useContext(FormItemContext);
|
|
987
989
|
const { getFieldState } = useFormContext();
|
|
988
990
|
const formState = useFormState({ name: fieldContext.name });
|
|
989
991
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1000,18 +1002,17 @@ var useFormField = () => {
|
|
|
1000
1002
|
...fieldState
|
|
1001
1003
|
};
|
|
1002
1004
|
};
|
|
1003
|
-
var FormItemContext =
|
|
1005
|
+
var FormItemContext = React4.createContext({});
|
|
1004
1006
|
function FormItem({ className, ...props }) {
|
|
1005
|
-
const id =
|
|
1007
|
+
const id = React4.useId();
|
|
1006
1008
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1007
1009
|
}
|
|
1008
1010
|
function FormLabel({ className, ...props }) {
|
|
1009
|
-
const {
|
|
1011
|
+
const { formItemId } = useFormField();
|
|
1010
1012
|
return /* @__PURE__ */ jsx(
|
|
1011
1013
|
Label2,
|
|
1012
1014
|
{
|
|
1013
1015
|
"data-slot": "form-label",
|
|
1014
|
-
"data-error": !!error,
|
|
1015
1016
|
className: cn("data-[error=true]:text-destructive", className),
|
|
1016
1017
|
htmlFor: formItemId,
|
|
1017
1018
|
...props
|
|
@@ -1061,23 +1062,6 @@ function FormMessage({ className, ...props }) {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
);
|
|
1063
1064
|
}
|
|
1064
|
-
var InputPrimitive = React5.forwardRef(
|
|
1065
|
-
({ className, type = "text", ...props }, ref) => {
|
|
1066
|
-
return /* @__PURE__ */ jsx(
|
|
1067
|
-
"input",
|
|
1068
|
-
{
|
|
1069
|
-
ref,
|
|
1070
|
-
type,
|
|
1071
|
-
className: cn(
|
|
1072
|
-
"placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
|
|
1073
|
-
className
|
|
1074
|
-
),
|
|
1075
|
-
...props
|
|
1076
|
-
}
|
|
1077
|
-
);
|
|
1078
|
-
}
|
|
1079
|
-
);
|
|
1080
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
1081
1065
|
var spinnerVariants = cva("relative inline-block aspect-square transform-gpu", {
|
|
1082
1066
|
variants: {
|
|
1083
1067
|
variant: {
|
|
@@ -1124,6 +1108,23 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
1124
1108
|
]
|
|
1125
1109
|
}
|
|
1126
1110
|
);
|
|
1111
|
+
var InputPrimitive = React4.forwardRef(
|
|
1112
|
+
({ className, type = "text", ...props }, ref) => {
|
|
1113
|
+
return /* @__PURE__ */ jsx(
|
|
1114
|
+
"input",
|
|
1115
|
+
{
|
|
1116
|
+
ref,
|
|
1117
|
+
type,
|
|
1118
|
+
className: cn(
|
|
1119
|
+
"placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
|
|
1120
|
+
className
|
|
1121
|
+
),
|
|
1122
|
+
...props
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
InputPrimitive.displayName = "InputPrimitive";
|
|
1127
1128
|
var inputVariants = cva("", {
|
|
1128
1129
|
variants: {
|
|
1129
1130
|
controlSize: {
|
|
@@ -1146,7 +1147,7 @@ var inputVariants = cva("", {
|
|
|
1146
1147
|
appearance: "filled"
|
|
1147
1148
|
}
|
|
1148
1149
|
});
|
|
1149
|
-
var Input =
|
|
1150
|
+
var Input = React4.forwardRef(
|
|
1150
1151
|
({
|
|
1151
1152
|
className,
|
|
1152
1153
|
wrapperClassName,
|
|
@@ -1155,14 +1156,17 @@ var Input = React5.forwardRef(
|
|
|
1155
1156
|
appearance,
|
|
1156
1157
|
prefix,
|
|
1157
1158
|
prefixProps,
|
|
1159
|
+
prefixInteractive,
|
|
1158
1160
|
suffix,
|
|
1159
1161
|
suffixProps,
|
|
1162
|
+
suffixInteractive,
|
|
1160
1163
|
invalid,
|
|
1161
1164
|
loading,
|
|
1162
1165
|
loadingIcon,
|
|
1163
1166
|
validationMessage,
|
|
1164
1167
|
validationIcon,
|
|
1165
1168
|
validationMessageProps,
|
|
1169
|
+
onValueChange,
|
|
1166
1170
|
type = "text",
|
|
1167
1171
|
...rest
|
|
1168
1172
|
}, ref) => {
|
|
@@ -1172,10 +1176,18 @@ var Input = React5.forwardRef(
|
|
|
1172
1176
|
const {
|
|
1173
1177
|
"aria-invalid": ariaInvalidProp,
|
|
1174
1178
|
"aria-describedby": ariaDescribedByProp,
|
|
1179
|
+
onChange: onChangeProp,
|
|
1175
1180
|
...inputProps
|
|
1176
1181
|
} = rest;
|
|
1177
1182
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
1178
|
-
const messageId =
|
|
1183
|
+
const messageId = React4.useId();
|
|
1184
|
+
const handleChange = React4.useCallback(
|
|
1185
|
+
(event) => {
|
|
1186
|
+
onChangeProp?.(event);
|
|
1187
|
+
onValueChange?.(event.target.value);
|
|
1188
|
+
},
|
|
1189
|
+
[onChangeProp, onValueChange]
|
|
1190
|
+
);
|
|
1179
1191
|
const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
|
|
1180
1192
|
const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
|
|
1181
1193
|
const controlWrapperClassName = cn(
|
|
@@ -1197,6 +1209,7 @@ var Input = React5.forwardRef(
|
|
|
1197
1209
|
),
|
|
1198
1210
|
"aria-invalid": resolvedAriaInvalid,
|
|
1199
1211
|
"aria-describedby": describedBy || void 0,
|
|
1212
|
+
onChange: handleChange,
|
|
1200
1213
|
...inputProps
|
|
1201
1214
|
}
|
|
1202
1215
|
);
|
|
@@ -1216,7 +1229,8 @@ var Input = React5.forwardRef(
|
|
|
1216
1229
|
{
|
|
1217
1230
|
...prefixRest,
|
|
1218
1231
|
className: cn(
|
|
1219
|
-
"
|
|
1232
|
+
"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
|
|
1233
|
+
!prefixInteractive && "pointer-events-none",
|
|
1220
1234
|
prefixClassName
|
|
1221
1235
|
),
|
|
1222
1236
|
children: prefix
|
|
@@ -1228,7 +1242,8 @@ var Input = React5.forwardRef(
|
|
|
1228
1242
|
{
|
|
1229
1243
|
...suffixRest,
|
|
1230
1244
|
className: cn(
|
|
1231
|
-
"
|
|
1245
|
+
"absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
|
|
1246
|
+
!suffixInteractive && "pointer-events-none",
|
|
1232
1247
|
suffixClassName
|
|
1233
1248
|
),
|
|
1234
1249
|
children: suffixContent
|
|
@@ -1491,20 +1506,20 @@ function DatePicker({
|
|
|
1491
1506
|
className,
|
|
1492
1507
|
...props
|
|
1493
1508
|
}) {
|
|
1494
|
-
const today =
|
|
1495
|
-
const [displayed, setDisplayed] =
|
|
1509
|
+
const today = React4.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1510
|
+
const [displayed, setDisplayed] = React4.useState(
|
|
1496
1511
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
1497
1512
|
);
|
|
1498
1513
|
minDate = clampToDay(minDate);
|
|
1499
1514
|
maxDate = clampToDay(maxDate);
|
|
1500
|
-
const disabledSet =
|
|
1515
|
+
const disabledSet = React4.useMemo(() => {
|
|
1501
1516
|
const s = /* @__PURE__ */ new Set();
|
|
1502
1517
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
1503
1518
|
return s;
|
|
1504
1519
|
}, [disabledDates]);
|
|
1505
1520
|
const displayYear = displayed.getFullYear();
|
|
1506
1521
|
const displayMonth = displayed.getMonth();
|
|
1507
|
-
const weekdays =
|
|
1522
|
+
const weekdays = React4.useMemo(() => {
|
|
1508
1523
|
const labels = [];
|
|
1509
1524
|
for (let i = 0; i < 7; i++) {
|
|
1510
1525
|
const idx = i;
|
|
@@ -1513,7 +1528,7 @@ function DatePicker({
|
|
|
1513
1528
|
}
|
|
1514
1529
|
return labels;
|
|
1515
1530
|
}, [callbacks]);
|
|
1516
|
-
const grid =
|
|
1531
|
+
const grid = React4.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
1517
1532
|
const isDateDisabled = (date) => {
|
|
1518
1533
|
const d = startOfDay(date);
|
|
1519
1534
|
if (minDate && d < minDate) return true;
|
|
@@ -1523,7 +1538,7 @@ function DatePicker({
|
|
|
1523
1538
|
};
|
|
1524
1539
|
const minYear = minDate?.getFullYear();
|
|
1525
1540
|
const maxYear = maxDate?.getFullYear();
|
|
1526
|
-
const getMonthLabel =
|
|
1541
|
+
const getMonthLabel = React4.useCallback(
|
|
1527
1542
|
(year, monthIndex) => {
|
|
1528
1543
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
1529
1544
|
if (label === null || label === void 0) {
|
|
@@ -1533,7 +1548,7 @@ function DatePicker({
|
|
|
1533
1548
|
},
|
|
1534
1549
|
[callbacks]
|
|
1535
1550
|
);
|
|
1536
|
-
const getYearLabel =
|
|
1551
|
+
const getYearLabel = React4.useCallback(
|
|
1537
1552
|
(year) => {
|
|
1538
1553
|
const label = callbacks?.yearLabel?.(year);
|
|
1539
1554
|
if (label === null || label === void 0) return String(year);
|
|
@@ -1541,7 +1556,7 @@ function DatePicker({
|
|
|
1541
1556
|
},
|
|
1542
1557
|
[callbacks]
|
|
1543
1558
|
);
|
|
1544
|
-
const clampMonthToBounds =
|
|
1559
|
+
const clampMonthToBounds = React4.useCallback(
|
|
1545
1560
|
(year, monthIndex) => {
|
|
1546
1561
|
let output = monthIndex;
|
|
1547
1562
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -1556,7 +1571,7 @@ function DatePicker({
|
|
|
1556
1571
|
},
|
|
1557
1572
|
[maxDate, minDate, maxYear, minYear]
|
|
1558
1573
|
);
|
|
1559
|
-
const yearOptions =
|
|
1574
|
+
const yearOptions = React4.useMemo(() => {
|
|
1560
1575
|
const fallbackWindow = 50;
|
|
1561
1576
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
1562
1577
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -1577,7 +1592,7 @@ function DatePicker({
|
|
|
1577
1592
|
}
|
|
1578
1593
|
return years;
|
|
1579
1594
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
1580
|
-
const monthOptions =
|
|
1595
|
+
const monthOptions = React4.useMemo(() => {
|
|
1581
1596
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
1582
1597
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
1583
1598
|
return {
|
|
@@ -1596,7 +1611,7 @@ function DatePicker({
|
|
|
1596
1611
|
}
|
|
1597
1612
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
1598
1613
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
1599
|
-
const handleMonthSelect =
|
|
1614
|
+
const handleMonthSelect = React4.useCallback((nextValue) => {
|
|
1600
1615
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
1601
1616
|
if (Number.isNaN(nextMonth)) return;
|
|
1602
1617
|
setDisplayed((prev) => {
|
|
@@ -1606,7 +1621,7 @@ function DatePicker({
|
|
|
1606
1621
|
return next;
|
|
1607
1622
|
});
|
|
1608
1623
|
}, []);
|
|
1609
|
-
const handleYearSelect =
|
|
1624
|
+
const handleYearSelect = React4.useCallback(
|
|
1610
1625
|
(nextValue) => {
|
|
1611
1626
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
1612
1627
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -1754,14 +1769,14 @@ var DatePicker2 = ({
|
|
|
1754
1769
|
ariaLabel,
|
|
1755
1770
|
...calendarProps
|
|
1756
1771
|
}) => {
|
|
1757
|
-
const [open, setOpen] =
|
|
1758
|
-
const parser =
|
|
1759
|
-
const outputFormatter =
|
|
1760
|
-
const labelFormatter =
|
|
1772
|
+
const [open, setOpen] = React4__default.useState(false);
|
|
1773
|
+
const parser = React4__default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
1774
|
+
const outputFormatter = React4__default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
1775
|
+
const labelFormatter = React4__default.useMemo(
|
|
1761
1776
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
1762
1777
|
[displayFormatter]
|
|
1763
1778
|
);
|
|
1764
|
-
const parsedValue =
|
|
1779
|
+
const parsedValue = React4__default.useMemo(() => {
|
|
1765
1780
|
if (value === null || value === void 0) return void 0;
|
|
1766
1781
|
if (value instanceof Date) return value;
|
|
1767
1782
|
const parsed = parser(value);
|
|
@@ -1770,26 +1785,26 @@ var DatePicker2 = ({
|
|
|
1770
1785
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
1771
1786
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
1772
1787
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
1773
|
-
const handleClose =
|
|
1774
|
-
const emitChange =
|
|
1788
|
+
const handleClose = React4__default.useCallback(() => setOpen(false), []);
|
|
1789
|
+
const emitChange = React4__default.useCallback(
|
|
1775
1790
|
(next) => {
|
|
1776
1791
|
onChange?.(next);
|
|
1777
1792
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
1778
1793
|
},
|
|
1779
1794
|
[onChange, onValueChange, outputFormatter]
|
|
1780
1795
|
);
|
|
1781
|
-
const handleSelect =
|
|
1796
|
+
const handleSelect = React4__default.useCallback(
|
|
1782
1797
|
(next) => {
|
|
1783
1798
|
emitChange(next);
|
|
1784
1799
|
if (closeOnSelect && next) handleClose();
|
|
1785
1800
|
},
|
|
1786
1801
|
[closeOnSelect, emitChange, handleClose]
|
|
1787
1802
|
);
|
|
1788
|
-
const handleClear =
|
|
1803
|
+
const handleClear = React4__default.useCallback(() => {
|
|
1789
1804
|
emitChange(void 0);
|
|
1790
1805
|
handleClose();
|
|
1791
1806
|
}, [emitChange, handleClose]);
|
|
1792
|
-
const handleOpenChange =
|
|
1807
|
+
const handleOpenChange = React4__default.useCallback(
|
|
1793
1808
|
(nextOpen) => {
|
|
1794
1809
|
if (disabled && nextOpen) return;
|
|
1795
1810
|
setOpen(nextOpen);
|
|
@@ -1961,15 +1976,15 @@ function MonthCal({
|
|
|
1961
1976
|
onYearBackward,
|
|
1962
1977
|
onYearForward
|
|
1963
1978
|
}) {
|
|
1964
|
-
const today =
|
|
1979
|
+
const today = React4.useMemo(() => {
|
|
1965
1980
|
const now = /* @__PURE__ */ new Date();
|
|
1966
1981
|
now.setDate(1);
|
|
1967
1982
|
now.setHours(0, 0, 0, 0);
|
|
1968
1983
|
return now;
|
|
1969
1984
|
}, []);
|
|
1970
|
-
const selectedMonthDate =
|
|
1971
|
-
const min =
|
|
1972
|
-
const max =
|
|
1985
|
+
const selectedMonthDate = React4.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
1986
|
+
const min = React4.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
1987
|
+
const max = React4.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
1973
1988
|
let effectiveMin = min;
|
|
1974
1989
|
if (min && max && min > max) {
|
|
1975
1990
|
effectiveMin = max;
|
|
@@ -1978,10 +1993,10 @@ function MonthCal({
|
|
|
1978
1993
|
const minMonth = effectiveMin?.getMonth();
|
|
1979
1994
|
const maxYear = max?.getFullYear();
|
|
1980
1995
|
const maxMonth = max?.getMonth();
|
|
1981
|
-
const [menuYear, setMenuYear] =
|
|
1996
|
+
const [menuYear, setMenuYear] = React4.useState(
|
|
1982
1997
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
1983
1998
|
);
|
|
1984
|
-
|
|
1999
|
+
React4.useEffect(() => {
|
|
1985
2000
|
if (selectedMonthDate) {
|
|
1986
2001
|
const year = selectedMonthDate.getFullYear();
|
|
1987
2002
|
if (year !== menuYear) {
|
|
@@ -1989,7 +2004,7 @@ function MonthCal({
|
|
|
1989
2004
|
}
|
|
1990
2005
|
}
|
|
1991
2006
|
}, [selectedMonthDate, menuYear]);
|
|
1992
|
-
|
|
2007
|
+
React4.useEffect(() => {
|
|
1993
2008
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
1994
2009
|
setMenuYear(minYear);
|
|
1995
2010
|
return;
|
|
@@ -2000,7 +2015,7 @@ function MonthCal({
|
|
|
2000
2015
|
}, [minYear, maxYear, menuYear]);
|
|
2001
2016
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
2002
2017
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
2003
|
-
const yearOptions =
|
|
2018
|
+
const yearOptions = React4.useMemo(() => {
|
|
2004
2019
|
const fallbackWindow = 50;
|
|
2005
2020
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
2006
2021
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -2014,7 +2029,7 @@ function MonthCal({
|
|
|
2014
2029
|
}
|
|
2015
2030
|
return years;
|
|
2016
2031
|
}, [maxYear, menuYear, minYear]);
|
|
2017
|
-
const formatYearLabel =
|
|
2032
|
+
const formatYearLabel = React4.useCallback(
|
|
2018
2033
|
(year) => {
|
|
2019
2034
|
const raw = callbacks?.yearLabel?.(year);
|
|
2020
2035
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -2022,7 +2037,7 @@ function MonthCal({
|
|
|
2022
2037
|
},
|
|
2023
2038
|
[callbacks]
|
|
2024
2039
|
);
|
|
2025
|
-
const handleYearSelect =
|
|
2040
|
+
const handleYearSelect = React4.useCallback(
|
|
2026
2041
|
(nextValue) => {
|
|
2027
2042
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
2028
2043
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2032,7 +2047,7 @@ function MonthCal({
|
|
|
2032
2047
|
},
|
|
2033
2048
|
[maxYear, minYear]
|
|
2034
2049
|
);
|
|
2035
|
-
const disabledPairs =
|
|
2050
|
+
const disabledPairs = React4.useMemo(() => {
|
|
2036
2051
|
if (!disabledDates?.length) return [];
|
|
2037
2052
|
const pairs = [];
|
|
2038
2053
|
disabledDates.forEach((date) => {
|
|
@@ -2177,14 +2192,14 @@ var MonthPicker2 = ({
|
|
|
2177
2192
|
ariaLabel,
|
|
2178
2193
|
...calendarProps
|
|
2179
2194
|
}) => {
|
|
2180
|
-
const [open, setOpen] =
|
|
2181
|
-
const parser =
|
|
2182
|
-
const outputFormatter =
|
|
2183
|
-
const labelFormatter =
|
|
2195
|
+
const [open, setOpen] = React4__default.useState(false);
|
|
2196
|
+
const parser = React4__default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
2197
|
+
const outputFormatter = React4__default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
2198
|
+
const labelFormatter = React4__default.useMemo(
|
|
2184
2199
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
2185
2200
|
[displayFormatter]
|
|
2186
2201
|
);
|
|
2187
|
-
const parsedValue =
|
|
2202
|
+
const parsedValue = React4__default.useMemo(() => {
|
|
2188
2203
|
if (value === null || value === void 0) return void 0;
|
|
2189
2204
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
2190
2205
|
if (typeof value === "string") {
|
|
@@ -2196,8 +2211,8 @@ var MonthPicker2 = ({
|
|
|
2196
2211
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
2197
2212
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
2198
2213
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2199
|
-
const handleClose =
|
|
2200
|
-
const emitChange =
|
|
2214
|
+
const handleClose = React4__default.useCallback(() => setOpen(false), []);
|
|
2215
|
+
const emitChange = React4__default.useCallback(
|
|
2201
2216
|
(next) => {
|
|
2202
2217
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
2203
2218
|
onChange?.(normalized);
|
|
@@ -2205,18 +2220,18 @@ var MonthPicker2 = ({
|
|
|
2205
2220
|
},
|
|
2206
2221
|
[onChange, onValueChange, outputFormatter]
|
|
2207
2222
|
);
|
|
2208
|
-
const handleSelect =
|
|
2223
|
+
const handleSelect = React4__default.useCallback(
|
|
2209
2224
|
(next) => {
|
|
2210
2225
|
emitChange(next);
|
|
2211
2226
|
if (closeOnSelect && next) handleClose();
|
|
2212
2227
|
},
|
|
2213
2228
|
[closeOnSelect, emitChange, handleClose]
|
|
2214
2229
|
);
|
|
2215
|
-
const handleClear =
|
|
2230
|
+
const handleClear = React4__default.useCallback(() => {
|
|
2216
2231
|
emitChange(void 0);
|
|
2217
2232
|
handleClose();
|
|
2218
2233
|
}, [emitChange, handleClose]);
|
|
2219
|
-
const handleOpenChange =
|
|
2234
|
+
const handleOpenChange = React4__default.useCallback(
|
|
2220
2235
|
(nextOpen) => {
|
|
2221
2236
|
if (disabled && nextOpen) return;
|
|
2222
2237
|
setOpen(nextOpen);
|
|
@@ -3276,7 +3291,7 @@ var AdvanceSearch = ({
|
|
|
3276
3291
|
defaultValues: {}
|
|
3277
3292
|
});
|
|
3278
3293
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
3279
|
-
const [operatorErrors, setOperatorErrors] =
|
|
3294
|
+
const [operatorErrors, setOperatorErrors] = React4__default.useState({});
|
|
3280
3295
|
const clearOperatorError = useCallback(
|
|
3281
3296
|
(rowId) => {
|
|
3282
3297
|
setOperatorErrors((prev) => {
|
|
@@ -3867,7 +3882,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
3867
3882
|
}
|
|
3868
3883
|
);
|
|
3869
3884
|
};
|
|
3870
|
-
var ColumnSeparator_default =
|
|
3885
|
+
var ColumnSeparator_default = React4__default.memo(ColumnSeparator);
|
|
3871
3886
|
var StatusContentSlot = ({
|
|
3872
3887
|
content,
|
|
3873
3888
|
icon,
|
|
@@ -3886,7 +3901,7 @@ var StatusContentSlot = ({
|
|
|
3886
3901
|
content
|
|
3887
3902
|
] });
|
|
3888
3903
|
};
|
|
3889
|
-
var StatusContentSlot_default =
|
|
3904
|
+
var StatusContentSlot_default = React4__default.memo(StatusContentSlot);
|
|
3890
3905
|
var stateOptions = [
|
|
3891
3906
|
"columnFilters",
|
|
3892
3907
|
"globalFilter",
|
|
@@ -4711,9 +4726,11 @@ var buttonVariants2 = cva(
|
|
|
4711
4726
|
variant: {
|
|
4712
4727
|
default: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50",
|
|
4713
4728
|
success: "bg-sus-primary-1 text-primary-foreground shadow-xs hover:bg-sus-primary/90",
|
|
4714
|
-
error: "border border-[#BB0B0E]
|
|
4729
|
+
error: "border border-[#BB0B0E] text-[#BB0B0E] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
4715
4730
|
warning: "bg-yellow-500 text-black shadow-xs hover:bg-yellow-600 dark:hover:bg-yellow-400",
|
|
4716
|
-
cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50"
|
|
4731
|
+
cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50",
|
|
4732
|
+
confirm: "border border-[#BB0B0E] text-[#BB0B0E] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
4733
|
+
"confirm-green": "border border-[#379A2A] text-[#379A2A] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground"
|
|
4717
4734
|
},
|
|
4718
4735
|
size: {
|
|
4719
4736
|
default: "h-9 px-4 has-[>svg]:px-3",
|
|
@@ -4755,6 +4772,154 @@ function Button2({
|
|
|
4755
4772
|
}
|
|
4756
4773
|
);
|
|
4757
4774
|
}
|
|
4775
|
+
|
|
4776
|
+
// src/components/dialog-alert/lib/constants.ts
|
|
4777
|
+
var DIALOG_ALERT_I18N_NAMESPACE = "dialog_alert";
|
|
4778
|
+
|
|
4779
|
+
// src/components/dialog-alert/locale/default.ts
|
|
4780
|
+
var defaultResource = {
|
|
4781
|
+
sharedui: {
|
|
4782
|
+
[DIALOG_ALERT_I18N_NAMESPACE]: {
|
|
4783
|
+
cancel: "Cancel",
|
|
4784
|
+
close: "Close",
|
|
4785
|
+
"success.saved": {
|
|
4786
|
+
title: "Successfully",
|
|
4787
|
+
description: "Data has been successfully saved"
|
|
4788
|
+
},
|
|
4789
|
+
"success.deleted": {
|
|
4790
|
+
title: "Successfully",
|
|
4791
|
+
description: "Data has been successfully deleted"
|
|
4792
|
+
},
|
|
4793
|
+
"success.removed": {
|
|
4794
|
+
title: "Successfully",
|
|
4795
|
+
description: "Data has been successfully removed"
|
|
4796
|
+
},
|
|
4797
|
+
"error.api_db_error": {
|
|
4798
|
+
title: "API/Database Error",
|
|
4799
|
+
description: "Failed to connect to the system. Please check API or database connection."
|
|
4800
|
+
},
|
|
4801
|
+
"error.permission_denied": {
|
|
4802
|
+
title: "Permission Denied",
|
|
4803
|
+
description: "You do not have permission to delete this data.",
|
|
4804
|
+
confirm_text: "Discard"
|
|
4805
|
+
},
|
|
4806
|
+
"error.session_expired": {
|
|
4807
|
+
title: "Session Expired",
|
|
4808
|
+
description: "Your session has expired or you have been logged out. Please sign in again.",
|
|
4809
|
+
confirm_text: "Logout"
|
|
4810
|
+
},
|
|
4811
|
+
"error.user_not_found": {
|
|
4812
|
+
title: "User Not Found",
|
|
4813
|
+
description: "The system could not locate the user account.",
|
|
4814
|
+
confirm_text: "Logout"
|
|
4815
|
+
},
|
|
4816
|
+
"error.data_not_found": {
|
|
4817
|
+
title: "Data Not Found",
|
|
4818
|
+
description: "The data has already been deleted or does not exist in the system."
|
|
4819
|
+
},
|
|
4820
|
+
"error.data_restrict_editing": {
|
|
4821
|
+
title: "Data Status Restricts Editing",
|
|
4822
|
+
description: "Data status does not allow editing."
|
|
4823
|
+
},
|
|
4824
|
+
"error.network_timeout_error": {
|
|
4825
|
+
title: "Network Error / Timeout",
|
|
4826
|
+
description: "The system could not connect to the network or the request took too long to process."
|
|
4827
|
+
},
|
|
4828
|
+
"error.queue_full": {
|
|
4829
|
+
title: "Queue Full",
|
|
4830
|
+
description: "The notification queue has reached its limit. Please try again later."
|
|
4831
|
+
},
|
|
4832
|
+
"error.invalid_data_format": {
|
|
4833
|
+
title: "Invalid Data Format",
|
|
4834
|
+
description: "Data creation failed due to invalid or incorrectly formatted data."
|
|
4835
|
+
},
|
|
4836
|
+
"error.data_linked_to_system_data": {
|
|
4837
|
+
title: "Data Linked to System Data",
|
|
4838
|
+
description: "Cannot delete data because they are linked to existing system data."
|
|
4839
|
+
},
|
|
4840
|
+
"error.pending_workflow_conflict": {
|
|
4841
|
+
title: "Pending Workflow Conflict ",
|
|
4842
|
+
description: "The data is currently involved in a pending workflow or approval process and cannot be deactivated."
|
|
4843
|
+
},
|
|
4844
|
+
"error.invalid_incomplete_data": {
|
|
4845
|
+
title: "Invalid or Incomplete Data",
|
|
4846
|
+
description: "Data status cannot be changed due to incomplete or invalid information."
|
|
4847
|
+
},
|
|
4848
|
+
"error.client_side_error": {
|
|
4849
|
+
title: "Client-Side Error",
|
|
4850
|
+
description: "An error occurred on the client side. Please refresh the page or try again."
|
|
4851
|
+
},
|
|
4852
|
+
"error.system_limitation": {
|
|
4853
|
+
title: "System Limitation",
|
|
4854
|
+
description: "The search cannot be completed due to system limitations. Please simplify your query."
|
|
4855
|
+
},
|
|
4856
|
+
"error.timeout": {
|
|
4857
|
+
title: "Timeout",
|
|
4858
|
+
description: "Request failed due to a system error or timeout. Please try again."
|
|
4859
|
+
},
|
|
4860
|
+
"error.duplicate_data": {
|
|
4861
|
+
title: "Duplicate Data",
|
|
4862
|
+
description: "The data you entered already exists in the system."
|
|
4863
|
+
},
|
|
4864
|
+
"error.something_went_wrong": {
|
|
4865
|
+
title: "Something Went Wrong",
|
|
4866
|
+
description: "An unknown error occurred."
|
|
4867
|
+
},
|
|
4868
|
+
"confirm.delete": {
|
|
4869
|
+
title: "Confirmation",
|
|
4870
|
+
description: "Are you sure you want to delete this item?",
|
|
4871
|
+
confirm_text: "Delete"
|
|
4872
|
+
},
|
|
4873
|
+
"confirm.inactive": {
|
|
4874
|
+
title: "Confirmation",
|
|
4875
|
+
description: "Are you sure you want to inactive this item?",
|
|
4876
|
+
confirm_text: "Inactive"
|
|
4877
|
+
},
|
|
4878
|
+
"confirm.active": {
|
|
4879
|
+
variant: "confirm-green",
|
|
4880
|
+
title: "Confirmation",
|
|
4881
|
+
description: "Are you sure you want to active this item?",
|
|
4882
|
+
confirm_text: "Active"
|
|
4883
|
+
},
|
|
4884
|
+
"confirm.leave_page": {
|
|
4885
|
+
title: "Confirmation",
|
|
4886
|
+
description: "Unsaved changes. Do you want to leave this page?",
|
|
4887
|
+
confirm_text: "Leave"
|
|
4888
|
+
},
|
|
4889
|
+
"confirm.remove": {
|
|
4890
|
+
title: "Confirmation",
|
|
4891
|
+
description: "Are you sure you want to remove this item?",
|
|
4892
|
+
confirm_text: "Remove"
|
|
4893
|
+
},
|
|
4894
|
+
"confirm.logout": {
|
|
4895
|
+
title: "Confirmation",
|
|
4896
|
+
description: "Do you want to log out?",
|
|
4897
|
+
confirm_text: "Logout"
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
};
|
|
4902
|
+
|
|
4903
|
+
// src/components/dialog-alert/locale/i18n.ts
|
|
4904
|
+
i18n.use(initReactI18next).init({
|
|
4905
|
+
resources: defaultResource,
|
|
4906
|
+
lng: "sharedui",
|
|
4907
|
+
fallbackLng: "sharedui",
|
|
4908
|
+
defaultNS: DIALOG_ALERT_I18N_NAMESPACE,
|
|
4909
|
+
interpolation: {
|
|
4910
|
+
escapeValue: false
|
|
4911
|
+
// react already safes from xss
|
|
4912
|
+
}
|
|
4913
|
+
});
|
|
4914
|
+
var i18n_default = i18n;
|
|
4915
|
+
var titleColorVariant = {
|
|
4916
|
+
default: "",
|
|
4917
|
+
success: "text-green-600",
|
|
4918
|
+
error: "text-red-600",
|
|
4919
|
+
warning: "text-yellow-600",
|
|
4920
|
+
confirm: "text-red-600",
|
|
4921
|
+
"confirm-green": "text-red-600"
|
|
4922
|
+
};
|
|
4758
4923
|
function DialogAlert({
|
|
4759
4924
|
open,
|
|
4760
4925
|
onOpenChange,
|
|
@@ -4762,7 +4927,7 @@ function DialogAlert({
|
|
|
4762
4927
|
description,
|
|
4763
4928
|
variant = "default",
|
|
4764
4929
|
confirmText,
|
|
4765
|
-
cancelText = "
|
|
4930
|
+
cancelText = "cancel",
|
|
4766
4931
|
onConfirm,
|
|
4767
4932
|
onCancel,
|
|
4768
4933
|
showCancel = true,
|
|
@@ -4771,6 +4936,7 @@ function DialogAlert({
|
|
|
4771
4936
|
persistent = false
|
|
4772
4937
|
}) {
|
|
4773
4938
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
4939
|
+
const { t } = useTranslation(DIALOG_ALERT_I18N_NAMESPACE);
|
|
4774
4940
|
const handleCancel = useCallback(() => {
|
|
4775
4941
|
onCancel?.();
|
|
4776
4942
|
onOpenChange(false);
|
|
@@ -4781,28 +4947,261 @@ function DialogAlert({
|
|
|
4781
4947
|
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
4782
4948
|
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
4783
4949
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
4784
|
-
title && /* @__PURE__ */ jsx(DialogTitle2, { className:
|
|
4785
|
-
description && /* @__PURE__ */ jsx(DialogDescription2, { children: description })
|
|
4950
|
+
title && /* @__PURE__ */ jsx(DialogTitle2, { className: titleColorVariant[variant], children: t(title) }),
|
|
4951
|
+
description && /* @__PURE__ */ jsx(DialogDescription2, { children: t(description) })
|
|
4786
4952
|
] }),
|
|
4787
4953
|
outlet && outlet,
|
|
4788
4954
|
/* @__PURE__ */ jsxs("div", { className: `flex gap-3 mt-3 ${alignClass}`, children: [
|
|
4789
|
-
showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: cancelText }),
|
|
4790
|
-
confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: confirmText })
|
|
4955
|
+
showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: t(cancelText) }),
|
|
4956
|
+
confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: t(confirmText) })
|
|
4791
4957
|
] })
|
|
4792
4958
|
] }) });
|
|
4793
4959
|
}
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4960
|
+
|
|
4961
|
+
// src/components/dialog-alert/templates/index.ts
|
|
4962
|
+
var getDialogTemplates = ({ setOpen = () => {
|
|
4963
|
+
} }) => ({
|
|
4964
|
+
"success.saved": {
|
|
4965
|
+
variant: "success",
|
|
4966
|
+
title: "success.saved.title",
|
|
4967
|
+
description: "success.saved.description",
|
|
4968
|
+
cancelText: "close"
|
|
4969
|
+
},
|
|
4970
|
+
"success.deleted": {
|
|
4971
|
+
variant: "success",
|
|
4972
|
+
title: "success.deleted.title",
|
|
4973
|
+
description: "success.deleted.description",
|
|
4974
|
+
cancelText: "close"
|
|
4975
|
+
},
|
|
4976
|
+
"success.removed": {
|
|
4977
|
+
variant: "success",
|
|
4978
|
+
title: "success.removed.title",
|
|
4979
|
+
description: "success.removed.description",
|
|
4980
|
+
cancelText: "close"
|
|
4981
|
+
},
|
|
4982
|
+
"error.api_db_error": {
|
|
4983
|
+
variant: "error",
|
|
4984
|
+
title: "error.api_db_error.title",
|
|
4985
|
+
description: "error.api_db_error.description",
|
|
4986
|
+
cancelText: "close"
|
|
4987
|
+
},
|
|
4988
|
+
"error.permission_denied": {
|
|
4989
|
+
variant: "error",
|
|
4990
|
+
title: "error.permission_denied.title",
|
|
4991
|
+
description: "error.permission_denied.description",
|
|
4992
|
+
confirmText: "error.permission_denied.confirm_text",
|
|
4993
|
+
showCancel: false,
|
|
4994
|
+
onConfirm: () => setOpen(false)
|
|
4995
|
+
},
|
|
4996
|
+
"error.session_expired": {
|
|
4997
|
+
variant: "error",
|
|
4998
|
+
title: "error.session_expired.title",
|
|
4999
|
+
description: "error.session_expired.description",
|
|
5000
|
+
confirmText: "error.session_expired.confirm_text",
|
|
5001
|
+
showCancel: false
|
|
5002
|
+
},
|
|
5003
|
+
"error.user_not_found": {
|
|
5004
|
+
variant: "error",
|
|
5005
|
+
title: "error.user_not_found.title",
|
|
5006
|
+
description: "error.user_not_found.description",
|
|
5007
|
+
confirmText: "error.user_not_found.confirm_text",
|
|
5008
|
+
showCancel: false
|
|
5009
|
+
},
|
|
5010
|
+
"error.data_not_found": {
|
|
5011
|
+
variant: "error",
|
|
5012
|
+
title: "error.data_not_found.title",
|
|
5013
|
+
description: "error.data_not_found.description",
|
|
5014
|
+
cancelText: "close"
|
|
5015
|
+
},
|
|
5016
|
+
"error.data_restrict_editing": {
|
|
5017
|
+
variant: "error",
|
|
5018
|
+
title: "error.data_restrict_editing.title",
|
|
5019
|
+
description: "error.data_restrict_editing.description",
|
|
5020
|
+
cancelText: "close"
|
|
5021
|
+
},
|
|
5022
|
+
"error.network_timeout_error": {
|
|
5023
|
+
variant: "error",
|
|
5024
|
+
title: "error.network_timeout_error.title",
|
|
5025
|
+
description: "error.network_timeout_error.description",
|
|
5026
|
+
cancelText: "close"
|
|
5027
|
+
},
|
|
5028
|
+
"error.queue_full": {
|
|
5029
|
+
variant: "error",
|
|
5030
|
+
title: "error.queue_full.title",
|
|
5031
|
+
description: "error.queue_full.description",
|
|
5032
|
+
cancelText: "close"
|
|
5033
|
+
},
|
|
5034
|
+
"error.invalid_data_format": {
|
|
5035
|
+
variant: "error",
|
|
5036
|
+
title: "error.invalid_data_format.title",
|
|
5037
|
+
description: "error.invalid_data_format.description",
|
|
5038
|
+
cancelText: "close"
|
|
5039
|
+
},
|
|
5040
|
+
"error.data_linked_to_system_data": {
|
|
5041
|
+
variant: "error",
|
|
5042
|
+
title: "error.data_linked_to_system_data.title",
|
|
5043
|
+
description: "error.data_linked_to_system_data.description",
|
|
5044
|
+
cancelText: "close"
|
|
5045
|
+
},
|
|
5046
|
+
"error.pending_workflow_conflict": {
|
|
5047
|
+
variant: "error",
|
|
5048
|
+
title: "error.pending_workflow_conflict.title",
|
|
5049
|
+
description: "error.pending_workflow_conflict.description",
|
|
5050
|
+
cancelText: "close"
|
|
5051
|
+
},
|
|
5052
|
+
"error.invalid_incomplete_data": {
|
|
5053
|
+
variant: "error",
|
|
5054
|
+
title: "error.invalid_incomplete_data.title",
|
|
5055
|
+
description: "error.invalid_incomplete_data.description",
|
|
5056
|
+
cancelText: "close"
|
|
5057
|
+
},
|
|
5058
|
+
"error.client_side_error": {
|
|
5059
|
+
variant: "error",
|
|
5060
|
+
title: "error.client_side_error.title",
|
|
5061
|
+
description: "error.client_side_error.description",
|
|
5062
|
+
cancelText: "close"
|
|
5063
|
+
},
|
|
5064
|
+
"error.system_limitation": {
|
|
5065
|
+
variant: "error",
|
|
5066
|
+
title: "error.system_limitation.title",
|
|
5067
|
+
description: "error.system_limitation.description",
|
|
5068
|
+
cancelText: "close"
|
|
5069
|
+
},
|
|
5070
|
+
"error.timeout": {
|
|
5071
|
+
variant: "error",
|
|
5072
|
+
title: "error.timeout.title",
|
|
5073
|
+
description: "error.timeout.description",
|
|
5074
|
+
cancelText: "close"
|
|
5075
|
+
},
|
|
5076
|
+
"error.duplicate_data": {
|
|
5077
|
+
variant: "error",
|
|
5078
|
+
title: "error.duplicate_data.title",
|
|
5079
|
+
description: "error.duplicate_data.description",
|
|
5080
|
+
cancelText: "close"
|
|
5081
|
+
},
|
|
5082
|
+
"error.something_went_wrong": {
|
|
5083
|
+
variant: "error",
|
|
5084
|
+
title: "error.something_went_wrong.title",
|
|
5085
|
+
description: "error.something_went_wrong.description",
|
|
5086
|
+
cancelText: "close"
|
|
5087
|
+
},
|
|
5088
|
+
"confirm.delete": {
|
|
5089
|
+
variant: "confirm",
|
|
5090
|
+
title: "confirm.delete.title",
|
|
5091
|
+
description: "confirm.delete.description",
|
|
5092
|
+
confirmText: "confirm.delete.confirm_text"
|
|
5093
|
+
},
|
|
5094
|
+
"confirm.inactive": {
|
|
5095
|
+
variant: "confirm",
|
|
5096
|
+
title: "confirm.inactive.title",
|
|
5097
|
+
description: "confirm.inactive.description",
|
|
5098
|
+
confirmText: "confirm.inactive.confirm_text"
|
|
5099
|
+
},
|
|
5100
|
+
"confirm.active": {
|
|
5101
|
+
variant: "confirm-green",
|
|
5102
|
+
title: "confirm.active.title",
|
|
5103
|
+
description: "confirm.active.description",
|
|
5104
|
+
confirmText: "confirm.active.confirm_text"
|
|
5105
|
+
},
|
|
5106
|
+
"confirm.leave_page": {
|
|
5107
|
+
variant: "confirm",
|
|
5108
|
+
title: "confirm.leave_page.title",
|
|
5109
|
+
description: "confirm.leave_page.description",
|
|
5110
|
+
confirmText: "confirm.leave_page.confirm_text"
|
|
5111
|
+
},
|
|
5112
|
+
"confirm.remove": {
|
|
5113
|
+
variant: "confirm",
|
|
5114
|
+
title: "confirm.remove.title",
|
|
5115
|
+
description: "confirm.remove.description",
|
|
5116
|
+
confirmText: "confirm.remove.confirm_text"
|
|
5117
|
+
},
|
|
5118
|
+
"confirm.logout": {
|
|
5119
|
+
variant: "confirm",
|
|
5120
|
+
title: "confirm.logout.title",
|
|
5121
|
+
description: "confirm.logout.description",
|
|
5122
|
+
confirmText: "confirm.logout.confirm_text"
|
|
4804
5123
|
}
|
|
4805
|
-
}
|
|
5124
|
+
});
|
|
5125
|
+
var useDialogAlertStore = create((set, get) => ({
|
|
5126
|
+
open: false,
|
|
5127
|
+
dialogProps: {},
|
|
5128
|
+
setOpen: (data) => set({ open: data }),
|
|
5129
|
+
setDialogProps: (data) => set({ dialogProps: data }),
|
|
5130
|
+
openDialogAlert: (payload) => {
|
|
5131
|
+
let templateVal;
|
|
5132
|
+
if (payload?.template) {
|
|
5133
|
+
templateVal = getDialogTemplates({ setOpen: get().setOpen })[payload.template];
|
|
5134
|
+
}
|
|
5135
|
+
get().setDialogProps({ ...templateVal, ...payload?.props });
|
|
5136
|
+
get().setOpen(true);
|
|
5137
|
+
},
|
|
5138
|
+
closeDialogAlert: () => {
|
|
5139
|
+
set({ open: false });
|
|
5140
|
+
}
|
|
5141
|
+
}));
|
|
5142
|
+
var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
5143
|
+
const open = useDialogAlertStore((state) => state.open);
|
|
5144
|
+
const setOpen = useDialogAlertStore((state) => state.setOpen);
|
|
5145
|
+
const dialogProps = useDialogAlertStore((state) => state.dialogProps);
|
|
5146
|
+
useEffect(() => {
|
|
5147
|
+
if (!i18nResource) {
|
|
5148
|
+
i18n_default.changeLanguage("sharedui");
|
|
5149
|
+
return;
|
|
5150
|
+
}
|
|
5151
|
+
const langs = Object.keys(i18nResource);
|
|
5152
|
+
for (const lang of langs) {
|
|
5153
|
+
i18n_default.addResourceBundle(
|
|
5154
|
+
lang,
|
|
5155
|
+
DIALOG_ALERT_I18N_NAMESPACE,
|
|
5156
|
+
i18nResource[lang][DIALOG_ALERT_I18N_NAMESPACE],
|
|
5157
|
+
false,
|
|
5158
|
+
true
|
|
5159
|
+
);
|
|
5160
|
+
}
|
|
5161
|
+
i18n_default.changeLanguage(i18nLang);
|
|
5162
|
+
}, [i18nLang, i18nResource]);
|
|
5163
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5164
|
+
children,
|
|
5165
|
+
/* @__PURE__ */ jsx(DialogAlert, { open, onOpenChange: setOpen, ...dialogProps })
|
|
5166
|
+
] });
|
|
5167
|
+
};
|
|
5168
|
+
var openDialogAlert = useDialogAlertStore.getState().openDialogAlert;
|
|
5169
|
+
var closeDialogAlert = useDialogAlertStore.getState().closeDialogAlert;
|
|
5170
|
+
var openErrorDialogAlert = (error) => {
|
|
5171
|
+
if (error instanceof Error) {
|
|
5172
|
+
openDialogAlert({ template: "error.something_went_wrong", props: { description: error.message } });
|
|
5173
|
+
} else if (error.isAxiosError) {
|
|
5174
|
+
let template = "error.something_went_wrong";
|
|
5175
|
+
switch (error.response?.status) {
|
|
5176
|
+
case 400:
|
|
5177
|
+
template = "error.invalid_incomplete_data";
|
|
5178
|
+
break;
|
|
5179
|
+
case 401:
|
|
5180
|
+
template = "error.session_expired";
|
|
5181
|
+
break;
|
|
5182
|
+
case 403:
|
|
5183
|
+
template = "error.permission_denied";
|
|
5184
|
+
break;
|
|
5185
|
+
case 404:
|
|
5186
|
+
template = "error.data_not_found";
|
|
5187
|
+
break;
|
|
5188
|
+
case 409:
|
|
5189
|
+
template = "error.duplicate_data";
|
|
5190
|
+
break;
|
|
5191
|
+
case 500:
|
|
5192
|
+
template = "error.api_db_error";
|
|
5193
|
+
break;
|
|
5194
|
+
}
|
|
5195
|
+
openDialogAlert({ template });
|
|
5196
|
+
} else {
|
|
5197
|
+
openDialogAlert({ template: "error.something_went_wrong" });
|
|
5198
|
+
}
|
|
5199
|
+
};
|
|
5200
|
+
var getDialogAlertControls = () => ({
|
|
5201
|
+
openDialogAlert,
|
|
5202
|
+
closeDialogAlert,
|
|
5203
|
+
openErrorDialogAlert
|
|
5204
|
+
});
|
|
4806
5205
|
function TooltipProvider({
|
|
4807
5206
|
delayDuration = 0,
|
|
4808
5207
|
...props
|
|
@@ -4861,7 +5260,7 @@ function SortableRow({
|
|
|
4861
5260
|
id: value,
|
|
4862
5261
|
disabled: name === "columns.0.id"
|
|
4863
5262
|
});
|
|
4864
|
-
const style =
|
|
5263
|
+
const style = React4.useMemo(
|
|
4865
5264
|
() => ({
|
|
4866
5265
|
transform: CSS.Transform.toString(transform),
|
|
4867
5266
|
transition
|
|
@@ -5203,7 +5602,7 @@ var useGridSettingsStore = create(
|
|
|
5203
5602
|
);
|
|
5204
5603
|
var useGridSettingsStore_default = useGridSettingsStore;
|
|
5205
5604
|
var ListTable = ({ onTableReady, children }) => {
|
|
5206
|
-
|
|
5605
|
+
React4.useEffect(() => {
|
|
5207
5606
|
if (onTableReady) {
|
|
5208
5607
|
onTableReady({ ready: true });
|
|
5209
5608
|
}
|
|
@@ -5307,26 +5706,48 @@ var InfoIcon = (props) => {
|
|
|
5307
5706
|
return /* @__PURE__ */ jsxs(
|
|
5308
5707
|
"svg",
|
|
5309
5708
|
{
|
|
5310
|
-
width: "
|
|
5311
|
-
height: "
|
|
5312
|
-
viewBox: "0 0
|
|
5709
|
+
width: "20",
|
|
5710
|
+
height: "20",
|
|
5711
|
+
viewBox: "0 0 20 20",
|
|
5313
5712
|
fill: "none",
|
|
5314
5713
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5315
5714
|
...props,
|
|
5316
5715
|
children: [
|
|
5317
|
-
/* @__PURE__ */ jsx("circle", { cx: "6.98438", cy: "6.63281", r: "6.25", fill: "white" }),
|
|
5318
5716
|
/* @__PURE__ */ jsx(
|
|
5319
5717
|
"path",
|
|
5320
5718
|
{
|
|
5321
|
-
d: "
|
|
5322
|
-
|
|
5719
|
+
d: "M10.0013 18.3327C14.6037 18.3327 18.3346 14.6017 18.3346 9.99935C18.3346 5.39698 14.6037 1.66602 10.0013 1.66602C5.39893 1.66602 1.66797 5.39698 1.66797 9.99935C1.66797 14.6017 5.39893 18.3327 10.0013 18.3327Z",
|
|
5720
|
+
stroke: "white",
|
|
5721
|
+
"stroke-width": "1.5",
|
|
5722
|
+
"stroke-linecap": "round",
|
|
5723
|
+
"stroke-linejoin": "round"
|
|
5724
|
+
}
|
|
5725
|
+
),
|
|
5726
|
+
/* @__PURE__ */ jsx(
|
|
5727
|
+
"path",
|
|
5728
|
+
{
|
|
5729
|
+
d: "M10 13.3333V10",
|
|
5730
|
+
stroke: "white",
|
|
5731
|
+
"stroke-width": "1.5",
|
|
5732
|
+
"stroke-linecap": "round",
|
|
5733
|
+
"stroke-linejoin": "round"
|
|
5734
|
+
}
|
|
5735
|
+
),
|
|
5736
|
+
/* @__PURE__ */ jsx(
|
|
5737
|
+
"path",
|
|
5738
|
+
{
|
|
5739
|
+
d: "M10 6.66602H10.0083",
|
|
5740
|
+
stroke: "white",
|
|
5741
|
+
"stroke-width": "1.5",
|
|
5742
|
+
"stroke-linecap": "round",
|
|
5743
|
+
"stroke-linejoin": "round"
|
|
5323
5744
|
}
|
|
5324
5745
|
)
|
|
5325
5746
|
]
|
|
5326
5747
|
}
|
|
5327
5748
|
);
|
|
5328
5749
|
};
|
|
5329
|
-
var InfoIcon_default =
|
|
5750
|
+
var InfoIcon_default = React4__default.memo(InfoIcon);
|
|
5330
5751
|
var Navbar = ({
|
|
5331
5752
|
className,
|
|
5332
5753
|
title,
|
|
@@ -5457,7 +5878,7 @@ var Navbar = ({
|
|
|
5457
5878
|
}
|
|
5458
5879
|
);
|
|
5459
5880
|
};
|
|
5460
|
-
var navbar_default =
|
|
5881
|
+
var navbar_default = React4__default.memo(Navbar);
|
|
5461
5882
|
function Sheet({ ...props }) {
|
|
5462
5883
|
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
5463
5884
|
}
|
|
@@ -6062,7 +6483,7 @@ function ToolbarPlugin({
|
|
|
6062
6483
|
isLink: hasLink
|
|
6063
6484
|
}));
|
|
6064
6485
|
}, []);
|
|
6065
|
-
|
|
6486
|
+
React4.useEffect(() => {
|
|
6066
6487
|
return mergeRegister(
|
|
6067
6488
|
editor.registerCommand(
|
|
6068
6489
|
CAN_UNDO_COMMAND,
|
|
@@ -6648,7 +7069,7 @@ function ControlledValuePlugin({
|
|
|
6648
7069
|
trackAppliedValue
|
|
6649
7070
|
}) {
|
|
6650
7071
|
const [editor] = useLexicalComposerContext();
|
|
6651
|
-
|
|
7072
|
+
React4.useEffect(() => {
|
|
6652
7073
|
if (value == null || trackAppliedValue.current === value) {
|
|
6653
7074
|
return;
|
|
6654
7075
|
}
|
|
@@ -6672,14 +7093,14 @@ function ControlledValuePlugin({
|
|
|
6672
7093
|
}
|
|
6673
7094
|
function EditableStatePlugin({ editable }) {
|
|
6674
7095
|
const [editor] = useLexicalComposerContext();
|
|
6675
|
-
|
|
7096
|
+
React4.useEffect(() => {
|
|
6676
7097
|
editor.setEditable(editable);
|
|
6677
7098
|
}, [editor, editable]);
|
|
6678
7099
|
return null;
|
|
6679
7100
|
}
|
|
6680
7101
|
function ImagesPlugin() {
|
|
6681
7102
|
const [editor] = useLexicalComposerContext();
|
|
6682
|
-
|
|
7103
|
+
React4.useEffect(() => {
|
|
6683
7104
|
return editor.registerCommand(
|
|
6684
7105
|
INSERT_IMAGE_COMMAND,
|
|
6685
7106
|
(payload) => {
|
|
@@ -6889,6 +7310,7 @@ __export(ui_exports, {
|
|
|
6889
7310
|
FormItem: () => FormItem,
|
|
6890
7311
|
FormLabel: () => FormLabel,
|
|
6891
7312
|
FormMessage: () => FormMessage,
|
|
7313
|
+
Input: () => Input,
|
|
6892
7314
|
InputPrimitive: () => InputPrimitive,
|
|
6893
7315
|
Label: () => Label2,
|
|
6894
7316
|
MonthPicker: () => MonthPicker,
|
|
@@ -6962,6 +7384,7 @@ __export(ui_exports, {
|
|
|
6962
7384
|
TooltipProvider: () => TooltipProvider2,
|
|
6963
7385
|
TooltipTrigger: () => TooltipTrigger2,
|
|
6964
7386
|
buttonVariants: () => buttonVariants,
|
|
7387
|
+
inputVariants: () => inputVariants,
|
|
6965
7388
|
spinnerVariants: () => spinnerVariants,
|
|
6966
7389
|
useFormField: () => useFormField,
|
|
6967
7390
|
useSidebar: () => useSidebar
|
|
@@ -7060,9 +7483,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
7060
7483
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
7061
7484
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
7062
7485
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
7063
|
-
var SidebarContext =
|
|
7486
|
+
var SidebarContext = React4.createContext(null);
|
|
7064
7487
|
function useSidebar() {
|
|
7065
|
-
const context =
|
|
7488
|
+
const context = React4.useContext(SidebarContext);
|
|
7066
7489
|
if (!context) {
|
|
7067
7490
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
7068
7491
|
}
|
|
@@ -7078,10 +7501,10 @@ function SidebarProvider({
|
|
|
7078
7501
|
...props
|
|
7079
7502
|
}) {
|
|
7080
7503
|
const isMobile = useIsMobile();
|
|
7081
|
-
const [openMobile, setOpenMobile] =
|
|
7082
|
-
const [_open, _setOpen] =
|
|
7504
|
+
const [openMobile, setOpenMobile] = React4.useState(false);
|
|
7505
|
+
const [_open, _setOpen] = React4.useState(defaultOpen);
|
|
7083
7506
|
const open = openProp ?? _open;
|
|
7084
|
-
const setOpen =
|
|
7507
|
+
const setOpen = React4.useCallback(
|
|
7085
7508
|
(value) => {
|
|
7086
7509
|
const openState = typeof value === "function" ? value(open) : value;
|
|
7087
7510
|
if (setOpenProp) {
|
|
@@ -7093,10 +7516,10 @@ function SidebarProvider({
|
|
|
7093
7516
|
},
|
|
7094
7517
|
[setOpenProp, open]
|
|
7095
7518
|
);
|
|
7096
|
-
const toggleSidebar =
|
|
7519
|
+
const toggleSidebar = React4.useCallback(() => {
|
|
7097
7520
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
7098
7521
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
7099
|
-
|
|
7522
|
+
React4.useEffect(() => {
|
|
7100
7523
|
const handleKeyDown = (event) => {
|
|
7101
7524
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
7102
7525
|
event.preventDefault();
|
|
@@ -7107,7 +7530,7 @@ function SidebarProvider({
|
|
|
7107
7530
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
7108
7531
|
}, [toggleSidebar]);
|
|
7109
7532
|
const state = open ? "expanded" : "collapsed";
|
|
7110
|
-
const contextValue =
|
|
7533
|
+
const contextValue = React4.useMemo(
|
|
7111
7534
|
() => ({
|
|
7112
7535
|
state,
|
|
7113
7536
|
open,
|
|
@@ -7549,7 +7972,7 @@ function SidebarMenuSkeleton({
|
|
|
7549
7972
|
showIcon = false,
|
|
7550
7973
|
...props
|
|
7551
7974
|
}) {
|
|
7552
|
-
const width =
|
|
7975
|
+
const width = React4.useMemo(() => {
|
|
7553
7976
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
7554
7977
|
}, []);
|
|
7555
7978
|
return /* @__PURE__ */ jsxs(
|
|
@@ -7689,10 +8112,38 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
|
|
|
7689
8112
|
}, "image/png");
|
|
7690
8113
|
});
|
|
7691
8114
|
}
|
|
8115
|
+
async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
|
|
8116
|
+
let svgString;
|
|
8117
|
+
const parts = imageSrc.split(",");
|
|
8118
|
+
const meta = parts[0];
|
|
8119
|
+
const data = parts[1];
|
|
8120
|
+
if (meta.includes("base64")) {
|
|
8121
|
+
svgString = atob(data);
|
|
8122
|
+
} else {
|
|
8123
|
+
svgString = decodeURIComponent(data);
|
|
8124
|
+
}
|
|
8125
|
+
const parser = new DOMParser();
|
|
8126
|
+
const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
|
|
8127
|
+
const svgElement = svgDoc.documentElement;
|
|
8128
|
+
if (svgElement.tagName.toLowerCase() !== "svg") {
|
|
8129
|
+
throw new Error("The file is not a valid SVG document root.");
|
|
8130
|
+
}
|
|
8131
|
+
const newViewBox = `${pixelCrop.x} ${pixelCrop.y} ${pixelCrop.width} ${pixelCrop.height}`;
|
|
8132
|
+
svgElement.setAttribute("viewBox", newViewBox);
|
|
8133
|
+
const outputWidth = desiredDimension?.width ?? pixelCrop.width;
|
|
8134
|
+
const outputHeight = desiredDimension?.height ?? pixelCrop.height;
|
|
8135
|
+
svgElement.setAttribute("width", String(outputWidth));
|
|
8136
|
+
svgElement.setAttribute("height", String(outputHeight));
|
|
8137
|
+
const serializer = new XMLSerializer();
|
|
8138
|
+
const croppedSvgString = serializer.serializeToString(svgElement);
|
|
8139
|
+
const blob = new Blob([croppedSvgString], { type: "image/svg+xml" });
|
|
8140
|
+
return URL.createObjectURL(blob);
|
|
8141
|
+
}
|
|
7692
8142
|
var CropperModal = ({
|
|
7693
8143
|
open,
|
|
7694
8144
|
onOpenChange,
|
|
7695
8145
|
imageSrc,
|
|
8146
|
+
isSVG,
|
|
7696
8147
|
onConfirm,
|
|
7697
8148
|
onCancel,
|
|
7698
8149
|
onError,
|
|
@@ -7734,7 +8185,7 @@ var CropperModal = ({
|
|
|
7734
8185
|
setIsLoading(true);
|
|
7735
8186
|
try {
|
|
7736
8187
|
const desiredDimension = outputExactCropSize ? cropSize : void 0;
|
|
7737
|
-
const croppedImage = await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
|
|
8188
|
+
const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
|
|
7738
8189
|
onConfirm({ crop, croppedAreaPixels, croppedImageBlobUrl: croppedImage });
|
|
7739
8190
|
} catch (e) {
|
|
7740
8191
|
if (onError) {
|
|
@@ -7799,7 +8250,7 @@ var CropperModal = ({
|
|
|
7799
8250
|
...props?.cropper
|
|
7800
8251
|
}
|
|
7801
8252
|
) }),
|
|
7802
|
-
/* @__PURE__ */ jsx("div", { className: "w-full py-4 px-8", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between", children: [
|
|
8253
|
+
/* @__PURE__ */ jsx("div", { className: "w-full py-4 px-8 min-h-10", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between", children: [
|
|
7803
8254
|
/* @__PURE__ */ jsx(Button, { type: "button", variant: "cancel", onClick: handleCancel, disabled: isLoading, children: "Cancel" }),
|
|
7804
8255
|
/* @__PURE__ */ jsx("div", { className: "ml-auto flex gap-x-2", children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "default", onClick: handleConfirm, disabled: isLoading, children: "Confirm" }) })
|
|
7805
8256
|
] }) })
|
|
@@ -7810,6 +8261,6 @@ var CropperModal = ({
|
|
|
7810
8261
|
);
|
|
7811
8262
|
};
|
|
7812
8263
|
|
|
7813
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Input, Label2 as Label, List_default as List, container_default as ListContainer, header_default as ListHeader, table_default as ListTable, LookupSelect, MonthPicker2 as MonthPicker, navbar_default as Navbar, not_found_default as NotFoundIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave_default as PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, calendar_default as SuiCalendarIcon, check_default as SuiCheckIcon, dots_vertical_default as SuiDotsVerticalIcon, empty_data_default as SuiEmptyDataIcon, expand_default as SuiExpandIcon, filter_default as SuiFilterIcon, setting_default as SuiSettingIcon, triangle_down_default as SuiTriangleDownIcon, warning_default as SuiWarningIcon, Switch, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, ui_exports as UI, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, stripNullishObject, throttle, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated };
|
|
8264
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, DIALOG_ALERT_I18N_NAMESPACE, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Input, Label2 as Label, List_default as List, container_default as ListContainer, header_default as ListHeader, table_default as ListTable, LookupSelect, MonthPicker2 as MonthPicker, navbar_default as Navbar, not_found_default as NotFoundIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave_default as PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, calendar_default as SuiCalendarIcon, check_default as SuiCheckIcon, dots_vertical_default as SuiDotsVerticalIcon, empty_data_default as SuiEmptyDataIcon, expand_default as SuiExpandIcon, filter_default as SuiFilterIcon, setting_default as SuiSettingIcon, triangle_down_default as SuiTriangleDownIcon, warning_default as SuiWarningIcon, Switch, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, ui_exports as UI, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, stripNullishObject, throttle, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated };
|
|
7814
8265
|
//# sourceMappingURL=index.mjs.map
|
|
7815
8266
|
//# sourceMappingURL=index.mjs.map
|