@bpmn-io/form-js-viewer 0.14.1 → 1.0.0-alpha.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 (29) hide show
  1. package/dist/assets/form-js-base.css +147 -49
  2. package/dist/assets/form-js.css +142 -45
  3. package/dist/index.cjs +618 -340
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.es.js +618 -340
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/types/Form.d.ts +1 -1
  8. package/dist/types/core/EventBus.d.ts +1 -1
  9. package/dist/types/core/index.d.ts +2 -1
  10. package/dist/types/index.d.ts +1 -1
  11. package/dist/types/render/Renderer.d.ts +2 -2
  12. package/dist/types/render/components/Util.d.ts +4 -3
  13. package/dist/types/render/components/form-fields/Button.d.ts +9 -7
  14. package/dist/types/render/components/form-fields/Checkbox.d.ts +11 -9
  15. package/dist/types/render/components/form-fields/Checklist.d.ts +14 -12
  16. package/dist/types/render/components/form-fields/Datetime.d.ts +9 -7
  17. package/dist/types/render/components/form-fields/Default.d.ts +9 -7
  18. package/dist/types/render/components/form-fields/Image.d.ts +7 -5
  19. package/dist/types/render/components/form-fields/Number.d.ts +12 -10
  20. package/dist/types/render/components/form-fields/Radio.d.ts +14 -12
  21. package/dist/types/render/components/form-fields/Select.d.ts +14 -12
  22. package/dist/types/render/components/form-fields/Taglist.d.ts +14 -12
  23. package/dist/types/render/components/form-fields/Text.d.ts +9 -7
  24. package/dist/types/render/components/form-fields/Textarea.d.ts +11 -9
  25. package/dist/types/render/components/form-fields/Textfield.d.ts +11 -9
  26. package/dist/types/render/hooks/index.d.ts +1 -0
  27. package/dist/types/render/hooks/useReadonly.d.ts +17 -0
  28. package/dist/types/types.d.ts +1 -1
  29. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -476,6 +476,30 @@ var FN_REF = '__fn';
476
476
  var DEFAULT_PRIORITY = 1000;
477
477
  var slice = Array.prototype.slice;
478
478
 
479
+ /**
480
+ * @typedef { {
481
+ * stopPropagation(): void;
482
+ * preventDefault(): void;
483
+ * cancelBubble: boolean;
484
+ * defaultPrevented: boolean;
485
+ * returnValue: any;
486
+ * } } Event
487
+ */
488
+
489
+ /**
490
+ * @template E
491
+ *
492
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
493
+ */
494
+
495
+ /**
496
+ * @typedef { {
497
+ * priority: number;
498
+ * next: EventBusListener | null;
499
+ * callback: EventBusEventCallback<any>;
500
+ * } } EventBusListener
501
+ */
502
+
479
503
  /**
480
504
  * A general purpose event bus.
481
505
  *
@@ -560,6 +584,9 @@ var slice = Array.prototype.slice;
560
584
  * ```
561
585
  */
