@sustaina/shared-ui 1.23.0 → 1.24.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 +41 -10
- package/dist/index.d.ts +41 -10
- package/dist/index.js +178 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ 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
20
|
import i18n from 'i18next';
|
|
21
|
-
import { initReactI18next
|
|
21
|
+
import { initReactI18next } from 'react-i18next';
|
|
22
22
|
import { create } from 'zustand';
|
|
23
23
|
import StarterKit from '@tiptap/starter-kit';
|
|
24
24
|
import { ReactNodeViewRenderer, NodeViewWrapper, useEditor, EditorContent } from '@tiptap/react';
|
|
@@ -57,6 +57,7 @@ import { $setBlocksType } from '@lexical/selection';
|
|
|
57
57
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
58
58
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
59
59
|
import Cropper from 'react-easy-crop';
|
|
60
|
+
import { NumericFormat } from 'react-number-format';
|
|
60
61
|
|
|
61
62
|
var __defProp = Object.defineProperty;
|
|
62
63
|
var __export = (target, all) => {
|
|
@@ -5070,17 +5071,17 @@ var defaultResource = {
|
|
|
5070
5071
|
};
|
|
5071
5072
|
|
|
5072
5073
|
// src/components/dialog-alert/locale/i18n.ts
|
|
5073
|
-
i18n.
|
|
5074
|
+
var instance = i18n.createInstance({
|
|
5074
5075
|
resources: defaultResource,
|
|
5075
5076
|
lng: "sharedui",
|
|
5076
5077
|
fallbackLng: "sharedui",
|
|
5077
5078
|
defaultNS: "translation",
|
|
5078
5079
|
interpolation: {
|
|
5079
5080
|
escapeValue: false
|
|
5080
|
-
// react already safes from xss
|
|
5081
5081
|
}
|
|
5082
|
-
});
|
|
5083
|
-
|
|
5082
|
+
}).use(initReactI18next);
|
|
5083
|
+
instance.init();
|
|
5084
|
+
var i18n_default = instance;
|
|
5084
5085
|
var titleColorVariant = {
|
|
5085
5086
|
default: "",
|
|
5086
5087
|
success: "text-green-600",
|
|
@@ -5096,7 +5097,7 @@ function DialogAlert({
|
|
|
5096
5097
|
description,
|
|
5097
5098
|
variant = "default",
|
|
5098
5099
|
confirmText,
|
|
5099
|
-
cancelText = "cancel",
|
|
5100
|
+
cancelText = i18nPrefix + "cancel",
|
|
5100
5101
|
onConfirm,
|
|
5101
5102
|
onCancel,
|
|
5102
5103
|
showCancel = true,
|
|
@@ -5105,7 +5106,6 @@ function DialogAlert({
|
|
|
5105
5106
|
persistent = false
|
|
5106
5107
|
}) {
|
|
5107
5108
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
5108
|
-
const { t } = useTranslation();
|
|
5109
5109
|
const handleCancel = useCallback(() => {
|
|
5110
5110
|
onCancel?.();
|
|
5111
5111
|
onOpenChange(false);
|
|
@@ -5117,13 +5117,13 @@ function DialogAlert({
|
|
|
5117
5117
|
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5118
5118
|
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5119
5119
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
5120
|
-
title && /* @__PURE__ */ jsx(DialogTitle2, { className: titleColorVariant[variant], children: t(title) }),
|
|
5121
|
-
description && /* @__PURE__ */ jsx(DialogDescription2, { children: t(description) })
|
|
5120
|
+
title && /* @__PURE__ */ jsx(DialogTitle2, { className: titleColorVariant[variant], children: i18n_default.t(title) }),
|
|
5121
|
+
description && /* @__PURE__ */ jsx(DialogDescription2, { children: i18n_default.t(description) })
|
|
5122
5122
|
] }),
|
|
5123
5123
|
outlet && outlet,
|
|
5124
5124
|
/* @__PURE__ */ jsxs("div", { className: `flex gap-3 mt-3 ${alignClass}`, children: [
|
|
5125
|
-
showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: t(cancelText) }),
|
|
5126
|
-
confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: t(confirmText) })
|
|
5125
|
+
showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: i18n_default.t(cancelText) }),
|
|
5126
|
+
confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: i18n_default.t(confirmText) })
|
|
5127
5127
|
] })
|
|
5128
5128
|
] }) });
|
|
5129
5129
|
}
|
|
@@ -9738,7 +9738,174 @@ var Truncated = ({ children, className, ellipsis = true, as = "p", style }) => {
|
|
|
9738
9738
|
);
|
|
9739
9739
|
};
|
|
9740
9740
|
var truncated_default = Truncated;
|
|
9741
|
+
var InputPrimitive2 = React4.forwardRef(
|
|
9742
|
+
({ className, type = "text", ...props }, ref) => {
|
|
9743
|
+
return /* @__PURE__ */ jsx(
|
|
9744
|
+
"input",
|
|
9745
|
+
{
|
|
9746
|
+
ref,
|
|
9747
|
+
type,
|
|
9748
|
+
className: cn(
|
|
9749
|
+
"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",
|
|
9750
|
+
className
|
|
9751
|
+
),
|
|
9752
|
+
...props
|
|
9753
|
+
}
|
|
9754
|
+
);
|
|
9755
|
+
}
|
|
9756
|
+
);
|
|
9757
|
+
InputPrimitive2.displayName = "InputPrimitive";
|
|
9758
|
+
var inputVariants2 = cva("", {
|
|
9759
|
+
variants: {
|
|
9760
|
+
controlSize: {
|
|
9761
|
+
sm: "h-9 rounded-md px-3 text-sm",
|
|
9762
|
+
md: "h-10 rounded-lg px-4 text-sm",
|
|
9763
|
+
lg: "h-12 rounded-xl px-5 text-base"
|
|
9764
|
+
},
|
|
9765
|
+
fullWidth: {
|
|
9766
|
+
true: "w-full",
|
|
9767
|
+
false: "w-auto"
|
|
9768
|
+
},
|
|
9769
|
+
appearance: {
|
|
9770
|
+
filled: "border-neutral-200 hover:border-neutral-500 focus-visible:border-neutral-900",
|
|
9771
|
+
unfilled: "bg-white border-neutral-300 hover:border-neutral-500 focus-visible:border-neutral-900"
|
|
9772
|
+
}
|
|
9773
|
+
},
|
|
9774
|
+
defaultVariants: {
|
|
9775
|
+
controlSize: "sm",
|
|
9776
|
+
fullWidth: true,
|
|
9777
|
+
appearance: "filled"
|
|
9778
|
+
}
|
|
9779
|
+
});
|
|
9780
|
+
var Input2 = React4.forwardRef(
|
|
9781
|
+
({
|
|
9782
|
+
className,
|
|
9783
|
+
wrapperClassName,
|
|
9784
|
+
controlSize,
|
|
9785
|
+
fullWidth,
|
|
9786
|
+
appearance,
|
|
9787
|
+
addonPrefix,
|
|
9788
|
+
addonPrefixProps,
|
|
9789
|
+
prefixInteractive,
|
|
9790
|
+
addonSuffix,
|
|
9791
|
+
addonSuffixProps,
|
|
9792
|
+
suffixInteractive,
|
|
9793
|
+
invalid,
|
|
9794
|
+
loading,
|
|
9795
|
+
loadingIcon,
|
|
9796
|
+
validationMessage,
|
|
9797
|
+
validationIcon,
|
|
9798
|
+
validationMessageProps,
|
|
9799
|
+
onValueChange,
|
|
9800
|
+
type = "text",
|
|
9801
|
+
...rest
|
|
9802
|
+
}, ref) => {
|
|
9803
|
+
const inputProps = rest;
|
|
9804
|
+
const hasPrefix = Boolean(addonPrefix);
|
|
9805
|
+
const hasSuffix = Boolean(addonSuffix) || loading;
|
|
9806
|
+
const isFullWidth = fullWidth ?? true;
|
|
9807
|
+
const {
|
|
9808
|
+
"aria-invalid": ariaInvalidProp,
|
|
9809
|
+
"aria-describedby": ariaDescribedByProp,
|
|
9810
|
+
onChange: onChangeProp
|
|
9811
|
+
} = rest;
|
|
9812
|
+
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
9813
|
+
const messageId = React4.useId();
|
|
9814
|
+
const handleChange = React4.useCallback(
|
|
9815
|
+
(event) => {
|
|
9816
|
+
onChangeProp?.(event);
|
|
9817
|
+
onValueChange?.(event.target.value);
|
|
9818
|
+
},
|
|
9819
|
+
[onChangeProp, onValueChange]
|
|
9820
|
+
);
|
|
9821
|
+
const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
|
|
9822
|
+
const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
|
|
9823
|
+
const controlWrapperClassName = cn(
|
|
9824
|
+
"relative inline-flex items-center",
|
|
9825
|
+
isFullWidth ? "w-full" : "w-fit",
|
|
9826
|
+
!validationMessage && wrapperClassName
|
|
9827
|
+
);
|
|
9828
|
+
const inputElement = /* @__PURE__ */ jsx(
|
|
9829
|
+
InputPrimitive2,
|
|
9830
|
+
{
|
|
9831
|
+
ref,
|
|
9832
|
+
type,
|
|
9833
|
+
"data-slot": "input",
|
|
9834
|
+
className: cn(
|
|
9835
|
+
inputVariants2({ controlSize, fullWidth: isFullWidth, appearance }),
|
|
9836
|
+
hasPrefix && "pl-10",
|
|
9837
|
+
hasSuffix && "pr-10",
|
|
9838
|
+
className
|
|
9839
|
+
),
|
|
9840
|
+
"aria-invalid": resolvedAriaInvalid,
|
|
9841
|
+
"aria-describedby": describedBy || void 0,
|
|
9842
|
+
onChange: handleChange,
|
|
9843
|
+
...inputProps
|
|
9844
|
+
}
|
|
9845
|
+
);
|
|
9846
|
+
if (!hasPrefix && !hasSuffix && !validationMessage) {
|
|
9847
|
+
return inputElement;
|
|
9848
|
+
}
|
|
9849
|
+
const { className: prefixClassName, ...prefixRest } = addonPrefixProps ?? {};
|
|
9850
|
+
const { className: suffixClassName, ...suffixRest } = addonSuffixProps ?? {};
|
|
9851
|
+
const { className: validationMessageClassName, ...validationMessageRest } = validationMessageProps ?? {};
|
|
9852
|
+
const suffixContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9853
|
+
addonSuffix,
|
|
9854
|
+
loading && (loadingIcon ?? /* @__PURE__ */ jsx(Spinner, { size: 16, variant: "muted" }))
|
|
9855
|
+
] });
|
|
9856
|
+
const inputWithAffixes = /* @__PURE__ */ jsxs("div", { "data-slot": "input-wrapper", className: controlWrapperClassName, children: [
|
|
9857
|
+
hasPrefix && /* @__PURE__ */ jsx(
|
|
9858
|
+
"span",
|
|
9859
|
+
{
|
|
9860
|
+
...prefixRest,
|
|
9861
|
+
className: cn(
|
|
9862
|
+
"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
|
|
9863
|
+
!prefixInteractive && "pointer-events-none",
|
|
9864
|
+
prefixClassName
|
|
9865
|
+
),
|
|
9866
|
+
children: addonPrefix
|
|
9867
|
+
}
|
|
9868
|
+
),
|
|
9869
|
+
inputElement,
|
|
9870
|
+
hasSuffix && /* @__PURE__ */ jsx(
|
|
9871
|
+
"span",
|
|
9872
|
+
{
|
|
9873
|
+
...suffixRest,
|
|
9874
|
+
className: cn(
|
|
9875
|
+
"absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
|
|
9876
|
+
!suffixInteractive && "pointer-events-none",
|
|
9877
|
+
suffixClassName
|
|
9878
|
+
),
|
|
9879
|
+
children: suffixContent
|
|
9880
|
+
}
|
|
9881
|
+
)
|
|
9882
|
+
] });
|
|
9883
|
+
if (!validationMessage) {
|
|
9884
|
+
return inputWithAffixes;
|
|
9885
|
+
}
|
|
9886
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", isFullWidth ? "w-full" : "w-fit", wrapperClassName), children: [
|
|
9887
|
+
inputWithAffixes,
|
|
9888
|
+
/* @__PURE__ */ jsxs(
|
|
9889
|
+
"p",
|
|
9890
|
+
{
|
|
9891
|
+
id: messageId,
|
|
9892
|
+
...validationMessageRest,
|
|
9893
|
+
className: cn("flex items-center gap-2 text-sm text-destructive", validationMessageClassName),
|
|
9894
|
+
children: [
|
|
9895
|
+
validationIcon ?? /* @__PURE__ */ jsx(CircleX, { className: "size-4" }),
|
|
9896
|
+
/* @__PURE__ */ jsx("span", { children: validationMessage })
|
|
9897
|
+
]
|
|
9898
|
+
}
|
|
9899
|
+
)
|
|
9900
|
+
] });
|
|
9901
|
+
}
|
|
9902
|
+
);
|
|
9903
|
+
Input2.displayName = "Input";
|
|
9904
|
+
var InputNumber = ({ customInputProps, ...props }) => {
|
|
9905
|
+
return /* @__PURE__ */ jsx(NumericFormat, { customInput: Input2, ...props, ...customInputProps });
|
|
9906
|
+
};
|
|
9907
|
+
var InputNumber_default = InputNumber;
|
|
9741
9908
|
|
|
9742
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, CropperModalError, DIALOG_ALERT_I18N_SUBNAMESPACE, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Image2 as Image, 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, Spinner, 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, truncated_default as Truncated, ui_exports as UI, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, 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, validateTokenPrefixes };
|
|
9909
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, CropperModalError, DIALOG_ALERT_I18N_SUBNAMESPACE, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Image2 as Image, Input, InputNumber_default as InputNumber, 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, Spinner, 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, truncated_default as Truncated, ui_exports as UI, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, 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, validateTokenPrefixes };
|
|
9743
9910
|
//# sourceMappingURL=index.mjs.map
|
|
9744
9911
|
//# sourceMappingURL=index.mjs.map
|