@insticc/genericform 2.0.1 → 2.0.3

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 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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
11
12
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -17,8 +18,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /**
17
18
  * Full GenericForm demo — every field type + every key scenario.
18
19
  *
19
20
  * Mount anywhere: <Demo />
20
- */
21
- // ── Shared option sets ────────────────────────────────────────────────────────
21
+ */ // ── Shared option sets ────────────────────────────────────────────────────────
22
22
  var COUNTRIES = [{
23
23
  value: "PT",
24
24
  text: "Portugal"
@@ -368,40 +368,44 @@ var Demo = function Demo() {
368
368
  sections: [{
369
369
  title: "Advanced settings",
370
370
  icon: "⚙️",
371
- content: /*#__PURE__*/React.createElement("div", {
371
+ content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
372
372
  style: {
373
373
  display: "flex",
374
374
  flexDirection: "column",
375
375
  gap: 8
376
- }
377
- }, /*#__PURE__*/React.createElement("label", {
378
- style: {
379
- fontSize: "0.9rem"
380
- }
381
- }, /*#__PURE__*/React.createElement("input", {
382
- type: "checkbox",
383
- style: {
384
- marginRight: 6
385
- }
386
- }), "Enable experimental features"), /*#__PURE__*/React.createElement("label", {
387
- style: {
388
- fontSize: "0.9rem"
389
- }
390
- }, /*#__PURE__*/React.createElement("input", {
391
- type: "checkbox",
392
- style: {
393
- marginRight: 6
394
- }
395
- }), "Verbose logging"))
376
+ },
377
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
378
+ style: {
379
+ fontSize: "0.9rem"
380
+ },
381
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
382
+ type: "checkbox",
383
+ style: {
384
+ marginRight: 6
385
+ }
386
+ }), "Enable experimental features"]
387
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
388
+ style: {
389
+ fontSize: "0.9rem"
390
+ },
391
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
392
+ type: "checkbox",
393
+ style: {
394
+ marginRight: 6
395
+ }
396
+ }), "Verbose logging"]
397
+ })]
398
+ })
396
399
  }, {
397
400
  title: "Danger zone",
398
401
  icon: "⚠️",
399
- content: /*#__PURE__*/React.createElement("p", {
402
+ content: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
400
403
  style: {
401
404
  color: "#db2828",
402
405
  fontSize: "0.9rem"
403
- }
404
- }, "Destructive actions go here.")
406
+ },
407
+ children: "Destructive actions go here."
408
+ })
405
409
  }]
406
410
  },
407
411
  // ── Custom component ──────────────────────────────────────────────────
@@ -416,7 +420,7 @@ var Demo = function Demo() {
416
420
  name: "avatar",
417
421
  type: "component",
418
422
  displayName: "Avatar preview",
419
- component: /*#__PURE__*/React.createElement("div", {
423
+ component: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
420
424
  style: {
421
425
  width: 64,
422
426
  height: 64,
@@ -428,8 +432,9 @@ var Demo = function Demo() {
428
432
  color: "#fff",
429
433
  fontSize: 24,
430
434
  fontWeight: 600
431
- }
432
- }, "A")
435
+ },
436
+ children: "A"
437
+ })
433
438
  },
434
439
  // ── Conditional (hide as function) ────────────────────────────────────
435
440
  {
@@ -496,64 +501,71 @@ var Demo = function Demo() {
496
501
  return alert("Reset clicked");
497
502
  }
498
503
  }];