562
586
  function EventBus() {
587
+ /**
588
+ * @type { Record<string, EventBusListener> }
589
+ */
563
590
  this._listeners = {};
564
591
 
565
592
  // cleanup on destroy on lowest priority to allow
@@ -579,10 +606,12 @@ function EventBus() {
579
606
  *
580
607
  * Returning anything but `undefined` from a listener will stop the listener propagation.
581
608
  *
582
- * @param {string|Array<string>} events
583
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
584
- * @param {Function} callback
585
- * @param {Object} [that] Pass context (`this`) to the callback
609
+ * @template T
610
+ *
611
+ * @param {string|string[]} events to subscribe to
612
+ * @param {number} [priority=1000] listen priority
613
+ * @param {EventBusEventCallback<T>} callback
614
+ * @param {any} [that] callback context
586
615
  */
587
616
  EventBus.prototype.on = function (events, priority, callback, that) {
588
617
  events = minDash.isArray(events) ? events : [events];
@@ -614,14 +643,16 @@ EventBus.prototype.on = function (events, priority, callback, that) {
614
643
  };
615
644
 
616
645
  /**
617
- * Register an event listener that is executed only once.
646
+ * Register an event listener that is called only once.
618
647
  *
619
- * @param {string} event the event name to register for
620
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
621
- * @param {Function} callback the callback to execute
622
- * @param {Object} [that] Pass context (`this`) to the callback
648
+ * @template T
649
+ *
650
+ * @param {string|string[]} events to subscribe to
651
+ * @param {number} [priority=1000] the listen priority
652
+ * @param {EventBusEventCallback<T>} callback
653
+ * @param {any} [that] callback context
623
654
  */
624
- EventBus.prototype.once = function (event, priority, callback, that) {
655
+ EventBus.prototype.once = function (events, priority, callback, that) {
625
656
  var self = this;
626
657
  if (minDash.isFunction(priority)) {
627
658
  that = callback;
@@ -634,7 +665,7 @@ EventBus.prototype.once = function (event, priority, callback, that) {
634
665
  function wrappedCallback() {
635
666
  wrappedCallback.__isTomb = true;
636
667
  var result = callback.apply(that, arguments);
637
- self.off(event, wrappedCallback);
668
+ self.off(events, wrappedCallback);
638
669
  return result;
639
670
  }
640
671
 
@@ -642,7 +673,7 @@ EventBus.prototype.once = function (event, priority, callback, that) {
642
673
  // bound callbacks via {@link #off} using the original
643
674
  // callback
644
675
  wrappedCallback[FN_REF] = callback;
645
- this.on(event, priority, wrappedCallback);
676
+ this.on(events, priority, wrappedCallback);
646
677
  };
647
678
 
648
679
  /**
@@ -650,8 +681,8 @@ EventBus.prototype.once = function (event, priority, callback, that) {
650
681
  *
651
682
  * If no callback is given, all listeners for a given event name are being removed.
652
683
  *
653
- * @param {string|Array<string>} events
654
- * @param {Function} [callback]
684
+ * @param {string|string[]} events
685
+ * @param {EventBusEventCallback} [callback]
655
686
  */
656
687
  EventBus.prototype.off = function (events, callback) {
657
688
  events = minDash.isArray(events) ? events : [events];
@@ -662,11 +693,11 @@ EventBus.prototype.off = function (events, callback) {
662
693
  };
663
694
 
664
695
  /**
665
- * Create an EventBus event.
696
+ * Create an event recognized be the event bus.
666
697
  *
667
- * @param {Object} data
698
+ * @param {Object} data Event data.
668
699
  *
669
- * @return {Object} event, recognized by the eventBus
700
+ * @return {Event} An event that will be recognized by the event bus.
670
701
  */
671
702
  EventBus.prototype.createEvent = function (data) {
672
703
  var event = new InternalEvent();
@@ -675,10 +706,11 @@ EventBus.prototype.createEvent = function (data) {
675
706
  };
676
707
 
677
708
  /**
678
- * Fires a named event.
709
+ * Fires an event.
679
710
  *
680
711
  * @example
681
712
  *
713
+ * ```javascript
682
714
  * // fire event by name
683
715
  * events.fire('foo');
684
716
  *
@@ -696,13 +728,13 @@ EventBus.prototype.createEvent = function (data) {
696
728
  * });
697
729
  *
698
730
  * events.fire({ type: 'foo' }, 'I am bar!');
731
+ * ```
699
732
  *
700
- * @param {string} [name] the optional event name
701
- * @param {Object} [event] the event object
702
- * @param {...Object} additional arguments to be passed to the callback functions
733
+ * @param {string} [type] event type
734
+ * @param {Object} [data] event or event data
735
+ * @param {...any} [args] additional arguments the callback will be called with.
703
736
  *
704
- * @return {boolean} the events return value, if specified or false if the
705
- * default action was prevented by listeners
737
+ * @return {any} The return value. Will be set to `false` if the default was prevented.
706
738
  */
707
739
  EventBus.prototype.fire = function (type, data) {
708
740
  var event, firstListener, returnValue, args;
@@ -754,6 +786,14 @@ EventBus.prototype.fire = function (type, data) {
754
786
  }
755
787
  return returnValue;
756
788
  };
789
+
790
+ /**
791
+ * Handle an error by firing an event.
792
+ *
793
+ * @param {Error} error The error to be handled.
794
+ *
795
+ * @return {boolean} Whether the error was handled.
796
+ */
757
797
  EventBus.prototype.handleError = function (error) {
758
798
  return this.fire('error', {
759
799
  error: error
@@ -762,6 +802,14 @@ EventBus.prototype.handleError = function (error) {
762
802
  EventBus.prototype._destroy = function () {
763
803
  this._listeners = {};
764
804
  };
805
+
806
+ /**
807
+ * @param {Event} event
808
+ * @param {any[]} args
809
+ * @param {EventBusListener} listener
810
+ *
811
+ * @return {any}
812
+ */
765
813
  EventBus.prototype._invokeListeners = function (event, args, listener) {
766
814
  var returnValue;
767
815
  while (listener) {
@@ -774,6 +822,14 @@ EventBus.prototype._invokeListeners = function (event, args, listener) {
774
822
  }
775
823
  return returnValue;
776
824
  };
825
+
826
+ /**
827
+ * @param {Event} event
828
+ * @param {any[]} args
829
+ * @param {EventBusListener} listener
830
+ *
831
+ * @return {any}
832
+ */
777
833
  EventBus.prototype._invokeListener = function (event, args, listener) {
778
834
  var returnValue;
779
835
  if (listener.callback.__isTomb) {
@@ -802,7 +858,7 @@ EventBus.prototype._invokeListener = function (event, args, listener) {
802
858
  return returnValue;
803
859
  };
804
860
 
805
- /*
861
+ /**
806
862
  * Add new listener with a certain priority to the list
807
863
  * of listeners (for the given event).
808
864
  *
@@ -816,7 +872,7 @@ EventBus.prototype._invokeListener = function (event, args, listener) {
816
872
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
817
873
  *
818
874
  * @param {string} event
819
- * @param {Object} listener { priority, callback }
875
+ * @param {EventBusListener} listener
820
876
  */
821
877
  EventBus.prototype._addListener = function (event, newListener) {
822
878
  var listener = this._getListeners(event),
@@ -847,9 +903,20 @@ EventBus.prototype._addListener = function (event, newListener) {
847
903
  // add new listener to back
848
904
  previousListener.next = newListener;
849
905
  };
906
+
907
+ /**
908
+ * @param {string} name
909
+ *
910
+ * @return {EventBusListener}
911
+ */
850
912
  EventBus.prototype._getListeners = function (name) {
851
913
  return this._listeners[name];
852
914
  };
915
+
916
+ /**
917
+ * @param {string} name
918
+ * @param {EventBusListener} listener
919
+ */
853
920
  EventBus.prototype._setListeners = function (name, listener) {
854
921
  this._listeners[name] = listener;
855
922
  };
@@ -897,9 +964,9 @@ InternalEvent.prototype.init = function (data) {
897
964
  * Invoke function. Be fast...
898
965
  *
899
966
  * @param {Function} fn
900
- * @param {Array<Object>} args
967
+ * @param {any[]} args
901
968
  *
902
- * @return {Any}
969
+ * @return {any}
903
970
  */
904
971
  function invokeFunction(fn, args) {
905
972
  return fn.apply(null, args);
@@ -1275,7 +1342,7 @@ function createFormContainer(prefix = 'fjs') {
1275
1342
  return container;
1276
1343
  }
1277
1344
 
1278
- const EXPRESSION_PROPERTIES = ['alt', 'source', 'text'];
1345
+ const EXPRESSION_PROPERTIES = ['alt', 'source', 'readonly', 'text'];
1279
1346
  const TEMPLATE_PROPERTIES = ['text'];
1280
1347
  function findErrors(errors, path) {
1281
1348
  return errors[pathStringify(path)];
@@ -1494,16 +1561,18 @@ class Importer {
1494
1561
  // if unavailable - get empty value from form field
1495
1562
 
1496
1563
  if (_path) {
1497
- const fieldImplementation = this._formFields.get(type);
1564
+ const {
1565
+ config: fieldConfig
1566
+ } = this._formFields.get(type);
1498
1567
  let valueData = minDash.get(data, _path);
1499
- if (!minDash.isUndefined(valueData) && fieldImplementation.sanitizeValue) {
1500
- valueData = fieldImplementation.sanitizeValue({
1568
+ if (!minDash.isUndefined(valueData) && fieldConfig.sanitizeValue) {
1569
+ valueData = fieldConfig.sanitizeValue({
1501
1570
  formField,
1502
1571
  data,
1503
1572
  value: valueData
1504
1573
  });
1505
1574
  }
1506
- const initializedFieldValue = !minDash.isUndefined(valueData) ? valueData : !minDash.isUndefined(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
1575
+ const initializedFieldValue = !minDash.isUndefined(valueData) ? valueData : !minDash.isUndefined(defaultValue) ? defaultValue : fieldConfig.emptyValue;
1507
1576
  initializedData = {
1508
1577
  ...initializedData,
1509
1578
  [_path[0]]: initializedFieldValue
@@ -1521,14 +1590,16 @@ var importModule = {
1521
1590
 
1522
1591
  function formFieldClasses(type, {
1523
1592
  errors = [],
1524
- disabled = false
1593
+ disabled = false,
1594
+ readonly = false
1525
1595
  } = {}) {
1526
1596
  if (!type) {
1527
1597
  throw new Error('type required');
1528
1598
  }
1529
1599
  return classNames('fjs-form-field', `fjs-form-field-${type}`, {
1530
1600
  'fjs-has-errors': errors.length > 0,
1531
- 'fjs-disabled': disabled
1601
+ 'fjs-disabled': disabled,
1602
+ 'fjs-readonly': readonly
1532
1603
  });
1533
1604
  }
1534
1605
  function gridColumnClasses(formField) {
@@ -1568,14 +1639,16 @@ function Button(props) {
1568
1639
  })
1569
1640
  });
1570
1641
  }
1571
- Button.create = (options = {}) => ({
1572
- action: 'submit',
1573
- ...options
1574
- });
1575
- Button.type = type$b;
1576
- Button.label = 'Button';
1577
- Button.keyed = true;
1578
- Button.group = 'action';
1642
+ Button.config = {
1643
+ type: type$b,
1644
+ keyed: true,
1645
+ label: 'Button',
1646
+ group: 'action',
1647
+ create: (options = {}) => ({
1648
+ action: 'submit',
1649
+ ...options
1650
+ })
1651
+ };
1579
1652
 
1580
1653
  const FormRenderContext = preact.createContext({
1581
1654
  Empty: props => {
@@ -1639,13 +1712,16 @@ function Description(props) {
1639
1712
 
1640
1713
  function Errors(props) {
1641
1714
  const {
1642
- errors
1715
+ errors,
1716
+ id
1643
1717
  } = props;
1644
1718
  if (!errors.length) {
1645
1719
  return null;
1646
1720
  }
1647
1721
  return jsxRuntime.jsx("div", {
1648
1722
  class: "fjs-form-field-error",
1723
+ "aria-live": "polite",
1724
+ id: id,
1649
1725
  children: jsxRuntime.jsx("ul", {
1650
1726
  children: errors.map(error => {
1651
1727
  return jsxRuntime.jsx("li", {
@@ -1681,6 +1757,7 @@ function Checkbox(props) {
1681
1757
  disabled,
1682
1758
  errors = [],
1683
1759
  field,
1760
+ readonly,
1684
1761
  value = false
1685
1762
  } = props;
1686
1763
  const {
@@ -1703,10 +1780,12 @@ function Checkbox(props) {
1703
1780
  const {
1704
1781
  formId
1705
1782
  } = hooks.useContext(FormContext$1);
1783
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
1706
1784
  return jsxRuntime.jsxs("div", {
1707
1785
  class: classNames(formFieldClasses(type$a, {
1708
1786
  errors,
1709
- disabled
1787
+ disabled,
1788
+ readonly
1710
1789
  }), {
1711
1790
  'fjs-checked': value
1712
1791
  }),
@@ -1718,28 +1797,33 @@ function Checkbox(props) {
1718
1797
  checked: value,
1719
1798
  class: "fjs-input",
1720
1799
  disabled: disabled,
1800
+ readOnly: readonly,
1721
1801
  id: prefixId(id, formId),
1722
1802
  type: "checkbox",
1723
- onChange: onChange
1803
+ onChange: onChange,
1804
+ "aria-describedby": errorMessageId
1724
1805
  })
1725
1806
  }), jsxRuntime.jsx(Description, {
1726
1807
  description: description
1727
1808
  }), jsxRuntime.jsx(Errors, {
1728
- errors: errors
1809
+ errors: errors,
1810
+ id: errorMessageId
1729
1811
  })]
1730
1812
  });
1731
1813
  }
1732
- Checkbox.create = (options = {}) => ({
1733
- ...options
1734
- });
1735
- Checkbox.type = type$a;
1736
- Checkbox.label = 'Checkbox';
1737
- Checkbox.keyed = true;
1738
- Checkbox.emptyValue = false;
1739
- Checkbox.sanitizeValue = ({
1740
- value
1741
- }) => value === true;
1742
- Checkbox.group = 'selection';
1814
+ Checkbox.config = {
1815
+ type: type$a,
1816
+ keyed: true,
1817
+ label: 'Checkbox',
1818
+ group: 'selection',
1819
+ emptyValue: false,
1820
+ sanitizeValue: ({
1821
+ value
1822
+ }) => value === true,
1823
+ create: (options = {}) => ({
1824
+ ...options
1825
+ })
1826
+ };
1743
1827
 
1744
1828
  // parses the options data from the provided form field and form data
1745
1829
  function getValuesData(formField, formData) {
@@ -2075,6 +2159,7 @@ function Checklist(props) {
2075
2159
  disabled,
2076
2160
  errors = [],
2077
2161
  field,
2162
+ readonly,
2078
2163
  value = []
2079
2164
  } = props;
2080
2165
  const {
@@ -2105,10 +2190,12 @@ function Checklist(props) {
2105
2190
  const {
2106
2191
  formId
2107
2192
  } = hooks.useContext(FormContext$1);
2193
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2108
2194
  return jsxRuntime.jsxs("div", {
2109
2195
  class: classNames(formFieldClasses(type$9, {
2110
2196
  errors,
2111
- disabled
2197
+ disabled,
2198
+ readonly
2112
2199
  })),
2113
2200
  children: [jsxRuntime.jsx(Label, {
2114
2201
  label: label,
@@ -2125,39 +2212,44 @@ function Checklist(props) {
2125
2212
  checked: value.includes(v.value),
2126
2213
  class: "fjs-input",
2127
2214
  disabled: disabled,
2215
+ readOnly: readonly,
2128
2216
  id: prefixId(`${id}-${index}`, formId),
2129
2217
  type: "checkbox",
2130
- onClick: () => toggleCheckbox(v.value)
2218
+ onClick: () => toggleCheckbox(v.value),
2219
+ "aria-describedby": errorMessageId
2131
2220
  })
2132
2221
  }, `${id}-${index}`);
2133
2222
  }), jsxRuntime.jsx(Description, {
2134
2223
  description: description
2135
2224
  }), jsxRuntime.jsx(Errors, {
2136
- errors: errors
2225
+ errors: errors,
2226
+ id: errorMessageId
2137
2227
  })]
2138
2228
  });
2139
2229
  }
2140
- Checklist.create = (options = {}) => {
2141
- const defaults = {};
2142
-
2143
- // provide default values if valuesKey isn't set
2144
- if (!options.valuesKey) {
2145
- defaults.values = [{
2146
- label: 'Value',
2147
- value: 'value'
2148
- }];
2230
+ Checklist.config = {
2231
+ type: type$9,
2232
+ keyed: true,
2233
+ label: 'Checklist',
2234
+ group: 'selection',
2235
+ emptyValue: [],
2236
+ sanitizeValue: sanitizeMultiSelectValue,
2237
+ create: (options = {}) => {
2238
+ const defaults = {};
2239
+
2240
+ // provide default values if valuesKey isn't set
2241
+ if (!options.valuesKey) {
2242
+ defaults.values = [{
2243
+ label: 'Value',
2244
+ value: 'value'
2245
+ }];
2246
+ }
2247
+ return {
2248
+ ...defaults,
2249
+ ...options
2250
+ };
2149
2251
  }
2150
- return {
2151
- ...defaults,
2152
- ...options
2153
- };
2154
2252
  };
2155
- Checklist.type = type$9;
2156
- Checklist.label = 'Checklist';
2157
- Checklist.keyed = true;
2158
- Checklist.emptyValue = [];
2159
- Checklist.sanitizeValue = sanitizeMultiSelectValue;
2160
- Checklist.group = 'selection';
2161
2253
 
2162
2254
  /**
2163
2255
  * Returns the conditionally filtered data of a form reactively.
@@ -2229,6 +2321,33 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
2229
2321
  });
2230
2322
  }
2231
2323
 
2324
+ /**
2325
+ * Retrieve readonly value of a form field, given it can be an
2326
+ * expression optionally or configured globally.
2327
+ *
2328
+ * @typedef { import('../../types').FormProperties } FormProperties
2329
+ *
2330
+ * @param {any} formField
2331
+ * @param {FormProperties} properties
2332
+ *
2333
+ * @returns {boolean}
2334
+ */
2335
+ function useReadonly(formField, properties = {}) {
2336
+ const expressionLanguage = useService('expressionLanguage');
2337
+ const conditionChecker = useService('conditionChecker', false);
2338
+ const filteredData = useFilteredFormData();
2339
+ const {
2340
+ readonly
2341
+ } = formField;
2342
+ if (properties.readOnly) {
2343
+ return true;
2344
+ }
2345
+ if (expressionLanguage && expressionLanguage.isExpression(readonly)) {
2346
+ return conditionChecker ? conditionChecker.check(readonly, filteredData) : false;
2347
+ }
2348
+ return readonly || false;
2349
+ }
2350
+
2232
2351
  /**
2233
2352
  * Template a string reactively based on form data. If the string is not a template, it is returned as is.
2234
2353
  * Memoised to minimize re-renders
@@ -2257,9 +2376,6 @@ function FormField(props) {
2257
2376
  field,
2258
2377
  onChange
2259
2378
  } = props;
2260
- const {
2261
- _path
2262
- } = field;
2263
2379
  const formFields = useService('formFields'),
2264
2380
  form = useService('form');
2265
2381
  const {
@@ -2276,9 +2392,12 @@ function FormField(props) {
2276
2392
  if (!FormFieldComponent) {
2277
2393
  throw new Error(`cannot render field <${field.type}>`);
2278
2394
  }
2279
- const value = minDash.get(data, _path);
2280
- const fieldErrors = findErrors(errors, _path);
2281
- const disabled = properties.readOnly || field.disabled || false;
2395
+ const value = minDash.get(data, field._path);
2396
+ const fieldErrors = findErrors(errors, field._path);
2397
+ const readonly = useReadonly(field, properties);
2398
+
2399
+ // add precedence: global readonly > form field disabled
2400
+ const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
2282
2401
  const hidden = useCondition(field.conditional && field.conditional.hide || null);
2283
2402
  if (hidden) {
2284
2403
  return jsxRuntime.jsx(Empty, {});
@@ -2293,7 +2412,8 @@ function FormField(props) {
2293
2412
  ...props,
2294
2413
  disabled: disabled,
2295
2414
  errors: fieldErrors,
2296
- onChange: disabled ? noop$1 : onChange,
2415
+ onChange: disabled || readonly ? noop$1 : onChange,
2416
+ readonly: readonly,
2297
2417
  value: value
2298
2418
  })
2299
2419
  })
@@ -2344,14 +2464,16 @@ function Default(props) {
2344
2464
  }), components.length ? null : jsxRuntime.jsx(Empty, {})]
2345
2465
  });
2346
2466
  }
2347
- Default.create = (options = {}) => ({
2348
- components: [],
2349
- ...options
2350
- });
2351
- Default.type = 'default';
2352
- Default.keyed = false;
2353
- Default.label = null;
2354
- Default.group = null;
2467
+ Default.config = {
2468
+ type: 'default',
2469
+ keyed: false,
2470
+ label: null,
2471
+ group: null,
2472
+ create: (options = {}) => ({
2473
+ components: [],
2474
+ ...options
2475
+ })
2476
+ };
2355
2477
 
2356
2478
  function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
2357
2479
  var CalendarIcon = (({
@@ -2378,12 +2500,14 @@ function InputAdorner(props) {
2378
2500
  inputRef,
2379
2501
  children,
2380
2502
  disabled,
2503
+ readonly,
2381
2504
  hasErrors
2382
2505
  } = props;
2383
2506
  const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
2384
2507
  return jsxRuntime.jsxs("div", {
2385
2508
  class: classNames('fjs-input-group', {
2386
- 'fjs-disabled': disabled
2509
+ 'fjs-disabled': disabled,
2510
+ 'fjs-readonly': readonly
2387
2511
  }, {
2388
2512
  'hasErrors': hasErrors
2389
2513
  }),
@@ -2416,6 +2540,7 @@ function Datepicker(props) {
2416
2540
  disabled,
2417
2541
  disallowPassedDates,
2418
2542
  date,
2543
+ readonly,
2419
2544
  setDate
2420
2545
  } = props;
2421
2546
  const dateInputRef = hooks.useRef();
@@ -2495,9 +2620,9 @@ function Datepicker(props) {
2495
2620
  }
2496
2621
  }, [flatpickrInstance, isInputDirty]);
2497
2622
  const onInputFocus = hooks.useCallback(e => {
2498
- if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget)) return;
2623
+ if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget) || readonly) return;
2499
2624
  flatpickrInstance.open();
2500
- }, [flatpickrInstance]);
2625
+ }, [flatpickrInstance, readonly]);
2501
2626
 
2502
2627
  // simulate an enter press on blur to make sure the date value is submitted in all scenarios
2503
2628
  const onInputBlur = hooks.useCallback(e => {
@@ -2516,6 +2641,7 @@ function Datepicker(props) {
2516
2641
  }), jsxRuntime.jsx(InputAdorner, {
2517
2642
  pre: jsxRuntime.jsx(CalendarIcon, {}),
2518
2643
  disabled: disabled,
2644
+ readonly: readonly,
2519
2645
  rootRef: focusScopeRef,
2520
2646
  inputRef: dateInputRef,
2521
2647
  children: jsxRuntime.jsx("div", {
@@ -2527,16 +2653,18 @@ function Datepicker(props) {
2527
2653
  ref: dateInputRef,
2528
2654
  type: "text",
2529
2655
  id: fullId,
2530
- class: 'fjs-input',
2656
+ class: "fjs-input",
2531
2657
  disabled: disabled,
2658
+ readOnly: readonly,
2532
2659
  placeholder: "mm/dd/yyyy",
2533
2660
  autoComplete: "off",
2534
2661
  onFocus: onInputFocus,
2535
2662
  onKeyDown: onInputKeyDown,
2536
- onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
2663
+ onMouseDown: () => !flatpickrInstance.isOpen && !readonly && flatpickrInstance.open(),
2537
2664
  onBlur: onInputBlur,
2538
- onInput: e => setIsInputDirty(true),
2539
- "data-input": true
2665
+ onInput: () => setIsInputDirty(true),
2666
+ "data-input": true,
2667
+ "aria-describedby": props['aria-describedby']
2540
2668
  })
2541
2669
  })
2542
2670
  })]
@@ -2666,6 +2794,7 @@ function Timepicker(props) {
2666
2794
  formId,
2667
2795
  required,
2668
2796
  disabled,
2797
+ readonly,
2669
2798
  use24h = false,
2670
2799
  timeInterval,
2671
2800
  time,
@@ -2771,6 +2900,7 @@ function Timepicker(props) {
2771
2900
  pre: jsxRuntime.jsx(ClockIcon, {}),
2772
2901
  inputRef: timeInputRef,
2773
2902
  disabled: disabled,
2903
+ readonly: readonly,
2774
2904
  children: jsxRuntime.jsxs("div", {
2775
2905
  class: "fjs-timepicker fjs-timepicker-anchor",
2776
2906
  children: [jsxRuntime.jsx("input", {
@@ -2780,10 +2910,11 @@ function Timepicker(props) {
2780
2910
  class: "fjs-input",
2781
2911
  value: rawValue,
2782
2912
  disabled: disabled,
2913
+ readOnly: readonly,
2783
2914
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
2784
2915
  autoComplete: "off",
2785
- onFocus: () => useDropdown && setDropdownIsOpen(true),
2786
- onClick: () => useDropdown && setDropdownIsOpen(true)
2916
+ onFocus: () => !readonly && useDropdown && setDropdownIsOpen(true),
2917
+ onClick: () => !readonly && useDropdown && setDropdownIsOpen(true)
2787
2918
 
2788
2919
  // @ts-ignore
2789
2920
  ,
@@ -2793,7 +2924,8 @@ function Timepicker(props) {
2793
2924
  },
2794
2925
  onBlur: onInputBlur,
2795
2926
  onKeyDown: onInputKeyDown,
2796
- "data-input": true
2927
+ "data-input": true,
2928
+ "aria-describedby": props['aria-describedby']
2797
2929
  }), dropdownIsOpen && jsxRuntime.jsx(DropdownList, {
2798
2930
  values: timeOptions,
2799
2931
  height: 150,
@@ -2813,6 +2945,7 @@ function Datetime(props) {
2813
2945
  errors = [],
2814
2946
  field,
2815
2947
  onChange,
2948
+ readonly,
2816
2949
  value = ''
2817
2950
  } = props;
2818
2951
  const {
@@ -2929,6 +3062,7 @@ function Datetime(props) {
2929
3062
  time
2930
3063
  });
2931
3064
  }, []);
3065
+ const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2932
3066
  const datePickerProps = {
2933
3067
  id,
2934
3068
  label: dateLabel,
@@ -2938,7 +3072,9 @@ function Datetime(props) {
2938
3072
  disabled,
2939
3073
  disallowPassedDates,
2940
3074
  date: dateTime.date,
2941
- setDate
3075
+ readonly,
3076
+ setDate,
3077
+ 'aria-describedby': errorMessageId
2942
3078
  };
2943
3079
  const timePickerProps = {
2944
3080
  id,
@@ -2947,15 +3083,18 @@ function Datetime(props) {
2947
3083
  formId,
2948
3084
  required,
2949
3085
  disabled,
3086
+ readonly,
2950
3087
  use24h,
2951
3088
  timeInterval,
2952
3089
  time: dateTime.time,
2953
- setTime
3090
+ setTime,
3091
+ 'aria-describedby': errorMessageId
2954
3092
  };
2955
3093
  return jsxRuntime.jsxs("div", {
2956
3094
  class: formFieldClasses(type$8, {
2957
3095
  errors: allErrors,
2958
- disabled
3096
+ disabled,
3097
+ readonly
2959
3098
  }),
2960
3099
  children: [jsxRuntime.jsxs("div", {
2961
3100
  class: classNames('fjs-vertical-group'),
@@ -2969,25 +3108,28 @@ function Datetime(props) {
2969
3108
  }), jsxRuntime.jsx(Description, {
2970
3109
  description: description
2971
3110
  }), jsxRuntime.jsx(Errors, {
2972
- errors: allErrors
3111
+ errors: allErrors,
3112
+ id: errorMessageId
2973
3113
  })]
2974
3114
  });
2975
3115
  }
2976
- Datetime.create = (options = {}) => {
2977
- const defaults = {};
2978
- minDash.set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
2979
- minDash.set(defaults, DATE_LABEL_PATH, 'Date');
2980
- return {
2981
- ...defaults,
2982
- ...options
2983
- };
3116
+ Datetime.config = {
3117
+ type: type$8,
3118
+ keyed: true,
3119
+ label: 'Date time',
3120
+ group: 'basic-input',
3121
+ emptyValue: null,
3122
+ sanitizeValue: sanitizeDateTimePickerValue,
3123
+ create: (options = {}) => {
3124
+ const defaults = {};
3125
+ minDash.set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
3126
+ minDash.set(defaults, DATE_LABEL_PATH, 'Date');
3127
+ return {
3128
+ ...defaults,
3129
+ ...options
3130
+ };
3131
+ }
2984
3132
  };
2985
- Datetime.type = type$8;
2986
- Datetime.keyed = true;
2987
- Datetime.emptyValue = null;
2988
- Datetime.sanitizeValue = sanitizeDateTimePickerValue;
2989
- Datetime.label = 'Date time';
2990
- Datetime.group = 'basic-input';
2991
3133
 
2992
3134
  /**
2993
3135
  * This file must not be changed or exchanged.
@@ -3031,7 +3173,7 @@ function Lightbox(props) {
3031
3173
  href: "https://bpmn.io",
3032
3174
  target: "_blank",
3033
3175
  rel: "noopener",
3034
- style: "margin: 15px 20px 15px 10px; align-self: center; color: #404040",
3176
+ style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
3035
3177
  children: jsxRuntime.jsx(Logo, {})
3036
3178
  }), jsxRuntime.jsxs("span", {
3037
3179
  children: ["Web-based tooling for BPMN, DMN, and forms powered by ", jsxRuntime.jsx("a", {
@@ -3054,7 +3196,7 @@ function Link(props) {
3054
3196
  rel: "noopener",
3055
3197
  class: "fjs-powered-by-link",
3056
3198
  title: "Powered by bpmn.io",
3057
- style: "color: #404040",
3199
+ style: "color: var(--cds-text-primary, #404040)",
3058
3200
  onClick: props.onClick,
3059
3201
  children: jsxRuntime.jsx(Logo, {})
3060
3202
  })
@@ -3082,8 +3224,12 @@ const noop = () => {};
3082
3224
  function FormComponent(props) {
3083
3225
  const form = useService('form');
3084
3226
  const {
3085
- schema
3227
+ schema,
3228
+ properties
3086
3229
  } = form._getState();
3230
+ const {
3231
+ ariaLabel
3232
+ } = properties;
3087
3233
  const {
3088
3234
  onSubmit = noop,
3089
3235
  onReset = noop,
@@ -3101,6 +3247,7 @@ function FormComponent(props) {
3101
3247
  class: "fjs-form",
3102
3248
  onSubmit: handleSubmit,
3103
3249
  onReset: handleReset,
3250
+ "aria-label": ariaLabel,
3104
3251
  noValidate: true,
3105
3252
  children: [jsxRuntime.jsx(FormField, {
3106
3253
  field: schema,
@@ -3111,7 +3258,7 @@ function FormComponent(props) {
3111
3258
 
3112
3259
  const NODE_TYPE_TEXT = 3,
3113
3260
  NODE_TYPE_ELEMENT = 1;
3114
- const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong'];
3261
+ const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong', 'table', 'thead', 'tbody', 'tr', 'th', 'td'];
3115
3262
  const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src'];
3116
3263
  const ALLOWED_URI_PATTERN = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
3117
3264
  const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
@@ -3300,13 +3447,15 @@ function Image(props) {
3300
3447
  })
3301
3448
  });
3302
3449
  }
3303
- Image.create = (options = {}) => ({
3304
- ...options
3305
- });
3306
- Image.type = type$7;
3307
- Image.keyed = false;
3308
- Image.label = 'Image view';
3309
- Image.group = 'presentation';
3450
+ Image.config = {
3451
+ type: type$7,
3452
+ keyed: false,
3453
+ label: 'Image view',
3454
+ group: 'presentation',
3455
+ create: (options = {}) => ({
3456
+ ...options
3457
+ })
3458
+ };
3310
3459
 
3311
3460
  function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
3312
3461
  var AngelDownIcon = (({
@@ -3349,6 +3498,7 @@ function Numberfield(props) {
3349
3498
  errors = [],
3350
3499
  field,
3351
3500
  value,
3501
+ readonly,
3352
3502
  onChange
3353
3503
  } = props;
3354
3504
  const {
@@ -3373,10 +3523,10 @@ function Numberfield(props) {
3373
3523
 
3374
3524
  // checks whether the value currently in the form data is practically different from the one in the input field cache
3375
3525
  // this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
3376
- const cacheValueMatchesState = hooks.useMemo(() => Numberfield.sanitizeValue({
3526
+ const cacheValueMatchesState = hooks.useMemo(() => Numberfield.config.sanitizeValue({
3377
3527
  value,
3378
3528
  formField: field
3379
- }) === Numberfield.sanitizeValue({
3529
+ }) === Numberfield.config.sanitizeValue({
3380
3530
  value: stringValueCache,
3381
3531
  formField: field
3382
3532
  }), [stringValueCache, value, field]);
@@ -3421,6 +3571,9 @@ function Numberfield(props) {
3421
3571
  });
3422
3572
  }, [field, onChange, serializeToString]);
3423
3573
  const increment = () => {
3574
+ if (readonly) {
3575
+ return;
3576
+ }
3424
3577
  const base = isValidNumber(value) ? Big(value) : Big(0);
3425
3578
  const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
3426
3579
 
@@ -3428,6 +3581,9 @@ function Numberfield(props) {
3428
3581
  setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
3429
3582
  };
3430
3583
  const decrement = () => {
3584
+ if (readonly) {
3585
+ return;
3586
+ }
3431
3587
  const base = isValidNumber(value) ? Big(value) : Big(0);
3432
3588
  const offset = base.mod(arrowIncrementValue);
3433
3589
  if (offset.cmp(0) === 0) {
@@ -3470,10 +3626,12 @@ function Numberfield(props) {
3470
3626
  const {
3471
3627
  formId
3472
3628
  } = hooks.useContext(FormContext$1);
3629
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3473
3630
  return jsxRuntime.jsxs("div", {
3474
3631
  class: formFieldClasses(type$6, {
3475
3632
  errors,
3476
- disabled
3633
+ disabled,
3634
+ readonly
3477
3635
  }),
3478
3636
  children: [jsxRuntime.jsx(Label, {
3479
3637
  id: prefixId(id, formId),
@@ -3481,11 +3639,13 @@ function Numberfield(props) {
3481
3639
  required: required
3482
3640
  }), jsxRuntime.jsx(InputAdorner, {
3483
3641
  disabled: disabled,
3642
+ readonly: readonly,
3484
3643
  pre: prefixAdorner,
3485
3644
  post: suffixAdorner,
3486
3645
  children: jsxRuntime.jsxs("div", {
3487
3646
  class: classNames('fjs-vertical-group', {
3488
- 'fjs-disabled': disabled
3647
+ 'fjs-disabled': disabled,
3648
+ 'fjs-readonly': readonly
3489
3649
  }, {
3490
3650
  'hasErrors': errors.length
3491
3651
  }),
@@ -3493,6 +3653,7 @@ function Numberfield(props) {
3493
3653
  ref: inputRef,
3494
3654
  class: "fjs-input",
3495
3655
  disabled: disabled,
3656
+ readOnly: readonly,
3496
3657
  id: prefixId(id, formId),
3497
3658
  onKeyDown: onKeyDown,
3498
3659
  onKeyPress: onKeyPress
@@ -3503,10 +3664,12 @@ function Numberfield(props) {
3503
3664
  type: "text",
3504
3665
  autoComplete: "off",
3505
3666
  step: arrowIncrementValue,
3506
- value: displayValue
3667
+ value: displayValue,
3668
+ "aria-describedby": errorMessageId
3507
3669
  }), jsxRuntime.jsxs("div", {
3508
3670
  class: classNames('fjs-number-arrow-container', {
3509
- 'fjs-disabled': disabled
3671
+ 'fjs-disabled': disabled,
3672
+ 'fjs-readonly': readonly
3510
3673
  }),
3511
3674
  children: [jsxRuntime.jsx("button", {
3512
3675
  class: "fjs-number-arrow-up",
@@ -3530,31 +3693,34 @@ function Numberfield(props) {
3530
3693
  }), jsxRuntime.jsx(Description, {
3531
3694
  description: description
3532
3695
  }), jsxRuntime.jsx(Errors, {
3533
- errors: errors
3696
+ errors: errors,
3697
+ id: errorMessageId
3534
3698
  })]
3535
3699
  });
3536
3700
  }
3537
- Numberfield.create = (options = {}) => ({
3538
- ...options
3539
- });
3540
- Numberfield.sanitizeValue = ({
3541
- value,
3542
- formField
3543
- }) => {
3544
- // null state is allowed
3545
- if (isNullEquivalentValue(value)) return null;
3546
-
3547
- // if data cannot be parsed as a valid number, go into invalid NaN state
3548
- if (!isValidNumber(value)) return 'NaN';
3549
-
3550
- // otherwise parse to formatting type
3551
- return formField.serializeToString ? value.toString() : Number(value);
3701
+ Numberfield.config = {
3702
+ type: type$6,
3703
+ keyed: true,
3704
+ label: 'Number',
3705
+ group: 'basic-input',
3706
+ emptyValue: null,
3707
+ sanitizeValue: ({
3708
+ value,
3709
+ formField
3710
+ }) => {
3711
+ // null state is allowed
3712
+ if (isNullEquivalentValue(value)) return null;
3713
+
3714
+ // if data cannot be parsed as a valid number, go into invalid NaN state
3715
+ if (!isValidNumber(value)) return 'NaN';
3716
+
3717
+ // otherwise parse to formatting type
3718
+ return formField.serializeToString ? value.toString() : Number(value);
3719
+ },
3720
+ create: (options = {}) => ({
3721
+ ...options
3722
+ })
3552
3723
  };
3553
- Numberfield.type = type$6;
3554
- Numberfield.keyed = true;
3555
- Numberfield.label = 'Number';
3556
- Numberfield.emptyValue = null;
3557
- Numberfield.group = 'basic-input';
3558
3724
 
3559
3725
  const type$5 = 'radio';
3560
3726
  function Radio(props) {
@@ -3562,6 +3728,7 @@ function Radio(props) {
3562
3728
  disabled,
3563
3729
  errors = [],
3564
3730
  field,
3731
+ readonly,
3565
3732
  value
3566
3733
  } = props;
3567
3734
  const {
@@ -3586,10 +3753,12 @@ function Radio(props) {
3586
3753
  const {
3587
3754
  formId
3588
3755
  } = hooks.useContext(FormContext$1);
3756
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3589
3757
  return jsxRuntime.jsxs("div", {
3590
3758
  class: formFieldClasses(type$5, {
3591
3759
  errors,
3592
- disabled
3760
+ disabled,
3761
+ readonly
3593
3762
  }),
3594
3763
  children: [jsxRuntime.jsx(Label, {
3595
3764
  label: label,
@@ -3606,39 +3775,44 @@ function Radio(props) {
3606
3775
  checked: option.value === value,
3607
3776
  class: "fjs-input",
3608
3777
  disabled: disabled,
3778
+ readOnly: readonly,
3609
3779
  id: prefixId(`${id}-${index}`, formId),
3610
3780
  type: "radio",
3611
- onClick: () => onChange(option.value)
3781
+ onClick: () => onChange(option.value),
3782
+ "aria-describedby": errorMessageId
3612
3783
  })
3613
3784
  }, `${id}-${index}`);
3614
3785
  }), jsxRuntime.jsx(Description, {
3615
3786
  description: description
3616
3787
  }), jsxRuntime.jsx(Errors, {
3617
- errors: errors
3788
+ errors: errors,
3789
+ id: errorMessageId
3618
3790
  })]
3619
3791
  });
3620
3792
  }
3621
- Radio.create = function (options = {}) {
3622
- const defaults = {};
3623
-
3624
- // provide default values if valuesKey isn't set
3625
- if (!options.valuesKey) {
3626
- defaults.values = [{
3627
- label: 'Value',
3628
- value: 'value'
3629
- }];
3793
+ Radio.config = {
3794
+ type: type$5,
3795
+ keyed: true,
3796
+ label: 'Radio',
3797
+ group: 'selection',
3798
+ emptyValue: null,
3799
+ sanitizeValue: sanitizeSingleSelectValue,
3800
+ create: (options = {}) => {
3801
+ const defaults = {};
3802
+
3803
+ // provide default values if valuesKey isn't set
3804
+ if (!options.valuesKey) {
3805
+ defaults.values = [{
3806
+ label: 'Value',
3807
+ value: 'value'
3808
+ }];
3809
+ }
3810
+ return {
3811
+ ...defaults,
3812
+ ...options
3813
+ };
3630
3814
  }
3631
- return {
3632
- ...defaults,
3633
- ...options
3634
- };
3635
3815
  };
3636
- Radio.type = type$5;
3637
- Radio.label = 'Radio';
3638
- Radio.keyed = true;
3639
- Radio.emptyValue = null;
3640
- Radio.sanitizeValue = sanitizeSingleSelectValue;
3641
- Radio.group = 'selection';
3642
3816
 
3643
3817
  function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
3644
3818
  var XMarkIcon = (({
@@ -3663,6 +3837,7 @@ function SearchableSelect(props) {
3663
3837
  disabled,
3664
3838
  errors,
3665
3839
  field,
3840
+ readonly,
3666
3841
  value
3667
3842
  } = props;
3668
3843
  const {
@@ -3735,11 +3910,11 @@ function SearchableSelect(props) {
3735
3910
  }, [isDropdownExpanded, isEscapeClosed]);
3736
3911
  const displayState = hooks.useMemo(() => {
3737
3912
  const ds = {};
3738
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
3913
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
3739
3914
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3740
- ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
3915
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
3741
3916
  return ds;
3742
- }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
3917
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
3743
3918
  const onAngelMouseDown = hooks.useCallback(e => {
3744
3919
  setIsEscapeClose(false);
3745
3920
  setIsDropdownExpanded(!isDropdownExpanded);
@@ -3751,12 +3926,14 @@ function SearchableSelect(props) {
3751
3926
  children: [jsxRuntime.jsxs("div", {
3752
3927
  id: prefixId(`${id}`, formId),
3753
3928
  class: classNames('fjs-input-group', {
3754
- 'disabled': disabled
3929
+ 'disabled': disabled,
3930
+ 'readonly': readonly
3755
3931
  }, {
3756
3932
  'hasErrors': errors.length
3757
3933
  }),
3758
3934
  children: [jsxRuntime.jsx("input", {
3759
3935
  disabled: disabled,
3936
+ readOnly: readonly,
3760
3937
  class: "fjs-input",
3761
3938
  ref: searchbarRef,
3762
3939
  id: prefixId(`${id}-search`, formId),
@@ -3778,7 +3955,8 @@ function SearchableSelect(props) {
3778
3955
  onBlur: () => {
3779
3956
  setIsDropdownExpanded(false);
3780
3957
  setFilter(valueLabel);
3781
- }
3958
+ },
3959
+ "aria-describedby": props['aria-describedby']
3782
3960
  }), displayState.displayCross && jsxRuntime.jsxs("span", {
3783
3961
  class: "fjs-select-cross",
3784
3962
  onMouseDown: e => {
@@ -3812,6 +3990,7 @@ function SimpleSelect(props) {
3812
3990
  disabled,
3813
3991
  errors,
3814
3992
  field,
3993
+ readonly,
3815
3994
  value
3816
3995
  } = props;
3817
3996
  const {
@@ -3837,9 +4016,9 @@ function SimpleSelect(props) {
3837
4016
  }, [field, props]);
3838
4017
  const displayState = hooks.useMemo(() => {
3839
4018
  const ds = {};
3840
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
4019
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
3841
4020
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3842
- ds.displayDropdown = !disabled && isDropdownExpanded;
4021
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded;
3843
4022
  return ds;
3844
4023
  }, [disabled, isDropdownExpanded, loadState, value]);
3845
4024
  const onMouseDown = hooks.useCallback(e => {
@@ -3858,20 +4037,27 @@ function SimpleSelect(props) {
3858
4037
  ref: selectRef,
3859
4038
  id: prefixId(`${id}`, formId),
3860
4039
  class: classNames('fjs-input-group', {
3861
- 'disabled': disabled
4040
+ disabled,
4041
+ readonly
3862
4042
  }, {
3863
4043
  'hasErrors': errors.length
3864
4044
  }),
3865
4045
  onFocus: () => setIsDropdownExpanded(true),
3866
4046
  onBlur: () => setIsDropdownExpanded(false),
3867
- onMouseDown: e => onMouseDown(e),
3868
- tabIndex: disabled ? undefined : 0,
4047
+ onMouseDown: onMouseDown,
3869
4048
  children: [jsxRuntime.jsx("div", {
3870
4049
  class: classNames('fjs-select-display', {
3871
4050
  'fjs-select-placeholder': !value
3872
4051
  }),
3873
4052
  id: prefixId(`${id}-display`, formId),
3874
4053
  children: valueLabel || 'Select'
4054
+ }), !disabled && jsxRuntime.jsx("input", {
4055
+ id: prefixId(`${id}-search`, formId),
4056
+ class: "fjs-select-hidden-input",
4057
+ value: valueLabel,
4058
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
4059
+ onBlur: () => !readonly && setIsDropdownExpanded(false),
4060
+ "aria-describedby": props['aria-describedby']
3875
4061
  }), displayState.displayCross && jsxRuntime.jsx("span", {
3876
4062
  class: "fjs-select-cross",
3877
4063
  onMouseDown: e => {
@@ -3906,6 +4092,7 @@ function Select(props) {
3906
4092
  errors = [],
3907
4093
  field,
3908
4094
  onChange,
4095
+ readonly,
3909
4096
  value
3910
4097
  } = props;
3911
4098
  const {
@@ -3921,18 +4108,22 @@ function Select(props) {
3921
4108
  const {
3922
4109
  formId
3923
4110
  } = hooks.useContext(FormContext$1);
4111
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3924
4112
  const selectProps = hooks.useMemo(() => ({
3925
4113
  id,
3926
4114
  disabled,
3927
4115
  errors,
3928
4116
  field,
3929
4117
  value,
3930
- onChange
3931
- }), [disabled, errors, field, id, value, onChange]);
4118
+ onChange,
4119
+ readonly,
4120
+ 'aria-describedby': errorMessageId
4121
+ }), [disabled, errors, field, id, value, onChange, readonly, errorMessageId]);
3932
4122
  return jsxRuntime.jsxs("div", {
3933
4123
  class: formFieldClasses(type$4, {
3934
4124
  errors,
3935
- disabled
4125
+ disabled,
4126
+ readonly
3936
4127
  }),
3937
4128
  onKeyDown: event => {
3938
4129
  if (event.key === 'Enter') {
@@ -3941,7 +4132,7 @@ function Select(props) {
3941
4132
  }
3942
4133
  },
3943
4134
  children: [jsxRuntime.jsx(Label, {
3944
- id: prefixId(id, formId),
4135
+ id: prefixId(`${id}-search`, formId),
3945
4136
  label: label,
3946
4137
  required: required
3947
4138
  }), searchable ? jsxRuntime.jsx(SearchableSelect, {
@@ -3951,31 +4142,34 @@ function Select(props) {
3951
4142
  }), jsxRuntime.jsx(Description, {
3952
4143
  description: description
3953
4144
  }), jsxRuntime.jsx(Errors, {
3954
- errors: errors
4145
+ errors: errors,
4146
+ id: errorMessageId
3955
4147
  })]
3956
4148
  });
3957
4149
  }
3958
- Select.create = (options = {}) => {
3959
- const defaults = {};
3960
-
3961
- // provide default values if valuesKey isn't set
3962
- if (!options.valuesKey) {
3963
- defaults.values = [{
3964
- label: 'Value',
3965
- value: 'value'
3966
- }];
4150
+ Select.config = {
4151
+ type: type$4,
4152
+ keyed: true,
4153
+ label: 'Select',
4154
+ group: 'selection',
4155
+ emptyValue: null,
4156
+ sanitizeValue: sanitizeSingleSelectValue,
4157
+ create: (options = {}) => {
4158
+ const defaults = {};
4159
+
4160
+ // provide default values if valuesKey isn't set
4161
+ if (!options.valuesKey) {
4162
+ defaults.values = [{
4163
+ label: 'Value',
4164
+ value: 'value'
4165
+ }];
4166
+ }
4167
+ return {
4168
+ ...defaults,
4169
+ ...options
4170
+ };
3967
4171
  }
3968
- return {
3969
- ...defaults,
3970
- ...options
3971
- };
3972
4172
  };
3973
- Select.type = type$4;
3974
- Select.label = 'Select';
3975
- Select.keyed = true;
3976
- Select.emptyValue = null;
3977
- Select.sanitizeValue = sanitizeSingleSelectValue;
3978
- Select.group = 'selection';
3979
4173
 
3980
4174
  const type$3 = 'taglist';
3981
4175
  function Taglist(props) {
@@ -3983,6 +4177,7 @@ function Taglist(props) {
3983
4177
  disabled,
3984
4178
  errors = [],
3985
4179
  field,
4180
+ readonly,
3986
4181
  value: values = []
3987
4182
  } = props;
3988
4183
  const {
@@ -3997,6 +4192,7 @@ function Taglist(props) {
3997
4192
  const {
3998
4193
  formId
3999
4194
  } = hooks.useContext(FormContext$1);
4195
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4000
4196
  const [filter, setFilter] = hooks.useState('');
4001
4197
  const [filteredOptions, setFilteredOptions] = hooks.useState([]);
4002
4198
  const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
@@ -4072,6 +4268,10 @@ function Taglist(props) {
4072
4268
  break;
4073
4269
  }
4074
4270
  };
4271
+ const onBlur = () => {
4272
+ setIsDropdownExpanded(false);
4273
+ setFilter('');
4274
+ };
4075
4275
  const onTagRemoveClick = (event, value) => {
4076
4276
  const {
4077
4277
  target
@@ -4088,7 +4288,8 @@ function Taglist(props) {
4088
4288
  return jsxRuntime.jsxs("div", {
4089
4289
  class: formFieldClasses(type$3, {
4090
4290
  errors,
4091
- disabled
4291
+ disabled,
4292
+ readonly
4092
4293
  }),
4093
4294
  onKeyDown: event => {
4094
4295
  if (event.key === 'Enter') {
@@ -4102,20 +4303,22 @@ function Taglist(props) {
4102
4303
  id: prefixId(`${id}-search`, formId)
4103
4304
  }), jsxRuntime.jsxs("div", {
4104
4305
  class: classNames('fjs-taglist', {
4105
- 'fjs-disabled': disabled
4306
+ 'fjs-disabled': disabled,
4307
+ 'fjs-readonly': readonly
4106
4308
  }),
4107
4309
  children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
4108
4310
  class: "fjs-taglist-tags",
4109
4311
  children: values.map(v => {
4110
4312
  return jsxRuntime.jsxs("div", {
4111
4313
  class: classNames('fjs-taglist-tag', {
4112
- 'fjs-disabled': disabled
4314
+ 'fjs-disabled': disabled,
4315
+ 'fjs-readonly': readonly
4113
4316
  }),
4114
4317
  onMouseDown: e => e.preventDefault(),
4115
4318
  children: [jsxRuntime.jsx("span", {
4116
4319
  class: "fjs-taglist-tag-label",
4117
4320
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
4118
- }), !disabled && jsxRuntime.jsx("button", {
4321
+ }), !disabled && !readonly && jsxRuntime.jsx("button", {
4119
4322
  type: "button",
4120
4323
  title: "Remove tag",
4121
4324
  class: "fjs-taglist-tag-remove",
@@ -4126,21 +4329,22 @@ function Taglist(props) {
4126
4329
  })
4127
4330
  }), jsxRuntime.jsx("input", {
4128
4331
  disabled: disabled,
4332
+ readOnly: readonly,
4129
4333
  class: "fjs-taglist-input",
4130
4334
  ref: searchbarRef,
4131
4335
  id: prefixId(`${id}-search`, formId),
4132
4336
  onChange: onFilterChange,
4133
4337
  type: "text",
4134
4338
  value: filter,
4135
- placeholder: disabled ? '' : 'Search',
4339
+ placeholder: disabled || readonly ? undefined : 'Search',
4136
4340
  autoComplete: "off",
4137
- onKeyDown: e => onInputKeyDown(e),
4341
+ onKeyDown: onInputKeyDown,
4138
4342
  onMouseDown: () => setIsEscapeClose(false),
4139
- onFocus: () => setIsDropdownExpanded(true),
4343
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
4140
4344
  onBlur: () => {
4141
- setIsDropdownExpanded(false);
4142
- setFilter('');
4143
- }
4345
+ !readonly && onBlur();
4346
+ },
4347
+ "aria-describedby": errorMessageId
4144
4348
  })]
4145
4349
  }), jsxRuntime.jsx("div", {
4146
4350
  class: "fjs-taglist-anchor",
@@ -4154,34 +4358,41 @@ function Taglist(props) {
4154
4358
  }), jsxRuntime.jsx(Description, {
4155
4359
  description: description
4156
4360
  }), jsxRuntime.jsx(Errors, {
4157
- errors: errors
4361
+ errors: errors,
4362
+ id: errorMessageId
4158
4363
  })]
4159
4364
  });
4160
4365
  }
4161
- Taglist.create = (options = {}) => {
4162
- const defaults = {};
4163
-
4164
- // provide default values if valuesKey isn't set
4165
- if (!options.valuesKey) {
4166
- defaults.values = [{
4167
- label: 'Value',
4168
- value: 'value'
4169
- }];
4366
+ Taglist.config = {
4367
+ type: type$3,
4368
+ keyed: true,
4369
+ label: 'Tag list',
4370
+ group: 'selection',
4371
+ emptyValue: [],
4372
+ sanitizeValue: sanitizeMultiSelectValue,
4373
+ create: (options = {}) => {
4374
+ const defaults = {};
4375
+
4376
+ // provide default values if valuesKey isn't set
4377
+ if (!options.valuesKey) {
4378
+ defaults.values = [{
4379
+ label: 'Value',
4380
+ value: 'value'
4381
+ }];
4382
+ }
4383
+ return {
4384
+ ...defaults,
4385
+ ...options
4386
+ };
4170
4387
  }
4171
- return {
4172
- ...defaults,
4173
- ...options
4174
- };
4175
4388
  };
4176
- Taglist.type = type$3;
4177
- Taglist.label = 'Tag list';
4178
- Taglist.keyed = true;
4179
- Taglist.emptyValue = [];
4180
- Taglist.sanitizeValue = sanitizeMultiSelectValue;
4181
- Taglist.group = 'selection';
4182
4389
 
4183
4390
  const type$2 = 'text';
4184
4391
  function Text(props) {
4392
+ const form = useService('form');
4393
+ const {
4394
+ textLinkTarget
4395
+ } = form._getState().properties;
4185
4396
  const {
4186
4397
  field,
4187
4398
  disableLinks
@@ -4203,9 +4414,20 @@ function Text(props) {
4203
4414
  const html = markdownRenderer.render(markdown);
4204
4415
  return sanitizeHTML(html);
4205
4416
  }, [markdownRenderer, markdown]);
4206
- const componentOverrides = hooks.useMemo(() => disableLinks ? {
4207
- 'a': DisabledLink
4208
- } : {}, [disableLinks]);
4417
+ const OverridenTargetLink = hooks.useMemo(() => BuildOverridenTargetLink(textLinkTarget), [textLinkTarget]);
4418
+ const componentOverrides = hooks.useMemo(() => {
4419
+ if (disableLinks) {
4420
+ return {
4421
+ 'a': DisabledLink
4422
+ };
4423
+ }
4424
+ if (textLinkTarget) {
4425
+ return {
4426
+ 'a': OverridenTargetLink
4427
+ };
4428
+ }
4429
+ return {};
4430
+ }, [disableLinks, OverridenTargetLink, textLinkTarget]);
4209
4431
  return jsxRuntime.jsx("div", {
4210
4432
  class: formFieldClasses(type$2),
4211
4433
  children: jsxRuntime.jsx(Markup, {
@@ -4215,21 +4437,35 @@ function Text(props) {
4215
4437
  })
4216
4438
  });
4217
4439
  }
4218
- Text.create = (options = {}) => ({
4219
- text: '# Text',
4220
- ...options
4221
- });
4222
- Text.type = type$2;
4223
- Text.keyed = false;
4224
- Text.group = 'presentation';
4225
- Text.label = 'Text view';
4440
+ Text.config = {
4441
+ type: type$2,
4442
+ keyed: false,
4443
+ label: 'Text view',
4444
+ group: 'presentation',
4445
+ create: (options = {}) => ({
4446
+ text: '# Text',
4447
+ ...options
4448
+ })
4449
+ };
4450
+ function BuildOverridenTargetLink(target) {
4451
+ return function ({
4452
+ children,
4453
+ ...rest
4454
+ }) {
4455
+ return jsxRuntime.jsx("a", {
4456
+ ...rest,
4457
+ target: target,
4458
+ children: children
4459
+ });
4460
+ };
4461
+ }
4226
4462
  function DisabledLink({
4227
- href,
4228
- children
4463
+ children,
4464
+ ...rest
4229
4465
  }) {
4230
4466
  return jsxRuntime.jsx("a", {
4467
+ ...rest,
4231
4468
  class: "fjs-disabled-link",
4232
- href: href,
4233
4469
  tabIndex: -1,
4234
4470
  children: children
4235
4471
  });
@@ -4241,6 +4477,7 @@ function Textfield(props) {
4241
4477
  disabled,
4242
4478
  errors = [],
4243
4479
  field,
4480
+ readonly,
4244
4481
  value = ''
4245
4482
  } = props;
4246
4483
  const {
@@ -4268,10 +4505,12 @@ function Textfield(props) {
4268
4505
  const {
4269
4506
  formId
4270
4507
  } = hooks.useContext(FormContext$1);
4508
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4271
4509
  return jsxRuntime.jsxs("div", {
4272
4510
  class: formFieldClasses(type$1, {
4273
4511
  errors,
4274
- disabled
4512
+ disabled,
4513
+ readonly
4275
4514
  }),
4276
4515
  children: [jsxRuntime.jsx(Label, {
4277
4516
  id: prefixId(id, formId),
@@ -4279,34 +4518,50 @@ function Textfield(props) {
4279
4518
  required: required
4280
4519
  }), jsxRuntime.jsx(InputAdorner, {
4281
4520
  disabled: disabled,
4521
+ readonly: readonly,
4282
4522
  pre: prefixAdorner,
4283
4523
  post: suffixAdorner,
4284
4524
  children: jsxRuntime.jsx("input", {
4285
4525
  class: "fjs-input",
4286
4526
  disabled: disabled,
4527
+ readOnly: readonly,
4287
4528
  id: prefixId(id, formId),
4288
4529
  onInput: onChange,
4289
4530
  type: "text",
4290
- value: value
4531
+ value: value,
4532
+ "aria-describedby": errorMessageId
4291
4533
  })
4292
4534
  }), jsxRuntime.jsx(Description, {
4293
4535
  description: description
4294
4536
  }), jsxRuntime.jsx(Errors, {
4295
- errors: errors
4537
+ errors: errors,
4538
+ id: errorMessageId
4296
4539
  })]
4297
4540
  });
4298
4541
  }
4299
- Textfield.create = (options = {}) => ({
4300
- ...options
4301
- });
4302
- Textfield.type = type$1;
4303
- Textfield.label = 'Text field';
4304
- Textfield.keyed = true;
4305
- Textfield.emptyValue = '';
4306
- Textfield.sanitizeValue = ({
4307
- value
4308
- }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
4309
- Textfield.group = 'basic-input';
4542
+ Textfield.config = {
4543
+ type: type$1,
4544
+ keyed: true,
4545
+ label: 'Text field',
4546
+ group: 'basic-input',
4547
+ emptyValue: '',
4548
+ sanitizeValue: ({
4549
+ value
4550
+ }) => {
4551
+ if (minDash.isArray(value) || minDash.isObject(value)) {
4552
+ return '';
4553
+ }
4554
+
4555
+ // sanitize newlines to spaces
4556
+ if (typeof value === 'string') {
4557
+ return value.replace(/[\r\n\t]/g, ' ');
4558
+ }
4559
+ return String(value);
4560
+ },
4561
+ create: (options = {}) => ({
4562
+ ...options
4563
+ })
4564
+ };
4310
4565
 
4311
4566
  const type = 'textarea';
4312
4567
  function Textarea(props) {
@@ -4314,6 +4569,7 @@ function Textarea(props) {
4314
4569
  disabled,
4315
4570
  errors = [],
4316
4571
  field,
4572
+ readonly,
4317
4573
  value = ''
4318
4574
  } = props;
4319
4575
  const {
@@ -4353,10 +4609,12 @@ function Textarea(props) {
4353
4609
  const {
4354
4610
  formId
4355
4611
  } = hooks.useContext(FormContext$1);
4612
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4356
4613
  return jsxRuntime.jsxs("div", {
4357
4614
  class: formFieldClasses(type, {
4358
4615
  errors,
4359
- disabled
4616
+ disabled,
4617
+ readonly
4360
4618
  }),
4361
4619
  children: [jsxRuntime.jsx(Label, {
4362
4620
  id: prefixId(id, formId),
@@ -4365,28 +4623,33 @@ function Textarea(props) {
4365
4623
  }), jsxRuntime.jsx("textarea", {
4366
4624
  class: "fjs-textarea",
4367
4625
  disabled: disabled,
4626
+ readonly: readonly,
4368
4627
  id: prefixId(id, formId),
4369
4628
  onInput: onInput,
4370
4629
  value: value,
4371
- ref: textareaRef
4630
+ ref: textareaRef,
4631
+ "aria-describedby": errorMessageId
4372
4632
  }), jsxRuntime.jsx(Description, {
4373
4633
  description: description
4374
4634
  }), jsxRuntime.jsx(Errors, {
4375
- errors: errors
4635
+ errors: errors,
4636
+ id: errorMessageId
4376
4637
  })]
4377
4638
  });
4378
4639
  }
4379
- Textarea.create = (options = {}) => ({
4380
- ...options
4381
- });
4382
- Textarea.type = type;
4383
- Textarea.label = 'Text area';
4384
- Textarea.keyed = true;
4385
- Textarea.emptyValue = '';
4386
- Textarea.sanitizeValue = ({
4387
- value
4388
- }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
4389
- Textarea.group = 'basic-input';
4640
+ Textarea.config = {
4641
+ type,
4642
+ keyed: true,
4643
+ label: 'Text area',
4644
+ group: 'basic-input',
4645
+ emptyValue: '',
4646
+ sanitizeValue: ({
4647
+ value
4648
+ }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value),
4649
+ create: (options = {}) => ({
4650
+ ...options
4651
+ })
4652
+ };
4390
4653
 
4391
4654
  function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
4392
4655
  var ButtonIcon = (({
@@ -4395,10 +4658,11 @@ var ButtonIcon = (({
4395
4658
  }) => /*#__PURE__*/React.createElement("svg", _extends$d({
4396
4659
  xmlns: "http://www.w3.org/2000/svg",
4397
4660
  width: "54",
4398
- height: "54"
4661
+ height: "54",
4662
+ fill: "currentcolor"
4399
4663
  }, props), /*#__PURE__*/React.createElement("path", {
4400
4664
  fillRule: "evenodd",
4401
- d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
4665
+ d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18v-2.222z"
4402
4666
  })));
4403
4667
 
4404
4668
  function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
@@ -4408,7 +4672,8 @@ var CheckboxIcon = (({
4408
4672
  }) => /*#__PURE__*/React.createElement("svg", _extends$c({
4409
4673
  xmlns: "http://www.w3.org/2000/svg",
4410
4674
  width: "54",
4411
- height: "54"
4675
+ height: "54",
4676
+ fill: "currentcolor"
4412
4677
  }, props), /*#__PURE__*/React.createElement("path", {
4413
4678
  d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
4414
4679
  })));
@@ -4419,18 +4684,35 @@ var ChecklistIcon = (({
4419
4684
  ...props
4420
4685
  }) => /*#__PURE__*/React.createElement("svg", _extends$b({
4421
4686
  xmlns: "http://www.w3.org/2000/svg",
4687
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4422
4688
  width: "54",
4423
4689
  height: "54",
4424
- fill: "none"
4425
- }, props), /*#__PURE__*/React.createElement("path", {
4426
- fillRule: "evenodd",
4427
- clipRule: "evenodd",
4428
- d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
4429
- fill: "#161616"
4690
+ fill: "currentcolor"
4691
+ }, props), /*#__PURE__*/React.createElement("g", {
4692
+ fillRule: "evenodd"
4693
+ }, /*#__PURE__*/React.createElement("use", {
4694
+ xlinkHref: "#a"
4695
+ }), /*#__PURE__*/React.createElement("use", {
4696
+ xlinkHref: "#a",
4697
+ y: "24"
4698
+ }), /*#__PURE__*/React.createElement("use", {
4699
+ xlinkHref: "#a",
4700
+ y: "12"
4701
+ })), /*#__PURE__*/React.createElement("use", {
4702
+ xlinkHref: "#b"
4703
+ }), /*#__PURE__*/React.createElement("use", {
4704
+ xlinkHref: "#b",
4705
+ y: "12"
4706
+ }), /*#__PURE__*/React.createElement("use", {
4707
+ xlinkHref: "#b",
4708
+ y: "24"
4709
+ }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
4710
+ id: "a",
4711
+ d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z"
4430
4712
  }), /*#__PURE__*/React.createElement("path", {
4431
- d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
4432
- fill: "#161616"
4433
- })));
4713
+ id: "b",
4714
+ d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z"
4715
+ }))));
4434
4716
 
4435
4717
  function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
4436
4718
  var DatetimeIcon = (({
@@ -4440,20 +4722,15 @@ var DatetimeIcon = (({
4440
4722
  xmlns: "http://www.w3.org/2000/svg",
4441
4723
  width: "54",
4442
4724
  height: "54",
4443
- fill: "none"
4725
+ fill: "currentcolor"
4444
4726
  }, props), /*#__PURE__*/React.createElement("path", {
4445
- fill: "#000",
4446
4727
  fillRule: "evenodd",
4447
- d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36c-1.132 0-2.06.928-2.06 2.06v23.549c0 1.132.928 2.06 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592c.39 0 .707.317.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z",
4448
- clipRule: "evenodd"
4728
+ d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36a2.07 2.07 0 00-2.06 2.06v23.549a2.07 2.07 0 002.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592a.71.71 0 01.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z"
4449
4729
  }), /*#__PURE__*/React.createElement("path", {
4450
- fill: "#000",
4451
4730
  d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
4452
4731
  }), /*#__PURE__*/React.createElement("path", {
4453
- fill: "#000",
4454
4732
  fillRule: "evenodd",
4455
- d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z",
4456
- clipRule: "evenodd"
4733
+ d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z"
4457
4734
  })));
4458
4735
 
4459
4736
  function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
@@ -4461,18 +4738,15 @@ var TaglistIcon = (({
4461
4738
  styles = {},
4462
4739
  ...props
4463
4740
  }) => /*#__PURE__*/React.createElement("svg", _extends$9({
4741
+ xmlns: "http://www.w3.org/2000/svg",
4464
4742
  width: "54",
4465
4743
  height: "54",
4466
- fill: "none",
4467
- xmlns: "http://www.w3.org/2000/svg"
4744
+ fill: "currentcolor"
4468
4745
  }, props), /*#__PURE__*/React.createElement("path", {
4469
4746
  fillRule: "evenodd",
4470
- clipRule: "evenodd",
4471
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
4472
- fill: "#000"
4747
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z"
4473
4748
  }), /*#__PURE__*/React.createElement("path", {
4474
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
4475
- fill: "#505562"
4749
+ d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z"
4476
4750
  })));
4477
4751
 
4478
4752
  function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
@@ -4484,22 +4758,22 @@ var FormIcon = (({
4484
4758
  width: "54",
4485
4759
  height: "54"
4486
4760
  }, props), /*#__PURE__*/React.createElement("rect", {
4487
- x: "15",
4488
- y: "17",
4489
4761
  width: "24",
4490
4762
  height: "4",
4763
+ x: "15",
4764
+ y: "17",
4491
4765
  rx: "1"
4492
4766
  }), /*#__PURE__*/React.createElement("rect", {
4493
- x: "15",
4494
- y: "25",
4495
4767
  width: "24",
4496
4768
  height: "4",
4769
+ x: "15",
4770
+ y: "25",
4497
4771
  rx: "1"
4498
4772
  }), /*#__PURE__*/React.createElement("rect", {
4499
- x: "15",
4500
- y: "33",
4501
4773
  width: "13",
4502
4774
  height: "4",
4775
+ x: "15",
4776
+ y: "33",
4503
4777
  rx: "1"
4504
4778
  })));
4505
4779
 
@@ -4523,7 +4797,8 @@ var NumberIcon = (({
4523
4797
  }) => /*#__PURE__*/React.createElement("svg", _extends$6({
4524
4798
  xmlns: "http://www.w3.org/2000/svg",
4525
4799
  width: "54",
4526
- height: "54"
4800
+ height: "54",
4801
+ fill: "currentcolor"
4527
4802
  }, props), /*#__PURE__*/React.createElement("path", {
4528
4803
  fillRule: "evenodd",
4529
4804
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
@@ -4536,9 +4811,10 @@ var RadioIcon = (({
4536
4811
  }) => /*#__PURE__*/React.createElement("svg", _extends$5({
4537
4812
  xmlns: "http://www.w3.org/2000/svg",
4538
4813
  width: "54",
4539
- height: "54"
4814
+ height: "54",
4815
+ fill: "currentcolor"
4540
4816
  }, props), /*#__PURE__*/React.createElement("path", {
4541
- d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
4817
+ d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18a8 8 0 110-16 8 8 0 110 16z"
4542
4818
  })));
4543
4819
 
4544
4820
  function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
@@ -4548,7 +4824,8 @@ var SelectIcon = (({
4548
4824
  }) => /*#__PURE__*/React.createElement("svg", _extends$4({
4549
4825
  xmlns: "http://www.w3.org/2000/svg",
4550
4826
  width: "54",
4551
- height: "54"
4827
+ height: "54",
4828
+ fill: "currentcolor"
4552
4829
  }, props), /*#__PURE__*/React.createElement("path", {
4553
4830
  fillRule: "evenodd",
4554
4831
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
@@ -4561,9 +4838,10 @@ var TextIcon = (({
4561
4838
  }) => /*#__PURE__*/React.createElement("svg", _extends$3({
4562
4839
  xmlns: "http://www.w3.org/2000/svg",
4563
4840
  width: "54",
4564
- height: "54"
4841
+ height: "54",
4842
+ fill: "currentcolor"
4565
4843
  }, props), /*#__PURE__*/React.createElement("path", {
4566
- d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
4844
+ d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zm19.62.92l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
4567
4845
  })));
4568
4846
 
4569
4847
  function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
@@ -4573,7 +4851,8 @@ var TextfieldIcon = (({
4573
4851
  }) => /*#__PURE__*/React.createElement("svg", _extends$2({
4574
4852
  xmlns: "http://www.w3.org/2000/svg",
4575
4853
  width: "54",
4576
- height: "54"
4854
+ height: "54",
4855
+ fill: "currentcolor"
4577
4856
  }, props), /*#__PURE__*/React.createElement("path", {
4578
4857
  fillRule: "evenodd",
4579
4858
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
@@ -4586,10 +4865,11 @@ var TextareaIcon = (({
4586
4865
  }) => /*#__PURE__*/React.createElement("svg", _extends$1({
4587
4866
  xmlns: "http://www.w3.org/2000/svg",
4588
4867
  width: "54",
4589
- height: "54"
4868
+ height: "54",
4869
+ fill: "currentcolor"
4590
4870
  }, props), /*#__PURE__*/React.createElement("path", {
4591
4871
  fillRule: "evenodd",
4592
- d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
4872
+ d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.849.849-6.364 6.364-.849-.849 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
4593
4873
  })));
4594
4874
 
4595
4875
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -4597,20 +4877,18 @@ var ImageIcon = (({
4597
4877
  styles = {},
4598
4878
  ...props
4599
4879
  }) => /*#__PURE__*/React.createElement("svg", _extends({
4880
+ xmlns: "http://www.w3.org/2000/svg",
4600
4881
  width: "54",
4601
4882
  height: "54",
4602
- fill: "none",
4603
- xmlns: "http://www.w3.org/2000/svg"
4883
+ fill: "currentcolor"
4604
4884
  }, props), /*#__PURE__*/React.createElement("path", {
4605
4885
  fillRule: "evenodd",
4606
- clipRule: "evenodd",
4607
4886
  d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
4608
- fill: "#000"
4887
+ clipRule: "evenodd"
4609
4888
  }), /*#__PURE__*/React.createElement("path", {
4610
4889
  fillRule: "evenodd",
4611
- clipRule: "evenodd",
4612
- d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
4613
- fill: "#000"
4890
+ d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754a.975.975 0 00.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
4891
+ clipRule: "evenodd"
4614
4892
  })));
4615
4893
 
4616
4894
  const iconsByType = type => {
@@ -4638,7 +4916,7 @@ class FormFields {
4638
4916
  constructor() {
4639
4917
  this._formFields = {};
4640
4918
  formFields.forEach(formField => {
4641
- this.register(formField.type, formField);
4919
+ this.register(formField.config.type, formField);
4642
4920
  });
4643
4921
  }
4644
4922
  register(type, formField) {
@@ -4859,7 +5137,7 @@ class Form {
4859
5137
  const {
4860
5138
  properties
4861
5139
  } = this._getState();
4862
- if (properties.readOnly) {
5140
+ if (properties.readOnly || properties.disabled) {
4863
5141
  throw new Error('form is read-only');
4864
5142
  }
4865
5143
  const data = this._getSubmitData();
@@ -5088,7 +5366,7 @@ class Form {
5088
5366
  }
5089
5367
  }
5090
5368
 
5091
- const schemaVersion = 8;
5369
+ const schemaVersion = 9;
5092
5370
 
5093
5371
  /**
5094
5372
  * @typedef { import('./types').CreateFormOptions } CreateFormOptions