@solostylist/ui-kit 1.0.200 → 1.0.201
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/{Select-80JhW337.js → Select-D2l9rDWL.js} +1594 -1594
- package/dist/entries/core.d.ts +13 -13
- package/dist/entries/core.js +109 -110
- package/dist/main.js +175 -176
- package/dist/s-date-picker/s-date-picker.js +1 -1
- package/dist/s-datetime-picker/s-datetime-picker.js +1 -1
- package/dist/s-link/index.d.ts +2 -0
- package/dist/s-link/index.js +4 -0
- package/dist/{s-button-link/s-button-link.d.ts → s-link/s-link.d.ts} +5 -5
- package/dist/s-link/s-link.js +37 -0
- package/dist/s-text-editor/s-text-editor-toolbar.js +1 -1
- package/dist/s-theme-provider/s-theme-provider.js +24 -35
- package/dist/s-tool-bar/index.d.ts +2 -0
- package/dist/s-tool-bar/index.js +4 -0
- package/dist/{s-ai-tool-bar/s-ai-tool-bar.d.ts → s-tool-bar/s-tool-bar.d.ts} +23 -30
- package/dist/s-tool-bar/s-tool-bar.js +478 -0
- package/dist/theme/components/accordion-details.d.ts +8 -0
- package/dist/theme/components/accordion-details.js +8 -0
- package/dist/theme/components/accordion-summary.d.ts +1033 -0
- package/dist/theme/components/accordion-summary.js +17 -0
- package/dist/theme/components/accordion.d.ts +35 -0
- package/dist/theme/components/accordion.js +32 -0
- package/dist/theme/components/app-bar.d.ts +24 -0
- package/dist/theme/components/app-bar.js +18 -0
- package/dist/theme/components/autocomplete.d.ts +31 -0
- package/dist/theme/components/autocomplete.js +30 -0
- package/dist/theme/components/button-base.d.ts +12 -0
- package/dist/theme/components/button-base.js +15 -0
- package/dist/theme/components/card-actions.d.ts +7 -0
- package/dist/theme/components/card-actions.js +10 -0
- package/dist/theme/components/card-content.d.ts +7 -0
- package/dist/theme/components/card-content.js +11 -0
- package/dist/theme/components/card-header.d.ts +7 -0
- package/dist/theme/components/card-header.js +10 -0
- package/dist/theme/components/card.d.ts +2046 -0
- package/dist/theme/components/card.js +35 -0
- package/dist/theme/components/checkbox.d.ts +1046 -0
- package/dist/theme/components/checkbox.js +65 -0
- package/dist/theme/components/components.js +112 -30
- package/dist/theme/components/dialog-actions.d.ts +12 -0
- package/dist/theme/components/dialog-actions.js +10 -0
- package/dist/theme/components/dialog.d.ts +19 -0
- package/dist/theme/components/dialog.js +17 -0
- package/dist/theme/components/drawer.d.ts +12 -0
- package/dist/theme/components/drawer.js +10 -0
- package/dist/theme/components/form-label.d.ts +17 -0
- package/dist/theme/components/form-label.js +11 -0
- package/dist/theme/components/icon.d.ts +17 -0
- package/dist/theme/components/icon.js +22 -0
- package/dist/theme/components/input-adornment.d.ts +1027 -0
- package/dist/theme/components/input-adornment.js +13 -0
- package/dist/theme/components/input-base.d.ts +18 -0
- package/dist/theme/components/input-base.js +16 -0
- package/dist/theme/components/linear-progress.d.ts +1023 -0
- package/dist/theme/components/linear-progress.js +16 -0
- package/dist/theme/components/link.d.ts +42 -0
- package/dist/theme/components/link.js +38 -0
- package/dist/theme/components/list-item-button.d.ts +155 -0
- package/dist/theme/components/list-item-button.js +44 -0
- package/dist/theme/components/list-item-icon.d.ts +7 -0
- package/dist/theme/components/list-item-icon.js +10 -0
- package/dist/theme/components/list-item-text.d.ts +22 -0
- package/dist/theme/components/list-item-text.js +16 -0
- package/dist/theme/components/list-item.d.ts +92 -0
- package/dist/theme/components/list-item.js +20 -0
- package/dist/theme/components/list-subheader.d.ts +20 -0
- package/dist/theme/components/list-subheader.js +14 -0
- package/dist/theme/components/list.d.ts +10 -0
- package/dist/theme/components/list.js +13 -0
- package/dist/theme/components/menu-item.d.ts +8 -0
- package/dist/theme/components/menu-item.js +8 -0
- package/dist/theme/components/menu.d.ts +20 -0
- package/dist/theme/components/menu.js +23 -0
- package/dist/theme/components/outlined-input.d.ts +81 -0
- package/dist/theme/components/outlined-input.js +64 -0
- package/dist/theme/components/pagination-item.d.ts +1028 -0
- package/dist/theme/components/pagination-item.js +18 -0
- package/dist/theme/components/paper.d.ts +5 -0
- package/dist/theme/components/paper.js +8 -0
- package/dist/theme/components/select.d.ts +7 -0
- package/dist/theme/components/select.js +13 -0
- package/dist/theme/components/step-connector.d.ts +15 -0
- package/dist/theme/components/step-connector.js +13 -0
- package/dist/theme/components/step-icon.d.ts +1043 -0
- package/dist/theme/components/step-icon.js +46 -0
- package/dist/theme/components/step-label.d.ts +1025 -0
- package/dist/theme/components/step-label.js +13 -0
- package/dist/theme/components/tab.d.ts +1031 -0
- package/dist/theme/components/tab.js +34 -0
- package/dist/theme/components/table-cell.d.ts +12 -0
- package/dist/theme/components/table-cell.js +10 -0
- package/dist/theme/components/table-pagination.d.ts +14 -0
- package/dist/theme/components/table-pagination.js +18 -0
- package/dist/theme/components/tabs.d.ts +1046 -0
- package/dist/theme/components/tabs.js +24 -0
- package/dist/theme/components/toggle-button-group.d.ts +1024 -0
- package/dist/theme/components/toggle-button-group.js +23 -0
- package/dist/theme/components/toggle-button.d.ts +1027 -0
- package/dist/theme/components/toggle-button.js +21 -0
- package/dist/{useMobilePicker-DVnEuXv1.js → useMobilePicker-B-bNHHXB.js} +1 -1
- package/package.json +1 -1
- package/dist/s-ai-tool-bar/index.d.ts +0 -2
- package/dist/s-ai-tool-bar/index.js +0 -5
- package/dist/s-ai-tool-bar/s-ai-tool-bar.js +0 -481
- package/dist/s-button-link/index.d.ts +0 -2
- package/dist/s-button-link/index.js +0 -4
- package/dist/s-button-link/s-button-link.js +0 -37
- package/dist/theme/customizations/data-display.d.ts +0 -2
- package/dist/theme/customizations/data-display.js +0 -142
- package/dist/theme/customizations/feedback.d.ts +0 -2
- package/dist/theme/customizations/feedback.js +0 -39
- package/dist/theme/customizations/inputs.d.ts +0 -2
- package/dist/theme/customizations/inputs.js +0 -230
- package/dist/theme/customizations/navigation.d.ts +0 -2
- package/dist/theme/customizations/navigation.js +0 -226
- package/dist/theme/customizations/surfaces.d.ts +0 -2
- package/dist/theme/customizations/surfaces.js +0 -111
|
@@ -2,38 +2,31 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { CheckboxProps, SelectProps, SliderProps, TextFieldProps } from '@mui/material';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
4
|
/**
|
|
5
|
-
* Possible value types for
|
|
5
|
+
* Possible value types for SToolBar inputs
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type SToolBarValue = string | number | boolean | File | (string | File)[] | null;
|
|
8
8
|
/**
|
|
9
9
|
* Base type constraint for select options
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
11
|
+
export type SToolBarOption = string | number | Record<string, unknown>;
|
|
12
12
|
/**
|
|
13
|
-
* Supported input types for
|
|
13
|
+
* Supported input types for SToolBar
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
16
|
-
TEXTAREA = "textarea",
|
|
17
|
-
SLIDER = "slider",
|
|
18
|
-
IMAGE = "image",
|
|
19
|
-
NUMBER = "number",
|
|
20
|
-
SELECT = "select",
|
|
21
|
-
CHECKBOX = "checkbox"
|
|
22
|
-
}
|
|
15
|
+
export type SToolBarInputType = 'textarea' | 'slider' | 'image' | 'number' | 'select' | 'checkbox';
|
|
23
16
|
/**
|
|
24
17
|
* Configuration for individual toolbar input fields
|
|
25
18
|
*/
|
|
26
|
-
export interface
|
|
19
|
+
export interface SToolBarInput {
|
|
27
20
|
/** Unique identifier for the input */
|
|
28
21
|
key: string;
|
|
29
22
|
/** Display label for the input */
|
|
30
23
|
label: string;
|
|
31
24
|
/** Input type */
|
|
32
|
-
type:
|
|
25
|
+
type: SToolBarInputType;
|
|
33
26
|
/** Whether the input is required */
|
|
34
27
|
required?: boolean;
|
|
35
28
|
/** Default value for the input */
|
|
36
|
-
defaultValue?:
|
|
29
|
+
defaultValue?: SToolBarValue;
|
|
37
30
|
/** Placeholder text (for textarea/number/select inputs) */
|
|
38
31
|
placeholder?: string;
|
|
39
32
|
/** Minimum value (for slider/number inputs) */
|
|
@@ -51,7 +44,7 @@ export interface SAiToolBarInput {
|
|
|
51
44
|
/** Maximum number of images (for image inputs with multiple=true) */
|
|
52
45
|
maxImages?: number;
|
|
53
46
|
/** Select options (for select inputs) */
|
|
54
|
-
options?:
|
|
47
|
+
options?: SToolBarOption[];
|
|
55
48
|
/** Key to extract label from option objects (for select inputs) */
|
|
56
49
|
optionLabel?: string;
|
|
57
50
|
/** Key to extract value from option objects (for select inputs) */
|
|
@@ -71,11 +64,11 @@ export interface SAiToolBarInput {
|
|
|
71
64
|
*
|
|
72
65
|
* Only the props relevant to the current `type` are used.
|
|
73
66
|
*/
|
|
74
|
-
componentProps?:
|
|
67
|
+
componentProps?: SToolBarComponentProps;
|
|
75
68
|
/** Custom renderer for the input */
|
|
76
69
|
renderInput?: (props: {
|
|
77
|
-
value:
|
|
78
|
-
onChange: (value:
|
|
70
|
+
value: SToolBarValue;
|
|
71
|
+
onChange: (value: SToolBarValue) => void;
|
|
79
72
|
onFocus: () => void;
|
|
80
73
|
onBlur: () => void;
|
|
81
74
|
disabled?: boolean;
|
|
@@ -83,9 +76,9 @@ export interface SAiToolBarInput {
|
|
|
83
76
|
}
|
|
84
77
|
/**
|
|
85
78
|
* Per-type overrides forwarded to the underlying child components.
|
|
86
|
-
* Omit props that are already managed by
|
|
79
|
+
* Omit props that are already managed by SToolBar to avoid conflicts.
|
|
87
80
|
*/
|
|
88
|
-
export interface
|
|
81
|
+
export interface SToolBarComponentProps {
|
|
89
82
|
/** Extra props for the MUI TextField used in `textarea` inputs */
|
|
90
83
|
textarea?: Omit<TextFieldProps, 'value' | 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'multiline' | 'minRows' | 'maxRows' | 'fullWidth' | 'placeholder'>;
|
|
91
84
|
/** Extra props for the MUI TextField used in `number` inputs */
|
|
@@ -105,7 +98,7 @@ export interface SAiToolBarComponentProps {
|
|
|
105
98
|
/** HTML id attribute for the select element */
|
|
106
99
|
htmlFor?: string;
|
|
107
100
|
/** Custom render function for dropdown options */
|
|
108
|
-
renderOption?: (option:
|
|
101
|
+
renderOption?: (option: SToolBarOption) => React.ReactNode;
|
|
109
102
|
};
|
|
110
103
|
/** Extra props for the MUI Checkbox used in `checkbox` inputs */
|
|
111
104
|
checkbox?: Omit<CheckboxProps, 'checked' | 'onChange' | 'onFocus' | 'onBlur' | 'disabled'>;
|
|
@@ -113,11 +106,11 @@ export interface SAiToolBarComponentProps {
|
|
|
113
106
|
image?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'ref' | 'type' | 'multiple' | 'onChange' | 'disabled' | 'style'>;
|
|
114
107
|
}
|
|
115
108
|
/**
|
|
116
|
-
* Props interface for
|
|
109
|
+
* Props interface for SToolBar component
|
|
117
110
|
*/
|
|
118
|
-
export interface
|
|
111
|
+
export interface SToolBarProps {
|
|
119
112
|
/** Configuration for input fields */
|
|
120
|
-
inputs?:
|
|
113
|
+
inputs?: SToolBarInput[];
|
|
121
114
|
/** Callback when process button is clicked */
|
|
122
115
|
onProcess?: () => void;
|
|
123
116
|
/** Callback when reset button is clicked */
|
|
@@ -129,9 +122,9 @@ export interface SAiToolBarProps {
|
|
|
129
122
|
/** Whether the toolbar is in uploading state */
|
|
130
123
|
uploading?: boolean;
|
|
131
124
|
/** Input values controlled externally */
|
|
132
|
-
inputValues?: Record<string,
|
|
125
|
+
inputValues?: Record<string, SToolBarValue>;
|
|
133
126
|
/** Callback when input values change */
|
|
134
|
-
onInputChange?: (key: string, value:
|
|
127
|
+
onInputChange?: (key: string, value: SToolBarValue, file?: File) => void;
|
|
135
128
|
/** Custom action buttons between inputs and standard actions */
|
|
136
129
|
customActionButtons?: React.ReactNode;
|
|
137
130
|
/** Hide the main process button */
|
|
@@ -165,8 +158,8 @@ export interface SAiToolBarProps {
|
|
|
165
158
|
* A dynamic floating toolbar for AI tools with inputs and action buttons.
|
|
166
159
|
* Features multiple input types, built-in validation, and portal rendering for proper z-index handling.
|
|
167
160
|
*/
|
|
168
|
-
export declare const
|
|
169
|
-
({ inputs, onProcess, onReset, onDownload, processing, uploading, inputValues, onInputChange, customActionButtons, hideProcessButton, processButtonDisabled, getInputDisabled, processTooltip, downloadTooltip, resetTooltip, infoTooltip, infoTitle, infoContent, position, relative, containerSx, sx, }:
|
|
161
|
+
export declare const SToolBar: {
|
|
162
|
+
({ inputs, onProcess, onReset, onDownload, processing, uploading, inputValues, onInputChange, customActionButtons, hideProcessButton, processButtonDisabled, getInputDisabled, processTooltip, downloadTooltip, resetTooltip, infoTooltip, infoTitle, infoContent, position, relative, containerSx, sx, }: SToolBarProps): React.JSX.Element;
|
|
170
163
|
displayName: string;
|
|
171
164
|
};
|
|
172
|
-
export default
|
|
165
|
+
export default SToolBar;
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { j as e } from "../jsx-runtime-tc70JA_2.js";
|
|
2
|
+
import u, { useEffect as J, useState as K, useMemo as q, useCallback as b } from "react";
|
|
3
|
+
import { c as P } from "../createSvgIcon-BkbeLOhM.js";
|
|
4
|
+
import { C as Q } from "../Close-lHCUMitI.js";
|
|
5
|
+
import { D as Y } from "../Download-BoRQUwCf.js";
|
|
6
|
+
import { TextField as H, Typography as Z, Box as r, Slider as ee, IconButton as w, Checkbox as te, Divider as le, Tooltip as R, Dialog as se, DialogTitle as ne, DialogContent as oe } from "@mui/material";
|
|
7
|
+
import { createPortal as re } from "react-dom";
|
|
8
|
+
import { SSelect as ae } from "../s-select/s-select.js";
|
|
9
|
+
const ce = P(/* @__PURE__ */ e.jsx("path", {
|
|
10
|
+
d: "M19 7v2.99s-1.99.01-2 0V7h-3s.01-1.99 0-2h3V2h2v3h3v2zm-3 4V8h-3V5H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-8zM5 19l3-4 2 3 3-4 4 5z"
|
|
11
|
+
}), "AddPhotoAlternate"), ie = P(/* @__PURE__ */ e.jsx("path", {
|
|
12
|
+
d: "m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25z"
|
|
13
|
+
}), "AutoAwesome"), de = P(/* @__PURE__ */ e.jsx("path", {
|
|
14
|
+
d: "M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"
|
|
15
|
+
}), "Autorenew"), xe = P(/* @__PURE__ */ e.jsx("path", {
|
|
16
|
+
d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
|
|
17
|
+
}), "InfoOutlined"), he = u.memo(({ input: t, value: s, onChange: i, onFocus: n, onBlur: h, disabled: c }) => /* @__PURE__ */ e.jsx(
|
|
18
|
+
H,
|
|
19
|
+
{
|
|
20
|
+
value: s,
|
|
21
|
+
onChange: (m) => i(m.target.value),
|
|
22
|
+
onFocus: n,
|
|
23
|
+
onBlur: h,
|
|
24
|
+
placeholder: t.placeholder ?? t.label,
|
|
25
|
+
disabled: c,
|
|
26
|
+
multiline: !0,
|
|
27
|
+
minRows: t.minRows ?? 2,
|
|
28
|
+
maxRows: t.maxRows ?? 5,
|
|
29
|
+
fullWidth: !0,
|
|
30
|
+
...t.componentProps?.textarea ?? {}
|
|
31
|
+
}
|
|
32
|
+
)), S = u.memo((t) => /* @__PURE__ */ e.jsx(
|
|
33
|
+
Z,
|
|
34
|
+
{
|
|
35
|
+
variant: "caption",
|
|
36
|
+
sx: {
|
|
37
|
+
whiteSpace: "nowrap",
|
|
38
|
+
overflow: "hidden",
|
|
39
|
+
textOverflow: "ellipsis",
|
|
40
|
+
width: "100% !important",
|
|
41
|
+
textAlign: "center"
|
|
42
|
+
},
|
|
43
|
+
children: t.label
|
|
44
|
+
}
|
|
45
|
+
)), me = u.memo(({ input: t, value: s, onChange: i, onFocus: n, onBlur: h, disabled: c }) => /* @__PURE__ */ e.jsxs(
|
|
46
|
+
r,
|
|
47
|
+
{
|
|
48
|
+
sx: {
|
|
49
|
+
width: 120,
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "column"
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ e.jsx(S, { label: t.label }),
|
|
55
|
+
/* @__PURE__ */ e.jsx(
|
|
56
|
+
H,
|
|
57
|
+
{
|
|
58
|
+
type: "number",
|
|
59
|
+
value: s ?? t.defaultValue ?? 0,
|
|
60
|
+
onChange: (m) => i(Number(m.target.value)),
|
|
61
|
+
onFocus: n,
|
|
62
|
+
onBlur: h,
|
|
63
|
+
disabled: c,
|
|
64
|
+
slotProps: {
|
|
65
|
+
htmlInput: {
|
|
66
|
+
min: t.min,
|
|
67
|
+
max: t.max,
|
|
68
|
+
step: t.step
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
sx: {
|
|
72
|
+
"& input": {
|
|
73
|
+
textAlign: "center"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
...t.componentProps?.number ?? {}
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
)), fe = u.memo(({ input: t, value: s, onChange: i, onFocus: n, onBlur: h, disabled: c }) => /* @__PURE__ */ e.jsxs(
|
|
82
|
+
r,
|
|
83
|
+
{
|
|
84
|
+
sx: {
|
|
85
|
+
width: 180,
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexDirection: "column"
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ e.jsx(S, { label: t.label }),
|
|
91
|
+
/* @__PURE__ */ e.jsx(
|
|
92
|
+
ae,
|
|
93
|
+
{
|
|
94
|
+
value: s ?? t.defaultValue ?? "",
|
|
95
|
+
onChange: (m) => i(m.target.value),
|
|
96
|
+
onFocus: n,
|
|
97
|
+
onBlur: h,
|
|
98
|
+
disabled: c,
|
|
99
|
+
placeholder: t.placeholder,
|
|
100
|
+
options: t.options ?? [],
|
|
101
|
+
optionLabel: t.optionLabel,
|
|
102
|
+
optionValue: t.optionValue,
|
|
103
|
+
searchable: t.searchable,
|
|
104
|
+
searchPlaceholder: t.searchPlaceholder,
|
|
105
|
+
...t.componentProps?.select ?? {}
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)), ue = u.memo(({ input: t, value: s, onChange: i, onFocus: n, onBlur: h, disabled: c }) => /* @__PURE__ */ e.jsxs(
|
|
111
|
+
r,
|
|
112
|
+
{
|
|
113
|
+
sx: {
|
|
114
|
+
width: 160,
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column"
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx(S, { label: t.label }),
|
|
120
|
+
/* @__PURE__ */ e.jsxs(r, { sx: { display: "flex", alignItems: "center", height: 36 }, children: [
|
|
121
|
+
/* @__PURE__ */ e.jsx(
|
|
122
|
+
ee,
|
|
123
|
+
{
|
|
124
|
+
value: s ?? t.defaultValue ?? t.min ?? 0,
|
|
125
|
+
onChange: (m, j) => i(j),
|
|
126
|
+
onMouseDown: n,
|
|
127
|
+
onMouseUp: h,
|
|
128
|
+
disabled: c,
|
|
129
|
+
min: t.min ?? 0,
|
|
130
|
+
max: t.max ?? 100,
|
|
131
|
+
step: t.step ?? 1,
|
|
132
|
+
sx: { flex: 1 },
|
|
133
|
+
...t.componentProps?.slider ?? {}
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ e.jsx(
|
|
137
|
+
r,
|
|
138
|
+
{
|
|
139
|
+
sx: {
|
|
140
|
+
minWidth: 60,
|
|
141
|
+
textAlign: "center",
|
|
142
|
+
fontWeight: 500,
|
|
143
|
+
fontSize: "0.875rem"
|
|
144
|
+
},
|
|
145
|
+
children: s ?? t.defaultValue ?? t.min ?? 0
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
)), pe = u.memo(({ input: t, value: s, onChange: i, disabled: n }) => {
|
|
152
|
+
const h = u.useRef(null), [c, m] = u.useState([]), [j, C] = u.useState(null), g = t.multiple ?? !1, y = t.maxImages ?? 5;
|
|
153
|
+
J(() => {
|
|
154
|
+
const f = [];
|
|
155
|
+
return m(((o) => {
|
|
156
|
+
if (!o) return [];
|
|
157
|
+
const p = Array.isArray(o) ? o : [o], a = [];
|
|
158
|
+
return p.forEach((I) => {
|
|
159
|
+
if (I instanceof File) {
|
|
160
|
+
const A = URL.createObjectURL(I);
|
|
161
|
+
a.push(A), f.push(A);
|
|
162
|
+
} else typeof I == "string" && a.push(I);
|
|
163
|
+
}), a;
|
|
164
|
+
})(s)), () => {
|
|
165
|
+
f.forEach((o) => URL.revokeObjectURL(o));
|
|
166
|
+
};
|
|
167
|
+
}, [s]);
|
|
168
|
+
const k = (f) => {
|
|
169
|
+
const d = f.target.files;
|
|
170
|
+
if (!(!d || d.length === 0)) {
|
|
171
|
+
if (g) {
|
|
172
|
+
const o = Array.isArray(s) ? s : s instanceof File || typeof s == "string" ? [s] : [], p = Array.from(d).slice(0, y - o.length), a = [...o, ...p];
|
|
173
|
+
i(a);
|
|
174
|
+
} else
|
|
175
|
+
i(d[0]);
|
|
176
|
+
f.target.value = "";
|
|
177
|
+
}
|
|
178
|
+
}, v = (f, d) => {
|
|
179
|
+
if (f.stopPropagation(), g && Array.isArray(s)) {
|
|
180
|
+
const o = s.filter((p, a) => a !== d);
|
|
181
|
+
i(o.length > 0 ? o : null);
|
|
182
|
+
} else
|
|
183
|
+
i(null);
|
|
184
|
+
}, D = () => {
|
|
185
|
+
n || g && c.length >= y || h.current?.click();
|
|
186
|
+
}, z = g && c.length < y;
|
|
187
|
+
return /* @__PURE__ */ e.jsxs(r, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
|
|
188
|
+
/* @__PURE__ */ e.jsx(
|
|
189
|
+
"input",
|
|
190
|
+
{
|
|
191
|
+
ref: h,
|
|
192
|
+
type: "file",
|
|
193
|
+
accept: "image/*",
|
|
194
|
+
multiple: g,
|
|
195
|
+
onChange: k,
|
|
196
|
+
disabled: n,
|
|
197
|
+
style: { display: "none" },
|
|
198
|
+
...t.componentProps?.image ?? {}
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
c.map((f, d) => /* @__PURE__ */ e.jsxs(
|
|
202
|
+
r,
|
|
203
|
+
{
|
|
204
|
+
onMouseEnter: () => C(d),
|
|
205
|
+
onMouseLeave: () => C(null),
|
|
206
|
+
sx: {
|
|
207
|
+
width: 50,
|
|
208
|
+
height: 50,
|
|
209
|
+
border: 1,
|
|
210
|
+
borderColor: n ? "action.disabled" : "divider",
|
|
211
|
+
borderRadius: 1,
|
|
212
|
+
display: "flex",
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
justifyContent: "center",
|
|
215
|
+
cursor: n ? "not-allowed" : "default",
|
|
216
|
+
position: "relative",
|
|
217
|
+
overflow: "hidden",
|
|
218
|
+
transition: "all 0.2s"
|
|
219
|
+
},
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ e.jsx(
|
|
222
|
+
r,
|
|
223
|
+
{
|
|
224
|
+
component: "img",
|
|
225
|
+
src: f,
|
|
226
|
+
alt: `Preview ${d + 1}`,
|
|
227
|
+
sx: {
|
|
228
|
+
width: "100%",
|
|
229
|
+
height: "100%",
|
|
230
|
+
objectFit: "cover"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
!n && j === d && /* @__PURE__ */ e.jsx(
|
|
235
|
+
r,
|
|
236
|
+
{
|
|
237
|
+
onClick: (o) => v(o, d),
|
|
238
|
+
sx: {
|
|
239
|
+
position: "absolute",
|
|
240
|
+
top: 0,
|
|
241
|
+
left: 0,
|
|
242
|
+
right: 0,
|
|
243
|
+
bottom: 0,
|
|
244
|
+
display: "flex",
|
|
245
|
+
alignItems: "center",
|
|
246
|
+
justifyContent: "center"
|
|
247
|
+
},
|
|
248
|
+
children: /* @__PURE__ */ e.jsx(w, { onClick: (o) => v(o, d), children: /* @__PURE__ */ e.jsx(Q, {}) })
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
d
|
|
254
|
+
)),
|
|
255
|
+
(c.length === 0 || z) && /* @__PURE__ */ e.jsx(
|
|
256
|
+
r,
|
|
257
|
+
{
|
|
258
|
+
onClick: D,
|
|
259
|
+
sx: {
|
|
260
|
+
width: 50,
|
|
261
|
+
height: 50,
|
|
262
|
+
border: 1,
|
|
263
|
+
borderColor: n ? "action.disabled" : "divider",
|
|
264
|
+
borderRadius: 1,
|
|
265
|
+
display: "flex",
|
|
266
|
+
alignItems: "center",
|
|
267
|
+
justifyContent: "center",
|
|
268
|
+
cursor: n ? "not-allowed" : "pointer",
|
|
269
|
+
transition: "all 0.2s",
|
|
270
|
+
"&:hover": {
|
|
271
|
+
bgcolor: "action.hover"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
children: /* @__PURE__ */ e.jsx(
|
|
275
|
+
ce,
|
|
276
|
+
{
|
|
277
|
+
sx: {
|
|
278
|
+
fontSize: 20,
|
|
279
|
+
color: n ? "action.disabled" : "divider"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] });
|
|
286
|
+
}), ge = u.memo(({ input: t, value: s, onChange: i, onFocus: n, onBlur: h, disabled: c }) => /* @__PURE__ */ e.jsxs(
|
|
287
|
+
r,
|
|
288
|
+
{
|
|
289
|
+
sx: {
|
|
290
|
+
display: "flex",
|
|
291
|
+
flexDirection: "column",
|
|
292
|
+
alignItems: "center",
|
|
293
|
+
minWidth: 60
|
|
294
|
+
},
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ e.jsx(S, { label: t.label }),
|
|
297
|
+
/* @__PURE__ */ e.jsx(
|
|
298
|
+
te,
|
|
299
|
+
{
|
|
300
|
+
checked: s ?? t.defaultValue ?? !1,
|
|
301
|
+
onChange: (m) => i(m.target.checked),
|
|
302
|
+
onFocus: n,
|
|
303
|
+
onBlur: h,
|
|
304
|
+
disabled: c,
|
|
305
|
+
...t.componentProps?.checkbox ?? {}
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
)), je = (t) => {
|
|
311
|
+
switch (t.input.type) {
|
|
312
|
+
case "textarea":
|
|
313
|
+
return /* @__PURE__ */ e.jsx(he, { ...t });
|
|
314
|
+
case "number":
|
|
315
|
+
return /* @__PURE__ */ e.jsx(me, { ...t });
|
|
316
|
+
case "slider":
|
|
317
|
+
return /* @__PURE__ */ e.jsx(ue, { ...t });
|
|
318
|
+
case "select":
|
|
319
|
+
return /* @__PURE__ */ e.jsx(fe, { ...t });
|
|
320
|
+
case "image":
|
|
321
|
+
return /* @__PURE__ */ e.jsx(pe, { input: t.input, value: t.value, onChange: t.onChange, disabled: t.disabled });
|
|
322
|
+
case "checkbox":
|
|
323
|
+
return /* @__PURE__ */ e.jsx(ge, { ...t });
|
|
324
|
+
default:
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
}, ye = ({
|
|
328
|
+
inputs: t = [],
|
|
329
|
+
onProcess: s,
|
|
330
|
+
onReset: i,
|
|
331
|
+
onDownload: n,
|
|
332
|
+
processing: h = !1,
|
|
333
|
+
uploading: c = !1,
|
|
334
|
+
inputValues: m = {},
|
|
335
|
+
onInputChange: j,
|
|
336
|
+
customActionButtons: C,
|
|
337
|
+
hideProcessButton: g = !1,
|
|
338
|
+
processButtonDisabled: y = !1,
|
|
339
|
+
getInputDisabled: k,
|
|
340
|
+
processTooltip: v = "Process",
|
|
341
|
+
downloadTooltip: D = "Download",
|
|
342
|
+
resetTooltip: z = "Reset",
|
|
343
|
+
infoTooltip: f = "Information",
|
|
344
|
+
infoTitle: d = "Tool Information",
|
|
345
|
+
infoContent: o,
|
|
346
|
+
position: p = "bottom",
|
|
347
|
+
relative: a = !1,
|
|
348
|
+
containerSx: I,
|
|
349
|
+
sx: A
|
|
350
|
+
}) => {
|
|
351
|
+
const [X, U] = K(!1), W = q(() => t.length === 0 ? !0 : t.every((l) => {
|
|
352
|
+
if (!l.required) return !0;
|
|
353
|
+
const x = m[l.key];
|
|
354
|
+
return l.type === "textarea" ? typeof x == "string" && x.trim() !== "" : l.type === "number" || l.type === "slider" ? x != null : l.type === "select" ? x != null && x !== "" : !0;
|
|
355
|
+
}), [t, m]), { imageInputs: F, textareaInputs: _, paramInputs: M } = q(() => t.reduce(
|
|
356
|
+
(l, x) => (x.type === "image" ? l.imageInputs.push(x) : x.type === "textarea" ? l.textareaInputs.push(x) : l.paramInputs.push(x), l),
|
|
357
|
+
{
|
|
358
|
+
imageInputs: [],
|
|
359
|
+
textareaInputs: [],
|
|
360
|
+
paramInputs: []
|
|
361
|
+
}
|
|
362
|
+
), [t]), V = b(() => {
|
|
363
|
+
}, []), B = b(() => {
|
|
364
|
+
}, []), O = b(
|
|
365
|
+
(l, x, L) => {
|
|
366
|
+
j?.(l, x, L);
|
|
367
|
+
},
|
|
368
|
+
[j]
|
|
369
|
+
), $ = b(() => U(!0), []), G = b(() => U(!1), []), T = b(
|
|
370
|
+
(l) => {
|
|
371
|
+
const x = m[l.key], L = k?.(l.key) ?? !1;
|
|
372
|
+
return l.renderInput ? /* @__PURE__ */ e.jsx(r, { children: l.renderInput({
|
|
373
|
+
value: x,
|
|
374
|
+
onChange: (E) => O(l.key, E),
|
|
375
|
+
onFocus: V,
|
|
376
|
+
onBlur: B,
|
|
377
|
+
disabled: L
|
|
378
|
+
}) }, l.key) : /* @__PURE__ */ e.jsx(
|
|
379
|
+
je,
|
|
380
|
+
{
|
|
381
|
+
input: l,
|
|
382
|
+
value: x,
|
|
383
|
+
onChange: (E) => O(l.key, E),
|
|
384
|
+
onFocus: V,
|
|
385
|
+
onBlur: B,
|
|
386
|
+
disabled: L
|
|
387
|
+
},
|
|
388
|
+
l.key
|
|
389
|
+
);
|
|
390
|
+
},
|
|
391
|
+
[m, k, O, V, B]
|
|
392
|
+
), N = /* @__PURE__ */ e.jsxs(
|
|
393
|
+
r,
|
|
394
|
+
{
|
|
395
|
+
sx: {
|
|
396
|
+
position: a ? "relative" : "fixed",
|
|
397
|
+
[p]: a ? "auto" : 20,
|
|
398
|
+
left: a ? "auto" : "50%",
|
|
399
|
+
transform: a ? "none" : "translateX(-50%)",
|
|
400
|
+
zIndex: a ? "auto" : 1300,
|
|
401
|
+
display: a ? "flex" : "block",
|
|
402
|
+
justifyContent: a ? "center" : "initial",
|
|
403
|
+
mt: a && p === "top" ? 2 : 0,
|
|
404
|
+
mb: a && p === "bottom" ? 2 : 0,
|
|
405
|
+
...I
|
|
406
|
+
},
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ e.jsxs(
|
|
409
|
+
r,
|
|
410
|
+
{
|
|
411
|
+
sx: {
|
|
412
|
+
display: "flex",
|
|
413
|
+
flexDirection: "column",
|
|
414
|
+
gap: 2,
|
|
415
|
+
p: 2,
|
|
416
|
+
borderRadius: 2,
|
|
417
|
+
border: 1,
|
|
418
|
+
borderColor: "divider",
|
|
419
|
+
bgcolor: "background.default",
|
|
420
|
+
...A
|
|
421
|
+
},
|
|
422
|
+
children: [
|
|
423
|
+
_.length > 0 && /* @__PURE__ */ e.jsx(r, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: _.map(T) }),
|
|
424
|
+
/* @__PURE__ */ e.jsxs(r, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
425
|
+
/* @__PURE__ */ e.jsx(
|
|
426
|
+
r,
|
|
427
|
+
{
|
|
428
|
+
sx: {
|
|
429
|
+
display: "flex",
|
|
430
|
+
alignItems: "center",
|
|
431
|
+
gap: 2,
|
|
432
|
+
flex: 1
|
|
433
|
+
},
|
|
434
|
+
children: (F.length > 0 || M.length > 0) && /* @__PURE__ */ e.jsxs(r, { sx: { display: "flex", alignItems: "flex-end", gap: 1.5 }, children: [
|
|
435
|
+
F.map(T),
|
|
436
|
+
M.map(T)
|
|
437
|
+
] })
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
(F.length > 0 || M.length > 0) && /* @__PURE__ */ e.jsx(le, { orientation: "vertical", flexItem: !0, sx: { mx: 0.5, flexShrink: 0 } }),
|
|
441
|
+
/* @__PURE__ */ e.jsxs(r, { sx: { display: "flex", alignItems: "center", gap: 0.75, ml: "auto" }, children: [
|
|
442
|
+
C,
|
|
443
|
+
o && /* @__PURE__ */ e.jsx(R, { title: f, children: /* @__PURE__ */ e.jsx(w, { onClick: $, children: /* @__PURE__ */ e.jsx(xe, {}) }) }),
|
|
444
|
+
/* @__PURE__ */ e.jsx(R, { title: D, children: /* @__PURE__ */ e.jsx(w, { onClick: n, children: /* @__PURE__ */ e.jsx(Y, {}) }) }),
|
|
445
|
+
/* @__PURE__ */ e.jsx(R, { title: z, children: /* @__PURE__ */ e.jsx(w, { onClick: i, children: /* @__PURE__ */ e.jsx(de, {}) }) }),
|
|
446
|
+
!g && /* @__PURE__ */ e.jsx(R, { title: v, children: /* @__PURE__ */ e.jsx("span", { children: /* @__PURE__ */ e.jsx(
|
|
447
|
+
w,
|
|
448
|
+
{
|
|
449
|
+
onClick: s,
|
|
450
|
+
disabled: y || !W || c || h,
|
|
451
|
+
size: "large",
|
|
452
|
+
children: /* @__PURE__ */ e.jsx(
|
|
453
|
+
ie,
|
|
454
|
+
{
|
|
455
|
+
color: y || !W || c || h ? "disabled" : "primary"
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
}
|
|
459
|
+
) }) })
|
|
460
|
+
] })
|
|
461
|
+
] })
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
o && /* @__PURE__ */ e.jsxs(se, { open: X, onClose: G, maxWidth: "sm", fullWidth: !0, children: [
|
|
466
|
+
/* @__PURE__ */ e.jsx(ne, { children: d }),
|
|
467
|
+
/* @__PURE__ */ e.jsx(oe, { children: o })
|
|
468
|
+
] })
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
return !a && typeof window < "u" ? re(N, document.body) : N;
|
|
473
|
+
};
|
|
474
|
+
ye.displayName = "SToolBar";
|
|
475
|
+
export {
|
|
476
|
+
ye as SToolBar,
|
|
477
|
+
ye as default
|
|
478
|
+
};
|