@easy-editor/setters 0.0.5 → 0.0.6

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.esm.js CHANGED
@@ -1,10 +1,9 @@
1
- import * as React from 'react';
1
+ import * as React$1 from 'react';
2
2
  import React__default, { useState, useRef } from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
7
  import * as PopoverPrimitive from '@radix-ui/react-popover';
9
8
  import Sketch from '@uiw/react-color-sketch';
10
9
  import * as SwitchPrimitive from '@radix-ui/react-switch';
@@ -12,6 +11,16 @@ import { Upload, X, ChevronsUpDown } from 'lucide-react';
12
11
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
13
12
  import * as TabsPrimitive from '@radix-ui/react-tabs';
14
13
 
14
+ function _extends() {
15
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
16
+ for (var e = 1; e < arguments.length; e++) {
17
+ var t = arguments[e];
18
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
19
+ }
20
+ return n;
21
+ }, _extends.apply(null, arguments);
22
+ }
23
+
15
24
  function cn(...inputs) {
16
25
  return twMerge(clsx(inputs));
17
26
  }
@@ -40,7 +49,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
40
49
  size: "default"
41
50
  }
42
51
  });
43
- const Button = /*#__PURE__*/React.forwardRef(({
52
+ const Button = /*#__PURE__*/React$1.forwardRef(({
44
53
  className,
45
54
  variant = "default",
46
55
  size = "default",
@@ -48,7 +57,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
48
57
  ...props
49
58
  }, ref) => {
50
59
  const Comp = asChild ? Slot : "button";
51
- return /*#__PURE__*/jsx(Comp, {
60
+ return /*#__PURE__*/React$1.createElement(Comp, _extends({
52
61
  ref: ref,
53
62
  "data-slot": "button",
54
63
  "data-variant": variant,
@@ -57,27 +66,24 @@ const Button = /*#__PURE__*/React.forwardRef(({
57
66
  variant,
58
67
  size,
59
68
  className
60
- })),
61
- ...props
62
- });
69
+ }))
70
+ }, props));
63
71
  });
64
72
  Button.displayName = "Button";
65
73
 
66
74
  function Popover({
67
75
  ...props
68
76
  }) {
69
- return /*#__PURE__*/jsx(PopoverPrimitive.Root, {
70
- "data-slot": "popover",
71
- ...props
72
- });
77
+ return /*#__PURE__*/React$1.createElement(PopoverPrimitive.Root, _extends({
78
+ "data-slot": "popover"
79
+ }, props));
73
80
  }
74
81
  function PopoverTrigger({
75
82
  ...props
76
83
  }) {
77
- return /*#__PURE__*/jsx(PopoverPrimitive.Trigger, {
78
- "data-slot": "popover-trigger",
79
- ...props
80
- });
84
+ return /*#__PURE__*/React$1.createElement(PopoverPrimitive.Trigger, _extends({
85
+ "data-slot": "popover-trigger"
86
+ }, props));
81
87
  }
82
88
  function PopoverContent({
83
89
  className,
@@ -85,15 +91,12 @@ function PopoverContent({
85
91
  sideOffset = 4,
86
92
  ...props
87
93
  }) {
88
- return /*#__PURE__*/jsx(PopoverPrimitive.Portal, {
89
- children: /*#__PURE__*/jsx(PopoverPrimitive.Content, {
90
- "data-slot": "popover-content",
91
- align: align,
92
- sideOffset: sideOffset,
93
- className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
94
- ...props
95
- })
96
- });
94
+ return /*#__PURE__*/React$1.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React$1.createElement(PopoverPrimitive.Content, _extends({
95
+ "data-slot": "popover-content",
96
+ align: align,
97
+ sideOffset: sideOffset,
98
+ className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className)
99
+ }, props)));
97
100
  }
98
101
 
