@insticc/genericform 2.0.1 → 2.0.2
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/build/Demo.js +95 -83
- package/build/Demo2.js +230 -192
- package/build/FormFields/CustomAccordion.js +44 -35
- package/build/FormFields/CustomCheckbox.js +14 -12
- package/build/FormFields/CustomCheckboxGroup.js +25 -21
- package/build/FormFields/CustomComponent.js +8 -6
- package/build/FormFields/CustomDatePicker.js +31 -25
- package/build/FormFields/CustomDropdown.js +23 -19
- package/build/FormFields/CustomInput.js +16 -14
- package/build/FormFields/CustomJson.js +42 -38
- package/build/FormFields/CustomLabel.js +6 -5
- package/build/FormFields/CustomMultiDropdown.js +20 -19
- package/build/FormFields/CustomNumberInput.js +19 -17
- package/build/FormFields/CustomRadioGroup.js +28 -24
- package/build/FormFields/CustomSearch.js +18 -17
- package/build/FormFields/CustomSeparator.js +3 -3
- package/build/FormFields/CustomTextArea.js +18 -16
- package/build/FormFields/CustomToggle.js +16 -13
- package/build/FormFields/defaults.js +21 -15
- package/build/index.js +123 -128
- package/package.json +1 -1
package/build/Demo2.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _index = _interopRequireDefault(require("./index"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
11
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
12
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -27,8 +28,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /**
|
|
|
27
28
|
* GenericForm with full external state management.
|
|
28
29
|
*
|
|
29
30
|
* Mount anywhere: <Demo2 />
|
|
30
|
-
*/
|
|
31
|
-
// ── Option sets ───────────────────────────────────────────────────────────────
|
|
31
|
+
*/ // ── Option sets ───────────────────────────────────────────────────────────────
|
|
32
32
|
var COUNTRIES = [{
|
|
33
33
|
value: 'PT',
|
|
34
34
|
text: 'Portugal'
|
|
@@ -271,21 +271,23 @@ var Demo2 = function Demo2() {
|
|
|
271
271
|
sections: [{
|
|
272
272
|
title: 'Config',
|
|
273
273
|
icon: '⚙️',
|
|
274
|
-
content: /*#__PURE__*/
|
|
274
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
275
275
|
style: {
|
|
276
276
|
fontSize: '0.85rem',
|
|
277
277
|
color: '#555'
|
|
278
|
-
}
|
|
279
|
-
|
|
278
|
+
},
|
|
279
|
+
children: "Config fields go here."
|
|
280
|
+
})
|
|
280
281
|
}, {
|
|
281
282
|
title: 'Danger zone',
|
|
282
283
|
icon: '⚠️',
|
|
283
|
-
content: /*#__PURE__*/
|
|
284
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
284
285
|
style: {
|
|
285
286
|
fontSize: '0.85rem',
|
|
286
287
|
color: '#db2828'
|
|
287
|
-
}
|
|
288
|
-
|
|
288
|
+
},
|
|
289
|
+
children: "Destructive actions."
|
|
290
|
+
})
|
|
289
291
|
}]
|
|
290
292
|
}];
|
|
291
293
|
|
|
@@ -297,7 +299,7 @@ var Demo2 = function Demo2() {
|
|
|
297
299
|
var pct = Math.round(filled.length / required.length * 100);
|
|
298
300
|
|
|
299
301
|
// ── JSX ─────────────────────────────────────────────────────────────────────
|
|
300
|
-
return /*#__PURE__*/
|
|
302
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
301
303
|
style: {
|
|
302
304
|
maxWidth: 960,
|
|
303
305
|
margin: '2rem auto',
|
|
@@ -306,190 +308,226 @@ var Demo2 = function Demo2() {
|
|
|
306
308
|
gridTemplateColumns: '1fr 320px',
|
|
307
309
|
gap: 24,
|
|
308
310
|
alignItems: 'start'
|
|
309
|
-
}
|
|
310
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", {
|
|
311
|
-
style: {
|
|
312
|
-
fontSize: '1.3rem',
|
|
313
|
-
marginBottom: '0.25rem'
|
|
314
|
-
}
|
|
315
|
-
}, "Demo 2 \u2014 formState as field values"), /*#__PURE__*/React.createElement("p", {
|
|
316
|
-
style: {
|
|
317
|
-
color: '#666',
|
|
318
|
-
fontSize: '0.85rem',
|
|
319
|
-
marginBottom: '1rem'
|
|
320
|
-
}
|
|
321
|
-
}, "Every ", /*#__PURE__*/React.createElement("code", null, "field.value"), " reads from ", /*#__PURE__*/React.createElement("code", null, "formState"), ".", /*#__PURE__*/React.createElement("code", null, "onDataChange"), " keeps it in sync. Parent actions write directly to ", /*#__PURE__*/React.createElement("code", null, "formState"), "."), /*#__PURE__*/React.createElement("div", {
|
|
322
|
-
style: {
|
|
323
|
-
display: 'flex',
|
|
324
|
-
gap: 8,
|
|
325
|
-
marginBottom: '1.25rem',
|
|
326
|
-
flexWrap: 'wrap'
|
|
327
|
-
}
|
|
328
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
329
|
-
onClick: loadProfile,
|
|
330
|
-
style: {
|
|
331
|
-
padding: '6px 12px',
|
|
332
|
-
fontSize: '0.8rem',
|
|
333
|
-
cursor: 'pointer',
|
|
334
|
-
borderRadius: 5,
|
|
335
|
-
background: '#2185d0',
|
|
336
|
-
color: '#fff',
|
|
337
|
-
border: 'none'
|
|
338
|
-
}
|
|
339
|
-
}, "Load profile"), /*#__PURE__*/React.createElement("button", {
|
|
340
|
-
onClick: function onClick() {
|
|
341
|
-
return clearField('email');
|
|
342
|
-
},
|
|
343
|
-
style: {
|
|
344
|
-
padding: '6px 12px',
|
|
345
|
-
fontSize: '0.8rem',
|
|
346
|
-
cursor: 'pointer',
|
|
347
|
-
borderRadius: 5,
|
|
348
|
-
background: '#fff',
|
|
349
|
-
border: '1px solid #ccc'
|
|
350
|
-
}
|
|
351
|
-
}, "Clear email"), /*#__PURE__*/React.createElement("button", {
|
|
352
|
-
onClick: resetForm,
|
|
353
|
-
style: {
|
|
354
|
-
padding: '6px 12px',
|
|
355
|
-
fontSize: '0.8rem',
|
|
356
|
-
cursor: 'pointer',
|
|
357
|
-
borderRadius: 5,
|
|
358
|
-
background: '#fff',
|
|
359
|
-
border: '1px solid #ccc'
|
|
360
|
-
}
|
|
361
|
-
}, "Reset all")), /*#__PURE__*/React.createElement(_index["default"], {
|
|
362
|
-
title: "User profile",
|
|
363
|
-
fields: fields,
|
|
364
|
-
submitText: "Save profile",
|
|
365
|
-
cancelText: "Reset all",
|
|
366
|
-
validateOnChange: true,
|
|
367
|
-
validateOnSubmit: true,
|
|
368
|
-
onDataChange: handleDataChange,
|
|
369
|
-
onFieldChange: handleFieldChange,
|
|
370
|
-
onSubmit: function onSubmit(data) {
|
|
371
|
-
return setSubmitted(data);
|
|
372
311
|
},
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
key: i,
|
|
455
|
-
style: {
|
|
456
|
-
fontSize: '0.7rem',
|
|
457
|
-
borderBottom: '0.5px solid #eee',
|
|
458
|
-
paddingBottom: 3,
|
|
459
|
-
marginBottom: 3
|
|
460
|
-
}
|
|
461
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
462
|
-
style: {
|
|
463
|
-
color: '#aaa'
|
|
464
|
-
}
|
|
465
|
-
}, e.time), ' ', /*#__PURE__*/React.createElement("strong", null, e.name), " \u2192 ", /*#__PURE__*/React.createElement("code", null, e.value), e.option && /*#__PURE__*/React.createElement("div", {
|
|
312
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
313
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
|
|
314
|
+
style: {
|
|
315
|
+
fontSize: '1.3rem',
|
|
316
|
+
marginBottom: '0.25rem'
|
|
317
|
+
},
|
|
318
|
+
children: "Demo 2 \u2014 formState as field values"
|
|
319
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
320
|
+
style: {
|
|
321
|
+
color: '#666',
|
|
322
|
+
fontSize: '0.85rem',
|
|
323
|
+
marginBottom: '1rem'
|
|
324
|
+
},
|
|
325
|
+
children: ["Every ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
326
|
+
children: "field.value"
|
|
327
|
+
}), " reads from ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
328
|
+
children: "formState"
|
|
329
|
+
}), ".", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
330
|
+
children: "onDataChange"
|
|
331
|
+
}), " keeps it in sync. Parent actions write directly to ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
332
|
+
children: "formState"
|
|
333
|
+
}), "."]
|
|
334
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
335
|
+
style: {
|
|
336
|
+
display: 'flex',
|
|
337
|
+
gap: 8,
|
|
338
|
+
marginBottom: '1.25rem',
|
|
339
|
+
flexWrap: 'wrap'
|
|
340
|
+
},
|
|
341
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
342
|
+
onClick: loadProfile,
|
|
343
|
+
style: {
|
|
344
|
+
padding: '6px 12px',
|
|
345
|
+
fontSize: '0.8rem',
|
|
346
|
+
cursor: 'pointer',
|
|
347
|
+
borderRadius: 5,
|
|
348
|
+
background: '#2185d0',
|
|
349
|
+
color: '#fff',
|
|
350
|
+
border: 'none'
|
|
351
|
+
},
|
|
352
|
+
children: "Load profile"
|
|
353
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
354
|
+
onClick: function onClick() {
|
|
355
|
+
return clearField('email');
|
|
356
|
+
},
|
|
357
|
+
style: {
|
|
358
|
+
padding: '6px 12px',
|
|
359
|
+
fontSize: '0.8rem',
|
|
360
|
+
cursor: 'pointer',
|
|
361
|
+
borderRadius: 5,
|
|
362
|
+
background: '#fff',
|
|
363
|
+
border: '1px solid #ccc'
|
|
364
|
+
},
|
|
365
|
+
children: "Clear email"
|
|
366
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
367
|
+
onClick: resetForm,
|
|
368
|
+
style: {
|
|
369
|
+
padding: '6px 12px',
|
|
370
|
+
fontSize: '0.8rem',
|
|
371
|
+
cursor: 'pointer',
|
|
372
|
+
borderRadius: 5,
|
|
373
|
+
background: '#fff',
|
|
374
|
+
border: '1px solid #ccc'
|
|
375
|
+
},
|
|
376
|
+
children: "Reset all"
|
|
377
|
+
})]
|
|
378
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
379
|
+
title: "User profile",
|
|
380
|
+
fields: fields,
|
|
381
|
+
submitText: "Save profile",
|
|
382
|
+
cancelText: "Reset all",
|
|
383
|
+
validateOnChange: true,
|
|
384
|
+
validateOnSubmit: true,
|
|
385
|
+
onDataChange: handleDataChange,
|
|
386
|
+
onFieldChange: handleFieldChange,
|
|
387
|
+
onSubmit: function onSubmit(data) {
|
|
388
|
+
return setSubmitted(data);
|
|
389
|
+
},
|
|
390
|
+
onCancel: resetForm
|
|
391
|
+
})]
|
|
392
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
466
393
|
style: {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
394
|
+
position: 'sticky',
|
|
395
|
+
top: 16,
|
|
396
|
+
display: 'flex',
|
|
397
|
+
flexDirection: 'column',
|
|
398
|
+
gap: 14
|
|
399
|
+
},
|
|
400
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
401
|
+
style: {
|
|
402
|
+
background: '#f9f9f9',
|
|
403
|
+
border: '1px solid #e0e0e0',
|
|
404
|
+
borderRadius: 8,
|
|
405
|
+
padding: '12px 14px'
|
|
406
|
+
},
|
|
407
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
408
|
+
style: {
|
|
409
|
+
fontSize: '0.78rem',
|
|
410
|
+
fontWeight: 600,
|
|
411
|
+
marginBottom: 6,
|
|
412
|
+
color: '#444'
|
|
413
|
+
},
|
|
414
|
+
children: ["Required \u2014 ", pct, "%"]
|
|
415
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
416
|
+
style: {
|
|
417
|
+
background: '#e0e0e0',
|
|
418
|
+
borderRadius: 4,
|
|
419
|
+
height: 8,
|
|
420
|
+
overflow: 'hidden'
|
|
421
|
+
},
|
|
422
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
423
|
+
style: {
|
|
424
|
+
width: "".concat(pct, "%"),
|
|
425
|
+
height: '100%',
|
|
426
|
+
transition: 'width .3s',
|
|
427
|
+
background: pct === 100 ? '#21ba45' : '#2185d0'
|
|
428
|
+
}
|
|
429
|
+
})
|
|
430
|
+
})]
|
|
431
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
432
|
+
style: {
|
|
433
|
+
background: '#f9f9f9',
|
|
434
|
+
border: '1px solid #e0e0e0',
|
|
435
|
+
borderRadius: 8,
|
|
436
|
+
padding: '12px 14px'
|
|
437
|
+
},
|
|
438
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
439
|
+
style: {
|
|
440
|
+
fontSize: '0.78rem',
|
|
441
|
+
fontWeight: 600,
|
|
442
|
+
marginBottom: 6,
|
|
443
|
+
color: '#444'
|
|
444
|
+
},
|
|
445
|
+
children: "formState (parent)"
|
|
446
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
|
|
447
|
+
style: {
|
|
448
|
+
fontSize: '0.7rem',
|
|
449
|
+
maxHeight: 240,
|
|
450
|
+
overflow: 'auto',
|
|
451
|
+
margin: 0,
|
|
452
|
+
color: '#222'
|
|
453
|
+
},
|
|
454
|
+
children: JSON.stringify(formState, null, 2)
|
|
455
|
+
})]
|
|
456
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
457
|
+
style: {
|
|
458
|
+
background: '#f9f9f9',
|
|
459
|
+
border: '1px solid #e0e0e0',
|
|
460
|
+
borderRadius: 8,
|
|
461
|
+
padding: '12px 14px'
|
|
462
|
+
},
|
|
463
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
464
|
+
style: {
|
|
465
|
+
fontSize: '0.78rem',
|
|
466
|
+
fontWeight: 600,
|
|
467
|
+
marginBottom: 6,
|
|
468
|
+
color: '#444'
|
|
469
|
+
},
|
|
470
|
+
children: "onFieldChange log"
|
|
471
|
+
}), fieldLog.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
472
|
+
style: {
|
|
473
|
+
fontSize: '0.75rem',
|
|
474
|
+
color: '#888',
|
|
475
|
+
margin: 0
|
|
476
|
+
},
|
|
477
|
+
children: "No changes yet."
|
|
478
|
+
}) : fieldLog.map(function (e, i) {
|
|
479
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
480
|
+
style: {
|
|
481
|
+
fontSize: '0.7rem',
|
|
482
|
+
borderBottom: '0.5px solid #eee',
|
|
483
|
+
paddingBottom: 3,
|
|
484
|
+
marginBottom: 3
|
|
485
|
+
},
|
|
486
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
487
|
+
style: {
|
|
488
|
+
color: '#aaa'
|
|
489
|
+
},
|
|
490
|
+
children: e.time
|
|
491
|
+
}), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
492
|
+
children: e.name
|
|
493
|
+
}), " \u2192 ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
494
|
+
children: e.value
|
|
495
|
+
}), e.option && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
496
|
+
style: {
|
|
497
|
+
color: '#888',
|
|
498
|
+
fontSize: '0.65rem'
|
|
499
|
+
},
|
|
500
|
+
children: ["option: ", e.option]
|
|
501
|
+
})]
|
|
502
|
+
}, i);
|
|
503
|
+
})]
|
|
504
|
+
}), submitted && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
505
|
+
style: {
|
|
506
|
+
background: '#f0f8f0',
|
|
507
|
+
border: '1px solid #b2dfb2',
|
|
508
|
+
borderRadius: 8,
|
|
509
|
+
padding: '12px 14px'
|
|
510
|
+
},
|
|
511
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
512
|
+
style: {
|
|
513
|
+
fontSize: '0.78rem',
|
|
514
|
+
fontWeight: 600,
|
|
515
|
+
marginBottom: 6,
|
|
516
|
+
color: '#2d6a2d'
|
|
517
|
+
},
|
|
518
|
+
children: "\u2713 Submitted"
|
|
519
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
|
|
520
|
+
style: {
|
|
521
|
+
fontSize: '0.7rem',
|
|
522
|
+
maxHeight: 200,
|
|
523
|
+
overflow: 'auto',
|
|
524
|
+
margin: 0,
|
|
525
|
+
color: '#222'
|
|
526
|
+
},
|
|
527
|
+
children: JSON.stringify(submitted, null, 2)
|
|
528
|
+
})]
|
|
529
|
+
})]
|
|
530
|
+
})]
|
|
531
|
+
});
|
|
494
532
|
};
|
|
495
533
|
var _default = exports["default"] = Demo2;
|
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _semanticUiReact = require("semantic-ui-react");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
12
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
13
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -50,45 +51,53 @@ var CustomAccordion = function CustomAccordion(_ref) {
|
|
|
50
51
|
if (!Array.isArray(content)) return content;
|
|
51
52
|
// Legacy {label, value} row format
|
|
52
53
|
if (content.length > 0 && ((_content$ = content[0]) === null || _content$ === void 0 ? void 0 : _content$.label) !== undefined) {
|
|
53
|
-
return /*#__PURE__*/
|
|
54
|
-
className: "ef-accordion-content"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
55
|
+
className: "ef-accordion-content",
|
|
56
|
+
children: content.map(function (item, idx) {
|
|
57
|
+
var _item$value;
|
|
58
|
+
return item.label === '---' ? /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}, idx) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
59
|
+
className: "ef-info-row",
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
61
|
+
children: item.label
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
63
|
+
children: (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 'N/A'
|
|
64
|
+
})]
|
|
65
|
+
}, idx);
|
|
66
|
+
})
|
|
67
|
+
});
|
|
64
68
|
}
|
|
65
69
|
return content;
|
|
66
70
|
};
|
|
67
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
68
72
|
id: name,
|
|
69
|
-
style: mainDivStyle
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
style: mainDivStyle,
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.Accordion, {
|
|
75
|
+
fluid: true,
|
|
76
|
+
styled: true,
|
|
77
|
+
className: "ef-accordion",
|
|
78
|
+
style: inputStyle,
|
|
79
|
+
children: sections.map(function (section, index) {
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_semanticUiReact.Accordion.Title, {
|
|
82
|
+
active: activeIndex.includes(index),
|
|
83
|
+
index: index,
|
|
84
|
+
onClick: handleClick,
|
|
85
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.Icon, {
|
|
86
|
+
name: "dropdown"
|
|
87
|
+
}), section.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
88
|
+
style: {
|
|
89
|
+
marginRight: 8
|
|
90
|
+
},
|
|
91
|
+
children: section.icon
|
|
92
|
+
}), section.title]
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.Accordion.Content, {
|
|
94
|
+
active: activeIndex.includes(index),
|
|
95
|
+
children: renderContent(section.content)
|
|
96
|
+
})]
|
|
97
|
+
}, index);
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
});
|
|
92
101
|
};
|
|
93
102
|
CustomAccordion.propTypes = {
|
|
94
103
|
name: _propTypes["default"].string.isRequired,
|
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _defaults = require("./defaults");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -44,22 +45,23 @@ var CustomCheckbox = function CustomCheckbox(_ref) {
|
|
|
44
45
|
var handleChange = (0, _react.useCallback)(function (e) {
|
|
45
46
|
return onChange === null || onChange === void 0 ? void 0 : onChange(name, e.target.checked);
|
|
46
47
|
}, [onChange, name]);
|
|
47
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
48
49
|
className: "ufg-checkbox-item",
|
|
49
50
|
id: name,
|
|
50
51
|
style: _objectSpread({
|
|
51
52
|
margin: "0 0 5px"
|
|
52
|
-
}, mainDivStyle)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
}, mainDivStyle),
|
|
54
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
55
|
+
id: "form-input-".concat(name),
|
|
56
|
+
type: "checkbox",
|
|
57
|
+
name: name,
|
|
58
|
+
checked: checked,
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
required: required,
|
|
61
|
+
style: inputStyle,
|
|
62
|
+
onChange: handleChange
|
|
63
|
+
}), (0, _defaults.labelJsx)(name, labelStyle, displayName, required, spanStyle, showHelp, helpText), (0, _defaults.errorJsx)(error), (0, _defaults.tooltipJsx)(tooltip, tooltipStyle)]
|
|
64
|
+
});
|
|
63
65
|
};
|
|
64
66
|
CustomCheckbox.propTypes = {
|
|
65
67
|
onChange: _propTypes["default"].func.isRequired,
|