@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.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default, { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
2
|
import { useDroppable, useDraggable } from '@dnd-kit/core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
4
5
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
5
6
|
import { clsx } from 'clsx';
|
|
6
7
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -26,1378 +27,15 @@ import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
|
26
27
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
27
28
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
28
29
|
|
|
29
|
-
var jsxRuntime = {exports: {}};
|
|
30
|
-
|
|
31
|
-
var reactJsxRuntime_production_min = {};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-jsx-runtime.production.min.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
44
|
-
|
|
45
|
-
function requireReactJsxRuntime_production_min () {
|
|
46
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
47
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
48
|
-
var f=React__default,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};
|
|
49
|
-
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;
|
|
50
|
-
return reactJsxRuntime_production_min;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var reactJsxRuntime_development = {};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @license React
|
|
57
|
-
* react-jsx-runtime.development.js
|
|
58
|
-
*
|
|
59
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the MIT license found in the
|
|
62
|
-
* LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
var hasRequiredReactJsxRuntime_development;
|
|
66
|
-
|
|
67
|
-
function requireReactJsxRuntime_development () {
|
|
68
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
69
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
70
|
-
|
|
71
|
-
if (process.env.NODE_ENV !== "production") {
|
|
72
|
-
(function() {
|
|
73
|
-
|
|
74
|
-
var React = React__default;
|
|
75
|
-
|
|
76
|
-
// ATTENTION
|
|
77
|
-
// When adding new symbols to this file,
|
|
78
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
79
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
80
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
81
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
82
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
83
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
84
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
85
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
86
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
87
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
88
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
89
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
90
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
91
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
92
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
93
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
94
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
95
|
-
function getIteratorFn(maybeIterable) {
|
|
96
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
101
|
-
|
|
102
|
-
if (typeof maybeIterator === 'function') {
|
|
103
|
-
return maybeIterator;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
110
|
-
|
|
111
|
-
function error(format) {
|
|
112
|
-
{
|
|
113
|
-
{
|
|
114
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
115
|
-
args[_key2 - 1] = arguments[_key2];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
printWarning('error', format, args);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function printWarning(level, format, args) {
|
|
124
|
-
// When changing this logic, you might want to also
|
|
125
|
-
// update consoleWithStackDev.www.js as well.
|
|
126
|
-
{
|
|
127
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
128
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
129
|
-
|
|
130
|
-
if (stack !== '') {
|
|
131
|
-
format += '%s';
|
|
132
|
-
args = args.concat([stack]);
|
|
133
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var argsWithFormat = args.map(function (item) {
|
|
137
|
-
return String(item);
|
|
138
|
-
}); // Careful: RN currently depends on this prefix
|
|
139
|
-
|
|
140
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
141
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
142
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
143
|
-
|
|
144
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// -----------------------------------------------------------------------------
|
|
149
|
-
|
|
150
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
151
|
-
var enableCacheElement = false;
|
|
152
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
153
|
-
|
|
154
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
155
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
156
|
-
// issues in DEV builds.
|
|
157
|
-
|
|
158
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
159
|
-
|
|
160
|
-
var REACT_MODULE_REFERENCE;
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function isValidElementType(type) {
|
|
167
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
168
|
-
return true;
|
|
169
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
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 ) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (typeof type === 'object' && type !== null) {
|
|
177
|
-
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
|
|
178
|
-
// types supported by any Flight configuration anywhere since
|
|
179
|
-
// we don't know which Flight build this will end up being used
|
|
180
|
-
// with.
|
|
181
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
190
|
-
var displayName = outerType.displayName;
|
|
191
|
-
|
|
192
|
-
if (displayName) {
|
|
193
|
-
return displayName;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
197
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
198
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
function getContextName(type) {
|
|
202
|
-
return type.displayName || 'Context';
|
|
203
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
function getComponentNameFromType(type) {
|
|
207
|
-
if (type == null) {
|
|
208
|
-
// Host root, text node or just invalid type.
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
if (typeof type.tag === 'number') {
|
|
214
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (typeof type === 'function') {
|
|
219
|
-
return type.displayName || type.name || null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (typeof type === 'string') {
|
|
223
|
-
return type;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
switch (type) {
|
|
227
|
-
case REACT_FRAGMENT_TYPE:
|
|
228
|
-
return 'Fragment';
|
|
229
|
-
|
|
230
|
-
case REACT_PORTAL_TYPE:
|
|
231
|
-
return 'Portal';
|
|
232
|
-
|
|
233
|
-
case REACT_PROFILER_TYPE:
|
|
234
|
-
return 'Profiler';
|
|
235
|
-
|
|
236
|
-
case REACT_STRICT_MODE_TYPE:
|
|
237
|
-
return 'StrictMode';
|
|
238
|
-
|
|
239
|
-
case REACT_SUSPENSE_TYPE:
|
|
240
|
-
return 'Suspense';
|
|
241
|
-
|
|
242
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
243
|
-
return 'SuspenseList';
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (typeof type === 'object') {
|
|
248
|
-
switch (type.$$typeof) {
|
|
249
|
-
case REACT_CONTEXT_TYPE:
|
|
250
|
-
var context = type;
|
|
251
|
-
return getContextName(context) + '.Consumer';
|
|
252
|
-
|
|
253
|
-
case REACT_PROVIDER_TYPE:
|
|
254
|
-
var provider = type;
|
|
255
|
-
return getContextName(provider._context) + '.Provider';
|
|
256
|
-
|
|
257
|
-
case REACT_FORWARD_REF_TYPE:
|
|
258
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
259
|
-
|
|
260
|
-
case REACT_MEMO_TYPE:
|
|
261
|
-
var outerName = type.displayName || null;
|
|
262
|
-
|
|
263
|
-
if (outerName !== null) {
|
|
264
|
-
return outerName;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
268
|
-
|
|
269
|
-
case REACT_LAZY_TYPE:
|
|
270
|
-
{
|
|
271
|
-
var lazyComponent = type;
|
|
272
|
-
var payload = lazyComponent._payload;
|
|
273
|
-
var init = lazyComponent._init;
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
return getComponentNameFromType(init(payload));
|
|
277
|
-
} catch (x) {
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// eslint-disable-next-line no-fallthrough
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
var assign = Object.assign;
|
|
290
|
-
|
|
291
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
292
|
-
// replaying on render function. This currently only patches the object
|
|
293
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
294
|
-
// We could also eagerly patch the method.
|
|
295
|
-
var disabledDepth = 0;
|
|
296
|
-
var prevLog;
|
|
297
|
-
var prevInfo;
|
|
298
|
-
var prevWarn;
|
|
299
|
-
var prevError;
|
|
300
|
-
var prevGroup;
|
|
301
|
-
var prevGroupCollapsed;
|
|
302
|
-
var prevGroupEnd;
|
|
303
|
-
|
|
304
|
-
function disabledLog() {}
|
|
305
|
-
|
|
306
|
-
disabledLog.__reactDisabledLog = true;
|
|
307
|
-
function disableLogs() {
|
|
308
|
-
{
|
|
309
|
-
if (disabledDepth === 0) {
|
|
310
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
311
|
-
prevLog = console.log;
|
|
312
|
-
prevInfo = console.info;
|
|
313
|
-
prevWarn = console.warn;
|
|
314
|
-
prevError = console.error;
|
|
315
|
-
prevGroup = console.group;
|
|
316
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
317
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
318
|
-
|
|
319
|
-
var props = {
|
|
320
|
-
configurable: true,
|
|
321
|
-
enumerable: true,
|
|
322
|
-
value: disabledLog,
|
|
323
|
-
writable: true
|
|
324
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
325
|
-
|
|
326
|
-
Object.defineProperties(console, {
|
|
327
|
-
info: props,
|
|
328
|
-
log: props,
|
|
329
|
-
warn: props,
|
|
330
|
-
error: props,
|
|
331
|
-
group: props,
|
|
332
|
-
groupCollapsed: props,
|
|
333
|
-
groupEnd: props
|
|
334
|
-
});
|
|
335
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
disabledDepth++;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function reenableLogs() {
|
|
342
|
-
{
|
|
343
|
-
disabledDepth--;
|
|
344
|
-
|
|
345
|
-
if (disabledDepth === 0) {
|
|
346
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
347
|
-
var props = {
|
|
348
|
-
configurable: true,
|
|
349
|
-
enumerable: true,
|
|
350
|
-
writable: true
|
|
351
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
352
|
-
|
|
353
|
-
Object.defineProperties(console, {
|
|
354
|
-
log: assign({}, props, {
|
|
355
|
-
value: prevLog
|
|
356
|
-
}),
|
|
357
|
-
info: assign({}, props, {
|
|
358
|
-
value: prevInfo
|
|
359
|
-
}),
|
|
360
|
-
warn: assign({}, props, {
|
|
361
|
-
value: prevWarn
|
|
362
|
-
}),
|
|
363
|
-
error: assign({}, props, {
|
|
364
|
-
value: prevError
|
|
365
|
-
}),
|
|
366
|
-
group: assign({}, props, {
|
|
367
|
-
value: prevGroup
|
|
368
|
-
}),
|
|
369
|
-
groupCollapsed: assign({}, props, {
|
|
370
|
-
value: prevGroupCollapsed
|
|
371
|
-
}),
|
|
372
|
-
groupEnd: assign({}, props, {
|
|
373
|
-
value: prevGroupEnd
|
|
374
|
-
})
|
|
375
|
-
});
|
|
376
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (disabledDepth < 0) {
|
|
380
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
386
|
-
var prefix;
|
|
387
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
388
|
-
{
|
|
389
|
-
if (prefix === undefined) {
|
|
390
|
-
// Extract the VM specific prefix used by each line.
|
|
391
|
-
try {
|
|
392
|
-
throw Error();
|
|
393
|
-
} catch (x) {
|
|
394
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
395
|
-
prefix = match && match[1] || '';
|
|
396
|
-
}
|
|
397
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return '\n' + prefix + name;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
var reentry = false;
|
|
404
|
-
var componentFrameCache;
|
|
405
|
-
|
|
406
|
-
{
|
|
407
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
408
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
412
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
413
|
-
if ( !fn || reentry) {
|
|
414
|
-
return '';
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
var frame = componentFrameCache.get(fn);
|
|
419
|
-
|
|
420
|
-
if (frame !== undefined) {
|
|
421
|
-
return frame;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
var control;
|
|
426
|
-
reentry = true;
|
|
427
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
428
|
-
|
|
429
|
-
Error.prepareStackTrace = undefined;
|
|
430
|
-
var previousDispatcher;
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
434
|
-
// for warnings.
|
|
435
|
-
|
|
436
|
-
ReactCurrentDispatcher.current = null;
|
|
437
|
-
disableLogs();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
try {
|
|
441
|
-
// This should throw.
|
|
442
|
-
if (construct) {
|
|
443
|
-
// Something should be setting the props in the constructor.
|
|
444
|
-
var Fake = function () {
|
|
445
|
-
throw Error();
|
|
446
|
-
}; // $FlowFixMe
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
450
|
-
set: function () {
|
|
451
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
452
|
-
// because that won't throw in a non-strict mode function.
|
|
453
|
-
throw Error();
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
458
|
-
// We construct a different control for this case to include any extra
|
|
459
|
-
// frames added by the construct call.
|
|
460
|
-
try {
|
|
461
|
-
Reflect.construct(Fake, []);
|
|
462
|
-
} catch (x) {
|
|
463
|
-
control = x;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
Reflect.construct(fn, [], Fake);
|
|
467
|
-
} else {
|
|
468
|
-
try {
|
|
469
|
-
Fake.call();
|
|
470
|
-
} catch (x) {
|
|
471
|
-
control = x;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
fn.call(Fake.prototype);
|
|
475
|
-
}
|
|
476
|
-
} else {
|
|
477
|
-
try {
|
|
478
|
-
throw Error();
|
|
479
|
-
} catch (x) {
|
|
480
|
-
control = x;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
fn();
|
|
484
|
-
}
|
|
485
|
-
} catch (sample) {
|
|
486
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
487
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
488
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
489
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
490
|
-
var sampleLines = sample.stack.split('\n');
|
|
491
|
-
var controlLines = control.stack.split('\n');
|
|
492
|
-
var s = sampleLines.length - 1;
|
|
493
|
-
var c = controlLines.length - 1;
|
|
494
|
-
|
|
495
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
496
|
-
// We expect at least one stack frame to be shared.
|
|
497
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
498
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
499
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
500
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
501
|
-
// the sample somewhere in the control.
|
|
502
|
-
c--;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
506
|
-
// Next we find the first one that isn't the same which should be the
|
|
507
|
-
// frame that called our sample function and the control.
|
|
508
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
509
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
510
|
-
// If we're about to return the first line, and the control is also on the same
|
|
511
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
512
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
513
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
514
|
-
if (s !== 1 || c !== 1) {
|
|
515
|
-
do {
|
|
516
|
-
s--;
|
|
517
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
518
|
-
// The next one that isn't the same should be our match though.
|
|
519
|
-
|
|
520
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
521
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
522
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
523
|
-
// but we have a user-provided "displayName"
|
|
524
|
-
// splice it in to make the stack more readable.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
528
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
{
|
|
532
|
-
if (typeof fn === 'function') {
|
|
533
|
-
componentFrameCache.set(fn, _frame);
|
|
534
|
-
}
|
|
535
|
-
} // Return the line we found.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return _frame;
|
|
539
|
-
}
|
|
540
|
-
} while (s >= 1 && c >= 0);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
} finally {
|
|
548
|
-
reentry = false;
|
|
549
|
-
|
|
550
|
-
{
|
|
551
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
552
|
-
reenableLogs();
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
556
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
560
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
561
|
-
|
|
562
|
-
{
|
|
563
|
-
if (typeof fn === 'function') {
|
|
564
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return syntheticFrame;
|
|
569
|
-
}
|
|
570
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
571
|
-
{
|
|
572
|
-
return describeNativeComponentFrame(fn, false);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
function shouldConstruct(Component) {
|
|
577
|
-
var prototype = Component.prototype;
|
|
578
|
-
return !!(prototype && prototype.isReactComponent);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
582
|
-
|
|
583
|
-
if (type == null) {
|
|
584
|
-
return '';
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
if (typeof type === 'function') {
|
|
588
|
-
{
|
|
589
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (typeof type === 'string') {
|
|
594
|
-
return describeBuiltInComponentFrame(type);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
switch (type) {
|
|
598
|
-
case REACT_SUSPENSE_TYPE:
|
|
599
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
600
|
-
|
|
601
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
602
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
if (typeof type === 'object') {
|
|
606
|
-
switch (type.$$typeof) {
|
|
607
|
-
case REACT_FORWARD_REF_TYPE:
|
|
608
|
-
return describeFunctionComponentFrame(type.render);
|
|
609
|
-
|
|
610
|
-
case REACT_MEMO_TYPE:
|
|
611
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
612
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
613
|
-
|
|
614
|
-
case REACT_LAZY_TYPE:
|
|
615
|
-
{
|
|
616
|
-
var lazyComponent = type;
|
|
617
|
-
var payload = lazyComponent._payload;
|
|
618
|
-
var init = lazyComponent._init;
|
|
619
|
-
|
|
620
|
-
try {
|
|
621
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
622
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
623
|
-
} catch (x) {}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
return '';
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
632
|
-
|
|
633
|
-
var loggedTypeFailures = {};
|
|
634
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
635
|
-
|
|
636
|
-
function setCurrentlyValidatingElement(element) {
|
|
637
|
-
{
|
|
638
|
-
if (element) {
|
|
639
|
-
var owner = element._owner;
|
|
640
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
641
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
642
|
-
} else {
|
|
643
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
649
|
-
{
|
|
650
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
651
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
652
|
-
|
|
653
|
-
for (var typeSpecName in typeSpecs) {
|
|
654
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
655
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
656
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
657
|
-
// After these have been cleaned up, we'll let them throw.
|
|
658
|
-
|
|
659
|
-
try {
|
|
660
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
661
|
-
// behavior as without this statement except with a better message.
|
|
662
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
663
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
664
|
-
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`.');
|
|
665
|
-
err.name = 'Invariant Violation';
|
|
666
|
-
throw err;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
670
|
-
} catch (ex) {
|
|
671
|
-
error$1 = ex;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
675
|
-
setCurrentlyValidatingElement(element);
|
|
676
|
-
|
|
677
|
-
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);
|
|
678
|
-
|
|
679
|
-
setCurrentlyValidatingElement(null);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
683
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
684
|
-
// same error.
|
|
685
|
-
loggedTypeFailures[error$1.message] = true;
|
|
686
|
-
setCurrentlyValidatingElement(element);
|
|
687
|
-
|
|
688
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
689
|
-
|
|
690
|
-
setCurrentlyValidatingElement(null);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
698
|
-
|
|
699
|
-
function isArray(a) {
|
|
700
|
-
return isArrayImpl(a);
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
/*
|
|
704
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
705
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
706
|
-
*
|
|
707
|
-
* The functions in this module will throw an easier-to-understand,
|
|
708
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
709
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
710
|
-
* of the `value` object).
|
|
711
|
-
*/
|
|
712
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
713
|
-
function typeName(value) {
|
|
714
|
-
{
|
|
715
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
716
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
717
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
718
|
-
return type;
|
|
719
|
-
}
|
|
720
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
function willCoercionThrow(value) {
|
|
724
|
-
{
|
|
725
|
-
try {
|
|
726
|
-
testStringCoercion(value);
|
|
727
|
-
return false;
|
|
728
|
-
} catch (e) {
|
|
729
|
-
return true;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
function testStringCoercion(value) {
|
|
735
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
736
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
737
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
738
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
739
|
-
//
|
|
740
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
741
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
742
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
743
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
744
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
745
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
746
|
-
//
|
|
747
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
748
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
749
|
-
//
|
|
750
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
751
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
752
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
753
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
754
|
-
// In most cases, this console output also shows the component and its
|
|
755
|
-
// ancestor components where the exception happened.
|
|
756
|
-
//
|
|
757
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
758
|
-
return '' + value;
|
|
759
|
-
}
|
|
760
|
-
function checkKeyStringCoercion(value) {
|
|
761
|
-
{
|
|
762
|
-
if (willCoercionThrow(value)) {
|
|
763
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
764
|
-
|
|
765
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
771
|
-
var RESERVED_PROPS = {
|
|
772
|
-
key: true,
|
|
773
|
-
ref: true,
|
|
774
|
-
__self: true,
|
|
775
|
-
__source: true
|
|
776
|
-
};
|
|
777
|
-
var specialPropKeyWarningShown;
|
|
778
|
-
var specialPropRefWarningShown;
|
|
779
|
-
|
|
780
|
-
function hasValidRef(config) {
|
|
781
|
-
{
|
|
782
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
783
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
784
|
-
|
|
785
|
-
if (getter && getter.isReactWarning) {
|
|
786
|
-
return false;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
return config.ref !== undefined;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
function hasValidKey(config) {
|
|
795
|
-
{
|
|
796
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
797
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
798
|
-
|
|
799
|
-
if (getter && getter.isReactWarning) {
|
|
800
|
-
return false;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return config.key !== undefined;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
809
|
-
{
|
|
810
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
815
|
-
{
|
|
816
|
-
var warnAboutAccessingKey = function () {
|
|
817
|
-
if (!specialPropKeyWarningShown) {
|
|
818
|
-
specialPropKeyWarningShown = true;
|
|
819
|
-
|
|
820
|
-
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);
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
|
|
824
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
825
|
-
Object.defineProperty(props, 'key', {
|
|
826
|
-
get: warnAboutAccessingKey,
|
|
827
|
-
configurable: true
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
833
|
-
{
|
|
834
|
-
var warnAboutAccessingRef = function () {
|
|
835
|
-
if (!specialPropRefWarningShown) {
|
|
836
|
-
specialPropRefWarningShown = true;
|
|
837
|
-
|
|
838
|
-
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);
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
843
|
-
Object.defineProperty(props, 'ref', {
|
|
844
|
-
get: warnAboutAccessingRef,
|
|
845
|
-
configurable: true
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
851
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
852
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
853
|
-
* if something is a React Element.
|
|
854
|
-
*
|
|
855
|
-
* @param {*} type
|
|
856
|
-
* @param {*} props
|
|
857
|
-
* @param {*} key
|
|
858
|
-
* @param {string|object} ref
|
|
859
|
-
* @param {*} owner
|
|
860
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
861
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
862
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
863
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
864
|
-
* change in behavior.
|
|
865
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
866
|
-
* indicating filename, line number, and/or other information.
|
|
867
|
-
* @internal
|
|
868
|
-
*/
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
872
|
-
var element = {
|
|
873
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
874
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
875
|
-
// Built-in properties that belong on the element
|
|
876
|
-
type: type,
|
|
877
|
-
key: key,
|
|
878
|
-
ref: ref,
|
|
879
|
-
props: props,
|
|
880
|
-
// Record the component responsible for creating this element.
|
|
881
|
-
_owner: owner
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
{
|
|
885
|
-
// The validation flag is currently mutative. We put it on
|
|
886
|
-
// an external backing store so that we can freeze the whole object.
|
|
887
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
888
|
-
// commonly used development environments.
|
|
889
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
890
|
-
// the validation flag non-enumerable (where possible, which should
|
|
891
|
-
// include every environment we run tests in), so the test framework
|
|
892
|
-
// ignores it.
|
|
893
|
-
|
|
894
|
-
Object.defineProperty(element._store, 'validated', {
|
|
895
|
-
configurable: false,
|
|
896
|
-
enumerable: false,
|
|
897
|
-
writable: true,
|
|
898
|
-
value: false
|
|
899
|
-
}); // self and source are DEV only properties.
|
|
900
|
-
|
|
901
|
-
Object.defineProperty(element, '_self', {
|
|
902
|
-
configurable: false,
|
|
903
|
-
enumerable: false,
|
|
904
|
-
writable: false,
|
|
905
|
-
value: self
|
|
906
|
-
}); // Two elements created in two different places should be considered
|
|
907
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
908
|
-
|
|
909
|
-
Object.defineProperty(element, '_source', {
|
|
910
|
-
configurable: false,
|
|
911
|
-
enumerable: false,
|
|
912
|
-
writable: false,
|
|
913
|
-
value: source
|
|
914
|
-
});
|
|
915
|
-
|
|
916
|
-
if (Object.freeze) {
|
|
917
|
-
Object.freeze(element.props);
|
|
918
|
-
Object.freeze(element);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
return element;
|
|
923
|
-
};
|
|
924
|
-
/**
|
|
925
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
926
|
-
* @param {*} type
|
|
927
|
-
* @param {object} props
|
|
928
|
-
* @param {string} key
|
|
929
|
-
*/
|
|
930
|
-
|
|
931
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
932
|
-
{
|
|
933
|
-
var propName; // Reserved names are extracted
|
|
934
|
-
|
|
935
|
-
var props = {};
|
|
936
|
-
var key = null;
|
|
937
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
938
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
939
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
940
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
941
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
942
|
-
// key is explicitly declared to be undefined or not.
|
|
943
|
-
|
|
944
|
-
if (maybeKey !== undefined) {
|
|
945
|
-
{
|
|
946
|
-
checkKeyStringCoercion(maybeKey);
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
key = '' + maybeKey;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
if (hasValidKey(config)) {
|
|
953
|
-
{
|
|
954
|
-
checkKeyStringCoercion(config.key);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
key = '' + config.key;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
if (hasValidRef(config)) {
|
|
961
|
-
ref = config.ref;
|
|
962
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
963
|
-
} // Remaining properties are added to a new props object
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
for (propName in config) {
|
|
967
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
968
|
-
props[propName] = config[propName];
|
|
969
|
-
}
|
|
970
|
-
} // Resolve default props
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (type && type.defaultProps) {
|
|
974
|
-
var defaultProps = type.defaultProps;
|
|
975
|
-
|
|
976
|
-
for (propName in defaultProps) {
|
|
977
|
-
if (props[propName] === undefined) {
|
|
978
|
-
props[propName] = defaultProps[propName];
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
if (key || ref) {
|
|
984
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
985
|
-
|
|
986
|
-
if (key) {
|
|
987
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (ref) {
|
|
991
|
-
defineRefPropWarningGetter(props, displayName);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1000
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1001
|
-
|
|
1002
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1003
|
-
{
|
|
1004
|
-
if (element) {
|
|
1005
|
-
var owner = element._owner;
|
|
1006
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1007
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1008
|
-
} else {
|
|
1009
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
var propTypesMisspellWarningShown;
|
|
1015
|
-
|
|
1016
|
-
{
|
|
1017
|
-
propTypesMisspellWarningShown = false;
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Verifies the object is a ReactElement.
|
|
1021
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1022
|
-
* @param {?object} object
|
|
1023
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1024
|
-
* @final
|
|
1025
|
-
*/
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
function isValidElement(object) {
|
|
1029
|
-
{
|
|
1030
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
function getDeclarationErrorAddendum() {
|
|
1035
|
-
{
|
|
1036
|
-
if (ReactCurrentOwner$1.current) {
|
|
1037
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1038
|
-
|
|
1039
|
-
if (name) {
|
|
1040
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
return '';
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1049
|
-
{
|
|
1050
|
-
|
|
1051
|
-
return '';
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1056
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1057
|
-
* updates.
|
|
1058
|
-
*/
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
var ownerHasKeyUseWarning = {};
|
|
1062
|
-
|
|
1063
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1064
|
-
{
|
|
1065
|
-
var info = getDeclarationErrorAddendum();
|
|
1066
|
-
|
|
1067
|
-
if (!info) {
|
|
1068
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1069
|
-
|
|
1070
|
-
if (parentName) {
|
|
1071
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
return info;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1080
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1081
|
-
* reordered. All children that haven't already been validated are required to
|
|
1082
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1083
|
-
* will only be shown once.
|
|
1084
|
-
*
|
|
1085
|
-
* @internal
|
|
1086
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1087
|
-
* @param {*} parentType element's parent's type.
|
|
1088
|
-
*/
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
function validateExplicitKey(element, parentType) {
|
|
1092
|
-
{
|
|
1093
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
element._store.validated = true;
|
|
1098
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1099
|
-
|
|
1100
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1105
|
-
// property, it may be the creator of the child that's responsible for
|
|
1106
|
-
// assigning it a key.
|
|
1107
|
-
|
|
1108
|
-
var childOwner = '';
|
|
1109
|
-
|
|
1110
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1111
|
-
// Give the component that originally created this child.
|
|
1112
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
setCurrentlyValidatingElement$1(element);
|
|
1116
|
-
|
|
1117
|
-
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);
|
|
1118
|
-
|
|
1119
|
-
setCurrentlyValidatingElement$1(null);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1124
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1125
|
-
* with valid key property.
|
|
1126
|
-
*
|
|
1127
|
-
* @internal
|
|
1128
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1129
|
-
* @param {*} parentType node's parent's type.
|
|
1130
|
-
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
function validateChildKeys(node, parentType) {
|
|
1134
|
-
{
|
|
1135
|
-
if (typeof node !== 'object') {
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
if (isArray(node)) {
|
|
1140
|
-
for (var i = 0; i < node.length; i++) {
|
|
1141
|
-
var child = node[i];
|
|
1142
|
-
|
|
1143
|
-
if (isValidElement(child)) {
|
|
1144
|
-
validateExplicitKey(child, parentType);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
} else if (isValidElement(node)) {
|
|
1148
|
-
// This element was passed in a valid location.
|
|
1149
|
-
if (node._store) {
|
|
1150
|
-
node._store.validated = true;
|
|
1151
|
-
}
|
|
1152
|
-
} else if (node) {
|
|
1153
|
-
var iteratorFn = getIteratorFn(node);
|
|
1154
|
-
|
|
1155
|
-
if (typeof iteratorFn === 'function') {
|
|
1156
|
-
// Entry iterators used to provide implicit keys,
|
|
1157
|
-
// but now we print a separate warning for them later.
|
|
1158
|
-
if (iteratorFn !== node.entries) {
|
|
1159
|
-
var iterator = iteratorFn.call(node);
|
|
1160
|
-
var step;
|
|
1161
|
-
|
|
1162
|
-
while (!(step = iterator.next()).done) {
|
|
1163
|
-
if (isValidElement(step.value)) {
|
|
1164
|
-
validateExplicitKey(step.value, parentType);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
/**
|
|
1173
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1174
|
-
* provided by the type.
|
|
1175
|
-
*
|
|
1176
|
-
* @param {ReactElement} element
|
|
1177
|
-
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
function validatePropTypes(element) {
|
|
1181
|
-
{
|
|
1182
|
-
var type = element.type;
|
|
1183
|
-
|
|
1184
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
var propTypes;
|
|
1189
|
-
|
|
1190
|
-
if (typeof type === 'function') {
|
|
1191
|
-
propTypes = type.propTypes;
|
|
1192
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1193
|
-
// Inner props are checked in the reconciler.
|
|
1194
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1195
|
-
propTypes = type.propTypes;
|
|
1196
|
-
} else {
|
|
1197
|
-
return;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
if (propTypes) {
|
|
1201
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1202
|
-
var name = getComponentNameFromType(type);
|
|
1203
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1204
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1205
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1206
|
-
|
|
1207
|
-
var _name = getComponentNameFromType(type);
|
|
1208
|
-
|
|
1209
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1213
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1219
|
-
* @param {ReactElement} fragment
|
|
1220
|
-
*/
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
function validateFragmentProps(fragment) {
|
|
1224
|
-
{
|
|
1225
|
-
var keys = Object.keys(fragment.props);
|
|
1226
|
-
|
|
1227
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1228
|
-
var key = keys[i];
|
|
1229
|
-
|
|
1230
|
-
if (key !== 'children' && key !== 'key') {
|
|
1231
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1232
|
-
|
|
1233
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1234
|
-
|
|
1235
|
-
setCurrentlyValidatingElement$1(null);
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
if (fragment.ref !== null) {
|
|
1241
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1242
|
-
|
|
1243
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1244
|
-
|
|
1245
|
-
setCurrentlyValidatingElement$1(null);
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
var didWarnAboutKeySpread = {};
|
|
1251
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1252
|
-
{
|
|
1253
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1254
|
-
// succeed and there will likely be errors in render.
|
|
1255
|
-
|
|
1256
|
-
if (!validType) {
|
|
1257
|
-
var info = '';
|
|
1258
|
-
|
|
1259
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1260
|
-
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.";
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
var sourceInfo = getSourceInfoErrorAddendum();
|
|
1264
|
-
|
|
1265
|
-
if (sourceInfo) {
|
|
1266
|
-
info += sourceInfo;
|
|
1267
|
-
} else {
|
|
1268
|
-
info += getDeclarationErrorAddendum();
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
var typeString;
|
|
1272
|
-
|
|
1273
|
-
if (type === null) {
|
|
1274
|
-
typeString = 'null';
|
|
1275
|
-
} else if (isArray(type)) {
|
|
1276
|
-
typeString = 'array';
|
|
1277
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1278
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1279
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1280
|
-
} else {
|
|
1281
|
-
typeString = typeof type;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
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);
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1288
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1289
|
-
|
|
1290
|
-
if (element == null) {
|
|
1291
|
-
return element;
|
|
1292
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1293
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1294
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1295
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1296
|
-
// fixed, the key warnings will appear.)
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
if (validType) {
|
|
1300
|
-
var children = props.children;
|
|
1301
|
-
|
|
1302
|
-
if (children !== undefined) {
|
|
1303
|
-
if (isStaticChildren) {
|
|
1304
|
-
if (isArray(children)) {
|
|
1305
|
-
for (var i = 0; i < children.length; i++) {
|
|
1306
|
-
validateChildKeys(children[i], type);
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
if (Object.freeze) {
|
|
1310
|
-
Object.freeze(children);
|
|
1311
|
-
}
|
|
1312
|
-
} else {
|
|
1313
|
-
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.');
|
|
1314
|
-
}
|
|
1315
|
-
} else {
|
|
1316
|
-
validateChildKeys(children, type);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
{
|
|
1322
|
-
if (hasOwnProperty.call(props, 'key')) {
|
|
1323
|
-
var componentName = getComponentNameFromType(type);
|
|
1324
|
-
var keys = Object.keys(props).filter(function (k) {
|
|
1325
|
-
return k !== 'key';
|
|
1326
|
-
});
|
|
1327
|
-
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1328
|
-
|
|
1329
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1330
|
-
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1331
|
-
|
|
1332
|
-
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);
|
|
1333
|
-
|
|
1334
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1340
|
-
validateFragmentProps(element);
|
|
1341
|
-
} else {
|
|
1342
|
-
validatePropTypes(element);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
return element;
|
|
1346
|
-
}
|
|
1347
|
-
} // These two functions exist to still get child warnings in dev
|
|
1348
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1349
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1350
|
-
// giving you warnings if you use production apis.
|
|
1351
|
-
|
|
1352
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1353
|
-
{
|
|
1354
|
-
return jsxWithValidation(type, props, key, true);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1358
|
-
{
|
|
1359
|
-
return jsxWithValidation(type, props, key, false);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1364
|
-
// for now we can ship identical prod functions
|
|
1365
|
-
|
|
1366
|
-
var jsxs = jsxWithValidationStatic ;
|
|
1367
|
-
|
|
1368
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1369
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
1370
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
1371
|
-
})();
|
|
1372
|
-
}
|
|
1373
|
-
return reactJsxRuntime_development;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
var hasRequiredJsxRuntime;
|
|
1377
|
-
|
|
1378
|
-
function requireJsxRuntime () {
|
|
1379
|
-
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
1380
|
-
hasRequiredJsxRuntime = 1;
|
|
1381
|
-
|
|
1382
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1383
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1384
|
-
} else {
|
|
1385
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1386
|
-
}
|
|
1387
|
-
return jsxRuntime.exports;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
var jsxRuntimeExports = requireJsxRuntime();
|
|
1391
|
-
|
|
1392
30
|
function cn(...inputs) {
|
|
1393
31
|
return twMerge(clsx(inputs));
|
|
1394
32
|
}
|
|
1395
33
|
|
|
1396
|
-
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
34
|
+
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(ScrollAreaPrimitive.Root, { ref: ref, className: cn("relative overflow-hidden", className), ...props, children: [jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children: children }), jsx(ScrollBar, {}), jsx(ScrollAreaPrimitive.Corner, {})] })));
|
|
1397
35
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
1398
|
-
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (
|
|
36
|
+
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn("flex touch-none select-none transition-colors", orientation === "vertical" &&
|
|
1399
37
|
"h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" &&
|
|
1400
|
-
"h-2.5 flex-col border-t border-t-transparent p-[1px]", className), ...props, children:
|
|
38
|
+
"h-2.5 flex-col border-t border-t-transparent p-[1px]", className), ...props, children: jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) })));
|
|
1401
39
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
1402
40
|
|
|
1403
41
|
const buttonVariants = 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" +
|
|
@@ -1431,11 +69,11 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
|
|
|
1431
69
|
});
|
|
1432
70
|
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1433
71
|
const Comp = asChild ? Slot : "button";
|
|
1434
|
-
return (
|
|
72
|
+
return (jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
1435
73
|
});
|
|
1436
74
|
Button.displayName = "Button";
|
|
1437
75
|
|
|
1438
|
-
const Progress = React.forwardRef(({ className, value, ...props }, ref) => (
|
|
76
|
+
const Progress = React.forwardRef(({ className, value, ...props }, ref) => (jsx(ProgressPrimitive.Root, { ref: ref, className: cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className), ...props, children: jsx(ProgressPrimitive.Indicator, { className: "h-full w-full flex-1 bg-primary transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
|
|
1439
77
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
1440
78
|
|
|
1441
79
|
const createEmptyColumn = (width = 12) => ({
|
|
@@ -2469,35 +1107,35 @@ const useFormStore = create((set, get) => ({
|
|
|
2469
1107
|
|
|
2470
1108
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
2471
1109
|
// h-9 to match icon buttons and default buttons.
|
|
2472
|
-
return (
|
|
1110
|
+
return (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 }));
|
|
2473
1111
|
});
|
|
2474
1112
|
Input.displayName = "Input";
|
|
2475
1113
|
|
|
2476
1114
|
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
2477
|
-
return (
|
|
1115
|
+
return (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 }));
|
|
2478
1116
|
});
|
|
2479
1117
|
Textarea.displayName = "Textarea";
|
|
2480
1118
|
|
|
2481
|
-
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (
|
|
1119
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (jsx(CheckboxPrimitive.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: jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: jsx(Check, { className: "h-4 w-4" }) }) })));
|
|
2482
1120
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
2483
1121
|
|
|
2484
|
-
const Switch = React.forwardRef(({ className, ...props }, ref) => (
|
|
1122
|
+
const Switch = React.forwardRef(({ className, ...props }, ref) => (jsx(SwitchPrimitives.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: jsx(SwitchPrimitives.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") }) })));
|
|
2485
1123
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
2486
1124
|
|
|
2487
1125
|
const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
2488
|
-
const Label = React.forwardRef(({ className, ...props }, ref) => (
|
|
1126
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => (jsx(LabelPrimitive.Root, { ref: ref, className: cn(labelVariants(), className), ...props })));
|
|
2489
1127
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
2490
1128
|
|
|
2491
1129
|
const RadioGroup = React.forwardRef(({ className, ...props }, ref) => {
|
|
2492
|
-
return (
|
|
1130
|
+
return (jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref: ref }));
|
|
2493
1131
|
});
|
|
2494
1132
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
2495
1133
|
const RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
2496
|
-
return (
|
|
1134
|
+
return (jsx(RadioGroupPrimitive.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: jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: jsx(Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) }) }));
|
|
2497
1135
|
});
|
|
2498
1136
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
2499
1137
|
|
|
2500
|
-
const Slider = React.forwardRef(({ className, ...props }, ref) => (
|
|
1138
|
+
const Slider = React.forwardRef(({ className, ...props }, ref) => (jsxs(SliderPrimitive.Root, { ref: ref, className: cn("relative flex w-full touch-none select-none items-center", className), ...props, children: [jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }), jsx(SliderPrimitive.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" })] })));
|
|
2501
1139
|
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
2502
1140
|
|
|
2503
1141
|
const badgeVariants = cva(
|
|
@@ -2517,35 +1155,35 @@ const badgeVariants = cva(
|
|
|
2517
1155
|
},
|
|
2518
1156
|
});
|
|
2519
1157
|
function Badge({ className, variant, ...props }) {
|
|
2520
|
-
return (
|
|
1158
|
+
return (jsx("div", { className: cn(badgeVariants({ variant }), className), ...props }));
|
|
2521
1159
|
}
|
|
2522
1160
|
|
|
2523
1161
|
const Tooltip = TooltipPrimitive.Root;
|
|
2524
1162
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2525
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
|
|
1163
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (jsx(TooltipPrimitive.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 })));
|
|
2526
1164
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
2527
1165
|
|
|
2528
1166
|
const Select = SelectPrimitive.Root;
|
|
2529
1167
|
const SelectValue = SelectPrimitive.Value;
|
|
2530
|
-
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
1168
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(SelectPrimitive.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, jsx(SelectPrimitive.Icon, { asChild: true, children: jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })] })));
|
|
2531
1169
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
2532
|
-
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (
|
|
1170
|
+
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: jsx(ChevronUp, { className: "h-4 w-4" }) })));
|
|
2533
1171
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
2534
|
-
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (
|
|
1172
|
+
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: jsx(ChevronDown, { className: "h-4 w-4" }) })));
|
|
2535
1173
|
SelectScrollDownButton.displayName =
|
|
2536
1174
|
SelectPrimitive.ScrollDownButton.displayName;
|
|
2537
|
-
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (
|
|
2538
|
-
"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: [
|
|
2539
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }),
|
|
1175
|
+
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (jsx(SelectPrimitive.Portal, { children: jsxs(SelectPrimitive.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" &&
|
|
1176
|
+
"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: [jsx(SelectScrollUpButton, {}), jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" &&
|
|
1177
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), jsx(SelectScrollDownButton, {})] }) })));
|
|
2540
1178
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
2541
|
-
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (
|
|
1179
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.Label, { ref: ref, className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className), ...props })));
|
|
2542
1180
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
2543
|
-
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
1181
|
+
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(SelectPrimitive.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: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(SelectPrimitive.ItemIndicator, { children: jsx(Check, { className: "h-4 w-4" }) }) }), jsx(SelectPrimitive.ItemText, { children: children })] })));
|
|
2544
1182
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
2545
|
-
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (
|
|
1183
|
+
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
|
|
2546
1184
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
2547
1185
|
|
|
2548
|
-
const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
1186
|
+
const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (jsx(SeparatorPrimitive.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 })));
|
|
2549
1187
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
2550
1188
|
|
|
2551
1189
|
function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode, getFieldValue, setFieldValue, fields, gap, padding, hasBorder, direction, background, flexWrap = 'wrap', justifyContent = 'flex-start', alignItems = 'stretch', fieldSize = 'normal', }) {
|
|
@@ -2580,7 +1218,7 @@ function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode,
|
|
|
2580
1218
|
// In preview mode, remove container padding/gap for consistent alignment with rows
|
|
2581
1219
|
const effectivePadding = isPreviewMode ? 0 : padding * 4;
|
|
2582
1220
|
const effectiveGap = isPreviewMode ? 0 : gap * 4;
|
|
2583
|
-
return (
|
|
1221
|
+
return (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: {
|
|
2584
1222
|
display: 'flex',
|
|
2585
1223
|
flexDirection: direction,
|
|
2586
1224
|
flexWrap: flexWrap,
|
|
@@ -2590,14 +1228,14 @@ function DroppableContainer({ rowId, columnId, containerFieldId, isPreviewMode,
|
|
|
2590
1228
|
padding: `${effectivePadding}px`,
|
|
2591
1229
|
background: background || (isPreviewMode ? 'transparent' : undefined),
|
|
2592
1230
|
minHeight: isPreviewMode ? undefined : '100px',
|
|
2593
|
-
}, children: fields.length === 0 && !isPreviewMode ? (
|
|
1231
|
+
}, children: fields.length === 0 && !isPreviewMode ? (jsxs("div", { className: "flex-1 flex flex-col items-center justify-center gap-2 py-4", children: [jsx("div", { className: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center", children: 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: jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 6v6m0 0v6m0-6h6m-6 0H6" }) }) }), jsx("span", { className: "text-sm font-medium text-primary/70", children: "Drop fields here" }), jsx("span", { className: "text-xs text-muted-foreground", children: "Drag inputs, dropdowns, or other fields" })] })) : (fields.map((field) => {
|
|
2594
1232
|
const fieldWidth = getFieldWidth(field);
|
|
2595
|
-
return (
|
|
1233
|
+
return (jsx("div", { className: "relative", style: {
|
|
2596
1234
|
zIndex: 20,
|
|
2597
1235
|
width: fieldWidth,
|
|
2598
1236
|
flexGrow: fieldWidth === 'auto' ? 1 : 0,
|
|
2599
1237
|
flexShrink: fieldWidth === 'auto' ? 1 : 0,
|
|
2600
|
-
}, children:
|
|
1238
|
+
}, children: jsx(CanvasField, { field: field, rowId: rowId, columnId: columnId, isPreviewMode: isPreviewMode, getFieldValue: getFieldValue, setFieldValue: setFieldValue, isInsideContainer: true, fieldSize: fieldSize }) }, field.id));
|
|
2601
1239
|
})) }));
|
|
2602
1240
|
}
|
|
2603
1241
|
function parseCssString(css) {
|
|
@@ -2669,7 +1307,7 @@ function validateField(value, validation, fieldType) {
|
|
|
2669
1307
|
}
|
|
2670
1308
|
function RatingField({ value, onChange, maxRating = 5, disabled, className }) {
|
|
2671
1309
|
const [hoverValue, setHoverValue] = useState(0);
|
|
2672
|
-
return (
|
|
1310
|
+
return (jsx("div", { className: `flex gap-1 ${className || ''}`, children: Array.from({ length: maxRating }, (_, i) => i + 1).map((star) => (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: jsx(Star, { className: `h-4 w-4 ${star <= (hoverValue || value)
|
|
2673
1311
|
? 'fill-yellow-400 text-yellow-400'
|
|
2674
1312
|
: 'text-muted-foreground'}` }) }, star))) }));
|
|
2675
1313
|
}
|
|
@@ -2741,7 +1379,7 @@ function SignatureField({ value, onChange, disabled, width = 400, height = 150,
|
|
|
2741
1379
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
2742
1380
|
onChange('');
|
|
2743
1381
|
};
|
|
2744
|
-
return (
|
|
1382
|
+
return (jsxs("div", { className: `space-y-2 ${className || ''}`, children: [jsx("canvas", { ref: canvasRef, width: width, height: height, className: "border border-border rounded-md cursor-crosshair", onMouseDown: startDrawing, onMouseMove: draw, onMouseUp: stopDrawing, onMouseLeave: stopDrawing }), jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: clearSignature, disabled: disabled, children: "Clear Signature" })] }));
|
|
2745
1383
|
}
|
|
2746
1384
|
function MultiSelectField({ value, onChange, options, disabled, maxItems, className }) {
|
|
2747
1385
|
const addItem = (item) => {
|
|
@@ -2754,9 +1392,9 @@ function MultiSelectField({ value, onChange, options, disabled, maxItems, classN
|
|
|
2754
1392
|
const removeItem = (item) => {
|
|
2755
1393
|
onChange(value.filter(v => v !== item));
|
|
2756
1394
|
};
|
|
2757
|
-
return (
|
|
1395
|
+
return (jsxs("div", { className: `space-y-2 ${className || ''}`, children: [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) => (jsxs(Badge, { variant: "secondary", className: "gap-1", children: [item, !disabled && (jsx("button", { type: "button", onClick: () => removeItem(item), className: "ml-1 hover:text-destructive", children: jsx(X, { className: "h-3 w-3" }) }))] }, i))) }), jsxs(Select, { disabled: disabled || (maxItems !== undefined && value.length >= maxItems), onValueChange: addItem, children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Add item..." }) }), jsx(SelectContent, { children: options
|
|
2758
1396
|
.filter(opt => !value.includes(opt))
|
|
2759
|
-
.map((option, i) => (
|
|
1397
|
+
.map((option, i) => (jsx(SelectItem, { value: option, children: option }, i))) })] })] }));
|
|
2760
1398
|
}
|
|
2761
1399
|
function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMode, getFieldValue: externalGetFieldValue, setFieldValue: externalSetFieldValue, isInsideContainer = false, fieldSize = 'normal' }) {
|
|
2762
1400
|
const store = useFormStore();
|
|
@@ -2866,27 +1504,27 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
2866
1504
|
const errorClass = hasError ? 'border-destructive focus-visible:ring-destructive' : '';
|
|
2867
1505
|
switch (field.type) {
|
|
2868
1506
|
case 'input':
|
|
2869
|
-
return (
|
|
1507
|
+
return (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: {
|
|
2870
1508
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2871
1509
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2872
1510
|
}, "data-testid": `field-input-${field.id}` }));
|
|
2873
1511
|
case 'password':
|
|
2874
|
-
return (
|
|
1512
|
+
return (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: {
|
|
2875
1513
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2876
1514
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2877
1515
|
}, "data-testid": `field-password-${field.id}` }));
|
|
2878
1516
|
case 'phone':
|
|
2879
|
-
return (
|
|
1517
|
+
return (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: {
|
|
2880
1518
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2881
1519
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2882
1520
|
}, "data-testid": `field-phone-${field.id}` }));
|
|
2883
1521
|
case 'url':
|
|
2884
|
-
return (
|
|
1522
|
+
return (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: {
|
|
2885
1523
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2886
1524
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2887
1525
|
}, "data-testid": `field-url-${field.id}` }));
|
|
2888
1526
|
case 'textarea':
|
|
2889
|
-
return (
|
|
1527
|
+
return (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: {
|
|
2890
1528
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2891
1529
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2892
1530
|
}, "data-testid": `field-textarea-${field.id}` }));
|
|
@@ -2894,140 +1532,140 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
2894
1532
|
const dropdownOptions = typeof field.props.optionsString === 'string'
|
|
2895
1533
|
? field.props.optionsString.split('\n').filter((o) => o.trim())
|
|
2896
1534
|
: (field.props.optionsString || []);
|
|
2897
|
-
return (
|
|
1535
|
+
return (jsxs(Select, { disabled: isFieldDisabled, value: isPreviewMode ? localValue : undefined, onValueChange: (v) => isPreviewMode && handleChange(v), children: [jsx(SelectTrigger, { className: `${inputSize} ${errorClass} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2898
1536
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2899
1537
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2900
|
-
}, "data-testid": `field-dropdown-${field.id}`, children:
|
|
1538
|
+
}, "data-testid": `field-dropdown-${field.id}`, children: jsx(SelectValue, { placeholder: field.props.placeholder || 'Select...' }) }), jsx(SelectContent, { children: dropdownOptions.map((option, i) => (jsx(SelectItem, { value: option, children: option }, i))) })] }));
|
|
2901
1539
|
case 'checkbox':
|
|
2902
|
-
return (
|
|
1540
|
+
return (jsxs("div", { className: `flex items-center gap-2 ${field.customStyle?.inputClassName || ''}`, children: [jsx(Checkbox, { disabled: isFieldDisabled, "data-testid": `field-checkbox-${field.id}` }), jsx("span", { className: "text-sm text-foreground", style: {
|
|
2903
1541
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2904
1542
|
}, children: field.props.label })] }));
|
|
2905
1543
|
case 'radio':
|
|
2906
1544
|
const radioOptions = typeof field.props.optionsString === 'string'
|
|
2907
1545
|
? field.props.optionsString.split('\n').filter((o) => o.trim())
|
|
2908
1546
|
: (field.props.optionsString || []);
|
|
2909
|
-
return (
|
|
1547
|
+
return (jsx(RadioGroup, { disabled: isFieldDisabled, className: field.customStyle?.inputClassName || '', children: radioOptions.map((option, i) => (jsxs("div", { className: "flex items-center gap-2", children: [jsx(RadioGroupItem, { value: option, id: `${field.id}-${i}`, "data-testid": `field-radio-${field.id}-${i}` }), jsx(Label, { htmlFor: `${field.id}-${i}`, className: "text-sm", style: {
|
|
2910
1548
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2911
1549
|
}, children: option })] }, i))) }));
|
|
2912
1550
|
case 'toggle':
|
|
2913
|
-
return (
|
|
1551
|
+
return (jsxs("div", { className: `flex items-center gap-2 ${field.customStyle?.inputClassName || ''}`, children: [jsx(Switch, { disabled: isFieldDisabled, "data-testid": `field-toggle-${field.id}` }), jsx("span", { className: "text-sm text-foreground", style: {
|
|
2914
1552
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2915
1553
|
}, children: field.props.label })] }));
|
|
2916
1554
|
case 'multiselect':
|
|
2917
|
-
return (
|
|
1555
|
+
return (jsx(MultiSelectField, { value: multiSelectValue, onChange: (v) => {
|
|
2918
1556
|
setMultiSelectValue(v);
|
|
2919
1557
|
setFieldValue(field.props.key, v);
|
|
2920
1558
|
}, options: field.props.optionsString || [], disabled: isFieldDisabled, maxItems: field.props.multiSelectConfig?.maxItems, className: field.customStyle?.inputClassName }));
|
|
2921
1559
|
case 'date':
|
|
2922
|
-
return (
|
|
1560
|
+
return (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: {
|
|
2923
1561
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2924
1562
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2925
1563
|
}, "data-testid": `field-date-${field.id}` }));
|
|
2926
1564
|
case 'time':
|
|
2927
|
-
return (
|
|
1565
|
+
return (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: {
|
|
2928
1566
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2929
1567
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2930
1568
|
}, "data-testid": `field-time-${field.id}` }));
|
|
2931
1569
|
case 'daterange':
|
|
2932
|
-
return (
|
|
1570
|
+
return (jsxs("div", { className: `flex gap-2 items-center ${field.customStyle?.inputClassName || ''}`, children: [jsx(Input, { type: "date", disabled: isFieldDisabled, className: inputSize, style: {
|
|
2933
1571
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2934
|
-
}, "data-testid": `field-daterange-start-${field.id}` }),
|
|
1572
|
+
}, "data-testid": `field-daterange-start-${field.id}` }), jsx("span", { className: "text-muted-foreground", style: {
|
|
2935
1573
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2936
|
-
}, children: "to" }),
|
|
1574
|
+
}, children: "to" }), jsx(Input, { type: "date", disabled: isFieldDisabled, className: inputSize, style: {
|
|
2937
1575
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2938
1576
|
}, "data-testid": `field-daterange-end-${field.id}` })] }));
|
|
2939
1577
|
case 'number':
|
|
2940
|
-
return (
|
|
1578
|
+
return (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: {
|
|
2941
1579
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2942
1580
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2943
1581
|
}, "data-testid": `field-number-${field.id}` }));
|
|
2944
1582
|
case 'email':
|
|
2945
|
-
return (
|
|
1583
|
+
return (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: {
|
|
2946
1584
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2947
1585
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2948
1586
|
}, "data-testid": `field-email-${field.id}` }));
|
|
2949
1587
|
case 'file':
|
|
2950
|
-
return (
|
|
1588
|
+
return (jsxs("div", { className: `space-y-2 ${field.customStyle?.inputClassName || ''}`, children: [jsx("div", { className: "flex items-center justify-center w-full", children: 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: {
|
|
2951
1589
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2952
|
-
}, children: [
|
|
1590
|
+
}, children: [jsxs("div", { className: "flex flex-col items-center justify-center pt-5 pb-6", children: [jsx(Upload, { className: "w-8 h-8 mb-2 text-muted-foreground" }), jsxs("p", { className: "mb-1 text-sm text-muted-foreground", style: {
|
|
2953
1591
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2954
|
-
}, children: [
|
|
1592
|
+
}, children: [jsx("span", { className: "font-semibold", children: "Click to upload" }), " or drag and drop"] }), jsx("p", { className: "text-xs text-muted-foreground", children: field.props.fileConfig?.accept || 'Any file type' })] }), 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 && (jsx("div", { className: "space-y-1", children: filesValue.map((file, i) => (jsxs("div", { className: "flex items-center justify-between p-2 bg-muted rounded", children: [jsx("span", { className: "text-sm truncate", children: file.name }), jsx(Button, { size: "icon", variant: "ghost", onClick: () => setFilesValue(filesValue.filter((_, idx) => idx !== i)), children: jsx(X, { className: "h-4 w-4" }) })] }, i))) }))] }));
|
|
2955
1593
|
case 'signature':
|
|
2956
|
-
return (
|
|
1594
|
+
return (jsx(SignatureField, { value: signatureValue, onChange: (v) => {
|
|
2957
1595
|
setSignatureValue(v);
|
|
2958
1596
|
setFieldValue(field.props.key, v);
|
|
2959
1597
|
}, disabled: isFieldDisabled, width: field.props.signatureConfig?.width, height: field.props.signatureConfig?.height, className: field.customStyle?.inputClassName }));
|
|
2960
1598
|
case 'rating':
|
|
2961
|
-
return (
|
|
1599
|
+
return (jsx(RatingField, { value: ratingValue, onChange: (v) => {
|
|
2962
1600
|
setRatingValue(v);
|
|
2963
1601
|
setFieldValue(field.props.key, v);
|
|
2964
1602
|
}, maxRating: field.props.ratingConfig?.maxRating || 5, disabled: isFieldDisabled, className: field.customStyle?.inputClassName }));
|
|
2965
1603
|
case 'richtext':
|
|
2966
|
-
return (
|
|
1604
|
+
return (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: {
|
|
2967
1605
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2968
1606
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2969
1607
|
}, "data-testid": `field-richtext-${field.id}` }));
|
|
2970
1608
|
case 'autocomplete':
|
|
2971
|
-
return (
|
|
1609
|
+
return (jsx("div", { className: `relative ${field.customStyle?.inputClassName || ''}`, children: jsx(Input, { placeholder: field.props.placeholder || 'Start typing...', disabled: isFieldDisabled, value: isPreviewMode ? localValue : '', onChange: (e) => isPreviewMode && handleChange(e.target.value), className: `${inputSize} ${errorClass}`, style: {
|
|
2972
1610
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2973
1611
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2974
1612
|
}, "data-testid": `field-autocomplete-${field.id}` }) }));
|
|
2975
1613
|
case 'slider':
|
|
2976
|
-
return (
|
|
1614
|
+
return (jsxs("div", { className: `space-y-2 ${field.customStyle?.inputClassName || ''}`, children: [jsx(Slider, { value: sliderValue, onValueChange: (v) => {
|
|
2977
1615
|
setSliderValue(v);
|
|
2978
1616
|
setFieldValue(field.props.key, v[0]);
|
|
2979
|
-
}, min: field.validation?.min || 0, max: field.validation?.max || 100, step: 1, disabled: isFieldDisabled, "data-testid": `field-slider-${field.id}` }),
|
|
1617
|
+
}, min: field.validation?.min || 0, max: field.validation?.max || 100, step: 1, disabled: isFieldDisabled, "data-testid": `field-slider-${field.id}` }), jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [jsx("span", { children: field.validation?.min || 0 }), jsx("span", { className: "font-medium text-foreground", style: {
|
|
2980
1618
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2981
|
-
}, children: sliderValue[0] }),
|
|
1619
|
+
}, children: sliderValue[0] }), jsx("span", { children: field.validation?.max || 100 })] })] }));
|
|
2982
1620
|
case 'header':
|
|
2983
|
-
return (
|
|
1621
|
+
return (jsx("h2", { className: `text-2xl font-bold text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2984
1622
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2985
1623
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2986
1624
|
}, children: field.props.label }));
|
|
2987
1625
|
case 'subheader':
|
|
2988
|
-
return (
|
|
1626
|
+
return (jsx("h3", { className: `text-lg font-semibold text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2989
1627
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2990
1628
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2991
1629
|
}, children: field.props.label }));
|
|
2992
1630
|
case 'label':
|
|
2993
|
-
return (
|
|
1631
|
+
return (jsx("span", { className: `text-sm font-medium text-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2994
1632
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
2995
1633
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
2996
1634
|
}, children: field.props.label }));
|
|
2997
1635
|
case 'paragraph':
|
|
2998
|
-
return (
|
|
1636
|
+
return (jsx("p", { className: `text-sm text-muted-foreground ${field.customStyle?.inputClassName || ''}`, style: {
|
|
2999
1637
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3000
1638
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3001
1639
|
}, children: field.props.label }));
|
|
3002
1640
|
case 'divider':
|
|
3003
1641
|
const dividerMargin = field.props.dividerMargin ?? 16;
|
|
3004
|
-
return (
|
|
1642
|
+
return (jsx(Separator, { className: field.customStyle?.inputClassName || '', style: {
|
|
3005
1643
|
marginTop: dividerMargin,
|
|
3006
1644
|
marginBottom: dividerMargin,
|
|
3007
1645
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3008
1646
|
} }));
|
|
3009
1647
|
case 'spacer':
|
|
3010
1648
|
const spacerHeight = field.props.spacerHeight ?? 24;
|
|
3011
|
-
return (
|
|
1649
|
+
return (jsx("div", { className: field.customStyle?.inputClassName || '', style: {
|
|
3012
1650
|
height: spacerHeight,
|
|
3013
1651
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3014
1652
|
} }));
|
|
3015
1653
|
case 'alert':
|
|
3016
|
-
return (
|
|
1654
|
+
return (jsxs("div", { className: `flex items-start gap-3 p-4 bg-muted rounded-md border border-border ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3017
1655
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3018
1656
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3019
|
-
}, children: [
|
|
1657
|
+
}, children: [jsx(AlertCircle, { className: "h-5 w-5 text-muted-foreground shrink-0 mt-0.5" }), jsx("p", { className: "text-sm text-foreground", children: field.props.label })] }));
|
|
3020
1658
|
case 'image':
|
|
3021
1659
|
const imageUrl = field.props.imageUrl;
|
|
3022
1660
|
const imageWidth = field.props.imageWidth || '100%';
|
|
3023
1661
|
const imageHeight = field.props.imageHeight || 'auto';
|
|
3024
|
-
return (
|
|
1662
|
+
return (jsx("div", { className: `w-full ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3025
1663
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3026
|
-
}, children: imageUrl ? (
|
|
1664
|
+
}, children: imageUrl ? (jsx("img", { src: imageUrl, alt: field.props.label || 'Image', style: { width: imageWidth, height: imageHeight, objectFit: 'cover' }, className: "rounded-md" })) : (jsx("div", { className: "w-full h-32 bg-muted rounded-md flex items-center justify-center", children: jsx("span", { className: "text-sm text-muted-foreground", children: "Image placeholder" }) })) }));
|
|
3027
1665
|
case 'button':
|
|
3028
1666
|
const buttonVariant = field.props.buttonConfig?.variant || 'default';
|
|
3029
1667
|
const buttonAction = field.props.buttonConfig?.action || 'submit';
|
|
3030
|
-
return (
|
|
1668
|
+
return (jsx(Button, { variant: buttonVariant, disabled: isFieldDisabled, className: field.customStyle?.inputClassName || '', style: {
|
|
3031
1669
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3032
1670
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3033
1671
|
}, onClick: () => {
|
|
@@ -3063,7 +1701,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3063
1701
|
}
|
|
3064
1702
|
return result;
|
|
3065
1703
|
};
|
|
3066
|
-
return (
|
|
1704
|
+
return (jsx(Input, { value: formatPatternValue(localValue), onChange: (e) => {
|
|
3067
1705
|
const digits = e.target.value.replace(/\D/g, '');
|
|
3068
1706
|
handleChange(digits);
|
|
3069
1707
|
}, placeholder: field.props.placeholder, disabled: isFieldDisabled, className: `${inputSize} ${field.customStyle?.inputClassName || ''}`, style: {
|
|
@@ -3073,11 +1711,11 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3073
1711
|
case 'qrcode':
|
|
3074
1712
|
const qrValue = field.props.qrCodeConfig?.value || 'https://example.com';
|
|
3075
1713
|
const qrSize = field.props.qrCodeConfig?.size || 128;
|
|
3076
|
-
return (
|
|
1714
|
+
return (jsx("div", { className: `flex items-center justify-center p-4 bg-white rounded-md border border-border ${field.customStyle?.inputClassName || ''}`, style: {
|
|
3077
1715
|
width: qrSize + 32,
|
|
3078
1716
|
height: qrSize + 32,
|
|
3079
1717
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3080
|
-
}, children:
|
|
1718
|
+
}, children: jsx(QRCodeSVG, { value: qrValue, size: qrSize, level: "M", "data-testid": `field-qrcode-${field.id}` }) }));
|
|
3081
1719
|
case 'container':
|
|
3082
1720
|
const containerGap = field.props.containerConfig?.gap ?? 4;
|
|
3083
1721
|
const containerPadding = field.props.containerConfig?.padding ?? 4;
|
|
@@ -3088,7 +1726,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3088
1726
|
const containerJustifyContent = field.props.containerConfig?.justifyContent || 'flex-start';
|
|
3089
1727
|
const containerAlignItems = field.props.containerConfig?.alignItems || 'stretch';
|
|
3090
1728
|
const containerFieldSize = field.props.containerConfig?.fieldSize || 'normal';
|
|
3091
|
-
return (
|
|
1729
|
+
return (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 }));
|
|
3092
1730
|
case 'table':
|
|
3093
1731
|
const tableColumns = field.props.tableConfig?.columns || [
|
|
3094
1732
|
{ key: 'col1', label: 'Column 1', type: 'text' },
|
|
@@ -3142,15 +1780,15 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3142
1780
|
setFieldValue(field.props.key, currentRows);
|
|
3143
1781
|
}
|
|
3144
1782
|
};
|
|
3145
|
-
return (
|
|
1783
|
+
return (jsxs("div", { className: `w-full overflow-x-auto ${field.customStyle?.inputClassName || ''}`, children: [jsxs("table", { className: `w-full ${tableFontClass} ${isBordered ? 'border border-border' : ''}`, children: [jsx("thead", { className: "bg-muted/50", children: jsxs("tr", { children: [showRowNumbers && (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) => (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 && jsx("span", { className: "text-destructive ml-1", children: "*" })] }, col.key))), allowDeleteRows && (jsx("th", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} w-12 ${isBordered ? 'border border-border' : ''}` }))] }) }), jsx("tbody", { children: tableRows.map((row, rowIndex) => (jsxs("tr", { className: isStriped && rowIndex % 2 === 1 ? 'bg-muted/30' : '', children: [showRowNumbers && (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) => (jsx("td", { className: `${isCompact ? 'px-1 py-1' : 'px-2 py-1'} ${isBordered ? 'border border-border' : ''}`, children: col.type === 'checkbox' ? (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' ? (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: [jsx("option", { value: "", children: col.placeholder || 'Select...' }), col.options?.map((opt) => (jsx("option", { value: opt.value, children: opt.label }, opt.value)))] })) : (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 && (jsx("td", { className: `${isCompact ? 'px-2 py-1' : 'px-3 py-2'} ${isBordered ? 'border border-border' : ''}`, children: jsx("button", { onClick: () => deleteTableRow(rowIndex), disabled: !isPreviewMode, className: "text-muted-foreground hover:text-destructive transition-colors", children: 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: jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }) }))] }, rowIndex))) })] }), allowAddRows && tableRows.length < maxRows && (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: [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: jsx("path", { d: "M12 5v14M5 12h14" }) }), "Add Row"] }))] }));
|
|
3146
1784
|
default:
|
|
3147
|
-
return (
|
|
1785
|
+
return (jsxs("div", { className: "p-3 bg-muted rounded-md text-sm text-muted-foreground", children: ["Unknown field type: ", field.type] }));
|
|
3148
1786
|
}
|
|
3149
1787
|
};
|
|
3150
1788
|
const showLabel = !['checkbox', 'toggle', 'header', 'subheader', 'label', 'paragraph', 'divider', 'spacer', 'alert', 'button', 'qrcode', 'container', 'table', 'image'].includes(field.type);
|
|
3151
1789
|
// For container fields, render with minimal wrapper to allow drop zone to work
|
|
3152
1790
|
if (field.type === 'container') {
|
|
3153
|
-
return (
|
|
1791
|
+
return (jsxs("div", { className: `
|
|
3154
1792
|
relative group rounded-md transition-all duration-150
|
|
3155
1793
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3156
1794
|
${field.props.hidden && !isPreviewMode ? 'opacity-50' : ''}
|
|
@@ -3165,10 +1803,10 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3165
1803
|
...(field.customStyle?.marginLeft ? { marginLeft: field.customStyle.marginLeft } : {}),
|
|
3166
1804
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3167
1805
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3168
|
-
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (
|
|
1806
|
+
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (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: [jsx("span", { className: "text-xs font-medium text-primary", children: field.props.label || 'Container' }), jsx("button", { onClick: (e) => {
|
|
3169
1807
|
e.stopPropagation();
|
|
3170
1808
|
deleteField(rowId, columnId, field.id);
|
|
3171
|
-
}, className: "p-1 rounded hover:bg-destructive/20 text-destructive", "data-testid": `delete-container-${field.id}`, children:
|
|
1809
|
+
}, className: "p-1 rounded hover:bg-destructive/20 text-destructive", "data-testid": `delete-container-${field.id}`, children: jsx(Trash2, { className: "h-3 w-3" }) })] })), jsx("div", { className: !isPreviewMode ? 'pt-8' : '', children: renderFieldContent() })] }));
|
|
3172
1810
|
}
|
|
3173
1811
|
// Calculate dynamic classes based on fieldSize (from container or row)
|
|
3174
1812
|
// When fieldSize is provided (from row or container), always use the size-specific styles
|
|
@@ -3204,7 +1842,7 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3204
1842
|
default: return `text-xs font-medium ${base}`;
|
|
3205
1843
|
}
|
|
3206
1844
|
};
|
|
3207
|
-
return (
|
|
1845
|
+
return (jsxs("div", { onClick: handleClick, className: `
|
|
3208
1846
|
relative group rounded-md transition-all duration-150 ${getPaddingClass()}
|
|
3209
1847
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background bg-primary/5' : 'bg-transparent'}
|
|
3210
1848
|
${!isPreviewMode ? 'hover:bg-muted/30 cursor-pointer' : ''}
|
|
@@ -3220,16 +1858,16 @@ function CanvasField({ field, rowId, columnId, isPreviewMode: externalPreviewMod
|
|
|
3220
1858
|
...(field.customStyle?.marginLeft ? { marginLeft: field.customStyle.marginLeft } : {}),
|
|
3221
1859
|
...(field.customStyle?.color ? { color: field.customStyle.color } : {}),
|
|
3222
1860
|
...(field.customStyle?.backgroundColor ? { backgroundColor: field.customStyle.backgroundColor } : {}),
|
|
3223
|
-
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (
|
|
1861
|
+
}, "data-testid": `canvas-field-${field.id}`, children: [!isPreviewMode && (jsx("button", { onClick: (e) => {
|
|
3224
1862
|
e.stopPropagation();
|
|
3225
1863
|
deleteField(rowId, columnId, field.id);
|
|
3226
|
-
}, 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:
|
|
1864
|
+
}, 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: jsx(Trash2, { className: "h-3 w-3" }) })), !isPreviewMode && field.conditionalLogic?.enabled && (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: jsx(Info, { className: "h-3 w-3" }) })), !isPreviewMode && field.type !== 'container' && (jsx("div", { className: "absolute inset-0 z-10 cursor-pointer", onClick: handleClick, "data-testid": `field-click-overlay-${field.id}` })), jsxs("div", { className: `${getSpacingClass()} relative ${field.type === 'container' ? 'z-20' : 'z-0'}`, children: [showLabel && (jsxs("div", { className: "flex items-center gap-0.5", children: [jsxs(Label, { className: getLabelClass(), children: [field.props.label, isFieldRequired && (jsx("span", { className: "text-destructive ml-0.5", children: "*" }))] }), field.props.tooltip && (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(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` }) }), jsx(TooltipContent, { children: jsx("p", { className: "max-w-xs", children: field.props.tooltip }) })] }))] })), field.props.helpText && !isInsideContainer && (jsx("p", { className: "text-xs text-muted-foreground", children: field.props.helpText })), jsx("div", { className: `${field.customStyle?.inputClassName || ''} ${fieldSize === 'compact'
|
|
3227
1865
|
? '[&_input]:h-7 [&_input]:text-xs [&_select]:h-7 [&_textarea]:text-xs [&_textarea]:min-h-[60px]'
|
|
3228
1866
|
: fieldSize === 'comfortable'
|
|
3229
1867
|
? '[&_input]:h-11 [&_input]:text-base [&_select]:h-11 [&_textarea]:text-base [&_textarea]:min-h-[120px] [&_input]:px-4 [&_select]:px-4'
|
|
3230
1868
|
: fieldSize === 'normal'
|
|
3231
1869
|
? '[&_input]:h-8 [&_input]:text-sm [&_select]:h-8 [&_textarea]:text-sm [&_textarea]:min-h-[80px]'
|
|
3232
|
-
: ''}`, children: renderFieldContent() }), hasError && (
|
|
1870
|
+
: ''}`, children: renderFieldContent() }), hasError && (jsx("p", { className: `${fieldSize === 'compact' ? 'text-[10px]' : fieldSize === 'comfortable' ? 'text-base' : 'text-sm'} text-destructive`, "data-testid": `field-error-${field.id}`, children: error }))] })] }));
|
|
3233
1871
|
}
|
|
3234
1872
|
|
|
3235
1873
|
function DroppableColumn({ row, column, }) {
|
|
@@ -3281,13 +1919,13 @@ function DroppableColumn({ row, column, }) {
|
|
|
3281
1919
|
default: return 'text-xs';
|
|
3282
1920
|
}
|
|
3283
1921
|
};
|
|
3284
|
-
return (
|
|
1922
|
+
return (jsx("div", { ref: setNodeRef, onClick: handleClick, className: `
|
|
3285
1923
|
${getMinHeight()} rounded-md transition-all duration-150
|
|
3286
1924
|
${isPreviewMode ? '' : 'border border-dashed'}
|
|
3287
1925
|
${isOver ? 'bg-primary/10 border-primary' : isPreviewMode ? '' : 'border-border'}
|
|
3288
1926
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3289
1927
|
${!isPreviewMode ? 'hover:border-muted-foreground cursor-pointer' : ''}
|
|
3290
|
-
`, style: { width: `${gridWidth}%` }, "data-testid": `column-${column.id}`, children: column.fields.length === 0 ? (!isPreviewMode && (
|
|
1928
|
+
`, style: { width: `${gridWidth}%` }, "data-testid": `column-${column.id}`, children: column.fields.length === 0 ? (!isPreviewMode && (jsx("div", { className: `flex items-center justify-center h-full ${getEmptyMinHeight()} ${getTextSize()} text-muted-foreground`, children: "Drop here" }))) : (jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: `${getColumnGap()}px`, padding: `${getColumnPadding()}px` }, children: column.fields.map((field, index) => (jsx(CanvasField, { field: field, rowId: row.id, columnId: column.id, index: index, fieldSize: row.fieldSize }, field.id))) })) }));
|
|
3291
1929
|
}
|
|
3292
1930
|
function CanvasRow({ row, index }) {
|
|
3293
1931
|
const { selection, setSelection, deleteRow, addColumn, isPreviewMode, evaluateCondition } = useFormStore();
|
|
@@ -3359,47 +1997,47 @@ function CanvasRow({ row, index }) {
|
|
|
3359
1997
|
// If this is a container-only row, render with minimal wrapper
|
|
3360
1998
|
if (isSingleContainerRow) {
|
|
3361
1999
|
const containerField = row.columns[0].fields[0];
|
|
3362
|
-
return (
|
|
2000
|
+
return (jsxs("div", { onClick: handleContainerClick, className: `
|
|
3363
2001
|
relative group rounded-lg transition-all duration-150 overflow-visible
|
|
3364
2002
|
${!isPreviewMode ? 'hover:ring-2 hover:ring-primary/30' : ''}
|
|
3365
2003
|
${isSelected && !isPreviewMode ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''}
|
|
3366
|
-
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (
|
|
2004
|
+
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (jsx("button", { onClick: (e) => {
|
|
3367
2005
|
e.stopPropagation();
|
|
3368
2006
|
deleteRow(row.id);
|
|
3369
|
-
}, 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:
|
|
2007
|
+
}, 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: jsx(Trash2, { className: "h-3 w-3" }) })), jsx(CanvasField, { field: containerField, rowId: row.id, columnId: row.columns[0].id })] }));
|
|
3370
2008
|
}
|
|
3371
|
-
return (
|
|
2009
|
+
return (jsxs("div", { onClick: handleContainerClick, className: `
|
|
3372
2010
|
relative group rounded-lg transition-all duration-150 overflow-visible
|
|
3373
2011
|
${isPreviewMode ? '' : 'border bg-card'}
|
|
3374
2012
|
${isSelected && !isPreviewMode ? 'border-primary bg-primary/5 ring-2 ring-primary ring-offset-2 ring-offset-background' : isPreviewMode ? '' : 'border-border'}
|
|
3375
2013
|
${!isPreviewMode ? 'hover:border-muted-foreground' : ''}
|
|
3376
|
-
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (
|
|
2014
|
+
`, "data-testid": `row-${row.id}`, children: [!isPreviewMode && (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: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(GripVertical, { className: `${getIconSize()} text-muted-foreground cursor-grab` }), 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 && (jsx("span", { className: `${getRowTextSize()} text-blue-500 font-medium`, children: "Conditional" }))] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx("button", { onClick: (e) => {
|
|
3377
2015
|
e.stopPropagation();
|
|
3378
2016
|
addColumn(row.id);
|
|
3379
|
-
}, className: "p-1 text-muted-foreground hover:text-foreground rounded", title: "Add column", "data-testid": `button-add-column-inline-${row.id}`, children:
|
|
2017
|
+
}, className: "p-1 text-muted-foreground hover:text-foreground rounded", title: "Add column", "data-testid": `button-add-column-inline-${row.id}`, children: jsx(Plus, { className: getIconSize() }) }), jsx("button", { onClick: (e) => {
|
|
3380
2018
|
e.stopPropagation();
|
|
3381
2019
|
deleteRow(row.id);
|
|
3382
|
-
}, className: "p-1 text-muted-foreground hover:text-destructive rounded", title: "Delete row", "data-testid": `button-delete-row-${row.id}`, children:
|
|
2020
|
+
}, className: "p-1 text-muted-foreground hover:text-destructive rounded", title: "Delete row", "data-testid": `button-delete-row-${row.id}`, children: jsx(Trash2, { className: getIconSize() }) })] })] })), jsx("div", { className: "flex", style: {
|
|
3383
2021
|
gap: isPreviewMode ? 0 : `${(row.spacing ?? getRowSpacingMultiplier()) * 4}px`,
|
|
3384
2022
|
padding: isPreviewMode ? 0 : `${(row.padding ?? getRowPaddingMultiplier()) * 4}px`,
|
|
3385
|
-
}, children: row.columns.map((column) => (
|
|
2023
|
+
}, children: row.columns.map((column) => (jsx(DroppableColumn, { row: row, column: column }, column.id))) })] }));
|
|
3386
2024
|
}
|
|
3387
2025
|
function StepIndicator() {
|
|
3388
2026
|
const { form, currentStepIndex, setCurrentStep, isPreviewMode } = useFormStore();
|
|
3389
2027
|
if (!form.isMultiStep || !form.steps?.length)
|
|
3390
2028
|
return null;
|
|
3391
2029
|
const progress = ((currentStepIndex + 1) / form.steps.length) * 100;
|
|
3392
|
-
return (
|
|
2030
|
+
return (jsxs("div", { className: "mb-6 space-y-4", children: [jsx(Progress, { value: progress, className: "h-2" }), jsx("div", { className: "flex justify-between", children: form.steps.map((step, index) => (jsxs("button", { onClick: () => !isPreviewMode && setCurrentStep(index), className: `
|
|
3393
2031
|
flex flex-col items-center gap-2 transition-all
|
|
3394
2032
|
${!isPreviewMode ? 'cursor-pointer' : ''}
|
|
3395
|
-
`, disabled: isPreviewMode && index > currentStepIndex, children: [
|
|
2033
|
+
`, disabled: isPreviewMode && index > currentStepIndex, children: [jsx("div", { className: `
|
|
3396
2034
|
w-10 h-10 rounded-full flex items-center justify-center font-medium text-sm border-2 transition-all
|
|
3397
2035
|
${index < currentStepIndex
|
|
3398
2036
|
? 'bg-primary border-primary text-primary-foreground'
|
|
3399
2037
|
: index === currentStepIndex
|
|
3400
2038
|
? 'border-primary text-primary bg-primary/10'
|
|
3401
2039
|
: 'border-muted text-muted-foreground bg-muted/30'}
|
|
3402
|
-
`, children: index < currentStepIndex ? (
|
|
2040
|
+
`, children: index < currentStepIndex ? (jsx(Check, { className: "h-5 w-5" })) : (index + 1) }), jsx("span", { className: `text-xs font-medium ${index <= currentStepIndex ? 'text-foreground' : 'text-muted-foreground'}`, children: step.title })] }, step.id))) })] }));
|
|
3403
2041
|
}
|
|
3404
2042
|
function StepNavigation() {
|
|
3405
2043
|
const { form, currentStepIndex, nextStep, prevStep, isPreviewMode } = useFormStore();
|
|
@@ -3407,7 +2045,7 @@ function StepNavigation() {
|
|
|
3407
2045
|
return null;
|
|
3408
2046
|
const isFirstStep = currentStepIndex === 0;
|
|
3409
2047
|
const isLastStep = currentStepIndex === form.steps.length - 1;
|
|
3410
|
-
return (
|
|
2048
|
+
return (jsxs("div", { className: "flex justify-between mt-6 pt-6 border-t border-border", children: [jsxs(Button, { variant: "outline", onClick: prevStep, disabled: isFirstStep, className: "gap-2", children: [jsx(ChevronLeft, { className: "h-4 w-4" }), "Previous"] }), isLastStep ? (jsxs(Button, { className: "gap-2", children: [jsx(Check, { className: "h-4 w-4" }), "Submit"] })) : (jsxs(Button, { onClick: nextStep, className: "gap-2", children: ["Next", jsx(ChevronRight, { className: "h-4 w-4" })] }))] }));
|
|
3411
2049
|
}
|
|
3412
2050
|
const canvasWidthClasses = {
|
|
3413
2051
|
compact: 'max-w-2xl',
|
|
@@ -3426,23 +2064,23 @@ function MultiStepCanvas() {
|
|
|
3426
2064
|
accepts: 'field',
|
|
3427
2065
|
},
|
|
3428
2066
|
});
|
|
3429
|
-
return (
|
|
2067
|
+
return (jsx("div", { ref: setNodeRef, className: `
|
|
3430
2068
|
min-h-full p-8
|
|
3431
2069
|
${isOver ? 'bg-primary/5' : ''}
|
|
3432
2070
|
`, style: {
|
|
3433
2071
|
backgroundImage: 'radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)',
|
|
3434
2072
|
backgroundSize: '24px 24px',
|
|
3435
|
-
}, children:
|
|
2073
|
+
}, children: jsxs("div", { className: `${canvasWidthClasses[canvasWidth]} mx-auto`, children: [jsx(StepIndicator, {}), !isPreviewMode && currentStep && (jsx("div", { className: "mb-4 p-4 bg-card rounded-lg border border-border", children: jsxs("button", { onClick: (e) => {
|
|
3436
2074
|
e.stopPropagation();
|
|
3437
2075
|
setSelection({ type: 'step', stepId: currentStep.id });
|
|
3438
|
-
}, className: "text-left w-full", "data-testid": "button-step-header", children: [
|
|
2076
|
+
}, className: "text-left w-full", "data-testid": "button-step-header", children: [jsx("h3", { className: "font-semibold text-lg", children: currentStep.title }), currentStep.description && (jsx("p", { className: "text-sm text-muted-foreground mt-1", children: currentStep.description }))] }) })), isPreviewMode && currentStep && (jsxs("div", { className: "mb-6", children: [jsx("h2", { className: "text-2xl font-bold", children: currentStep.title }), currentStep.description && (jsx("p", { className: "text-muted-foreground mt-2", children: currentStep.description }))] })), rows.length === 0 ? (jsxs("div", { className: "flex flex-col items-center justify-center min-h-[200px] text-center border-2 border-dashed border-border rounded-lg", children: [jsx("p", { className: "text-muted-foreground mb-4", children: "This step has no fields yet" }), !isPreviewMode && (jsxs(Button, { onClick: () => addRow(1), className: "gap-2", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Row"] }))] })) : (jsxs("div", { className: "space-y-4", children: [rows.map((row, index) => (jsx(CanvasRow, { row: row, index: index }, row.id))), !isPreviewMode && (jsx("div", { className: "flex justify-center pt-4", children: jsxs(Button, { variant: "outline", onClick: () => addRow(1), className: "gap-2", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Row"] }) }))] })), jsx(StepNavigation, {}), !isPreviewMode && (jsx("div", { className: "mt-8 pt-8 border-t border-border", children: jsxs("div", { className: "flex flex-wrap gap-2", children: [form.steps?.map((step, index) => (jsxs("div", { className: "flex items-center gap-1", children: [jsxs(Button, { variant: index === currentStepIndex ? 'default' : 'outline', size: "sm", onClick: (e) => {
|
|
3439
2077
|
e.stopPropagation();
|
|
3440
2078
|
setCurrentStep(index);
|
|
3441
2079
|
setSelection({ type: 'step', stepId: step.id });
|
|
3442
|
-
}, "data-testid": `button-step-${index + 1}`, children: ["Step ", index + 1] }), (form.steps?.length || 0) > 1 && (
|
|
2080
|
+
}, "data-testid": `button-step-${index + 1}`, children: ["Step ", index + 1] }), (form.steps?.length || 0) > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 text-muted-foreground hover:text-destructive", onClick: (e) => {
|
|
3443
2081
|
e.stopPropagation();
|
|
3444
2082
|
deleteStep(step.id);
|
|
3445
|
-
}, "data-testid": `button-delete-step-${index}`, children:
|
|
2083
|
+
}, "data-testid": `button-delete-step-${index}`, children: jsx(Trash2, { className: "h-3 w-3" }) }))] }, step.id))), jsxs(Button, { variant: "outline", size: "sm", onClick: addStep, className: "gap-1", children: [jsx(Plus, { className: "h-3 w-3" }), "Add Step"] })] }) }))] }) }));
|
|
3446
2084
|
}
|
|
3447
2085
|
function SingleFormCanvas() {
|
|
3448
2086
|
const { form, addRow, clearSelection, isPreviewMode, canvasWidth } = useFormStore();
|
|
@@ -3456,20 +2094,20 @@ function SingleFormCanvas() {
|
|
|
3456
2094
|
const handleCanvasClick = () => {
|
|
3457
2095
|
clearSelection();
|
|
3458
2096
|
};
|
|
3459
|
-
return (
|
|
2097
|
+
return (jsx("div", { ref: setNodeRef, onClick: handleCanvasClick, className: `
|
|
3460
2098
|
min-h-full p-8
|
|
3461
2099
|
${isOver ? 'bg-primary/5' : ''}
|
|
3462
2100
|
`, style: {
|
|
3463
2101
|
backgroundImage: 'radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)',
|
|
3464
2102
|
backgroundSize: '24px 24px',
|
|
3465
|
-
}, children: form.rows.length === 0 ? (
|
|
2103
|
+
}, children: form.rows.length === 0 ? (jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-center", children: [jsx("div", { className: "w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-4", children: jsx(Plus, { className: "h-10 w-10 text-muted-foreground" }) }), jsx("h2", { className: "text-xl font-semibold text-foreground mb-2", children: "Start building your form" }), jsx("p", { className: "text-muted-foreground mb-6 max-w-md", children: "Drag components from the left sidebar to get started" })] })) : (jsxs("div", { className: `space-y-4 ${canvasWidthClasses[canvasWidth]} mx-auto`, children: [form.rows.map((row, index) => (jsx(CanvasRow, { row: row, index: index }, row.id))), !isPreviewMode && (jsx("div", { className: "flex justify-center pt-4", children: jsxs(Button, { variant: "outline", onClick: () => addRow(1), className: "gap-2", "data-testid": "button-add-row", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Row"] }) }))] })) }));
|
|
3466
2104
|
}
|
|
3467
2105
|
function FormCanvas() {
|
|
3468
2106
|
const { form, clearSelection } = useFormStore();
|
|
3469
2107
|
const handleCanvasClick = () => {
|
|
3470
2108
|
clearSelection();
|
|
3471
2109
|
};
|
|
3472
|
-
return (
|
|
2110
|
+
return (jsx("main", { className: "flex-1 bg-background overflow-hidden", onClick: handleCanvasClick, children: jsx(ScrollArea, { className: "h-full", children: form.isMultiStep ? jsx(MultiStepCanvas, {}) : jsx(SingleFormCanvas, {}) }) }));
|
|
3473
2111
|
}
|
|
3474
2112
|
|
|
3475
2113
|
const Collapsible = CollapsiblePrimitive.Root;
|
|
@@ -3477,11 +2115,11 @@ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
|
3477
2115
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
3478
2116
|
|
|
3479
2117
|
const Tabs = TabsPrimitive.Root;
|
|
3480
|
-
const TabsList = React.forwardRef(({ className, ...props }, ref) => (
|
|
2118
|
+
const TabsList = React.forwardRef(({ className, ...props }, ref) => (jsx(TabsPrimitive.List, { ref: ref, className: cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", className), ...props })));
|
|
3481
2119
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
3482
|
-
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (
|
|
2120
|
+
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (jsx(TabsPrimitive.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 })));
|
|
3483
2121
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
3484
|
-
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (
|
|
2122
|
+
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (jsx(TabsPrimitive.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 })));
|
|
3485
2123
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
3486
2124
|
|
|
3487
2125
|
function RowProperties() {
|
|
@@ -3490,7 +2128,7 @@ function RowProperties() {
|
|
|
3490
2128
|
const row = getSelectedRow();
|
|
3491
2129
|
if (!row)
|
|
3492
2130
|
return null;
|
|
3493
|
-
return (
|
|
2131
|
+
return (jsx("div", { className: "p-4 space-y-6", children: jsxs("div", { children: [jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Row Properties" }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx("span", { className: "text-sm text-foreground", children: "Columns" }), jsx("span", { className: "text-sm font-medium text-foreground", children: row.columns.length })] }), jsx("div", { className: "flex gap-2", children: jsxs(Button, { variant: "outline", size: "sm", onClick: () => addColumn(row.id), className: "flex-1 gap-2", "data-testid": "button-add-column", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Column"] }) }), row.columns.length > 0 && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-xs text-muted-foreground", children: "Column Management" }), jsx("div", { className: "space-y-1", children: row.columns.map((col, idx) => (jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/50 rounded-md", children: [jsxs("span", { className: "text-xs font-medium flex-1", children: ["Col ", idx + 1, " ", jsxs("span", { className: "text-muted-foreground", children: ["(", col.width, "/12)"] })] }), jsxs("span", { className: "text-xs text-muted-foreground", children: [col.fields.length, " field", col.fields.length !== 1 ? 's' : ''] }), 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: jsx(Trash2, { className: "h-3 w-3 text-destructive" }) })] }, col.id))) })] })), jsx(Separator, {}), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Inner Field Size (Density)" }), jsxs(Select, { value: row.fieldSize || 'normal', onValueChange: (value) => updateRow(row.id, { fieldSize: value }), children: [jsx(SelectTrigger, { "data-testid": "row-field-size", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "compact", children: "Compact (Minimal)" }), jsx(SelectItem, { value: "normal", children: "Normal" }), jsx(SelectItem, { value: "comfortable", children: "Comfortable (Spacious)" })] })] }), jsx("p", { className: "text-xs text-muted-foreground", children: "Controls padding and font sizes for all fields in this row" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Spacing (Gap between fields)" }), 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" }), jsx("p", { className: "text-xs text-muted-foreground", children: "0 = no gap, higher = more space" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Padding (Inner space)" }), 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" }), jsx("p", { className: "text-xs text-muted-foreground", children: "0 = no padding, higher = more space" })] }), jsx(Separator, {}), jsxs(Collapsible, { open: conditionalOpen, onOpenChange: setConditionalOpen, children: [jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Zap, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Conditional Logic" })] }), jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${conditionalOpen ? 'rotate-180' : ''}` })] }), jsx(CollapsibleContent, { className: "pt-4", children: jsx("div", { className: "space-y-4", children: jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Enable" }), jsx(Switch, { checked: row.conditionalLogic?.enabled || false, onCheckedChange: (checked) => updateRow(row.id, {
|
|
3494
2132
|
conditionalLogic: {
|
|
3495
2133
|
...row.conditionalLogic,
|
|
3496
2134
|
enabled: checked,
|
|
@@ -3498,7 +2136,7 @@ function RowProperties() {
|
|
|
3498
2136
|
logicType: row.conditionalLogic?.logicType || 'all',
|
|
3499
2137
|
conditions: row.conditionalLogic?.conditions || [],
|
|
3500
2138
|
}
|
|
3501
|
-
}) })] }) }) })] }),
|
|
2139
|
+
}) })] }) }) })] }), jsx(Separator, {}), 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: [jsx(Trash2, { className: "h-4 w-4" }), "Delete Row"] })] })] }) }));
|
|
3502
2140
|
}
|
|
3503
2141
|
function ColumnProperties() {
|
|
3504
2142
|
const { getSelectedColumn, updateColumn, deleteColumn, duplicateColumn } = useFormStore();
|
|
@@ -3507,33 +2145,33 @@ function ColumnProperties() {
|
|
|
3507
2145
|
if (!result)
|
|
3508
2146
|
return null;
|
|
3509
2147
|
const { row, column } = result;
|
|
3510
|
-
return (
|
|
2148
|
+
return (jsx("div", { className: "p-4 space-y-6", children: jsxs("div", { children: [jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Column Properties" }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Width (1-12)" }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Button, { variant: "outline", size: "icon", onClick: () => {
|
|
3511
2149
|
if (column.width > 1) {
|
|
3512
2150
|
updateColumn(row.id, column.id, { width: column.width - 1 });
|
|
3513
2151
|
}
|
|
3514
|
-
}, disabled: column.width <= 1, "data-testid": "button-decrease-width", children:
|
|
2152
|
+
}, disabled: column.width <= 1, "data-testid": "button-decrease-width", children: jsx(Minus, { className: "h-4 w-4" }) }), jsx(Input, { type: "number", min: 1, max: 12, value: column.width, onChange: (e) => {
|
|
3515
2153
|
const width = Math.min(12, Math.max(1, parseInt(e.target.value) || 1));
|
|
3516
2154
|
updateColumn(row.id, column.id, { width });
|
|
3517
|
-
}, className: "w-20 text-center", "data-testid": "input-column-width" }),
|
|
2155
|
+
}, className: "w-20 text-center", "data-testid": "input-column-width" }), jsx(Button, { variant: "outline", size: "icon", onClick: () => {
|
|
3518
2156
|
if (column.width < 12) {
|
|
3519
2157
|
updateColumn(row.id, column.id, { width: column.width + 1 });
|
|
3520
2158
|
}
|
|
3521
|
-
}, disabled: column.width >= 12, "data-testid": "button-increase-width", children:
|
|
2159
|
+
}, disabled: column.width >= 12, "data-testid": "button-increase-width", children: jsx(Plus, { className: "h-4 w-4" }) })] }), jsxs("p", { className: "text-xs text-muted-foreground", children: [Math.round((column.width / 12) * 100), "% of row width"] })] }), jsx(Separator, {}), jsxs(Collapsible, { open: responsiveOpen, onOpenChange: setResponsiveOpen, children: [jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full", children: [jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Responsive Widths" }), jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${responsiveOpen ? 'rotate-180' : ''}` })] }), jsx(CollapsibleContent, { className: "pt-4", children: jsxs("div", { className: "space-y-3", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Mobile (1-12)" }), jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.mobile || '', placeholder: "12", onChange: (e) => {
|
|
3522
2160
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3523
2161
|
updateColumn(row.id, column.id, {
|
|
3524
2162
|
responsiveWidth: { ...column.responsiveWidth, mobile: val },
|
|
3525
2163
|
});
|
|
3526
|
-
} })] }),
|
|
2164
|
+
} })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Tablet (1-12)" }), jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.tablet || '', placeholder: "6", onChange: (e) => {
|
|
3527
2165
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3528
2166
|
updateColumn(row.id, column.id, {
|
|
3529
2167
|
responsiveWidth: { ...column.responsiveWidth, tablet: val },
|
|
3530
2168
|
});
|
|
3531
|
-
} })] }),
|
|
2169
|
+
} })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Desktop (1-12)" }), jsx(Input, { type: "number", min: 1, max: 12, value: column.responsiveWidth?.desktop || '', placeholder: String(column.width), onChange: (e) => {
|
|
3532
2170
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3533
2171
|
updateColumn(row.id, column.id, {
|
|
3534
2172
|
responsiveWidth: { ...column.responsiveWidth, desktop: val },
|
|
3535
2173
|
});
|
|
3536
|
-
} })] })] }) })] }),
|
|
2174
|
+
} })] })] }) })] }), jsx(Separator, {}), jsx("div", { className: "flex gap-2", children: jsxs(Button, { variant: "outline", size: "sm", onClick: () => duplicateColumn(row.id, column.id), className: "flex-1 gap-2", "data-testid": "button-duplicate-column", children: [jsx(Copy, { className: "h-4 w-4" }), "Duplicate"] }) }), 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: [jsx(Trash2, { className: "h-4 w-4" }), "Delete Column"] })] })] }) }));
|
|
3537
2175
|
}
|
|
3538
2176
|
function FieldProperties() {
|
|
3539
2177
|
const { getSelectedField, updateField, deleteField, getAllFields } = useFormStore();
|
|
@@ -3632,38 +2270,38 @@ function FieldProperties() {
|
|
|
3632
2270
|
const currentActions = (field.events?.[eventType] || []).filter((_, i) => i !== index);
|
|
3633
2271
|
handleUpdateEvents(eventType, currentActions);
|
|
3634
2272
|
};
|
|
3635
|
-
return (
|
|
2273
|
+
return (jsx("div", { className: "p-4", children: jsxs(Tabs, { defaultValue: "main", className: "w-full", children: [jsxs(TabsList, { className: "grid w-full grid-cols-4 mb-4", children: [jsx(TabsTrigger, { value: "main", className: "text-xs", children: "Main" }), jsx(TabsTrigger, { value: "style", className: "text-xs", children: "Style" }), jsx(TabsTrigger, { value: "actions", className: "text-xs", children: "Actions" }), jsx(TabsTrigger, { value: "rules", className: "text-xs", children: "Rules" })] }), jsxs(TabsContent, { value: "main", className: "space-y-4 mt-0", children: [(() => {
|
|
3636
2274
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode'];
|
|
3637
2275
|
const textOnlyTypes = ['header', 'subheader', 'label', 'paragraph', 'alert'];
|
|
3638
2276
|
const isStaticDisplay = staticDisplayTypes.includes(field.type);
|
|
3639
2277
|
const isTextOnly = textOnlyTypes.includes(field.type);
|
|
3640
|
-
return (
|
|
3641
|
-
})(), isInsideContainer && (
|
|
2278
|
+
return (jsxs(Fragment, { children: [isTextOnly && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Text" }), jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), "data-testid": "input-field-label" })] })), field.type === 'spacer' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Height (px)" }), 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' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Margin (px)" }), 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' && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Alt Text" }), jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), placeholder: "Image description..." })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Image URL" }), jsx(Input, { value: field.props.imageUrl || '', onChange: (e) => handleUpdateProp('imageUrl', e.target.value), placeholder: "https://example.com/image.jpg" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Width" }), jsx(Input, { value: field.props.imageWidth || '', onChange: (e) => handleUpdateProp('imageWidth', e.target.value), placeholder: "100% or 200px" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Height" }), jsx(Input, { value: field.props.imageHeight || '', onChange: (e) => handleUpdateProp('imageHeight', e.target.value), placeholder: "auto or 150px" })] })] })), !isStaticDisplay && field.type !== 'button' && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Key" }), jsx(Input, { value: field.props.key, onChange: (e) => handleUpdateProp('key', e.target.value), className: "font-mono text-sm", "data-testid": "input-field-key" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Label" }), jsx(Input, { value: field.props.label, onChange: (e) => handleUpdateProp('label', e.target.value), "data-testid": "input-field-label" })] })] })), field.type === 'button' && (jsx(Fragment, { children: jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Button Text" }), 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' && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Placeholder" }), jsx(Input, { value: field.props.placeholder || '', onChange: (e) => handleUpdateProp('placeholder', e.target.value), "data-testid": "input-field-placeholder" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Help Text" }), jsx(Input, { value: field.props.helpText || '', onChange: (e) => handleUpdateProp('helpText', e.target.value), placeholder: "Additional instructions..." })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Tooltip" }), jsx(Input, { value: field.props.tooltip || '', onChange: (e) => handleUpdateProp('tooltip', e.target.value), placeholder: "Hover tooltip text..." }), jsx("p", { className: "text-xs text-muted-foreground", children: "Shows a help icon next to the label" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Default Value" }), jsx(Input, { value: field.props.defaultValue || '', onChange: (e) => handleUpdateProp('defaultValue', e.target.value) })] })] })), !isInsideContainer && !isStaticDisplay && field.type !== 'button' && field.type !== 'container' && field.type !== 'table' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Size" }), jsxs(Select, { value: field.props.size || 'medium', onValueChange: (value) => handleUpdateProp('size', value), children: [jsx(SelectTrigger, { "data-testid": "select-field-size", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "small", children: "Small" }), jsx(SelectItem, { value: "medium", children: "Medium" }), jsx(SelectItem, { value: "large", children: "Large" })] })] })] }))] }));
|
|
2279
|
+
})(), isInsideContainer && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Width" }), jsxs(Select, { value: field.props.containerWidth || 'auto', onValueChange: (value) => handleUpdateProp('containerWidth', value), children: [jsx(SelectTrigger, { "data-testid": "select-container-width", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "auto", children: "Auto (flexible)" }), jsx(SelectItem, { value: "25", children: "25%" }), jsx(SelectItem, { value: "33", children: "33% (1/3)" }), jsx(SelectItem, { value: "50", children: "50% (1/2)" }), jsx(SelectItem, { value: "66", children: "66% (2/3)" }), jsx(SelectItem, { value: "75", children: "75%" }), jsx(SelectItem, { value: "100", children: "100% (full width)" })] })] })] })), (() => {
|
|
3642
2280
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3643
2281
|
const showFocusProps = !staticDisplayTypes.includes(field.type) && field.type !== 'table' && field.type !== 'container';
|
|
3644
2282
|
if (!showFocusProps)
|
|
3645
2283
|
return null;
|
|
3646
|
-
return (
|
|
3647
|
-
})(),
|
|
2284
|
+
return (jsxs(Fragment, { children: [jsx(Separator, {}), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Auto Focus" }), jsx(Switch, { checked: field.props.autoFocus || false, onCheckedChange: (checked) => handleUpdateProp('autoFocus', checked) })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Tab Index" }), jsx(Input, { type: "number", value: field.props.tabIndex ?? '', onChange: (e) => handleUpdateProp('tabIndex', e.target.value ? parseInt(e.target.value) : undefined), placeholder: "Auto" })] })] }));
|
|
2285
|
+
})(), jsxs(Collapsible, { children: [jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full py-2", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Code, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: "HTML Attributes" })] }), jsx(ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxs(CollapsibleContent, { className: "space-y-3 pt-2", children: [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) => (jsxs("div", { className: "flex gap-2", children: [jsx(Input, { value: key, placeholder: "Attribute", className: "flex-1 font-mono text-xs", onChange: (e) => {
|
|
3648
2286
|
const attrs = { ...field.props.htmlAttributes };
|
|
3649
2287
|
delete attrs[key];
|
|
3650
2288
|
attrs[e.target.value] = value;
|
|
3651
2289
|
handleUpdateProp('htmlAttributes', attrs);
|
|
3652
|
-
} }),
|
|
2290
|
+
} }), jsx(Input, { value: value, placeholder: "Value", className: "flex-1 font-mono text-xs", onChange: (e) => {
|
|
3653
2291
|
handleUpdateProp('htmlAttributes', {
|
|
3654
2292
|
...field.props.htmlAttributes,
|
|
3655
2293
|
[key]: e.target.value,
|
|
3656
2294
|
});
|
|
3657
|
-
} }),
|
|
2295
|
+
} }), jsx(Button, { variant: "ghost", size: "icon", onClick: () => {
|
|
3658
2296
|
const attrs = { ...field.props.htmlAttributes };
|
|
3659
2297
|
delete attrs[key];
|
|
3660
2298
|
handleUpdateProp('htmlAttributes', Object.keys(attrs).length > 0 ? attrs : undefined);
|
|
3661
|
-
}, children:
|
|
2299
|
+
}, children: jsx(Trash2, { className: "h-4 w-4" }) })] }, i))), jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
3662
2300
|
handleUpdateProp('htmlAttributes', {
|
|
3663
2301
|
...field.props.htmlAttributes,
|
|
3664
2302
|
'': '',
|
|
3665
2303
|
});
|
|
3666
|
-
}, className: "w-full gap-2", children: [jsxRuntimeExports.jsx(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(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(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: () => {
|
|
2304
|
+
}, className: "w-full gap-2", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Attribute"] })] })] }), jsx(Separator, {}), hasOptions && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Options" }), jsxs("div", { className: "space-y-2", children: [getOptionsArray().map((option, i) => (jsxs("div", { className: "flex gap-2", children: [jsx(Input, { value: option, onChange: (e) => handleUpdateOption(i, e.target.value), className: "flex-1", "data-testid": `input-option-${i}` }), jsx(Button, { variant: "outline", size: "icon", onClick: () => handleRemoveOption(i), "data-testid": `button-remove-option-${i}`, children: jsx(Trash2, { className: "h-4 w-4" }) })] }, i))), jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddOption, className: "w-full gap-2", "data-testid": "button-add-option", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Option"] })] })] })), field.type === 'button' && (jsxs("div", { className: "space-y-4", children: [jsx(Separator, {}), jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Button Settings" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Action" }), jsxs(Select, { value: field.props.buttonConfig?.action || 'submit', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, action: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "submit", children: "Submit Form" }), jsx(SelectItem, { value: "reset", children: "Reset Form" }), jsx(SelectItem, { value: "custom", children: "Custom Action" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Variant" }), jsxs(Select, { value: field.props.buttonConfig?.variant || 'default', onValueChange: (value) => handleUpdateProp('buttonConfig', { ...field.props.buttonConfig, variant: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "default", children: "Default" }), jsx(SelectItem, { value: "outline", children: "Outline" }), jsx(SelectItem, { value: "secondary", children: "Secondary" }), jsx(SelectItem, { value: "destructive", children: "Destructive" }), jsx(SelectItem, { value: "ghost", children: "Ghost" })] })] })] })] })), field.type === 'pattern' && (jsxs("div", { className: "space-y-4", children: [jsx(Separator, {}), jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Pattern Format" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Format Pattern" }), jsx(Input, { value: field.props.patternConfig?.format || '(###) ###-####', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, format: e.target.value }), placeholder: "(###) ###-####" }), jsx("p", { className: "text-xs text-muted-foreground", children: "Use # for digit placeholders" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Mask Character" }), jsx(Input, { value: field.props.patternConfig?.mask || '_', onChange: (e) => handleUpdateProp('patternConfig', { ...field.props.patternConfig, mask: e.target.value }), maxLength: 1 })] })] })), field.type === 'qrcode' && (jsxs("div", { className: "space-y-4", children: [jsx(Separator, {}), jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "QR Code Settings" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "QR Value" }), 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" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Size (px)" }), 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' && (jsxs("div", { className: "space-y-4", children: [jsx(Separator, {}), jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Container Settings" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Direction" }), jsxs(Select, { value: field.props.containerConfig?.direction || 'row', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, direction: value }), children: [jsx(SelectTrigger, { "data-testid": "select-container-direction", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "row", children: "Row (Horizontal)" }), jsx(SelectItem, { value: "column", children: "Column (Vertical)" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Inner Field Size (Density)" }), jsxs(Select, { value: field.props.containerConfig?.fieldSize || 'normal', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, fieldSize: value }), children: [jsx(SelectTrigger, { "data-testid": "container-field-size", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "compact", "data-testid": "field-size-compact", children: "Compact (Minimal)" }), jsx(SelectItem, { value: "normal", "data-testid": "field-size-normal", children: "Normal" }), jsx(SelectItem, { value: "comfortable", "data-testid": "field-size-comfortable", children: "Comfortable (Spacious)" })] })] }), jsx("p", { className: "text-xs text-muted-foreground", children: "Controls padding and font sizes for fields inside this container" })] }), jsx(Separator, {}), jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Spacing & Layout" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Gap (between items)" }), 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 }), jsx("p", { className: "text-xs text-muted-foreground", children: "Space between child elements (0-16)" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Padding (inner space)" }), 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 }), jsx("p", { className: "text-xs text-muted-foreground", children: "Inner spacing around content (0-16)" })] }), jsx(Separator, {}), jsx("h5", { className: "text-xs font-medium text-muted-foreground", children: "Flex Properties" }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Justify Content" }), jsxs(Select, { value: field.props.containerConfig?.justifyContent || 'flex-start', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, justifyContent: value }), children: [jsx(SelectTrigger, { "data-testid": "select-justify-content", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "flex-start", children: "Start" }), jsx(SelectItem, { value: "flex-end", children: "End" }), jsx(SelectItem, { value: "center", children: "Center" }), jsx(SelectItem, { value: "space-between", children: "Space Between" }), jsx(SelectItem, { value: "space-around", children: "Space Around" }), jsx(SelectItem, { value: "space-evenly", children: "Space Evenly" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Align Items" }), jsxs(Select, { value: field.props.containerConfig?.alignItems || 'stretch', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, alignItems: value }), children: [jsx(SelectTrigger, { "data-testid": "select-align-items", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "flex-start", children: "Start" }), jsx(SelectItem, { value: "flex-end", children: "End" }), jsx(SelectItem, { value: "center", children: "Center" }), jsx(SelectItem, { value: "stretch", children: "Stretch" }), jsx(SelectItem, { value: "baseline", children: "Baseline" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Flex Wrap" }), jsxs(Select, { value: field.props.containerConfig?.flexWrap || 'wrap', onValueChange: (value) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, flexWrap: value }), children: [jsx(SelectTrigger, { "data-testid": "select-flex-wrap", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "wrap", children: "Wrap" }), jsx(SelectItem, { value: "nowrap", children: "No Wrap" })] })] })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Show Border" }), jsx(Switch, { checked: field.props.containerConfig?.border || false, onCheckedChange: (checked) => handleUpdateProp('containerConfig', { ...field.props.containerConfig, border: checked }) })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx("h5", { className: "text-sm font-medium", children: "Container Fields" }), jsxs("span", { className: "text-xs text-muted-foreground", children: [(field.props.containerConfig?.fields || []).length, " field(s)"] })] }), 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' && (jsxs("div", { className: "space-y-4 p-3 bg-muted/30 rounded-md", children: [jsx("h4", { className: "text-sm font-medium", children: "Table Configuration" }), jsxs("div", { className: "space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Show Row Numbers" }), jsx(Switch, { checked: field.props.tableConfig?.showRowNumbers ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, showRowNumbers: checked }) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Allow Add Rows" }), jsx(Switch, { checked: field.props.tableConfig?.allowAddRows ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowAddRows: checked }) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Allow Delete Rows" }), jsx(Switch, { checked: field.props.tableConfig?.allowDeleteRows ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, allowDeleteRows: checked }) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Striped Rows" }), jsx(Switch, { checked: field.props.tableConfig?.striped ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, striped: checked }) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Bordered" }), jsx(Switch, { checked: field.props.tableConfig?.bordered ?? true, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, bordered: checked }) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Compact" }), jsx(Switch, { checked: field.props.tableConfig?.compact ?? false, onCheckedChange: (checked) => handleUpdateProp('tableConfig', { ...field.props.tableConfig, compact: checked }) })] })] }), jsx(Separator, {}), jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Min Rows" }), 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 })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Max Rows" }), 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 })] })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx("h5", { className: "text-sm font-medium", children: "Columns" }), jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
3667
2305
|
const currentColumns = field.props.tableConfig?.columns || [];
|
|
3668
2306
|
const newColumn = {
|
|
3669
2307
|
key: `col_${Date.now()}`,
|
|
@@ -3671,102 +2309,102 @@ function FieldProperties() {
|
|
|
3671
2309
|
type: 'text',
|
|
3672
2310
|
};
|
|
3673
2311
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: [...currentColumns, newColumn] });
|
|
3674
|
-
}, children: [
|
|
2312
|
+
}, children: [jsx(Plus, { className: "h-4 w-4 mr-1" }), "Add Column"] })] }), (field.props.tableConfig?.columns || []).map((col, colIndex) => (jsxs("div", { className: "p-3 bg-background rounded-md border border-border space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: ["Column ", colIndex + 1] }), jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => {
|
|
3675
2313
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3676
2314
|
currentColumns.splice(colIndex, 1);
|
|
3677
2315
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3678
|
-
}, children:
|
|
2316
|
+
}, children: jsx(Trash2, { className: "h-3 w-3 text-destructive" }) })] }), jsxs("div", { className: "grid grid-cols-2 gap-2", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Key" }), jsx(Input, { value: col.key, onChange: (e) => {
|
|
3679
2317
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3680
2318
|
currentColumns[colIndex] = { ...col, key: e.target.value };
|
|
3681
2319
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3682
|
-
}, placeholder: "column_key", className: "text-xs h-8" })] }),
|
|
2320
|
+
}, placeholder: "column_key", className: "text-xs h-8" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Label" }), jsx(Input, { value: col.label, onChange: (e) => {
|
|
3683
2321
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3684
2322
|
currentColumns[colIndex] = { ...col, label: e.target.value };
|
|
3685
2323
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3686
|
-
}, placeholder: "Column Label", className: "text-xs h-8" })] })] }),
|
|
2324
|
+
}, placeholder: "Column Label", className: "text-xs h-8" })] })] }), jsxs("div", { className: "grid grid-cols-3 gap-2", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Type" }), jsxs(Select, { value: col.type || 'text', onValueChange: (value) => {
|
|
3687
2325
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3688
2326
|
currentColumns[colIndex] = { ...col, type: value };
|
|
3689
2327
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3690
|
-
}, children: [
|
|
2328
|
+
}, children: [jsx(SelectTrigger, { className: "h-8 text-xs", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "text", children: "Text" }), jsx(SelectItem, { value: "number", children: "Number" }), jsx(SelectItem, { value: "email", children: "Email" }), jsx(SelectItem, { value: "date", children: "Date" }), jsx(SelectItem, { value: "select", children: "Select" }), jsx(SelectItem, { value: "checkbox", children: "Checkbox" })] })] })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Width" }), jsx(Input, { value: col.width || '', onChange: (e) => {
|
|
3691
2329
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3692
2330
|
currentColumns[colIndex] = { ...col, width: e.target.value };
|
|
3693
2331
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3694
|
-
}, placeholder: "auto", className: "text-xs h-8" })] }),
|
|
2332
|
+
}, placeholder: "auto", className: "text-xs h-8" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Required" }), jsx("div", { className: "flex items-center h-8", children: jsx(Switch, { checked: col.required || false, onCheckedChange: (checked) => {
|
|
3695
2333
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3696
2334
|
currentColumns[colIndex] = { ...col, required: checked };
|
|
3697
2335
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3698
|
-
} }) })] })] }), col.type === 'select' && (
|
|
2336
|
+
} }) })] })] }), col.type === 'select' && (jsxs("div", { className: "space-y-2 pt-2 border-t border-border", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-xs font-medium", children: "Select Options" }), jsxs(Button, { variant: "outline", size: "sm", className: "h-6 text-xs", onClick: () => {
|
|
3699
2337
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3700
2338
|
const currentOptions = col.options || [];
|
|
3701
2339
|
const newOption = { label: `Option ${currentOptions.length + 1}`, value: `option_${currentOptions.length + 1}` };
|
|
3702
2340
|
currentColumns[colIndex] = { ...col, options: [...currentOptions, newOption] };
|
|
3703
2341
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3704
|
-
}, children: [
|
|
2342
|
+
}, children: [jsx(Plus, { className: "h-3 w-3 mr-1" }), "Add"] })] }), jsxs("div", { className: "grid grid-cols-[1fr_1fr_auto] gap-1 text-[10px] text-muted-foreground px-1", children: [jsx("span", { children: "Label" }), jsx("span", { children: "Value" }), jsx("span", { className: "w-6" })] }), (col.options || []).map((opt, optIndex) => (jsxs("div", { className: "grid grid-cols-[1fr_1fr_auto] gap-1 items-center", children: [jsx(Input, { value: opt.label, onChange: (e) => {
|
|
3705
2343
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3706
2344
|
const currentOptions = [...(col.options || [])];
|
|
3707
2345
|
currentOptions[optIndex] = { ...opt, label: e.target.value };
|
|
3708
2346
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3709
2347
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3710
|
-
}, placeholder: "Evet", className: "text-xs h-7" }),
|
|
2348
|
+
}, placeholder: "Evet", className: "text-xs h-7" }), jsx(Input, { value: opt.value, onChange: (e) => {
|
|
3711
2349
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3712
2350
|
const currentOptions = [...(col.options || [])];
|
|
3713
2351
|
currentOptions[optIndex] = { ...opt, value: e.target.value };
|
|
3714
2352
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3715
2353
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3716
|
-
}, placeholder: "yes", className: "text-xs h-7" }),
|
|
2354
|
+
}, placeholder: "yes", className: "text-xs h-7" }), jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => {
|
|
3717
2355
|
const currentColumns = [...(field.props.tableConfig?.columns || [])];
|
|
3718
2356
|
const currentOptions = [...(col.options || [])];
|
|
3719
2357
|
currentOptions.splice(optIndex, 1);
|
|
3720
2358
|
currentColumns[colIndex] = { ...col, options: currentOptions };
|
|
3721
2359
|
handleUpdateProp('tableConfig', { ...field.props.tableConfig, columns: currentColumns });
|
|
3722
|
-
}, children:
|
|
2360
|
+
}, children: jsx(Trash2, { className: "h-3 w-3 text-destructive" }) })] }, optIndex))), (!col.options || col.options.length === 0) && (jsx("p", { className: "text-xs text-muted-foreground italic", children: "Hen\u00FCz se\u00E7enek eklenmedi" }))] }))] }, col.key)))] })] })), (() => {
|
|
3723
2361
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3724
2362
|
if (staticDisplayTypes.includes(field.type))
|
|
3725
2363
|
return null;
|
|
3726
|
-
return (
|
|
3727
|
-
})(),
|
|
2364
|
+
return (jsxs(Fragment, { children: [jsx(Separator, {}), jsxs("div", { className: "space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Required" }), jsx(Switch, { checked: field.validation?.required || false, onCheckedChange: (checked) => handleUpdateValidation('required', checked), "data-testid": "switch-required" })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Disabled" }), jsx(Switch, { checked: field.props.disabled || false, onCheckedChange: (checked) => handleUpdateProp('disabled', checked), "data-testid": "switch-disabled" })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Read Only" }), jsx(Switch, { checked: field.props.readOnly || false, onCheckedChange: (checked) => handleUpdateProp('readOnly', checked), "data-testid": "switch-readonly" })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Hidden" }), jsx(Switch, { checked: field.props.hidden || false, onCheckedChange: (checked) => handleUpdateProp('hidden', checked) })] })] })] }));
|
|
2365
|
+
})(), jsx(Separator, {}), 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: [jsx(Trash2, { className: "h-4 w-4" }), "Delete Field"] })] }), jsx(TabsContent, { value: "rules", className: "space-y-4 mt-0", children: (() => {
|
|
3728
2366
|
const staticDisplayTypes = ['spacer', 'divider', 'header', 'subheader', 'label', 'paragraph', 'alert', 'image', 'qrcode', 'button'];
|
|
3729
2367
|
if (staticDisplayTypes.includes(field.type)) {
|
|
3730
|
-
return (
|
|
2368
|
+
return (jsx("div", { className: "text-center py-8 text-muted-foreground", children: jsx("p", { className: "text-sm", children: "Bu bile\u015Fen i\u00E7in do\u011Frulama kurallar\u0131 gerekli de\u011Fil." }) }));
|
|
3731
2369
|
}
|
|
3732
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsxRuntimeExports.jsx(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(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(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(Plus, { className: "h-4 w-4" }), "Add Condition"] })] })] }))] }));
|
|
3733
|
-
})() }),
|
|
2370
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsx(Settings2, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: "Validation Rules" })] }), jsxs("div", { className: "space-y-3 pb-4", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Auto Validate" }), jsx(Switch, { checked: field.validation?.autoValidate || false, onCheckedChange: (checked) => handleUpdateValidation('autoValidate', checked) })] }), jsx("p", { className: "text-xs text-muted-foreground", children: "Validate while typing" }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Validate on Blur" }), jsx(Switch, { checked: field.validation?.validateOnBlur ?? true, onCheckedChange: (checked) => handleUpdateValidation('validateOnBlur', checked) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Validate on Change" }), jsx(Switch, { checked: field.validation?.validateOnChange || false, onCheckedChange: (checked) => handleUpdateValidation('validateOnChange', checked) })] })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-2 pt-4", children: [jsx(Label, { className: "text-sm", children: "Validation Type" }), jsxs(Select, { value: field.validation?.validationType || '', onValueChange: (value) => handleUpdateValidation('validationType', value || undefined), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "None" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "email", children: "Email" }), jsx(SelectItem, { value: "url", children: "URL" }), jsx(SelectItem, { value: "phone", children: "Phone" }), jsx(SelectItem, { value: "custom", children: "Custom" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Min Length" }), 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" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Max Length" }), 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) && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Min Value" }), 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" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Max Value" }), 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" })] })] })), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Pattern (Regex)" }), 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" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Custom Error Message" }), 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" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Custom Validation (JS)" }), 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]" }), jsx("p", { className: "text-xs text-muted-foreground", children: "Write JavaScript that returns true for valid values" })] }), jsx(Separator, {}), jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Zap, { className: "h-4 w-4 text-muted-foreground" }), jsx(Label, { className: "text-sm font-medium", children: "Conditional Logic" })] }), jsx(Switch, { checked: field.conditionalLogic?.enabled || false, onCheckedChange: (checked) => handleUpdateConditionalLogic({ enabled: checked }) })] }), field.conditionalLogic?.enabled && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Action" }), jsxs(Select, { value: field.conditionalLogic?.action || 'show', onValueChange: (value) => handleUpdateConditionalLogic({ action: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "show", children: "Show this field" }), jsx(SelectItem, { value: "hide", children: "Hide this field" }), jsx(SelectItem, { value: "enable", children: "Enable this field" }), jsx(SelectItem, { value: "disable", children: "Disable this field" }), jsx(SelectItem, { value: "require", children: "Make required" })] })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "When" }), jsxs(Select, { value: field.conditionalLogic?.logicType || 'all', onValueChange: (value) => handleUpdateConditionalLogic({ logicType: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "all", children: "All conditions are met" }), jsx(SelectItem, { value: "any", children: "Any condition is met" })] })] })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-3", children: [jsx(Label, { className: "text-sm font-medium", children: "Conditions" }), (field.conditionalLogic?.conditions || []).map((condition, index) => (jsxs("div", { className: "p-3 border border-border rounded-md space-y-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsxs(Badge, { variant: "secondary", children: ["Condition ", index + 1] }), jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeCondition(index), children: jsx(Trash2, { className: "h-4 w-4" }) })] }), jsxs(Select, { value: condition.fieldKey, onValueChange: (value) => updateCondition(index, { fieldKey: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select field..." }) }), jsx(SelectContent, { children: allFields.map((f) => (jsxs(SelectItem, { value: f.props.key, children: [f.props.label, " (", f.props.key, ")"] }, f.id))) })] }), jsxs(Select, { value: condition.operator, onValueChange: (value) => updateCondition(index, { operator: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "equals", children: "Equals" }), jsx(SelectItem, { value: "notEquals", children: "Not equals" }), jsx(SelectItem, { value: "contains", children: "Contains" }), jsx(SelectItem, { value: "notContains", children: "Does not contain" }), jsx(SelectItem, { value: "greaterThan", children: "Greater than" }), jsx(SelectItem, { value: "lessThan", children: "Less than" }), jsx(SelectItem, { value: "isEmpty", children: "Is empty" }), jsx(SelectItem, { value: "isNotEmpty", children: "Is not empty" }), jsx(SelectItem, { value: "startsWith", children: "Starts with" }), jsx(SelectItem, { value: "endsWith", children: "Ends with" })] })] }), !['isEmpty', 'isNotEmpty'].includes(condition.operator) && (jsx(Input, { value: condition.value || '', onChange: (e) => updateCondition(index, { value: e.target.value }), placeholder: "Value..." }))] }, index))), jsxs(Button, { variant: "outline", size: "sm", onClick: addCondition, className: "w-full gap-2", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Condition"] })] })] }))] }));
|
|
2371
|
+
})() }), jsxs(TabsContent, { value: "actions", className: "space-y-4 mt-0", children: [jsxs("div", { className: "flex items-center gap-2 mb-4", children: [jsx(MousePointerClick, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: "Event Handlers" })] }), 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) => (jsxs(Collapsible, { className: "border border-border rounded-md", children: [jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full p-3 hover:bg-muted/50", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Play, { className: "h-3 w-3 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: eventType }), (field.events?.[eventType]?.length || 0) > 0 && (jsx(Badge, { variant: "secondary", className: "text-xs", children: field.events?.[eventType]?.length }))] }), jsx(ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxs(CollapsibleContent, { className: "p-3 pt-0 space-y-3", children: [(field.events?.[eventType] || []).map((action, index) => (jsxs("div", { className: "p-3 border border-border rounded-md space-y-3 bg-muted/30", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsxs(Badge, { variant: "outline", children: ["Action ", index + 1] }), jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeEventAction(eventType, index), children: jsx(Trash2, { className: "h-4 w-4" }) })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-xs", children: "Type" }), jsxs(Select, { value: action.type, onValueChange: (value) => updateEventAction(eventType, index, { type: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "common", children: "Common Action" }), jsx(SelectItem, { value: "code", children: "Code Action" }), jsx(SelectItem, { value: "custom", children: "Custom Action" })] })] })] }), action.type === 'common' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-xs", children: "Action" }), jsxs(Select, { value: action.name, onValueChange: (value) => updateEventAction(eventType, index, { name: value }), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select action..." }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "validate", children: "Validate Form" }), jsx(SelectItem, { value: "reset", children: "Reset Form" }), jsx(SelectItem, { value: "submit", children: "Submit Form" }), jsx(SelectItem, { value: "clearField", children: "Clear This Field" }), jsx(SelectItem, { value: "focusField", children: "Focus Field" }), jsx(SelectItem, { value: "showMessage", children: "Show Message" })] })] })] })), action.type === 'code' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-xs", children: "JavaScript Code" }), 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' && (jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-xs", children: "Custom Action Name" }), jsx(Input, { value: action.name, onChange: (e) => updateEventAction(eventType, index, { name: e.target.value }), placeholder: "myCustomAction", className: "font-mono text-sm" }), jsx("p", { className: "text-xs text-muted-foreground", children: "This will call the custom action passed to FormViewer" })] }))] }, index))), jsxs(Button, { variant: "outline", size: "sm", onClick: () => addEventAction(eventType), className: "w-full gap-2", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Action"] })] })] }, eventType)))] }), jsxs(TabsContent, { value: "style", className: "space-y-4 mt-0", children: [jsxs("div", { className: "flex items-center justify-between mb-4", children: [jsx("span", { className: "text-sm font-medium", children: "For device" }), jsxs(Select, { value: field.customStyle?.deviceTarget || 'any', onValueChange: (value) => handleUpdateCustomStyle('deviceTarget', value), children: [jsx(SelectTrigger, { className: "w-32", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "any", children: "Any" }), jsx(SelectItem, { value: "mobile", children: "Mobile" }), jsx(SelectItem, { value: "tablet", children: "Tablet" }), jsx(SelectItem, { value: "desktop", children: "Desktop" })] })] })] }), jsxs("div", { className: "space-y-4", children: [jsx("h4", { className: "text-sm font-semibold", children: "Component" }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Paintbrush, { className: "h-4 w-4 text-muted-foreground" }), jsx(Label, { className: "text-sm w-24", children: "Class Name" }), jsx(Input, { value: field.customStyle?.inputClassName || '', onChange: (e) => handleUpdateCustomStyle('inputClassName', e.target.value), placeholder: "", className: "font-mono text-sm flex-1" }), field.customStyle?.inputClassName && (jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('inputClassName', ''), children: jsx(Trash2, { className: "h-4 w-4" }) }))] })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-4", children: [jsx("h4", { className: "text-sm font-semibold", children: "Wrapper" }), jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Width" }), jsxs("div", { className: "flex gap-1", children: [jsx(Input, { type: "number", value: field.customStyle?.width?.value ?? 100, onChange: (e) => handleUpdateCustomStyle('width', {
|
|
3734
2372
|
...field.customStyle?.width,
|
|
3735
2373
|
value: parseInt(e.target.value) || 100
|
|
3736
|
-
}), className: "w-16" }),
|
|
2374
|
+
}), className: "w-16" }), jsxs(Select, { value: field.customStyle?.width?.unit || '%', onValueChange: (value) => handleUpdateCustomStyle('width', {
|
|
3737
2375
|
...field.customStyle?.width,
|
|
3738
2376
|
unit: value
|
|
3739
|
-
}), children: [
|
|
2377
|
+
}), children: [jsx(SelectTrigger, { className: "w-14", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "%", children: "%" }), jsx(SelectItem, { value: "px", children: "px" }), jsx(SelectItem, { value: "rem", children: "rem" })] })] })] })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Height" }), jsxs(Select, { value: field.customStyle?.height || 'auto', onValueChange: (value) => handleUpdateCustomStyle('height', value), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "auto", children: "Auto" }), jsx(SelectItem, { value: "100%", children: "100%" }), jsx(SelectItem, { value: "50%", children: "50%" }), jsx(SelectItem, { value: "200px", children: "200px" }), jsx(SelectItem, { value: "300px", children: "300px" })] })] })] })] }), jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Margin Top" }), jsxs(Select, { value: field.customStyle?.marginTop || '', onValueChange: (value) => handleUpdateCustomStyle('marginTop', value), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "0", children: "0" }), jsx(SelectItem, { value: "4px", children: "4px" }), jsx(SelectItem, { value: "8px", children: "8px" }), jsx(SelectItem, { value: "16px", children: "16px" }), jsx(SelectItem, { value: "24px", children: "24px" }), jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Margin Right" }), jsxs(Select, { value: field.customStyle?.marginRight || '', onValueChange: (value) => handleUpdateCustomStyle('marginRight', value), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "0", children: "0" }), jsx(SelectItem, { value: "4px", children: "4px" }), jsx(SelectItem, { value: "8px", children: "8px" }), jsx(SelectItem, { value: "16px", children: "16px" }), jsx(SelectItem, { value: "24px", children: "24px" }), jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Margin Bottom" }), jsxs(Select, { value: field.customStyle?.marginBottom || '', onValueChange: (value) => handleUpdateCustomStyle('marginBottom', value), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "0", children: "0" }), jsx(SelectItem, { value: "4px", children: "4px" }), jsx(SelectItem, { value: "8px", children: "8px" }), jsx(SelectItem, { value: "16px", children: "16px" }), jsx(SelectItem, { value: "24px", children: "24px" }), jsx(SelectItem, { value: "32px", children: "32px" })] })] })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Margin Left" }), jsxs(Select, { value: field.customStyle?.marginLeft || '', onValueChange: (value) => handleUpdateCustomStyle('marginLeft', value), children: [jsx(SelectTrigger, { children: jsx(SelectValue, { placeholder: "Select" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "0", children: "0" }), jsx(SelectItem, { value: "4px", children: "4px" }), jsx(SelectItem, { value: "8px", children: "8px" }), jsx(SelectItem, { value: "16px", children: "16px" }), jsx(SelectItem, { value: "24px", children: "24px" }), jsx(SelectItem, { value: "32px", children: "32px" })] })] })] })] }), jsxs("div", { className: "grid grid-cols-2 gap-3", children: [jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Color" }), jsxs("div", { className: "flex gap-1", children: [jsx(Input, { type: "color", value: field.customStyle?.color || '#000000', onChange: (e) => handleUpdateCustomStyle('color', e.target.value), className: "w-10 h-9 p-1" }), 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 && (jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('color', ''), children: jsx(Trash2, { className: "h-4 w-4" }) }))] })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-xs", children: "Background Color" }), jsxs("div", { className: "flex gap-1", children: [jsx(Input, { type: "color", value: field.customStyle?.backgroundColor || '#ffffff', onChange: (e) => handleUpdateCustomStyle('backgroundColor', e.target.value), className: "w-10 h-9 p-1" }), 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 && (jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleUpdateCustomStyle('backgroundColor', ''), children: jsx(Trash2, { className: "h-4 w-4" }) }))] })] })] })] }), jsx(Separator, {}), jsxs("div", { className: "space-y-4", children: [jsx("h4", { className: "text-sm font-semibold", children: "Styles for className" }), jsxs(Tabs, { defaultValue: "component", className: "w-full", children: [jsxs(TabsList, { className: "w-full grid grid-cols-2", children: [jsx(TabsTrigger, { value: "component", className: "text-xs", children: "Component" }), jsx(TabsTrigger, { value: "wrapper", className: "text-xs", children: "Wrapper" })] }), jsx(TabsContent, { value: "component", className: "mt-3", children: jsxs("div", { className: "space-y-2", children: [jsxs(Label, { className: "text-xs text-primary", children: ["element.style ", '{'] }), 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" }), jsx(Label, { className: "text-xs text-primary", children: '}' })] }) }), jsx(TabsContent, { value: "wrapper", className: "mt-3", children: jsxs("div", { className: "space-y-2", children: [jsxs(Label, { className: "text-xs text-primary", children: ["wrapper.style ", '{'] }), 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" }), jsx(Label, { className: "text-xs text-primary", children: '}' })] }) })] })] }), jsx(Separator, {}), jsxs(Collapsible, { children: [jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full py-2", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Globe, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: "Responsive Grid" })] }), jsx(ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }), jsxs(CollapsibleContent, { className: "space-y-4 pt-2", children: [jsx("p", { className: "text-xs text-muted-foreground", children: "Override column width for different screen sizes (1-12 grid)" }), jsxs("div", { className: "space-y-2", children: [jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsx("span", { className: "w-16", children: "Mobile" }), jsx("span", { className: "text-muted-foreground", children: "(<640px)" })] }), jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.mobile ?? '', onChange: (e) => {
|
|
3740
2378
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3741
2379
|
updateField(row.id, column.id, field.id, {
|
|
3742
2380
|
responsiveWidth: { ...field.responsiveWidth, mobile: val },
|
|
3743
2381
|
});
|
|
3744
|
-
}, placeholder: "Auto" })] }),
|
|
2382
|
+
}, placeholder: "Auto" })] }), jsxs("div", { className: "space-y-2", children: [jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsx("span", { className: "w-16", children: "Tablet" }), jsx("span", { className: "text-muted-foreground", children: "(640-1024px)" })] }), jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.tablet ?? '', onChange: (e) => {
|
|
3745
2383
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3746
2384
|
updateField(row.id, column.id, field.id, {
|
|
3747
2385
|
responsiveWidth: { ...field.responsiveWidth, tablet: val },
|
|
3748
2386
|
});
|
|
3749
|
-
}, placeholder: "Auto" })] }),
|
|
2387
|
+
}, placeholder: "Auto" })] }), jsxs("div", { className: "space-y-2", children: [jsxs(Label, { className: "text-xs flex items-center gap-2", children: [jsx("span", { className: "w-16", children: "Desktop" }), jsx("span", { className: "text-muted-foreground", children: "(>1024px)" })] }), jsx(Input, { type: "number", min: 1, max: 12, value: field.responsiveWidth?.desktop ?? '', onChange: (e) => {
|
|
3750
2388
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
|
3751
2389
|
updateField(row.id, column.id, field.id, {
|
|
3752
2390
|
responsiveWidth: { ...field.responsiveWidth, desktop: val },
|
|
3753
2391
|
});
|
|
3754
|
-
}, placeholder: "Auto" })] })] })] }),
|
|
2392
|
+
}, placeholder: "Auto" })] })] })] }), jsx(Separator, {}), jsxs("div", { className: "flex items-center gap-2 mb-2", children: [jsx(Globe, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { className: "text-sm font-medium", children: "Localization" })] }), 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." })] })] }) }));
|
|
3755
2393
|
}
|
|
3756
2394
|
function StepProperties() {
|
|
3757
2395
|
const { getSelectedStep, updateStep, deleteStep, form } = useFormStore();
|
|
3758
2396
|
const step = getSelectedStep();
|
|
3759
2397
|
if (!step)
|
|
3760
2398
|
return null;
|
|
3761
|
-
return (
|
|
2399
|
+
return (jsx("div", { className: "p-4 space-y-6", children: jsxs("div", { children: [jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-4", children: "Step Properties" }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Title" }), jsx(Input, { value: step.title, onChange: (e) => updateStep(step.id, { title: e.target.value }) })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { className: "text-sm", children: "Description" }), jsx(Textarea, { value: step.description || '', onChange: (e) => updateStep(step.id, { description: e.target.value }), placeholder: "Optional step description..." })] }), jsx(Separator, {}), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Validate on Next" }), jsx(Switch, { checked: step.validation?.validateOnNext || false, onCheckedChange: (checked) => updateStep(step.id, {
|
|
3762
2400
|
validation: { ...step.validation, validateOnNext: checked }
|
|
3763
|
-
}) })] }),
|
|
2401
|
+
}) })] }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-sm", children: "Allow Skip" }), jsx(Switch, { checked: step.validation?.allowSkip || false, onCheckedChange: (checked) => updateStep(step.id, {
|
|
3764
2402
|
validation: { ...step.validation, allowSkip: checked }
|
|
3765
|
-
}) })] }),
|
|
2403
|
+
}) })] }), jsx(Separator, {}), 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: [jsx(Trash2, { className: "h-4 w-4" }), "Delete Step"] })] })] }) }));
|
|
3766
2404
|
}
|
|
3767
2405
|
function PropertiesPanel() {
|
|
3768
2406
|
const { selection } = useFormStore();
|
|
3769
|
-
return (
|
|
2407
|
+
return (jsx("aside", { className: "w-[320px] border-l border-border bg-card shrink-0", children: jsxs(ScrollArea, { className: "h-full", children: [selection.type === null && (jsx("div", { className: "p-4 text-center text-muted-foreground", children: jsx("p", { className: "text-sm", children: "Select an element to edit its properties" }) })), selection.type === 'row' && jsx(RowProperties, {}), selection.type === 'column' && jsx(ColumnProperties, {}), selection.type === 'field' && jsx(FieldProperties, {}), selection.type === 'step' && jsx(StepProperties, {})] }) }));
|
|
3770
2408
|
}
|
|
3771
2409
|
|
|
3772
2410
|
const conditionOperatorSchema = z.enum([
|
|
@@ -4140,11 +2778,11 @@ const SUPPORTED_LANGUAGES = [
|
|
|
4140
2778
|
];
|
|
4141
2779
|
|
|
4142
2780
|
const Accordion = AccordionPrimitive.Root;
|
|
4143
|
-
const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (
|
|
2781
|
+
const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (jsx(AccordionPrimitive.Item, { ref: ref, className: cn("border-b", className), ...props })));
|
|
4144
2782
|
AccordionItem.displayName = "AccordionItem";
|
|
4145
|
-
const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
2783
|
+
const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => (jsx(AccordionPrimitive.Header, { className: "flex", children: jsxs(AccordionPrimitive.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, jsx(ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200" })] }) })));
|
|
4146
2784
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
4147
|
-
const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
2785
|
+
const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => (jsx(AccordionPrimitive.Content, { ref: ref, className: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", ...props, children: jsx("div", { className: cn("pb-4 pt-0", className), children: children }) })));
|
|
4148
2786
|
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
4149
2787
|
|
|
4150
2788
|
const iconMap$1 = {
|
|
@@ -4199,17 +2837,17 @@ function DraggableComponent({ type, label, icon, isCollapsed }) {
|
|
|
4199
2837
|
});
|
|
4200
2838
|
const IconComponent = iconMap$1[icon] || Type;
|
|
4201
2839
|
if (isCollapsed) {
|
|
4202
|
-
return (
|
|
2840
|
+
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("div", { ref: setNodeRef, ...listeners, ...attributes, className: `
|
|
4203
2841
|
flex items-center justify-center p-2 rounded-md border border-border
|
|
4204
2842
|
bg-card cursor-grab hover-elevate active-elevate-2 transition-all duration-150
|
|
4205
2843
|
${isDragging ? 'opacity-50' : 'opacity-100'}
|
|
4206
|
-
`, "data-testid": `draggable-${type}`, children:
|
|
2844
|
+
`, "data-testid": `draggable-${type}`, children: jsx(IconComponent, { className: "h-4 w-4 text-muted-foreground" }) }) }), jsx(TooltipContent, { side: "right", children: jsx("p", { children: label }) })] }));
|
|
4207
2845
|
}
|
|
4208
|
-
return (
|
|
2846
|
+
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("div", { ref: setNodeRef, ...listeners, ...attributes, className: `
|
|
4209
2847
|
flex items-center gap-2 px-2 py-2 rounded-md border border-border
|
|
4210
2848
|
bg-card cursor-grab hover-elevate active-elevate-2 transition-all duration-150
|
|
4211
2849
|
${isDragging ? 'opacity-50' : 'opacity-100'}
|
|
4212
|
-
`, "data-testid": `draggable-${type}`, children: [
|
|
2850
|
+
`, "data-testid": `draggable-${type}`, children: [jsx(IconComponent, { className: "h-4 w-4 text-muted-foreground shrink-0" }), jsx("span", { className: "text-xs text-foreground truncate leading-tight", children: label })] }) }), jsx(TooltipContent, { side: "right", children: jsx("p", { children: label }) })] }));
|
|
4213
2851
|
}
|
|
4214
2852
|
const fieldCategories = {
|
|
4215
2853
|
basic: { label: 'Basic Fields', types: FIELD_TYPES.filter(f => f.category === 'basic') },
|
|
@@ -4218,9 +2856,9 @@ const fieldCategories = {
|
|
|
4218
2856
|
};
|
|
4219
2857
|
function ComponentLibrary({ isCollapsed = false, onToggleCollapse }) {
|
|
4220
2858
|
if (isCollapsed) {
|
|
4221
|
-
return (
|
|
2859
|
+
return (jsxs("aside", { className: "w-[60px] border-r border-border bg-card shrink-0 flex flex-col", children: [jsx("div", { className: "p-2 border-b border-border", children: jsx(Button, { variant: "ghost", size: "icon", onClick: onToggleCollapse, "data-testid": "button-expand-sidebar", children: jsx(PanelLeft, { className: "h-4 w-4" }) }) }), jsx(ScrollArea, { className: "flex-1", children: jsxs("div", { className: "p-2 space-y-4", children: [jsxs("div", { className: "space-y-1", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "LY" }) }), jsx(TooltipContent, { side: "right", children: "Layout" })] }), jsx("div", { className: "grid grid-cols-1 gap-1", children: STRUCTURE_TYPES.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxs("div", { className: "space-y-1", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "BF" }) }), jsx(TooltipContent, { side: "right", children: "Basic Fields" })] }), jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.basic.types.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxs("div", { className: "space-y-1", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "SF" }) }), jsx(TooltipContent, { side: "right", children: "Selection Fields" })] }), jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.selection.types.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxs("div", { className: "space-y-1", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "AD" }) }), jsx(TooltipContent, { side: "right", children: "Advanced Fields" })] }), jsx("div", { className: "grid grid-cols-1 gap-1", children: fieldCategories.advanced.types.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] }), jsxs("div", { className: "space-y-1", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("p", { className: "text-[10px] font-semibold uppercase text-muted-foreground text-center cursor-default", children: "EL" }) }), jsx(TooltipContent, { side: "right", children: "Static Elements" })] }), jsx("div", { className: "grid grid-cols-1 gap-1", children: STATIC_TYPES.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon, isCollapsed: true }, item.type))) })] })] }) })] }));
|
|
4222
2860
|
}
|
|
4223
|
-
return (
|
|
2861
|
+
return (jsxs("aside", { className: "w-[200px] border-r border-border bg-card shrink-0 flex flex-col", children: [jsxs("div", { className: "p-2 border-b border-border flex items-center justify-between gap-2", children: [jsx("span", { className: "text-sm font-medium text-foreground pl-1", children: "Components" }), jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 shrink-0", onClick: onToggleCollapse, "data-testid": "button-collapse-sidebar", children: jsx(PanelLeftClose, { className: "h-3.5 w-3.5" }) })] }), jsx(ScrollArea, { className: "flex-1", children: jsx("div", { className: "p-2", children: jsxs(Accordion, { type: "multiple", defaultValue: ['structure', 'basic', 'selection', 'advanced', 'static'], className: "w-full", children: [jsxs(AccordionItem, { value: "structure", className: "border-b-0 bg-muted/50 rounded-md mb-1 px-2", children: [jsxs(AccordionTrigger, { className: "py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline", children: ["Layout (", STRUCTURE_TYPES.length, ")"] }), jsx(AccordionContent, { children: jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: STRUCTURE_TYPES.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] }), Object.entries(fieldCategories).map(([key, category]) => (jsxs(AccordionItem, { value: key, className: "border-b-0 bg-background dark:bg-card rounded-md mb-1 px-2", children: [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, ")"] }), jsx(AccordionContent, { children: jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: category.types.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] }, key))), jsxs(AccordionItem, { value: "static", className: "border-b-0 bg-background dark:bg-card rounded-md mb-1 px-2", children: [jsxs(AccordionTrigger, { className: "py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline", children: ["Attributes (", STATIC_TYPES.length, ")"] }), jsx(AccordionContent, { children: jsx("div", { className: "grid grid-cols-2 gap-1 pb-2", children: STATIC_TYPES.map((item) => (jsx(DraggableComponent, { type: item.type, label: item.label, icon: item.icon }, item.type))) }) })] })] }) }) })] }));
|
|
4224
2862
|
}
|
|
4225
2863
|
|
|
4226
2864
|
const TOAST_LIMIT = 1;
|
|
@@ -6148,39 +4786,39 @@ new QueryClient({
|
|
|
6148
4786
|
const Dialog = DialogPrimitive.Root;
|
|
6149
4787
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
6150
4788
|
const DialogPortal = DialogPrimitive.Portal;
|
|
6151
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (
|
|
4789
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.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 })));
|
|
6152
4790
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
6153
|
-
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
4791
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(DialogPortal, { children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.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, jsxs(DialogPrimitive.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: [jsx(X, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
|
|
6154
4792
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
6155
|
-
const DialogHeader = ({ className, ...props }) => (
|
|
4793
|
+
const DialogHeader = ({ className, ...props }) => (jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
|
|
6156
4794
|
DialogHeader.displayName = "DialogHeader";
|
|
6157
|
-
const DialogFooter = ({ className, ...props }) => (
|
|
4795
|
+
const DialogFooter = ({ className, ...props }) => (jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
|
|
6158
4796
|
DialogFooter.displayName = "DialogFooter";
|
|
6159
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (
|
|
4797
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Title, { ref: ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props })));
|
|
6160
4798
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
6161
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (
|
|
4799
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Description, { ref: ref, className: cn("text-sm text-muted-foreground", className), ...props })));
|
|
6162
4800
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
6163
4801
|
|
|
6164
4802
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
6165
4803
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
6166
|
-
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (
|
|
4804
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (jsxs(DropdownMenuPrimitive.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, jsx(ChevronRight, { className: "ml-auto" })] })));
|
|
6167
4805
|
DropdownMenuSubTrigger.displayName =
|
|
6168
4806
|
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
6169
|
-
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (
|
|
4807
|
+
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (jsx(DropdownMenuPrimitive.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 })));
|
|
6170
4808
|
DropdownMenuSubContent.displayName =
|
|
6171
4809
|
DropdownMenuPrimitive.SubContent.displayName;
|
|
6172
|
-
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
|
|
4810
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.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 }) })));
|
|
6173
4811
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
6174
|
-
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (
|
|
4812
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(DropdownMenuPrimitive.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 })));
|
|
6175
4813
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
6176
|
-
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (
|
|
4814
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (jsxs(DropdownMenuPrimitive.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: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(DropdownMenuPrimitive.ItemIndicator, { children: jsx(Check, { className: "h-4 w-4" }) }) }), children] })));
|
|
6177
4815
|
DropdownMenuCheckboxItem.displayName =
|
|
6178
4816
|
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
6179
|
-
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
4817
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(DropdownMenuPrimitive.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: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(DropdownMenuPrimitive.ItemIndicator, { children: jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
6180
4818
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
6181
|
-
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (
|
|
4819
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(DropdownMenuPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className), ...props })));
|
|
6182
4820
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
6183
|
-
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (
|
|
4821
|
+
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (jsx(DropdownMenuPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
|
|
6184
4822
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
6185
4823
|
|
|
6186
4824
|
function Toolbar({ onOpenJsonViewer }) {
|
|
@@ -6290,10 +4928,10 @@ function Toolbar({ onOpenJsonViewer }) {
|
|
|
6290
4928
|
setIsEditing(false);
|
|
6291
4929
|
}
|
|
6292
4930
|
};
|
|
6293
|
-
return (
|
|
4931
|
+
return (jsxs("header", { className: "h-14 border-b border-border bg-card px-6 flex items-center justify-between gap-4 shrink-0", children: [jsx("div", { className: "flex items-center gap-3", children: isEditing ? (jsxs("div", { className: "flex items-center gap-2", children: [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" }), jsx(Button, { size: "icon", variant: "ghost", onClick: handleSaveName, "data-testid": "button-save-name", children: jsx(Check, { className: "h-4 w-4" }) })] })) : (jsxs("div", { className: "flex items-center gap-2", children: [jsx("h1", { className: "text-lg font-semibold text-foreground", children: form.name }), jsx(Button, { size: "icon", variant: "ghost", onClick: () => {
|
|
6294
4932
|
setTempName(form.name);
|
|
6295
4933
|
setIsEditing(true);
|
|
6296
|
-
}, "data-testid": "button-edit-name", children: jsxRuntimeExports.jsx(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(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(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(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(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(Loader2, { className: "h-4 w-4 animate-spin" })) : (jsxRuntimeExports.jsx(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(EyeOff, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("span", { children: "Edit" })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(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(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(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(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(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(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(FileJson, { className: "h-4 w-4 mr-2" }), "View JSON Schema"] }), jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleExportJson, children: [jsxRuntimeExports.jsx(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(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(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(Sun, { className: "h-4 w-4" }) : jsxRuntimeExports.jsx(Moon, { className: "h-4 w-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: isDarkMode ? 'Light Mode' : 'Dark Mode' })] })] })] }));
|
|
4934
|
+
}, "data-testid": "button-edit-name", children: jsx(Edit3, { className: "h-4 w-4" }) }), form.isMultiStep && (jsx(Badge, { variant: "secondary", className: "text-xs", children: "Multi-Step" })), form.currentVersion && (jsxs(Badge, { variant: "outline", className: "text-xs", children: ["v", form.currentVersion] }))] })) }), jsxs("div", { className: "flex items-center gap-2", children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: "ghost", size: "icon", onClick: undo, disabled: !canUndo(), "data-testid": "button-undo", children: jsx(Undo2, { className: "h-4 w-4" }) }) }), jsx(TooltipContent, { children: "Undo" })] }), jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: "ghost", size: "icon", onClick: redo, disabled: !canRedo(), "data-testid": "button-redo", children: jsx(Redo2, { className: "h-4 w-4" }) }) }), jsx(TooltipContent, { children: "Redo" })] }), jsxs(DropdownMenu, { children: [jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "ghost", size: "icon", "data-testid": "button-canvas-width", children: jsx(Maximize2, { className: "h-4 w-4" }) }) }) }), jsx(TooltipContent, { children: "Canvas Width" })] }), jsxs(DropdownMenuContent, { align: "end", children: [jsx(DropdownMenuLabel, { children: "Canvas Width" }), jsx(DropdownMenuSeparator, {}), widthOptions.map((option) => (jsxs(DropdownMenuItem, { onClick: () => setCanvasWidth(option.value), className: "flex justify-between gap-4", "data-testid": `menu-width-${option.value}`, children: [jsx("span", { children: option.label }), jsx("span", { className: "text-muted-foreground text-xs", children: option.description }), canvasWidth === option.value && jsx(Check, { className: "h-4 w-4 ml-2" })] }, option.value)))] })] }), jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxs(Button, { variant: "default", size: "sm", onClick: handleSaveForm, disabled: isSaving, className: "gap-2", "data-testid": "button-save-form", children: [isSaving ? (jsx(Loader2, { className: "h-4 w-4 animate-spin" })) : (jsx(Save, { className: "h-4 w-4" })), jsx("span", { children: "Save" })] }), jsx(Button, { variant: isPreviewMode ? 'default' : 'outline', size: "sm", onClick: togglePreviewMode, className: "gap-2", "data-testid": "button-toggle-preview", children: isPreviewMode ? (jsxs(Fragment, { children: [jsx(EyeOff, { className: "h-4 w-4" }), jsx("span", { children: "Edit" })] })) : (jsxs(Fragment, { children: [jsx(Eye, { className: "h-4 w-4" }), jsx("span", { children: "Preview" })] })) }), 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: jsx(Layers, { className: "h-4 w-4" }) }), jsxs(Dialog, { open: versionDialogOpen, onOpenChange: setVersionDialogOpen, children: [jsx(DialogTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-version", children: jsx(History, { className: "h-4 w-4" }) }) }), jsxs(DialogContent, { className: "max-w-md", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: "Version History" }), jsx(DialogDescription, { children: "Save snapshots and restore previous versions of your form." })] }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { children: "Save New Version" }), jsx(Textarea, { value: changelog, onChange: (e) => setChangelog(e.target.value), placeholder: "What changed in this version?", className: "min-h-[60px]" }), jsxs(Button, { onClick: handleSaveVersion, className: "w-full gap-2", size: "sm", children: [jsx(Save, { className: "h-4 w-4" }), "Save Version ", (form.currentVersion || 0) + 1] })] }), form.versions && form.versions.length > 0 && (jsx(Fragment, { children: jsxs("div", { className: "border-t pt-4", children: [jsx(Label, { className: "mb-2 block", children: "Previous Versions" }), jsx(ScrollArea, { className: "h-[200px]", children: jsx("div", { className: "space-y-2", children: [...form.versions].reverse().map((version) => (jsxs("div", { className: "p-3 border rounded-md space-y-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsxs("span", { className: "font-medium", children: ["Version ", version.version] }), jsx(Button, { variant: "outline", size: "sm", onClick: () => handleRestoreVersion(version.id, version.version), children: "Restore" })] }), version.changelog && (jsx("p", { className: "text-sm text-muted-foreground", children: version.changelog })), jsx("p", { className: "text-xs text-muted-foreground", children: new Date(version.createdAt).toLocaleString() })] }, version.id))) }) })] }) }))] })] })] }), jsxs(Dialog, { open: settingsDialogOpen, onOpenChange: setSettingsDialogOpen, children: [jsx(DialogTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-settings", children: jsx(Settings, { className: "h-4 w-4" }) }) }), jsxs(DialogContent, { className: "max-w-lg", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: "Form Settings" }), jsx(DialogDescription, { children: "Configure submission, webhooks, and other form settings." })] }), jsx("div", { className: "space-y-6", children: jsxs("div", { className: "space-y-4", children: [jsx("h4", { className: "font-medium", children: "Submission Settings" }), jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { children: "Enable Submission Handler" }), jsx(Switch, { checked: form.submissionConfig?.enabled || false, onCheckedChange: (checked) => updateSubmissionConfig({ enabled: checked }) })] }), form.submissionConfig?.enabled && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { children: "Webhook URL" }), jsx(Input, { value: form.submissionConfig?.webhookUrl || '', onChange: (e) => updateSubmissionConfig({ webhookUrl: e.target.value }), placeholder: "https://your-api.com/webhook" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { children: "Success Message" }), jsx(Input, { value: form.submissionConfig?.successMessage || '', onChange: (e) => updateSubmissionConfig({ successMessage: e.target.value }), placeholder: "Thank you for your submission!" })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { children: "Redirect URL (optional)" }), jsx(Input, { value: form.submissionConfig?.redirectUrl || '', onChange: (e) => updateSubmissionConfig({ redirectUrl: e.target.value }), placeholder: "https://your-site.com/thank-you" })] })] }))] }) }), jsx(DialogFooter, { children: jsx(Button, { onClick: () => setSettingsDialogOpen(false), children: "Done" }) })] })] }), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "sm", className: "gap-2", "data-testid": "button-more", children: jsx(FileJson, { className: "h-4 w-4" }) }) }), jsxs(DropdownMenuContent, { align: "end", children: [jsx(DropdownMenuLabel, { children: "Export / Import" }), jsx(DropdownMenuSeparator, {}), jsxs(DropdownMenuItem, { onClick: onOpenJsonViewer, children: [jsx(FileJson, { className: "h-4 w-4 mr-2" }), "View JSON Schema"] }), jsxs(DropdownMenuItem, { onClick: handleExportJson, children: [jsx(Download, { className: "h-4 w-4 mr-2" }), "Download JSON"] }), jsx(DropdownMenuItem, { asChild: true, children: jsxs("label", { className: "cursor-pointer flex items-center", children: [jsx(Upload, { className: "h-4 w-4 mr-2" }), "Import JSON", jsx("input", { type: "file", accept: ".json", onChange: handleImportJson, className: "hidden" })] }) })] })] }), jsx(Button, { variant: "outline", size: "sm", onClick: clearForm, className: "gap-2 text-destructive hover:text-destructive", "data-testid": "button-clear-form", children: jsx(Trash2, { className: "h-4 w-4" }) }), jsx("div", { className: "w-px h-6 bg-border mx-1" }), jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: "ghost", size: "icon", onClick: toggleTheme, "data-testid": "button-toggle-theme", children: isDarkMode ? jsx(Sun, { className: "h-4 w-4" }) : jsx(Moon, { className: "h-4 w-4" }) }) }), jsx(TooltipContent, { children: isDarkMode ? 'Light Mode' : 'Dark Mode' })] })] })] }));
|
|
6297
4935
|
}
|
|
6298
4936
|
|
|
6299
4937
|
const iconMap = {
|
|
@@ -6347,7 +4985,7 @@ const labelMap = {
|
|
|
6347
4985
|
function DragOverlayContent({ type }) {
|
|
6348
4986
|
const IconComponent = iconMap[type] || Type;
|
|
6349
4987
|
const label = labelMap[type] || type;
|
|
6350
|
-
return (
|
|
4988
|
+
return (jsxs("div", { className: "flex items-center gap-3 px-4 py-3 rounded-md border border-primary bg-card shadow-xl cursor-grabbing", children: [jsx(IconComponent, { className: "h-4 w-4 text-primary" }), jsx("span", { className: "text-sm font-medium text-foreground", children: label })] }));
|
|
6351
4989
|
}
|
|
6352
4990
|
|
|
6353
4991
|
function JsonViewerModal({ isOpen, onClose, schema }) {
|
|
@@ -6358,7 +4996,7 @@ function JsonViewerModal({ isOpen, onClose, schema }) {
|
|
|
6358
4996
|
setCopied(true);
|
|
6359
4997
|
setTimeout(() => setCopied(false), 2000);
|
|
6360
4998
|
};
|
|
6361
|
-
return (
|
|
4999
|
+
return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "max-w-3xl max-h-[80vh] flex flex-col", children: [jsxs(DialogHeader, { className: "flex flex-row items-center justify-between pr-8", children: [jsx(DialogTitle, { children: "Form Schema (JSON)" }), jsx(Button, { variant: "outline", size: "sm", onClick: handleCopy, className: "gap-2", "data-testid": "button-copy-json", children: copied ? (jsxs(Fragment, { children: [jsx(Check, { className: "h-4 w-4" }), "Copied"] })) : (jsxs(Fragment, { children: [jsx(Copy, { className: "h-4 w-4" }), "Copy"] })) })] }), jsx("div", { className: "flex-1 min-h-0 h-[60vh] border rounded-md bg-muted/30 overflow-auto", children: jsx("pre", { className: "p-4 text-sm font-mono text-foreground whitespace-pre", children: jsonString }) })] }) }));
|
|
6362
5000
|
}
|
|
6363
5001
|
|
|
6364
5002
|
export { CanvasField, ComponentLibrary, DragOverlayContent, FIELD_TYPES, FormCanvas, JsonViewerModal, PropertiesPanel, STATIC_TYPES, STRUCTURE_TYPES, SUPPORTED_LANGUAGES, Toolbar, autocompleteConfigSchema, computedFieldSchema, conditionOperatorSchema, conditionSchema, conditionalLogicSchema, customStyleSchema, eventActionSchema, fieldEventsSchema, fieldPropsSchema, fileUploadConfigSchema, formColumnSchema, formFieldSchema, formRowSchema, formSchemaObject, formSettingsSchema, formVersionSchema, localizationSchema, ratingConfigSchema, responsiveWidthSchema, stepSchema, submissionConfigSchema, useFormStore, validationSchema };
|