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

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