@react-typed-forms/schemas-html 4.2.0 → 5.0.0

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.
Files changed (33) hide show
  1. package/lib/adornments/optionalAdornment.d.ts +4 -25
  2. package/lib/components/ArrayElementRenderer.d.ts +1 -4
  3. package/lib/components/AutocompleteRenderer.d.ts +1 -7
  4. package/lib/components/CheckRenderer.d.ts +3 -29
  5. package/lib/components/ControlInput.d.ts +2 -1
  6. package/lib/components/DefaultAccordion.d.ts +13 -6
  7. package/lib/components/DefaultArrayRenderer.d.ts +2 -9
  8. package/lib/components/DefaultDialogRenderer.d.ts +2 -8
  9. package/lib/components/DefaultDisplay.d.ts +3 -6
  10. package/lib/components/DefaultDisplayOnly.d.ts +3 -3
  11. package/lib/components/DefaultGroupRenderer.d.ts +2 -16
  12. package/lib/components/DefaultLayout.d.ts +4 -8
  13. package/lib/components/DefaultVisibility.d.ts +1 -1
  14. package/lib/components/DefaultWizardRenderer.d.ts +1 -27
  15. package/lib/components/GridRenderer.d.ts +1 -5
  16. package/lib/components/HtmlCheckButtons.d.ts +3 -0
  17. package/lib/components/JsonataRenderer.d.ts +2 -1
  18. package/lib/components/MultilineTextfield.d.ts +2 -1
  19. package/lib/components/ScrollListRenderer.d.ts +2 -0
  20. package/lib/components/SelectDataRenderer.d.ts +3 -6
  21. package/lib/components/TabsRenderer.d.ts +1 -9
  22. package/lib/components/ValueForFieldRenderer.d.ts +2 -10
  23. package/lib/createButtonActionRenderer.d.ts +2 -20
  24. package/lib/createDefaultRenderers.d.ts +8 -83
  25. package/lib/index.cjs +718 -550
  26. package/lib/index.cjs.map +1 -1
  27. package/lib/index.d.ts +3 -1
  28. package/lib/index.js +655 -475
  29. package/lib/index.js.map +1 -1
  30. package/lib/rendererOptions.d.ts +218 -0
  31. package/lib/tailwind.d.ts +14 -2
  32. package/package.json +6 -6
  33. package/lib/components/VisibleChildrenRenderer.d.ts +0 -14
package/lib/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
+ var react = require('react');
1
2
  var clsx = require('clsx');
2
3
  var schemas = require('@react-typed-forms/schemas');
3
4
  var jsxRuntime = require('react/jsx-runtime');
4
5
  var core = require('@react-typed-forms/core');
5
- var react = require('react');
6
6
  var ariaBase = require('@astroapps/aria-base');
7
7
  var base = require('@mui/base');
8
8
  var overlays = require('@react-stately/overlays');
@@ -94,6 +94,9 @@ function _extends() {
94
94
  return n;
95
95
  }, _extends.apply(null, arguments);
96
96
  }
97
+ function _inheritsLoose(t, o) {
98
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
99
+ }
97
100
  function _objectDestructuringEmpty(t) {
98
101
  if (null == t) throw new TypeError("Cannot destructure " + t);
99
102
  }
@@ -101,13 +104,18 @@ function _objectWithoutPropertiesLoose(r, e) {
101
104
  if (null == r) return {};
102
105
  var t = {};
103
106
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
104
- if (e.includes(n)) continue;
107
+ if (-1 !== e.indexOf(n)) continue;
105
108
  t[n] = r[n];
106
109
  }
107
110
  return t;
108
111
  }
112
+ function _setPrototypeOf(t, e) {
113
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
114
+ return t.__proto__ = e, t;
115
+ }, _setPrototypeOf(t, e);
116
+ }
109
117
 
110
- var _excluded$4 = ["control", "convert", "renderer"],
118
+ var _excluded$4 = ["control", "convert", "renderer", "errorId"],
111
119
  _excluded2$2 = ["errorText", "value", "onChange", "ref"];
