@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.es.js CHANGED
@@ -474,6 +474,30 @@ var FN_REF = '__fn';
474
474
  var DEFAULT_PRIORITY = 1000;
475
475
  var slice = Array.prototype.slice;
476
476
 
477
+ /**
478
+ * @typedef { {
479
+ * stopPropagation(): void;
480
+ * preventDefault(): void;
481
+ * cancelBubble: boolean;
482
+ * defaultPrevented: boolean;
483
+ * returnValue: any;
484
+ * } } Event
485
+ */
486
+
487
+ /**
488
+ * @template E
489
+ *
490
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
491
+ */
492
+
493
+ /**
494
+ * @typedef { {
495
+ * priority: number;
496
+ * next: EventBusListener | null;
497
+ * callback: EventBusEventCallback<any>;
498
+ * } } EventBusListener
499
+ */
500
+
477
501
  /**
478
502
  * A general purpose event bus.
479
503
  *
@@ -558,6 +582,9 @@ var slice = Array.prototype.slice;
558
582
  * ```
559
583
  */
560
584
  function EventBus() {
585
+ /**
586
+ * @type { Record<string, EventBusListener> }
587
+ */
561
588
  this._listeners = {};
562
589
 
563
590
  // cleanup on destroy on lowest priority to allow
@@ -577,10 +604,12 @@ function EventBus() {
577
604
  *
578
605
  * Returning anything but `undefined` from a listener will stop the listener propagation.
579
606
  *
580
- * @param {string|Array<string>} events
581
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
582
- * @param {Function} callback
583
- * @param {Object} [that] Pass context (`this`) to the callback
607
+ * @template T
608
+ *
609
+ * @param {string|string[]} events to subscribe to
610
+ * @param {number} [priority=1000] listen priority
611
+ * @param {EventBusEventCallback<T>} callback
612
+ * @param {any} [that] callback context
584
613
  */
585
614
  EventBus.prototype.on = function (events, priority, callback, that) {
586
615
  events = isArray(events) ? events : [events];
@@ -612,14 +641,16 @@ EventBus.prototype.on = function (events, priority, callback, that) {
612
641
  };
613
642
 
614
643
  /**
615
- * Register an event listener that is executed only once.
644
+ * Register an event listener that is called only once.
616
645
  *
617
- * @param {string} event the event name to register for
618
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
619
- * @param {Function} callback the callback to execute
620
- * @param {Object} [that] Pass context (`this`) to the callback
646
+ * @template T
647
+ *
648
+ * @param {string|string[]} events to subscribe to
649
+ * @param {number} [priority=1000] the listen priority
650
+ * @param {EventBusEventCallback<T>} callback
651
+ * @param {any} [that] callback context
621
652
  */
622
- EventBus.prototype.once = function (event, priority, callback, that) {
653
+ EventBus.prototype.once = function (events, priority, callback, that) {
623
654
  var self = this;
624
655
  if (isFunction(priority)) {
625
656
  that = callback;
@@ -632,7 +663,7 @@ EventBus.prototype.once = function (event, priority, callback, that) {
632
663
  function wrappedCallback() {
633
664
  wrappedCallback.__isTomb = true;
634
665
  var result = callback.apply(that, arguments);
635
- self.off(event, wrappedCallback);
666
+ self.off(events, wrappedCallback);
636
667
  return result;
637
668
  }
638
669
 
@@ -640,7 +671,7 @@ EventBus.prototype.once = function (event, priority, callback, that) {
640
671
  // bound callbacks via {@link #off} using the original
641
672
  // callback
642
673
  wrappedCallback[FN_REF] = callback;
643
- this.on(event, priority, wrappedCallback);
674
+ this.on(events, priority, wrappedCallback);
644
675
  };
645
676
 
646
677
  /**
@@ -648,8 +679,8 @@ EventBus.prototype.once = function (event, priority, callback, that) {
648
679
  *
649
680
  * If no callback is given, all listeners for a given event name are being removed.
650
681
  *
651
- * @param {string|Array<string>} events
652
- * @param {Function} [callback]
682
+ * @param {string|string[]} events
683
+ * @param {EventBusEventCallback} [callback]
653
684
  */
654
685
  EventBus.prototype.off = function (events, callback) {
655
686
  events = isArray(events) ? events : [events];
@@ -660,11 +691,11 @@ EventBus.prototype.off = function (events, callback) {
660
691
  };
661
692
 
662
693
  /**
663
- * Create an EventBus event.
694
+ * Create an event recognized be the event bus.
664
695
  *
665
- * @param {Object} data
696
+ * @param {Object} data Event data.
666
697
  *
667
- * @return {Object} event, recognized by the eventBus
698
+ * @return {Event} An event that will be recognized by the event bus.
668
699
  */
669
700
  EventBus.prototype.createEvent = function (data) {
670
701
  var event = new InternalEvent();
@@ -673,10 +704,11 @@ EventBus.prototype.createEvent = function (data) {
673
704
  };
674
705
 
675
706
  /**
676
- * Fires a named event.
707
+ * Fires an event.
677
708
  *
678
709
  * @example
679
710
  *
711
+ * ```javascript
680
712
  * // fire event by name
681
713
  * events.fire('foo');
682
714
  *
@@ -694,13 +726,13 @@ EventBus.prototype.createEvent = function (data) {
694
726
  * });
695
727
  *
696
728
  * events.fire({ type: 'foo' }, 'I am bar!');
729
+ * ```
697
730
  *
698
- * @param {string} [name] the optional event name
699
- * @param {Object} [event] the event object
700
- * @param {...Object} additional arguments to be passed to the callback functions
731
+ * @param {string} [type] event type
732
+ * @param {Object} [data] event or event data
733
+ * @param {...any} [args] additional arguments the callback will be called with.
701
734
  *
702
- * @return {boolean} the events return value, if specified or false if the
703
- * default action was prevented by listeners
735
+ * @return {any} The return value. Will be set to `false` if the default was prevented.
704
736
  */
705
737
  EventBus.prototype.fire = function (type, data) {
706
738
  var event, firstListener, returnValue, args;
@@ -752,6 +784,14 @@ EventBus.prototype.fire = function (type, data) {
752
784
  }
753
785
  return returnValue;
754
786
  };
787
+
788
+ /**
789
+ * Handle an error by firing an event.
790
+ *
791
+ * @param {Error} error The error to be handled.
792
+ *
793
+ * @return {boolean} Whether the error was handled.
794
+ */
755
795
  EventBus.prototype.handleError = function (error) {
756
796
  return this.fire('error', {
757
797
  error: error
@@ -760,6 +800,14 @@ EventBus.prototype.handleError = function (error) {
760
800
  EventBus.prototype._destroy = function () {
761
801
  this._listeners = {};
762
802
  };
803
+
804
+ /**
805
+ * @param {Event} event
806
+ * @param {any[]} args
807
+ * @param {EventBusListener} listener
808
+ *
809
+ * @return {any}
810
+ */
763
811
  EventBus.prototype._invokeListeners = function (event, args, listener) {
764
812
  var returnValue;
765
813
  while (listener) {
@@ -772,6 +820,14 @@ EventBus.prototype._invokeListeners = function (event, args, listener) {
772
820
  }
773
821
  return returnValue;
774
822
  };
823
+
824
+ /**
825
+ * @param {Event} event
826
+ * @param {any[]} args
827
+ * @param {EventBusListener} listener
828
+ *
829
+ * @return {any}
830
+ */
775
831
  EventBus.prototype._invokeListener = function (event, args, listener) {
776
832
  var returnValue;
777
833
  if (listener.callback.__isTomb) {
@@ -800,7 +856,7 @@ EventBus.prototype._invokeListener = function (event, args, listener) {
800
856
  return returnValue;
801
857
  };
802
858
 
803
- /*
859
+ /**
804
860
  * Add new listener with a certain priority to the list
805
861
  * of listeners (for the given event).
806
862
  *
@@ -814,7 +870,7 @@ EventBus.prototype._invokeListener = function (event, args, listener) {
814
870
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
815
871
  *
816
872
  * @param {string} event
817
- * @param {Object} listener { priority, callback }
873
+ * @param {EventBusListener} listener
818
874
  */
819
875
  EventBus.prototype._addListener = function (event, newListener) {
820
876
  var listener = this._getListeners(event),
@@ -845,9 +901,20 @@ EventBus.prototype._addListener = function (event, newListener) {
845
901
  // add new listener to back
846
902
  previousListener.next = newListener;
847
903
  };
904
+
905
+ /**
906
+ * @param {string} name
907
+ *
908
+ * @return {EventBusListener}
909
+ */
848
910
  EventBus.prototype._getListeners = function (name) {
849
911
  return this._listeners[name];
850
912
  };
913
+
914
+ /**
915
+ * @param {string} name
916
+ * @param {EventBusListener} listener
917
+ */
851
918
  EventBus.prototype._setListeners = function (name, listener) {
852
919
  this._listeners[name] = listener;
853
920
  };
@@ -895,9 +962,9 @@ InternalEvent.prototype.init = function (data) {
895
962
  * Invoke function. Be fast...
896
963
  *
897
964
  * @param {Function} fn
898
- * @param {Array<Object>} args
965
+ * @param {any[]} args
899
966
  *
900
- * @return {Any}
967
+ * @return {any}
901
968
  */
902
969
  function invokeFunction(fn, args) {
903
970
  return fn.apply(null, args);
@@ -1273,7 +1340,7 @@ function createFormContainer(prefix = 'fjs') {
1273
1340
  return container;
1274
1341
  }
1275
1342
 
1276
- const EXPRESSION_PROPERTIES = ['alt', 'source', 'text'];
1343
+ const EXPRESSION_PROPERTIES = ['alt', 'source', 'readonly', 'text'];
1277
1344
  const TEMPLATE_PROPERTIES = ['text'];
1278
1345
  function findErrors(errors, path) {
1279
1346
  return errors[pathStringify(path)];
@@ -1492,16 +1559,18 @@ class Importer {
1492
1559
  // if unavailable - get empty value from form field
1493
1560
 
1494
1561
  if (_path) {
1495
- const fieldImplementation = this._formFields.get(type);
1562
+ const {
1563
+ config: fieldConfig
1564
+ } = this._formFields.get(type);
1496
1565
  let valueData = get(data, _path);
1497
- if (!isUndefined(valueData) && fieldImplementation.sanitizeValue) {
1498
- valueData = fieldImplementation.sanitizeValue({
1566
+ if (!isUndefined(valueData) && fieldConfig.sanitizeValue) {
1567
+ valueData = fieldConfig.sanitizeValue({
1499
1568
  formField,
1500
1569
  data,
1501
1570
  value: valueData
1502
1571
  });
1503
1572
  }
1504
- const initializedFieldValue = !isUndefined(valueData) ? valueData : !isUndefined(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
1573
+ const initializedFieldValue = !isUndefined(valueData) ? valueData : !isUndefined(defaultValue) ? defaultValue : fieldConfig.emptyValue;
1505
1574
  initializedData = {
1506
1575
  ...initializedData,
1507
1576
  [_path[0]]: initializedFieldValue
@@ -1519,14 +1588,16 @@ var importModule = {
1519
1588
 
1520
1589
  function formFieldClasses(type, {
1521
1590
  errors = [],
1522
- disabled = false
1591
+ disabled = false,
1592
+ readonly = false
1523
1593
  } = {}) {
1524
1594
  if (!type) {
1525
1595
  throw new Error('type required');
1526
1596
  }
1527
1597
  return classNames('fjs-form-field', `fjs-form-field-${type}`, {
1528
1598
  'fjs-has-errors': errors.length > 0,
1529
- 'fjs-disabled': disabled
1599
+ 'fjs-disabled': disabled,
1600
+ 'fjs-readonly': readonly
1530
1601
  });
1531
1602
  }
1532
1603
  function gridColumnClasses(formField) {
@@ -1566,14 +1637,16 @@ function Button(props) {
1566
1637
  })
1567
1638
  });
1568
1639
  }
1569
- Button.create = (options = {}) => ({
1570
- action: 'submit',
1571
- ...options
1572
- });
1573
- Button.type = type$b;
1574
- Button.label = 'Button';
1575
- Button.keyed = true;
1576
- Button.group = 'action';
1640
+ Button.config = {
1641
+ type: type$b,
1642
+ keyed: true,
1643
+ label: 'Button',
1644
+ group: 'action',
1645
+ create: (options = {}) => ({
1646
+ action: 'submit',
1647
+ ...options
1648
+ })
1649
+ };
1577
1650
 
1578
1651
  const FormRenderContext = createContext({
1579
1652
  Empty: props => {
@@ -1637,13 +1710,16 @@ function Description(props) {
1637
1710
 
1638
1711
  function Errors(props) {
1639
1712
  const {
1640
- errors
1713
+ errors,
1714
+ id
1641
1715
  } = props;
1642
1716
  if (!errors.length) {
1643
1717
  return null;
1644
1718
  }
1645
1719
  return jsx("div", {
1646
1720
  class: "fjs-form-field-error",
1721
+ "aria-live": "polite",
1722
+ id: id,
1647
1723
  children: jsx("ul", {
1648
1724
  children: errors.map(error => {
1649
1725
  return jsx("li", {
@@ -1679,6 +1755,7 @@ function Checkbox(props) {
1679
1755
  disabled,
1680
1756
  errors = [],
1681
1757
  field,
1758
+ readonly,
1682
1759
  value = false
1683
1760
  } = props;
1684
1761
  const {
@@ -1701,10 +1778,12 @@ function Checkbox(props) {
1701
1778
  const {
1702
1779
  formId
1703
1780
  } = useContext(FormContext$1);
1781
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
1704
1782
  return jsxs("div", {
1705
1783
  class: classNames(formFieldClasses(type$a, {
1706
1784
  errors,
1707
- disabled
1785
+ disabled,
1786
+ readonly
1708
1787
  }), {
1709
1788
  'fjs-checked': value
1710
1789
  }),
@@ -1716,28 +1795,33 @@ function Checkbox(props) {
1716
1795
  checked: value,
1717
1796
  class: "fjs-input",
1718
1797
  disabled: disabled,
1798
+ readOnly: readonly,
1719
1799
  id: prefixId(id, formId),
1720
1800
  type: "checkbox",
1721
- onChange: onChange
1801
+ onChange: onChange,
1802
+ "aria-describedby": errorMessageId
1722
1803
  })
1723
1804
  }), jsx(Description, {
1724
1805
  description: description
1725
1806
  }), jsx(Errors, {
1726
- errors: errors
1807
+ errors: errors,
1808
+ id: errorMessageId
1727
1809
  })]
1728
1810
  });
1729
1811
  }
1730
- Checkbox.create = (options = {}) => ({
1731
- ...options
1732
- });
1733
- Checkbox.type = type$a;
1734
- Checkbox.label = 'Checkbox';
1735
- Checkbox.keyed = true;
1736
- Checkbox.emptyValue = false;
1737
- Checkbox.sanitizeValue = ({
1738
- value
1739
- }) => value === true;
1740
- Checkbox.group = 'selection';
1812
+ Checkbox.config = {
1813
+ type: type$a,
1814
+ keyed: true,
1815
+ label: 'Checkbox',
1816
+ group: 'selection',
1817
+ emptyValue: false,
1818
+ sanitizeValue: ({
1819
+ value
1820
+ }) => value === true,
1821
+ create: (options = {}) => ({
1822
+ ...options
1823
+ })
1824
+ };
1741
1825
 
1742
1826
  // parses the options data from the provided form field and form data
1743
1827
  function getValuesData(formField, formData) {
@@ -2073,6 +2157,7 @@ function Checklist(props) {
2073
2157
  disabled,
2074
2158
  errors = [],
2075
2159
  field,
2160
+ readonly,
2076
2161
  value = []
2077
2162
  } = props;
2078
2163
  const {
@@ -2103,10 +2188,12 @@ function Checklist(props) {
2103
2188
  const {
2104
2189
  formId
2105
2190
  } = useContext(FormContext$1);
2191
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2106
2192
  return jsxs("div", {
2107
2193
  class: classNames(formFieldClasses(type$9, {
2108
2194
  errors,
2109
- disabled
2195
+ disabled,
2196
+ readonly
2110
2197
  })),
2111
2198
  children: [jsx(Label, {
2112
2199
  label: label,
@@ -2123,39 +2210,44 @@ function Checklist(props) {
2123
2210
  checked: value.includes(v.value),
2124
2211
  class: "fjs-input",
2125
2212
  disabled: disabled,
2213
+ readOnly: readonly,
2126
2214
  id: prefixId(`${id}-${index}`, formId),
2127
2215
  type: "checkbox",
2128
- onClick: () => toggleCheckbox(v.value)
2216
+ onClick: () => toggleCheckbox(v.value),
2217
+ "aria-describedby": errorMessageId
2129
2218
  })
2130
2219
  }, `${id}-${index}`);
2131
2220
  }), jsx(Description, {
2132
2221
  description: description
2133
2222
  }), jsx(Errors, {
2134
- errors: errors
2223
+ errors: errors,
2224
+ id: errorMessageId
2135
2225
  })]
2136
2226
  });
2137
2227
  }
2138
- Checklist.create = (options = {}) => {
2139
- const defaults = {};
2140
-
2141
- // provide default values if valuesKey isn't set
2142
- if (!options.valuesKey) {
2143
- defaults.values = [{
2144
- label: 'Value',
2145
- value: 'value'
2146
- }];
2228
+ Checklist.config = {
2229
+ type: type$9,
2230
+ keyed: true,
2231
+ label: 'Checklist',
2232
+ group: 'selection',
2233
+ emptyValue: [],
2234
+ sanitizeValue: sanitizeMultiSelectValue,
2235
+ create: (options = {}) => {
2236
+ const defaults = {};
2237
+
2238
+ // provide default values if valuesKey isn't set
2239
+ if (!options.valuesKey) {
2240
+ defaults.values = [{
2241
+ label: 'Value',
2242
+ value: 'value'
2243
+ }];
2244
+ }
2245
+ return {
2246
+ ...defaults,
2247
+ ...options
2248
+ };
2147
2249
  }
2148
- return {
2149
- ...defaults,
2150
- ...options
2151
- };
2152
2250
  };
2153
- Checklist.type = type$9;
2154
- Checklist.label = 'Checklist';
2155
- Checklist.keyed = true;
2156
- Checklist.emptyValue = [];
2157
- Checklist.sanitizeValue = sanitizeMultiSelectValue;
2158
- Checklist.group = 'selection';
2159
2251
 
2160
2252
  /**
2161
2253
  * Returns the conditionally filtered data of a form reactively.
@@ -2227,6 +2319,33 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
2227
2319
  });
2228
2320
  }
2229
2321
 
2322
+ /**
2323
+ * Retrieve readonly value of a form field, given it can be an
2324
+ * expression optionally or configured globally.
2325
+ *
2326
+ * @typedef { import('../../types').FormProperties } FormProperties
2327
+ *
2328
+ * @param {any} formField
2329
+ * @param {FormProperties} properties
2330
+ *
2331
+ * @returns {boolean}
2332
+ */
2333
+ function useReadonly(formField, properties = {}) {
2334
+ const expressionLanguage = useService('expressionLanguage');
2335
+ const conditionChecker = useService('conditionChecker', false);
2336
+ const filteredData = useFilteredFormData();
2337
+ const {
2338
+ readonly
2339
+ } = formField;
2340
+ if (properties.readOnly) {
2341
+ return true;
2342
+ }
2343
+ if (expressionLanguage && expressionLanguage.isExpression(readonly)) {
2344
+ return conditionChecker ? conditionChecker.check(readonly, filteredData) : false;
2345
+ }
2346
+ return readonly || false;
2347
+ }
2348
+
2230
2349
  /**
2231
2350
  * Template a string reactively based on form data. If the string is not a template, it is returned as is.
2232
2351
  * Memoised to minimize re-renders
@@ -2255,9 +2374,6 @@ function FormField(props) {
2255
2374
  field,
2256
2375
  onChange
2257
2376
  } = props;
2258
- const {
2259
- _path
2260
- } = field;
2261
2377
  const formFields = useService('formFields'),
2262
2378
  form = useService('form');
2263
2379
  const {
@@ -2274,9 +2390,12 @@ function FormField(props) {
2274
2390
  if (!FormFieldComponent) {
2275
2391
  throw new Error(`cannot render field <${field.type}>`);
2276
2392
  }
2277
- const value = get(data, _path);
2278
- const fieldErrors = findErrors(errors, _path);
2279
- const disabled = properties.readOnly || field.disabled || false;
2393
+ const value = get(data, field._path);
2394
+ const fieldErrors = findErrors(errors, field._path);
2395
+ const readonly = useReadonly(field, properties);
2396
+
2397
+ // add precedence: global readonly > form field disabled
2398
+ const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
2280
2399
  const hidden = useCondition(field.conditional && field.conditional.hide || null);
2281
2400
  if (hidden) {
2282
2401
  return jsx(Empty, {});
@@ -2291,7 +2410,8 @@ function FormField(props) {
2291
2410
  ...props,
2292
2411
  disabled: disabled,
2293
2412
  errors: fieldErrors,
2294
- onChange: disabled ? noop$1 : onChange,
2413
+ onChange: disabled || readonly ? noop$1 : onChange,
2414
+ readonly: readonly,
2295
2415
  value: value
2296
2416
  })
2297
2417
  })
@@ -2342,14 +2462,16 @@ function Default(props) {
2342
2462
  }), components.length ? null : jsx(Empty, {})]
2343
2463
  });
2344
2464
  }
2345
- Default.create = (options = {}) => ({
2346
- components: [],
2347
- ...options
2348
- });
2349
- Default.type = 'default';
2350
- Default.keyed = false;
2351
- Default.label = null;
2352
- Default.group = null;
2465
+ Default.config = {
2466
+ type: 'default',
2467
+ keyed: false,
2468
+ label: null,
2469
+ group: null,
2470
+ create: (options = {}) => ({
2471
+ components: [],
2472
+ ...options
2473
+ })
2474
+ };
2353
2475
 
2354
2476
  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); }
2355
2477
  var CalendarIcon = (({
@@ -2376,12 +2498,14 @@ function InputAdorner(props) {
2376
2498
  inputRef,
2377
2499
  children,
2378
2500
  disabled,
2501
+ readonly,
2379
2502
  hasErrors
2380
2503
  } = props;
2381
2504
  const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
2382
2505
  return jsxs("div", {
2383
2506
  class: classNames('fjs-input-group', {
2384
- 'fjs-disabled': disabled
2507
+ 'fjs-disabled': disabled,
2508
+ 'fjs-readonly': readonly
2385
2509
  }, {
2386
2510
  'hasErrors': hasErrors
2387
2511
  }),
@@ -2414,6 +2538,7 @@ function Datepicker(props) {
2414
2538
  disabled,
2415
2539
  disallowPassedDates,
2416
2540
  date,
2541
+ readonly,
2417
2542
  setDate
2418
2543
  } = props;
2419
2544
  const dateInputRef = useRef();
@@ -2493,9 +2618,9 @@ function Datepicker(props) {
2493
2618
  }
2494
2619
  }, [flatpickrInstance, isInputDirty]);
2495
2620
  const onInputFocus = useCallback(e => {
2496
- if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget)) return;
2621
+ if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget) || readonly) return;
2497
2622
  flatpickrInstance.open();
2498
- }, [flatpickrInstance]);
2623
+ }, [flatpickrInstance, readonly]);
2499
2624
 
2500
2625
  // simulate an enter press on blur to make sure the date value is submitted in all scenarios
2501
2626
  const onInputBlur = useCallback(e => {
@@ -2514,6 +2639,7 @@ function Datepicker(props) {
2514
2639
  }), jsx(InputAdorner, {
2515
2640
  pre: jsx(CalendarIcon, {}),
2516
2641
  disabled: disabled,
2642
+ readonly: readonly,
2517
2643
  rootRef: focusScopeRef,
2518
2644
  inputRef: dateInputRef,
2519
2645
  children: jsx("div", {
@@ -2525,16 +2651,18 @@ function Datepicker(props) {
2525
2651
  ref: dateInputRef,
2526
2652
  type: "text",
2527
2653
  id: fullId,
2528
- class: 'fjs-input',
2654
+ class: "fjs-input",
2529
2655
  disabled: disabled,
2656
+ readOnly: readonly,
2530
2657
  placeholder: "mm/dd/yyyy",
2531
2658
  autoComplete: "off",
2532
2659
  onFocus: onInputFocus,
2533
2660
  onKeyDown: onInputKeyDown,
2534
- onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
2661
+ onMouseDown: () => !flatpickrInstance.isOpen && !readonly && flatpickrInstance.open(),
2535
2662
  onBlur: onInputBlur,
2536
- onInput: e => setIsInputDirty(true),
2537
- "data-input": true
2663
+ onInput: () => setIsInputDirty(true),
2664
+ "data-input": true,
2665
+ "aria-describedby": props['aria-describedby']
2538
2666
  })
2539
2667
  })
2540
2668
  })]
@@ -2664,6 +2792,7 @@ function Timepicker(props) {
2664
2792
  formId,
2665
2793
  required,
2666
2794
  disabled,
2795
+ readonly,
2667
2796
  use24h = false,
2668
2797
  timeInterval,
2669
2798
  time,
@@ -2769,6 +2898,7 @@ function Timepicker(props) {
2769
2898
  pre: jsx(ClockIcon, {}),
2770
2899
  inputRef: timeInputRef,
2771
2900
  disabled: disabled,
2901
+ readonly: readonly,
2772
2902
  children: jsxs("div", {
2773
2903
  class: "fjs-timepicker fjs-timepicker-anchor",
2774
2904
  children: [jsx("input", {
@@ -2778,10 +2908,11 @@ function Timepicker(props) {
2778
2908
  class: "fjs-input",
2779
2909
  value: rawValue,
2780
2910
  disabled: disabled,
2911
+ readOnly: readonly,
2781
2912
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
2782
2913
  autoComplete: "off",
2783
- onFocus: () => useDropdown && setDropdownIsOpen(true),
2784
- onClick: () => useDropdown && setDropdownIsOpen(true)
2914
+ onFocus: () => !readonly && useDropdown && setDropdownIsOpen(true),
2915
+ onClick: () => !readonly && useDropdown && setDropdownIsOpen(true)
2785
2916
 
2786
2917
  // @ts-ignore
2787
2918
  ,
@@ -2791,7 +2922,8 @@ function Timepicker(props) {
2791
2922
  },
2792
2923
  onBlur: onInputBlur,
2793
2924
  onKeyDown: onInputKeyDown,
2794
- "data-input": true
2925
+ "data-input": true,
2926
+ "aria-describedby": props['aria-describedby']
2795
2927
  }), dropdownIsOpen && jsx(DropdownList, {
2796
2928
  values: timeOptions,
2797
2929
  height: 150,
@@ -2811,6 +2943,7 @@ function Datetime(props) {
2811
2943
  errors = [],
2812
2944
  field,
2813
2945
  onChange,
2946
+ readonly,
2814
2947
  value = ''
2815
2948
  } = props;
2816
2949
  const {
@@ -2927,6 +3060,7 @@ function Datetime(props) {
2927
3060
  time
2928
3061
  });
2929
3062
  }, []);
3063
+ const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2930
3064
  const datePickerProps = {
2931
3065
  id,
2932
3066
  label: dateLabel,
@@ -2936,7 +3070,9 @@ function Datetime(props) {
2936
3070
  disabled,
2937
3071
  disallowPassedDates,
2938
3072
  date: dateTime.date,
2939
- setDate
3073
+ readonly,
3074
+ setDate,
3075
+ 'aria-describedby': errorMessageId
2940
3076
  };
2941
3077
  const timePickerProps = {
2942
3078
  id,
@@ -2945,15 +3081,18 @@ function Datetime(props) {
2945
3081
  formId,
2946
3082
  required,
2947
3083
  disabled,
3084
+ readonly,
2948
3085
  use24h,
2949
3086
  timeInterval,
2950
3087
  time: dateTime.time,
2951
- setTime
3088
+ setTime,
3089
+ 'aria-describedby': errorMessageId
2952
3090
  };
2953
3091
  return jsxs("div", {
2954
3092
  class: formFieldClasses(type$8, {
2955
3093
  errors: allErrors,
2956
- disabled
3094
+ disabled,
3095
+ readonly
2957
3096
  }),
2958
3097
  children: [jsxs("div", {
2959
3098
  class: classNames('fjs-vertical-group'),
@@ -2967,25 +3106,28 @@ function Datetime(props) {
2967
3106
  }), jsx(Description, {
2968
3107
  description: description
2969
3108
  }), jsx(Errors, {
2970
- errors: allErrors
3109
+ errors: allErrors,
3110
+ id: errorMessageId
2971
3111
  })]
2972
3112
  });
2973
3113
  }
2974
- Datetime.create = (options = {}) => {
2975
- const defaults = {};
2976
- set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
2977
- set(defaults, DATE_LABEL_PATH, 'Date');
2978
- return {
2979
- ...defaults,
2980
- ...options
2981
- };
3114
+ Datetime.config = {
3115
+ type: type$8,
3116
+ keyed: true,
3117
+ label: 'Date time',
3118
+ group: 'basic-input',
3119
+ emptyValue: null,
3120
+ sanitizeValue: sanitizeDateTimePickerValue,
3121
+ create: (options = {}) => {
3122
+ const defaults = {};
3123
+ set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
3124
+ set(defaults, DATE_LABEL_PATH, 'Date');
3125
+ return {
3126
+ ...defaults,
3127
+ ...options
3128
+ };
3129
+ }
2982
3130
  };
2983
- Datetime.type = type$8;
2984
- Datetime.keyed = true;
2985
- Datetime.emptyValue = null;
2986
- Datetime.sanitizeValue = sanitizeDateTimePickerValue;
2987
- Datetime.label = 'Date time';
2988
- Datetime.group = 'basic-input';
2989
3131
 
2990
3132
  /**
2991
3133
  * This file must not be changed or exchanged.
@@ -3029,7 +3171,7 @@ function Lightbox(props) {
3029
3171
  href: "https://bpmn.io",
3030
3172
  target: "_blank",
3031
3173
  rel: "noopener",
3032
- style: "margin: 15px 20px 15px 10px; align-self: center; color: #404040",
3174
+ style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
3033
3175
  children: jsx(Logo, {})
3034
3176
  }), jsxs("span", {
3035
3177
  children: ["Web-based tooling for BPMN, DMN, and forms powered by ", jsx("a", {
@@ -3052,7 +3194,7 @@ function Link(props) {
3052
3194
  rel: "noopener",
3053
3195
  class: "fjs-powered-by-link",
3054
3196
  title: "Powered by bpmn.io",
3055
- style: "color: #404040",
3197
+ style: "color: var(--cds-text-primary, #404040)",
3056
3198
  onClick: props.onClick,
3057
3199
  children: jsx(Logo, {})
3058
3200
  })
@@ -3080,8 +3222,12 @@ const noop = () => {};
3080
3222
  function FormComponent(props) {
3081
3223
  const form = useService('form');
3082
3224
  const {
3083
- schema
3225
+ schema,
3226
+ properties
3084
3227
  } = form._getState();
3228
+ const {
3229
+ ariaLabel
3230
+ } = properties;
3085
3231
  const {
3086
3232
  onSubmit = noop,
3087
3233
  onReset = noop,
@@ -3099,6 +3245,7 @@ function FormComponent(props) {
3099
3245
  class: "fjs-form",
3100
3246
  onSubmit: handleSubmit,
3101
3247
  onReset: handleReset,
3248
+ "aria-label": ariaLabel,
3102
3249
  noValidate: true,
3103
3250
  children: [jsx(FormField, {
3104
3251
  field: schema,
@@ -3109,7 +3256,7 @@ function FormComponent(props) {
3109
3256
 
3110
3257
  const NODE_TYPE_TEXT = 3,
3111
3258
  NODE_TYPE_ELEMENT = 1;
3112
- const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong'];
3259
+ 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'];
3113
3260
  const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src'];
3114
3261
  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
3115
3262
  const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
@@ -3298,13 +3445,15 @@ function Image(props) {
3298
3445
  })
3299
3446
  });
3300
3447
  }
3301
- Image.create = (options = {}) => ({
3302
- ...options
3303
- });
3304
- Image.type = type$7;
3305
- Image.keyed = false;
3306
- Image.label = 'Image view';
3307
- Image.group = 'presentation';
3448
+ Image.config = {
3449
+ type: type$7,
3450
+ keyed: false,
3451
+ label: 'Image view',
3452
+ group: 'presentation',
3453
+ create: (options = {}) => ({
3454
+ ...options
3455
+ })
3456
+ };
3308
3457
 
3309
3458
  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); }
3310
3459
  var AngelDownIcon = (({
@@ -3347,6 +3496,7 @@ function Numberfield(props) {
3347
3496
  errors = [],
3348
3497
  field,
3349
3498
  value,
3499
+ readonly,
3350
3500
  onChange
3351
3501
  } = props;
3352
3502
  const {
@@ -3371,10 +3521,10 @@ function Numberfield(props) {
3371
3521
 
3372
3522
  // checks whether the value currently in the form data is practically different from the one in the input field cache
3373
3523
  // this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
3374
- const cacheValueMatchesState = useMemo(() => Numberfield.sanitizeValue({
3524
+ const cacheValueMatchesState = useMemo(() => Numberfield.config.sanitizeValue({
3375
3525
  value,
3376
3526
  formField: field
3377
- }) === Numberfield.sanitizeValue({
3527
+ }) === Numberfield.config.sanitizeValue({
3378
3528
  value: stringValueCache,
3379
3529
  formField: field
3380
3530
  }), [stringValueCache, value, field]);
@@ -3419,6 +3569,9 @@ function Numberfield(props) {
3419
3569
  });
3420
3570
  }, [field, onChange, serializeToString]);
3421
3571
  const increment = () => {
3572
+ if (readonly) {
3573
+ return;
3574
+ }
3422
3575
  const base = isValidNumber(value) ? Big(value) : Big(0);
3423
3576
  const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
3424
3577
 
@@ -3426,6 +3579,9 @@ function Numberfield(props) {
3426
3579
  setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
3427
3580
  };
3428
3581
  const decrement = () => {
3582
+ if (readonly) {
3583
+ return;
3584
+ }
3429
3585
  const base = isValidNumber(value) ? Big(value) : Big(0);
3430
3586
  const offset = base.mod(arrowIncrementValue);
3431
3587
  if (offset.cmp(0) === 0) {
@@ -3468,10 +3624,12 @@ function Numberfield(props) {
3468
3624
  const {
3469
3625
  formId
3470
3626
  } = useContext(FormContext$1);
3627
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3471
3628
  return jsxs("div", {
3472
3629
  class: formFieldClasses(type$6, {
3473
3630
  errors,
3474
- disabled
3631
+ disabled,
3632
+ readonly
3475
3633
  }),
3476
3634
  children: [jsx(Label, {
3477
3635
  id: prefixId(id, formId),
@@ -3479,11 +3637,13 @@ function Numberfield(props) {
3479
3637
  required: required
3480
3638
  }), jsx(InputAdorner, {
3481
3639
  disabled: disabled,
3640
+ readonly: readonly,
3482
3641
  pre: prefixAdorner,
3483
3642
  post: suffixAdorner,
3484
3643
  children: jsxs("div", {
3485
3644
  class: classNames('fjs-vertical-group', {
3486
- 'fjs-disabled': disabled
3645
+ 'fjs-disabled': disabled,
3646
+ 'fjs-readonly': readonly
3487
3647
  }, {
3488
3648
  'hasErrors': errors.length
3489
3649
  }),
@@ -3491,6 +3651,7 @@ function Numberfield(props) {
3491
3651
  ref: inputRef,
3492
3652
  class: "fjs-input",
3493
3653
  disabled: disabled,
3654
+ readOnly: readonly,
3494
3655
  id: prefixId(id, formId),
3495
3656
  onKeyDown: onKeyDown,
3496
3657
  onKeyPress: onKeyPress
@@ -3501,10 +3662,12 @@ function Numberfield(props) {
3501
3662
  type: "text",
3502
3663
  autoComplete: "off",
3503
3664
  step: arrowIncrementValue,
3504
- value: displayValue
3665
+ value: displayValue,
3666
+ "aria-describedby": errorMessageId
3505
3667
  }), jsxs("div", {
3506
3668
  class: classNames('fjs-number-arrow-container', {
3507
- 'fjs-disabled': disabled
3669
+ 'fjs-disabled': disabled,
3670
+ 'fjs-readonly': readonly
3508
3671
  }),
3509
3672
  children: [jsx("button", {
3510
3673
  class: "fjs-number-arrow-up",
@@ -3528,31 +3691,34 @@ function Numberfield(props) {
3528
3691
  }), jsx(Description, {
3529
3692
  description: description
3530
3693
  }), jsx(Errors, {
3531
- errors: errors
3694
+ errors: errors,
3695
+ id: errorMessageId
3532
3696
  })]
3533
3697
  });
3534
3698
  }
3535
- Numberfield.create = (options = {}) => ({
3536
- ...options
3537
- });
3538
- Numberfield.sanitizeValue = ({
3539
- value,
3540
- formField
3541
- }) => {
3542
- // null state is allowed
3543
- if (isNullEquivalentValue(value)) return null;
3544
-
3545
- // if data cannot be parsed as a valid number, go into invalid NaN state
3546
- if (!isValidNumber(value)) return 'NaN';
3547
-
3548
- // otherwise parse to formatting type
3549
- return formField.serializeToString ? value.toString() : Number(value);
3699
+ Numberfield.config = {
3700
+ type: type$6,
3701
+ keyed: true,
3702
+ label: 'Number',
3703
+ group: 'basic-input',
3704
+ emptyValue: null,
3705
+ sanitizeValue: ({
3706
+ value,
3707
+ formField
3708
+ }) => {
3709
+ // null state is allowed
3710
+ if (isNullEquivalentValue(value)) return null;
3711
+
3712
+ // if data cannot be parsed as a valid number, go into invalid NaN state
3713
+ if (!isValidNumber(value)) return 'NaN';
3714
+
3715
+ // otherwise parse to formatting type
3716
+ return formField.serializeToString ? value.toString() : Number(value);
3717
+ },
3718
+ create: (options = {}) => ({
3719
+ ...options
3720
+ })
3550
3721
  };
3551
- Numberfield.type = type$6;
3552
- Numberfield.keyed = true;
3553
- Numberfield.label = 'Number';
3554
- Numberfield.emptyValue = null;
3555
- Numberfield.group = 'basic-input';
3556
3722
 
3557
3723
  const type$5 = 'radio';
3558
3724
  function Radio(props) {
@@ -3560,6 +3726,7 @@ function Radio(props) {
3560
3726
  disabled,
3561
3727
  errors = [],
3562
3728
  field,
3729
+ readonly,
3563
3730
  value
3564
3731
  } = props;
3565
3732
  const {
@@ -3584,10 +3751,12 @@ function Radio(props) {
3584
3751
  const {
3585
3752
  formId
3586
3753
  } = useContext(FormContext$1);
3754
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3587
3755
  return jsxs("div", {
3588
3756
  class: formFieldClasses(type$5, {
3589
3757
  errors,
3590
- disabled
3758
+ disabled,
3759
+ readonly
3591
3760
  }),
3592
3761
  children: [jsx(Label, {
3593
3762
  label: label,
@@ -3604,39 +3773,44 @@ function Radio(props) {
3604
3773
  checked: option.value === value,
3605
3774
  class: "fjs-input",
3606
3775
  disabled: disabled,
3776
+ readOnly: readonly,
3607
3777
  id: prefixId(`${id}-${index}`, formId),
3608
3778
  type: "radio",
3609
- onClick: () => onChange(option.value)
3779
+ onClick: () => onChange(option.value),
3780
+ "aria-describedby": errorMessageId
3610
3781
  })
3611
3782
  }, `${id}-${index}`);
3612
3783
  }), jsx(Description, {
3613
3784
  description: description
3614
3785
  }), jsx(Errors, {
3615
- errors: errors
3786
+ errors: errors,
3787
+ id: errorMessageId
3616
3788
  })]
3617
3789
  });
3618
3790
  }
3619
- Radio.create = function (options = {}) {
3620
- const defaults = {};
3621
-
3622
- // provide default values if valuesKey isn't set
3623
- if (!options.valuesKey) {
3624
- defaults.values = [{
3625
- label: 'Value',
3626
- value: 'value'
3627
- }];
3791
+ Radio.config = {
3792
+ type: type$5,
3793
+ keyed: true,
3794
+ label: 'Radio',
3795
+ group: 'selection',
3796
+ emptyValue: null,
3797
+ sanitizeValue: sanitizeSingleSelectValue,
3798
+ create: (options = {}) => {
3799
+ const defaults = {};
3800
+
3801
+ // provide default values if valuesKey isn't set
3802
+ if (!options.valuesKey) {
3803
+ defaults.values = [{
3804
+ label: 'Value',
3805
+ value: 'value'
3806
+ }];
3807
+ }
3808
+ return {
3809
+ ...defaults,
3810
+ ...options
3811
+ };
3628
3812
  }
3629
- return {
3630
- ...defaults,
3631
- ...options
3632
- };
3633
3813
  };
3634
- Radio.type = type$5;
3635
- Radio.label = 'Radio';
3636
- Radio.keyed = true;
3637
- Radio.emptyValue = null;
3638
- Radio.sanitizeValue = sanitizeSingleSelectValue;
3639
- Radio.group = 'selection';
3640
3814
 
3641
3815
  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); }
3642
3816
  var XMarkIcon = (({
@@ -3661,6 +3835,7 @@ function SearchableSelect(props) {
3661
3835
  disabled,
3662
3836
  errors,
3663
3837
  field,
3838
+ readonly,
3664
3839
  value
3665
3840
  } = props;
3666
3841
  const {
@@ -3733,11 +3908,11 @@ function SearchableSelect(props) {
3733
3908
  }, [isDropdownExpanded, isEscapeClosed]);
3734
3909
  const displayState = useMemo(() => {
3735
3910
  const ds = {};
3736
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
3911
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
3737
3912
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3738
- ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
3913
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
3739
3914
  return ds;
3740
- }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
3915
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
3741
3916
  const onAngelMouseDown = useCallback(e => {
3742
3917
  setIsEscapeClose(false);
3743
3918
  setIsDropdownExpanded(!isDropdownExpanded);
@@ -3749,12 +3924,14 @@ function SearchableSelect(props) {
3749
3924
  children: [jsxs("div", {
3750
3925
  id: prefixId(`${id}`, formId),
3751
3926
  class: classNames('fjs-input-group', {
3752
- 'disabled': disabled
3927
+ 'disabled': disabled,
3928
+ 'readonly': readonly
3753
3929
  }, {
3754
3930
  'hasErrors': errors.length
3755
3931
  }),
3756
3932
  children: [jsx("input", {
3757
3933
  disabled: disabled,
3934
+ readOnly: readonly,
3758
3935
  class: "fjs-input",
3759
3936
  ref: searchbarRef,
3760
3937
  id: prefixId(`${id}-search`, formId),
@@ -3776,7 +3953,8 @@ function SearchableSelect(props) {
3776
3953
  onBlur: () => {
3777
3954
  setIsDropdownExpanded(false);
3778
3955
  setFilter(valueLabel);
3779
- }
3956
+ },
3957
+ "aria-describedby": props['aria-describedby']
3780
3958
  }), displayState.displayCross && jsxs("span", {
3781
3959
  class: "fjs-select-cross",
3782
3960
  onMouseDown: e => {
@@ -3810,6 +3988,7 @@ function SimpleSelect(props) {
3810
3988
  disabled,
3811
3989
  errors,
3812
3990
  field,
3991
+ readonly,
3813
3992
  value
3814
3993
  } = props;
3815
3994
  const {
@@ -3835,9 +4014,9 @@ function SimpleSelect(props) {
3835
4014
  }, [field, props]);
3836
4015
  const displayState = useMemo(() => {
3837
4016
  const ds = {};
3838
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
4017
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
3839
4018
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3840
- ds.displayDropdown = !disabled && isDropdownExpanded;
4019
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded;
3841
4020
  return ds;
3842
4021
  }, [disabled, isDropdownExpanded, loadState, value]);
3843
4022
  const onMouseDown = useCallback(e => {
@@ -3856,20 +4035,27 @@ function SimpleSelect(props) {
3856
4035
  ref: selectRef,
3857
4036
  id: prefixId(`${id}`, formId),
3858
4037
  class: classNames('fjs-input-group', {
3859
- 'disabled': disabled
4038
+ disabled,
4039
+ readonly
3860
4040
  }, {
3861
4041
  'hasErrors': errors.length
3862
4042
  }),
3863
4043
  onFocus: () => setIsDropdownExpanded(true),
3864
4044
  onBlur: () => setIsDropdownExpanded(false),
3865
- onMouseDown: e => onMouseDown(e),
3866
- tabIndex: disabled ? undefined : 0,
4045
+ onMouseDown: onMouseDown,
3867
4046
  children: [jsx("div", {
3868
4047
  class: classNames('fjs-select-display', {
3869
4048
  'fjs-select-placeholder': !value
3870
4049
  }),
3871
4050
  id: prefixId(`${id}-display`, formId),
3872
4051
  children: valueLabel || 'Select'
4052
+ }), !disabled && jsx("input", {
4053
+ id: prefixId(`${id}-search`, formId),
4054
+ class: "fjs-select-hidden-input",
4055
+ value: valueLabel,
4056
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
4057
+ onBlur: () => !readonly && setIsDropdownExpanded(false),
4058
+ "aria-describedby": props['aria-describedby']
3873
4059
  }), displayState.displayCross && jsx("span", {
3874
4060
  class: "fjs-select-cross",
3875
4061
  onMouseDown: e => {
@@ -3904,6 +4090,7 @@ function Select(props) {
3904
4090
  errors = [],
3905
4091
  field,
3906
4092
  onChange,
4093
+ readonly,
3907
4094
  value
3908
4095
  } = props;
3909
4096
  const {
@@ -3919,18 +4106,22 @@ function Select(props) {
3919
4106
  const {
3920
4107
  formId
3921
4108
  } = useContext(FormContext$1);
4109
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3922
4110
  const selectProps = useMemo(() => ({
3923
4111
  id,
3924
4112
  disabled,
3925
4113
  errors,
3926
4114
  field,
3927
4115
  value,
3928
- onChange
3929
- }), [disabled, errors, field, id, value, onChange]);
4116
+ onChange,
4117
+ readonly,
4118
+ 'aria-describedby': errorMessageId
4119
+ }), [disabled, errors, field, id, value, onChange, readonly, errorMessageId]);
3930
4120
  return jsxs("div", {
3931
4121
  class: formFieldClasses(type$4, {
3932
4122
  errors,
3933
- disabled
4123
+ disabled,
4124
+ readonly
3934
4125
  }),
3935
4126
  onKeyDown: event => {
3936
4127
  if (event.key === 'Enter') {
@@ -3939,7 +4130,7 @@ function Select(props) {
3939
4130
  }
3940
4131
  },
3941
4132
  children: [jsx(Label, {
3942
- id: prefixId(id, formId),
4133
+ id: prefixId(`${id}-search`, formId),
3943
4134
  label: label,
3944
4135
  required: required
3945
4136
  }), searchable ? jsx(SearchableSelect, {
@@ -3949,31 +4140,34 @@ function Select(props) {
3949
4140
  }), jsx(Description, {
3950
4141
  description: description
3951
4142
  }), jsx(Errors, {
3952
- errors: errors
4143
+ errors: errors,
4144
+ id: errorMessageId
3953
4145
  })]
3954
4146
  });
3955
4147
  }
3956
- Select.create = (options = {}) => {
3957
- const defaults = {};
3958
-
3959
- // provide default values if valuesKey isn't set
3960
- if (!options.valuesKey) {
3961
- defaults.values = [{
3962
- label: 'Value',
3963
- value: 'value'
3964
- }];
4148
+ Select.config = {
4149
+ type: type$4,
4150
+ keyed: true,
4151
+ label: 'Select',
4152
+ group: 'selection',
4153
+ emptyValue: null,
4154
+ sanitizeValue: sanitizeSingleSelectValue,
4155
+ create: (options = {}) => {
4156
+ const defaults = {};
4157
+
4158
+ // provide default values if valuesKey isn't set
4159
+ if (!options.valuesKey) {
4160
+ defaults.values = [{
4161
+ label: 'Value',
4162
+ value: 'value'
4163
+ }];
4164
+ }
4165
+ return {
4166
+ ...defaults,
4167
+ ...options
4168
+ };
3965
4169
  }
3966
- return {
3967
- ...defaults,
3968
- ...options
3969
- };
3970
4170
  };
3971
- Select.type = type$4;
3972
- Select.label = 'Select';
3973
- Select.keyed = true;
3974
- Select.emptyValue = null;
3975
- Select.sanitizeValue = sanitizeSingleSelectValue;
3976
- Select.group = 'selection';
3977
4171
 
3978
4172
  const type$3 = 'taglist';
3979
4173
  function Taglist(props) {
@@ -3981,6 +4175,7 @@ function Taglist(props) {
3981
4175
  disabled,
3982
4176
  errors = [],
3983
4177
  field,
4178
+ readonly,
3984
4179
  value: values = []
3985
4180
  } = props;
3986
4181
  const {
@@ -3995,6 +4190,7 @@ function Taglist(props) {
3995
4190
  const {
3996
4191
  formId
3997
4192
  } = useContext(FormContext$1);
4193
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3998
4194
  const [filter, setFilter] = useState('');
3999
4195
  const [filteredOptions, setFilteredOptions] = useState([]);
4000
4196
  const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
@@ -4070,6 +4266,10 @@ function Taglist(props) {
4070
4266
  break;
4071
4267
  }
4072
4268
  };
4269
+ const onBlur = () => {
4270
+ setIsDropdownExpanded(false);
4271
+ setFilter('');
4272
+ };
4073
4273
  const onTagRemoveClick = (event, value) => {
4074
4274
  const {
4075
4275
  target
@@ -4086,7 +4286,8 @@ function Taglist(props) {
4086
4286
  return jsxs("div", {
4087
4287
  class: formFieldClasses(type$3, {
4088
4288
  errors,
4089
- disabled
4289
+ disabled,
4290
+ readonly
4090
4291
  }),
4091
4292
  onKeyDown: event => {
4092
4293
  if (event.key === 'Enter') {
@@ -4100,20 +4301,22 @@ function Taglist(props) {
4100
4301
  id: prefixId(`${id}-search`, formId)
4101
4302
  }), jsxs("div", {
4102
4303
  class: classNames('fjs-taglist', {
4103
- 'fjs-disabled': disabled
4304
+ 'fjs-disabled': disabled,
4305
+ 'fjs-readonly': readonly
4104
4306
  }),
4105
4307
  children: [loadState === LOAD_STATES.LOADED && jsx("div", {
4106
4308
  class: "fjs-taglist-tags",
4107
4309
  children: values.map(v => {
4108
4310
  return jsxs("div", {
4109
4311
  class: classNames('fjs-taglist-tag', {
4110
- 'fjs-disabled': disabled
4312
+ 'fjs-disabled': disabled,
4313
+ 'fjs-readonly': readonly
4111
4314
  }),
4112
4315
  onMouseDown: e => e.preventDefault(),
4113
4316
  children: [jsx("span", {
4114
4317
  class: "fjs-taglist-tag-label",
4115
4318
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
4116
- }), !disabled && jsx("button", {
4319
+ }), !disabled && !readonly && jsx("button", {
4117
4320
  type: "button",
4118
4321
  title: "Remove tag",
4119
4322
  class: "fjs-taglist-tag-remove",
@@ -4124,21 +4327,22 @@ function Taglist(props) {
4124
4327
  })
4125
4328
  }), jsx("input", {
4126
4329
  disabled: disabled,
4330
+ readOnly: readonly,
4127
4331
  class: "fjs-taglist-input",
4128
4332
  ref: searchbarRef,
4129
4333
  id: prefixId(`${id}-search`, formId),
4130
4334
  onChange: onFilterChange,
4131
4335
  type: "text",
4132
4336
  value: filter,
4133
- placeholder: disabled ? '' : 'Search',
4337
+ placeholder: disabled || readonly ? undefined : 'Search',
4134
4338
  autoComplete: "off",
4135
- onKeyDown: e => onInputKeyDown(e),
4339
+ onKeyDown: onInputKeyDown,
4136
4340
  onMouseDown: () => setIsEscapeClose(false),
4137
- onFocus: () => setIsDropdownExpanded(true),
4341
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
4138
4342
  onBlur: () => {
4139
- setIsDropdownExpanded(false);
4140
- setFilter('');
4141
- }
4343
+ !readonly && onBlur();
4344
+ },
4345
+ "aria-describedby": errorMessageId
4142
4346
  })]
4143
4347
  }), jsx("div", {
4144
4348
  class: "fjs-taglist-anchor",
@@ -4152,34 +4356,41 @@ function Taglist(props) {
4152
4356
  }), jsx(Description, {
4153
4357
  description: description
4154
4358
  }), jsx(Errors, {
4155
- errors: errors
4359
+ errors: errors,
4360
+ id: errorMessageId
4156
4361
  })]
4157
4362
  });
4158
4363
  }
4159
- Taglist.create = (options = {}) => {
4160
- const defaults = {};
4161
-
4162
- // provide default values if valuesKey isn't set
4163
- if (!options.valuesKey) {
4164
- defaults.values = [{
4165
- label: 'Value',
4166
- value: 'value'
4167
- }];
4364
+ Taglist.config = {
4365
+ type: type$3,
4366
+ keyed: true,
4367
+ label: 'Tag list',
4368
+ group: 'selection',
4369
+ emptyValue: [],
4370
+ sanitizeValue: sanitizeMultiSelectValue,
4371
+ create: (options = {}) => {
4372
+ const defaults = {};
4373
+
4374
+ // provide default values if valuesKey isn't set
4375
+ if (!options.valuesKey) {
4376
+ defaults.values = [{
4377
+ label: 'Value',
4378
+ value: 'value'
4379
+ }];
4380
+ }
4381
+ return {
4382
+ ...defaults,
4383
+ ...options
4384
+ };
4168
4385
  }
4169
- return {
4170
- ...defaults,
4171
- ...options
4172
- };
4173
4386
  };
4174
- Taglist.type = type$3;
4175
- Taglist.label = 'Tag list';
4176
- Taglist.keyed = true;
4177
- Taglist.emptyValue = [];
4178
- Taglist.sanitizeValue = sanitizeMultiSelectValue;
4179
- Taglist.group = 'selection';
4180
4387
 
4181
4388
  const type$2 = 'text';
4182
4389
  function Text(props) {
4390
+ const form = useService('form');
4391
+ const {
4392
+ textLinkTarget
4393
+ } = form._getState().properties;
4183
4394
  const {
4184
4395
  field,
4185
4396
  disableLinks
@@ -4201,9 +4412,20 @@ function Text(props) {
4201
4412
  const html = markdownRenderer.render(markdown);
4202
4413
  return sanitizeHTML(html);
4203
4414
  }, [markdownRenderer, markdown]);
4204
- const componentOverrides = useMemo(() => disableLinks ? {
4205
- 'a': DisabledLink
4206
- } : {}, [disableLinks]);
4415
+ const OverridenTargetLink = useMemo(() => BuildOverridenTargetLink(textLinkTarget), [textLinkTarget]);
4416
+ const componentOverrides = useMemo(() => {
4417
+ if (disableLinks) {
4418
+ return {
4419
+ 'a': DisabledLink
4420
+ };
4421
+ }
4422
+ if (textLinkTarget) {
4423
+ return {
4424
+ 'a': OverridenTargetLink
4425
+ };
4426
+ }
4427
+ return {};
4428
+ }, [disableLinks, OverridenTargetLink, textLinkTarget]);
4207
4429
  return jsx("div", {
4208
4430
  class: formFieldClasses(type$2),
4209
4431
  children: jsx(Markup, {
@@ -4213,21 +4435,35 @@ function Text(props) {
4213
4435
  })
4214
4436
  });
4215
4437
  }
4216
- Text.create = (options = {}) => ({
4217
- text: '# Text',
4218
- ...options
4219
- });
4220
- Text.type = type$2;
4221
- Text.keyed = false;
4222
- Text.group = 'presentation';
4223
- Text.label = 'Text view';
4438
+ Text.config = {
4439
+ type: type$2,
4440
+ keyed: false,
4441
+ label: 'Text view',
4442
+ group: 'presentation',
4443
+ create: (options = {}) => ({
4444
+ text: '# Text',
4445
+ ...options
4446
+ })
4447
+ };
4448
+ function BuildOverridenTargetLink(target) {
4449
+ return function ({
4450
+ children,
4451
+ ...rest
4452
+ }) {
4453
+ return jsx("a", {
4454
+ ...rest,
4455
+ target: target,
4456
+ children: children
4457
+ });
4458
+ };
4459
+ }
4224
4460
  function DisabledLink({
4225
- href,
4226
- children
4461
+ children,
4462
+ ...rest
4227
4463
  }) {
4228
4464
  return jsx("a", {
4465
+ ...rest,
4229
4466
  class: "fjs-disabled-link",
4230
- href: href,
4231
4467
  tabIndex: -1,
4232
4468
  children: children
4233
4469
  });
@@ -4239,6 +4475,7 @@ function Textfield(props) {
4239
4475
  disabled,
4240
4476
  errors = [],
4241
4477
  field,
4478
+ readonly,
4242
4479
  value = ''
4243
4480
  } = props;
4244
4481
  const {
@@ -4266,10 +4503,12 @@ function Textfield(props) {
4266
4503
  const {
4267
4504
  formId
4268
4505
  } = useContext(FormContext$1);
4506
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4269
4507
  return jsxs("div", {
4270
4508
  class: formFieldClasses(type$1, {
4271
4509
  errors,
4272
- disabled
4510
+ disabled,
4511
+ readonly
4273
4512
  }),
4274
4513
  children: [jsx(Label, {
4275
4514
  id: prefixId(id, formId),
@@ -4277,34 +4516,50 @@ function Textfield(props) {
4277
4516
  required: required
4278
4517
  }), jsx(InputAdorner, {
4279
4518
  disabled: disabled,
4519
+ readonly: readonly,
4280
4520
  pre: prefixAdorner,
4281
4521
  post: suffixAdorner,
4282
4522
  children: jsx("input", {
4283
4523
  class: "fjs-input",
4284
4524
  disabled: disabled,
4525
+ readOnly: readonly,
4285
4526
  id: prefixId(id, formId),
4286
4527
  onInput: onChange,
4287
4528
  type: "text",
4288
- value: value
4529
+ value: value,
4530
+ "aria-describedby": errorMessageId
4289
4531
  })
4290
4532
  }), jsx(Description, {
4291
4533
  description: description
4292
4534
  }), jsx(Errors, {
4293
- errors: errors
4535
+ errors: errors,
4536
+ id: errorMessageId
4294
4537
  })]
4295
4538
  });
4296
4539
  }
4297
- Textfield.create = (options = {}) => ({
4298
- ...options
4299
- });
4300
- Textfield.type = type$1;
4301
- Textfield.label = 'Text field';
4302
- Textfield.keyed = true;
4303
- Textfield.emptyValue = '';
4304
- Textfield.sanitizeValue = ({
4305
- value
4306
- }) => isArray(value) || isObject(value) ? '' : String(value);
4307
- Textfield.group = 'basic-input';
4540
+ Textfield.config = {
4541
+ type: type$1,
4542
+ keyed: true,
4543
+ label: 'Text field',
4544
+ group: 'basic-input',
4545
+ emptyValue: '',
4546
+ sanitizeValue: ({
4547
+ value
4548
+ }) => {
4549
+ if (isArray(value) || isObject(value)) {
4550
+ return '';
4551
+ }
4552
+
4553
+ // sanitize newlines to spaces
4554
+ if (typeof value === 'string') {
4555
+ return value.replace(/[\r\n\t]/g, ' ');
4556
+ }
4557
+ return String(value);
4558
+ },
4559
+ create: (options = {}) => ({
4560
+ ...options
4561
+ })
4562
+ };
4308
4563
 
4309
4564
  const type = 'textarea';
4310
4565
  function Textarea(props) {
@@ -4312,6 +4567,7 @@ function Textarea(props) {
4312
4567
  disabled,
4313
4568
  errors = [],
4314
4569
  field,
4570
+ readonly,
4315
4571
  value = ''
4316
4572
  } = props;
4317
4573
  const {
@@ -4351,10 +4607,12 @@ function Textarea(props) {
4351
4607
  const {
4352
4608
  formId
4353
4609
  } = useContext(FormContext$1);
4610
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4354
4611
  return jsxs("div", {
4355
4612
  class: formFieldClasses(type, {
4356
4613
  errors,
4357
- disabled
4614
+ disabled,
4615
+ readonly
4358
4616
  }),
4359
4617
  children: [jsx(Label, {
4360
4618
  id: prefixId(id, formId),
@@ -4363,28 +4621,33 @@ function Textarea(props) {
4363
4621
  }), jsx("textarea", {
4364
4622
  class: "fjs-textarea",
4365
4623
  disabled: disabled,
4624
+ readonly: readonly,
4366
4625
  id: prefixId(id, formId),
4367
4626
  onInput: onInput,
4368
4627
  value: value,
4369
- ref: textareaRef
4628
+ ref: textareaRef,
4629
+ "aria-describedby": errorMessageId
4370
4630
  }), jsx(Description, {
4371
4631
  description: description
4372
4632
  }), jsx(Errors, {
4373
- errors: errors
4633
+ errors: errors,
4634
+ id: errorMessageId
4374
4635
  })]
4375
4636
  });
4376
4637
  }
4377
- Textarea.create = (options = {}) => ({
4378
- ...options
4379
- });
4380
- Textarea.type = type;
4381
- Textarea.label = 'Text area';
4382
- Textarea.keyed = true;
4383
- Textarea.emptyValue = '';
4384
- Textarea.sanitizeValue = ({
4385
- value
4386
- }) => isArray(value) || isObject(value) ? '' : String(value);
4387
- Textarea.group = 'basic-input';
4638
+ Textarea.config = {
4639
+ type,
4640
+ keyed: true,
4641
+ label: 'Text area',
4642
+ group: 'basic-input',
4643
+ emptyValue: '',
4644
+ sanitizeValue: ({
4645
+ value
4646
+ }) => isArray(value) || isObject(value) ? '' : String(value),
4647
+ create: (options = {}) => ({
4648
+ ...options
4649
+ })
4650
+ };
4388
4651
 
4389
4652
  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); }
4390
4653
  var ButtonIcon = (({
@@ -4393,10 +4656,11 @@ var ButtonIcon = (({
4393
4656
  }) => /*#__PURE__*/React.createElement("svg", _extends$d({
4394
4657
  xmlns: "http://www.w3.org/2000/svg",
4395
4658
  width: "54",
4396
- height: "54"
4659
+ height: "54",
4660
+ fill: "currentcolor"
4397
4661
  }, props), /*#__PURE__*/React.createElement("path", {
4398
4662
  fillRule: "evenodd",
4399
- 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"
4663
+ 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"
4400
4664
  })));
4401
4665
 
4402
4666
  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); }
@@ -4406,7 +4670,8 @@ var CheckboxIcon = (({
4406
4670
  }) => /*#__PURE__*/React.createElement("svg", _extends$c({
4407
4671
  xmlns: "http://www.w3.org/2000/svg",
4408
4672
  width: "54",
4409
- height: "54"
4673
+ height: "54",
4674
+ fill: "currentcolor"
4410
4675
  }, props), /*#__PURE__*/React.createElement("path", {
4411
4676
  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"
4412
4677
  })));
@@ -4417,18 +4682,35 @@ var ChecklistIcon = (({
4417
4682
  ...props
4418
4683
  }) => /*#__PURE__*/React.createElement("svg", _extends$b({
4419
4684
  xmlns: "http://www.w3.org/2000/svg",
4685
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4420
4686
  width: "54",
4421
4687
  height: "54",
4422
- fill: "none"
4423
- }, props), /*#__PURE__*/React.createElement("path", {
4424
- fillRule: "evenodd",
4425
- clipRule: "evenodd",
4426
- 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",
4427
- fill: "#161616"
4688
+ fill: "currentcolor"
4689
+ }, props), /*#__PURE__*/React.createElement("g", {
4690
+ fillRule: "evenodd"
4691
+ }, /*#__PURE__*/React.createElement("use", {
4692
+ xlinkHref: "#a"
4693
+ }), /*#__PURE__*/React.createElement("use", {
4694
+ xlinkHref: "#a",
4695
+ y: "24"
4696
+ }), /*#__PURE__*/React.createElement("use", {
4697
+ xlinkHref: "#a",
4698
+ y: "12"
4699
+ })), /*#__PURE__*/React.createElement("use", {
4700
+ xlinkHref: "#b"
4701
+ }), /*#__PURE__*/React.createElement("use", {
4702
+ xlinkHref: "#b",
4703
+ y: "12"
4704
+ }), /*#__PURE__*/React.createElement("use", {
4705
+ xlinkHref: "#b",
4706
+ y: "24"
4707
+ }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
4708
+ id: "a",
4709
+ 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"
4428
4710
  }), /*#__PURE__*/React.createElement("path", {
4429
- 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",
4430
- fill: "#161616"
4431
- })));
4711
+ id: "b",
4712
+ d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z"
4713
+ }))));
4432
4714
 
4433
4715
  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); }
4434
4716
  var DatetimeIcon = (({
@@ -4438,20 +4720,15 @@ var DatetimeIcon = (({
4438
4720
  xmlns: "http://www.w3.org/2000/svg",
4439
4721
  width: "54",
4440
4722
  height: "54",
4441
- fill: "none"
4723
+ fill: "currentcolor"
4442
4724
  }, props), /*#__PURE__*/React.createElement("path", {
4443
- fill: "#000",
4444
4725
  fillRule: "evenodd",
4445
- 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",
4446
- clipRule: "evenodd"
4726
+ 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"
4447
4727
  }), /*#__PURE__*/React.createElement("path", {
4448
- fill: "#000",
4449
4728
  d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
4450
4729
  }), /*#__PURE__*/React.createElement("path", {
4451
- fill: "#000",
4452
4730
  fillRule: "evenodd",
4453
- 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",
4454
- clipRule: "evenodd"
4731
+ 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"
4455
4732
  })));
4456
4733
 
4457
4734
  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); }
@@ -4459,18 +4736,15 @@ var TaglistIcon = (({
4459
4736
  styles = {},
4460
4737
  ...props
4461
4738
  }) => /*#__PURE__*/React.createElement("svg", _extends$9({
4739
+ xmlns: "http://www.w3.org/2000/svg",
4462
4740
  width: "54",
4463
4741
  height: "54",
4464
- fill: "none",
4465
- xmlns: "http://www.w3.org/2000/svg"
4742
+ fill: "currentcolor"
4466
4743
  }, props), /*#__PURE__*/React.createElement("path", {
4467
4744
  fillRule: "evenodd",
4468
- clipRule: "evenodd",
4469
- 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",
4470
- fill: "#000"
4745
+ 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"
4471
4746
  }), /*#__PURE__*/React.createElement("path", {
4472
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
4473
- fill: "#505562"
4747
+ d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z"
4474
4748
  })));
4475
4749
 
4476
4750
  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); }
@@ -4482,22 +4756,22 @@ var FormIcon = (({
4482
4756
  width: "54",
4483
4757
  height: "54"
4484
4758
  }, props), /*#__PURE__*/React.createElement("rect", {
4485
- x: "15",
4486
- y: "17",
4487
4759
  width: "24",
4488
4760
  height: "4",
4761
+ x: "15",
4762
+ y: "17",
4489
4763
  rx: "1"
4490
4764
  }), /*#__PURE__*/React.createElement("rect", {
4491
- x: "15",
4492
- y: "25",
4493
4765
  width: "24",
4494
4766
  height: "4",
4767
+ x: "15",
4768
+ y: "25",
4495
4769
  rx: "1"
4496
4770
  }), /*#__PURE__*/React.createElement("rect", {
4497
- x: "15",
4498
- y: "33",
4499
4771
  width: "13",
4500
4772
  height: "4",
4773
+ x: "15",
4774
+ y: "33",
4501
4775
  rx: "1"
4502
4776
  })));
4503
4777
 
@@ -4521,7 +4795,8 @@ var NumberIcon = (({
4521
4795
  }) => /*#__PURE__*/React.createElement("svg", _extends$6({
4522
4796
  xmlns: "http://www.w3.org/2000/svg",
4523
4797
  width: "54",
4524
- height: "54"
4798
+ height: "54",
4799
+ fill: "currentcolor"
4525
4800
  }, props), /*#__PURE__*/React.createElement("path", {
4526
4801
  fillRule: "evenodd",
4527
4802
  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"
@@ -4534,9 +4809,10 @@ var RadioIcon = (({
4534
4809
  }) => /*#__PURE__*/React.createElement("svg", _extends$5({
4535
4810
  xmlns: "http://www.w3.org/2000/svg",
4536
4811
  width: "54",
4537
- height: "54"
4812
+ height: "54",
4813
+ fill: "currentcolor"
4538
4814
  }, props), /*#__PURE__*/React.createElement("path", {
4539
- 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"
4815
+ 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"
4540
4816
  })));
4541
4817
 
4542
4818
  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); }
@@ -4546,7 +4822,8 @@ var SelectIcon = (({
4546
4822
  }) => /*#__PURE__*/React.createElement("svg", _extends$4({
4547
4823
  xmlns: "http://www.w3.org/2000/svg",
4548
4824
  width: "54",
4549
- height: "54"
4825
+ height: "54",
4826
+ fill: "currentcolor"
4550
4827
  }, props), /*#__PURE__*/React.createElement("path", {
4551
4828
  fillRule: "evenodd",
4552
4829
  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"
@@ -4559,9 +4836,10 @@ var TextIcon = (({
4559
4836
  }) => /*#__PURE__*/React.createElement("svg", _extends$3({
4560
4837
  xmlns: "http://www.w3.org/2000/svg",
4561
4838
  width: "54",
4562
- height: "54"
4839
+ height: "54",
4840
+ fill: "currentcolor"
4563
4841
  }, props), /*#__PURE__*/React.createElement("path", {
4564
- 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"
4842
+ 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"
4565
4843
  })));
4566
4844
 
4567
4845
  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); }
@@ -4571,7 +4849,8 @@ var TextfieldIcon = (({
4571
4849
  }) => /*#__PURE__*/React.createElement("svg", _extends$2({
4572
4850
  xmlns: "http://www.w3.org/2000/svg",
4573
4851
  width: "54",
4574
- height: "54"
4852
+ height: "54",
4853
+ fill: "currentcolor"
4575
4854
  }, props), /*#__PURE__*/React.createElement("path", {
4576
4855
  fillRule: "evenodd",
4577
4856
  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"
@@ -4584,10 +4863,11 @@ var TextareaIcon = (({
4584
4863
  }) => /*#__PURE__*/React.createElement("svg", _extends$1({
4585
4864
  xmlns: "http://www.w3.org/2000/svg",
4586
4865
  width: "54",
4587
- height: "54"
4866
+ height: "54",
4867
+ fill: "currentcolor"
4588
4868
  }, props), /*#__PURE__*/React.createElement("path", {
4589
4869
  fillRule: "evenodd",
4590
- 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"
4870
+ 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"
4591
4871
  })));
4592
4872
 
4593
4873
  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); }
@@ -4595,20 +4875,18 @@ var ImageIcon = (({
4595
4875
  styles = {},
4596
4876
  ...props
4597
4877
  }) => /*#__PURE__*/React.createElement("svg", _extends({
4878
+ xmlns: "http://www.w3.org/2000/svg",
4598
4879
  width: "54",
4599
4880
  height: "54",
4600
- fill: "none",
4601
- xmlns: "http://www.w3.org/2000/svg"
4881
+ fill: "currentcolor"
4602
4882
  }, props), /*#__PURE__*/React.createElement("path", {
4603
4883
  fillRule: "evenodd",
4604
- clipRule: "evenodd",
4605
4884
  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",
4606
- fill: "#000"
4885
+ clipRule: "evenodd"
4607
4886
  }), /*#__PURE__*/React.createElement("path", {
4608
4887
  fillRule: "evenodd",
4609
- clipRule: "evenodd",
4610
- 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",
4611
- fill: "#000"
4888
+ 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",
4889
+ clipRule: "evenodd"
4612
4890
  })));
4613
4891
 
4614
4892
  const iconsByType = type => {
@@ -4636,7 +4914,7 @@ class FormFields {
4636
4914
  constructor() {
4637
4915
  this._formFields = {};
4638
4916
  formFields.forEach(formField => {
4639
- this.register(formField.type, formField);
4917
+ this.register(formField.config.type, formField);
4640
4918
  });
4641
4919
  }
4642
4920
  register(type, formField) {
@@ -4857,7 +5135,7 @@ class Form {
4857
5135
  const {
4858
5136
  properties
4859
5137
  } = this._getState();
4860
- if (properties.readOnly) {
5138
+ if (properties.readOnly || properties.disabled) {
4861
5139
  throw new Error('form is read-only');
4862
5140
  }
4863
5141
  const data = this._getSubmitData();
@@ -5086,7 +5364,7 @@ class Form {
5086
5364
  }
5087
5365
  }
5088
5366
 
5089
- const schemaVersion = 8;
5367
+ const schemaVersion = 9;
5090
5368
 
5091
5369
  /**
5092
5370
  * @typedef { import('./types').CreateFormOptions } CreateFormOptions