99
102
  const ColorSetter = props => {
@@ -103,51 +106,42 @@ const ColorSetter = props => {
103
106
  onChange,
104
107
  disableAlpha = false
105
108
  } = props;
106
- return /*#__PURE__*/jsxs(Popover, {
107
- children: [/*#__PURE__*/jsx(PopoverTrigger, {
108
- asChild: true,
109
- children: /*#__PURE__*/jsxs(Button, {
110
- "aria-label": "Select color",
111
- className: 'h-8 w-full justify-start gap-2 bg-transparent px-2 py-[5px] text-left font-normal text-xs',
112
- variant: 'outline',
113
- children: [/*#__PURE__*/jsx("div", {
114
- "aria-label": "Current color",
115
- className: "h-3.5 w-3.5 rounded-full border border-muted-foreground",
116
- style: {
117
- backgroundColor: value ?? initialValue
118
- }
119
- }), /*#__PURE__*/jsx("span", {
120
- className: "truncate font-mono",
121
- children: value ?? initialValue
122
- })]
123
- })
124
- }), /*#__PURE__*/jsx(PopoverContent, {
125
- align: "start",
126
- className: "w-auto p-0",
127
- children: /*#__PURE__*/jsx(Sketch, {
128
- color: value,
129
- disableAlpha: disableAlpha,
130
- onChange: res => onChange(res.hexa),
131
- presetColors: []
132
- })
133
- })]
134
- });
109
+ return /*#__PURE__*/React.createElement(Popover, null, /*#__PURE__*/React.createElement(PopoverTrigger, {
110
+ asChild: true
111
+ }, /*#__PURE__*/React.createElement(Button, {
112
+ "aria-label": "Select color",
113
+ className: 'h-8 w-full justify-start gap-2 bg-transparent px-2 py-[5px] text-left font-normal text-xs',
114
+ variant: 'outline'
115
+ }, /*#__PURE__*/React.createElement("div", {
116
+ "aria-label": "Current color",
117
+ className: "h-3.5 w-3.5 rounded-full border border-muted-foreground",
118
+ style: {
119
+ backgroundColor: value ?? initialValue
120
+ }
121
+ }), /*#__PURE__*/React.createElement("span", {
122
+ className: "truncate font-mono"
123
+ }, value ?? initialValue))), /*#__PURE__*/React.createElement(PopoverContent, {
124
+ align: "start",
125
+ className: "w-auto p-0"
126
+ }, /*#__PURE__*/React.createElement(Sketch, {
127
+ color: value,
128
+ disableAlpha: disableAlpha,
129
+ onChange: res => onChange(res.hexa),
130
+ presetColors: []
131
+ })));
135
132
  };
136
133
 
137
134
  const NodeIdSetter = props => {
138
135
  const {
139
136
  selected
140
137
  } = props;
141
- return /*#__PURE__*/jsxs("div", {
142
- className: "flex flex-col",
143
- children: [/*#__PURE__*/jsx("p", {
144
- className: "leading-7",
145
- children: selected.id
146
- }), /*#__PURE__*/jsx("p", {
147
- className: "text-muted-foreground text-xs",
148
- children: selected.componentMeta.title
149
- })]
150
- });
138
+ return /*#__PURE__*/React.createElement("div", {
139
+ className: "flex flex-col"
140
+ }, /*#__PURE__*/React.createElement("p", {
141
+ className: "leading-7"
142
+ }, selected.id), /*#__PURE__*/React.createElement("p", {
143
+ className: "text-muted-foreground text-xs"
144
+ }, selected.componentMeta.title));
151
145
  };
152
146
 
153
147
  function Input({
@@ -155,12 +149,11 @@ function Input({
155
149
  type,
156
150
  ...props
157
151
  }) {
158
- return /*#__PURE__*/jsx("input", {
152
+ return /*#__PURE__*/React$1.createElement("input", _extends({
159
153
  type: type,
160
154
  "data-slot": "input",
161
- className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
162
- ...props
163
- });
155
+ className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className)
156
+ }, props));
164
157
  }
165
158
 
166
159
  const NumberSetter = props => {
@@ -171,20 +164,18 @@ const NumberSetter = props => {
171
164
  onChange,
172
165
  suffix
173
166
  } = props;
174
- return /*#__PURE__*/jsxs("div", {
175
- className: "relative w-full",
176
- children: [/*#__PURE__*/jsx(Input, {
177
- className: cn('h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none', !!suffix && 'pr-8'),
178
- onChange: e => onChange(+e.target.value),
179
- placeholder: placeholder || '',
180
- type: "number",
181
- value: value ?? initialValue
182
- }), !!suffix && /*#__PURE__*/jsx("span", {
183
- "aria-label": `Unit: ${suffix}`,
184
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
185
- children: suffix
186
- })]
187
- });
167
+ return /*#__PURE__*/React.createElement("div", {
168
+ className: "relative w-full"
169
+ }, /*#__PURE__*/React.createElement(Input, {
170
+ className: cn('h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none', !!suffix && 'pr-8'),
171
+ onChange: e => onChange(+e.target.value),
172
+ placeholder: placeholder || '',
173
+ type: "number",
174
+ value: value ?? initialValue
175
+ }), !!suffix && /*#__PURE__*/React.createElement("span", {
176
+ "aria-label": `Unit: ${suffix}`,
177
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
178
+ }, suffix));
188
179
  };
189
180
 
190
181
  const RectSetter = props => {
@@ -198,58 +189,49 @@ const RectSetter = props => {
198
189
  [key]: newValue
199
190
  });
200
191
  };