112
120
  function ControlInput(_ref) {
113
121
  var _effect = core.useComponentTracking();
@@ -118,6 +126,7 @@ function ControlInput(_ref) {
118
126
  var control = _ref.control,
119
127
  convert = _ref.convert,
120
128
  renderer = _ref.renderer,
129
+ errorId = _ref.errorId,
121
130
  props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
122
131
  var _formControlProps = core.formControlProps(control),
123
132
  errorText = _formControlProps.errorText,
@@ -138,6 +147,8 @@ function ControlInput(_ref) {
138
147
  inputRef: ref,
139
148
  type: convert[0],
140
149
  value: textValue.value,
150
+ "aria-describedby": !!errorText ? errorId : undefined,
151
+ "aria-invalid": !!errorText || undefined,
141
152
  onChangeValue: function onChangeValue(e) {
142
153
  textValue.value = e;
143
154
  var converted = convert[1](e);
@@ -211,7 +222,8 @@ function createSelectRenderer(options) {
211
222
  options = {};
212
223
  }
213
224
  return schemas.createDataRenderer(function (props, asArray) {
214
- var _props$options;
225
+ var _props$options, _renderOptions$requir;
226
+ var renderOptions = props.definition.renderOptions;
215
227
  return /*#__PURE__*/jsxRuntime.jsx(SelectDataRenderer, {
216
228
  className: schemas.rendererClass(props.className, options.className),
217
229
  state: props.control,
@@ -220,7 +232,7 @@ function createSelectRenderer(options) {
220
232
  options: (_props$options = props.options) != null ? _props$options : [],
221
233
  required: props.required,
222
234
  emptyText: options.emptyText,
223
- requiredText: options.requiredText,
235
+ requiredText: (_renderOptions$requir = renderOptions == null ? void 0 : renderOptions.requiredText) != null ? _renderOptions$requir : options.requiredText,
224
236
  convert: createSelectConversion(props.field.type)
225
237
  });
226
238
  }, {
@@ -312,7 +324,7 @@ function createRadioRenderer(options) {
312
324
  options = {};
313
325
  }
314
326
  return schemas.createDataRenderer(function (p, renderer) {
315
- return /*#__PURE__*/jsxRuntime.jsx(CheckButtons, _extends({
327
+ return /*#__PURE__*/jsxRuntime.jsx(renderer.html.CheckButtons, _extends({
316
328
  classes: options,
317
329
  controlClasses: p.renderOptions
318
330
  }, p, {
@@ -338,7 +350,7 @@ function createCheckListRenderer(options) {
338
350
  options = {};
339
351
  }
340
352
  return schemas.createDataRenderer(function (p, renderer) {
341
- return /*#__PURE__*/jsxRuntime.jsx(CheckButtons, _extends({
353
+ return /*#__PURE__*/jsxRuntime.jsx(renderer.html.CheckButtons, _extends({
342
354
  classes: options,
343
355
  controlClasses: p.renderOptions
344
356
  }, p, {
@@ -350,7 +362,7 @@ function createCheckListRenderer(options) {
350
362
  setChecked: function setChecked(c, o, checked) {
351
363
  c.setTouched(true);
352
364
  c.setValue(function (x) {
353
- return setIncluded(x != null ? x : [], o.value, checked);
365
+ return schemas.setIncluded(x != null ? x : [], o.value, checked);
354
366
  });
355
367
  },
356
368
  control: p.control,
@@ -363,85 +375,6 @@ function createCheckListRenderer(options) {
363
375
  renderType: schemas.DataRenderType.CheckList
364
376
  });
365
377
  }
366
- function CheckButtons(_ref) {
367
- var _effect = core.useComponentTracking();
368
- try {
369
- var control = _ref.control,
370
- options = _ref.options,
371
- readonly = _ref.readonly,
372
- className = _ref.className,
373
- id = _ref.id,
374
- type = _ref.type,
375
- isChecked = _ref.isChecked,
376
- setChecked = _ref.setChecked,
377
- entryAdornment = _ref.entryAdornment,
378
- classes = _ref.classes,
379
- _ref$controlClasses = _ref.controlClasses,
380
- controlClasses = _ref$controlClasses === void 0 ? {} : _ref$controlClasses,
381
- renderer = _ref.renderer;
382
- var _renderer$html = renderer.html,
383
- Button = _renderer$html.Button,
384
- Input = _renderer$html.Input,
385
- Label = _renderer$html.Label,
386
- Div = _renderer$html.Div;
387
- var disabled = control.disabled;
388
- var name = "r" + control.uniqueId;
389
- return /*#__PURE__*/jsxRuntime.jsx(Div, {
390
- className: className,
391
- id: id,
392
- children: /*#__PURE__*/jsxRuntime.jsx(core.RenderArrayElements, {
393
- array: options == null ? void 0 : options.filter(function (x) {
394
- return x.value != null;
395
- }),
396
- children: function children(o, i) {
397
- var checked = core.useComputed(function () {
398
- return isChecked(control, o);
399
- }).value;
400
- var selOrUnsel = checked ? schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.selectedClass, classes.selectedClass) : schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.notSelectedClass, classes.notSelectedClass);
401
- return /*#__PURE__*/jsxRuntime.jsxs(Button, {
402
- className: clsx__default["default"](schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
403
- onClick: function onClick() {
404
- return !readonly && setChecked(control, o, !checked);
405
- },
406
- children: [/*#__PURE__*/jsxRuntime.jsxs(Div, {
407
- className: classes.entryClass,
408
- children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
409
- id: name + "_" + i,
410
- className: classes.checkClass,
411
- type: type,
412
- name: name,
413
- readOnly: readonly,
414
- disabled: disabled,
415
- checked: checked,
416
- onChangeChecked: function onChangeChecked(x) {
417
- !readonly && setChecked(control, o, x);
418
- }
419
- }), /*#__PURE__*/jsxRuntime.jsx(Label, {
420
- className: classes.labelClass,
421
- htmlFor: name + "_" + i,
422
- children: o.name
423
- })]
424
- }), entryAdornment == null ? void 0 : entryAdornment(o, i, checked)]
425
- });
426
- }
427
- })
428
- });
429
- } finally {
430
- _effect();
431
- }
432
- }
433
- function setIncluded(array, elem, included) {
434
- var already = array.includes(elem);
435
- if (included === already) {
436
- return array;
437
- }
438
- if (included) {
439
- return [].concat(array, [elem]);
440
- }
441
- return array.filter(function (e) {
442
- return e !== elem;
443
- });
444
- }
445
378
  function createCheckboxRenderer(options) {
446
379
  if (options === void 0) {
447
380
  options = {};
@@ -482,35 +415,16 @@ function createElementSelectedRenderer(options) {
482
415
  renderType: schemas.DataRenderType.ElementSelected
483
416
  });
484
417
  }
485
- function CheckBoxSelected(_ref2) {
486
- var _effect2 = core.useComponentTracking();
418
+ function CheckBoxSelected(_ref) {
419
+ var _effect = core.useComponentTracking();
487
420
  try {
488
- var p = _ref2.p,
489
- props = _ref2.props,
490
- renderer = _ref2.renderer,
491
- options = _ref2.options;
421
+ var _p$label;
422
+ var p = _ref.p,
423
+ props = _ref.props,
424
+ renderer = _ref.renderer,
425
+ options = _ref.options;
492
426
  var Div = renderer.html.Div;
493
- var elementValue = core.useControl();
494
- react.useEffect(function () {
495
- props.runExpression(elementValue, props.renderOptions.elementExpression, function (v) {
496
- return elementValue.value = v;
497
- });
498
- });
499
- var isSelected = core.useComputed(function () {
500
- var _props$control$as$val, _props$control$as$val2;
501
- return (_props$control$as$val = (_props$control$as$val2 = props.control.as().value) == null ? void 0 : _props$control$as$val2.includes(elementValue.current.value)) != null ? _props$control$as$val : false;
502
- });
503
- var selControl = core.useControl(function () {
504
- return isSelected.current.value;
505
- });
506
- selControl.value = isSelected.value;
507
- core.useControlEffect(function () {
508
- return selControl.value;
509
- }, function (v) {
510
- props.control.as().setValue(function (x) {
511
- return setIncluded(x != null ? x : [], elementValue.value, v);
512
- });
513
- });
427
+ var selControl = schemas.useElementSelectedRenderer(props);
514
428
  return /*#__PURE__*/jsxRuntime.jsxs(Div, {
515
429
  className: schemas.rendererClass(props.className, options.entryClass),
516
430
  children: [/*#__PURE__*/jsxRuntime.jsx(Fcheckbox, {
@@ -519,19 +433,19 @@ function CheckBoxSelected(_ref2) {
519
433
  style: props.style,
520
434
  className: options.checkClass,
521
435
  renderer: renderer
522
- }), p.label && renderer.renderLabel(p.label, undefined, undefined)]
436
+ }), ((_p$label = p.label) == null ? void 0 : _p$label.label) && renderer.renderLabel(p.label, undefined, undefined)]
523
437
  });
524
438
  } finally {
525
- _effect2();
439
+ _effect();
526
440
  }
527
441
  }
528
- function CheckBox(_ref3) {
529
- var _effect3 = core.useComponentTracking();
442
+ function CheckBox(_ref2) {
443
+ var _effect2 = core.useComponentTracking();
530
444
  try {
531
- var p = _ref3.p,
532
- props = _ref3.props,
533
- renderer = _ref3.renderer,
534
- options = _ref3.options;
445
+ var p = _ref2.p,
446
+ props = _ref2.props,
447
+ renderer = _ref2.renderer,
448
+ options = _ref2.options;
535
449
  var Div = renderer.html.Div;
536
450
  return /*#__PURE__*/jsxRuntime.jsxs(Div, {
537
451
  className: schemas.rendererClass(props.className, options.entryClass),
@@ -544,19 +458,19 @@ function CheckBox(_ref3) {
544
458
  }), p.label && renderer.renderLabel(p.label, undefined, undefined)]
545
459
  });
546
460
  } finally {
547
- _effect3();
461
+ _effect2();
548
462
  }
549
463
  }
550
- function Fcheckbox(_ref4) {
551
- var _effect4 = core.useComponentTracking();
464
+ function Fcheckbox(_ref3) {
465
+ var _effect3 = core.useComponentTracking();
552
466
  try {
553
- var control = _ref4.control,
554
- _ref4$type = _ref4.type,
555
- type = _ref4$type === void 0 ? "checkbox" : _ref4$type,
556
- _ref4$notValue = _ref4.notValue,
557
- notValue = _ref4$notValue === void 0 ? false : _ref4$notValue,
558
- renderer = _ref4.renderer,
559
- others = _objectWithoutPropertiesLoose(_ref4, _excluded$2);
467
+ var control = _ref3.control,
468
+ _ref3$type = _ref3.type,
469
+ type = _ref3$type === void 0 ? "checkbox" : _ref3$type,
470
+ _ref3$notValue = _ref3.notValue,
471
+ notValue = _ref3$notValue === void 0 ? false : _ref3$notValue,
472
+ renderer = _ref3.renderer,
473
+ others = _objectWithoutPropertiesLoose(_ref3, _excluded$2);
560
474
  var Input = renderer.html.Input;
561
475
  var _formControlProps = core.formControlProps(control),
562
476
  value = _formControlProps.value,
@@ -576,7 +490,7 @@ function Fcheckbox(_ref4) {
576
490
  type: type
577
491
  }, others));
578
492
  } finally {
579
- _effect4();
493
+ _effect3();
580
494
  }
581
495
  }
582
496
 
@@ -609,9 +523,10 @@ function DefaultLayout(_ref) {
609
523
  Div = _ref$renderer$html.Div,
610
524
  Span = _ref$renderer$html.Span,
611
525
  _ref$renderError = _ref.renderError,
612
- renderError = _ref$renderError === void 0 ? function (e) {
526
+ renderError = _ref$renderError === void 0 ? function (e, errorId) {
613
527
  return e && /*#__PURE__*/jsxRuntime.jsx(Div, {
614
528
  children: /*#__PURE__*/jsxRuntime.jsx(Span, {
529
+ id: errorId,
615
530
  className: errorClass,
616
531
  children: e
617
532
  })
@@ -622,11 +537,12 @@ function DefaultLayout(_ref) {
622
537
  controlStart = _ref$layout.controlStart,
623
538
  label = _ref$layout.label,
624
539
  children = _ref$layout.children,
625
- errorControl = _ref$layout.errorControl;
540
+ errorControl = _ref$layout.errorControl,
541
+ errorId = _ref$layout.errorId;
626
542
  var ec = errorControl;
627
543
  var errorText = ec && ec.touched ? ec.error : undefined;
628
544
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
629
- children: [label, controlStart, children, renderError(errorText), controlEnd]
545
+ children: [label, controlStart, children, renderError(errorText, errorId), controlEnd]
630
546
  });
631
547
  } finally {
632
548
  _effect();
@@ -646,7 +562,8 @@ function DefaultDisplayOnly(_ref) {
646
562
  textClass = _ref.textClass,
647
563
  inline = _ref.inline,
648
564
  state = _ref.state;
649
- var text = state.display != null ? state.display : (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
565
+ var display = state.resolved.display;
566
+ var text = display != null ? display : (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
650
567
  var Div = renderer.html.Div;
651
568
  return /*#__PURE__*/jsxRuntime.jsx(Div, {
652
569
  style: style,
@@ -660,135 +577,24 @@ function DefaultDisplayOnly(_ref) {
660
577
  }
661
578
  }
662
579
 
663
- function DefaultAccordion(_ref) {
664
- var _effect = core.useComponentTracking();
665
- try {
666
- var _dataContext$dataNode;
667
- var children = _ref.children,
668
- accordion = _ref.accordion,
669
- contentStyle = _ref.contentStyle,
670
- contentClassName = _ref.contentClassName,
671
- designMode = _ref.designMode,
672
- iconOpen = _ref.iconOpen,
673
- iconClosed = _ref.iconClosed,
674
- className = _ref.className,
675
- _ref$renderTitle = _ref.renderTitle,
676
- renderTitle = _ref$renderTitle === void 0 ? function (t) {
677
- return t;
678
- } : _ref$renderTitle,
679
- renderToggler = _ref.renderToggler,
680
- renderers = _ref.renderers,
681
- titleClass = _ref.titleClass,
682
- useCss = _ref.useCss,
683
- dataContext = _ref.dataContext;
684
- var _renderers$html = renderers.html,
685
- Button = _renderers$html.Button,
686
- I = _renderers$html.I,
687
- Div = _renderers$html.Div,
688
- Label = _renderers$html.Label;
689
- var dataControl = ((_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode).control;
690
- var open = core.useControl(!!accordion.defaultExpanded);
691
- if (dataControl && !dataControl.meta.accordionState) {
692
- dataControl.meta.accordionState = open;
693
- }
694
- var isOpen = open.value;
695
- var fullContentStyle = isOpen || designMode ? contentStyle : _extends({}, contentStyle, {
696
- display: "none"
697
- });
698
- var title = renderers.renderLabelText(renderTitle(accordion.title, open));
699
- var currentIcon = isOpen ? iconOpen : iconClosed;
700
- var toggler = renderToggler ? renderToggler(open, title) : /*#__PURE__*/jsxRuntime.jsxs(Button, {
701
- className: className,
702
- onClick: function onClick() {
703
- return open.setValue(function (x) {
704
- return !x;
705
- });
706
- },
707
- children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
708
- className: titleClass,
709
- children: title
710
- }), currentIcon && /*#__PURE__*/jsxRuntime.jsx(I, {
711
- iconLibrary: currentIcon.library,
712
- iconName: currentIcon.name
713
- })]
714
- });
715
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
716
- children: [toggler, (useCss || isOpen || designMode) && /*#__PURE__*/jsxRuntime.jsx(Div, {
717
- style: fullContentStyle,
718
- className: contentClassName,
719
- children: children
720
- })]
721
- });
722
- } finally {
723
- _effect();
724
- }
725
- }
726
- function getAccordionState(c) {
727
- return c.meta.accordionState;
728
- }
729
-
730
- /**
731
- * @trackControls
732
- */
733
- function VisibleChildrenRenderer(props) {
734
- var _effect = core.useComponentTracking();
735
- try {
736
- var childStates = props.parentFormNode.getChildNodes().map(function (x) {
737
- return props.parent.getChildState(x);
738
- });
739
- return props.render(props.props, function (i) {
740
- return !childStates[i].hidden;
741
- });
742
- } finally {
743
- _effect();
744
- }
745
- }
746
-
747
580
  function createTabsRenderer(options) {
748
581
  if (options === void 0) {
749
582
  options = {};
750
583
  }
751
584
  return schemas.createGroupRenderer(function (p, renderer) {
752
- return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
753
- render: renderAllTabs,
754
- dataContext: p.dataContext,
755
- parentFormNode: p.formNode,
756
- parent: p,
757
- props: {
758
- groupProps: p,
759
- tabOptions: p.renderOptions,
760
- options: options
761
- }
585
+ return /*#__PURE__*/jsxRuntime.jsx(TabsRenderer, {
586
+ groupProps: p,
587
+ tabOptions: p.renderOptions,
588
+ options: options
762
589
  });
763
590
  }, {
764
591
  renderType: schemas.GroupRenderType.Tabs
765
592
  });
766
- function renderAllTabs(_ref, isVisible) {
767
- var _tabIndex$value;
768
- var options = _ref.options,
769
- _ref$groupProps = _ref.groupProps,
770
- designMode = _ref$groupProps.designMode,
771
- formNode = _ref$groupProps.formNode,
772
- className = _ref$groupProps.className,
773
- renderChild = _ref$groupProps.renderChild,
774
- state = _ref$groupProps.state,
775
- tabOptions = _ref.tabOptions;
776
- var tabIndex = state.meta.fields.tabIndex.as();
777
- var tabClass = options.tabClass,
778
- labelClass = options.labelClass,
779
- tabListClass = options.tabListClass,
780
- inactiveClass = options.inactiveClass,
781
- activeClass = options.activeClass,
782
- contentClass = options.contentClass;
783
- var currentTab = (_tabIndex$value = tabIndex.value) != null ? _tabIndex$value : 0;
784
- return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
785
- children: formNode.getChildNodes().map(function (x, i) {
786
- return renderTabs([x], i);
787
- })
788
- }) : renderTabs(formNode.getChildNodes().filter(function (x, i) {
789
- return isVisible(i);
790
- }), 0);
791
- function renderTabs(tabs, key) {
593
+ }
594
+ function TabsRenderer(_ref) {
595
+ var _effect = core.useComponentTracking();
596
+ try {
597
+ var renderTabs = function renderTabs(tabs, key) {
792
598
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
793
599
  className: schemas.rendererClass(className, options.className),
794
600
  children: [/*#__PURE__*/jsxRuntime.jsx("ul", {
@@ -807,58 +613,116 @@ function createTabsRenderer(options) {
807
613
  })
808
614
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
809
615
  className: schemas.rendererClass(tabOptions.contentClass, contentClass),
810
- children: renderChild(currentTab, tabs[currentTab])
616
+ children: renderChild(tabs[currentTab])
811
617
  })]
812
618
  }, key);
813
- }
619
+ };
620
+ var options = _ref.options,
621
+ _ref$groupProps = _ref.groupProps,
622
+ designMode = _ref$groupProps.designMode,
623
+ formNode = _ref$groupProps.formNode,
624
+ className = _ref$groupProps.className,
625
+ renderChild = _ref$groupProps.renderChild,
626
+ tabOptions = _ref.tabOptions;
627
+ var tabIndex = core.useControl(0);
628
+ react.useEffect(function () {
629
+ formNode.attachUi(new TabUi(tabIndex, formNode));
630
+ }, [formNode, tabIndex]);
631
+ var tabClass = options.tabClass,
632
+ labelClass = options.labelClass,
633
+ tabListClass = options.tabListClass,
634
+ inactiveClass = options.inactiveClass,
635
+ activeClass = options.activeClass,
636
+ contentClass = options.contentClass;
637
+ var currentTab = tabIndex.value;
638
+ return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
639
+ children: formNode.children.map(function (x, i) {
640
+ return renderTabs([x], i);
641
+ })
642
+ }) : renderTabs(formNode.children.filter(function (x, i) {
643
+ return x.visible;
644
+ }), 0);
645
+ } finally {
646
+ _effect();
814
647
  }
815
648
  }
649
+ var TabUi = /*#__PURE__*/function (_DefaultFormNodeUi) {
650
+ function TabUi(tabIndex, node) {
651
+ var _this;
652
+ _this = _DefaultFormNodeUi.call(this, node) || this;
653
+ _this.tabIndex = void 0;
654
+ _this.tabIndex = tabIndex;
655
+ return _this;
656
+ }
657
+ _inheritsLoose(TabUi, _DefaultFormNodeUi);
658
+ var _proto = TabUi.prototype;
659
+ _proto.ensureChildVisible = function ensureChildVisible(childIndex) {
660
+ this.tabIndex.value = childIndex;
661
+ _DefaultFormNodeUi.prototype.ensureChildVisible.call(this, childIndex);
662
+ };
663
+ return TabUi;
664
+ }(schemas.DefaultFormNodeUi);
816
665
 
817
666
  function createGridRenderer(options) {
818
667
  return schemas.createGroupRenderer(function (props, formRenderer) {
819
- return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
820
- props: _extends({}, props, {
821
- formRenderer: formRenderer,
822
- defaultOptions: options
823
- }),
824
- render: renderGrid,
825
- parent: props,
826
- dataContext: props.dataContext,
827
- parentFormNode: props.formNode
668
+ return /*#__PURE__*/jsxRuntime.jsx(GridRenderer, {
669
+ groupProps: props,
670
+ formRenderer: formRenderer,
671
+ options: options
828
672
  });
829
673
  }, {
830
674
  renderType: schemas.GroupRenderType.Grid
831
675
  });
832
- function renderGrid(props, isChildVisible) {
833
- var _props$defaultOptions, _ref, _gridOptions$columns;
834
- var filteredChildren = props.formNode.getChildNodes().filter(function (x, i) {
835
- return isChildVisible(i);
676
+ }
677
+ function GridRenderer(props) {
678
+ var _effect = core.useComponentTracking();
679
+ try {
680
+ var _props$options, _ref, _gridOptions$columns;
681
+ var _props$groupProps = props.groupProps,
682
+ formNode = _props$groupProps.formNode,
683
+ renderOptions = _props$groupProps.renderOptions,
684
+ renderChild = _props$groupProps.renderChild,
685
+ className = _props$groupProps.className;
686
+ var filteredChildren = formNode.children.filter(function (x, i) {
687
+ return x.visible;
836
688
  });
837
689
  var Div = props.formRenderer.html.Div;
838
- var defaults = (_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {};
839
- var gridOptions = props.renderOptions;
690
+ var defaults = (_props$options = props.options) != null ? _props$options : {};
691
+ var gridOptions = renderOptions;
840
692
  var numColumns = (_ref = (_gridOptions$columns = gridOptions.columns) != null ? _gridOptions$columns : defaults.defaultColumns) != null ? _ref : 2;
841
- var allChildren = filteredChildren.map(function (x, i) {
842
- return props.renderChild(i, x);
693
+ var allChildren = filteredChildren.map(function (x) {
694
+ return renderChild(x);
843
695
  });
696
+ var cellClass = gridOptions.cellClass ? getCellClassNames(gridOptions.cellClass) : getCellClassNames(defaults.cellClass);
844
697
  // split into numColumns items wrapped a div each
845
698
  var rows = [];
846
699
  for (var i = 0; i < allChildren.length; i += numColumns) {
847
700
  rows.push(allChildren.slice(i, i + numColumns));
848
701
  }
849
702
  return /*#__PURE__*/jsxRuntime.jsx(Div, {
850
- className: schemas.rendererClass(props.className, defaults.className),
703
+ className: schemas.rendererClass(className, defaults.className),
851
704
  children: rows.map(function (row, rowIndex) {
852
705
  return /*#__PURE__*/jsxRuntime.jsx(Div, {
853
706
  className: schemas.rendererClass(gridOptions.rowClass, defaults.rowClass),
854
- children: row
707
+ children: row.map(function (cell, cellIndex) {
708
+ var _cellClass$at;
709
+ return /*#__PURE__*/jsxRuntime.jsx(Div, {
710
+ className: (_cellClass$at = cellClass == null ? void 0 : cellClass.at(cellIndex)) != null ? _cellClass$at : "flex-1",
711
+ children: cell
712
+ }, cellIndex);
713
+ })
855
714
  }, rowIndex);
856
715
  })
857
716
  });
717
+ } finally {
718
+ _effect();
858
719
  }
859
720
  }
721
+ function getCellClassNames(cellClass) {
722
+ return cellClass == null ? void 0 : cellClass.split(",");
723
+ }
860
724
 
861
- var defaultOptions = {
725
+ var defaultOptions$1 = {
862
726
  classes: {
863
727
  className: undefined,
864
728
  contentClass: "min-h-96 overflow-auto",
@@ -890,129 +754,127 @@ function defaultNavigationRender(_ref) {
890
754
  }
891
755
  function createWizardRenderer(options) {
892
756
  return schemas.createGroupRenderer(function (props, formRenderer) {
893
- return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
894
- props: _extends({}, props, {
895
- formRenderer: formRenderer,
896
- defaultOptions: options
897
- }),
898
- render: renderWizard,
899
- parent: props,
900
- dataContext: props.dataContext,
901
- parentFormNode: props.formNode
757
+ return /*#__PURE__*/jsxRuntime.jsx(WizardRenderer, {
758
+ groupProps: props,
759
+ formRenderer: formRenderer,
760
+ options: options
902
761
  });
903
762
  }, {
904
763
  renderType: schemas.GroupRenderType.Wizard
905
764
  });
906
765
  }
907
- function renderWizard(props, isChildVisible) {
908
- var _props$defaultOptions;
909
- var mergedOptions = schemas.deepMerge((_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {}, defaultOptions);
910
- var _mergedOptions$classe = mergedOptions.classes,
911
- className = _mergedOptions$classe.className,
912
- contentClass = _mergedOptions$classe.contentClass,
913
- navContainerClass = _mergedOptions$classe.navContainerClass,
914
- _mergedOptions$action = mergedOptions.actions,
915
- nextText = _mergedOptions$action.nextText,
916
- nextIcon = _mergedOptions$action.nextIcon,
917
- prevText = _mergedOptions$action.prevText,
918
- prevIcon = _mergedOptions$action.prevIcon,
919
- nextValidate = _mergedOptions$action.nextValidate,
920
- prevValidate = _mergedOptions$action.prevValidate,
921
- renderNavigation = mergedOptions.renderNavigation;
922
- var Div = props.formRenderer.html.Div;
923
- var children = props.formNode.getChildNodes();
924
- var allVisible = children.map(function (_, i) {
925
- return isChildVisible(i);
926
- });
927
- var page = core.useControl(0);
928
- var currentPage = page.value;
929
- var isValid = core.useComputed(function () {
930
- return isPageValid();
931
- });
932
- var next = schemas.createAction("nav", function () {
933
- return nav(1, nextValidate);
934
- }, nextText, {
935
- hidden: !props.designMode && nextVisibleInDirection(1) == null,
936
- disabled: !isValid.value,
937
- icon: nextIcon,
938
- iconPlacement: schemas.IconPlacement.AfterText
939
- });
940
- var prev = schemas.createAction("nav", function () {
941
- return nav(-1, prevValidate);
942
- }, prevText, {
943
- disabled: !props.designMode && nextVisibleInDirection(-1) == null,
944
- icon: prevIcon
945
- });
946
- var navElement = renderNavigation({
947
- formRenderer: props.formRenderer,
948
- page: countVisibleUntil(currentPage),
949
- totalPages: countVisibleUntil(children.length),
950
- prev: prev,
951
- next: next,
952
- className: navContainerClass,
953
- validatePage: function () {
954
- try {
955
- return Promise.resolve(_validatePage());
956
- } catch (e) {
957
- return Promise.reject(e);
766
+ function WizardRenderer(_ref2) {
767
+ var _effect = core.useComponentTracking();
768
+ try {
769
+ var countVisibleUntil = function countVisibleUntil(untilPage) {
770
+ var count = 0;
771
+ for (var i = 0; i < untilPage && i < childrenLength; i++) {
772
+ if (formNode.getChild(i).visible) {
773
+ count++;
774
+ }
958
775
  }
959
- }
960
- });
961
- var content = props.designMode ? /*#__PURE__*/jsxRuntime.jsx(Div, {
962
- children: children.map(function (child, i) {
963
- return props.renderChild(i, child);
964
- })
965
- }) : currentPage < children.length ? /*#__PURE__*/jsxRuntime.jsx(Div, {
966
- className: contentClass,
967
- children: props.renderChild(currentPage, children[currentPage])
968
- }) : /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {});
969
- return /*#__PURE__*/jsxRuntime.jsxs(Div, {
970
- className: schemas.rendererClass(props.className, className),
971
- children: [content, navElement]
972
- });
973
- function countVisibleUntil(untilPage) {
974
- var count = 0;
975
- for (var i = 0; i < untilPage && i < allVisible.length; i++) {
976
- if (allVisible[i]) {
977
- count++;
776
+ return count;
777
+ };
778
+ var nav = function nav(dir, validate) {
779
+ if (validate && !_validatePage()) {
780
+ return;
978
781
  }
979
- }
980
- return count;
981
- }
982
- function nav(dir, validate) {
983
- if (validate && !_validatePage()) {
984
- return;
985
- }
986
- var next = nextVisibleInDirection(dir);
987
- if (next != null) {
988
- page.value = next;
989
- }
990
- }
991
- function nextVisibleInDirection(dir) {
992
- var next = currentPage + dir;
993
- while (next >= 0 && next < children.length) {
994
- if (allVisible[next]) {
995
- return next;
782
+ var next = nextVisibleInDirection(dir);
783
+ if (next != null) {
784
+ page.value = next;
996
785
  }
997
- next += dir;
998
- }
999
- return null;
1000
- }
1001
- function _validatePage() {
1002
- var pageNode = children[currentPage];
1003
- var hasErrors = false;
1004
- schemas.visitFormDataInContext(props.dataContext.parentNode, pageNode, schemas.validationVisitor(function () {
1005
- hasErrors = true;
1006
- }));
1007
- return !hasErrors;
1008
- }
1009
- function isPageValid() {
1010
- var pageNode = children[currentPage];
1011
- var hasErrors = false;
1012
- schemas.visitFormDataInContext(props.dataContext.parentNode, pageNode, function (c) {
1013
- if (!c.control.valid) hasErrors = true;
786
+ };
787
+ var nextVisibleInDirection = function nextVisibleInDirection(dir) {
788
+ var next = currentPage + dir;
789
+ while (next >= 0 && next < childrenLength) {
790
+ if (formNode.getChild(next).visible) {
791
+ return next;
792
+ }
793
+ next += dir;
794
+ }
795
+ return null;
796
+ };
797
+ var _validatePage = function _validatePage() {
798
+ var pageNode = formNode.getChild(currentPage);
799
+ if (pageNode) {
800
+ var valid = pageNode.validate();
801
+ pageNode.setTouched(true);
802
+ return valid;
803
+ }
804
+ return false;
805
+ };
806
+ var isPageValid = function isPageValid() {
807
+ return formNode.getChild(currentPage).valid;
808
+ };
809
+ var props = _ref2.groupProps,
810
+ formRenderer = _ref2.formRenderer,
811
+ options = _ref2.options;
812
+ var mergedOptions = schemas.deepMerge(options != null ? options : {}, defaultOptions$1);
813
+ var _mergedOptions$classe = mergedOptions.classes,
814
+ className = _mergedOptions$classe.className,
815
+ contentClass = _mergedOptions$classe.contentClass,
816
+ navContainerClass = _mergedOptions$classe.navContainerClass,
817
+ _mergedOptions$action = mergedOptions.actions,
818
+ nextText = _mergedOptions$action.nextText,
819
+ nextIcon = _mergedOptions$action.nextIcon,
820
+ prevText = _mergedOptions$action.prevText,
821
+ prevIcon = _mergedOptions$action.prevIcon,
822
+ nextValidate = _mergedOptions$action.nextValidate,
823
+ prevValidate = _mergedOptions$action.prevValidate,
824
+ renderNavigation = mergedOptions.renderNavigation;
825
+ var formNode = props.formNode,
826
+ designMode = props.designMode,
827
+ renderChild = props.renderChild;
828
+ var Div = formRenderer.html.Div;
829
+ var childrenLength = formNode.getChildCount();
830
+ var page = core.useControl(0);
831
+ var currentPage = page.value;
832
+ var isValid = core.useComputed(function () {
833
+ return isPageValid();
1014
834
  });
1015
- return !hasErrors;
835
+ var next = schemas.createAction("nav", function () {
836
+ return nav(1, nextValidate);
837
+ }, nextText, {
838
+ hidden: !designMode && nextVisibleInDirection(1) == null,
839
+ disabled: !isValid.value,
840
+ icon: nextIcon,
841
+ iconPlacement: schemas.IconPlacement.AfterText
842
+ });
843
+ var prev = schemas.createAction("nav", function () {
844
+ return nav(-1, prevValidate);
845
+ }, prevText, {
846
+ disabled: !designMode && nextVisibleInDirection(-1) == null,
847
+ icon: prevIcon
848
+ });
849
+ var navElement = renderNavigation({
850
+ formRenderer: formRenderer,
851
+ page: countVisibleUntil(currentPage),
852
+ totalPages: countVisibleUntil(childrenLength),
853
+ prev: prev,
854
+ next: next,
855
+ className: navContainerClass,
856
+ validatePage: function validatePage() {
857
+ try {
858
+ return Promise.resolve(_validatePage());
859
+ } catch (e) {
860
+ return Promise.reject(e);
861
+ }
862
+ }
863
+ });
864
+ var content = designMode ? /*#__PURE__*/jsxRuntime.jsx(Div, {
865
+ children: formNode.children.map(function (child) {
866
+ return renderChild(child);
867
+ })
868
+ }) : currentPage < childrenLength ? /*#__PURE__*/jsxRuntime.jsx(Div, {
869
+ className: contentClass,
870
+ children: renderChild(formNode.getChild(currentPage))
871
+ }) : /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {});
872
+ return /*#__PURE__*/jsxRuntime.jsxs(Div, {
873
+ className: schemas.rendererClass(props.className, className),
874
+ children: [content, navElement]
875
+ });
876
+ } finally {
877
+ _effect();
1016
878
  }
1017
879
  }
1018
880
 
@@ -1073,24 +935,25 @@ function DefaultDialogRenderer(_ref) {
1073
935
  };
1074
936
  }
1075
937
  };
1076
- var triggerChildren = props.formNode.getChildNodes().filter(function (x) {
938
+ var allChildren = props.formNode.children;
939
+ var triggerChildren = allChildren.filter(function (x) {
1077
940
  return x.definition.placement === "trigger";
1078
941
  });
1079
942
  var dialogContent = /*#__PURE__*/jsxRuntime.jsx(ariaBase.Dialog, {
1080
943
  title: renderOptions.title,
1081
944
  titleClass: titleClass,
1082
945
  className: schemas.rendererClass(props.className, className),
1083
- children: props.formNode.getChildNodes().filter(function (x) {
946
+ children: allChildren.filter(function (x) {
1084
947
  return !x.definition.placement || x.definition.placement === "dialog";
1085
948
  }).map(function (x, i) {
1086
- return props.renderChild(i, x, {
949
+ return props.renderChild(x, {
1087
950
  actionOnClick: actionOnClick
1088
951
  });
1089
952
  })
1090
953
  });
1091
954
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1092
955
  children: [triggerChildren.map(function (x, i) {
1093
- return props.renderChild(i, x, {
956
+ return props.renderChild(x, {
1094
957
  actionOnClick: actionOnClick
1095
958
  });
1096
959
  }), props.designMode ? designContent() : open.value && /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
@@ -1105,11 +968,152 @@ function DefaultDialogRenderer(_ref) {
1105
968
  }
1106
969
  }
1107
970
 
1108
- function createDefaultGroupRenderer(options) {
971
+ function DefaultAccordion(_ref) {
972
+ var _effect = core.useComponentTracking();
973
+ try {
974
+ var _dataContext$dataNode;
975
+ var openCtrl = _ref.openCtrl,
976
+ children = _ref.children,
977
+ contentStyle = _ref.contentStyle,
978
+ className = _ref.className,
979
+ contentClassName = _ref.contentClassName,
980
+ designMode = _ref.designMode,
981
+ renderers = _ref.renderers,
982
+ dataContext = _ref.dataContext,
983
+ title = _ref.title,
984
+ options = _ref.options,
985
+ defaultExpanded = _ref.defaultExpanded,
986
+ isGroup = _ref.isGroup,
987
+ titleTextClass = _ref.titleTextClass;
988
+ var _ref2 = options != null ? options : {},
989
+ iconOpen = _ref2.iconOpen,
990
+ iconClosed = _ref2.iconClosed,
991
+ togglerClass = _ref2.togglerClass,
992
+ _ref2$renderTitle = _ref2.renderTitle,
993
+ renderTitle = _ref2$renderTitle === void 0 ? function (t) {
994
+ return t;
995
+ } : _ref2$renderTitle,
996
+ renderToggler = _ref2.renderToggler,
997
+ useCss = _ref2.useCss;
998
+ var panelId = react.useId();
999
+ var _renderers$html = renderers.html,
1000
+ Button = _renderers$html.Button,
1001
+ I = _renderers$html.I,
1002
+ Div = _renderers$html.Div,
1003
+ Label = _renderers$html.Label;
1004
+ var dataControl = ((_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode).control;
1005
+ var open = core.useControl(!!defaultExpanded, {
1006
+ use: openCtrl
1007
+ });
1008
+ if (dataControl && !dataControl.meta.accordionState) {
1009
+ dataControl.meta.accordionState = open;
1010
+ }
1011
+ var isOpen = open.value;
1012
+ var fullContentStyle = isOpen || designMode ? contentStyle : _extends({}, contentStyle, {
1013
+ display: "none"
1014
+ });
1015
+ var currentIcon = isOpen ? iconOpen : iconClosed;
1016
+ var accordionClassName = schemas.rendererClass(className, options == null ? void 0 : options.className);
1017
+ var accordionTitleTextClass = schemas.rendererClass(titleTextClass, options == null ? void 0 : options.titleTextClass);
1018
+ var accordionTitle = isGroup ? title : /*#__PURE__*/jsxRuntime.jsx(Label, {
1019
+ textClass: accordionTitleTextClass,
1020
+ children: title
1021
+ });
1022
+ var toggler = renderToggler ? renderToggler(open, renderTitle(title, open)) : /*#__PURE__*/jsxRuntime.jsxs(Button, {
1023
+ className: accordionClassName,
1024
+ notWrapInText: true,
1025
+ onClick: function onClick() {
1026
+ return open.setValue(function (x) {
1027
+ return !x;
1028
+ });
1029
+ },
1030
+ "aria-expanded": isOpen,
1031
+ "aria-controls": panelId,
1032
+ children: [accordionTitle, currentIcon && /*#__PURE__*/jsxRuntime.jsx(I, {
1033
+ className: togglerClass,
1034
+ iconLibrary: currentIcon.library,
1035
+ iconName: currentIcon.name
1036
+ })]
1037
+ });
1038
+ // The content class name not currently used since if the content is wrapped in a group, the group will handle the styling
1039
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1040
+ children: [toggler, (useCss || isOpen || designMode) && /*#__PURE__*/jsxRuntime.jsx(Div, {
1041
+ id: panelId,
1042
+ role: "region",
1043
+ style: fullContentStyle,
1044
+ className: contentClassName,
1045
+ children: children
1046
+ })]
1047
+ });
1048
+ } finally {
1049
+ _effect();
1050
+ }
1051
+ }
1052
+ function getAccordionState(c) {
1053
+ return c.meta.accordionState;
1054
+ }
1055
+ function createAccordionGroupRenderer(options) {
1056
+ return schemas.createGroupRenderer(function (p, renderer) {
1057
+ return /*#__PURE__*/jsxRuntime.jsx(AccordionGroupRenderer, {
1058
+ groupProps: p,
1059
+ renderer: renderer,
1060
+ options: options
1061
+ });
1062
+ }, {
1063
+ renderType: schemas.GroupRenderType.Accordion
1064
+ });
1065
+ }
1066
+ function AccordionGroupRenderer(_ref3) {
1067
+ var _effect2 = core.useComponentTracking();
1068
+ try {
1069
+ var groupProps = _ref3.groupProps,
1070
+ renderer = _ref3.renderer,
1071
+ options = _ref3.options;
1072
+ var allChildren = groupProps.formNode.children;
1073
+ var titleChildren = allChildren.filter(function (x) {
1074
+ return x.definition.placement === "title";
1075
+ });
1076
+ var contentChildren = allChildren.filter(function (x) {
1077
+ return x.definition.placement !== "title";
1078
+ });
1079
+ var _groupProps$renderOpt = groupProps.renderOptions,
1080
+ expandStateField = _groupProps$renderOpt.expandStateField,
1081
+ defaultExpanded = _groupProps$renderOpt.defaultExpanded;
1082
+ var expandStateFieldNode = expandStateField ? schemas.schemaDataForFieldRef(expandStateField, groupProps.dataContext.parentNode) : null;
1083
+ var open = expandStateFieldNode == null ? void 0 : expandStateFieldNode.control.as();
1084
+ return /*#__PURE__*/jsxRuntime.jsx(DefaultAccordion, {
1085
+ openCtrl: open,
1086
+ isGroup: true,
1087
+ options: options,
1088
+ children: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
1089
+ children: contentChildren.map(function (x) {
1090
+ return groupProps.renderChild(x);
1091
+ })
1092
+ }),
1093
+ title: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
1094
+ children: titleChildren.map(function (x) {
1095
+ return groupProps.renderChild(x);
1096
+ })
1097
+ }),
1098
+ renderers: renderer,
1099
+ className: groupProps.className,
1100
+ dataContext: groupProps.dataContext,
1101
+ designMode: groupProps.designMode,
1102
+ defaultExpanded: defaultExpanded,
1103
+ contentStyle: groupProps.style
1104
+ });
1105
+ } finally {
1106
+ _effect2();
1107
+ }
1108
+ }
1109
+
1110
+ function createDefaultGroupRenderer(options, adornmentOptions) {
1111
+ var _options$accordion;
1109
1112
  var gridRenderer = createGridRenderer(options == null ? void 0 : options.grid);
1110
1113
  var tabsRenderer = createTabsRenderer(options == null ? void 0 : options.tabs);
1111
1114
  var wizardRenderer = createWizardRenderer(options == null ? void 0 : options.wizard);
1112
1115
  var dialogRenderer = createDialogRenderer(options == null ? void 0 : options.dialog);
1116
+ var accordionRenderer = createAccordionGroupRenderer((_options$accordion = options == null ? void 0 : options.accordion) != null ? _options$accordion : adornmentOptions == null ? void 0 : adornmentOptions.accordion);
1113
1117
  var _ref = options != null ? options : {},
1114
1118
  className = _ref.className,
1115
1119
  standardClassName = _ref.standardClassName,
@@ -1134,10 +1138,14 @@ function createDefaultGroupRenderer(options) {
1134
1138
  if (schemas.isGridRenderer(renderOptions)) return gridRenderer.render(props, renderer);
1135
1139
  if (schemas.isWizardRenderer(renderOptions)) return wizardRenderer.render(props, renderer);
1136
1140
  if (schemas.isDialogRenderer(renderOptions)) return dialogRenderer.render(props, renderer);
1141
+ if (schemas.isAccordionRenderer(renderOptions)) return accordionRenderer.render(props, renderer);
1137
1142
  if (schemas.isSelectChildRenderer(renderOptions) && !props.designMode) {
1138
- return /*#__PURE__*/jsxRuntime.jsx(SelectChildGroupRenderer, _extends({}, props, {
1139
- renderOptions: renderOptions
1140
- }));
1143
+ return /*#__PURE__*/jsxRuntime.jsx(SelectChildGroupRenderer, {
1144
+ props: _extends({}, props, {
1145
+ renderOptions: renderOptions
1146
+ }),
1147
+ renderer: renderer
1148
+ });
1141
1149
  }
1142
1150
  var _ref2 = schemas.isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : schemas.isInlineRenderer(renderOptions) ? {
1143
1151
  className: inlineClass
@@ -1148,8 +1156,8 @@ function createDefaultGroupRenderer(options) {
1148
1156
  gcn = _ref2.className;
1149
1157
  var Div = renderer.html.Div;
1150
1158
  var inline = renderOptions.type == schemas.GroupRenderType.Inline;
1151
- var children = formNode.getChildNodes().map(function (c, i) {
1152
- return renderChild(i, c, {
1159
+ var children = formNode.children.map(function (c, i) {
1160
+ return renderChild(c, {
1153
1161
  inline: inline
1154
1162
  });
1155
1163
  });
@@ -1165,8 +1173,8 @@ function createDefaultGroupRenderer(options) {
1165
1173
  if (props.renderOptions.type === schemas.GroupRenderType.Contents) {
1166
1174
  var formNode = props.formNode,
1167
1175
  renderChild = props.renderChild;
1168
- var children = formNode.getChildNodes().map(function (c, i) {
1169
- return renderChild(i, c);
1176
+ var children = formNode.children.map(function (c) {
1177
+ return renderChild(c);
1170
1178
  });
1171
1179
  return function (layout) {
1172
1180
  return _extends({}, layout, {
@@ -1182,18 +1190,21 @@ function createDefaultGroupRenderer(options) {
1182
1190
  render: renderLayout
1183
1191
  };
1184
1192
  }
1185
- function SelectChildGroupRenderer(props) {
1193
+ function SelectChildGroupRenderer(_ref3) {
1186
1194
  var _effect = core.useComponentTracking();
1187
1195
  try {
1196
+ var props = _ref3.props,
1197
+ renderer = _ref3.renderer;
1198
+ var Div = renderer.html.Div;
1188
1199
  var runExpression = props.runExpression,
1189
1200
  renderOptions = props.renderOptions;
1190
1201
  var ctrl = schemas.useExpression(undefined, runExpression, renderOptions == null ? void 0 : renderOptions.childIndexExpression, function (x) {
1191
1202
  return typeof x == "string" ? parseInt(x) : x;
1192
1203
  });
1193
1204
  var childIndex = ctrl == null ? void 0 : ctrl.value;
1194
- var childDefinitions = props.formNode.getChildNodes();
1195
- return /*#__PURE__*/jsxRuntime.jsx("div", {
1196
- children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && props.renderChild(childIndex, childDefinitions[childIndex])
1205
+ var childCount = props.formNode.getChildCount();
1206
+ return /*#__PURE__*/jsxRuntime.jsx(Div, {
1207
+ children: typeof childIndex === "number" && childIndex < childCount && childIndex >= 0 && props.renderChild(props.formNode.getChild(childIndex))
1197
1208
  });
1198
1209
  } finally {
1199
1210
  _effect();
@@ -1266,15 +1277,14 @@ function JsonataRenderer(_ref) {
1266
1277
  dataContext = _ref.dataContext,
1267
1278
  dataNode = _ref.dataNode,
1268
1279
  runExpression = _ref.runExpression;
1269
- var sdn = dataNode.elementIndex != null ? dataNode : dataContext.parentNode;
1270
- var bindings = core.useComputed(function () {
1271
- return _extends({}, dataContext.variables, {
1272
- value: control.value,
1280
+ var bindings = function bindings(changes) {
1281
+ return {
1282
+ value: core.trackedValue(control, changes),
1273
1283
  readonly: readonly,
1274
1284
  disabled: control.disabled,
1275
1285
  dataPath: schemas.getJsonPath(dataNode)
1276
- });
1277
- });
1286
+ };
1287
+ };
1278
1288
  var rendered = schemas.useExpression("", runExpression, {
1279
1289
  type: schemas.ExpressionType.Jsonata,
1280
1290
  expression: renderOptions.expression
@@ -1332,11 +1342,6 @@ function createDefaultArrayDataRenderer(defaultActions) {
1332
1342
  function DataArrayRenderer(_ref) {
1333
1343
  var _effect = core.useComponentTracking();
1334
1344
  try {
1335
- var renderChildElement = function renderChildElement(i, elementNode) {
1336
- return renderChild(elementNode.control.uniqueId, childNode, {
1337
- parentDataNode: elementNode
1338
- });
1339
- };
1340
1345
  var dataProps = _ref.dataProps,
1341
1346
  renderers = _ref.renderers,
1342
1347
  defaultActions = _ref.defaultActions;
@@ -1351,36 +1356,18 @@ function DataArrayRenderer(_ref) {
1351
1356
  className = dataProps.className,
1352
1357
  style = dataProps.style,
1353
1358
  dataContext = dataProps.dataContext,
1354
- formNode = dataProps.formNode,
1355
- getChildState = dataProps.getChildState;
1359
+ formNode = dataProps.formNode;
1356
1360
  var _mergeObjects = schemas.mergeObjects(schemas.isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions),
1357
1361
  addText = _mergeObjects.addText,
1358
1362
  noAdd = _mergeObjects.noAdd,
1359
1363
  noRemove = _mergeObjects.noRemove,
1360
1364
  noReorder = _mergeObjects.noReorder,
1361
1365
  removeText = _mergeObjects.removeText,
1362
- editExternal = _mergeObjects.editExternal;
1363
- var childDefs = formNode.getResolvedChildren();
1364
- var renderAsElement = !schemas.isCompoundField(field);
1365
- var defaultChildDef = {
1366
- type: schemas.ControlDefinitionType.Data,
1367
- field: ".",
1368
- renderOptions: {
1369
- type: schemas.DataRenderType.Standard
1370
- },
1371
- hideTitle: true
1372
- };
1373
- var childDef = {
1374
- type: schemas.ControlDefinitionType.Group,
1375
- groupOptions: {
1376
- type: schemas.GroupRenderType.Standard,
1377
- hideTitle: true
1378
- },
1379
- children: renderAsElement && childDefs.length == 0 ? [defaultChildDef] : childDefs
1380
- };
1381
- var childNode = formNode.createChildNode("child", childDef);
1382
- var childNodes = childNode.getChildNodes();
1383
- var arrayProps = _extends({}, schemas.createArrayActions(control.as(), field, {
1366
+ editExternal = _mergeObjects.editExternal,
1367
+ childOverrideClass = _mergeObjects.childOverrideClass;
1368
+ var arrayProps = _extends({}, schemas.createArrayActions(control.as(), function () {
1369
+ return formNode.getChildCount();
1370
+ }, field, {
1384
1371
  addText: addText,
1385
1372
  removeText: removeText,
1386
1373
  noAdd: noAdd,
@@ -1390,19 +1377,11 @@ function DataArrayRenderer(_ref) {
1390
1377
  designMode: designMode,
1391
1378
  editExternal: editExternal
1392
1379
  }), {
1380
+ childOverrideClass: childOverrideClass,
1393
1381
  required: required,
1394
1382
  renderElement: function renderElement(i, wrap) {
1395
- return /*#__PURE__*/jsxRuntime.jsx(RenderEntry, {
1396
- index: i,
1397
- renderChildElement: renderChildElement,
1398
- dataContext: dataContext,
1399
- wrap: wrap,
1400
- isChildHidden: function isChildHidden(dataNode) {
1401
- return childNodes.every(function (x) {
1402
- return getChildState(x, dataNode).hidden;
1403
- });
1404
- }
1405
- });
1383
+ var n = formNode.getChild(i);
1384
+ return !n || !n.visible ? undefined : wrap(n.childKey, renderChild(n));
1406
1385
  },
1407
1386
  className: className ? className : undefined,
1408
1387
  style: style
@@ -1412,29 +1391,11 @@ function DataArrayRenderer(_ref) {
1412
1391
  _effect();
1413
1392
  }
1414
1393
  }
1415
- /**
1416
- * @trackControls
1417
- */
1418
- function RenderEntry(_ref2) {
1419
- var _effect2 = core.useComponentTracking();
1420
- try {
1421
- var i = _ref2.index,
1422
- renderChildElement = _ref2.renderChildElement,
1423
- wrap = _ref2.wrap,
1424
- isChildHidden = _ref2.isChildHidden,
1425
- dataContext = _ref2.dataContext;
1426
- var elementNode = dataContext.dataNode.getChildElement(i);
1427
- if (isChildHidden(elementNode)) return undefined;
1428
- return wrap(renderChildElement(i, elementNode));
1429
- } finally {
1430
- _effect2();
1431
- }
1432
- }
1433
1394
  function createDefaultArrayRenderer(options) {
1434
1395
  return {
1435
- render: function render(props, _ref3) {
1436
- var renderAction = _ref3.renderAction,
1437
- html = _ref3.html;
1396
+ render: function render(props, _ref2) {
1397
+ var renderAction = _ref2.renderAction,
1398
+ html = _ref2.html;
1438
1399
  return /*#__PURE__*/jsxRuntime.jsx(DefaultArrayRenderer, _extends({}, props, options, {
1439
1400
  renderAction: renderAction,
1440
1401
  html: html
@@ -1444,16 +1405,17 @@ function createDefaultArrayRenderer(options) {
1444
1405
  };
1445
1406
  }
1446
1407
  function DefaultArrayRenderer(props) {
1447
- var _effect3 = core.useComponentTracking();
1408
+ var _effect2 = core.useComponentTracking();
1448
1409
  try {
1449
1410
  var renderElement = props.renderElement,
1450
1411
  className = props.className,
1451
1412
  removableClass = props.removableClass,
1452
1413
  childClass = props.childClass,
1453
1414
  removableChildClass = props.removableChildClass,
1415
+ childOverrideClass = props.childOverrideClass,
1454
1416
  removeActionClass = props.removeActionClass,
1455
1417
  addActionClass = props.addActionClass,
1456
- arrayControl = props.arrayControl,
1418
+ getElementCount = props.getElementCount,
1457
1419
  renderAction = props.renderAction,
1458
1420
  style = props.style,
1459
1421
  editAction = props.editAction,
@@ -1465,24 +1427,27 @@ function DefaultArrayRenderer(props) {
1465
1427
  style: style,
1466
1428
  children: [/*#__PURE__*/jsxRuntime.jsx(Div, {
1467
1429
  className: clsx__default["default"](className, removeAction && removableClass),
1468
- children: /*#__PURE__*/jsxRuntime.jsx(core.RenderElements, {
1469
- control: arrayControl,
1470
- children: function children(_, x) {
1471
- return renderElement(x, function (children) {
1472
- return removeAction || editAction ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1473
- children: [/*#__PURE__*/jsxRuntime.jsx(Div, {
1474
- className: clsx__default["default"](childClass, removableChildClass),
1430
+ children: Array.from({
1431
+ length: getElementCount()
1432
+ }, function (_, x) {
1433
+ return /*#__PURE__*/jsxRuntime.jsx(core.RenderControl, {
1434
+ render: function render() {
1435
+ return renderElement(x, function (key, children) {
1436
+ return removeAction || editAction ? /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
1437
+ children: [/*#__PURE__*/jsxRuntime.jsx(Div, {
1438
+ className: clsx__default["default"](schemas.rendererClass(childOverrideClass, childClass), removableChildClass),
1439
+ children: children
1440
+ }), /*#__PURE__*/jsxRuntime.jsxs(Div, {
1441
+ className: removeActionClass,
1442
+ children: [editAction && renderAction(editAction(x)), removeAction && renderAction(removeAction(x))]
1443
+ })]
1444
+ }, key) : /*#__PURE__*/jsxRuntime.jsx(Div, {
1445
+ className: schemas.rendererClass(childOverrideClass, childClass),
1475
1446
  children: children
1476
- }), /*#__PURE__*/jsxRuntime.jsxs(Div, {
1477
- className: removeActionClass,
1478
- children: [editAction && renderAction(editAction(x)), removeAction && renderAction(removeAction(x))]
1479
- })]
1480
- }) : /*#__PURE__*/jsxRuntime.jsx(Div, {
1481
- className: childClass,
1482
- children: children
1447
+ }, key);
1483
1448
  });
1484
- });
1485
- }
1449
+ }
1450
+ }, x);
1486
1451
  })
1487
1452
  }), addAction && /*#__PURE__*/jsxRuntime.jsx(Div, {
1488
1453
  className: addActionClass,
@@ -1490,7 +1455,7 @@ function DefaultArrayRenderer(props) {
1490
1455
  })]
1491
1456
  });
1492
1457
  } finally {
1493
- _effect3();
1458
+ _effect2();
1494
1459
  }
1495
1460
  }
1496
1461
 
@@ -1812,14 +1777,18 @@ function ValueForField(_ref) {
1812
1777
  hideTitle: true
1813
1778
  });
1814
1779
  var rootSchema = schemas.createSchemaTree([adjustedField]).rootNode;
1815
- return [control, rootSchema];
1780
+ return [schemas.createFormTree([control]), rootSchema];
1816
1781
  }, [schemaField]),
1817
1782
  controls = _useMemo[0],
1818
1783
  rootSchema = _useMemo[1];
1819
- var Render = schemas.useControlRendererComponent(controls, renderer, {
1820
- disabled: control.disabled
1821
- }, schemas.makeSchemaDataNode(rootSchema, value));
1822
- return /*#__PURE__*/jsxRuntime.jsx(Render, {});
1784
+ return /*#__PURE__*/jsxRuntime.jsx(schemas.RenderForm, {
1785
+ form: controls.rootNode,
1786
+ renderer: renderer,
1787
+ data: schemas.createSchemaDataNode(rootSchema, value),
1788
+ options: {
1789
+ disabled: control.disabled
1790
+ }
1791
+ });
1823
1792
  } finally {
1824
1793
  _effect();
1825
1794
  }
@@ -1842,7 +1811,7 @@ function createOptionalAdornment(options) {
1842
1811
  return {
1843
1812
  apply: function apply(rl) {
1844
1813
  var _ref, _adornment$placement;
1845
- if (props.formOptions.readonly) return rl;
1814
+ if (props.formNode.readonly) return rl;
1846
1815
  if (!options.hideEdit && adornment.editSelectable) schemas.appendMarkupAt((_ref = (_adornment$placement = adornment.placement) != null ? _adornment$placement : options.defaultPlacement) != null ? _ref : schemas.AdornmentPlacement.LabelStart, /*#__PURE__*/jsxRuntime.jsx(core.Fcheckbox, {
1847
1816
  control: editing,
1848
1817
  className: options.checkClass
@@ -1943,6 +1912,17 @@ function MultilineTextfield(_ref) {
1943
1912
  }
1944
1913
  }
1945
1914
 
1915
+ // ============================================================================
1916
+ // ADDITIONAL CONSTANTS
1917
+ // ============================================================================
1918
+ var DefaultBoolOptions = [{
1919
+ name: "Yes",
1920
+ value: true
1921
+ }, {
1922
+ name: "No",
1923
+ value: false
1924
+ }];
1925
+
1946
1926
  function createArrayElementRenderer(options) {
1947
1927
  if (options === void 0) {
1948
1928
  options = {};
@@ -1978,11 +1958,16 @@ function ArrayElementRenderer(_ref) {
1978
1958
  });
1979
1959
  if (designMode || extData.value !== undefined) {
1980
1960
  var runValidation = function runValidation(onClick) {
1981
- var hasErrors = false;
1982
- schemas.visitFormDataInContext(parentDataNode, elementGroup, schemas.validationVisitor(function () {
1983
- hasErrors = true;
1984
- }));
1985
- if (!hasErrors) onClick();
1961
+ // TODO
1962
+ // let hasErrors = false;
1963
+ // visitFormDataInContext(
1964
+ // parentDataNode,
1965
+ // elementGroup,
1966
+ // validationVisitor(() => {
1967
+ // hasErrors = true;
1968
+ // }),
1969
+ // );
1970
+ // if (!hasErrors) onClick();
1986
1971
  };
1987
1972
  var applyValidation = function applyValidation(_ref2) {
1988
1973
  var action = _ref2.action,
@@ -1994,19 +1979,15 @@ function ArrayElementRenderer(_ref) {
1994
1979
  });
1995
1980
  };
1996
1981
  var parentDataNode = schemas.makeSchemaDataNode(dataProps.dataNode.schema, extData.fields.data);
1997
- var elementGroup = formNode.createChildNode("group", {
1998
- type: schemas.ControlDefinitionType.Group,
1999
- groupOptions: {
2000
- type: schemas.GroupRenderType.Standard,
2001
- hideTitle: true
2002
- },
2003
- children: formNode.getResolvedChildren()
2004
- });
2005
- var editContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
1982
+ // TODO
1983
+ // const elementGroup: FormNode = formNode.createChildNode("group", {
1984
+ // type: ControlDefinitionType.Group,
1985
+ // groupOptions: { type: GroupRenderType.Standard, hideTitle: true },
1986
+ // children: formNode.getResolvedChildren(),
1987
+ // } as GroupedControlsDefinition);
1988
+ var editContent = /*#__PURE__*/jsxRuntime.jsx("div", {
2006
1989
  className: schemas.rendererClass(dataProps.className, options.className),
2007
- children: [renderChild("", elementGroup, {
2008
- parentDataNode: parentDataNode
2009
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
1990
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
2010
1991
  className: options.actionsClass,
2011
1992
  children: /*#__PURE__*/jsxRuntime.jsx(core.RenderElements, {
2012
1993
  control: extData.fields.actions,
@@ -2014,7 +1995,7 @@ function ArrayElementRenderer(_ref) {
2014
1995
  return formRenderer.renderAction(applyValidation(c.value));
2015
1996
  }
2016
1997
  })
2017
- })]
1998
+ })
2018
1999
  });
2019
2000
  if (renderOptions.showInline || designMode) return editContent;
2020
2001
  return /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
@@ -2034,7 +2015,7 @@ function createButtonActionRenderer(actionId, options) {
2034
2015
  options = {};
2035
2016
  }
2036
2017
  return schemas.createActionRenderer(actionId, function (props, renderer) {
2037
- var _props$icon, _ref, _props$iconPlacement, _options$renderConten;
2018
+ var _props$icon, _ref, _props$iconPlacement, _ref2, _props$iconPlacement2, _options$renderConten;
2038
2019
  var key = props.key,
2039
2020
  onClick = props.onClick,
2040
2021
  actionText = props.actionText,
@@ -2046,9 +2027,14 @@ function createButtonActionRenderer(actionId, options) {
2046
2027
  textClass = props.textClass,
2047
2028
  actionStyle = props.actionStyle,
2048
2029
  inline = props.inline,
2049
- actionContent = props.actionContent;
2050
- var icon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
2051
- var iconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : schemas.IconPlacement.BeforeText;
2030
+ actionContent = props.actionContent,
2031
+ busy = props.busy;
2032
+ var busyIcon = props.busy ? options.busyIcon : undefined;
2033
+ var stdIcon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
2034
+ var icon = busyIcon != null ? busyIcon : stdIcon;
2035
+ var stdIconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : schemas.IconPlacement.BeforeText;
2036
+ var busyPlacement = (_ref2 = (_props$iconPlacement2 = props.iconPlacement) != null ? _props$iconPlacement2 : options.busyIconPlacement) != null ? _ref2 : schemas.IconPlacement.ReplaceText;
2037
+ var iconPlacement = busyIcon ? busyPlacement : stdIconPlacement;
2052
2038
  var _renderer$html = renderer.html,
2053
2039
  Button = _renderer$html.Button,
2054
2040
  I = _renderer$html.I,
@@ -2056,12 +2042,12 @@ function createButtonActionRenderer(actionId, options) {
2056
2042
  var isLink = actionStyle == schemas.ActionStyle.Link;
2057
2043
  var isGroup = actionStyle == schemas.ActionStyle.Group;
2058
2044
  var classNames = schemas.rendererClass(className, isLink ? options.linkClass : isGroup ? options.groupClass : schemas.rendererClass(options.buttonClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryClass : options.primaryClass));
2045
+ var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
2059
2046
  var iconElement = icon && /*#__PURE__*/jsxRuntime.jsx(I, {
2060
2047
  iconName: icon.name,
2061
2048
  iconLibrary: icon.library,
2062
- className: schemas.rendererClass(textClass, iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
2049
+ className: schemas.rendererClass(textClassNames, iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
2063
2050
  });
2064
- var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
2065
2051
  var textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsxRuntime.jsx(Span, {
2066
2052
  className: textClassNames,
2067
2053
  children: actionText
@@ -2077,24 +2063,189 @@ function createButtonActionRenderer(actionId, options) {
2077
2063
  title: iconPlacement == schemas.IconPlacement.ReplaceText ? actionText : undefined,
2078
2064
  notWrapInText: options.notWrapInText,
2079
2065
  androidRippleColor: options.androidRippleColor,
2080
- children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2066
+ children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData, busy)) != null ? _options$renderConten : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2081
2067
  children: [iconPlacement == schemas.IconPlacement.BeforeText && iconElement, iconPlacement != schemas.IconPlacement.ReplaceText && textElement, iconPlacement != schemas.IconPlacement.BeforeText && iconElement]
2082
2068
  })
2083
2069
  }, key);
2084
2070
  });
2085
2071
  }
2086
2072
 
2073
+ var defaultOptions = {
2074
+ spinnerClass: "flex justify-center my-6",
2075
+ className: "flex flex-row",
2076
+ loadingIcon: undefined,
2077
+ iconClass: "text-[36px]"
2078
+ };
2079
+ function createScrollListRenderer(options) {
2080
+ return schemas.createDataRenderer(function (p, renderer) {
2081
+ return /*#__PURE__*/jsxRuntime.jsx(ScrollListRenderer, {
2082
+ dataProps: p,
2083
+ renderer: renderer,
2084
+ options: options
2085
+ });
2086
+ }, {
2087
+ collection: true,
2088
+ renderType: schemas.DataRenderType.ScrollList
2089
+ });
2090
+ }
2091
+ function ScrollListRenderer(_ref) {
2092
+ var _effect = core.useComponentTracking();
2093
+ try {
2094
+ var spinner = function spinner() {
2095
+ return loadingControl.value && /*#__PURE__*/jsxRuntime.jsx("div", {
2096
+ className: spinnerClass,
2097
+ ref: function ref(e) {
2098
+ return e == null ? void 0 : e.scrollIntoView({
2099
+ behavior: "smooth"
2100
+ });
2101
+ },
2102
+ children: /*#__PURE__*/jsxRuntime.jsx(I, {
2103
+ iconName: loadingIcon.name,
2104
+ iconLibrary: loadingIcon.library,
2105
+ className: iconClass
2106
+ })
2107
+ });
2108
+ };
2109
+ var _ref$dataProps = _ref.dataProps,
2110
+ formNode = _ref$dataProps.formNode,
2111
+ renderChild = _ref$dataProps.renderChild,
2112
+ dataNode = _ref$dataProps.dataNode,
2113
+ actionOnClick = _ref$dataProps.actionOnClick,
2114
+ renderOptions = _ref$dataProps.renderOptions,
2115
+ dataContext = _ref$dataProps.dataContext,
2116
+ className = _ref$dataProps.className,
2117
+ renderer = _ref.renderer,
2118
+ options = _ref.options;
2119
+ var bottomActionId = renderOptions.bottomActionId;
2120
+ var loadingControl = schemas.getLoadingControl(dataNode.control);
2121
+ var hasMoreControl = schemas.getHasMoreControl(dataNode.control);
2122
+ var handler = bottomActionId ? actionOnClick == null ? void 0 : actionOnClick(bottomActionId, undefined, dataContext) : undefined;
2123
+ var I = renderer.html.I;
2124
+ var _deepMerge = schemas.deepMerge(options, defaultOptions),
2125
+ loadingIcon = _deepMerge.loadingIcon,
2126
+ spinnerClass = _deepMerge.spinnerClass,
2127
+ iconClass = _deepMerge.iconClass;
2128
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2129
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2130
+ className: schemas.rendererClass(className, options == null ? void 0 : options.className),
2131
+ children: formNode.children.map(function (x) {
2132
+ return renderChild(x);
2133
+ })
2134
+ }), (loadingIcon == null ? void 0 : loadingIcon.name) && /*#__PURE__*/jsxRuntime.jsx(core.RenderControl, {
2135
+ render: spinner
2136
+ }), /*#__PURE__*/jsxRuntime.jsx(ScrollTrigger, {
2137
+ hasMoreControl: hasMoreControl,
2138
+ loadingControl: loadingControl,
2139
+ fetchMore: function fetchMore() {
2140
+ return handler == null ? void 0 : handler(schemas.NoOpControlActionContext);
2141
+ }
2142
+ })]
2143
+ });
2144
+ } finally {
2145
+ _effect();
2146
+ }
2147
+ }
2148
+ function ScrollTrigger(_ref2) {
2149
+ var _effect2 = core.useComponentTracking();
2150
+ try {
2151
+ var hasMoreControl = _ref2.hasMoreControl,
2152
+ loadingControl = _ref2.loadingControl,
2153
+ fetchMore = _ref2.fetchMore;
2154
+ var observerTarget = react.useRef(null);
2155
+ var hasMore = hasMoreControl.value;
2156
+ var loading = loadingControl.value;
2157
+ react.useEffect(function () {
2158
+ var observer = new IntersectionObserver(function (entries) {
2159
+ if (entries[0].isIntersecting && hasMore && !loading) {
2160
+ fetchMore();
2161
+ }
2162
+ }, {
2163
+ threshold: 0.5
2164
+ }); // Trigger when 50% of the target is visible
2165
+ if (observerTarget.current) {
2166
+ observer.observe(observerTarget.current);
2167
+ }
2168
+ return function () {
2169
+ if (observerTarget.current) {
2170
+ observer.unobserve(observerTarget.current);
2171
+ }
2172
+ };
2173
+ }, [hasMore, loading]); // Re-run effect if hasMore or loading state changes
2174
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
2175
+ ref: observerTarget,
2176
+ style: {
2177
+ height: "1px"
2178
+ }
2179
+ });
2180
+ } finally {
2181
+ _effect2();
2182
+ }
2183
+ }
2184
+
2185
+ function HtmlCheckButtons(props) {
2186
+ var _effect = core.useComponentTracking();
2187
+ try {
2188
+ var control = props.control,
2189
+ options = props.options,
2190
+ readonly = props.readonly,
2191
+ className = props.className,
2192
+ id = props.id,
2193
+ type = props.type,
2194
+ isChecked = props.isChecked,
2195
+ setChecked = props.setChecked,
2196
+ entryAdornment = props.entryAdornment,
2197
+ classes = props.classes,
2198
+ _props$controlClasses = props.controlClasses,
2199
+ controlClasses = _props$controlClasses === void 0 ? {} : _props$controlClasses;
2200
+ var disabled = control.disabled;
2201
+ var name = "r" + control.uniqueId;
2202
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
2203
+ role: "group",
2204
+ className: className,
2205
+ id: id,
2206
+ children: /*#__PURE__*/jsxRuntime.jsx(core.RenderArrayElements, {
2207
+ array: options == null ? void 0 : options.filter(function (x) {
2208
+ return x.value != null;
2209
+ }),
2210
+ children: function children(o, i) {
2211
+ var checked = core.useComputed(function () {
2212
+ return isChecked(control, o);
2213
+ }).value;
2214
+ var selOrUnsel = checked ? schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.selectedClass, classes.selectedClass) : schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.notSelectedClass, classes.notSelectedClass);
2215
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
2216
+ className: clsx.clsx(schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
2217
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2218
+ className: classes.entryClass,
2219
+ children: [/*#__PURE__*/jsxRuntime.jsx("input", {
2220
+ id: name + "_" + i,
2221
+ className: classes.checkClass,
2222
+ type: type,
2223
+ name: name,
2224
+ readOnly: readonly,
2225
+ disabled: disabled,
2226
+ checked: checked,
2227
+ onChange: function onChange(x) {
2228
+ !readonly && setChecked(control, o, x.target.checked);
2229
+ }
2230
+ }), /*#__PURE__*/jsxRuntime.jsx("label", {
2231
+ className: classes.labelClass,
2232
+ htmlFor: name + "_" + i,
2233
+ children: o.name
2234
+ })]
2235
+ }), entryAdornment == null ? void 0 : entryAdornment(o, i, checked)]
2236
+ });
2237
+ }
2238
+ })
2239
+ });
2240
+ } finally {
2241
+ _effect();
2242
+ }
2243
+ }
2244
+
2087
2245
  var _excluded = ["inline", "textClass", "className", "notWrapInText", "androidRippleColor", "onClick", "nonTextContent"],
2088
2246
  _excluded2 = ["textClass", "className", "onChangeValue", "onChangeChecked", "inputRef"],
2089
2247
  _excluded3 = ["text", "html", "children", "className", "textClass", "nativeRef", "inline"],
2090
2248
  _excluded4 = ["textClass", "className"];
2091
- var DefaultBoolOptions = [{
2092
- name: "Yes",
2093
- value: true
2094
- }, {
2095
- name: "No",
2096
- value: false
2097
- }];
2098
2249
  function createDefaultDataRenderer(options) {
2099
2250
  var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
2100
2251
  if (options === void 0) {
@@ -2121,16 +2272,17 @@ function createDefaultDataRenderer(options) {
2121
2272
  defaultEmptyText = _optionRenderer$boole.defaultEmptyText;
2122
2273
  var arrayRenderer = createDefaultArrayDataRenderer(options.arrayOptions);
2123
2274
  var autocompleteRenderer = createAutocompleteRenderer(options.autocompleteOptions);
2275
+ var scrollListRenderer = createScrollListRenderer(options.scrollListOptions);
2124
2276
  return schemas.createDataRenderer(function (props, renderers) {
2125
2277
  var field = props.field;
2126
2278
  var fieldType = field.type;
2127
2279
  var renderOptions = props.renderOptions;
2128
- var renderType = renderOptions.type;
2280
+ var renderType = renderOptions.type ? renderOptions.type : schemas.DataRenderType.Standard;
2129
2281
  if (field.collection && props.dataNode.elementIndex == null && (renderType == schemas.DataRenderType.Standard || renderType == schemas.DataRenderType.Array || renderType == schemas.DataRenderType.ArrayElement)) {
2130
2282
  if (renderType == schemas.DataRenderType.ArrayElement) return arrayElementRenderer.render(props, renderers);
2131
2283
  return arrayRenderer.render(props, renderers);
2132
2284
  }
2133
- if (fieldType === schemas.FieldType.Compound) {
2285
+ if (fieldType === schemas.FieldType.Compound && (schemas.isDataGroupRenderer(renderOptions) || renderType === schemas.DataRenderType.Standard)) {
2134
2286
  var _ref;
2135
2287
  var groupOptions = (_ref = schemas.isDataGroupRenderer(renderOptions) ? renderOptions.groupOptions : undefined) != null ? _ref : {
2136
2288
  type: "Standard",
@@ -2145,7 +2297,7 @@ function createDefaultDataRenderer(options) {
2145
2297
  className: "@ " + schemas.rendererClass(p.className, displayOnlyClass),
2146
2298
  children: /*#__PURE__*/jsxRuntime.jsx(DefaultDisplayOnly, {
2147
2299
  dataNode: props.dataNode,
2148
- state: props.state,
2300
+ state: props.formNode,
2149
2301
  schemaInterface: props.dataContext.schemaInterface,
2150
2302
  className: props.className,
2151
2303
  textClass: props.textClass,
@@ -2170,6 +2322,8 @@ function createDefaultDataRenderer(options) {
2170
2322
  return nullToggler.render(props, renderers);
2171
2323
  case schemas.DataRenderType.CheckList:
2172
2324
  return checkListRenderer.render(props, renderers);
2325
+ case schemas.DataRenderType.ScrollList:
2326
+ return scrollListRenderer.render(props, renderers);
2173
2327
  case schemas.DataRenderType.Dropdown:
2174
2328
  return selectRenderer.render(props, renderers);
2175
2329
  case schemas.DataRenderType.Radio:
@@ -2196,6 +2350,7 @@ function createDefaultDataRenderer(options) {
2196
2350
  textClass: schemas.rendererClass(props.textClass, inputTextClass),
2197
2351
  style: props.style,
2198
2352
  id: props.id,
2353
+ errorId: props.errorId,
2199
2354
  readOnly: props.readonly,
2200
2355
  control: props.control,
2201
2356
  placeholder: placeholder != null ? placeholder : undefined,
@@ -2244,15 +2399,22 @@ function createDefaultAdornmentRenderer(options) {
2244
2399
  }
2245
2400
  if (schemas.isAccordionAdornment(adornment)) {
2246
2401
  return schemas.wrapLayout(function (x) {
2247
- return /*#__PURE__*/jsxRuntime.jsx(DefaultAccordion, _extends({
2402
+ var _rl$children$props;
2403
+ var displayProps = /*#__PURE__*/react.isValidElement(rl.children) ? (_rl$children$props = rl.children.props) == null ? void 0 : _rl$children$props.displayProps : undefined;
2404
+ return /*#__PURE__*/jsxRuntime.jsx(DefaultAccordion, {
2405
+ isGroup: false,
2248
2406
  renderers: renderers,
2249
2407
  children: x,
2250
- accordion: adornment,
2408
+ className: displayProps == null ? void 0 : displayProps.className,
2409
+ titleTextClass: displayProps == null ? void 0 : displayProps.textClass,
2410
+ title: renderers.renderLabelText(adornment.title),
2411
+ defaultExpanded: adornment.defaultExpanded,
2251
2412
  contentStyle: rl.style,
2252
2413
  contentClassName: rl.className,
2253
2414
  designMode: designMode,
2254
- dataContext: dataContext
2255
- }, options.accordion));
2415
+ dataContext: dataContext,
2416
+ options: options.accordion
2417
+ });
2256
2418
  })(rl);
2257
2419
  }
2258
2420
  },
@@ -2331,7 +2493,8 @@ var StandardHtmlComponents = {
2331
2493
  Div: DefaultHtmlDivRenderer,
2332
2494
  H1: "h1",
2333
2495
  B: "b",
2334
- Input: DefaultHtmlInputRenderer
2496
+ Input: DefaultHtmlInputRenderer,
2497
+ CheckButtons: HtmlCheckButtons
2335
2498
  };
2336
2499
  function DefaultHtmlButtonRenderer(_ref5) {
2337
2500
  var _effect = core.useComponentTracking();
@@ -2344,9 +2507,9 @@ function DefaultHtmlButtonRenderer(_ref5) {
2344
2507
  onClick = _ref5.onClick,
2345
2508
  nonTextContent = _ref5.nonTextContent,
2346
2509
  props = _objectWithoutPropertiesLoose(_ref5, _excluded);
2347
- var Comp = nonTextContent ? "div" : "button";
2510
+ var Comp = inline ? "span" : nonTextContent ? "div" : "button";
2348
2511
  return /*#__PURE__*/jsxRuntime.jsx(Comp, _extends({
2349
- role: nonTextContent ? "button" : undefined,
2512
+ role: nonTextContent || inline ? "button" : undefined,
2350
2513
  onClick: onClick ? function (e) {
2351
2514
  e.stopPropagation();
2352
2515
  onClick();
@@ -2454,7 +2617,7 @@ function createDefaultRenderers(options) {
2454
2617
  display: createDefaultDisplayRenderer(options.display),
2455
2618
  action: createButtonActionRenderer(undefined, options.action),
2456
2619
  array: createDefaultArrayRenderer(options.array),
2457
- group: createDefaultGroupRenderer(options.group),
2620
+ group: createDefaultGroupRenderer(options.group, options.adornment),
2458
2621
  label: createDefaultLabelRenderer(options.label),
2459
2622
  adornment: createDefaultAdornmentRenderer(options.adornment),
2460
2623
  renderLayout: createDefaultLayoutRenderer(options.layout),
@@ -2508,7 +2671,8 @@ var defaultTailwindTheme = {
2508
2671
  standardClassName: "flex flex-col gap-4",
2509
2672
  grid: {
2510
2673
  className: "flex flex-col gap-4",
2511
- rowClass: "flex flex-row gap-4 justify-between *:flex-1"
2674
+ rowClass: "flex flex-row gap-4 justify-between",
2675
+ cellClass: "flex-1"
2512
2676
  },
2513
2677
  flexClassName: "gap-2",
2514
2678
  inlineClass: "",
@@ -2527,7 +2691,8 @@ var defaultTailwindTheme = {
2527
2691
  primaryClass: "bg-primary-500",
2528
2692
  secondaryClass: "bg-secondary-500",
2529
2693
  iconBeforeClass: "px-2",
2530
- iconAfterClass: "px-2"
2694
+ iconAfterClass: "px-2",
2695
+ busyIcon: schemas.fontAwesomeIcon("spinner fa-spin")
2531
2696
  },
2532
2697
  layout: {
2533
2698
  className: "flex flex-col",
@@ -2553,12 +2718,15 @@ var defaultTailwindTheme = {
2553
2718
  listEntryClass: "list-none p-2 rounded-lg cursor-default last-of-type:border-b-0 hover:cursor-pointer hover:bg-primary-100 aria-selected:bg-primary-200 aria-selected:text-primary-900 focused:bg-surface-100 focus-visible:bg-surface-100 focused:text-surface-900 focus-visible:text-surface-900 focus-visible:shadow-[0_0_0_3px_transparent] focus-visible:shadow-primary-200 focused:aria-selected:bg-primary-200 focus-visible:aria-selected:bg-primary-200 focused:aria-selected:text-primary-900 focus-visible:aria-selected:text-primary-900",
2554
2719
  chipContainerClass: "flex flex-row items-center px-3 py-1 rounded-full bg-surface-100 m-1 gap-2 truncate",
2555
2720
  chipCloseButtonClass: "fa-solid fa-xmark p-1 bg-surface-300 rounded-full min-w-[24px] flex justify-center text-surface-50 hover:bg-surface-400 hover:text-surface-100 hover:cursor-pointer"
2721
+ },
2722
+ scrollListOptions: {
2723
+ loadingIcon: schemas.fontAwesomeIcon("spinner fa-spin")
2556
2724
  }
2557
2725
  },
2558
2726
  adornment: {
2559
2727
  accordion: {
2560
- className: "flex items-center gap-2 my-2",
2561
- titleClass: "cursor-pointer",
2728
+ className: "flex items-center gap-2 my-2 w-fit",
2729
+ titleTextClass: "cursor-pointer",
2562
2730
  iconOpen: schemas.fontAwesomeIcon("chevron-up"),
2563
2731
  iconClosed: schemas.fontAwesomeIcon("chevron-down")
2564
2732
  },
@@ -2571,7 +2739,6 @@ var defaultTailwindTheme = {
2571
2739
  }
2572
2740
  };
2573
2741
 
2574
- exports.CheckButtons = CheckButtons;
2575
2742
  exports.ControlInput = ControlInput;
2576
2743
  exports.DataArrayRenderer = DataArrayRenderer;
2577
2744
  exports.DefaultAccordion = DefaultAccordion;
@@ -2592,6 +2759,7 @@ exports.OptionalEditRenderer = OptionalEditRenderer;
2592
2759
  exports.SelectDataRenderer = SelectDataRenderer;
2593
2760
  exports.StandardHtmlComponents = StandardHtmlComponents;
2594
2761
  exports.ValueForFieldExtension = ValueForFieldExtension;
2762
+ exports.createAccordionGroupRenderer = createAccordionGroupRenderer;
2595
2763
  exports.createAutocompleteRenderer = createAutocompleteRenderer;
2596
2764
  exports.createButtonActionRenderer = createButtonActionRenderer;
2597
2765
  exports.createCheckListRenderer = createCheckListRenderer;
@@ -2613,11 +2781,11 @@ exports.createJsonataRenderer = createJsonataRenderer;
2613
2781
  exports.createNullToggleRenderer = createNullToggleRenderer;
2614
2782
  exports.createOptionalAdornment = createOptionalAdornment;
2615
2783
  exports.createRadioRenderer = createRadioRenderer;
2784
+ exports.createScrollListRenderer = createScrollListRenderer;
2616
2785
  exports.createSelectConversion = createSelectConversion;
2617
2786
  exports.createSelectRenderer = createSelectRenderer;
2618
2787
  exports.createValueForFieldRenderer = createValueForFieldRenderer;
2619
2788
  exports.createWizardRenderer = createWizardRenderer;
2620
2789
  exports.defaultTailwindTheme = defaultTailwindTheme;
2621
2790
  exports.getAccordionState = getAccordionState;
2622
- exports.setIncluded = setIncluded;
2623
2791
  //# sourceMappingURL=index.cjs.map