499
- return /*#__PURE__*/React.createElement("div", {
504
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
500
505
  style: {
501
506
  maxWidth: 800,
502
507
  margin: "2rem auto",
503
508
  fontFamily: "sans-serif"
504
- }
505
- }, /*#__PURE__*/React.createElement("h1", {
506
- style: {
507
- fontSize: "1.4rem",
508
- marginBottom: "0.5rem"
509
- }
510
- }, "GenericForm \u2014 full demo"), /*#__PURE__*/React.createElement("p", {
511
- style: {
512
- color: "#666",
513
- marginBottom: "1.5rem",
514
- fontSize: "0.9rem"
515
- }
516
- }, "Every field type, conditional visibility, validation, custom actions, and onSubmit."), /*#__PURE__*/React.createElement(_index["default"], {
517
- title: "Demo form",
518
- fields: fields,
519
- submitText: "Submit demo",
520
- cancelText: "Clear",
521
- customActions: customActions,
522
- validateOnChange: true,
523
- validateOnSubmit: true,
524
- onSubmit: function onSubmit(data) {
525
- console.log("Submitted:", data);
526
- setLastSubmit(data);
527
509
  },
528
- onCancel: function onCancel() {
529
- return setLastSubmit(null);
530
- }
531
- // Date handlers
532
- ,
533
- onChangeTime: function onChangeTime(date, name) {
534
- return console.log("date:", name, date);
535
- },
536
- onChangeYear: function onChangeYear(date, name) {
537
- return console.log("year:", name, date);
538
- }
539
- // Search
540
- ,
541
- handleSearchChange: function handleSearchChange() {},
542
- handleResultSelect: function handleResultSelect() {}
543
- }), lastSubmit && /*#__PURE__*/React.createElement("div", {
544
- style: {
545
- marginTop: "2rem",
546
- padding: "1rem",
547
- background: "#f0f8f0",
548
- borderRadius: 8,
549
- border: "1px solid #b2dfb2"
550
- }
551
- }, /*#__PURE__*/React.createElement("strong", null, "Last submitted data:"), /*#__PURE__*/React.createElement("pre", {
552
- style: {
553
- marginTop: 8,
554
- fontSize: "0.8rem",
555
- overflow: "auto"
556
- }
557
- }, JSON.stringify(lastSubmit, null, 2))));
510
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
511
+ style: {
512
+ fontSize: "1.4rem",
513
+ marginBottom: "0.5rem"
514
+ },
515
+ children: "GenericForm \u2014 full demo"
516
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
517
+ style: {
518
+ color: "#666",
519
+ marginBottom: "1.5rem",
520
+ fontSize: "0.9rem"
521
+ },
522
+ children: "Every field type, conditional visibility, validation, custom actions, and onSubmit."
523
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
524
+ title: "Demo form",
525
+ fields: fields,
526
+ submitText: "Submit demo",
527
+ cancelText: "Clear",
528
+ customActions: customActions,
529
+ validateOnChange: true,
530
+ validateOnSubmit: true,
531
+ onSubmit: function onSubmit(data) {
532
+ console.log("Submitted:", data);
533
+ setLastSubmit(data);
534
+ },
535
+ onCancel: function onCancel() {
536
+ return setLastSubmit(null);
537
+ }
538
+ // Date handlers
539
+ ,
540
+ onChangeTime: function onChangeTime(date, name) {
541
+ return console.log("date:", name, date);
542
+ },
543
+ onChangeYear: function onChangeYear(date, name) {
544
+ return console.log("year:", name, date);
545
+ }
546
+ // Search
547
+ ,
548
+ handleSearchChange: function handleSearchChange() {},
549
+ handleResultSelect: function handleResultSelect() {}
550
+ }), lastSubmit && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
551
+ style: {
552
+ marginTop: "2rem",
553
+ padding: "1rem",
554
+ background: "#f0f8f0",
555
+ borderRadius: 8,
556
+ border: "1px solid #b2dfb2"
557
+ },
558
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
559
+ children: "Last submitted data:"
560
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
561
+ style: {
562
+ marginTop: 8,
563
+ fontSize: "0.8rem",
564
+ overflow: "auto"
565
+ },
566
+ children: JSON.stringify(lastSubmit, null, 2)
567
+ })]
568
+ })]
569
+ });
558
570
  };
559
571
  var _default = exports["default"] = Demo;