201
- return /*#__PURE__*/jsxs("div", {
202
- className: "flex w-full flex-wrap gap-2",
203
- children: [/*#__PURE__*/jsxs("div", {
204
- className: "relative w-[calc(50%-4px)]",
205
- children: [/*#__PURE__*/jsx(Input, {
206
- className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
207
- onChange: e => handleChange('x', Number(e.target.value)),
208
- type: "number",
209
- value: formatDecimal(value.x)
210
- }), /*#__PURE__*/jsx("span", {
211
- "aria-label": 'Unit: X',
212
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
213
- children: "X"
214
- })]
215
- }), /*#__PURE__*/jsxs("div", {
216
- className: "relative w-[calc(50%-4px)]",
217
- children: [/*#__PURE__*/jsx(Input, {
218
- className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
219
- onChange: e => handleChange('y', Number(e.target.value)),
220
- type: "number",
221
- value: formatDecimal(value.y)
222
- }), /*#__PURE__*/jsx("span", {
223
- "aria-label": 'Unit: Y',
224
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
225
- children: "Y"
226
- })]
227
- }), /*#__PURE__*/jsxs("div", {
228
- className: "relative w-[calc(50%-4px)]",
229
- children: [/*#__PURE__*/jsx(Input, {
230
- className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
231
- onChange: e => handleChange('width', Number(e.target.value)),
232
- type: "number",
233
- value: formatDecimal(value.width)
234
- }), /*#__PURE__*/jsx("span", {
235
- "aria-label": 'Unit: W',
236
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
237
- children: "W"
238
- })]
239
- }), /*#__PURE__*/jsxs("div", {
240
- className: "relative w-[calc(50%-4px)]",
241
- children: [/*#__PURE__*/jsx(Input, {
242
- className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
243
- onChange: e => handleChange('height', Number(e.target.value)),
244
- type: "number",
245
- value: formatDecimal(value.height)
246
- }), /*#__PURE__*/jsx("span", {
247
- "aria-label": 'Unit: H',
248
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
249
- children: "H"
250
- })]
251
- })]
252
- });
192
+ return /*#__PURE__*/React.createElement("div", {
193
+ className: "flex w-full flex-wrap gap-2"
194
+ }, /*#__PURE__*/React.createElement("div", {
195
+ className: "relative w-[calc(50%-4px)]"
196
+ }, /*#__PURE__*/React.createElement(Input, {
197
+ className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
198
+ onChange: e => handleChange('x', Number(e.target.value)),
199
+ type: "number",
200
+ value: formatDecimal(value.x)
201
+ }), /*#__PURE__*/React.createElement("span", {
202
+ "aria-label": 'Unit: X',
203
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
204
+ }, "X")), /*#__PURE__*/React.createElement("div", {
205
+ className: "relative w-[calc(50%-4px)]"
206
+ }, /*#__PURE__*/React.createElement(Input, {
207
+ className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
208
+ onChange: e => handleChange('y', Number(e.target.value)),
209
+ type: "number",
210
+ value: formatDecimal(value.y)
211
+ }), /*#__PURE__*/React.createElement("span", {
212
+ "aria-label": 'Unit: Y',
213
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
214
+ }, "Y")), /*#__PURE__*/React.createElement("div", {
215
+ className: "relative w-[calc(50%-4px)]"
216
+ }, /*#__PURE__*/React.createElement(Input, {
217
+ className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
218
+ onChange: e => handleChange('width', Number(e.target.value)),
219
+ type: "number",
220
+ value: formatDecimal(value.width)
221
+ }), /*#__PURE__*/React.createElement("span", {
222
+ "aria-label": 'Unit: W',
223
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
224
+ }, "W")), /*#__PURE__*/React.createElement("div", {
225
+ className: "relative w-[calc(50%-4px)]"
226
+ }, /*#__PURE__*/React.createElement(Input, {
227
+ className: "h-8 px-2 py-[5px] pr-8 text-xs! [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
228
+ onChange: e => handleChange('height', Number(e.target.value)),
229
+ type: "number",
230
+ value: formatDecimal(value.height)
231
+ }), /*#__PURE__*/React.createElement("span", {
232
+ "aria-label": 'Unit: H',
233
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
234
+ }, "H")));
253
235
  };
