@enerjisaformlibrary/formbuilder-react 1.0.0 → 1.0.1
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/index.cjs +195 -1557
- package/index.cjs.map +1 -0
- package/index.js +183 -1545
- package/index.js.map +1 -0
- package/package.json +11 -1
package/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var core = require('@dnd-kit/core');
|
|
5
|
+
var React = require('react');
|
|
5
6
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
6
7
|
var clsx = require('clsx');
|
|
7
8
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -28,20 +29,20 @@ var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
|
28
29
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
29
30
|
|
|
30
31
|
function _interopNamespaceDefault(e) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
var n = Object.create(null);
|
|
33
|
+
if (e) {
|
|
34
|
+
Object.keys(e).forEach(function (k) {
|
|
35
|
+
if (k !== 'default') {
|
|
36
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
37
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return e[k]; }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
39
42
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
n.default = e;
|
|
44
|
-
return Object.freeze(n);
|
|
43
|
+
}
|
|
44
|
+
n.default = e;
|
|
45
|
+
return Object.freeze(n);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
@@ -61,1378 +62,15 @@ var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(Accord
|
|
|
61
62
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
62
63
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
|
|
63
64
|
|
|
64
|
-
var jsxRuntime = {exports: {}};
|
|
65
|
-
|
|
66
|
-
var reactJsxRuntime_production_min = {};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @license React
|
|
70
|
-
* react-jsx-runtime.production.min.js
|
|
71
|
-
*
|
|
72
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the MIT license found in the
|
|
75
|
-
* LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
79
|
-
|
|
80
|
-
function requireReactJsxRuntime_production_min () {
|
|
81
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
82
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
83
|
-
var f=React,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
|
|
84
|
-
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
85
|
-
return reactJsxRuntime_production_min;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
var reactJsxRuntime_development = {};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @license React
|
|
92
|
-
* react-jsx-runtime.development.js
|
|
93
|
-
*
|
|
94
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the MIT license found in the
|
|
97
|
-
* LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
var hasRequiredReactJsxRuntime_development;
|
|
101
|
-
|
|
102
|
-
function requireReactJsxRuntime_development () {
|
|
103
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
104
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
105
|
-
|
|
106
|
-
if (process.env.NODE_ENV !== "production") {
|
|
107
|
-
(function() {
|
|
108
|
-
|
|
109
|
-
var React$1 = React;
|
|
110
|
-
|
|
111
|
-
// ATTENTION
|
|
112
|
-
// When adding new symbols to this file,
|
|
113
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
114
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
115
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
116
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
117
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
118
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
119
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
120
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
121
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
122
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
123
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
124
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
125
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
126
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
127
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
128
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
129
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
130
|
-
function getIteratorFn(maybeIterable) {
|
|
131
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
136
|
-
|
|
137
|
-
if (typeof maybeIterator === 'function') {
|
|
138
|
-
return maybeIterator;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
145
|
-
|
|
146
|
-
function error(format) {
|
|
147
|
-
{
|
|
148
|
-
{
|
|
149
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
150
|
-
args[_key2 - 1] = arguments[_key2];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
printWarning('error', format, args);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function printWarning(level, format, args) {
|
|
159
|
-
// When changing this logic, you might want to also
|
|
160
|
-
// update consoleWithStackDev.www.js as well.
|
|
161
|
-
{
|
|
162
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
163
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
164
|
-
|
|
165
|
-
if (stack !== '') {
|
|
166
|
-
format += '%s';
|
|
167
|
-
args = args.concat([stack]);
|
|
168
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
var argsWithFormat = args.map(function (item) {
|
|
172
|
-
return String(item);
|
|
173
|
-
}); // Careful: RN currently depends on this prefix
|
|
174
|
-
|
|
175
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
176
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
177
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
178
|
-
|
|
179
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// -----------------------------------------------------------------------------
|
|
184
|
-
|
|
185
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
186
|
-
var enableCacheElement = false;
|
|
187
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
188
|
-
|
|
189
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
190
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
191
|
-
// issues in DEV builds.
|
|
192
|
-
|
|
193
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
194
|
-
|
|
195
|
-
var REACT_MODULE_REFERENCE;
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function isValidElementType(type) {
|
|
202
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
203
|
-
return true;
|
|
204
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (typeof type === 'object' && type !== null) {
|
|
212
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
213
|
-
// types supported by any Flight configuration anywhere since
|
|
214
|
-
// we don't know which Flight build this will end up being used
|
|
215
|
-
// with.
|
|
216
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
225
|
-
var displayName = outerType.displayName;
|
|
226
|
-
|
|
227
|
-
if (displayName) {
|
|
228
|
-
return displayName;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
232
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
233
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
function getContextName(type) {
|
|
237
|
-
return type.displayName || 'Context';
|
|
238
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
function getComponentNameFromType(type) {
|
|
242
|
-
if (type == null) {
|
|
243
|
-
// Host root, text node or just invalid type.
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
{
|
|
248
|
-
if (typeof type.tag === 'number') {
|
|
249
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (typeof type === 'function') {
|
|
254
|
-
return type.displayName || type.name || null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (typeof type === 'string') {
|
|
258
|
-
return type;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
switch (type) {
|
|
262
|
-
case REACT_FRAGMENT_TYPE:
|
|
263
|
-
return 'Fragment';
|
|
264
|
-
|
|
265
|
-
case REACT_PORTAL_TYPE:
|
|
266
|
-
return 'Portal';
|
|
267
|
-
|
|
268
|
-
case REACT_PROFILER_TYPE:
|
|
269
|
-
return 'Profiler';
|
|
270
|
-
|
|
271
|
-
case REACT_STRICT_MODE_TYPE:
|
|
272
|
-
return 'StrictMode';
|
|
273
|
-
|
|
274
|
-
case REACT_SUSPENSE_TYPE:
|
|
275
|
-
return 'Suspense';
|
|
276
|
-
|
|
277
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
278
|
-
return 'SuspenseList';
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (typeof type === 'object') {
|
|
283
|
-
switch (type.$$typeof) {
|
|
284
|
-
case REACT_CONTEXT_TYPE:
|
|
285
|
-
var context = type;
|
|
286
|
-
return getContextName(context) + '.Consumer';
|
|
287
|
-
|
|
288
|
-
case REACT_PROVIDER_TYPE:
|
|
289
|
-
var provider = type;
|
|
290
|
-
return getContextName(provider._context) + '.Provider';
|
|
291
|
-
|
|
292
|
-
case REACT_FORWARD_REF_TYPE:
|
|
293
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
294
|
-
|
|
295
|
-
case REACT_MEMO_TYPE:
|
|
296
|
-
var outerName = type.displayName || null;
|
|
297
|
-
|
|
298
|
-
if (outerName !== null) {
|
|
299
|
-
return outerName;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
303
|
-
|
|
304
|
-
case REACT_LAZY_TYPE:
|
|
305
|
-
{
|
|
306
|
-
var lazyComponent = type;
|
|
307
|
-
var payload = lazyComponent._payload;
|
|
308
|
-
var init = lazyComponent._init;
|
|
309
|
-
|
|
310
|
-
try {
|
|
311
|
-
return getComponentNameFromType(init(payload));
|
|
312
|
-
} catch (x) {
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// eslint-disable-next-line no-fallthrough
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
var assign = Object.assign;
|
|
325
|
-
|
|
326
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
327
|
-
// replaying on render function. This currently only patches the object
|
|
328
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
329
|
-
// We could also eagerly patch the method.
|
|
330
|
-
var disabledDepth = 0;
|
|
331
|
-
var prevLog;
|
|
332
|
-
var prevInfo;
|
|
333
|
-
var prevWarn;
|
|
334
|
-
var prevError;
|
|
335
|
-
var prevGroup;
|
|
336
|
-
var prevGroupCollapsed;
|
|
337
|
-
var prevGroupEnd;
|
|
338
|
-
|
|
339
|
-
function disabledLog() {}
|
|
340
|
-
|
|
341
|
-
disabledLog.__reactDisabledLog = true;
|
|
342
|
-
function disableLogs() {
|
|
343
|
-
{
|
|
344
|
-
if (disabledDepth === 0) {
|
|
345
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
346
|
-
prevLog = console.log;
|
|
347
|
-
prevInfo = console.info;
|
|
348
|
-
prevWarn = console.warn;
|
|
349
|
-
prevError = console.error;
|
|
350
|
-
prevGroup = console.group;
|
|
351
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
352
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
353
|
-
|
|
354
|
-
var props = {
|
|
355
|
-
configurable: true,
|
|
356
|
-
enumerable: true,
|
|
357
|
-
value: disabledLog,
|
|
358
|
-
writable: true
|
|
359
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
360
|
-
|
|
361
|
-
Object.defineProperties(console, {
|
|
362
|
-
info: props,
|
|
363
|
-
log: props,
|
|
364
|
-
warn: props,
|
|
365
|
-
error: props,
|
|
366
|
-
group: props,
|
|
367
|
-
groupCollapsed: props,
|
|
368
|
-
groupEnd: props
|
|
369
|
-
});
|
|
370
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
disabledDepth++;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function reenableLogs() {
|
|
377
|
-
{
|
|
378
|
-
disabledDepth--;
|
|
379
|
-
|
|
380
|
-
if (disabledDepth === 0) {
|
|
381
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
382
|
-
var props = {
|
|
383
|
-
configurable: true,
|
|
384
|
-
enumerable: true,
|
|
385
|
-
writable: true
|
|
386
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
387
|
-
|
|
388
|
-
Object.defineProperties(console, {
|
|
389
|
-
log: assign({}, props, {
|
|
390
|
-
value: prevLog
|
|
391
|
-
}),
|
|
392
|
-
info: assign({}, props, {
|
|
393
|
-
value: prevInfo
|
|
394
|
-
}),
|
|
395
|
-
warn: assign({}, props, {
|
|
396
|
-
value: prevWarn
|
|
397
|
-
}),
|
|
398
|
-
error: assign({}, props, {
|
|
399
|
-
value: prevError
|
|
400
|
-
}),
|
|
401
|
-
group: assign({}, props, {
|
|
402
|
-
value: prevGroup
|
|
403
|
-
}),
|
|
404
|
-
groupCollapsed: assign({}, props, {
|
|
405
|
-
value: prevGroupCollapsed
|
|
406
|
-
}),
|
|
407
|
-
groupEnd: assign({}, props, {
|
|
408
|
-
value: prevGroupEnd
|
|
409
|
-
})
|
|
410
|
-
});
|
|
411
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (disabledDepth < 0) {
|
|
415
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
421
|
-
var prefix;
|
|
422
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
423
|
-
{
|
|
424
|
-
if (prefix === undefined) {
|
|
425
|
-
// Extract the VM specific prefix used by each line.
|
|
426
|
-
try {
|
|
427
|
-
throw Error();
|
|
428
|
-
} catch (x) {
|
|
429
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
430
|
-
prefix = match && match[1] || '';
|
|
431
|
-
}
|
|
432
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
return '\n' + prefix + name;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
var reentry = false;
|
|
439
|
-
var componentFrameCache;
|
|
440
|
-
|
|
441
|
-
{
|
|
442
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
443
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
447
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
448
|
-
if ( !fn || reentry) {
|
|
449
|
-
return '';
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
{
|
|
453
|
-
var frame = componentFrameCache.get(fn);
|
|
454
|
-
|
|
455
|
-
if (frame !== undefined) {
|
|
456
|
-
return frame;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
var control;
|
|
461
|
-
reentry = true;
|
|
462
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
463
|
-
|
|
464
|
-
Error.prepareStackTrace = undefined;
|
|
465
|
-
var previousDispatcher;
|
|
466
|
-
|
|
467
|
-
{
|
|
468
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
469
|
-
// for warnings.
|
|
470
|
-
|
|
471
|
-
ReactCurrentDispatcher.current = null;
|
|
472
|
-
disableLogs();
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
try {
|
|
476
|
-
// This should throw.
|
|
477
|
-
if (construct) {
|
|
478
|
-
// Something should be setting the props in the constructor.
|
|
479
|
-
var Fake = function () {
|
|
480
|
-
throw Error();
|
|
481
|
-
}; // $FlowFixMe
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
485
|
-
set: function () {
|
|
486
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
487
|
-
// because that won't throw in a non-strict mode function.
|
|
488
|
-
throw Error();
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
493
|
-
// We construct a different control for this case to include any extra
|
|
494
|
-
// frames added by the construct call.
|
|
495
|
-
try {
|
|
496
|
-
Reflect.construct(Fake, []);
|
|
497
|
-
} catch (x) {
|
|
498
|
-
control = x;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
Reflect.construct(fn, [], Fake);
|
|
502
|
-
} else {
|
|
503
|
-
try {
|
|
504
|
-
Fake.call();
|
|
505
|
-
} catch (x) {
|
|
506
|
-
control = x;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
fn.call(Fake.prototype);
|
|
510
|
-
}
|
|
511
|
-
} else {
|
|
512
|
-
try {
|
|
513
|
-
throw Error();
|
|
514
|
-
} catch (x) {
|
|
515
|
-
control = x;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
fn();
|
|
519
|
-
}
|
|
520
|
-
} catch (sample) {
|
|
521
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
522
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
523
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
524
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
525
|
-
var sampleLines = sample.stack.split('\n');
|
|
526
|
-
var controlLines = control.stack.split('\n');
|
|
527
|
-
var s = sampleLines.length - 1;
|
|
528
|
-
var c = controlLines.length - 1;
|
|
529
|
-
|
|
530
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
531
|
-
// We expect at least one stack frame to be shared.
|
|
532
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
533
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
534
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
535
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
536
|
-
// the sample somewhere in the control.
|
|
537
|
-
c--;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
541
|
-
// Next we find the first one that isn't the same which should be the
|
|
542
|
-
// frame that called our sample function and the control.
|
|
543
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
544
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
545
|
-
// If we're about to return the first line, and the control is also on the same
|
|
546
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
547
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
548
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
549
|
-
if (s !== 1 || c !== 1) {
|
|
550
|
-
do {
|
|
551
|
-
s--;
|
|
552
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
553
|
-
// The next one that isn't the same should be our match though.
|
|
554
|
-
|
|
555
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
556
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
557
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
558
|
-
// but we have a user-provided "displayName"
|
|
559
|
-
// splice it in to make the stack more readable.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
563
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
{
|
|
567
|
-
if (typeof fn === 'function') {
|
|
568
|
-
componentFrameCache.set(fn, _frame);
|
|
569
|
-
}
|
|
570
|
-
} // Return the line we found.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return _frame;
|
|
574
|
-
}
|
|
575
|
-
} while (s >= 1 && c >= 0);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
} finally {
|
|
583
|
-
reentry = false;
|
|
584
|
-
|
|
585
|
-
{
|
|
586
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
587
|
-
reenableLogs();
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
591
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
595
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
596
|
-
|
|
597
|
-
{
|
|
598
|
-
if (typeof fn === 'function') {
|
|
599
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
return syntheticFrame;
|
|
604
|
-
}
|
|
605
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
606
|
-
{
|
|
607
|
-
return describeNativeComponentFrame(fn, false);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
function shouldConstruct(Component) {
|
|
612
|
-
var prototype = Component.prototype;
|
|
613
|
-
return !!(prototype && prototype.isReactComponent);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
617
|
-
|
|
618
|
-
if (type == null) {
|
|
619
|
-
return '';
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (typeof type === 'function') {
|
|
623
|
-
{
|
|
624
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
if (typeof type === 'string') {
|
|
629
|
-
return describeBuiltInComponentFrame(type);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
switch (type) {
|
|
633
|
-
case REACT_SUSPENSE_TYPE:
|
|
634
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
635
|
-
|
|
636
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
637
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
if (typeof type === 'object') {
|
|
641
|
-
switch (type.$$typeof) {
|
|
642
|
-
case REACT_FORWARD_REF_TYPE:
|
|
643
|
-
return describeFunctionComponentFrame(type.render);
|
|
644
|
-
|
|
645
|
-
case REACT_MEMO_TYPE:
|
|
646
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
647
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
648
|
-
|
|
649
|
-
case REACT_LAZY_TYPE:
|
|
650
|
-
{
|
|
651
|
-
var lazyComponent = type;
|
|
652
|
-
var payload = lazyComponent._payload;
|
|
653
|
-
var init = lazyComponent._init;
|
|
654
|
-
|
|
655
|
-
try {
|
|
656
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
657
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
658
|
-
} catch (x) {}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
return '';
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
667
|
-
|
|
668
|
-
var loggedTypeFailures = {};
|
|
669
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
670
|
-
|
|
671
|
-
function setCurrentlyValidatingElement(element) {
|
|
672
|
-
{
|
|
673
|
-
if (element) {
|
|
674
|
-
var owner = element._owner;
|
|
675
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
676
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
677
|
-
} else {
|
|
678
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
684
|
-
{
|
|
685
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
686
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
687
|
-
|
|
688
|
-
for (var typeSpecName in typeSpecs) {
|
|
689
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
690
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
691
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
692
|
-
// After these have been cleaned up, we'll let them throw.
|
|
693
|
-
|
|
694
|
-
try {
|
|
695
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
696
|
-
// behavior as without this statement except with a better message.
|
|
697
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
698
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
699
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
700
|
-
err.name = 'Invariant Violation';
|
|
701
|
-
throw err;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
705
|
-
} catch (ex) {
|
|
706
|
-
error$1 = ex;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
710
|
-
setCurrentlyValidatingElement(element);
|
|
711
|
-
|
|
712
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
713
|
-
|
|
714
|
-
setCurrentlyValidatingElement(null);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
718
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
719
|
-
// same error.
|
|
720
|
-
loggedTypeFailures[error$1.message] = true;
|
|
721
|
-
setCurrentlyValidatingElement(element);
|
|
722
|
-
|
|
723
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
724
|
-
|
|
725
|
-
setCurrentlyValidatingElement(null);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
733
|
-
|
|
734
|
-
function isArray(a) {
|
|
735
|
-
return isArrayImpl(a);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/*
|
|
739
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
740
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
741
|
-
*
|
|
742
|
-
* The functions in this module will throw an easier-to-understand,
|
|
743
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
744
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
745
|
-
* of the `value` object).
|
|
746
|
-
*/
|
|
747
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
748
|
-
function typeName(value) {
|
|
749
|
-
{
|
|
750
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
751
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
752
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
753
|
-
return type;
|
|
754
|
-
}
|
|
755
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
function willCoercionThrow(value) {
|
|
759
|
-
{
|
|
760
|
-
try {
|
|
761
|
-
testStringCoercion(value);
|
|
762
|
-
return false;
|
|
763
|
-
} catch (e) {
|
|
764
|
-
return true;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
function testStringCoercion(value) {
|
|
770
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
771
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
772
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
773
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
774
|
-
//
|
|
775
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
776
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
777
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
778
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
779
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
780
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
781
|
-
//
|
|
782
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
783
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
784
|
-
//
|
|
785
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
786
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
787
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
788
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
789
|
-
// In most cases, this console output also shows the component and its
|
|
790
|
-
// ancestor components where the exception happened.
|
|
791
|
-
//
|
|
792
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
793
|
-
return '' + value;
|
|
794
|
-
}
|
|
795
|
-
function checkKeyStringCoercion(value) {
|
|
796
|
-
{
|
|
797
|
-
if (willCoercionThrow(value)) {
|
|
798
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
799
|
-
|
|
800
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
806
|
-
var RESERVED_PROPS = {
|
|
807
|
-
key: true,
|
|
808
|
-
ref: true,
|
|
809
|
-
__self: true,
|
|
810
|
-
__source: true
|
|
811
|
-
};
|
|
812
|
-
var specialPropKeyWarningShown;
|
|
813
|
-
var specialPropRefWarningShown;
|
|
814
|
-
|
|
815
|
-
function hasValidRef(config) {
|
|
816
|
-
{
|
|
817
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
818
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
819
|
-
|
|
820
|
-
if (getter && getter.isReactWarning) {
|
|
821
|
-
return false;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
return config.ref !== undefined;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
function hasValidKey(config) {
|
|
830
|
-
{
|
|
831
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
832
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
833
|
-
|
|
834
|
-
if (getter && getter.isReactWarning) {
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
return config.key !== undefined;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
844
|
-
{
|
|
845
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
850
|
-
{
|
|
851
|
-
var warnAboutAccessingKey = function () {
|
|
852
|
-
if (!specialPropKeyWarningShown) {
|
|
853
|
-
specialPropKeyWarningShown = true;
|
|
854
|
-
|
|
855
|
-
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
860
|
-
Object.defineProperty(props, 'key', {
|
|
861
|
-
get: warnAboutAccessingKey,
|
|
862
|
-
configurable: true
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
868
|
-
{
|
|
869
|
-
var warnAboutAccessingRef = function () {
|
|
870
|
-
if (!specialPropRefWarningShown) {
|
|
871
|
-
specialPropRefWarningShown = true;
|
|
872
|
-
|
|
873
|
-
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
|
|
877
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
878
|
-
Object.defineProperty(props, 'ref', {
|
|
879
|
-
get: warnAboutAccessingRef,
|
|
880
|
-
configurable: true
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
886
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
887
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
888
|
-
* if something is a React Element.
|
|
889
|
-
*
|
|
890
|
-
* @param {*} type
|
|
891
|
-
* @param {*} props
|
|
892
|
-
* @param {*} key
|
|
893
|
-
* @param {string|object} ref
|
|
894
|
-
* @param {*} owner
|
|
895
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
896
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
897
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
898
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
899
|
-
* change in behavior.
|
|
900
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
901
|
-
* indicating filename, line number, and/or other information.
|
|
902
|
-
* @internal
|
|
903
|
-
*/
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
907
|
-
var element = {
|
|
908
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
909
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
910
|
-
// Built-in properties that belong on the element
|
|
911
|
-
type: type,
|
|
912
|
-
key: key,
|
|
913
|
-
ref: ref,
|
|
914
|
-
props: props,
|
|
915
|
-
// Record the component responsible for creating this element.
|
|
916
|
-
_owner: owner
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
{
|
|
920
|
-
// The validation flag is currently mutative. We put it on
|
|
921
|
-
// an external backing store so that we can freeze the whole object.
|
|
922
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
923
|
-
// commonly used development environments.
|
|
924
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
925
|
-
// the validation flag non-enumerable (where possible, which should
|
|
926
|
-
// include every environment we run tests in), so the test framework
|
|
927
|
-
// ignores it.
|
|
928
|
-
|
|
929
|
-
Object.defineProperty(element._store, 'validated', {
|
|
930
|
-
configurable: false,
|
|
931
|
-
enumerable: false,
|
|
932
|
-
writable: true,
|
|
933
|
-
value: false
|
|
934
|
-
}); // self and source are DEV only properties.
|
|
935
|
-
|
|
936
|
-
Object.defineProperty(element, '_self', {
|
|
937
|
-
configurable: false,
|
|
938
|
-
enumerable: false,
|
|
939
|
-
writable: false,
|
|
940
|
-
value: self
|
|
941
|
-
}); // Two elements created in two different places should be considered
|
|
942
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
943
|
-
|
|
944
|
-
Object.defineProperty(element, '_source', {
|
|
945
|
-
configurable: false,
|
|
946
|
-
enumerable: false,
|
|
947
|
-
writable: false,
|
|
948
|
-
value: source
|
|
949
|
-
});
|
|
950
|
-
|
|
951
|
-
if (Object.freeze) {
|
|
952
|
-
Object.freeze(element.props);
|
|
953
|
-
Object.freeze(element);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
return element;
|
|
958
|
-
};
|
|
959
|
-
/**
|
|
960
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
961
|
-
* @param {*} type
|
|
962
|
-
* @param {object} props
|
|
963
|
-
* @param {string} key
|
|
964
|
-
*/
|
|
965
|
-
|
|
966
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
967
|
-
{
|
|
968
|
-
var propName; // Reserved names are extracted
|
|
969
|
-
|
|
970
|
-
var props = {};
|
|
971
|
-
var key = null;
|
|
972
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
973
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
974
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
975
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
976
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
977
|
-
// key is explicitly declared to be undefined or not.
|
|
978
|
-
|
|
979
|
-
if (maybeKey !== undefined) {
|
|
980
|
-
{
|
|
981
|
-
checkKeyStringCoercion(maybeKey);
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
key = '' + maybeKey;
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
if (hasValidKey(config)) {
|
|
988
|
-
{
|
|
989
|
-
checkKeyStringCoercion(config.key);
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
key = '' + config.key;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
if (hasValidRef(config)) {
|
|
996
|
-
ref = config.ref;
|
|
997
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
998
|
-
} // Remaining properties are added to a new props object
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
for (propName in config) {
|
|
1002
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1003
|
-
props[propName] = config[propName];
|
|
1004
|
-
}
|
|
1005
|
-
} // Resolve default props
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
if (type && type.defaultProps) {
|
|
1009
|
-
var defaultProps = type.defaultProps;
|
|
1010
|
-
|
|
1011
|
-
for (propName in defaultProps) {
|
|
1012
|
-
if (props[propName] === undefined) {
|
|
1013
|
-
props[propName] = defaultProps[propName];
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
if (key || ref) {
|
|
1019
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1020
|
-
|
|
1021
|
-
if (key) {
|
|
1022
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
if (ref) {
|
|
1026
|
-
defineRefPropWarningGetter(props, displayName);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1035
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1036
|
-
|
|
1037
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1038
|
-
{
|
|
1039
|
-
if (element) {
|
|
1040
|
-
var owner = element._owner;
|
|
1041
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1042
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1043
|
-
} else {
|
|
1044
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
var propTypesMisspellWarningShown;
|
|
1050
|
-
|
|
1051
|
-
{
|
|
1052
|
-
propTypesMisspellWarningShown = false;
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Verifies the object is a ReactElement.
|
|
1056
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1057
|
-
* @param {?object} object
|
|
1058
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1059
|
-
* @final
|
|
1060
|
-
*/
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
function isValidElement(object) {
|
|
1064
|
-
{
|
|
1065
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
function getDeclarationErrorAddendum() {
|
|
1070
|
-
{
|
|
1071
|
-
if (ReactCurrentOwner$1.current) {
|
|
1072
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1073
|
-
|
|
1074
|
-
if (name) {
|
|
1075
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
return '';
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1084
|
-
{
|
|
1085
|
-
|
|
1086
|
-
return '';
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1091
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1092
|
-
* updates.
|
|
1093
|
-
*/
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
var ownerHasKeyUseWarning = {};
|
|
1097
|
-
|
|
1098
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1099
|
-
{
|
|
1100
|
-
var info = getDeclarationErrorAddendum();
|
|
1101
|
-
|
|
1102
|
-
if (!info) {
|
|
1103
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1104
|
-
|
|
1105
|
-
if (parentName) {
|
|
1106
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
return info;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1115
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1116
|
-
* reordered. All children that haven't already been validated are required to
|
|
1117
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1118
|
-
* will only be shown once.
|
|
1119
|
-
*
|
|
1120
|
-
* @internal
|
|
1121
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1122
|
-
* @param {*} parentType element's parent's type.
|
|
1123
|
-
*/
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
function validateExplicitKey(element, parentType) {
|
|
1127
|
-
{
|
|
1128
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
element._store.validated = true;
|
|
1133
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1134
|
-
|
|
1135
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1140
|
-
// property, it may be the creator of the child that's responsible for
|
|
1141
|
-
// assigning it a key.
|
|
1142
|
-
|
|
1143
|
-
var childOwner = '';
|
|
1144
|
-
|
|
1145
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1146
|
-
// Give the component that originally created this child.
|
|
1147
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
setCurrentlyValidatingElement$1(element);
|
|
1151
|
-
|
|
1152
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1153
|
-
|
|
1154
|
-
setCurrentlyValidatingElement$1(null);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1159
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1160
|
-
* with valid key property.
|
|
1161
|
-
*
|
|
1162
|
-
* @internal
|
|
1163
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1164
|
-
* @param {*} parentType node's parent's type.
|
|
1165
|
-
*/
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
function validateChildKeys(node, parentType) {
|
|
1169
|
-
{
|
|
1170
|
-
if (typeof node !== 'object') {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
if (isArray(node)) {
|
|
1175
|
-
for (var i = 0; i < node.length; i++) {
|
|
1176
|
-
var child = node[i];
|
|
1177
|
-
|
|
1178
|
-
if (isValidElement(child)) {
|
|
1179
|
-
validateExplicitKey(child, parentType);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
} else if (isValidElement(node)) {
|
|
1183
|
-
// This element was passed in a valid location.
|
|
1184
|
-
if (node._store) {
|
|
1185
|
-
node._store.validated = true;
|
|
1186
|
-
}
|
|
1187
|
-
} else if (node) {
|
|
1188
|
-
var iteratorFn = getIteratorFn(node);
|
|
1189
|
-
|
|
1190
|
-
if (typeof iteratorFn === 'function') {
|
|
1191
|
-
// Entry iterators used to provide implicit keys,
|
|
1192
|
-
// but now we print a separate warning for them later.
|
|
1193
|
-
if (iteratorFn !== node.entries) {
|
|
1194
|
-
var iterator = iteratorFn.call(node);
|
|
1195
|
-
var step;
|
|
1196
|
-
|
|
1197
|
-
while (!(step = iterator.next()).done) {
|
|
1198
|
-
if (isValidElement(step.value)) {
|
|
1199
|
-
validateExplicitKey(step.value, parentType);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1209
|
-
* provided by the type.
|
|
1210
|
-
*
|
|
1211
|
-
* @param {ReactElement} element
|
|
1212
|
-
*/
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
function validatePropTypes(element) {
|
|
1216
|
-
{
|
|
1217
|
-
var type = element.type;
|
|
1218
|
-
|
|
1219
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
var propTypes;
|
|
1224
|
-
|
|
1225
|
-
if (typeof type === 'function') {
|
|
1226
|
-
propTypes = type.propTypes;
|
|
1227
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1228
|
-
// Inner props are checked in the reconciler.
|
|
1229
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1230
|
-
propTypes = type.propTypes;
|
|
1231
|
-
} else {
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
if (propTypes) {
|
|
1236
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1237
|
-
var name = getComponentNameFromType(type);
|
|
1238
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1239
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1240
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1241
|
-
|
|
1242
|
-
var _name = getComponentNameFromType(type);
|
|
1243
|
-
|
|
1244
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1248
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
/**
|
|
1253
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1254
|
-
* @param {ReactElement} fragment
|
|
1255
|
-
*/
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
function validateFragmentProps(fragment) {
|
|
1259
|
-
{
|
|
1260
|
-
var keys = Object.keys(fragment.props);
|
|
1261
|
-
|
|
1262
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1263
|
-
var key = keys[i];
|
|
1264
|
-
|
|
1265
|
-
if (key !== 'children' && key !== 'key') {
|
|
1266
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1267
|
-
|
|
1268
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1269
|
-
|
|
1270
|
-
setCurrentlyValidatingElement$1(null);
|
|
1271
|
-
break;
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
if (fragment.ref !== null) {
|
|
1276
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1277
|
-
|
|
1278
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1279
|
-
|
|
1280
|
-
setCurrentlyValidatingElement$1(null);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
var didWarnAboutKeySpread = {};
|
|
1286
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1287
|
-
{
|
|
1288
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1289
|
-
// succeed and there will likely be errors in render.
|
|
1290
|
-
|
|
1291
|
-
if (!validType) {
|
|
1292
|
-
var info = '';
|
|
1293
|
-
|
|
1294
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1295
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
var sourceInfo = getSourceInfoErrorAddendum();
|
|
1299
|
-
|
|
1300
|
-
if (sourceInfo) {
|
|
1301
|
-
info += sourceInfo;
|
|
1302
|
-
} else {
|
|
1303
|
-
info += getDeclarationErrorAddendum();
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
var typeString;
|
|
1307
|
-
|
|
1308
|
-
if (type === null) {
|
|
1309
|
-
typeString = 'null';
|
|
1310
|
-
} else if (isArray(type)) {
|
|
1311
|
-
typeString = 'array';
|
|
1312
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1313
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1314
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1315
|
-
} else {
|
|
1316
|
-
typeString = typeof type;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1323
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1324
|
-
|
|
1325
|
-
if (element == null) {
|
|
1326
|
-
return element;
|
|
1327
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1328
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1329
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1330
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1331
|
-
// fixed, the key warnings will appear.)
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
if (validType) {
|
|
1335
|
-
var children = props.children;
|
|
1336
|
-
|
|
1337
|
-
if (children !== undefined) {
|
|
1338
|
-
if (isStaticChildren) {
|
|
1339
|
-
if (isArray(children)) {
|
|
1340
|
-
for (var i = 0; i < children.length; i++) {
|
|
1341
|
-
validateChildKeys(children[i], type);
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
if (Object.freeze) {
|
|
1345
|
-
Object.freeze(children);
|
|
1346
|
-
}
|
|
1347
|
-
} else {
|
|
1348
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1349
|
-
}
|
|
1350
|
-
} else {
|
|
1351
|
-
validateChildKeys(children, type);
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
{
|
|
1357
|
-
if (hasOwnProperty.call(props, 'key')) {
|
|
1358
|
-
var componentName = getComponentNameFromType(type);
|
|
1359
|
-
var keys = Object.keys(props).filter(function (k) {
|
|
1360
|
-
return k !== 'key';
|
|
1361
|
-
});
|
|
1362
|
-
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1363
|
-
|
|
1364
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1365
|
-
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1366
|
-
|
|
1367
|
-
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
1368
|
-
|
|
1369
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1375
|
-
validateFragmentProps(element);
|
|
1376
|
-
} else {
|
|
1377
|
-
validatePropTypes(element);
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
return element;
|
|
1381
|
-
}
|
|
1382
|
-
} // These two functions exist to still get child warnings in dev
|
|
1383
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1384
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1385
|
-
// giving you warnings if you use production apis.
|
|
1386
|
-
|
|
1387
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1388
|
-
{
|
|
1389
|
-
return jsxWithValidation(type, props, key, true);
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1393
|
-
{
|
|
1394
|
-
return jsxWithValidation(type, props, key, false);
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1399
|
-
// for now we can ship identical prod functions
|
|
1400
|
-
|
|
1401
|
-
var jsxs = jsxWithValidationStatic ;
|
|
1402
|
-
|
|
1403
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1404
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
1405
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
1406
|
-
})();
|
|
1407
|
-
}
|
|
1408
|
-
return reactJsxRuntime_development;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
var hasRequiredJsxRuntime;
|
|
1412
|
-
|
|
1413
|
-
function requireJsxRuntime () {
|
|
1414
|
-
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
1415
|
-
hasRequiredJsxRuntime = 1;
|
|
1416
|
-
|
|
1417
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1418
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1419
|
-
} else {
|
|
1420
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1421
|
-
}
|
|
1422
|
-
return jsxRuntime.exports;
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
var jsxRuntimeExports = requireJsxRuntime();
|
|
1426
|
-
|
|
1427
65
|
function cn(...inputs) {
|
|
1428
66
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
1429
67
|
}
|
|
1430
68
|
|
|
1431
|
-
const ScrollArea = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
69
|
+
const ScrollArea = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(ScrollAreaPrimitive__namespace.Root, { ref: ref, className: cn("relative overflow-hidden", className), ...props, children: [jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Viewport, { className: "h-full w-full rounded-[inherit]", children: children }), jsxRuntime.jsx(ScrollBar, {}), jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})] })));
|
|
1432
70
|
ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
|
|
1433
|
-
const ScrollBar = React__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (
|
|
71
|
+
const ScrollBar = React__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn("flex touch-none select-none transition-colors", orientation === "vertical" &&
|
|
1434
72
|
"h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" &&
|
|
1435
|
-
"h-2.5 flex-col border-t border-t-transparent p-[1px]", className), ...props, children:
|
|
73
|
+
"h-2.5 flex-col border-t border-t-transparent p-[1px]", className), ...props, children: jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) })));
|
|
1436
74
|
ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
|
|
1437
75
|
|
|
1438
76
|
const buttonVariants = classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0" +
|
|
@@ -1466,11 +104,11 @@ const buttonVariants = classVarianceAuthority.cva("inline-flex items-center just
|
|
|
1466
104
|
});
|
|
1467
105
|
const Button = React__namespace.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1468
106
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
1469
|
-
return (
|
|
107
|
+
return (jsxRuntime.jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
1470
108
|
});
|
|
1471
109
|
Button.displayName = "Button";
|
|
1472
110
|
|
|
1473
|
-
const Progress = React__namespace.forwardRef(({ className, value, ...props }, ref) => (
|
|
111
|
+
const Progress = React__namespace.forwardRef(({ className, value, ...props }, ref) => (jsxRuntime.jsx(ProgressPrimitive__namespace.Root, { ref: ref, className: cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className), ...props, children: jsxRuntime.jsx(ProgressPrimitive__namespace.Indicator, { className: "h-full w-full flex-1 bg-primary transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
|
|
1474
112
|
Progress.displayName = ProgressPrimitive__namespace.Root.displayName;
|
|
1475
113
|
|
|
1476
114
|
const createEmptyColumn = (width = 12) => ({
|
|
@@ -2504,35 +1142,35 @@ const useFormStore = zustand.create((set, get) => ({
|
|
|
2504
1142
|
|
|
2505
1143
|
const Input = React__namespace.forwardRef(({ className, type, ...props }, ref) => {
|
|
2506
1144
|
// h-9 to match icon buttons and default buttons.
|
|
2507
|
-
return (
|
|
1145
|
+
return (jsxRuntime.jsx("input", { type: type, className: cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className), ref: ref, ...props }));
|
|
2508
1146
|
});
|
|
2509
1147
|
Input.displayName = "Input";
|
|
2510
1148
|
|
|
2511
1149
|
const Textarea = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2512
|
-
return (
|
|
1150
|
+
return (jsxRuntime.jsx("textarea", { className: cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className), ref: ref, ...props }));
|
|
2513
1151
|
});
|
|
2514
1152
|
Textarea.displayName = "Textarea";
|
|
2515
1153
|
|
|
2516
|
-
const Checkbox = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1154
|
+
const Checkbox = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(CheckboxPrimitive__namespace.Root, { ref: ref, className: cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", className), ...props, children: jsxRuntime.jsx(CheckboxPrimitive__namespace.Indicator, { className: cn("flex items-center justify-center text-current"), children: jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) })));
|
|
2517
1155
|
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
2518
1156
|
|
|
2519
|
-
const Switch = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1157
|
+
const Switch = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(SwitchPrimitives__namespace.Root, { className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, ref: ref, children: jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, { className: cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0") }) })));
|
|
2520
1158
|
Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
|
|
2521
1159
|
|
|
2522
1160
|
const labelVariants = classVarianceAuthority.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
2523
|
-
const Label = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1161
|
+
const Label = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref: ref, className: cn(labelVariants(), className), ...props })));
|
|
2524
1162
|
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
2525
1163
|
|
|
2526
1164
|
const RadioGroup = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2527
|
-
return (
|
|
1165
|
+
return (jsxRuntime.jsx(RadioGroupPrimitive__namespace.Root, { className: cn("grid gap-2", className), ...props, ref: ref }));
|
|
2528
1166
|
});
|
|
2529
1167
|
RadioGroup.displayName = RadioGroupPrimitive__namespace.Root.displayName;
|
|
2530
1168
|
const RadioGroupItem = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2531
|
-
return (
|
|
1169
|
+
return (jsxRuntime.jsx(RadioGroupPrimitive__namespace.Item, { ref: ref, className: cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ...props, children: jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex items-center justify-center", children: jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) }) }));
|
|
2532
1170
|
});
|
|
2533
1171
|
RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
|
|
2534
1172
|
|
|
2535
|
-
const Slider = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1173
|
+
const Slider = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsxs(SliderPrimitive__namespace.Root, { ref: ref, className: cn("relative flex w-full touch-none select-none items-center", className), ...props, children: [jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: "absolute h-full bg-primary" }) }), jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })] })));
|
|
2536
1174
|
Slider.displayName = SliderPrimitive__namespace.Root.displayName;
|
|
2537
1175
|
|
|
2538
1176
|
const badgeVariants = classVarianceAuthority.cva(
|
|
@@ -2552,35 +1190,35 @@ const badgeVariants = classVarianceAuthority.cva(
|
|
|
2552
1190
|
},
|
|
2553
1191
|
});
|
|
2554
1192
|
function Badge({ className, variant, ...props }) {
|
|
2555
|
-
return (
|
|
1193
|
+
return (jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props }));
|
|
2556
1194
|
}
|
|
2557
1195
|
|
|
2558
1196
|
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
2559
1197
|
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
2560
|
-
const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
|
|
1198
|
+
const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (jsxRuntime.jsx(TooltipPrimitive__namespace.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]", className), ...props })));
|
|
2561
1199
|
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
2562
1200
|
|
|
2563
1201
|
const Select = SelectPrimitive__namespace.Root;
|
|
2564
1202
|
const SelectValue = SelectPrimitive__namespace.Value;
|
|
2565
|
-
const SelectTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
1203
|
+
const SelectTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(SelectPrimitive__namespace.Trigger, { ref: ref, className: cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className), ...props, children: [children, jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })] })));
|
|
2566
1204
|
SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
|
|
2567
|
-
const SelectScrollUpButton = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1205
|
+
const SelectScrollUpButton = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(SelectPrimitive__namespace.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4" }) })));
|
|
2568
1206
|
SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
|
|
2569
|
-
const SelectScrollDownButton = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1207
|
+
const SelectScrollDownButton = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(SelectPrimitive__namespace.ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" }) })));
|
|
2570
1208
|
SelectScrollDownButton.displayName =
|
|
2571
1209
|
SelectPrimitive__namespace.ScrollDownButton.displayName;
|
|
2572
|
-
const SelectContent = React__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => (
|
|
2573
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, ...props, children: [
|
|
2574
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }),
|
|
1210
|
+
const SelectContent = React__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => (jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: jsxRuntime.jsxs(SelectPrimitive__namespace.Content, { ref: ref, className: cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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 origin-[--radix-select-content-transform-origin]", position === "popper" &&
|
|
1211
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, ...props, children: [jsxRuntime.jsx(SelectScrollUpButton, {}), jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: cn("p-1", position === "popper" &&
|
|
1212
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), jsxRuntime.jsx(SelectScrollDownButton, {})] }) })));
|
|
2575
1213
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
2576
|
-
const SelectLabel = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1214
|
+
const SelectLabel = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(SelectPrimitive__namespace.Label, { ref: ref, className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className), ...props })));
|
|
2577
1215
|
SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
|
|
2578
|
-
const SelectItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
1216
|
+
const SelectItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(SelectPrimitive__namespace.Item, { ref: ref, className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children: children })] })));
|
|
2579
1217
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
2580
|
-
const SelectSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
1218
|
+
const SelectSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(SelectPrimitive__namespace.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
|
|
2581
1219
|
SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
|
|
2582
1220
|
|
|
2583
|
-
const Separator = React__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
1221
|
+
const Separator = React__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (jsxRuntime.jsx(SeparatorPrimitive__namespace.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className), ...props })));
|
|
2584
1222
|
Separator.displayName = SeparatorPrimitive__namespace.Root.displayName;
|
|
2585
1223
|
|
|
2586
1224
|
function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode, getFieldValue, setFieldValue, fields, gap, padding, hasBorder, direction, background, flexWrap = 'wrap', justifyContent = 'flex-start', alignItems = 'stretch', fieldSize = 'normal', }) {
|
|
@@ -2615,7 +1253,7 @@ function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode,
|
|
|
2615
1253
|
// In preview mode, remove container padding/gap for consistent alignment with rows
|
|
2616
1254
|
const effectivePadding = isPreviewMode ? 0 : padding * 4;
|
|
2617
1255
|
const effectiveGap = isPreviewMode ? 0 : gap * 4;
|
|
2618
|
-
return (
|
|
1256
|
+
return (jsxRuntime.jsx("div", { ref: setNodeRef, className: `rounded-lg transition-all ${!isPreviewMode ? 'border-2 border-dashed border-primary/40 bg-primary/5' : ''} ${hasBorder ? 'border border-solid border-border' : ''} ${isOver ? 'border-primary bg-primary/15' : ''}`, style: {
|
|
2619
1257
|
display: 'flex',
|
|
2620
1258
|
flexDirection: direction,
|
|
2621
1259
|
flexWrap: flexWrap,
|
|
@@ -2625,14 +1263,14 @@ function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode,
|
|
|
2625
1263
|
padding: `${effectivePadding}px`,
|
|
2626
1264
|
background: background || (isPreviewMode ? 'transparent' : undefined),
|
|
2627
1265
|
minHeight: isPreviewMode ? undefined : '100px',
|
|
2628
|
-
}, children: fields.length === 0 && !isPreviewMode ? (
|
|
1266
|
+
}, children: fields.length === 0 && !isPreviewMode ? (jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col items-center justify-center gap-2 py-4", children: [jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center", children: jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-primary/60", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 6v6m0 0v6m0-6h6m-6 0H6" }) }) }), jsxRuntime.jsx("span", { className: "text-sm font-medium text-primary/70", children: "Drop fields here" }), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Drag inputs, dropdowns, or other fields" })] })) : (fields.map((field) => {
|
|
2629
1267
|
const fieldWidth = getFieldWidth(field);
|
|
2630
|
-
return (
|
|
1268
|
+
return (jsxRuntime.jsx("div", { className: "relative", style: {
|
|
2631
1269
|
zIndex: 20,
|
|
2632
1270
|
width: fieldWidth,
|
|
2633
1271
|
flexGrow: fieldWidth === 'auto' ? 1 : 0,
|
|
2634
1272
|
flexShrink: fieldWidth === 'auto' ? 1 : 0,
|
|
2635
|
-
}, children:
|
|
1273
|
+
}, children: jsxRuntime.jsx(CanvasField, { field: field, rowId: rowId, columnId: columnId, isPreviewMode: isPreviewMode, getFieldValue: getFieldValue, setFieldValue: setFieldValue, isInsideContainer: true, fieldSize: fieldSize }) }, field.id));
|
|
2636
1274
|
})) }));
|
|
2637
1275
|
}
|
|
2638
1276
|
function parseCssString(css) {
|
|
@@ -2704,7 +1342,7 @@ function validateField(value, validation, fieldType) {
|
|
|
2704
1342
|
}
|
|
2705
1343
|
function RatingField({ value, onChange, maxRating = 5, disabled, className }) {
|
|
2706
1344
|
const [hoverValue, setHoverValue] = React.useState(0);
|
|
2707
|
-
return (
|
|
1345
|
+
return (jsxRuntime.jsx("div", { className: `flex gap-1 ${className || ''}`, children: Array.from({ length: maxRating }, (_, i) => i + 1).map((star) => (jsxRuntime.jsx("button", { type: "button", disabled: disabled, className: "p-0.5 transition-colors disabled:opacity-50", onMouseEnter: () => !disabled && setHoverValue(star), onMouseLeave: () => setHoverValue(0), onClick: () => !disabled && onChange(star), children: jsxRuntime.jsx(lucideReact.Star, { className: `h-4 w-4 ${star <= (hoverValue || value)
|
|
2708
1346
|
? 'fill-yellow-400 text-yellow-400'
|
|
2709
1347
|
: 'text-muted-foreground'}` }) }, star))) }));
|
|
2710
1348
|
}
|
|
@@ -2776,7 +1414,7 @@ function SignatureField({ value, onChange, disabled, width = 400, height = 150,
|
|
|
2776
1414
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
2777
1415
|
onChange('');
|
|
2778
1416
|
};
|
|
2779
|
-
return (
|
|
1417
|
+
return (jsxRuntime.jsxs("div", { className: `space-y-2 ${className || ''}`, children: [jsxRuntime.jsx("canvas", { ref: canvasRef, width: width, height: height, className: "border border-border rounded-md cursor-crosshair", onMouseDown: startDrawing, onMouseMove: draw, onMouseUp: stopDrawing, onMouseLeave: stopDrawing }), jsxRuntime.jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: clearSignature, disabled: disabled, children: "Clear Signature" })] }));
|
|
2780
1418
|
}
|
|
2781
1419
|
function MultiSelectField({ value, onChange, options, disabled, maxItems, className }) {
|
|
2782
1420
|
const addItem = (item) => {
|
|
@@ -2789,9 +1427,9 @@ function MultiSelectField({ value, onChange, options, disabled, maxItems, classN
|
|
|
2789
1427
|
const removeItem = (item) => {
|
|
2790
1428
|
onChange(value.filter(v => v !== item));
|
|
2791
1429
|
};
|
|
2792
|
-
return (
|
|
1430
|
+
return (jsxRuntime.jsxs("div", { className: `space-y-2 ${className || ''}`, children: [jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 min-h-[36px] p-2 border border-border rounded-md bg-background", children: value.map((item, i) => (jsxRuntime.jsxs(Badge, { variant: "secondary", className: "gap-1", children: [item, !disabled && (jsxRuntime.jsx("button", { type: "button", onClick: () => removeItem(item), className: "ml-1 hover:text-destructive", children: jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" }) }))] }, i))) }), jsxRuntime.jsxs(Select, { disabled: disabled || (maxItems !== undefined && value.length >= maxItems), onValueChange: addItem, children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Add item..." }) }), jsxRuntime.jsx(SelectContent, { children: options
|
|
2793
1431
|
.filter(opt => !value.includes(opt))
|
|
2794
|
-
.map((option, i) => (
|
|
1432
|
+
.map((option, i) => (jsxRuntime.jsx(SelectItem, { value: option, children: option }, i))) })] })] }));
|
|
2795
1433
|
}
|
|
2796
1434
|
function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMode, getFieldValue: externalGetFieldValue, setFieldValue: externalSetFieldValue, isInsideContainer = false, fieldSize = 'normal' }) {
|
|
2797
1435
|
const store = useFormStore();
|
|
@@ -2901,27 +1539,27 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
2901
1539
|
const errorClass = hasError ? 'border-destructive focus-visible:ring-destructive' : '';
|
|
2902
1540
|
switch (field.type) {
|
|
2903
1541
|
case 'input':
|
|
2904
|
-
return (
|
|
1542
|
+
return (jsxRuntime.jsx(Input, { placeholder: field.props.placeholder, disabled: isFieldDisabled, readOnly: field.props.readOnly, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2905
1543
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2906
1544
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2907
1545
|
}, "data-testid": `field-input-${field.id}` }));
|
|
2908
1546
|
case 'password':
|
|
2909
|
-
return (
|
|
1547
|
+
return (jsxRuntime.jsx(Input, { type: "password", placeholder: field.props.placeholder, disabled: isFieldDisabled, value: isPreviewMode ? localValue : '', onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2910
1548
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2911
1549
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2912
1550
|
}, "data-testid": `field-password-${field.id}` }));
|
|
2913
1551
|
case 'phone':
|
|
2914
|
-
return (
|
|
1552
|
+
return (jsxRuntime.jsx(Input, { type: "tel", placeholder: field.props.placeholder || '+1 (555) 000-0000', disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2915
1553
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2916
1554
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2917
1555
|
}, "data-testid": `field-phone-${field.id}` }));
|
|
2918
1556
|
case 'url':
|
|
2919
|
-
return (
|
|
1557
|
+
return (jsxRuntime.jsx(Input, { type: "url", placeholder: field.props.placeholder || 'https://example.com', disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2920
1558
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2921
1559
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2922
1560
|
}, "data-testid": `field-url-${field.id}` }));
|
|
2923
1561
|
case 'textarea':
|
|
2924
|
-
return (
|
|
1562
|
+
return (jsxRuntime.jsx(Textarea, { placeholder: field.props.placeholder, disabled: isFieldDisabled, readOnly: field.props.readOnly, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `min-h-[80px] ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2925
1563
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2926
1564
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2927
1565
|
}, "data-testid": `field-textarea-${field.id}` }));
|
|
@@ -2929,140 +1567,140 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
2929
1567
|
const dropdownOptions = typeof field.props.optionsString === 'string'
|
|
2930
1568
|
? field.props.optionsString.split('\n').filter((o) => o.trim())
|
|
2931
1569
|
: (field.props.optionsString || []);
|
|
2932
|
-
return (
|
|
1570
|
+
return (jsxRuntime.jsxs(Select, { disabled: isFieldDisabled, value: isPreviewMode ? localValue : undefined, onValueChange: (v) => isPreviewMode && handleChange(v), children: [jsxRuntime.jsx(SelectTrigger, { className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2933
1571
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2934
1572
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2935
|
-
}, "data-testid": `field-dropdown-${field.id}`, children:
|
|
1573
|
+
}, "data-testid": `field-dropdown-${field.id}`, children: jsxRuntime.jsx(SelectValue, { placeholder: field.props.placeholder || 'Select...' }) }), jsxRuntime.jsx(SelectContent, { children: dropdownOptions.map((option, i) => (jsxRuntime.jsx(SelectItem, { value: option, children: option }, i))) })] }));
|
|
2936
1574
|
case 'checkbox':
|
|
2937
|
-
return (
|
|
1575
|
+
return (jsxRuntime.jsxs("div", { className: `flex items-center gap-2 ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsx(Checkbox, { disabled: isFieldDisabled, "data-testid": `field-checkbox-${field.id}` }), jsxRuntime.jsx("span", { className: "text-sm text-foreground", style: {
|
|
2938
1576
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2939
1577
|
}, children: field.props.label })] }));
|
|
2940
1578
|
case 'radio':
|
|
2941
1579
|
const radioOptions = typeof field.props.optionsString === 'string'
|
|
2942
1580
|
? field.props.optionsString.split('\n').filter((o) => o.trim())
|
|
2943
1581
|
: (field.props.optionsString || []);
|
|
2944
|
-
return (
|
|
1582
|
+
return (jsxRuntime.jsx(RadioGroup, { disabled: isFieldDisabled, className: field.customStyle?.inputClassName || '', children: radioOptions.map((option, i) => (jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(RadioGroupItem, { value: option, id: `${field.id}-${i}`, "data-testid": `field-radio-${field.id}-${i}` }), jsxRuntime.jsx(Label, { htmlFor: `${field.id}-${i}`, className: "text-sm", style: {
|
|
2945
1583
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2946
1584
|
}, children: option })] }, i))) }));
|
|
2947
1585
|
case 'toggle':
|
|
2948
|
-
return (
|
|
1586
|
+
return (jsxRuntime.jsxs("div", { className: `flex items-center gap-2 ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsx(Switch, { disabled: isFieldDisabled, "data-testid": `field-toggle-${field.id}` }), jsxRuntime.jsx("span", { className: "text-sm text-foreground", style: {
|
|
2949
1587
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2950
1588
|
}, children: field.props.label })] }));
|
|
2951
1589
|
case 'multiselect':
|
|
2952
|
-
return (
|
|
1590
|
+
return (jsxRuntime.jsx(MultiSelectField, { value: multiSelectValue, onChange: (v) => {
|
|
2953
1591
|
setMultiSelectValue(v);
|
|
2954
1592
|
setFieldValue(field.props.key, v);
|
|
2955
1593
|
}, options: field.props.optionsString || [], disabled: isFieldDisabled, maxItems: field.props.multiSelectConfig?.maxItems, className: field.customStyle?.inputClassName }));
|
|
2956
1594
|
case 'date':
|
|
2957
|
-
return (
|
|
1595
|
+
return (jsxRuntime.jsx(Input, { type: "date", disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2958
1596
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2959
1597
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2960
1598
|
}, "data-testid": `field-date-${field.id}` }));
|
|
2961
1599
|
case 'time':
|
|
2962
|
-
return (
|
|
1600
|
+
return (jsxRuntime.jsx(Input, { type: "time", disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2963
1601
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2964
1602
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2965
1603
|
}, "data-testid": `field-time-${field.id}` }));
|
|
2966
1604
|
case 'daterange':
|
|
2967
|
-
return (
|
|
1605
|
+
return (jsxRuntime.jsxs("div", { className: `flex gap-2 items-center ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsx(Input, { type: "date", disabled: isFieldDisabled, className: inputSize, style: {
|
|
2968
1606
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2969
|
-
}, "data-testid": `field-daterange-start-${field.id}` }),
|
|
1607
|
+
}, "data-testid": `field-daterange-start-${field.id}` }), jsxRuntime.jsx("span", { className: "text-muted-foreground", style: {
|
|
2970
1608
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2971
|
-
}, children: "to" }),
|
|
1609
|
+
}, children: "to" }), jsxRuntime.jsx(Input, { type: "date", disabled: isFieldDisabled, className: inputSize, style: {
|
|
2972
1610
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2973
1611
|
}, "data-testid": `field-daterange-end-${field.id}` })] }));
|
|
2974
1612
|
case 'number':
|
|
2975
|
-
return (
|
|
1613
|
+
return (jsxRuntime.jsx(Input, { type: "number", placeholder: field.props.placeholder, disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2976
1614
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2977
1615
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2978
1616
|
}, "data-testid": `field-number-${field.id}` }));
|
|
2979
1617
|
case 'email':
|
|
2980
|
-
return (
|
|
1618
|
+
return (jsxRuntime.jsx(Input, { type: "email", placeholder: field.props.placeholder, disabled: isFieldDisabled, value: isPreviewMode ? localValue : (field.props.defaultValue || ''), onChange: (e) => isPreviewMode && handleChange(e.target.value), onBlur: handleBlur, tabIndex: tabIndexValue, className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2981
1619
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2982
1620
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2983
1621
|
}, "data-testid": `field-email-${field.id}` }));
|
|
2984
1622
|
case 'file':
|
|
2985
|
-
return (
|
|
1623
|
+
return (jsxRuntime.jsxs("div", { className: `space-y-2 ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsx("div", { className: "flex items-center justify-center w-full", children: jsxRuntime.jsxs("label", { className: `flex flex-col items-center justify-center w-full h-32 border-2 border-border border-dashed rounded-lg cursor-pointer bg-muted/30 hover:bg-muted/50 ${isFieldDisabled ? 'opacity-50 cursor-not-allowed' : ''}`, style: {
|
|
2986
1624
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2987
|
-
}, children: [
|
|
1625
|
+
}, children: [jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center pt-5 pb-6", children: [jsxRuntime.jsx(lucideReact.Upload, { className: "w-8 h-8 mb-2 text-muted-foreground" }), jsxRuntime.jsxs("p", { className: "mb-1 text-sm text-muted-foreground", style: {
|
|
2988
1626
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2989
|
-
}, children: [
|
|
1627
|
+
}, children: [jsxRuntime.jsx("span", { className: "font-semibold", children: "Click to upload" }), " or drag and drop"] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.props.fileConfig?.accept || 'Any file type' })] }), jsxRuntime.jsx("input", { type: "file", className: "hidden", disabled: isFieldDisabled, multiple: field.props.fileConfig?.multiple, accept: field.props.fileConfig?.accept, "data-testid": `field-file-${field.id}` })] }) }), filesValue.length > 0 && (jsxRuntime.jsx("div", { className: "space-y-1", children: filesValue.map((file, i) => (jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-2 bg-muted rounded", children: [jsxRuntime.jsx("span", { className: "text-sm truncate", children: file.name }), jsxRuntime.jsx(Button, { size: "icon", variant: "ghost", onClick: () => setFilesValue(filesValue.filter((_, idx) => idx !== i)), children: jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) })] }, i))) }))] }));
|
|
2990
1628
|
case 'signature':
|
|
2991
|
-
return (
|
|
1629
|
+
return (jsxRuntime.jsx(SignatureField, { value: signatureValue, onChange: (v) => {
|
|
2992
1630
|
setSignatureValue(v);
|
|
2993
1631
|
setFieldValue(field.props.key, v);
|
|
2994
1632
|
}, disabled: isFieldDisabled, width: field.props.signatureConfig?.width, height: field.props.signatureConfig?.height, className: field.customStyle?.inputClassName }));
|
|
2995
1633
|
case 'rating':
|
|
2996
|
-
return (
|
|
1634
|
+
return (jsxRuntime.jsx(RatingField, { value: ratingValue, onChange: (v) => {
|
|
2997
1635
|
setRatingValue(v);
|
|
2998
1636
|
setFieldValue(field.props.key, v);
|
|
2999
1637
|
}, maxRating: field.props.ratingConfig?.maxRating || 5, disabled: isFieldDisabled, className: field.customStyle?.inputClassName }));
|
|
3000
1638
|
case 'richtext':
|
|
3001
|
-
return (
|
|
1639
|
+
return (jsxRuntime.jsx(Textarea, { placeholder: field.props.placeholder || 'Enter rich text content...', disabled: isFieldDisabled, value: isPreviewMode ? localValue : '', onChange: (e) => isPreviewMode && handleChange(e.target.value), className: `min-h-[120px] ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3002
1640
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3003
1641
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3004
1642
|
}, "data-testid": `field-richtext-${field.id}` }));
|
|
3005
1643
|
case 'autocomplete':
|
|
3006
|
-
return (
|
|
1644
|
+
return (jsxRuntime.jsx("div", { className: `relative ${field.customStyle?.inputClassName || ''}`, children: jsxRuntime.jsx(Input, { placeholder: field.props.placeholder || 'Start typing...', disabled: isFieldDisabled, value: isPreviewMode ? localValue : '', onChange: (e) => isPreviewMode && handleChange(e.target.value), className: `${inputSize} ${errorClass}`, style: {
|
|
3007
1645
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3008
1646
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3009
1647
|
}, "data-testid": `field-autocomplete-${field.id}` }) }));
|
|
3010
1648
|
case 'slider':
|
|
3011
|
-
return (
|
|
1649
|
+
return (jsxRuntime.jsxs("div", { className: `space-y-2 ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsx(Slider, { value: sliderValue, onValueChange: (v) => {
|
|
3012
1650
|
setSliderValue(v);
|
|
3013
1651
|
setFieldValue(field.props.key, v[0]);
|
|
3014
|
-
}, min: field.validation?.min || 0, max: field.validation?.max || 100, step: 1, disabled: isFieldDisabled, "data-testid": `field-slider-${field.id}` }),
|
|
1652
|
+
}, min: field.validation?.min || 0, max: field.validation?.max || 100, step: 1, disabled: isFieldDisabled, "data-testid": `field-slider-${field.id}` }), jsxRuntime.jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [jsxRuntime.jsx("span", { children: field.validation?.min || 0 }), jsxRuntime.jsx("span", { className: "font-medium text-foreground", style: {
|
|
3015
1653
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3016
|
-
}, children: sliderValue[0] }),
|
|
1654
|
+
}, children: sliderValue[0] }), jsxRuntime.jsx("span", { children: field.validation?.max || 100 })] })] }));
|
|
3017
1655
|
case 'header':
|
|
3018
|
-
return (
|
|
1656
|
+
return (jsxRuntime.jsx("h2", { className: `text-2xl font-bold text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3019
1657
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3020
1658
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3021
1659
|
}, children: field.props.label }));
|
|
3022
1660
|
case 'subheader':
|
|
3023
|
-
return (
|
|
1661
|
+
return (jsxRuntime.jsx("h3", { className: `text-lg font-semibold text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3024
1662
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3025
1663
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3026
1664
|
}, children: field.props.label }));
|
|
3027
1665
|
case 'label':
|
|
3028
|
-
return (
|
|
1666
|
+
return (jsxRuntime.jsx("span", { className: `text-sm font-medium text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3029
1667
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3030
1668
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3031
1669
|
}, children: field.props.label }));
|
|
3032
1670
|
case 'paragraph':
|
|
3033
|
-
return (
|
|
1671
|
+
return (jsxRuntime.jsx("p", { className: `text-sm text-muted-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3034
1672
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3035
1673
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3036
1674
|
}, children: field.props.label }));
|
|
3037
1675
|
case 'divider':
|
|
3038
1676
|
const dividerMargin = field.props.dividerMargin ?? 16;
|
|
3039
|
-
return (
|
|
1677
|
+
return (jsxRuntime.jsx(Separator, { className: field.customStyle?.inputClassName || '', style: {
|
|
3040
1678
|
marginTop: dividerMargin,
|
|
3041
1679
|
marginBottom: dividerMargin,
|
|
3042
1680
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3043
1681
|
} }));
|
|
3044
1682
|
case 'spacer':
|
|
3045
1683
|
const spacerHeight = field.props.spacerHeight ?? 24;
|
|
3046
|
-
return (
|
|
1684
|
+
return (jsxRuntime.jsx("div", { className: field.customStyle?.inputClassName || '', style: {
|
|
3047
1685
|
height: spacerHeight,
|
|
3048
1686
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3049
1687
|
} }));
|
|
3050
1688
|
case 'alert':
|
|
3051
|
-
return (
|
|
1689
|
+
return (jsxRuntime.jsxs("div", { className: `flex items-start gap-3 p-4 bg-muted rounded-md border border-border ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3052
1690
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3053
1691
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3054
|
-
}, children: [
|
|
1692
|
+
}, children: [jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-muted-foreground shrink-0 mt-0.5" }), jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: field.props.label })] }));
|
|
3055
1693
|
case 'image':
|
|
3056
1694
|
const imageUrl = field.props.imageUrl;
|
|
3057
1695
|
const imageWidth = field.props.imageWidth || '100%';
|
|
3058
1696
|
const imageHeight = field.props.imageHeight || 'auto';
|
|
3059
|
-
return (
|
|
1697
|
+
return (jsxRuntime.jsx("div", { className: `w-full ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3060
1698
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3061
|
-
}, children: imageUrl ? (
|
|
1699
|
+
}, children: imageUrl ? (jsxRuntime.jsx("img", { src: imageUrl, alt: field.props.label || 'Image', style: { width: imageWidth, height: imageHeight, objectFit: 'cover' }, className: "rounded-md" })) : (jsxRuntime.jsx("div", { className: "w-full h-32 bg-muted rounded-md flex items-center justify-center", children: jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Image placeholder" }) })) }));
|
|
3062
1700
|
case 'button':
|
|
3063
1701
|
const buttonVariant = field.props.buttonConfig?.variant || 'default';
|
|
3064
1702
|
const buttonAction = field.props.buttonConfig?.action || 'submit';
|
|
3065
|
-
return (
|
|
1703
|
+
return (jsxRuntime.jsx(Button, { variant: buttonVariant, disabled: isFieldDisabled, className: field.customStyle?.inputClassName || '', style: {
|
|
3066
1704
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3067
1705
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3068
1706
|
}, onClick: () => {
|
|
@@ -3098,7 +1736,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3098
1736
|
}
|
|
3099
1737
|
return result;
|
|
3100
1738
|
};
|
|
3101
|
-
return (
|
|
1739
|
+
return (jsxRuntime.jsx(Input, { value: formatPatternValue(localValue), onChange: (e) => {
|
|
3102
1740
|
const digits = e.target.value.replace(/\D/g, '');
|
|
3103
1741
|
handleChange(digits);
|
|
3104
1742
|
}, placeholder: field.props.placeholder, disabled: isFieldDisabled, className: `${inputSize} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
@@ -3108,11 +1746,11 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3108
1746
|
case 'qrcode':
|
|
3109
1747
|
const qrValue = field.props.qrCodeConfig?.value || 'https://example.com';
|
|
3110
1748
|
const qrSize = field.props.qrCodeConfig?.size || 128;
|
|
3111
|
-
return (
|
|
1749
|
+
return (jsxRuntime.jsx("div", { className: `flex items-center justify-center p-4 bg-white rounded-md border border-border ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3112
1750
|
width: qrSize + 32,
|
|
3113
1751
|
height: qrSize + 32,
|
|
3114
1752
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3115
|
-
}, children:
|
|
1753
|
+
}, children: jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: qrValue, size: qrSize, level: "M", "data-testid": `field-qrcode-${field.id}` }) }));
|
|
3116
1754
|
case 'container':
|
|
3117
1755
|
const containerGap = field.props.containerConfig?.gap ?? 4;
|
|
3118
1756
|
const containerPadding = field.props.containerConfig?.padding ?? 4;
|
|
@@ -3123,7 +1761,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3123
1761
|
const containerJustifyContent = field.props.containerConfig?.justifyContent || 'flex-start';
|
|
3124
1762
|
const containerAlignItems = field.props.containerConfig?.alignItems || 'stretch';
|
|
3125
1763
|
const containerFieldSize = field.props.containerConfig?.fieldSize || 'normal';
|
|
3126
|
-
return (
|
|
1764
|
+
return (jsxRuntime.jsx(DroppableContainer, { rowId: rowId, columnId: columnId, containerFieldId: field.id, isPreviewMode: isPreviewMode, getFieldValue: getFieldValue, setFieldValue: setFieldValue, fields: containerFields, gap: containerGap, padding: containerPadding, hasBorder: hasBorder, direction: containerDirection, background: field.props.containerConfig?.background, flexWrap: containerFlexWrap, justifyContent: containerJustifyContent, alignItems: containerAlignItems, fieldSize: containerFieldSize }));
|
|
3127
1765
|
case 'table':
|
|
3128
1766
|
const tableColumns = field.props.tableConfig?.columns || [
|
|
3129
1767
|
{ key: 'col1', label: 'Column 1', type: 'text' },
|
|
@@ -3177,15 +1815,15 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3177
1815
|
setFieldValue(field.props.key, currentRows);
|
|
3178
1816
|
}
|
|
3179
1817
|
};
|
|
3180
|
-
return (
|
|
1818
|
+
return (jsxRuntime.jsxs("div", { className: `w-full overflow-x-auto ${field.customStyle?.inputClassName || ''}`, children: [jsxRuntime.jsxs("table", { className: `w-full ${tableFontClass} ${isBordered ? 'border border-border' : ''}`, children: [jsxRuntime.jsx("thead", { className: "bg-muted/50", children: jsxRuntime.jsxs("tr", { children: [showRowNumbers && (jsxRuntime.jsx("th", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} text-left font-medium text-muted-foreground w-12 ${isBordered ? 'border border-border' : ''}`, children: "#" })), tableColumns.map((col) => (jsxRuntime.jsxs("th", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} text-left font-medium ${isBordered ? 'border border-border' : ''}`, style: { width: col.width }, children: [col.label, col.required && jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })] }, col.key))), allowDeleteRows && (jsxRuntime.jsx("th", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} w-12 ${isBordered ? 'border border-border' : ''}` }))] }) }), jsxRuntime.jsx("tbody", { children: tableRows.map((row, rowIndex) => (jsxRuntime.jsxs("tr", { className: isStriped && rowIndex % 2 === 1 ? 'bg-muted/30' : '', children: [showRowNumbers && (jsxRuntime.jsx("td", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} text-muted-foreground ${isBordered ? 'border border-border' : ''}`, children: rowIndex + 1 })), tableColumns.map((col) => (jsxRuntime.jsx("td", { className: `${isCompact ? 'px-1 py-1' : 'px-2 py-1'} ${isBordered ? 'border border-border' : ''}`, children: col.type === 'checkbox' ? (jsxRuntime.jsx("input", { type: "checkbox", checked: row[col.key] || false, onChange: (e) => handleTableCellChange(rowIndex, col.key, e.target.checked), disabled: !isPreviewMode, className: "h-4 w-4" })) : col.type === 'select' ? (jsxRuntime.jsxs("select", { value: row[col.key] || '', onChange: (e) => handleTableCellChange(rowIndex, col.key, e.target.value), disabled: !isPreviewMode, className: `w-full ${isCompact ? 'h-6 text-xs' : 'h-8 text-sm'} px-2 rounded border border-input bg-background`, children: [jsxRuntime.jsx("option", { value: "", children: col.placeholder || 'Select...' }), col.options?.map((opt) => (jsxRuntime.jsx("option", { value: opt.value, children: opt.label }, opt.value)))] })) : (jsxRuntime.jsx("input", { type: col.type === 'number' ? 'number' : col.type === 'email' ? 'email' : col.type === 'date' ? 'date' : 'text', value: row[col.key] || '', onChange: (e) => handleTableCellChange(rowIndex, col.key, e.target.value), disabled: !isPreviewMode, placeholder: col.placeholder, className: `w-full ${isCompact ? 'h-6 text-xs' : 'h-8 text-sm'} px-2 rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring` })) }, col.key))), allowDeleteRows && tableRows.length > minRows && (jsxRuntime.jsx("td", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} ${isBordered ? 'border border-border' : ''}`, children: jsxRuntime.jsx("button", { onClick: () => deleteTableRow(rowIndex), disabled: !isPreviewMode, className: "text-muted-foreground hover:text-destructive transition-colors", children: jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }) }))] }, rowIndex))) })] }), allowAddRows && tableRows.length < maxRows && (jsxRuntime.jsxs("button", { onClick: addTableRow, disabled: !isPreviewMode, className: `mt-2 flex items-center gap-1 text-sm text-primary hover:underline ${!isPreviewMode ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: jsxRuntime.jsx("path", { d: "M12 5v14M5 12h14" }) }), "Add Row"] }))] }));
|
|
3181
1819
|
default:
|
|
3182
|
-
return (
|
|
1820
|
+
return (jsxRuntime.jsxs("div", { className: "p-3 bg-muted rounded-md text-sm text-muted-foreground", children: ["Unknown field type: ", field.type] }));
|
|
3183
1821
|
}
|
|
3184
1822
|
};
|
|
3185
1823
|
const showLabel = !['checkbox', 'toggle', 'header', 'subheader', 'label', 'paragraph', 'divider', 'spacer', 'alert', 'button', 'qrcode', 'container', 'table', 'image'].includes(field.type);
|
|
3186
1824
|
// For container fields, render with minimal wrapper to allow drop zone to work
|
|
3187
1825
|
if (field.type === 'container') {
|
|
3188
|
-
return (
|
|
1826
|
+
return (jsxRuntime.jsxs("div", { className: `
|
|
3189
1827
|
relative group rounded-md transition-all duration-150
|
|
3190
1828
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3191
1829
|
${field.props.hidden && !isPreviewMode ? 'opacity-50' : ''}
|
|
@@ -3200,10 +1838,10 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3200
1838
|
...(field.customStyle?.marginLeft ? { marginLeft: field.customStyle.marginLeft } : {}),
|
|
3201
1839
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3202
1840
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3203
|
-
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (
|
|
1841
|
+
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (jsxRuntime.jsxs("div", { className: "absolute top-0 left-0 right-0 h-8 cursor-pointer z-30 flex items-center justify-between px-3 bg-primary/10 rounded-t-md border-b border-primary/20", onClick: handleClick, "data-testid": `container-header-${field.id}`, children: [jsxRuntime.jsx("span", { className: "text-xs font-medium text-primary", children: field.props.label || 'Container' }), jsxRuntime.jsx("button", { onClick: (e) => {
|
|
3204
1842
|
e.stopPropagation();
|
|
3205
1843
|
deleteField(rowId, columnId, field.id);
|
|
3206
|
-
}, className: "p-1 rounded hover:bg-destructive/20 text-destructive", "data-testid": `delete-container-${field.id}`, children:
|
|
1844
|
+
}, className: "p-1 rounded hover:bg-destructive/20 text-destructive", "data-testid": `delete-container-${field.id}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3" }) })] })), jsxRuntime.jsx("div", { className: !isPreviewMode ? 'pt-8' : '', children: renderFieldContent() })] }));
|
|
3207
1845
|
}
|
|
3208
1846
|
// Calculate dynamic classes based on fieldSize (from container or row)
|
|
3209
1847
|
// When fieldSize is provided (from row or container), always use the size-specific styles
|
|
@@ -3239,7 +1877,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3239
1877
|
default: return `text-xs font-medium ${base}`;
|
|
3240
1878
|
}
|
|
3241
1879
|
};
|
|
3242
|
-
return (
|
|
1880
|
+
return (jsxRuntime.jsxs("div", { onClick: handleClick, className: `
|
|
3243
1881
|
relative group rounded-md transition-all duration-150 ${getPaddingClass()}
|
|
3244
1882
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background bg-primary/5' : 'bg-transparent'}
|
|
3245
1883
|
${!isPreviewMode ? 'hover:bg-muted/30 cursor-pointer' : ''}
|
|
@@ -3255,16 +1893,16 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3255
1893
|
...(field.customStyle?.marginLeft ? { marginLeft: field.customStyle.marginLeft } : {}),
|
|
3256
1894
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3257
1895
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3258
|
-
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (
|
|
1896
|
+
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (jsxRuntime.jsx("button", { onClick: (e) => {
|
|
3259
1897
|
e.stopPropagation();
|
|
3260
1898
|
deleteField(rowId, columnId, field.id);
|
|
3261
|
-
}, className: "absolute -top-2 -right-2 z-30 p-1 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity shadow-md", "data-testid": `button-delete-field-${field.id}`, children:
|
|
1899
|
+
}, className: "absolute -top-2 -right-2 z-30 p-1 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity shadow-md", "data-testid": `button-delete-field-${field.id}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3" }) })), !isPreviewMode && field.conditionalLogic?.enabled && (jsxRuntime.jsx("div", { className: "absolute -top-2 -left-2 p-1 rounded-full bg-blue-500 text-white opacity-0 group-hover:opacity-100 transition-opacity shadow-md", title: "Has conditional logic", children: jsxRuntime.jsx(lucideReact.Info, { className: "h-3 w-3" }) })), !isPreviewMode && field.type !== 'container' && (jsxRuntime.jsx("div", { className: "absolute inset-0 z-10 cursor-pointer", onClick: handleClick, "data-testid": `field-click-overlay-${field.id}` })), jsxRuntime.jsxs("div", { className: `${getSpacingClass()} relative ${field.type === 'container' ? 'z-20' : 'z-0'}`, children: [showLabel && (jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [jsxRuntime.jsxs(Label, { className: getLabelClass(), children: [field.props.label, isFieldRequired && (jsxRuntime.jsx("span", { className: "text-destructive ml-0.5", children: "*" }))] }), field.props.tooltip && (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(lucideReact.HelpCircle, { className: `${fieldSize === 'compact' ? 'h-2.5 w-2.5' : fieldSize === 'comfortable' ? 'h-4 w-4' : 'h-3.5 w-3.5'} text-muted-foreground cursor-help` }) }), jsxRuntime.jsx(TooltipContent, { children: jsxRuntime.jsx("p", { className: "max-w-xs", children: field.props.tooltip }) })] }))] })), field.props.helpText && !isInsideContainer && (jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.props.helpText })), jsxRuntime.jsx("div", { className: `${field.customStyle?.inputClassName || ''} ${fieldSize === 'compact'
|
|
3262
1900
|
? '[&_input]:h-7 [&_input]:text-xs [&_select]:h-7 [&_textarea]:text-xs [&_textarea]:min-h-[60px]'
|
|
3263
1901
|
: fieldSize === 'comfortable'
|
|
3264
1902
|
? '[&_input]:h-11 [&_input]:text-base [&_select]:h-11 [&_textarea]:text-base [&_textarea]:min-h-[120px] [&_input]:px-4 [&_select]:px-4'
|
|
3265
1903
|
: fieldSize === 'normal'
|
|
3266
1904
|
? '[&_input]:h-8 [&_input]:text-sm [&_select]:h-8 [&_textarea]:text-sm [&_textarea]:min-h-[80px]'
|
|
3267
|
-
: ''}`, children: renderFieldContent() }), hasError && (
|
|
1905
|
+
: ''}`, children: renderFieldContent() }), hasError && (jsxRuntime.jsx("p", { className: `${fieldSize === 'compact' ? 'text-[10px]' : fieldSize === 'comfortable' ? 'text-base' : 'text-sm'} text-destructive`, "data-testid": `field-error-${field.id}`, children: error }))] })] }));
|
|
3268
1906
|
}
|
|
3269
1907
|
|
|
3270
1908
|
function DroppableColumn({ row, column, }) {
|
|
@@ -3316,13 +1954,13 @@ function DroppableColumn({ row, column, }) {
|
|
|
3316
1954
|
default: return 'text-xs';
|
|
3317
1955
|
}
|
|
3318
1956
|
};
|
|
3319
|
-
return (
|
|
1957
|
+
return (jsxRuntime.jsx("div", { ref: setNodeRef, onClick: handleClick, className: `
|
|
3320
1958
|
${getMinHeight()} rounded-md transition-all duration-150
|
|
3321
1959
|
${isPreviewMode ? '' : 'border border-dashed'}
|
|
3322
1960
|
${isOver ? 'bg-primary/10 border-primary' : isPreviewMode ? '' : 'border-border'}
|
|
3323
1961
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3324
1962
|
${!isPreviewMode ? 'hover:border-muted-foreground cursor-pointer' : ''}
|
|
3325
|
-
`, style: { width: `${gridWidth}%` }, "data-testid": `column-${column.id}`, children: column.fields.length === 0 ? (!isPreviewMode && (
|
|
1963
|
+
`, style: { width: `${gridWidth}%` }, "data-testid": `column-${column.id}`, children: column.fields.length === 0 ? (!isPreviewMode && (jsxRuntime.jsx("div", { className: `flex items-center justify-center h-full ${getEmptyMinHeight()} ${getTextSize()} text-muted-foreground`, children: "Drop here" }))) : (jsxRuntime.jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: `${getColumnGap()}px`, padding: `${getColumnPadding()}px` }, children: column.fields.map((field, index) => (jsxRuntime.jsx(CanvasField, { field: field, rowId: row.id, columnId: column.id, index: index, fieldSize: row.fieldSize }, field.id))) })) }));
|
|
3326
1964
|
}
|
|
3327
1965
|
function CanvasRow({ row, index }) {
|
|
3328
1966
|
const { selection, setSelection, deleteRow, addColumn, isPreviewMode, evaluateCondition } = useFormStore();
|
|
@@ -3394,47 +2032,47 @@ function CanvasRow({ row, index }) {
|
|
|
3394
2032
|
// If this is a container-only row, render with minimal wrapper
|
|
3395
2033
|
if (isSingleContainerRow) {
|
|
3396
2034
|
const containerField = row.columns[0].fields[0];
|
|
3397
|
-
return (
|
|
2035
|
+
return (jsxRuntime.jsxs("div", { onClick: handleContainerClick, className: `
|
|
3398
2036
|
relative group rounded-lg transition-all duration-150 overflow-visible
|
|
3399
2037
|
${!isPreviewMode ? 'hover:ring-2 hover:ring-primary/30' : ''}
|
|
3400
2038
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3401
|
-
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (
|
|
2039
|
+
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (jsxRuntime.jsx("button", { onClick: (e) => {
|
|
3402
2040
|
e.stopPropagation();
|
|
3403
2041
|
deleteRow(row.id);
|
|
3404
|
-
}, className: "absolute -top-2 -right-2 z-20 p-1 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity shadow-md", title: "Delete container", "data-testid": `button-delete-row-${row.id}`, children:
|
|
2042
|
+
}, className: "absolute -top-2 -right-2 z-20 p-1 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity shadow-md", title: "Delete container", "data-testid": `button-delete-row-${row.id}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3" }) })), jsxRuntime.jsx(CanvasField, { field: containerField, rowId: row.id, columnId: row.columns[0].id })] }));
|
|
3405
2043
|
}
|
|
3406
|
-
return (
|
|
2044
|
+
return (jsxRuntime.jsxs("div", { onClick: handleContainerClick, className: `
|
|
3407
2045
|
relative group rounded-lg transition-all duration-150 overflow-visible
|
|
3408
2046
|
${isPreviewMode ? '' : 'border bg-card'}
|
|
3409
2047
|
${isSelected && !isPreviewMode ? 'border-primary bg-primary/5 ring-2 ring-primary ring-offset-2 ring-offset-background' : isPreviewMode ? '' : 'border-border'}
|
|
3410
2048
|
${!isPreviewMode ? 'hover:border-muted-foreground' : ''}
|
|
3411
|
-
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (
|
|
2049
|
+
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (jsxRuntime.jsxs("div", { onClick: handleRowHeaderClick, className: `flex items-center justify-between ${getHeaderClass()} border-b border-border cursor-pointer hover-elevate`, "data-testid": `row-header-${row.id}`, children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.GripVertical, { className: `${getIconSize()} text-muted-foreground cursor-grab` }), jsxRuntime.jsxs("span", { className: `${getRowTextSize()} font-medium text-muted-foreground uppercase tracking-wide`, children: ["Row (", row.columns.length, " ", row.columns.length === 1 ? 'column' : 'columns', ")"] }), row.conditionalLogic?.enabled && (jsxRuntime.jsx("span", { className: `${getRowTextSize()} text-blue-500 font-medium`, children: "Conditional" }))] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [jsxRuntime.jsx("button", { onClick: (e) => {
|
|
3412
2050
|
e.stopPropagation();
|
|
3413
2051
|
addColumn(row.id);
|
|
3414
|
-
}, className: "p-1 text-muted-foreground hover:text-foreground rounded", title: "Add column", "data-testid": `button-add-column-inline-${row.id}`, children:
|
|
2052
|
+
}, className: "p-1 text-muted-foreground hover:text-foreground rounded", title: "Add column", "data-testid": `button-add-column-inline-${row.id}`, children: jsxRuntime.jsx(lucideReact.Plus, { className: getIconSize() }) }), jsxRuntime.jsx("button", { onClick: (e) => {
|
|
3415
2053
|
e.stopPropagation();
|
|
3416
2054
|
deleteRow(row.id);
|
|
3417
|
-
}, className: "p-1 text-muted-foreground hover:text-destructive rounded", title: "Delete row", "data-testid": `button-delete-row-${row.id}`, children:
|
|
2055
|
+
}, className: "p-1 text-muted-foreground hover:text-destructive rounded", title: "Delete row", "data-testid": `button-delete-row-${row.id}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: getIconSize() }) })] })] })), jsxRuntime.jsx("div", { className: "flex", style: {
|
|
3418
2056
|
gap: isPreviewMode ? 0 : `${(row.spacing ?? getRowSpacingMultiplier()) * 4}px`,
|
|
3419
2057
|
padding: isPreviewMode ? 0 : `${(row.padding ?? getRowPaddingMultiplier()) * 4}px`,
|
|
3420
|
-
}, children: row.columns.map((column) => (
|
|
2058
|
+
}, children: row.columns.map((column) => (jsxRuntime.jsx(DroppableColumn, { row: row, column: column }, column.id))) })] }));
|
|
3421
2059
|
}
|
|
3422
2060
|
function StepIndicator() {
|
|
3423
2061
|
const { form, currentStepIndex, setCurrentStep, isPreviewMode } = useFormStore();
|
|
3424
2062
|
if (!form.isMultiStep || !form.steps?.length)
|
|
3425
2063
|
return null;
|
|
3426
2064
|
const progress = ((currentStepIndex + 1) / form.steps.length) * 100;
|
|
3427
|
-
return (
|
|
2065
|
+
return (jsxRuntime.jsxs("div", { className: "mb-6 space-y-4", children: [jsxRuntime.jsx(Progress, { value: progress, className: "h-2" }), jsxRuntime.jsx("div", { className: "flex justify-between", children: form.steps.map((step, index) => (jsxRuntime.jsxs("button", { onClick: () => !isPreviewMode && setCurrentStep(index), className: `
|
|
3428
2066
|
flex flex-col items-center gap-2 transition-all
|
|
3429
2067
|
${!isPreviewMode ? 'cursor-pointer' : ''}
|
|
3430
|
-
`, disabled: isPreviewMode && index > currentStepIndex, children: [
|
|
2068
|
+
`, disabled: isPreviewMode && index > currentStepIndex, children: [jsxRuntime.jsx("div", { className: `
|
|
3431
2069
|
w-10 h-10 rounded-full flex items-center justify-center font-medium text-sm border-2 transition-all
|
|
3432
2070
|
${index < currentStepIndex
|
|
3433
2071
|
? 'bg-primary border-primary text-primary-foreground'
|
|
3434
2072
|
: index === currentStepIndex
|
|
3435
2073
|
? 'border-primary text-primary bg-primary/10'
|
|
3436
2074
|
: 'border-muted text-muted-foreground bg-muted/30'}
|
|
3437
|
-
`, children: index < currentStepIndex ? (
|
|
2075
|
+
`, children: index < currentStepIndex ? (jsxRuntime.jsx(lucideReact.Check, { className: "h-5 w-5" })) : (index + 1) }), jsxRuntime.jsx("span", { className: `text-xs font-medium ${index <= currentStepIndex ? 'text-foreground' : 'text-muted-foreground'}`, children: step.title })] }, step.id))) })] }));
|
|
3438
2076
|
}
|
|
3439
2077
|
function StepNavigation() {
|
|
3440
2078
|
const { form, currentStepIndex, nextStep, prevStep, isPreviewMode } = useFormStore();
|
|
@@ -3442,7 +2080,7 @@ function StepNavigation() {
|
|
|
3442
2080
|
return null;
|
|
3443
2081
|
const isFirstStep = currentStepIndex === 0;
|
|
3444
2082
|
const isLastStep = currentStepIndex === form.steps.length - 1;
|
|
3445
|
-
return (
|
|
2083
|
+
return (jsxRuntime.jsxs("div", { className: "flex justify-between mt-6 pt-6 border-t border-border", children: [jsxRuntime.jsxs(Button, { variant: "outline", onClick: prevStep, disabled: isFirstStep, className: "gap-2", children: [jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }), "Previous"] }), isLastStep ? (jsxRuntime.jsxs(Button, { className: "gap-2", children: [jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }), "Submit"] })) : (jsxRuntime.jsxs(Button, { onClick: nextStep, className: "gap-2", children: ["Next", jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })] }))] }));
|
|
3446
2084
|
}
|
|
3447
2085
|
const canvasWidthClasses = {
|
|
3448
2086
|
compact: 'max-w-2xl',
|
|
@@ -3461,23 +2099,23 @@ function MultiStepCanvas() {
|
|
|
3461
2099
|
accepts: 'field',
|
|
3462
2100
|
},
|
|
3463
2101
|
});
|
|
3464
|
-
return (
|
|
2102
|
+
return (jsxRuntime.jsx("div", { ref: setNodeRef, className: `
|
|
3465
2103
|
min-h-full p-8
|
|
3466
2104
|
${isOver ? 'bg-primary/5' : ''}
|
|
3467
2105
|
`, style: {
|
|
3468
2106
|
backgroundImage: 'radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)',
|
|
3469
2107
|
backgroundSize: '24px 24px',
|
|
3470
|
-
}, children:
|
|
2108
|
+
}, children: jsxRuntime.jsxs("div", { className: `${canvasWidthClasses[canvasWidth]} mx-auto`, children: [jsxRuntime.jsx(StepIndicator, {}), !isPreviewMode && currentStep && (jsxRuntime.jsx("div", { className: "mb-4 p-4 bg-card rounded-lg border border-border", children: jsxRuntime.jsxs("button", { onClick: (e) => {
|
|
3471
2109
|
e.stopPropagation();
|
|
3472
2110
|
setSelection({ type: 'step', stepId: currentStep.id });
|
|
3473
|
-
}, className: "text-left w-full", "data-testid": "button-step-header", children: [
|
|
2111
|
+
}, className: "text-left w-full", "data-testid": "button-step-header", children: [jsxRuntime.jsx("h3", { className: "font-semibold text-lg", children: currentStep.title }), currentStep.description && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: currentStep.description }))] }) })), isPreviewMode && currentStep && (jsxRuntime.jsxs("div", { className: "mb-6", children: [jsxRuntime.jsx("h2", { className: "text-2xl font-bold", children: currentStep.title }), currentStep.description && (jsxRuntime.jsx("p", { className: "text-muted-foreground mt-2", children: currentStep.description }))] })), rows.length === 0 ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center min-h-[200px] text-center border-2 border-dashed border-border rounded-lg", children: [jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: "This step has no fields yet" }), !isPreviewMode && (jsxRuntime.jsxs(Button, { onClick: () => addRow(1), className: "gap-2", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Row"] }))] })) : (jsxRuntime.jsxs("div", { className: "space-y-4", children: [rows.map((row, index) => (jsxRuntime.jsx(CanvasRow, { row: row, index: index }, row.id))), !isPreviewMode && (jsxRuntime.jsx("div", { className: "flex justify-center pt-4", children: jsxRuntime.jsxs(Button, { variant: "outline", onClick: () => addRow(1), className: "gap-2", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Row"] }) }))] })), jsxRuntime.jsx(StepNavigation, {}), !isPreviewMode && (jsxRuntime.jsx("div", { className: "mt-8 pt-8 border-t border-border", children: jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [form.steps?.map((step, index) => (jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [jsxRuntime.jsxs(Button, { variant: index === currentStepIndex ? 'default' : 'outline', size: "sm", onClick: (e) => {
|
|
3474
2112
|
e.stopPropagation();
|
|
3475
2113
|
setCurrentStep(index);
|
|
3476
2114
|
setSelection({ type: 'step', stepId: step.id });
|
|
3477
|
-
}, "data-testid": `button-step-${index + 1}`, children: ["Step ", index + 1] }), (form.steps?.length || 0) > 1 && (
|
|
2115
|
+
}, "data-testid": `button-step-${index + 1}`, children: ["Step ", index + 1] }), (form.steps?.length || 0) > 1 && (jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 text-muted-foreground hover:text-destructive", onClick: (e) => {
|
|
3478
2116
|
e.stopPropagation();
|
|
3479
2117
|
deleteStep(step.id);
|
|
3480
|
-
}, "data-testid": `button-delete-step-${index}`, children:
|
|
2118
|
+
}, "data-testid": `button-delete-step-${index}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3" }) }))] }, step.id))), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: addStep, className: "gap-1", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-3 w-3" }), "Add Step"] })] }) }))] }) }));
|
|
3481
2119
|
}
|
|
3482
2120
|
function SingleFormCanvas() {
|
|
3483
2121
|
const { form, addRow, clearSelection, isPreviewMode, canvasWidth } = useFormStore();
|
|
@@ -3491,20 +2129,20 @@ function SingleFormCanvas() {
|
|
|
3491
2129
|
const handleCanvasClick = () => {
|
|
3492
2130
|
clearSelection();
|
|
3493
2131
|
};
|
|
3494
|
-
return (
|
|
2132
|
+
return (jsxRuntime.jsx("div", { ref: setNodeRef, onClick: handleCanvasClick, className: `
|
|
3495
2133
|
min-h-full p-8
|
|
3496
2134
|
${isOver ? 'bg-primary/5' : ''}
|
|
3497
2135
|
`, style: {
|
|
3498
2136
|
backgroundImage: 'radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)',
|
|
3499
2137
|
backgroundSize: '24px 24px',
|
|
3500
|
-
}, children: form.rows.length === 0 ? (
|
|
2138
|
+
}, children: form.rows.length === 0 ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-center", children: [jsxRuntime.jsx("div", { className: "w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-4", children: jsxRuntime.jsx(lucideReact.Plus, { className: "h-10 w-10 text-muted-foreground" }) }), jsxRuntime.jsx("h2", { className: "text-xl font-semibold text-foreground mb-2", children: "Start building your form" }), jsxRuntime.jsx("p", { className: "text-muted-foreground mb-6 max-w-md", children: "Drag components from the left sidebar to get started" })] })) : (jsxRuntime.jsxs("div", { className: `space-y-4 ${canvasWidthClasses[canvasWidth]} mx-auto`, children: [form.rows.map((row, index) => (jsxRuntime.jsx(CanvasRow, { row: row, index: index }, row.id))), !isPreviewMode && (jsxRuntime.jsx("div", { className: "flex justify-center pt-4", children: jsxRuntime.jsxs(Button, { variant: "outline", onClick: () => addRow(1), className: "gap-2", "data-testid": "button-add-row", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Row"] }) }))] })) }));
|
|
3501
2139
|
}
|
|
3502
2140
|
function FormCanvas() {
|
|
3503
2141
|
const { form, clearSelection } = useFormStore();
|
|
3504
2142
|
const handleCanvasClick = () => {
|
|
3505
2143
|
clearSelection();
|
|
3506
2144
|
};
|
|
3507
|
-
return (
|
|
2145
|
+
return (jsxRuntime.jsx("main", { className: "flex-1 bg-background overflow-hidden", onClick: handleCanvasClick, children: jsxRuntime.jsx(ScrollArea, { className: "h-full", children: form.isMultiStep ? jsxRuntime.jsx(MultiStepCanvas, {}) : jsxRuntime.jsx(SingleFormCanvas, {}) }) }));
|
|
3508
2146
|
}
|
|
3509
2147
|
|
|
3510
2148
|
const Collapsible = CollapsiblePrimitive__namespace.Root;
|
|
@@ -3512,11 +2150,11 @@ const CollapsibleTrigger = CollapsiblePrimitive__namespace.CollapsibleTrigger;
|
|
|
3512
2150
|
const CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
|
|
3513
2151
|
|
|
3514
2152
|
const Tabs = TabsPrimitive__namespace.Root;
|
|
3515
|
-
const TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
2153
|
+
const TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(TabsPrimitive__namespace.List, { ref: ref, className: cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", className), ...props })));
|
|
3516
2154
|
TabsList.displayName = TabsPrimitive__namespace.List.displayName;
|
|
3517
|
-
const TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
2155
|
+
const TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { ref: ref, className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm", className), ...props })));
|
|
3518
2156
|
TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
|
|
3519
|
-
const TabsContent = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
2157
|
+
const TabsContent = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(TabsPrimitive__namespace.Content, { ref: ref, className: cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className), ...props })));
|
|
3520
2158
|
TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
|
|
3521
2159
|
|
|
3522
2160
|
function RowProperties() {
|
|
@@ -3525,7 +2163,7 @@ function RowProperties() {
|
|
|
3525
2163
|
const row = getSelectedRow();
|
|
3526
2164
|
if (!row)
|
|
3527
2165
|
return null;
|
|
3528
|
-
return (
|
|
2166
|
+
return (jsxRuntime.jsx("div", { className: "p-4 space-y-6", children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Row Properties" }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("span", { className: "text-sm text-foreground", children: "Columns" }), jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: row.columns.length })] }), jsxRuntime.jsx("div", { className: "flex gap-2", children: jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => addColumn(row.id), className: "flex-1 gap-2", "data-testid": "button-add-column", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Column"] }) }), row.columns.length > 0 && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-xs text-muted-foreground", children: "Column Management" }), jsxRuntime.jsx("div", { className: "space-y-1", children: row.columns.map((col, idx) => (jsxRuntime.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/50 rounded-md", children: [jsxRuntime.jsxs("span", { className: "text-xs font-medium flex-1", children: ["Col ", idx + 1, " ", jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: ["(", col.width, "/12)"] })] }), jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [col.fields.length, " field", col.fields.length !== 1 ? 's' : ''] }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => deleteColumn(row.id, col.id), disabled: row.columns.length <= 1, title: row.columns.length <= 1 ? "Cannot delete last column" : "Delete column", "data-testid": `button-delete-col-${idx}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3 text-destructive" }) })] }, col.id))) })] })), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Inner Field Size (Density)" }), jsxRuntime.jsxs(Select, { value: row.fieldSize || 'normal', onValueChange: (value) => updateRow(row.id, { fieldSize: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "row-field-size", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "compact", children: "Compact (Minimal)" }), jsxRuntime.jsx(SelectItem, { value: "normal", children: "Normal" }), jsxRuntime.jsx(SelectItem, { value: "comfortable", children: "Comfortable (Spacious)" })] })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Controls padding and font sizes for all fields in this row" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Spacing (Gap between fields)" }), jsxRuntime.jsx(Input, { type: "number", value: row.spacing ?? 3, onChange: (e) => updateRow(row.id, { spacing: parseFloat(e.target.value) || 0 }), min: 0, max: 16, step: 0.5, "data-testid": "row-spacing" }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "0 = no gap, higher = more space" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Padding (Inner space)" }), jsxRuntime.jsx(Input, { type: "number", value: row.padding ?? 3, onChange: (e) => updateRow(row.id, { padding: parseFloat(e.target.value) || 0 }), min: 0, max: 16, step: 0.5, "data-testid": "row-padding" }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "0 = no padding, higher = more space" })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Collapsible, { open: conditionalOpen, onOpenChange: setConditionalOpen, children: [jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Zap, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Conditional Logic" })] }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${conditionalOpen ? 'rotate-180' : ''}` })] }), jsxRuntime.jsx(CollapsibleContent, { className: "pt-4", children: jsxRuntime.jsx("div", { className: "space-y-4", children: jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Enable" }), jsxRuntime.jsx(Switch, { checked: row.conditionalLogic?.enabled || false, onCheckedChange: (checked) => updateRow(row.id, {
|
|
3529
2167
|
conditionalLogic: {
|
|
3530
2168
|
...row.conditionalLogic,
|
|
3531
2169
|
enabled: checked,
|
|
@@ -3533,7 +2171,7 @@ function RowProperties() {
|
|
|
3533
2171
|
logicType: row.conditionalLogic?.logicType || 'all',
|
|
3534
2172
|
conditions: row.conditionalLogic?.conditions || [],
|
|
3535
2173
|
}
|
|
3536
|
-
}) })] }) }) })] }),
|
|
2174
|
+
}) })] }) }) })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => deleteRow(row.id), className: "w-full gap-2 text-destructive hover:text-destructive", "data-testid": "button-delete-row", children: [jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }), "Delete Row"] })] })] }) }));
|
|
3537
2175
|
}
|
|
3538
2176
|
function ColumnProperties() {
|
|
3539
2177
|
const { getSelectedColumn, updateColumn, deleteColumn, duplicateColumn } = useFormStore();
|
|
@@ -3542,33 +2180,33 @@ function ColumnProperties() {
|
|
|
3542
2180
|
if (!result)
|
|
3543
2181
|
return null;
|
|
3544
2182
|
const { row, column } = result;
|
|
3545
|
-
return (
|
|
2183
|
+
return (jsxRuntime.jsx("div", { className: "p-4 space-y-6", children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Column Properties" }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Width (1-12)" }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(Button, { variant: "outline", size: "icon", onClick: () => {
|
|
3546
2184
|
if (column.width > 1) {
|
|
3547
2185
|
updateColumn(row.id, column.id, { width: column.width - 1 });
|
|
3548
2186
|
}
|
|
3549
|
-
}, disabled: column.width <= 1, "data-testid": "button-decrease-width", children:
|
|
2187
|
+
}, disabled: column.width <= 1, "data-testid": "button-decrease-width", children: jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" }) }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: column.width, onChange: (e) => {
|
|
3550
2188
|
const width = Math.min(12, Math.max(1, parseInt(e.target.value) || 1));
|
|
3551
2189
|
updateColumn(row.id, column.id, { width });
|
|
3552
|
-
}, className: "w-20 text-center", "data-testid": "input-column-width" }),
|
|
2190
|
+
}, className: "w-20 text-center", "data-testid": "input-column-width" }), jsxRuntime.jsx(Button, { variant: "outline", size: "icon", onClick: () => {
|
|
3553
2191
|
if (column.width < 12) {
|
|
3554
2192
|
updateColumn(row.id, column.id, { width: column.width + 1 });
|
|
3555
2193
|
}
|
|
3556
|
-
}, disabled: column.width >= 12, "data-testid": "button-increase-width", children:
|
|
2194
|
+
}, disabled: column.width >= 12, "data-testid": "button-increase-width", children: jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }) })] }), jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [Math.round((column.width / 12) * 100), "% of row width"] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Collapsible, { open: responsiveOpen, onOpenChange: setResponsiveOpen, children: [jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full", children: [jsxRuntime.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Responsive Widths" }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${responsiveOpen ? 'rotate-180' : ''}` })] }), jsxRuntime.jsx(CollapsibleContent, { className: "pt-4", children: jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Mobile (1-12)" }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.mobile || '', placeholder: "12", onChange: (e) => {
|
|
3557
2195
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3558
2196
|
updateColumn(row.id, column.id, {
|
|
3559
2197
|
responsiveWidth: { ...column.responsiveWidth, mobile: val },
|
|
3560
2198
|
});
|
|
3561
|
-
} })] }),
|
|
2199
|
+
} })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Tablet (1-12)" }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.tablet || '', placeholder: "6", onChange: (e) => {
|
|
3562
2200
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3563
2201
|
updateColumn(row.id, column.id, {
|
|
3564
2202
|
responsiveWidth: { ...column.responsiveWidth, tablet: val },
|
|
3565
2203
|
});
|
|
3566
|
-
} })] }),
|
|
2204
|
+
} })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Desktop (1-12)" }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.desktop || '', placeholder: String(column.width), onChange: (e) => {
|
|
3567
2205
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3568
2206
|
updateColumn(row.id, column.id, {
|
|
3569
2207
|
responsiveWidth: { ...column.responsiveWidth, desktop: val },
|
|
3570
2208
|
});
|
|
3571
|
-
} })] })] }) })] }),
|
|
2209
|
+
} })] })] }) })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("div", { className: "flex gap-2", children: jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => duplicateColumn(row.id, column.id), className: "flex-1 gap-2", "data-testid": "button-duplicate-column", children: [jsxRuntime.jsx(lucideReact.Copy, { className: "h-4 w-4" }), "Duplicate"] }) }), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => deleteColumn(row.id, column.id), className: "w-full gap-2 text-destructive hover:text-destructive", disabled: row.columns.length <= 1, "data-testid": "button-delete-column", children: [jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }), "Delete Column"] })] })] }) }));
|
|
3572
2210
|
}
|
|
3573
2211
|
function FieldProperties() {
|
|
3574
2212
|
const { getSelectedField, updateField, deleteField, getAllFields } = useFormStore();
|
|
@@ -3667,38 +2305,38 @@ function FieldProperties() {
|
|
|
3667
2305
|
const currentActions = (field.events?.[eventType] || []).filter((_, i) => i !== index);
|
|
3668
2306
|
handleUpdateEvents(eventType, currentActions);
|
|
3669
2307
|
};
|
|
3670
|
-
return (
|
|
2308
|
+
return (jsxRuntime.jsx("div", { className: "p-4", children: jsxRuntime.jsxs(Tabs, { defaultValue: "main", className: "w-full", children: [jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-4 mb-4", children: [jsxRuntime.jsx(TabsTrigger, { value: "main", className: "text-xs", children: "Main" }), jsxRuntime.jsx(TabsTrigger, { value: "style", className: "text-xs", children: "Style" }), jsxRuntime.jsx(TabsTrigger, { value: "actions", className: "text-xs", children: "Actions" }), jsxRuntime.jsx(TabsTrigger, { value: "rules", className: "text-xs", children: "Rules" })] }), jsxRuntime.jsxs(TabsContent, { value: "main", className: "space-y-4 mt-0", children: [(() => {
|
|
3671
2309
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode'];
|
|
3672
2310
|
const textOnlyTypes = ['header', 'subheader', 'label', 'paragraph', 'alert'];
|
|
3673
2311
|
const isStaticDisplay = staticDisplayTypes.includes(field.type);
|
|
3674
2312
|
const isTextOnly = textOnlyTypes.includes(field.type);
|
|
3675
|
-
return (
|
|
3676
|
-
})(), isInsideContainer && (
|
|
2313
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isTextOnly && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Text" }), jsxRuntime.jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), "data-testid": "input-field-label" })] })), field.type === 'spacer' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Height (px)" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.spacerHeight || 24, onChange: (e) => handleUpdateProp('spacerHeight', parseInt(e.target.value) || 24), min: 4, max: 200 })] })), field.type === 'divider' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Margin (px)" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.dividerMargin || 16, onChange: (e) => handleUpdateProp('dividerMargin', parseInt(e.target.value) || 16), min: 0, max: 100 })] })), field.type === 'image' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Alt Text" }), jsxRuntime.jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), placeholder: "Image description..." })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Image URL" }), jsxRuntime.jsx(Input, { value: field.props.imageUrl || '', onChange: (e) => handleUpdateProp('imageUrl', e.target.value), placeholder: "https://example.com/image.jpg" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Width" }), jsxRuntime.jsx(Input, { value: field.props.imageWidth || '', onChange: (e) => handleUpdateProp('imageWidth', e.target.value), placeholder: "100% or 200px" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Height" }), jsxRuntime.jsx(Input, { value: field.props.imageHeight || '', onChange: (e) => handleUpdateProp('imageHeight', e.target.value), placeholder: "auto or 150px" })] })] })), !isStaticDisplay && field.type !== 'button' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Key" }), jsxRuntime.jsx(Input, { value: field.props.key, onChange: (e) => handleUpdateProp('key', e.target.value), className: "font-mono text-sm", "data-testid": "input-field-key" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Label" }), jsxRuntime.jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), "data-testid": "input-field-label" })] })] })), field.type === 'button' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Button Text" }), jsxRuntime.jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), "data-testid": "input-field-label" })] }) })), !isStaticDisplay && field.type !== 'button' && field.type !== 'table' && field.type !== 'container' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Placeholder" }), jsxRuntime.jsx(Input, { value: field.props.placeholder || '', onChange: (e) => handleUpdateProp('placeholder', e.target.value), "data-testid": "input-field-placeholder" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Help Text" }), jsxRuntime.jsx(Input, { value: field.props.helpText || '', onChange: (e) => handleUpdateProp('helpText', e.target.value), placeholder: "Additional instructions..." })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Tooltip" }), jsxRuntime.jsx(Input, { value: field.props.tooltip || '', onChange: (e) => handleUpdateProp('tooltip', e.target.value), placeholder: "Hover tooltip text..." }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Shows a help icon next to the label" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Default Value" }), jsxRuntime.jsx(Input, { value: field.props.defaultValue || '', onChange: (e) => handleUpdateProp('defaultValue', e.target.value) })] })] })), !isInsideContainer && !isStaticDisplay && field.type !== 'button' && field.type !== 'container' && field.type !== 'table' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Size" }), jsxRuntime.jsxs(Select, { value: field.props.size || 'medium', onValueChange: (value) => handleUpdateProp('size', value), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-field-size", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "small", children: "Small" }), jsxRuntime.jsx(SelectItem, { value: "medium", children: "Medium" }), jsxRuntime.jsx(SelectItem, { value: "large", children: "Large" })] })] })] }))] }));
|
|
2314
|
+
})(), isInsideContainer && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Width" }), jsxRuntime.jsxs(Select, { value: field.props.containerWidth || 'auto', onValueChange: (value) => handleUpdateProp('containerWidth', value), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-container-width", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "auto", children: "Auto (flexible)" }), jsxRuntime.jsx(SelectItem, { value: "25", children: "25%" }), jsxRuntime.jsx(SelectItem, { value: "33", children: "33% (1/3)" }), jsxRuntime.jsx(SelectItem, { value: "50", children: "50% (1/2)" }), jsxRuntime.jsx(SelectItem, { value: "66", children: "66% (2/3)" }), jsxRuntime.jsx(SelectItem, { value: "75", children: "75%" }), jsxRuntime.jsx(SelectItem, { value: "100", children: "100% (full width)" })] })] })] })), (() => {
|
|
3677
2315
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3678
2316
|
const showFocusProps = !staticDisplayTypes.includes(field.type) && field.type !== 'table' && field.type !== 'container';
|
|
3679
2317
|
if (!showFocusProps)
|
|
3680
2318
|
return null;
|
|
3681
|
-
return (
|
|
3682
|
-
})(),
|
|
2319
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Auto Focus" }), jsxRuntime.jsx(Switch, { checked: field.props.autoFocus || false, onCheckedChange: (checked) => handleUpdateProp('autoFocus', checked) })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Tab Index" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.tabIndex ?? '', onChange: (e) => handleUpdateProp('tabIndex', e.target.value ? parseInt(e.target.value) : undefined), placeholder: "Auto" })] })] }));
|
|
2320
|
+
})(), jsxRuntime.jsxs(Collapsible, { children: [jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full py-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "HTML Attributes" })] }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxRuntime.jsxs(CollapsibleContent, { className: "space-y-3 pt-2", children: [jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Add custom HTML attributes to this field (e.g., data-*, aria-*)" }), Object.entries(field.props.htmlAttributes || {}).map(([key, value], i) => (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx(Input, { value: key, placeholder: "Attribute", className: "flex-1 font-mono text-xs", onChange: (e) => {
|
|
3683
2321
|
const attrs = { ...field.props.htmlAttributes };
|
|
3684
2322
|
delete attrs[key];
|
|
3685
2323
|
attrs[e.target.value] = value;
|
|
3686
2324
|
handleUpdateProp('htmlAttributes', attrs);
|
|
3687
|
-
} }),
|
|
2325
|
+
} }), jsxRuntime.jsx(Input, { value: value, placeholder: "Value", className: "flex-1 font-mono text-xs", onChange: (e) => {
|
|
3688
2326
|
handleUpdateProp('htmlAttributes', {
|
|
3689
2327
|
...field.props.htmlAttributes,
|
|
3690
2328
|
[key]: e.target.value,
|
|
3691
2329
|
});
|
|
3692
|
-
} }),
|
|
2330
|
+
} }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => {
|
|
3693
2331
|
const attrs = { ...field.props.htmlAttributes };
|
|
3694
2332
|
delete attrs[key];
|
|
3695
2333
|
handleUpdateProp('htmlAttributes', Object.keys(attrs).length > 0 ? attrs : undefined);
|
|
3696
|
-
}, children:
|
|
2334
|
+
}, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }, i))), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
3697
2335
|
handleUpdateProp('htmlAttributes', {
|
|
3698
2336
|
...field.props.htmlAttributes,
|
|
3699
2337
|
'': '',
|
|
3700
2338
|
});
|
|
3701
|
-
}, className: "w-full gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Attribute"] })] })] }), jsxRuntimeExports.jsx(Separator, {}), hasOptions && (jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Options" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [getOptionsArray().map((option, i) => (jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [jsxRuntimeExports.jsx(Input, { value: option, onChange: (e) => handleUpdateOption(i, e.target.value), className: "flex-1", "data-testid": `input-option-${i}` }), jsxRuntimeExports.jsx(Button, { variant: "outline", size: "icon", onClick: () => handleRemoveOption(i), "data-testid": `button-remove-option-${i}`, children: jsxRuntimeExports.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }, i))), jsxRuntimeExports.jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddOption, className: "w-full gap-2", "data-testid": "button-add-option", children: [jsxRuntimeExports.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Option"] })] })] })), field.type === 'button' && (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Button Settings" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Action" }), jsxRuntimeExports.jsxs(Select, { value: field.props.buttonConfig?.action || 'submit', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, action: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "submit", children: "Submit Form" }), jsxRuntimeExports.jsx(SelectItem, { value: "reset", children: "Reset Form" }), jsxRuntimeExports.jsx(SelectItem, { value: "custom", children: "Custom Action" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Variant" }), jsxRuntimeExports.jsxs(Select, { value: field.props.buttonConfig?.variant || 'default', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, variant: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "default", children: "Default" }), jsxRuntimeExports.jsx(SelectItem, { value: "outline", children: "Outline" }), jsxRuntimeExports.jsx(SelectItem, { value: "secondary", children: "Secondary" }), jsxRuntimeExports.jsx(SelectItem, { value: "destructive", children: "Destructive" }), jsxRuntimeExports.jsx(SelectItem, { value: "ghost", children: "Ghost" })] })] })] })] })), field.type === 'pattern' && (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Pattern Format" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Format Pattern" }), jsxRuntimeExports.jsx(Input, { value: field.props.patternConfig?.format || '(###) ###-####', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, format: e.target.value }), placeholder: "(###) ###-####" }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Use # for digit placeholders" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Mask Character" }), jsxRuntimeExports.jsx(Input, { value: field.props.patternConfig?.mask || '_', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, mask: e.target.value }), maxLength: 1 })] })] })), field.type === 'qrcode' && (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "QR Code Settings" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "QR Value" }), jsxRuntimeExports.jsx(Input, { value: field.props.qrCodeConfig?.value || 'https://example.com', onChange: (e) => handleUpdateProp('qrCodeConfig', { ...field.props.qrCodeConfig, value: e.target.value }), placeholder: "https://example.com" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Size (px)" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.props.qrCodeConfig?.size || 128, onChange: (e) => handleUpdateProp('qrCodeConfig', { ...field.props.qrCodeConfig, size: parseInt(e.target.value) }), min: 64, max: 512 })] })] })), field.type === 'container' && (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Container Settings" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Direction" }), jsxRuntimeExports.jsxs(Select, { value: field.props.containerConfig?.direction || 'row', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, direction: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { "data-testid": "select-container-direction", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "row", children: "Row (Horizontal)" }), jsxRuntimeExports.jsx(SelectItem, { value: "column", children: "Column (Vertical)" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Inner Field Size (Density)" }), jsxRuntimeExports.jsxs(Select, { value: field.props.containerConfig?.fieldSize || 'normal', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, fieldSize: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { "data-testid": "container-field-size", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "compact", "data-testid": "field-size-compact", children: "Compact (Minimal)" }), jsxRuntimeExports.jsx(SelectItem, { value: "normal", "data-testid": "field-size-normal", children: "Normal" }), jsxRuntimeExports.jsx(SelectItem, { value: "comfortable", "data-testid": "field-size-comfortable", children: "Comfortable (Spacious)" })] })] }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Controls padding and font sizes for fields inside this container" })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Spacing & Layout" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Gap (between items)" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.props.containerConfig?.gap ?? 4, onChange: (e) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, gap: parseInt(e.target.value) }), min: 0, max: 16 }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Space between child elements (0-16)" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Padding (inner space)" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.props.containerConfig?.padding ?? 4, onChange: (e) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, padding: parseInt(e.target.value) }), min: 0, max: 16 }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Inner spacing around content (0-16)" })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Flex Properties" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Justify Content" }), jsxRuntimeExports.jsxs(Select, { value: field.props.containerConfig?.justifyContent || 'flex-start', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, justifyContent: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { "data-testid": "select-justify-content", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "flex-start", children: "Start" }), jsxRuntimeExports.jsx(SelectItem, { value: "flex-end", children: "End" }), jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntimeExports.jsx(SelectItem, { value: "space-between", children: "Space Between" }), jsxRuntimeExports.jsx(SelectItem, { value: "space-around", children: "Space Around" }), jsxRuntimeExports.jsx(SelectItem, { value: "space-evenly", children: "Space Evenly" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Align Items" }), jsxRuntimeExports.jsxs(Select, { value: field.props.containerConfig?.alignItems || 'stretch', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, alignItems: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { "data-testid": "select-align-items", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "flex-start", children: "Start" }), jsxRuntimeExports.jsx(SelectItem, { value: "flex-end", children: "End" }), jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntimeExports.jsx(SelectItem, { value: "stretch", children: "Stretch" }), jsxRuntimeExports.jsx(SelectItem, { value: "baseline", children: "Baseline" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Flex Wrap" }), jsxRuntimeExports.jsxs(Select, { value: field.props.containerConfig?.flexWrap || 'wrap', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, flexWrap: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { "data-testid": "select-flex-wrap", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "wrap", children: "Wrap" }), jsxRuntimeExports.jsx(SelectItem, { value: "nowrap", children: "No Wrap" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Show Border" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.containerConfig?.border || false, onCheckedChange: (checked) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, border: checked }) })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx("h5", { className: "text-sm font-medium", children: "Container Fields" }), jsxRuntimeExports.jsxs("span", { className: "text-xs text-muted-foreground", children: [(field.props.containerConfig?.fields || []).length, " field(s)"] })] }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Drag fields onto the container. Set each field's width in its properties." })] })] })), field.type === 'table' && (jsxRuntimeExports.jsxs("div", { className: "space-y-4 p-3 bg-muted/30 rounded-md", children: [jsxRuntimeExports.jsx("h4", { className: "text-sm font-medium", children: "Table Configuration" }), jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Show Row Numbers" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.showRowNumbers ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, showRowNumbers: checked }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Allow Add Rows" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.allowAddRows ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowAddRows: checked }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Allow Delete Rows" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.allowDeleteRows ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowDeleteRows: checked }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Striped Rows" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.striped ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, striped: checked }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Bordered" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.bordered ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, bordered: checked }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Compact" }), jsxRuntimeExports.jsx(Switch, { checked: field.props.tableConfig?.compact ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, compact: checked }) })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Min Rows" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.props.tableConfig?.minRows ?? 1, onChange: (e) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, minRows: parseInt(e.target.value) || 1 }), min: 1, max: 100 })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Max Rows" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.props.tableConfig?.maxRows ?? 100, onChange: (e) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, maxRows: parseInt(e.target.value) || 100 }), min: 1, max: 1000 })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx("h5", { className: "text-sm font-medium", children: "Columns" }), jsxRuntimeExports.jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
2339
|
+
}, className: "w-full gap-2", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Attribute"] })] })] }), jsxRuntime.jsx(Separator, {}), hasOptions && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Options" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [getOptionsArray().map((option, i) => (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx(Input, { value: option, onChange: (e) => handleUpdateOption(i, e.target.value), className: "flex-1", "data-testid": `input-option-${i}` }), jsxRuntime.jsx(Button, { variant: "outline", size: "icon", onClick: () => handleRemoveOption(i), "data-testid": `button-remove-option-${i}`, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }, i))), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddOption, className: "w-full gap-2", "data-testid": "button-add-option", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Option"] })] })] })), field.type === 'button' && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Button Settings" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Action" }), jsxRuntime.jsxs(Select, { value: field.props.buttonConfig?.action || 'submit', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, action: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "submit", children: "Submit Form" }), jsxRuntime.jsx(SelectItem, { value: "reset", children: "Reset Form" }), jsxRuntime.jsx(SelectItem, { value: "custom", children: "Custom Action" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Variant" }), jsxRuntime.jsxs(Select, { value: field.props.buttonConfig?.variant || 'default', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, variant: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "default", children: "Default" }), jsxRuntime.jsx(SelectItem, { value: "outline", children: "Outline" }), jsxRuntime.jsx(SelectItem, { value: "secondary", children: "Secondary" }), jsxRuntime.jsx(SelectItem, { value: "destructive", children: "Destructive" }), jsxRuntime.jsx(SelectItem, { value: "ghost", children: "Ghost" })] })] })] })] })), field.type === 'pattern' && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Pattern Format" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Format Pattern" }), jsxRuntime.jsx(Input, { value: field.props.patternConfig?.format || '(###) ###-####', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, format: e.target.value }), placeholder: "(###) ###-####" }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Use # for digit placeholders" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Mask Character" }), jsxRuntime.jsx(Input, { value: field.props.patternConfig?.mask || '_', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, mask: e.target.value }), maxLength: 1 })] })] })), field.type === 'qrcode' && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "QR Code Settings" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "QR Value" }), jsxRuntime.jsx(Input, { value: field.props.qrCodeConfig?.value || 'https://example.com', onChange: (e) => handleUpdateProp('qrCodeConfig', { ...field.props.qrCodeConfig, value: e.target.value }), placeholder: "https://example.com" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Size (px)" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.qrCodeConfig?.size || 128, onChange: (e) => handleUpdateProp('qrCodeConfig', { ...field.props.qrCodeConfig, size: parseInt(e.target.value) }), min: 64, max: 512 })] })] })), field.type === 'container' && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Container Settings" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Direction" }), jsxRuntime.jsxs(Select, { value: field.props.containerConfig?.direction || 'row', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, direction: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-container-direction", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "row", children: "Row (Horizontal)" }), jsxRuntime.jsx(SelectItem, { value: "column", children: "Column (Vertical)" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Inner Field Size (Density)" }), jsxRuntime.jsxs(Select, { value: field.props.containerConfig?.fieldSize || 'normal', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, fieldSize: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "container-field-size", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "compact", "data-testid": "field-size-compact", children: "Compact (Minimal)" }), jsxRuntime.jsx(SelectItem, { value: "normal", "data-testid": "field-size-normal", children: "Normal" }), jsxRuntime.jsx(SelectItem, { value: "comfortable", "data-testid": "field-size-comfortable", children: "Comfortable (Spacious)" })] })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Controls padding and font sizes for fields inside this container" })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Spacing & Layout" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Gap (between items)" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.containerConfig?.gap ?? 4, onChange: (e) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, gap: parseInt(e.target.value) }), min: 0, max: 16 }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Space between child elements (0-16)" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Padding (inner space)" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.containerConfig?.padding ?? 4, onChange: (e) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, padding: parseInt(e.target.value) }), min: 0, max: 16 }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Inner spacing around content (0-16)" })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Flex Properties" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Justify Content" }), jsxRuntime.jsxs(Select, { value: field.props.containerConfig?.justifyContent || 'flex-start', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, justifyContent: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-justify-content", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "flex-start", children: "Start" }), jsxRuntime.jsx(SelectItem, { value: "flex-end", children: "End" }), jsxRuntime.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntime.jsx(SelectItem, { value: "space-between", children: "Space Between" }), jsxRuntime.jsx(SelectItem, { value: "space-around", children: "Space Around" }), jsxRuntime.jsx(SelectItem, { value: "space-evenly", children: "Space Evenly" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Align Items" }), jsxRuntime.jsxs(Select, { value: field.props.containerConfig?.alignItems || 'stretch', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, alignItems: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-align-items", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "flex-start", children: "Start" }), jsxRuntime.jsx(SelectItem, { value: "flex-end", children: "End" }), jsxRuntime.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntime.jsx(SelectItem, { value: "stretch", children: "Stretch" }), jsxRuntime.jsx(SelectItem, { value: "baseline", children: "Baseline" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Flex Wrap" }), jsxRuntime.jsxs(Select, { value: field.props.containerConfig?.flexWrap || 'wrap', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, flexWrap: value }), children: [jsxRuntime.jsx(SelectTrigger, { "data-testid": "select-flex-wrap", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "wrap", children: "Wrap" }), jsxRuntime.jsx(SelectItem, { value: "nowrap", children: "No Wrap" })] })] })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Show Border" }), jsxRuntime.jsx(Switch, { checked: field.props.containerConfig?.border || false, onCheckedChange: (checked) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, border: checked }) })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("h5", { className: "text-sm font-medium", children: "Container Fields" }), jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [(field.props.containerConfig?.fields || []).length, " field(s)"] })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Drag fields onto the container. Set each field's width in its properties." })] })] })), field.type === 'table' && (jsxRuntime.jsxs("div", { className: "space-y-4 p-3 bg-muted/30 rounded-md", children: [jsxRuntime.jsx("h4", { className: "text-sm font-medium", children: "Table Configuration" }), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Show Row Numbers" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.showRowNumbers ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, showRowNumbers: checked }) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Allow Add Rows" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.allowAddRows ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowAddRows: checked }) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Allow Delete Rows" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.allowDeleteRows ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowDeleteRows: checked }) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Striped Rows" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.striped ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, striped: checked }) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Bordered" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.bordered ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, bordered: checked }) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Compact" }), jsxRuntime.jsx(Switch, { checked: field.props.tableConfig?.compact ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, compact: checked }) })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Min Rows" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.tableConfig?.minRows ?? 1, onChange: (e) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, minRows: parseInt(e.target.value) || 1 }), min: 1, max: 100 })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Max Rows" }), jsxRuntime.jsx(Input, { type: "number", value: field.props.tableConfig?.maxRows ?? 100, onChange: (e) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, maxRows: parseInt(e.target.value) || 100 }), min: 1, max: 1000 })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("h5", { className: "text-sm font-medium", children: "Columns" }), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
3702
2340
|
const currentColumns = field.props.tableConfig?.columns || [];
|
|
3703
2341
|
const newColumn = {
|
|
3704
2342
|
key: `col_${Date.now()}`,
|
|
@@ -3706,102 +2344,102 @@ function FieldProperties() {
|
|
|
3706
2344
|
type: 'text',
|
|
3707
2345
|
};
|
|
3708
2346
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: [...currentColumns, newColumn] });
|
|
3709
|
-
}, children: [
|
|
2347
|
+
}, children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4 mr-1" }), "Add Column"] })] }), (field.props.tableConfig?.columns || []).map((col, colIndex) => (jsxRuntime.jsxs("div", { className: "p-3 bg-background rounded-md border border-border space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: ["Column ", colIndex + 1] }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => {
|
|
3710
2348
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3711
2349
|
currentColumns.splice(colIndex, 1);
|
|
3712
2350
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3713
|
-
}, children:
|
|
2351
|
+
}, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3 text-destructive" }) })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Key" }), jsxRuntime.jsx(Input, { value: col.key, onChange: (e) => {
|
|
3714
2352
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3715
2353
|
currentColumns[colIndex] = { ...col, key: e.target.value };
|
|
3716
2354
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3717
|
-
}, placeholder: "column_key", className: "text-xs h-8" })] }),
|
|
2355
|
+
}, placeholder: "column_key", className: "text-xs h-8" })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Label" }), jsxRuntime.jsx(Input, { value: col.label, onChange: (e) => {
|
|
3718
2356
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3719
2357
|
currentColumns[colIndex] = { ...col, label: e.target.value };
|
|
3720
2358
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3721
|
-
}, placeholder: "Column Label", className: "text-xs h-8" })] })] }),
|
|
2359
|
+
}, placeholder: "Column Label", className: "text-xs h-8" })] })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-2", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Type" }), jsxRuntime.jsxs(Select, { value: col.type || 'text', onValueChange: (value) => {
|
|
3722
2360
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3723
2361
|
currentColumns[colIndex] = { ...col, type: value };
|
|
3724
2362
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3725
|
-
}, children: [
|
|
2363
|
+
}, children: [jsxRuntime.jsx(SelectTrigger, { className: "h-8 text-xs", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "text", children: "Text" }), jsxRuntime.jsx(SelectItem, { value: "number", children: "Number" }), jsxRuntime.jsx(SelectItem, { value: "email", children: "Email" }), jsxRuntime.jsx(SelectItem, { value: "date", children: "Date" }), jsxRuntime.jsx(SelectItem, { value: "select", children: "Select" }), jsxRuntime.jsx(SelectItem, { value: "checkbox", children: "Checkbox" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Width" }), jsxRuntime.jsx(Input, { value: col.width || '', onChange: (e) => {
|
|
3726
2364
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3727
2365
|
currentColumns[colIndex] = { ...col, width: e.target.value };
|
|
3728
2366
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3729
|
-
}, placeholder: "auto", className: "text-xs h-8" })] }),
|
|
2367
|
+
}, placeholder: "auto", className: "text-xs h-8" })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Required" }), jsxRuntime.jsx("div", { className: "flex items-center h-8", children: jsxRuntime.jsx(Switch, { checked: col.required || false, onCheckedChange: (checked) => {
|
|
3730
2368
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3731
2369
|
currentColumns[colIndex] = { ...col, required: checked };
|
|
3732
2370
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3733
|
-
} }) })] })] }), col.type === 'select' && (
|
|
2371
|
+
} }) })] })] }), col.type === 'select' && (jsxRuntime.jsxs("div", { className: "space-y-2 pt-2 border-t border-border", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-xs font-medium", children: "Select Options" }), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "h-6 text-xs", onClick: () => {
|
|
3734
2372
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3735
2373
|
const currentOptions = col.options || [];
|
|
3736
2374
|
const newOption = { label: `Option ${currentOptions.length + 1}`, value: `option_${currentOptions.length + 1}` };
|
|
3737
2375
|
currentColumns[colIndex] = { ...col, options: [...currentOptions, newOption] };
|
|
3738
2376
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3739
|
-
}, children: [
|
|
2377
|
+
}, children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-3 w-3 mr-1" }), "Add"] })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-[1fr_1fr_auto] gap-1 text-[10px] text-muted-foreground px-1", children: [jsxRuntime.jsx("span", { children: "Label" }), jsxRuntime.jsx("span", { children: "Value" }), jsxRuntime.jsx("span", { className: "w-6" })] }), (col.options || []).map((opt, optIndex) => (jsxRuntime.jsxs("div", { className: "grid grid-cols-[1fr_1fr_auto] gap-1 items-center", children: [jsxRuntime.jsx(Input, { value: opt.label, onChange: (e) => {
|
|
3740
2378
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3741
2379
|
const currentOptions = [...(col.options || [])];
|
|
3742
2380
|
currentOptions[optIndex] = { ...opt, label: e.target.value };
|
|
3743
2381
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3744
2382
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3745
|
-
}, placeholder: "Evet", className: "text-xs h-7" }),
|
|
2383
|
+
}, placeholder: "Evet", className: "text-xs h-7" }), jsxRuntime.jsx(Input, { value: opt.value, onChange: (e) => {
|
|
3746
2384
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3747
2385
|
const currentOptions = [...(col.options || [])];
|
|
3748
2386
|
currentOptions[optIndex] = { ...opt, value: e.target.value };
|
|
3749
2387
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3750
2388
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3751
|
-
}, placeholder: "yes", className: "text-xs h-7" }),
|
|
2389
|
+
}, placeholder: "yes", className: "text-xs h-7" }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => {
|
|
3752
2390
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3753
2391
|
const currentOptions = [...(col.options || [])];
|
|
3754
2392
|
currentOptions.splice(optIndex, 1);
|
|
3755
2393
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3756
2394
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3757
|
-
}, children:
|
|
2395
|
+
}, children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3 w-3 text-destructive" }) })] }, optIndex))), (!col.options || col.options.length === 0) && (jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground italic", children: "Hen\u00FCz se\u00E7enek eklenmedi" }))] }))] }, col.key)))] })] })), (() => {
|
|
3758
2396
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3759
2397
|
if (staticDisplayTypes.includes(field.type))
|
|
3760
2398
|
return null;
|
|
3761
|
-
return (
|
|
3762
|
-
})(),
|
|
2399
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Required" }), jsxRuntime.jsx(Switch, { checked: field.validation?.required || false, onCheckedChange: (checked) => handleUpdateValidation('required', checked), "data-testid": "switch-required" })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Disabled" }), jsxRuntime.jsx(Switch, { checked: field.props.disabled || false, onCheckedChange: (checked) => handleUpdateProp('disabled', checked), "data-testid": "switch-disabled" })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Read Only" }), jsxRuntime.jsx(Switch, { checked: field.props.readOnly || false, onCheckedChange: (checked) => handleUpdateProp('readOnly', checked), "data-testid": "switch-readonly" })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Hidden" }), jsxRuntime.jsx(Switch, { checked: field.props.hidden || false, onCheckedChange: (checked) => handleUpdateProp('hidden', checked) })] })] })] }));
|
|
2400
|
+
})(), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => deleteField(row.id, column.id, field.id), className: "w-full gap-2 text-destructive hover:text-destructive", "data-testid": "button-delete-field", children: [jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }), "Delete Field"] })] }), jsxRuntime.jsx(TabsContent, { value: "rules", className: "space-y-4 mt-0", children: (() => {
|
|
3763
2401
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3764
2402
|
if (staticDisplayTypes.includes(field.type)) {
|
|
3765
|
-
return (
|
|
2403
|
+
return (jsxRuntime.jsx("div", { className: "text-center py-8 text-muted-foreground", children: jsxRuntime.jsx("p", { className: "text-sm", children: "Bu bile\u015Fen i\u00E7in do\u011Frulama kurallar\u0131 gerekli de\u011Fil." }) }));
|
|
3766
2404
|
}
|
|
3767
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsxRuntimeExports.jsx(lucideReact.Settings2, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: "Validation Rules" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-3 pb-4", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Auto Validate" }), jsxRuntimeExports.jsx(Switch, { checked: field.validation?.autoValidate || false, onCheckedChange: (checked) => handleUpdateValidation('autoValidate', checked) })] }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Validate while typing" }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Validate on Blur" }), jsxRuntimeExports.jsx(Switch, { checked: field.validation?.validateOnBlur ?? true, onCheckedChange: (checked) => handleUpdateValidation('validateOnBlur', checked) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Validate on Change" }), jsxRuntimeExports.jsx(Switch, { checked: field.validation?.validateOnChange || false, onCheckedChange: (checked) => handleUpdateValidation('validateOnChange', checked) })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "space-y-2 pt-4", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Validation Type" }), jsxRuntimeExports.jsxs(Select, { value: field.validation?.validationType || '', onValueChange: (value) => handleUpdateValidation('validationType', value || undefined), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "None" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "email", children: "Email" }), jsxRuntimeExports.jsx(SelectItem, { value: "url", children: "URL" }), jsxRuntimeExports.jsx(SelectItem, { value: "phone", children: "Phone" }), jsxRuntimeExports.jsx(SelectItem, { value: "custom", children: "Custom" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Min Length" }), jsxRuntimeExports.jsx(Input, { type: "number", min: 0, value: field.validation?.minLength || '', onChange: (e) => handleUpdateValidation('minLength', e.target.value ? parseInt(e.target.value) : undefined), "data-testid": "input-min-length" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Max Length" }), jsxRuntimeExports.jsx(Input, { type: "number", min: 0, value: field.validation?.maxLength || '', onChange: (e) => handleUpdateValidation('maxLength', e.target.value ? parseInt(e.target.value) : undefined), "data-testid": "input-max-length" })] }), ['number', 'slider'].includes(field.type) && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Min Value" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.validation?.min ?? '', onChange: (e) => handleUpdateValidation('min', e.target.value ? parseFloat(e.target.value) : undefined), "data-testid": "input-min-value" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Max Value" }), jsxRuntimeExports.jsx(Input, { type: "number", value: field.validation?.max ?? '', onChange: (e) => handleUpdateValidation('max', e.target.value ? parseFloat(e.target.value) : undefined), "data-testid": "input-max-value" })] })] })), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Pattern (Regex)" }), jsxRuntimeExports.jsx(Input, { value: field.validation?.pattern || '', onChange: (e) => handleUpdateValidation('pattern', e.target.value || undefined), placeholder: "^[a-zA-Z]+$", className: "font-mono text-sm", "data-testid": "input-pattern" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Custom Error Message" }), jsxRuntimeExports.jsx(Input, { value: field.validation?.errorMessage || '', onChange: (e) => handleUpdateValidation('errorMessage', e.target.value || undefined), placeholder: "Please enter a valid value", "data-testid": "input-error-message" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Custom Validation (JS)" }), jsxRuntimeExports.jsx(Textarea, { value: field.validation?.customValidation || '', onChange: (e) => handleUpdateValidation('customValidation', e.target.value || undefined), placeholder: "return value.length > 5;", className: "font-mono text-sm min-h-[80px]" }), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Write JavaScript that returns true for valid values" })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Zap, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntimeExports.jsx(Label, { className: "text-sm font-medium", children: "Conditional Logic" })] }), jsxRuntimeExports.jsx(Switch, { checked: field.conditionalLogic?.enabled || false, onCheckedChange: (checked) => handleUpdateConditionalLogic({ enabled: checked }) })] }), field.conditionalLogic?.enabled && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "Action" }), jsxRuntimeExports.jsxs(Select, { value: field.conditionalLogic?.action || 'show', onValueChange: (value) => handleUpdateConditionalLogic({ action: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "show", children: "Show this field" }), jsxRuntimeExports.jsx(SelectItem, { value: "hide", children: "Hide this field" }), jsxRuntimeExports.jsx(SelectItem, { value: "enable", children: "Enable this field" }), jsxRuntimeExports.jsx(SelectItem, { value: "disable", children: "Disable this field" }), jsxRuntimeExports.jsx(SelectItem, { value: "require", children: "Make required" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm", children: "When" }), jsxRuntimeExports.jsxs(Select, { value: field.conditionalLogic?.logicType || 'all', onValueChange: (value) => handleUpdateConditionalLogic({ logicType: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "all", children: "All conditions are met" }), jsxRuntimeExports.jsx(SelectItem, { value: "any", children: "Any condition is met" })] })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [jsxRuntimeExports.jsx(Label, { className: "text-sm font-medium", children: "Conditions" }), (field.conditionalLogic?.conditions || []).map((condition, index) => (jsxRuntimeExports.jsxs("div", { className: "p-3 border border-border rounded-md space-y-3", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsxs(Badge, { variant: "secondary", children: ["Condition ", index + 1] }), jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeCondition(index), children: jsxRuntimeExports.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }), jsxRuntimeExports.jsxs(Select, { value: condition.fieldKey, onValueChange: (value) => updateCondition(index, { fieldKey: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select field..." }) }), jsxRuntimeExports.jsx(SelectContent, { children: allFields.map((f) => (jsxRuntimeExports.jsxs(SelectItem, { value: f.props.key, children: [f.props.label, " (", f.props.key, ")"] }, f.id))) })] }), jsxRuntimeExports.jsxs(Select, { value: condition.operator, onValueChange: (value) => updateCondition(index, { operator: value }), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "equals", children: "Equals" }), jsxRuntimeExports.jsx(SelectItem, { value: "notEquals", children: "Not equals" }), jsxRuntimeExports.jsx(SelectItem, { value: "contains", children: "Contains" }), jsxRuntimeExports.jsx(SelectItem, { value: "notContains", children: "Does not contain" }), jsxRuntimeExports.jsx(SelectItem, { value: "greaterThan", children: "Greater than" }), jsxRuntimeExports.jsx(SelectItem, { value: "lessThan", children: "Less than" }), jsxRuntimeExports.jsx(SelectItem, { value: "isEmpty", children: "Is empty" }), jsxRuntimeExports.jsx(SelectItem, { value: "isNotEmpty", children: "Is not empty" }), jsxRuntimeExports.jsx(SelectItem, { value: "startsWith", children: "Starts with" }), jsxRuntimeExports.jsx(SelectItem, { value: "endsWith", children: "Ends with" })] })] }), !['isEmpty', 'isNotEmpty'].includes(condition.operator) && (jsxRuntimeExports.jsx(Input, { value: condition.value || '', onChange: (e) => updateCondition(index, { value: e.target.value }), placeholder: "Value..." }))] }, index))), jsxRuntimeExports.jsxs(Button, { variant: "outline", size: "sm", onClick: addCondition, className: "w-full gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Condition"] })] })] }))] }));
|
|
3768
|
-
})() }),
|
|
2405
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsxRuntime.jsx(lucideReact.Settings2, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Validation Rules" })] }), jsxRuntime.jsxs("div", { className: "space-y-3 pb-4", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Auto Validate" }), jsxRuntime.jsx(Switch, { checked: field.validation?.autoValidate || false, onCheckedChange: (checked) => handleUpdateValidation('autoValidate', checked) })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Validate while typing" }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Validate on Blur" }), jsxRuntime.jsx(Switch, { checked: field.validation?.validateOnBlur ?? true, onCheckedChange: (checked) => handleUpdateValidation('validateOnBlur', checked) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Validate on Change" }), jsxRuntime.jsx(Switch, { checked: field.validation?.validateOnChange || false, onCheckedChange: (checked) => handleUpdateValidation('validateOnChange', checked) })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-2 pt-4", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Validation Type" }), jsxRuntime.jsxs(Select, { value: field.validation?.validationType || '', onValueChange: (value) => handleUpdateValidation('validationType', value || undefined), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "None" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "email", children: "Email" }), jsxRuntime.jsx(SelectItem, { value: "url", children: "URL" }), jsxRuntime.jsx(SelectItem, { value: "phone", children: "Phone" }), jsxRuntime.jsx(SelectItem, { value: "custom", children: "Custom" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Min Length" }), jsxRuntime.jsx(Input, { type: "number", min: 0, value: field.validation?.minLength || '', onChange: (e) => handleUpdateValidation('minLength', e.target.value ? parseInt(e.target.value) : undefined), "data-testid": "input-min-length" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Max Length" }), jsxRuntime.jsx(Input, { type: "number", min: 0, value: field.validation?.maxLength || '', onChange: (e) => handleUpdateValidation('maxLength', e.target.value ? parseInt(e.target.value) : undefined), "data-testid": "input-max-length" })] }), ['number', 'slider'].includes(field.type) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Min Value" }), jsxRuntime.jsx(Input, { type: "number", value: field.validation?.min ?? '', onChange: (e) => handleUpdateValidation('min', e.target.value ? parseFloat(e.target.value) : undefined), "data-testid": "input-min-value" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Max Value" }), jsxRuntime.jsx(Input, { type: "number", value: field.validation?.max ?? '', onChange: (e) => handleUpdateValidation('max', e.target.value ? parseFloat(e.target.value) : undefined), "data-testid": "input-max-value" })] })] })), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Pattern (Regex)" }), jsxRuntime.jsx(Input, { value: field.validation?.pattern || '', onChange: (e) => handleUpdateValidation('pattern', e.target.value || undefined), placeholder: "^[a-zA-Z]+$", className: "font-mono text-sm", "data-testid": "input-pattern" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Custom Error Message" }), jsxRuntime.jsx(Input, { value: field.validation?.errorMessage || '', onChange: (e) => handleUpdateValidation('errorMessage', e.target.value || undefined), placeholder: "Please enter a valid value", "data-testid": "input-error-message" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Custom Validation (JS)" }), jsxRuntime.jsx(Textarea, { value: field.validation?.customValidation || '', onChange: (e) => handleUpdateValidation('customValidation', e.target.value || undefined), placeholder: "return value.length > 5;", className: "font-mono text-sm min-h-[80px]" }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Write JavaScript that returns true for valid values" })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Zap, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: "Conditional Logic" })] }), jsxRuntime.jsx(Switch, { checked: field.conditionalLogic?.enabled || false, onCheckedChange: (checked) => handleUpdateConditionalLogic({ enabled: checked }) })] }), field.conditionalLogic?.enabled && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Action" }), jsxRuntime.jsxs(Select, { value: field.conditionalLogic?.action || 'show', onValueChange: (value) => handleUpdateConditionalLogic({ action: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "show", children: "Show this field" }), jsxRuntime.jsx(SelectItem, { value: "hide", children: "Hide this field" }), jsxRuntime.jsx(SelectItem, { value: "enable", children: "Enable this field" }), jsxRuntime.jsx(SelectItem, { value: "disable", children: "Disable this field" }), jsxRuntime.jsx(SelectItem, { value: "require", children: "Make required" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "When" }), jsxRuntime.jsxs(Select, { value: field.conditionalLogic?.logicType || 'all', onValueChange: (value) => handleUpdateConditionalLogic({ logicType: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "all", children: "All conditions are met" }), jsxRuntime.jsx(SelectItem, { value: "any", children: "Any condition is met" })] })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: "Conditions" }), (field.conditionalLogic?.conditions || []).map((condition, index) => (jsxRuntime.jsxs("div", { className: "p-3 border border-border rounded-md space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs(Badge, { variant: "secondary", children: ["Condition ", index + 1] }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeCondition(index), children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }), jsxRuntime.jsxs(Select, { value: condition.fieldKey, onValueChange: (value) => updateCondition(index, { fieldKey: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select field..." }) }), jsxRuntime.jsx(SelectContent, { children: allFields.map((f) => (jsxRuntime.jsxs(SelectItem, { value: f.props.key, children: [f.props.label, " (", f.props.key, ")"] }, f.id))) })] }), jsxRuntime.jsxs(Select, { value: condition.operator, onValueChange: (value) => updateCondition(index, { operator: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "equals", children: "Equals" }), jsxRuntime.jsx(SelectItem, { value: "notEquals", children: "Not equals" }), jsxRuntime.jsx(SelectItem, { value: "contains", children: "Contains" }), jsxRuntime.jsx(SelectItem, { value: "notContains", children: "Does not contain" }), jsxRuntime.jsx(SelectItem, { value: "greaterThan", children: "Greater than" }), jsxRuntime.jsx(SelectItem, { value: "lessThan", children: "Less than" }), jsxRuntime.jsx(SelectItem, { value: "isEmpty", children: "Is empty" }), jsxRuntime.jsx(SelectItem, { value: "isNotEmpty", children: "Is not empty" }), jsxRuntime.jsx(SelectItem, { value: "startsWith", children: "Starts with" }), jsxRuntime.jsx(SelectItem, { value: "endsWith", children: "Ends with" })] })] }), !['isEmpty', 'isNotEmpty'].includes(condition.operator) && (jsxRuntime.jsx(Input, { value: condition.value || '', onChange: (e) => updateCondition(index, { value: e.target.value }), placeholder: "Value..." }))] }, index))), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: addCondition, className: "w-full gap-2", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Condition"] })] })] }))] }));
|
|
2406
|
+
})() }), jsxRuntime.jsxs(TabsContent, { value: "actions", className: "space-y-4 mt-0", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsxRuntime.jsx(lucideReact.MousePointerClick, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Event Handlers" })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mb-4", children: "Add actions that trigger on specific events like click, change, focus, or blur." }), ['onClick', 'onChange', 'onFocus', 'onBlur'].map((eventType) => (jsxRuntime.jsxs(Collapsible, { className: "border border-border rounded-md", children: [jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full p-3 hover:bg-muted/50", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Play, { className: "h-3 w-3 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: eventType }), (field.events?.[eventType]?.length || 0) > 0 && (jsxRuntime.jsx(Badge, { variant: "secondary", className: "text-xs", children: field.events?.[eventType]?.length }))] }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxRuntime.jsxs(CollapsibleContent, { className: "p-3 pt-0 space-y-3", children: [(field.events?.[eventType] || []).map((action, index) => (jsxRuntime.jsxs("div", { className: "p-3 border border-border rounded-md space-y-3 bg-muted/30", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs(Badge, { variant: "outline", children: ["Action ", index + 1] }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeEventAction(eventType, index), children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Type" }), jsxRuntime.jsxs(Select, { value: action.type, onValueChange: (value) => updateEventAction(eventType, index, { type: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "common", children: "Common Action" }), jsxRuntime.jsx(SelectItem, { value: "code", children: "Code Action" }), jsxRuntime.jsx(SelectItem, { value: "custom", children: "Custom Action" })] })] })] }), action.type === 'common' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Action" }), jsxRuntime.jsxs(Select, { value: action.name, onValueChange: (value) => updateEventAction(eventType, index, { name: value }), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select action..." }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "validate", children: "Validate Form" }), jsxRuntime.jsx(SelectItem, { value: "reset", children: "Reset Form" }), jsxRuntime.jsx(SelectItem, { value: "submit", children: "Submit Form" }), jsxRuntime.jsx(SelectItem, { value: "clearField", children: "Clear This Field" }), jsxRuntime.jsx(SelectItem, { value: "focusField", children: "Focus Field" }), jsxRuntime.jsx(SelectItem, { value: "showMessage", children: "Show Message" })] })] })] })), action.type === 'code' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "JavaScript Code" }), jsxRuntime.jsx(Textarea, { value: action.code || '', onChange: (e) => updateEventAction(eventType, index, { code: e.target.value }), placeholder: "console.log('Action triggered');", className: "font-mono text-xs min-h-[60px]" })] })), action.type === 'custom' && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Custom Action Name" }), jsxRuntime.jsx(Input, { value: action.name, onChange: (e) => updateEventAction(eventType, index, { name: e.target.value }), placeholder: "myCustomAction", className: "font-mono text-sm" }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "This will call the custom action passed to FormViewer" })] }))] }, index))), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => addEventAction(eventType), className: "w-full gap-2", children: [jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }), "Add Action"] })] })] }, eventType)))] }), jsxRuntime.jsxs(TabsContent, { value: "style", className: "space-y-4 mt-0", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-4", children: [jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "For device" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.deviceTarget || 'any', onValueChange: (value) => handleUpdateCustomStyle('deviceTarget', value), children: [jsxRuntime.jsx(SelectTrigger, { className: "w-32", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "any", children: "Any" }), jsxRuntime.jsx(SelectItem, { value: "mobile", children: "Mobile" }), jsxRuntime.jsx(SelectItem, { value: "tablet", children: "Tablet" }), jsxRuntime.jsx(SelectItem, { value: "desktop", children: "Desktop" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h4", { className: "text-sm font-semibold", children: "Component" }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Paintbrush, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx(Label, { className: "text-sm w-24", children: "Class Name" }), jsxRuntime.jsx(Input, { value: field.customStyle?.inputClassName || '', onChange: (e) => handleUpdateCustomStyle('inputClassName', e.target.value), placeholder: "", className: "font-mono text-sm flex-1" }), field.customStyle?.inputClassName && (jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('inputClassName', ''), children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }))] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h4", { className: "text-sm font-semibold", children: "Wrapper" }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Width" }), jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx(Input, { type: "number", value: field.customStyle?.width?.value ?? 100, onChange: (e) => handleUpdateCustomStyle('width', {
|
|
3769
2407
|
...field.customStyle?.width,
|
|
3770
2408
|
value: parseInt(e.target.value) || 100
|
|
3771
|
-
}), className: "w-16" }),
|
|
2409
|
+
}), className: "w-16" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.width?.unit || '%', onValueChange: (value) => handleUpdateCustomStyle('width', {
|
|
3772
2410
|
...field.customStyle?.width,
|
|
3773
2411
|
unit: value
|
|
3774
|
-
}), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "w-14", children: jsxRuntimeExports.jsx(SelectValue, {}) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "%", children: "%" }), jsxRuntimeExports.jsx(SelectItem, { value: "px", children: "px" }), jsxRuntimeExports.jsx(SelectItem, { value: "rem", children: "rem" })] })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Height" }), jsxRuntimeExports.jsxs(Select, { value: field.customStyle?.height || 'auto', onValueChange: (value) => handleUpdateCustomStyle('height', value), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "auto", children: "Auto" }), jsxRuntimeExports.jsx(SelectItem, { value: "100%", children: "100%" }), jsxRuntimeExports.jsx(SelectItem, { value: "50%", children: "50%" }), jsxRuntimeExports.jsx(SelectItem, { value: "200px", children: "200px" }), jsxRuntimeExports.jsx(SelectItem, { value: "300px", children: "300px" })] })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Margin Top" }), jsxRuntimeExports.jsxs(Select, { value: field.customStyle?.marginTop || '', onValueChange: (value) => handleUpdateCustomStyle('marginTop', value), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntimeExports.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntimeExports.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntimeExports.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntimeExports.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntimeExports.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Margin Right" }), jsxRuntimeExports.jsxs(Select, { value: field.customStyle?.marginRight || '', onValueChange: (value) => handleUpdateCustomStyle('marginRight', value), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntimeExports.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntimeExports.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntimeExports.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntimeExports.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntimeExports.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Margin Bottom" }), jsxRuntimeExports.jsxs(Select, { value: field.customStyle?.marginBottom || '', onValueChange: (value) => handleUpdateCustomStyle('marginBottom', value), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntimeExports.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntimeExports.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntimeExports.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntimeExports.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntimeExports.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Margin Left" }), jsxRuntimeExports.jsxs(Select, { value: field.customStyle?.marginLeft || '', onValueChange: (value) => handleUpdateCustomStyle('marginLeft', value), children: [jsxRuntimeExports.jsx(SelectTrigger, { children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntimeExports.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntimeExports.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntimeExports.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntimeExports.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntimeExports.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Color" }), jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [jsxRuntimeExports.jsx(Input, { type: "color", value: field.customStyle?.color || '#000000', onChange: (e) => handleUpdateCustomStyle('color', e.target.value), className: "w-10 h-9 p-1" }), jsxRuntimeExports.jsx(Input, { value: field.customStyle?.color || '', onChange: (e) => handleUpdateCustomStyle('color', e.target.value), placeholder: "#000000", className: "flex-1 font-mono text-xs" }), field.customStyle?.color && (jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('color', ''), children: jsxRuntimeExports.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }))] })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [jsxRuntimeExports.jsx(Label, { className: "text-xs", children: "Background Color" }), jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [jsxRuntimeExports.jsx(Input, { type: "color", value: field.customStyle?.backgroundColor || '#ffffff', onChange: (e) => handleUpdateCustomStyle('backgroundColor', e.target.value), className: "w-10 h-9 p-1" }), jsxRuntimeExports.jsx(Input, { value: field.customStyle?.backgroundColor || '', onChange: (e) => handleUpdateCustomStyle('backgroundColor', e.target.value), placeholder: "#ffffff", className: "flex-1 font-mono text-xs" }), field.customStyle?.backgroundColor && (jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('backgroundColor', ''), children: jsxRuntimeExports.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }))] })] })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: "Styles for className" }), jsxRuntimeExports.jsxs(Tabs, { defaultValue: "component", className: "w-full", children: [jsxRuntimeExports.jsxs(TabsList, { className: "w-full grid grid-cols-2", children: [jsxRuntimeExports.jsx(TabsTrigger, { value: "component", className: "text-xs", children: "Component" }), jsxRuntimeExports.jsx(TabsTrigger, { value: "wrapper", className: "text-xs", children: "Wrapper" })] }), jsxRuntimeExports.jsx(TabsContent, { value: "component", className: "mt-3", children: jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsxs(Label, { className: "text-xs text-primary", children: ["element.style ", '{'] }), jsxRuntimeExports.jsx(Textarea, { value: field.customStyle?.css || '', onChange: (e) => handleUpdateCustomStyle('css', e.target.value), placeholder: "color: #333;\nfont-size: 14px;", className: "font-mono text-xs min-h-[100px] bg-muted/30" }), jsxRuntimeExports.jsx(Label, { className: "text-xs text-primary", children: '}' })] }) }), jsxRuntimeExports.jsx(TabsContent, { value: "wrapper", className: "mt-3", children: jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsxs(Label, { className: "text-xs text-primary", children: ["wrapper.style ", '{'] }), jsxRuntimeExports.jsx(Textarea, { value: field.customStyle?.wrapperCss || '', onChange: (e) => handleUpdateCustomStyle('wrapperCss', e.target.value), placeholder: "padding: 8px;\nborder-radius: 4px;", className: "font-mono text-xs min-h-[100px] bg-muted/30" }), jsxRuntimeExports.jsx(Label, { className: "text-xs text-primary", children: '}' })] }) })] })] }), jsxRuntimeExports.jsx(Separator, {}), jsxRuntimeExports.jsxs(Collapsible, { children: [jsxRuntimeExports.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full py-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Globe, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: "Responsive Grid" })] }), jsxRuntimeExports.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxRuntimeExports.jsxs(CollapsibleContent, { className: "space-y-4 pt-2", children: [jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Override column width for different screen sizes (1-12 grid)" }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: "w-16", children: "Mobile" }), jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "(<640px)" })] }), jsxRuntimeExports.jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.mobile ?? '', onChange: (e) => {
|
|
2412
|
+
}), children: [jsxRuntime.jsx(SelectTrigger, { className: "w-14", children: jsxRuntime.jsx(SelectValue, {}) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "%", children: "%" }), jsxRuntime.jsx(SelectItem, { value: "px", children: "px" }), jsxRuntime.jsx(SelectItem, { value: "rem", children: "rem" })] })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Height" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.height || 'auto', onValueChange: (value) => handleUpdateCustomStyle('height', value), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "auto", children: "Auto" }), jsxRuntime.jsx(SelectItem, { value: "100%", children: "100%" }), jsxRuntime.jsx(SelectItem, { value: "50%", children: "50%" }), jsxRuntime.jsx(SelectItem, { value: "200px", children: "200px" }), jsxRuntime.jsx(SelectItem, { value: "300px", children: "300px" })] })] })] })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Margin Top" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.marginTop || '', onValueChange: (value) => handleUpdateCustomStyle('marginTop', value), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntime.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntime.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntime.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntime.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntime.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Margin Right" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.marginRight || '', onValueChange: (value) => handleUpdateCustomStyle('marginRight', value), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntime.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntime.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntime.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntime.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntime.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Margin Bottom" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.marginBottom || '', onValueChange: (value) => handleUpdateCustomStyle('marginBottom', value), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntime.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntime.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntime.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntime.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntime.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Margin Left" }), jsxRuntime.jsxs(Select, { value: field.customStyle?.marginLeft || '', onValueChange: (value) => handleUpdateCustomStyle('marginLeft', value), children: [jsxRuntime.jsx(SelectTrigger, { children: jsxRuntime.jsx(SelectValue, { placeholder: "Select" }) }), jsxRuntime.jsxs(SelectContent, { children: [jsxRuntime.jsx(SelectItem, { value: "0", children: "0" }), jsxRuntime.jsx(SelectItem, { value: "4px", children: "4px" }), jsxRuntime.jsx(SelectItem, { value: "8px", children: "8px" }), jsxRuntime.jsx(SelectItem, { value: "16px", children: "16px" }), jsxRuntime.jsx(SelectItem, { value: "24px", children: "24px" }), jsxRuntime.jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Color" }), jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx(Input, { type: "color", value: field.customStyle?.color || '#000000', onChange: (e) => handleUpdateCustomStyle('color', e.target.value), className: "w-10 h-9 p-1" }), jsxRuntime.jsx(Input, { value: field.customStyle?.color || '', onChange: (e) => handleUpdateCustomStyle('color', e.target.value), placeholder: "#000000", className: "flex-1 font-mono text-xs" }), field.customStyle?.color && (jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('color', ''), children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }))] })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx(Label, { className: "text-xs", children: "Background Color" }), jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx(Input, { type: "color", value: field.customStyle?.backgroundColor || '#ffffff', onChange: (e) => handleUpdateCustomStyle('backgroundColor', e.target.value), className: "w-10 h-9 p-1" }), jsxRuntime.jsx(Input, { value: field.customStyle?.backgroundColor || '', onChange: (e) => handleUpdateCustomStyle('backgroundColor', e.target.value), placeholder: "#ffffff", className: "flex-1 font-mono text-xs" }), field.customStyle?.backgroundColor && (jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('backgroundColor', ''), children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }))] })] })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h4", { className: "text-sm font-semibold", children: "Styles for className" }), jsxRuntime.jsxs(Tabs, { defaultValue: "component", className: "w-full", children: [jsxRuntime.jsxs(TabsList, { className: "w-full grid grid-cols-2", children: [jsxRuntime.jsx(TabsTrigger, { value: "component", className: "text-xs", children: "Component" }), jsxRuntime.jsx(TabsTrigger, { value: "wrapper", className: "text-xs", children: "Wrapper" })] }), jsxRuntime.jsx(TabsContent, { value: "component", className: "mt-3", children: jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(Label, { className: "text-xs text-primary", children: ["element.style ", '{'] }), jsxRuntime.jsx(Textarea, { value: field.customStyle?.css || '', onChange: (e) => handleUpdateCustomStyle('css', e.target.value), placeholder: "color: #333;\nfont-size: 14px;", className: "font-mono text-xs min-h-[100px] bg-muted/30" }), jsxRuntime.jsx(Label, { className: "text-xs text-primary", children: '}' })] }) }), jsxRuntime.jsx(TabsContent, { value: "wrapper", className: "mt-3", children: jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(Label, { className: "text-xs text-primary", children: ["wrapper.style ", '{'] }), jsxRuntime.jsx(Textarea, { value: field.customStyle?.wrapperCss || '', onChange: (e) => handleUpdateCustomStyle('wrapperCss', e.target.value), placeholder: "padding: 8px;\nborder-radius: 4px;", className: "font-mono text-xs min-h-[100px] bg-muted/30" }), jsxRuntime.jsx(Label, { className: "text-xs text-primary", children: '}' })] }) })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Collapsible, { children: [jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full py-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(lucideReact.Globe, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Responsive Grid" })] }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxRuntime.jsxs(CollapsibleContent, { className: "space-y-4 pt-2", children: [jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Override column width for different screen sizes (1-12 grid)" }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "w-16", children: "Mobile" }), jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "(<640px)" })] }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.mobile ?? '', onChange: (e) => {
|
|
3775
2413
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3776
2414
|
updateField(row.id, column.id, field.id, {
|
|
3777
2415
|
responsiveWidth: { ...field.responsiveWidth, mobile: val },
|
|
3778
2416
|
});
|
|
3779
|
-
}, placeholder: "Auto" })] }),
|
|
2417
|
+
}, placeholder: "Auto" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "w-16", children: "Tablet" }), jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "(640-1024px)" })] }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.tablet ?? '', onChange: (e) => {
|
|
3780
2418
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3781
2419
|
updateField(row.id, column.id, field.id, {
|
|
3782
2420
|
responsiveWidth: { ...field.responsiveWidth, tablet: val },
|
|
3783
2421
|
});
|
|
3784
|
-
}, placeholder: "Auto" })] }),
|
|
2422
|
+
}, placeholder: "Auto" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "w-16", children: "Desktop" }), jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "(>1024px)" })] }), jsxRuntime.jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.desktop ?? '', onChange: (e) => {
|
|
3785
2423
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3786
2424
|
updateField(row.id, column.id, field.id, {
|
|
3787
2425
|
responsiveWidth: { ...field.responsiveWidth, desktop: val },
|
|
3788
2426
|
});
|
|
3789
|
-
}, placeholder: "Auto" })] })] })] }),
|
|
2427
|
+
}, placeholder: "Auto" })] })] })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [jsxRuntime.jsx(lucideReact.Globe, { className: "h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Localization" })] }), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Configure translations for this field in different languages. Translations can be managed at the form level in Form Settings." })] })] }) }));
|
|
3790
2428
|
}
|
|
3791
2429
|
function StepProperties() {
|
|
3792
2430
|
const { getSelectedStep, updateStep, deleteStep, form } = useFormStore();
|
|
3793
2431
|
const step = getSelectedStep();
|
|
3794
2432
|
if (!step)
|
|
3795
2433
|
return null;
|
|
3796
|
-
return (
|
|
2434
|
+
return (jsxRuntime.jsx("div", { className: "p-4 space-y-6", children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Step Properties" }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Title" }), jsxRuntime.jsx(Input, { value: step.title, onChange: (e) => updateStep(step.id, { title: e.target.value }) })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Description" }), jsxRuntime.jsx(Textarea, { value: step.description || '', onChange: (e) => updateStep(step.id, { description: e.target.value }), placeholder: "Optional step description..." })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Validate on Next" }), jsxRuntime.jsx(Switch, { checked: step.validation?.validateOnNext || false, onCheckedChange: (checked) => updateStep(step.id, {
|
|
3797
2435
|
validation: { ...step.validation, validateOnNext: checked }
|
|
3798
|
-
}) })] }),
|
|
2436
|
+
}) })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { className: "text-sm", children: "Allow Skip" }), jsxRuntime.jsx(Switch, { checked: step.validation?.allowSkip || false, onCheckedChange: (checked) => updateStep(step.id, {
|
|
3799
2437
|
validation: { ...step.validation, allowSkip: checked }
|
|
3800
|
-
}) })] }),
|
|
2438
|
+
}) })] }), jsxRuntime.jsx(Separator, {}), jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: () => deleteStep(step.id), className: "w-full gap-2 text-destructive hover:text-destructive", disabled: (form.steps?.length || 0) <= 1, children: [jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }), "Delete Step"] })] })] }) }));
|
|
3801
2439
|
}
|
|
3802
2440
|
function PropertiesPanel() {
|
|
3803
2441
|
const { selection } = useFormStore();
|
|
3804
|
-
return (
|
|
2442
|
+
return (jsxRuntime.jsx("aside", { className: "w-[320px] border-l border-border bg-card shrink-0", children: jsxRuntime.jsxs(ScrollArea, { className: "h-full", children: [selection.type === null && (jsxRuntime.jsx("div", { className: "p-4 text-center text-muted-foreground", children: jsxRuntime.jsx("p", { className: "text-sm", children: "Select an element to edit its properties" }) })), selection.type === 'row' && jsxRuntime.jsx(RowProperties, {}), selection.type === 'column' && jsxRuntime.jsx(ColumnProperties, {}), selection.type === 'field' && jsxRuntime.jsx(FieldProperties, {}), selection.type === 'step' && jsxRuntime.jsx(StepProperties, {})] }) }));
|
|
3805
2443
|
}
|
|
3806
2444
|
|
|
3807
2445
|
const conditionOperatorSchema = zod.z.enum([
|
|
@@ -4175,11 +2813,11 @@ const SUPPORTED_LANGUAGES = [
|
|
|
4175
2813
|
];
|
|
4176
2814
|
|
|
4177
2815
|
const Accordion = AccordionPrimitive__namespace.Root;
|
|
4178
|
-
const AccordionItem = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
2816
|
+
const AccordionItem = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(AccordionPrimitive__namespace.Item, { ref: ref, className: cn("border-b", className), ...props })));
|
|
4179
2817
|
AccordionItem.displayName = "AccordionItem";
|
|
4180
|
-
const AccordionTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
2818
|
+
const AccordionTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { className: "flex", children: jsxRuntime.jsxs(AccordionPrimitive__namespace.Trigger, { ref: ref, className: cn("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180", className), ...props, children: [children, jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200" })] }) })));
|
|
4181
2819
|
AccordionTrigger.displayName = AccordionPrimitive__namespace.Trigger.displayName;
|
|
4182
|
-
const AccordionContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
2820
|
+
const AccordionContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsx(AccordionPrimitive__namespace.Content, { ref: ref, className: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", ...props, children: jsxRuntime.jsx("div", { className: cn("pb-4 pt-0", className), children: children }) })));
|
|
4183
2821
|
AccordionContent.displayName = AccordionPrimitive__namespace.Content.displayName;
|
|
4184
2822
|
|
|
4185
2823
|
const iconMap$1 = {
|
|
@@ -4234,17 +2872,17 @@ function DraggableComponent({ type, label, icon, isCollapsed }) {
|
|
|
4234
2872
|
});
|
|
4235
2873
|
const IconComponent = iconMap$1[icon] || lucideReact.Type;
|
|
4236
2874
|
if (isCollapsed) {
|
|
4237
|
-
return (
|
|
2875
|
+
return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("div", { ref: setNodeRef, ...listeners, ...attributes, className: `
|
|
4238
2876
|
flex items-center justify-center p-2 rounded-md border border-border
|
|
4239
2877
|
bg-card cursor-grab hover-elevate active-elevate-2 transition-all duration-150
|
|
4240
2878
|
${isDragging ? 'opacity-50' : 'opacity-100'}
|
|
4241
|
-
`, "data-testid": `draggable-${type}`, children:
|
|
2879
|
+
`, "data-testid": `draggable-${type}`, children: jsxRuntime.jsx(IconComponent, { className: "h-4 w-4 text-muted-foreground" }) }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: jsxRuntime.jsx("p", { children: label }) })] }));
|
|
4242
2880
|
}
|
|
4243
|
-
return (
|
|
2881
|
+
return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsxs("div", { ref: setNodeRef, ...listeners, ...attributes, className: `
|
|
4244
2882
|
flex items-center gap-2 px-2 py-2 rounded-md border border-border
|
|
4245
2883
|
bg-card cursor-grab hover-elevate active-elevate-2 transition-all duration-150
|
|
4246
2884
|
${isDragging ? 'opacity-50' : 'opacity-100'}
|
|
4247
|
-
`, "data-testid": `draggable-${type}`, children: [
|
|
2885
|
+
`, "data-testid": `draggable-${type}`, children: [jsxRuntime.jsx(IconComponent, { className: "h-4 w-4 text-muted-foreground shrink-0" }), jsxRuntime.jsx("span", { className: "text-xs text-foreground truncate leading-tight", children: label })] }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: jsxRuntime.jsx("p", { children: label }) })] }));
|
|
4248
2886
|
}
|
|
4249
2887
|
const fieldCategories = {
|
|
4250
2888
|
basic: { label: 'Basic Fields', types: FIELD_TYPES.filter(f => f.category === 'basic') },
|
|
@@ -4253,9 +2891,9 @@ const fieldCategories = {
|
|
|
4253
2891
|
};
|
|
4254
2892
|
function ComponentLibrary({ isCollapsed = false, onToggleCollapse }) {
|
|
4255
2893
|
if (isCollapsed) {
|
|
4256
|
-
return (
|
|
2894
|
+
return (jsxRuntime.jsxs("aside", { className: "w-[60px] border-r border-border bg-card shrink-0 flex flex-col", children: [jsxRuntime.jsx("div", { className: "p-2 border-b border-border", children: jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: onToggleCollapse, "data-testid": "button-expand-sidebar", children: jsxRuntime.jsx(lucideReact.PanelLeft, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(ScrollArea, { className: "flex-1", children: jsxRuntime.jsxs("div", { className: "p-2 space-y-4", children: [jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "LY" }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: "Layout" })] }), jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-1", children: STRUCTURE_TYPES.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "BF" }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: "Basic Fields" })] }), jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.basic.types.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "SF" }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: "Selection Fields" })] }), jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.selection.types.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "AD" }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: "Advanced Fields" })] }), jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.advanced.types.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "EL" }) }), jsxRuntime.jsx(TooltipContent, { side: "right", children: "Static Elements" })] }), jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-1", children: STATIC_TYPES.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] })] }) })] }));
|
|
4257
2895
|
}
|
|
4258
|
-
return (
|
|
2896
|
+
return (jsxRuntime.jsxs("aside", { className: "w-[200px] border-r border-border bg-card shrink-0 flex flex-col", children: [jsxRuntime.jsxs("div", { className: "p-2 border-b border-border flex items-center justify-between gap-2", children: [jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground pl-1", children: "Components" }), jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 shrink-0", onClick: onToggleCollapse, "data-testid": "button-collapse-sidebar", children: jsxRuntime.jsx(lucideReact.PanelLeftClose, { className: "h-3.5 w-3.5" }) })] }), jsxRuntime.jsx(ScrollArea, { className: "flex-1", children: jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.jsxs(Accordion, { type: "multiple", defaultValue: ['structure', 'basic', 'selection', 'advanced', 'static'], className: "w-full", children: [jsxRuntime.jsxs(AccordionItem, { value: "structure", className: "border-b-0 bg-muted/50 rounded-md mb-1 px-2", children: [jsxRuntime.jsxs(AccordionTrigger, { className: "py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline", children: ["Layout (", STRUCTURE_TYPES.length, ")"] }), jsxRuntime.jsx(AccordionContent, { children: jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: STRUCTURE_TYPES.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] }), Object.entries(fieldCategories).map(([key, category]) => (jsxRuntime.jsxs(AccordionItem, { value: key, className: "border-b-0 bg-background dark:bg-card rounded-md mb-1 px-2", children: [jsxRuntime.jsxs(AccordionTrigger, { className: "py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline", children: [category.label.split(' ')[0], " (", category.types.length, ")"] }), jsxRuntime.jsx(AccordionContent, { children: jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: category.types.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] }, key))), jsxRuntime.jsxs(AccordionItem, { value: "static", className: "border-b-0 bg-background dark:bg-card rounded-md mb-1 px-2", children: [jsxRuntime.jsxs(AccordionTrigger, { className: "py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline", children: ["Attributes (", STATIC_TYPES.length, ")"] }), jsxRuntime.jsx(AccordionContent, { children: jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: STATIC_TYPES.map((item) => (jsxRuntime.jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] })] }) }) })] }));
|
|
4259
2897
|
}
|
|
4260
2898
|
|
|
4261
2899
|
const TOAST_LIMIT = 1;
|
|
@@ -6183,39 +4821,39 @@ new QueryClient({
|
|
|
6183
4821
|
const Dialog = DialogPrimitive__namespace.Root;
|
|
6184
4822
|
const DialogTrigger = DialogPrimitive__namespace.Trigger;
|
|
6185
4823
|
const DialogPortal = DialogPrimitive__namespace.Portal;
|
|
6186
|
-
const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
4824
|
+
const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
|
|
6187
4825
|
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
6188
|
-
const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
4826
|
+
const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, { ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className), ...props, children: [children, jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
|
|
6189
4827
|
DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
|
|
6190
|
-
const DialogHeader = ({ className, ...props }) => (
|
|
4828
|
+
const DialogHeader = ({ className, ...props }) => (jsxRuntime.jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
|
|
6191
4829
|
DialogHeader.displayName = "DialogHeader";
|
|
6192
|
-
const DialogFooter = ({ className, ...props }) => (
|
|
4830
|
+
const DialogFooter = ({ className, ...props }) => (jsxRuntime.jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
|
|
6193
4831
|
DialogFooter.displayName = "DialogFooter";
|
|
6194
|
-
const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
4832
|
+
const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Title, { ref: ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props })));
|
|
6195
4833
|
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
6196
|
-
const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
4834
|
+
const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref: ref, className: cn("text-sm text-muted-foreground", className), ...props })));
|
|
6197
4835
|
DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
|
|
6198
4836
|
|
|
6199
4837
|
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
6200
4838
|
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
6201
|
-
const DropdownMenuSubTrigger = React__namespace.forwardRef(({ className, inset, children, ...props }, ref) => (
|
|
4839
|
+
const DropdownMenuSubTrigger = React__namespace.forwardRef(({ className, inset, children, ...props }, ref) => (jsxRuntime.jsxs(DropdownMenuPrimitive__namespace.SubTrigger, { ref: ref, className: cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className), ...props, children: [children, jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ml-auto" })] })));
|
|
6202
4840
|
DropdownMenuSubTrigger.displayName =
|
|
6203
4841
|
DropdownMenuPrimitive__namespace.SubTrigger.displayName;
|
|
6204
|
-
const DropdownMenuSubContent = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
4842
|
+
const DropdownMenuSubContent = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.SubContent, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-dropdown-menu-content-transform-origin]", className), ...props })));
|
|
6205
4843
|
DropdownMenuSubContent.displayName =
|
|
6206
4844
|
DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
6207
|
-
const DropdownMenuContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
|
|
4845
|
+
const DropdownMenuContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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 origin-[--radix-dropdown-menu-content-transform-origin]", className), ...props }) })));
|
|
6208
4846
|
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
6209
|
-
const DropdownMenuItem = React__namespace.forwardRef(({ className, inset, ...props }, ref) => (
|
|
4847
|
+
const DropdownMenuItem = React__namespace.forwardRef(({ className, inset, ...props }, ref) => (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className), ...props })));
|
|
6210
4848
|
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
6211
|
-
const DropdownMenuCheckboxItem = React__namespace.forwardRef(({ className, children, checked, ...props }, ref) => (
|
|
4849
|
+
const DropdownMenuCheckboxItem = React__namespace.forwardRef(({ className, children, checked, ...props }, ref) => (jsxRuntime.jsxs(DropdownMenuPrimitive__namespace.CheckboxItem, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), checked: checked, ...props, children: [jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }), children] })));
|
|
6212
4850
|
DropdownMenuCheckboxItem.displayName =
|
|
6213
4851
|
DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
|
|
6214
|
-
const DropdownMenuRadioItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => (
|
|
4852
|
+
const DropdownMenuRadioItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(DropdownMenuPrimitive__namespace.RadioItem, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: jsxRuntime.jsx(lucideReact.Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
6215
4853
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
|
|
6216
|
-
const DropdownMenuLabel = React__namespace.forwardRef(({ className, inset, ...props }, ref) => (
|
|
4854
|
+
const DropdownMenuLabel = React__namespace.forwardRef(({ className, inset, ...props }, ref) => (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className), ...props })));
|
|
6217
4855
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
6218
|
-
const DropdownMenuSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => (
|
|
4856
|
+
const DropdownMenuSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
|
|
6219
4857
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
|
|
6220
4858
|
|
|
6221
4859
|
function Toolbar({ onOpenJsonViewer }) {
|
|
@@ -6325,10 +4963,10 @@ function Toolbar({ onOpenJsonViewer }) {
|
|
|
6325
4963
|
setIsEditing(false);
|
|
6326
4964
|
}
|
|
6327
4965
|
};
|
|
6328
|
-
return (
|
|
4966
|
+
return (jsxRuntime.jsxs("header", { className: "h-14 border-b border-border bg-card px-6 flex items-center justify-between gap-4 shrink-0", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: isEditing ? (jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(Input, { value: tempName, onChange: (e) => setTempName(e.target.value), onKeyDown: handleKeyDown, onBlur: handleSaveName, className: "h-8 w-64 text-sm font-medium", autoFocus: true, "data-testid": "input-form-name" }), jsxRuntime.jsx(Button, { size: "icon", variant: "ghost", onClick: handleSaveName, "data-testid": "button-save-name", children: jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) })] })) : (jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("h1", { className: "text-lg font-semibold text-foreground", children: form.name }), jsxRuntime.jsx(Button, { size: "icon", variant: "ghost", onClick: () => {
|
|
6329
4967
|
setTempName(form.name);
|
|
6330
4968
|
setIsEditing(true);
|
|
6331
|
-
}, "data-testid": "button-edit-name", children: jsxRuntimeExports.jsx(lucideReact.Edit3, { className: "h-4 w-4" }) }), form.isMultiStep && (jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-xs", children: "Multi-Step" })), form.currentVersion && (jsxRuntimeExports.jsxs(Badge, { variant: "outline", className: "text-xs", children: ["v", form.currentVersion] }))] })) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: undo, disabled: !canUndo(), "data-testid": "button-undo", children: jsxRuntimeExports.jsx(lucideReact.Undo2, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: "Undo" })] }), jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: redo, disabled: !canRedo(), "data-testid": "button-redo", children: jsxRuntimeExports.jsx(lucideReact.Redo2, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: "Redo" })] }), jsxRuntimeExports.jsxs(DropdownMenu, { children: [jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", "data-testid": "button-canvas-width", children: jsxRuntimeExports.jsx(lucideReact.Maximize2, { className: "h-4 w-4" }) }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: "Canvas Width" })] }), jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "end", children: [jsxRuntimeExports.jsx(DropdownMenuLabel, { children: "Canvas Width" }), jsxRuntimeExports.jsx(DropdownMenuSeparator, {}), widthOptions.map((option) => (jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: () => setCanvasWidth(option.value), className: "flex justify-between gap-4", "data-testid": `menu-width-${option.value}`, children: [jsxRuntimeExports.jsx("span", { children: option.label }), jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs", children: option.description }), canvasWidth === option.value && jsxRuntimeExports.jsx(lucideReact.Check, { className: "h-4 w-4 ml-2" })] }, option.value)))] })] }), jsxRuntimeExports.jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxRuntimeExports.jsxs(Button, { variant: "default", size: "sm", onClick: handleSaveForm, disabled: isSaving, className: "gap-2", "data-testid": "button-save-form", children: [isSaving ? (jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" })) : (jsxRuntimeExports.jsx(lucideReact.Save, { className: "h-4 w-4" })), jsxRuntimeExports.jsx("span", { children: "Save" })] }), jsxRuntimeExports.jsx(Button, { variant: isPreviewMode ? 'default' : 'outline', size: "sm", onClick: togglePreviewMode, className: "gap-2", "data-testid": "button-toggle-preview", children: isPreviewMode ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(lucideReact.EyeOff, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("span", { children: "Edit" })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(lucideReact.Eye, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("span", { children: "Preview" })] })) }), jsxRuntimeExports.jsx(Button, { variant: form.isMultiStep ? 'default' : 'outline', size: "sm", onClick: toggleMultiStep, className: "gap-2", title: form.isMultiStep ? 'Switch to single page' : 'Switch to multi-step wizard', "data-testid": "button-toggle-multistep", children: jsxRuntimeExports.jsx(lucideReact.Layers, { className: "h-4 w-4" }) }), jsxRuntimeExports.jsxs(Dialog, { open: versionDialogOpen, onOpenChange: setVersionDialogOpen, children: [jsxRuntimeExports.jsx(DialogTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-version", children: jsxRuntimeExports.jsx(lucideReact.History, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsxs(DialogContent, { className: "max-w-md", children: [jsxRuntimeExports.jsxs(DialogHeader, { children: [jsxRuntimeExports.jsx(DialogTitle, { children: "Version History" }), jsxRuntimeExports.jsx(DialogDescription, { children: "Save snapshots and restore previous versions of your form." })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { children: "Save New Version" }), jsxRuntimeExports.jsx(Textarea, { value: changelog, onChange: (e) => setChangelog(e.target.value), placeholder: "What changed in this version?", className: "min-h-[60px]" }), jsxRuntimeExports.jsxs(Button, { onClick: handleSaveVersion, className: "w-full gap-2", size: "sm", children: [jsxRuntimeExports.jsx(lucideReact.Save, { className: "h-4 w-4" }), "Save Version ", (form.currentVersion || 0) + 1] })] }), form.versions && form.versions.length > 0 && (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs("div", { className: "border-t pt-4", children: [jsxRuntimeExports.jsx(Label, { className: "mb-2 block", children: "Previous Versions" }), jsxRuntimeExports.jsx(ScrollArea, { className: "h-[200px]", children: jsxRuntimeExports.jsx("div", { className: "space-y-2", children: [...form.versions].reverse().map((version) => (jsxRuntimeExports.jsxs("div", { className: "p-3 border rounded-md space-y-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsxs("span", { className: "font-medium", children: ["Version ", version.version] }), jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", onClick: () => handleRestoreVersion(version.id, version.version), children: "Restore" })] }), version.changelog && (jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: version.changelog })), jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: new Date(version.createdAt).toLocaleString() })] }, version.id))) }) })] }) }))] })] })] }), jsxRuntimeExports.jsxs(Dialog, { open: settingsDialogOpen, onOpenChange: setSettingsDialogOpen, children: [jsxRuntimeExports.jsx(DialogTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-settings", children: jsxRuntimeExports.jsx(lucideReact.Settings, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsxs(DialogContent, { className: "max-w-lg", children: [jsxRuntimeExports.jsxs(DialogHeader, { children: [jsxRuntimeExports.jsx(DialogTitle, { children: "Form Settings" }), jsxRuntimeExports.jsx(DialogDescription, { children: "Configure submission, webhooks, and other form settings." })] }), jsxRuntimeExports.jsx("div", { className: "space-y-6", children: jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx("h4", { className: "font-medium", children: "Submission Settings" }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntimeExports.jsx(Label, { children: "Enable Submission Handler" }), jsxRuntimeExports.jsx(Switch, { checked: form.submissionConfig?.enabled || false, onCheckedChange: (checked) => updateSubmissionConfig({ enabled: checked }) })] }), form.submissionConfig?.enabled && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { children: "Webhook URL" }), jsxRuntimeExports.jsx(Input, { value: form.submissionConfig?.webhookUrl || '', onChange: (e) => updateSubmissionConfig({ webhookUrl: e.target.value }), placeholder: "https://your-api.com/webhook" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { children: "Success Message" }), jsxRuntimeExports.jsx(Input, { value: form.submissionConfig?.successMessage || '', onChange: (e) => updateSubmissionConfig({ successMessage: e.target.value }), placeholder: "Thank you for your submission!" })] }), jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [jsxRuntimeExports.jsx(Label, { children: "Redirect URL (optional)" }), jsxRuntimeExports.jsx(Input, { value: form.submissionConfig?.redirectUrl || '', onChange: (e) => updateSubmissionConfig({ redirectUrl: e.target.value }), placeholder: "https://your-site.com/thank-you" })] })] }))] }) }), jsxRuntimeExports.jsx(DialogFooter, { children: jsxRuntimeExports.jsx(Button, { onClick: () => setSettingsDialogOpen(false), children: "Done" }) })] })] }), jsxRuntimeExports.jsxs(DropdownMenu, { children: [jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-more", children: jsxRuntimeExports.jsx(lucideReact.FileJson, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "end", children: [jsxRuntimeExports.jsx(DropdownMenuLabel, { children: "Export / Import" }), jsxRuntimeExports.jsx(DropdownMenuSeparator, {}), jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: onOpenJsonViewer, children: [jsxRuntimeExports.jsx(lucideReact.FileJson, { className: "h-4 w-4 mr-2" }), "View JSON Schema"] }), jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleExportJson, children: [jsxRuntimeExports.jsx(lucideReact.Download, { className: "h-4 w-4 mr-2" }), "Download JSON"] }), jsxRuntimeExports.jsx(DropdownMenuItem, { asChild: true, children: jsxRuntimeExports.jsxs("label", { className: "cursor-pointer flex items-center", children: [jsxRuntimeExports.jsx(lucideReact.Upload, { className: "h-4 w-4 mr-2" }), "Import JSON", jsxRuntimeExports.jsx("input", { type: "file", accept: ".json", onChange: handleImportJson, className: "hidden" })] }) })] })] }), jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", onClick: clearForm, className: "gap-2 text-destructive hover:text-destructive", "data-testid": "button-clear-form", children: jsxRuntimeExports.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }), jsxRuntimeExports.jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", onClick: toggleTheme, "data-testid": "button-toggle-theme", children: isDarkMode ? jsxRuntimeExports.jsx(lucideReact.Sun, { className: "h-4 w-4" }) : jsxRuntimeExports.jsx(lucideReact.Moon, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: isDarkMode ? 'Light Mode' : 'Dark Mode' })] })] })] }));
|
|
4969
|
+
}, "data-testid": "button-edit-name", children: jsxRuntime.jsx(lucideReact.Edit3, { className: "h-4 w-4" }) }), form.isMultiStep && (jsxRuntime.jsx(Badge, { variant: "secondary", className: "text-xs", children: "Multi-Step" })), form.currentVersion && (jsxRuntime.jsxs(Badge, { variant: "outline", className: "text-xs", children: ["v", form.currentVersion] }))] })) }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: undo, disabled: !canUndo(), "data-testid": "button-undo", children: jsxRuntime.jsx(lucideReact.Undo2, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(TooltipContent, { children: "Undo" })] }), jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: redo, disabled: !canRedo(), "data-testid": "button-redo", children: jsxRuntime.jsx(lucideReact.Redo2, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(TooltipContent, { children: "Redo" })] }), jsxRuntime.jsxs(DropdownMenu, { children: [jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", "data-testid": "button-canvas-width", children: jsxRuntime.jsx(lucideReact.Maximize2, { className: "h-4 w-4" }) }) }) }), jsxRuntime.jsx(TooltipContent, { children: "Canvas Width" })] }), jsxRuntime.jsxs(DropdownMenuContent, { align: "end", children: [jsxRuntime.jsx(DropdownMenuLabel, { children: "Canvas Width" }), jsxRuntime.jsx(DropdownMenuSeparator, {}), widthOptions.map((option) => (jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => setCanvasWidth(option.value), className: "flex justify-between gap-4", "data-testid": `menu-width-${option.value}`, children: [jsxRuntime.jsx("span", { children: option.label }), jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: option.description }), canvasWidth === option.value && jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4 ml-2" })] }, option.value)))] })] }), jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxRuntime.jsxs(Button, { variant: "default", size: "sm", onClick: handleSaveForm, disabled: isSaving, className: "gap-2", "data-testid": "button-save-form", children: [isSaving ? (jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" })) : (jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4" })), jsxRuntime.jsx("span", { children: "Save" })] }), jsxRuntime.jsx(Button, { variant: isPreviewMode ? 'default' : 'outline', size: "sm", onClick: togglePreviewMode, className: "gap-2", "data-testid": "button-toggle-preview", children: isPreviewMode ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(lucideReact.EyeOff, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { children: "Edit" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { children: "Preview" })] })) }), jsxRuntime.jsx(Button, { variant: form.isMultiStep ? 'default' : 'outline', size: "sm", onClick: toggleMultiStep, className: "gap-2", title: form.isMultiStep ? 'Switch to single page' : 'Switch to multi-step wizard', "data-testid": "button-toggle-multistep", children: jsxRuntime.jsx(lucideReact.Layers, { className: "h-4 w-4" }) }), jsxRuntime.jsxs(Dialog, { open: versionDialogOpen, onOpenChange: setVersionDialogOpen, children: [jsxRuntime.jsx(DialogTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-version", children: jsxRuntime.jsx(lucideReact.History, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(DialogContent, { className: "max-w-md", children: [jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsx(DialogTitle, { children: "Version History" }), jsxRuntime.jsx(DialogDescription, { children: "Save snapshots and restore previous versions of your form." })] }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { children: "Save New Version" }), jsxRuntime.jsx(Textarea, { value: changelog, onChange: (e) => setChangelog(e.target.value), placeholder: "What changed in this version?", className: "min-h-[60px]" }), jsxRuntime.jsxs(Button, { onClick: handleSaveVersion, className: "w-full gap-2", size: "sm", children: [jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4" }), "Save Version ", (form.currentVersion || 0) + 1] })] }), form.versions && form.versions.length > 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "border-t pt-4", children: [jsxRuntime.jsx(Label, { className: "mb-2 block", children: "Previous Versions" }), jsxRuntime.jsx(ScrollArea, { className: "h-[200px]", children: jsxRuntime.jsx("div", { className: "space-y-2", children: [...form.versions].reverse().map((version) => (jsxRuntime.jsxs("div", { className: "p-3 border rounded-md space-y-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs("span", { className: "font-medium", children: ["Version ", version.version] }), jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: () => handleRestoreVersion(version.id, version.version), children: "Restore" })] }), version.changelog && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: version.changelog })), jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: new Date(version.createdAt).toLocaleString() })] }, version.id))) }) })] }) }))] })] })] }), jsxRuntime.jsxs(Dialog, { open: settingsDialogOpen, onOpenChange: setSettingsDialogOpen, children: [jsxRuntime.jsx(DialogTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-settings", children: jsxRuntime.jsx(lucideReact.Settings, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(DialogContent, { className: "max-w-lg", children: [jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsx(DialogTitle, { children: "Form Settings" }), jsxRuntime.jsx(DialogDescription, { children: "Configure submission, webhooks, and other form settings." })] }), jsxRuntime.jsx("div", { className: "space-y-6", children: jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h4", { className: "font-medium", children: "Submission Settings" }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Label, { children: "Enable Submission Handler" }), jsxRuntime.jsx(Switch, { checked: form.submissionConfig?.enabled || false, onCheckedChange: (checked) => updateSubmissionConfig({ enabled: checked }) })] }), form.submissionConfig?.enabled && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { children: "Webhook URL" }), jsxRuntime.jsx(Input, { value: form.submissionConfig?.webhookUrl || '', onChange: (e) => updateSubmissionConfig({ webhookUrl: e.target.value }), placeholder: "https://your-api.com/webhook" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { children: "Success Message" }), jsxRuntime.jsx(Input, { value: form.submissionConfig?.successMessage || '', onChange: (e) => updateSubmissionConfig({ successMessage: e.target.value }), placeholder: "Thank you for your submission!" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label, { children: "Redirect URL (optional)" }), jsxRuntime.jsx(Input, { value: form.submissionConfig?.redirectUrl || '', onChange: (e) => updateSubmissionConfig({ redirectUrl: e.target.value }), placeholder: "https://your-site.com/thank-you" })] })] }))] }) }), jsxRuntime.jsx(DialogFooter, { children: jsxRuntime.jsx(Button, { onClick: () => setSettingsDialogOpen(false), children: "Done" }) })] })] }), jsxRuntime.jsxs(DropdownMenu, { children: [jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-more", children: jsxRuntime.jsx(lucideReact.FileJson, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(DropdownMenuContent, { align: "end", children: [jsxRuntime.jsx(DropdownMenuLabel, { children: "Export / Import" }), jsxRuntime.jsx(DropdownMenuSeparator, {}), jsxRuntime.jsxs(DropdownMenuItem, { onClick: onOpenJsonViewer, children: [jsxRuntime.jsx(lucideReact.FileJson, { className: "h-4 w-4 mr-2" }), "View JSON Schema"] }), jsxRuntime.jsxs(DropdownMenuItem, { onClick: handleExportJson, children: [jsxRuntime.jsx(lucideReact.Download, { className: "h-4 w-4 mr-2" }), "Download JSON"] }), jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: jsxRuntime.jsxs("label", { className: "cursor-pointer flex items-center", children: [jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4 mr-2" }), "Import JSON", jsxRuntime.jsx("input", { type: "file", accept: ".json", onChange: handleImportJson, className: "hidden" })] }) })] })] }), jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: clearForm, className: "gap-2 text-destructive hover:text-destructive", "data-testid": "button-clear-form", children: jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) }), jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: toggleTheme, "data-testid": "button-toggle-theme", children: isDarkMode ? jsxRuntime.jsx(lucideReact.Sun, { className: "h-4 w-4" }) : jsxRuntime.jsx(lucideReact.Moon, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(TooltipContent, { children: isDarkMode ? 'Light Mode' : 'Dark Mode' })] })] })] }));
|
|
6332
4970
|
}
|
|
6333
4971
|
|
|
6334
4972
|
const iconMap = {
|
|
@@ -6382,7 +5020,7 @@ const labelMap = {
|
|
|
6382
5020
|
function DragOverlayContent({ type }) {
|
|
6383
5021
|
const IconComponent = iconMap[type] || lucideReact.Type;
|
|
6384
5022
|
const label = labelMap[type] || type;
|
|
6385
|
-
return (
|
|
5023
|
+
return (jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-4 py-3 rounded-md border border-primary bg-card shadow-xl cursor-grabbing", children: [jsxRuntime.jsx(IconComponent, { className: "h-4 w-4 text-primary" }), jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: label })] }));
|
|
6386
5024
|
}
|
|
6387
5025
|
|
|
6388
5026
|
function JsonViewerModal({ isOpen, onClose, schema }) {
|
|
@@ -6393,7 +5031,7 @@ function JsonViewerModal({ isOpen, onClose, schema }) {
|
|
|
6393
5031
|
setCopied(true);
|
|
6394
5032
|
setTimeout(() => setCopied(false), 2000);
|
|
6395
5033
|
};
|
|
6396
|
-
return (
|
|
5034
|
+
return (jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxRuntime.jsxs(DialogContent, { className: "max-w-3xl max-h-[80vh] flex flex-col", children: [jsxRuntime.jsxs(DialogHeader, { className: "flex flex-row items-center justify-between pr-8", children: [jsxRuntime.jsx(DialogTitle, { children: "Form Schema (JSON)" }), jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleCopy, className: "gap-2", "data-testid": "button-copy-json", children: copied ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }), "Copied"] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(lucideReact.Copy, { className: "h-4 w-4" }), "Copy"] })) })] }), jsxRuntime.jsx("div", { className: "flex-1 min-h-0 h-[60vh] border rounded-md bg-muted/30 overflow-auto", children: jsxRuntime.jsx("pre", { className: "p-4 text-sm font-mono text-foreground whitespace-pre", children: jsonString }) })] }) }));
|
|
6397
5035
|
}
|
|
6398
5036
|
|
|
6399
5037
|
exports.CanvasField = CanvasField;
|