@mesob/ui 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.ts +4 -2
- package/dist/components.js +19 -8
- package/dist/components.js.map +1 -1
- package/package.json +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -374,11 +374,13 @@ type EntityFormActionsProps = {
|
|
|
374
374
|
isSubmitting?: boolean;
|
|
375
375
|
isDeleting?: boolean;
|
|
376
376
|
disabled?: boolean;
|
|
377
|
+
/** When set, overrides `disabled` for the delete trigger only. */
|
|
378
|
+
deleteDisabled?: boolean;
|
|
377
379
|
submitLabel?: string;
|
|
378
380
|
deleteLabel?: string;
|
|
379
381
|
itemName?: string;
|
|
380
382
|
};
|
|
381
|
-
declare function EntityFormActions({ mode, onSubmit, onReset, onDelete, onCancel, isSubmitting, isDeleting, disabled, submitLabel, deleteLabel, itemName, }: EntityFormActionsProps): react_jsx_runtime.JSX.Element;
|
|
383
|
+
declare function EntityFormActions({ mode, onSubmit, onReset, onDelete, onCancel, isSubmitting, isDeleting, disabled, deleteDisabled, submitLabel, deleteLabel, itemName, }: EntityFormActionsProps): react_jsx_runtime.JSX.Element;
|
|
382
384
|
|
|
383
385
|
type EntityHeaderProps = {
|
|
384
386
|
title: ReactNode;
|
|
@@ -2336,7 +2338,7 @@ type FileInputProps = Omit<React$1.ComponentProps<'input'>, 'type'> & Omit<Input
|
|
|
2336
2338
|
editImageOnSelect?: boolean;
|
|
2337
2339
|
imageOutputScale?: number;
|
|
2338
2340
|
};
|
|
2339
|
-
declare function FileInput({ className, onFilesChange, clearable, multiple, files: filesProp, defaultFiles, previewItems, leftSection, placeholder, cropAspect, editImageOnSelect, imageOutputScale, label, description, error, required, withAsterisk, inputWrapperOrder, labelProps, descriptionProps, errorProps, inputContainer, disabled, ...props }: FileInputProps): react_jsx_runtime.JSX.Element;
|
|
2341
|
+
declare function FileInput({ className, onFilesChange, clearable, multiple, files: filesProp, defaultFiles, previewItems, leftSection, placeholder, cropAspect, editImageOnSelect, imageOutputScale, label, description, error, required, withAsterisk, inputWrapperOrder, labelProps, descriptionProps, errorProps, inputContainer, disabled, id: inputIdProp, ...props }: FileInputProps): react_jsx_runtime.JSX.Element;
|
|
2340
2342
|
|
|
2341
2343
|
type FlexProps = React$1.ComponentProps<'div'> & {
|
|
2342
2344
|
gap?: ComponentSize | number;
|
package/dist/components.js
CHANGED
|
@@ -5019,10 +5019,12 @@ function EntityFormActions({
|
|
|
5019
5019
|
isSubmitting = false,
|
|
5020
5020
|
isDeleting = false,
|
|
5021
5021
|
disabled = false,
|
|
5022
|
+
deleteDisabled,
|
|
5022
5023
|
submitLabel,
|
|
5023
5024
|
deleteLabel = "Delete",
|
|
5024
5025
|
itemName = "item"
|
|
5025
5026
|
}) {
|
|
5027
|
+
const deleteTriggerDisabled = deleteDisabled ?? disabled;
|
|
5026
5028
|
const defaultSubmitLabel = mode === "new" ? "Create" : "Update";
|
|
5027
5029
|
const label = submitLabel || defaultSubmitLabel;
|
|
5028
5030
|
return /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
@@ -5058,7 +5060,7 @@ function EntityFormActions({
|
|
|
5058
5060
|
Button,
|
|
5059
5061
|
{
|
|
5060
5062
|
variant: "destructive",
|
|
5061
|
-
disabled,
|
|
5063
|
+
disabled: deleteTriggerDisabled,
|
|
5062
5064
|
loading: isDeleting,
|
|
5063
5065
|
className: "cursor-pointer",
|
|
5064
5066
|
leftIcon: /* @__PURE__ */ jsx44(IconTrash3, { className: "size-4" })
|
|
@@ -19577,10 +19579,12 @@ function FileInput({
|
|
|
19577
19579
|
errorProps,
|
|
19578
19580
|
inputContainer,
|
|
19579
19581
|
disabled,
|
|
19582
|
+
id: inputIdProp,
|
|
19580
19583
|
...props
|
|
19581
19584
|
}) {
|
|
19582
19585
|
const inputRef = useRef20(null);
|
|
19583
|
-
const
|
|
19586
|
+
const generatedInputId = useId7();
|
|
19587
|
+
const inputId = inputIdProp ?? generatedInputId;
|
|
19584
19588
|
const [internalFiles, setInternalFiles] = useState45(defaultFiles);
|
|
19585
19589
|
const [pendingCropFile, setPendingCropFile] = useState45(null);
|
|
19586
19590
|
const [cropOpen, setCropOpen] = useState45(false);
|
|
@@ -19632,7 +19636,14 @@ function FileInput({
|
|
|
19632
19636
|
const hasWrapper = label || description || error || required || withAsterisk;
|
|
19633
19637
|
const RootIcon = singleItem ? getFileIcon2(singleItem.type) : IconPaperclip;
|
|
19634
19638
|
let metaContent = null;
|
|
19635
|
-
if (items.length >
|
|
19639
|
+
if (multiple && items.length > 0) {
|
|
19640
|
+
metaContent = /* @__PURE__ */ jsxs95("div", { "data-slot": "file-input-meta", className: "cn-file-input-meta", children: [
|
|
19641
|
+
items.length,
|
|
19642
|
+
" file",
|
|
19643
|
+
items.length === 1 ? "" : "s",
|
|
19644
|
+
" selected"
|
|
19645
|
+
] });
|
|
19646
|
+
} else if (!multiple && items.length > 1) {
|
|
19636
19647
|
metaContent = /* @__PURE__ */ jsxs95("div", { "data-slot": "file-input-meta", className: "cn-file-input-meta", children: [
|
|
19637
19648
|
items.length,
|
|
19638
19649
|
" files selected"
|
|
@@ -19666,13 +19677,11 @@ function FileInput({
|
|
|
19666
19677
|
}
|
|
19667
19678
|
),
|
|
19668
19679
|
/* @__PURE__ */ jsx155(
|
|
19669
|
-
"
|
|
19680
|
+
"label",
|
|
19670
19681
|
{
|
|
19671
|
-
|
|
19682
|
+
htmlFor: inputId,
|
|
19672
19683
|
"data-slot": "file-input-root",
|
|
19673
19684
|
className: "cn-file-input-root",
|
|
19674
|
-
onClick: () => inputRef.current?.click(),
|
|
19675
|
-
disabled,
|
|
19676
19685
|
children: singleItem ? /* @__PURE__ */ jsxs95(Fragment29, { children: [
|
|
19677
19686
|
/* @__PURE__ */ jsx155(
|
|
19678
19687
|
"div",
|
|
@@ -19712,6 +19721,7 @@ function FileInput({
|
|
|
19712
19721
|
variant: "ghost",
|
|
19713
19722
|
size: "icon-sm",
|
|
19714
19723
|
onClick: (event) => {
|
|
19724
|
+
event.preventDefault();
|
|
19715
19725
|
event.stopPropagation();
|
|
19716
19726
|
handleEdit();
|
|
19717
19727
|
},
|
|
@@ -19727,6 +19737,7 @@ function FileInput({
|
|
|
19727
19737
|
variant: "ghost",
|
|
19728
19738
|
size: "icon-sm",
|
|
19729
19739
|
onClick: (event) => {
|
|
19740
|
+
event.preventDefault();
|
|
19730
19741
|
event.stopPropagation();
|
|
19731
19742
|
handleClear();
|
|
19732
19743
|
},
|
|
@@ -19769,7 +19780,7 @@ function FileInput({
|
|
|
19769
19780
|
] })
|
|
19770
19781
|
}
|
|
19771
19782
|
),
|
|
19772
|
-
!singleItem && items.length > 1 ? /* @__PURE__ */ jsx155("div", { "data-slot": "file-input-list", className: "cn-file-input-list", children: items.map((item) => {
|
|
19783
|
+
!singleItem && (multiple ? items.length > 0 : items.length > 1) ? /* @__PURE__ */ jsx155("div", { "data-slot": "file-input-list", className: "cn-file-input-list", children: items.map((item) => {
|
|
19773
19784
|
const ItemIcon = getFileIcon2(item.type);
|
|
19774
19785
|
return /* @__PURE__ */ jsxs95(
|
|
19775
19786
|
"div",
|