254
236
  const decimalRegex = /(\.\d{2})\d+$/;
255
237
  const formatDecimal = num => num.toString().replace(decimalRegex, '$1');
@@ -262,34 +244,30 @@ const StringSetter = props => {
262
244
  onChange,
263
245
  suffix
264
246
  } = props;
265
- return /*#__PURE__*/jsxs("div", {
266
- className: "relative w-full",
267
- children: [/*#__PURE__*/jsx(Input, {
268
- className: cn('h-8 px-2 py-[5px] text-xs!', !!suffix && 'pr-8'),
269
- onChange: e => onChange(e.target.value),
270
- placeholder: placeholder || '',
271
- value: value || initialValue
272
- }), !!suffix && /*#__PURE__*/jsx("span", {
273
- "aria-label": `Unit: ${suffix}`,
274
- className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground",
275
- children: suffix
276
- })]
277
- });
247
+ return /*#__PURE__*/React.createElement("div", {
248
+ className: "relative w-full"
249
+ }, /*#__PURE__*/React.createElement(Input, {
250
+ className: cn('h-8 px-2 py-[5px] text-xs!', !!suffix && 'pr-8'),
251
+ onChange: e => onChange(e.target.value),
252
+ placeholder: placeholder || '',
253
+ value: value || initialValue
254
+ }), !!suffix && /*#__PURE__*/React.createElement("span", {
255
+ "aria-label": `Unit: ${suffix}`,
256
+ className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-muted-foreground"
257
+ }, suffix));
278
258
  };
279
259
 
280
260
  function Switch({
281
261
  className,
282
262
  ...props
283
263
  }) {
284
- return /*#__PURE__*/jsx(SwitchPrimitive.Root, {
264
+ return /*#__PURE__*/React$1.createElement(SwitchPrimitive.Root, _extends({
285
265
  "data-slot": "switch",
286
- className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
287
- ...props,
288
- children: /*#__PURE__*/jsx(SwitchPrimitive.Thumb, {
289
- "data-slot": "switch-thumb",
290
- className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
291
- })
292
- });
266
+ className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className)
267
+ }, props), /*#__PURE__*/React$1.createElement(SwitchPrimitive.Thumb, {
268
+ "data-slot": "switch-thumb",
269
+ className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
270
+ }));
293
271
  }
294
272
 
295
273
  const SwitchSetter = props => {
@@ -298,13 +276,12 @@ const SwitchSetter = props => {
298
276
  initialValue,
299
277
  onChange
300
278
  } = props;
301
- return /*#__PURE__*/jsx("div", {
302
- className: "py-0.5",
303
- children: /*#__PURE__*/jsx(Switch, {
304
- checked: value || initialValue,
305
- onCheckedChange: onChange
306
- })
307
- });
279
+ return /*#__PURE__*/React.createElement("div", {
280
+ className: "py-0.5"
281
+ }, /*#__PURE__*/React.createElement(Switch, {
282
+ checked: value || initialValue,
283
+ onCheckedChange: onChange
284
+ }));
308
285
  };
309
286
 
310
287
  const UploadSetter = props => {
@@ -378,77 +355,63 @@ const UploadSetter = props => {
378
355
  inputRef.current.value = '';
379
356
  }
380
357
  };
381
- return /*#__PURE__*/jsxs("div", {
382
- className: "group relative w-full overflow-hidden",
383
- children: [/*#__PURE__*/jsxs("div", {
384
- className: "flex gap-2",
385
- children: [/*#__PURE__*/jsxs("label", {
386
- className: "flex-1 cursor-pointer",
387
- children: [/*#__PURE__*/jsx("input", {
388
- accept: accept,
389
- className: cn('h-8 cursor-pointer px-2 py-[5px] text-xs', 'border-dashed transition-colors hover:border-primary', 'absolute h-0 w-0 opacity-0'),
390
- onChange: handleFileChange,
391
- ref: inputRef,
392
- type: "file"
393
- }), /*#__PURE__*/jsxs("div", {
394
- className: "flex h-8 w-full items-center justify-center rounded-md border border-dashed text-muted-foreground text-xs transition-colors hover:border-primary",
395
- children: [/*#__PURE__*/jsx(Upload, {
396
- className: "mr-2 h-4 w-4"
397
- }), /*#__PURE__*/jsx("span", {
398
- children: value ? '更换文件' : '点击上传'
399
- })]
400
- })]
401
- }), !!value && /*#__PURE__*/jsx(Button, {
402
- "aria-label": "\u6E05\u9664\u6587\u4EF6",
403
- className: "h-8 px-2 text-muted-foreground hover:text-destructive",
404
- onClick: handleClear,
405
- size: "sm",
406
- type: "button",
407
- variant: "ghost",
408
- children: /*#__PURE__*/jsx(X, {
409
- className: "h-4 w-4"
410
- })
411
- })]
412
- }), !!value && /*#__PURE__*/jsxs("div", {
413
- className: "mt-2 flex w-full items-center gap-2 text-foreground/80 text-xs",
414
- children: [/*#__PURE__*/jsx("span", {
415
- className: "min-w-0 flex-1 truncate",
416
- children: value.raw?.name
417
- }), /*#__PURE__*/jsxs("span", {
418
- className: "shrink-0 whitespace-nowrap text-muted-foreground/50",
419
- children: [(value.raw?.size / 1024).toFixed(1), "KB"]
420
- })]
421
- }), !!error && /*#__PURE__*/jsx("p", {
422
- className: "mt-1 text-destructive text-xs",
423
- role: "alert",
424
- children: error
425
- })]
426
- });
358
+ return /*#__PURE__*/React.createElement("div", {
359
+ className: "group relative w-full overflow-hidden"
360
+ }, /*#__PURE__*/React.createElement("div", {
361
+ className: "flex gap-2"
362
+ }, /*#__PURE__*/React.createElement("label", {
363
+ className: "flex-1 cursor-pointer"
364
+ }, /*#__PURE__*/React.createElement("input", {
365
+ accept: accept,
366
+ className: cn('h-8 cursor-pointer px-2 py-[5px] text-xs', 'border-dashed transition-colors hover:border-primary', 'absolute h-0 w-0 opacity-0'),
367
+ onChange: handleFileChange,
368
+ ref: inputRef,
369
+ type: "file"
370
+ }), /*#__PURE__*/React.createElement("div", {
371
+ className: "flex h-8 w-full items-center justify-center rounded-md border border-dashed text-muted-foreground text-xs transition-colors hover:border-primary"
372
+ }, /*#__PURE__*/React.createElement(Upload, {
373
+ className: "mr-2 h-4 w-4"
374
+ }), /*#__PURE__*/React.createElement("span", null, value ? '更换文件' : '点击上传'))), !!value && /*#__PURE__*/React.createElement(Button, {
375
+ "aria-label": "\u6E05\u9664\u6587\u4EF6",
376
+ className: "h-8 px-2 text-muted-foreground hover:text-destructive",
377
+ onClick: handleClear,
378
+ size: "sm",
379
+ type: "button",
380
+ variant: "ghost"
381
+ }, /*#__PURE__*/React.createElement(X, {
382
+ className: "h-4 w-4"
383
+ }))), !!value && /*#__PURE__*/React.createElement("div", {
384
+ className: "mt-2 flex w-full items-center gap-2 text-foreground/80 text-xs"
385
+ }, /*#__PURE__*/React.createElement("span", {
386
+ className: "min-w-0 flex-1 truncate"
387
+ }, value.raw?.name), /*#__PURE__*/React.createElement("span", {
388
+ className: "shrink-0 whitespace-nowrap text-muted-foreground/50"
389
+ }, (value.raw?.size / 1024).toFixed(1), "KB")), !!error && /*#__PURE__*/React.createElement("p", {
390
+ className: "mt-1 text-destructive text-xs",
391
+ role: "alert"
392
+ }, error));
427
393
  };
428
394
 
429
395
  function Collapsible({
430
396
  ...props
431
397
  }) {
432
- return /*#__PURE__*/jsx(CollapsiblePrimitive.Root, {
433
- "data-slot": "collapsible",
434
- ...props
435
- });
398
+ return /*#__PURE__*/React.createElement(CollapsiblePrimitive.Root, _extends({
399
+ "data-slot": "collapsible"
400
+ }, props));
436
401
  }
437
402
  function CollapsibleTrigger({
438
403
  ...props
439
404
  }) {
440
- return /*#__PURE__*/jsx(CollapsiblePrimitive.CollapsibleTrigger, {
441
- "data-slot": "collapsible-trigger",
442
- ...props
443
- });
405
+ return /*#__PURE__*/React.createElement(CollapsiblePrimitive.CollapsibleTrigger, _extends({
406
+ "data-slot": "collapsible-trigger"
407
+ }, props));
444
408
  }
445
409
  function CollapsibleContent({
446
410
  ...props
447
411
  }) {
448
- return /*#__PURE__*/jsx(CollapsiblePrimitive.CollapsibleContent, {
449
- "data-slot": "collapsible-content",
450
- ...props
451
- });
412
+ return /*#__PURE__*/React.createElement(CollapsiblePrimitive.CollapsibleContent, _extends({
413
+ "data-slot": "collapsible-content"
414
+ }, props));
452
415
  }
453
416
 
454
417
  const CollapseSetter = props => {
@@ -459,73 +422,61 @@ const CollapseSetter = props => {
459
422
  icon = true
460
423
  } = props;
461
424
  const [isOpen, setIsOpen] = useState(initialValue ?? true);
462
- return /*#__PURE__*/jsxs(Collapsible, {
425
+ return /*#__PURE__*/React.createElement(Collapsible, {
463
426
  className: "w-[calc(100%+32px)] -translate-x-4 space-y-2",
464
427
  onOpenChange: setIsOpen,
465
- open: isOpen,
466
- children: [/*#__PURE__*/jsxs("div", {
467
- className: "flex h-8 items-center justify-between space-x-4 bg-muted px-4",
468
- children: [/*#__PURE__*/jsx("h4", {
469
- children: field.title
470
- }), !!icon && /*#__PURE__*/jsx(CollapsibleTrigger, {
471
- asChild: true,
472
- children: /*#__PURE__*/jsxs(Button, {
473
- size: "sm",
474
- variant: "ghost",
475
- children: [/*#__PURE__*/jsx(ChevronsUpDown, {
476
- className: "h-4 w-4"
477
- }), /*#__PURE__*/jsx("span", {
478
- className: "sr-only",
479
- children: "Toggle"
480
- })]
481
- })
482
- })]
483
- }), /*#__PURE__*/jsx(CollapsibleContent, {
484
- className: "space-y-3 px-4 py-2",
485
- children: children
486
- })]
487
- });
428
+ open: isOpen
429
+ }, /*#__PURE__*/React.createElement("div", {
430
+ className: "flex h-8 items-center justify-between space-x-4 bg-muted px-4"
431
+ }, /*#__PURE__*/React.createElement("h4", null, field.title), !!icon && /*#__PURE__*/React.createElement(CollapsibleTrigger, {
432
+ asChild: true
433
+ }, /*#__PURE__*/React.createElement(Button, {
434
+ size: "sm",
435
+ variant: "ghost"
436
+ }, /*#__PURE__*/React.createElement(ChevronsUpDown, {
437
+ className: "h-4 w-4"
438
+ }), /*#__PURE__*/React.createElement("span", {
439
+ className: "sr-only"
440
+ }, "Toggle")))), /*#__PURE__*/React.createElement(CollapsibleContent, {
441
+ className: "space-y-3 px-4 py-2"
442
+ }, children));
488
443
  };
489
444
 
490
445
  function Tabs({
491
446
  className,
492
447
  ...props
493
448
  }) {
494
- return /*#__PURE__*/jsx(TabsPrimitive.Root, {
449
+ return /*#__PURE__*/React$1.createElement(TabsPrimitive.Root, _extends({
495
450
  "data-slot": "tabs",
496
- className: cn("flex flex-col gap-2", className),
497
- ...props
498
- });
451
+ className: cn("flex flex-col gap-2", className)
452
+ }, props));
499
453
  }
500
454
  function TabsList({
501
455
  className,
502
456
  ...props
503
457
  }) {
504
- return /*#__PURE__*/jsx(TabsPrimitive.List, {
458
+ return /*#__PURE__*/React$1.createElement(TabsPrimitive.List, _extends({
505
459
  "data-slot": "tabs-list",
506
- className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
507
- ...props
508
- });
460
+ className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className)
461
+ }, props));
509
462
  }
510
463
  function TabsTrigger({
511
464
  className,
512
465
  ...props
513
466
  }) {
514
- return /*#__PURE__*/jsx(TabsPrimitive.Trigger, {
467
+ return /*#__PURE__*/React$1.createElement(TabsPrimitive.Trigger, _extends({
515
468
  "data-slot": "tabs-trigger",
516
- className: cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
517
- ...props
518
- });
469
+ className: cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className)
470
+ }, props));
519
471
  }
520
472
  function TabsContent({
521
473
  className,
522
474
  ...props
523
475
  }) {
524
- return /*#__PURE__*/jsx(TabsPrimitive.Content, {
476
+ return /*#__PURE__*/React$1.createElement(TabsPrimitive.Content, _extends({
525
477
  "data-slot": "tabs-content",
526
- className: cn("flex-1 outline-none", className),
527
- ...props
528
- });
478
+ className: cn("flex-1 outline-none", className)
479
+ }, props));
529
480
  }
530
481
 
531
482
  const TabSetter = props => {
@@ -547,24 +498,22 @@ const TabSetter = props => {
547
498
  throw new Error('TabSetter: children or tabs must be an array');
548
499
  }, [tabs, children]);
549
500
  const firstTabValue = React__default.useMemo(() => tabsList[0]?.value, [tabsList]);
550
- return /*#__PURE__*/jsxs(Tabs, {
501
+ return /*#__PURE__*/React__default.createElement(Tabs, {
551
502
  className: "w-full",
552
- defaultValue: initialValue ?? firstTabValue,
553
- children: [/*#__PURE__*/jsx(TabsList, {
554
- className: "grid w-full",
555
- style: {
556
- gridTemplateColumns: `repeat(${tabsList.length}, minmax(0, 1fr))`
557
- },
558
- children: tabsList.map(tab => /*#__PURE__*/jsx(TabsTrigger, {
559
- value: tab.value,
560
- children: tab.label
561
- }, tab.value))
562
- }), Array.isArray(children) && children.map(child => /*#__PURE__*/jsx(TabsContent, {
563
- className: "mt-0 box-border space-y-3 p-2",
564
- value: child.props.field.config.key,
565
- children: child
566
- }, child.props.field.config.key))]
567
- });
503
+ defaultValue: initialValue ?? firstTabValue
504
+ }, /*#__PURE__*/React__default.createElement(TabsList, {
505
+ className: "grid w-full",
506
+ style: {
507
+ gridTemplateColumns: `repeat(${tabsList.length}, minmax(0, 1fr))`
508
+ }
509
+ }, tabsList.map(tab => /*#__PURE__*/React__default.createElement(TabsTrigger, {
510
+ key: tab.value,
511
+ value: tab.value
512
+ }, tab.label))), Array.isArray(children) && children.map(child => /*#__PURE__*/React__default.createElement(TabsContent, {
513
+ className: "mt-0 box-border space-y-3 p-2",
514
+ key: child.props.field.config.key,
515
+ value: child.props.field.config.key
516
+ }, child)));
568
517
  };
569
518
 
570
519
  const setterMap = {