@bpmn-io/form-js-playground 0.11.1 → 0.12.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.
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormPlayground = {}));
5
- }(this, (function (exports) { 'use strict';
5
+ })(this, (function (exports) { 'use strict';
6
6
 
7
7
  var n$3,
8
8
  l$3,
@@ -737,184 +737,192 @@
737
737
 
738
738
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
739
739
 
740
- var download$1 = {exports: {}};
740
+ var downloadExports = {};
741
+ var download$1 = {
742
+ get exports(){ return downloadExports; },
743
+ set exports(v){ downloadExports = v; },
744
+ };
741
745
 
742
746
  (function (module, exports) {
743
- //download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
744
- // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
745
- // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
746
- // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
747
- // v4 adds AMD/UMD, commonJS, and plain browser support
748
- // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
749
- // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
750
- // https://github.com/rndme/download
751
-
752
- (function (root, factory) {
753
- {
754
- // Node. Does not work with strict CommonJS, but
755
- // only CommonJS-like environments that support module.exports,
756
- // like Node.
757
- module.exports = factory();
758
- }
759
- })(commonjsGlobal, function () {
760
- return function download(data, strFileName, strMimeType) {
761
- var self = window,
762
- // this script is only for browsers anyway...
763
- defaultMime = "application/octet-stream",
764
- // this default mime also triggers iframe downloads
765
- mimeType = strMimeType || defaultMime,
766
- payload = data,
767
- url = !strFileName && !strMimeType && payload,
768
- anchor = document.createElement("a"),
769
- toString = function (a) {
770
- return String(a);
771
- },
772
- myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
773
- fileName = strFileName || "download",
774
- blob,
775
- reader;
776
- myBlob = myBlob.call ? myBlob.bind(self) : Blob;
777
- if (String(this) === "true") {
778
- //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
779
- payload = [payload, mimeType];
780
- mimeType = payload[0];
781
- payload = payload[1];
782
- }
783
- if (url && url.length < 2048) {
784
- // if no filename and no mime, assume a url was passed as the only argument
785
- fileName = url.split("/").pop().split("?")[0];
786
- anchor.href = url; // assign href prop to temp anchor
787
- if (anchor.href.indexOf(url) !== -1) {
788
- // if the browser determines that it's a potentially valid url path:
789
- var ajax = new XMLHttpRequest();
790
- ajax.open("GET", url, true);
791
- ajax.responseType = 'blob';
792
- ajax.onload = function (e) {
793
- download(e.target.response, fileName, defaultMime);
794
- };
795
- setTimeout(function () {
796
- ajax.send();
797
- }, 0); // allows setting custom ajax headers using the return:
798
- return ajax;
799
- } // end if valid url?
800
- } // end if url?
801
-
802
- //go ahead and download dataURLs right away
803
- if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)) {
804
- if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
805
- payload = dataUrlToBlob(payload);
806
- mimeType = payload.type || defaultMime;
807
- } else {
808
- return navigator.msSaveBlob ?
809
- // IE10 can't do a[download], only Blobs:
810
- navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : saver(payload); // everyone else can save dataURLs un-processed
811
- }
812
- } else {
813
- //not data url, is it a string with special needs?
814
- if (/([\x80-\xff])/.test(payload)) {
815
- var i = 0,
816
- tempUiArr = new Uint8Array(payload.length),
817
- mx = tempUiArr.length;
818
- for (i; i < mx; ++i) tempUiArr[i] = payload.charCodeAt(i);
819
- payload = new myBlob([tempUiArr], {
820
- type: mimeType
821
- });
822
- }
823
- }
824
- blob = payload instanceof myBlob ? payload : new myBlob([payload], {
825
- type: mimeType
826
- });
827
- function dataUrlToBlob(strUrl) {
828
- var parts = strUrl.split(/[:;,]/),
829
- type = parts[1],
830
- decoder = parts[2] == "base64" ? atob : decodeURIComponent,
831
- binData = decoder(parts.pop()),
832
- mx = binData.length,
833
- i = 0,
834
- uiArr = new Uint8Array(mx);
835
- for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
836
- return new myBlob([uiArr], {
837
- type: type
838
- });
839
- }
840
- function saver(url, winMode) {
841
- if ('download' in anchor) {
842
- //html5 A[download]
843
- anchor.href = url;
844
- anchor.setAttribute("download", fileName);
845
- anchor.className = "download-js-link";
846
- anchor.innerHTML = "downloading...";
847
- anchor.style.display = "none";
848
- document.body.appendChild(anchor);
849
- setTimeout(function () {
850
- anchor.click();
851
- document.body.removeChild(anchor);
852
- if (winMode === true) {
853
- setTimeout(function () {
854
- self.URL.revokeObjectURL(anchor.href);
855
- }, 250);
856
- }
857
- }, 66);
858
- return true;
859
- }
860
-
861
- // handle non-a[download] safari as best we can:
862
- if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
863
- if (/^data:/.test(url)) url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
864
- if (!window.open(url)) {
865
- // popup blocked, offer direct download:
866
- if (confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")) {
867
- location.href = url;
868
- }
869
- }
870
- return true;
871
- }
872
-
873
- //do iframe dataURL download (old ch+FF):
874
- var f = document.createElement("iframe");
875
- document.body.appendChild(f);
876
- if (!winMode && /^data:/.test(url)) {
877
- // force a mime that will download:
878
- url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
879
- }
880
- f.src = url;
881
- setTimeout(function () {
882
- document.body.removeChild(f);
883
- }, 333);
884
- } //end saver
885
-
886
- if (navigator.msSaveBlob) {
887
- // IE10+ : (has Blob, but not a[download] or URL)
888
- return navigator.msSaveBlob(blob, fileName);
889
- }
890
- if (self.URL) {
891
- // simple fast and modern way using Blob and URL:
892
- saver(self.URL.createObjectURL(blob), true);
893
- } else {
894
- // handle non-Blob()+non-URL browsers:
895
- if (typeof blob === "string" || blob.constructor === toString) {
896
- try {
897
- return saver("data:" + mimeType + ";base64," + self.btoa(blob));
898
- } catch (y) {
899
- return saver("data:" + mimeType + "," + encodeURIComponent(blob));
900
- }
901
- }
902
-
903
- // Blob but not URL support:
904
- reader = new FileReader();
905
- reader.onload = function (e) {
906
- saver(this.result);
907
- };
908
- reader.readAsDataURL(blob);
909
- }
910
- return true;
911
- }; /* end download() */
912
- });
913
- }(download$1));
914
-
915
- var download = download$1.exports;
916
-
917
- var classnames = {exports: {}};
747
+ //download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
748
+ // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
749
+ // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
750
+ // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
751
+ // v4 adds AMD/UMD, commonJS, and plain browser support
752
+ // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
753
+ // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
754
+ // https://github.com/rndme/download
755
+
756
+ (function (root, factory) {
757
+ {
758
+ // Node. Does not work with strict CommonJS, but
759
+ // only CommonJS-like environments that support module.exports,
760
+ // like Node.
761
+ module.exports = factory();
762
+ }
763
+ })(commonjsGlobal, function () {
764
+ return function download(data, strFileName, strMimeType) {
765
+ var self = window,
766
+ // this script is only for browsers anyway...
767
+ defaultMime = "application/octet-stream",
768
+ // this default mime also triggers iframe downloads
769
+ mimeType = strMimeType || defaultMime,
770
+ payload = data,
771
+ url = !strFileName && !strMimeType && payload,
772
+ anchor = document.createElement("a"),
773
+ toString = function (a) {
774
+ return String(a);
775
+ },
776
+ myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
777
+ fileName = strFileName || "download",
778
+ blob,
779
+ reader;
780
+ myBlob = myBlob.call ? myBlob.bind(self) : Blob;
781
+ if (String(this) === "true") {
782
+ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
783
+ payload = [payload, mimeType];
784
+ mimeType = payload[0];
785
+ payload = payload[1];
786
+ }
787
+ if (url && url.length < 2048) {
788
+ // if no filename and no mime, assume a url was passed as the only argument
789
+ fileName = url.split("/").pop().split("?")[0];
790
+ anchor.href = url; // assign href prop to temp anchor
791
+ if (anchor.href.indexOf(url) !== -1) {
792
+ // if the browser determines that it's a potentially valid url path:
793
+ var ajax = new XMLHttpRequest();
794
+ ajax.open("GET", url, true);
795
+ ajax.responseType = 'blob';
796
+ ajax.onload = function (e) {
797
+ download(e.target.response, fileName, defaultMime);
798
+ };
799
+ setTimeout(function () {
800
+ ajax.send();
801
+ }, 0); // allows setting custom ajax headers using the return:
802
+ return ajax;
803
+ } // end if valid url?
804
+ } // end if url?
805
+
806
+ //go ahead and download dataURLs right away
807
+ if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)) {
808
+ if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
809
+ payload = dataUrlToBlob(payload);
810
+ mimeType = payload.type || defaultMime;
811
+ } else {
812
+ return navigator.msSaveBlob ?
813
+ // IE10 can't do a[download], only Blobs:
814
+ navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : saver(payload); // everyone else can save dataURLs un-processed
815
+ }
816
+ } else {
817
+ //not data url, is it a string with special needs?
818
+ if (/([\x80-\xff])/.test(payload)) {
819
+ var i = 0,
820
+ tempUiArr = new Uint8Array(payload.length),
821
+ mx = tempUiArr.length;
822
+ for (i; i < mx; ++i) tempUiArr[i] = payload.charCodeAt(i);
823
+ payload = new myBlob([tempUiArr], {
824
+ type: mimeType
825
+ });
826
+ }
827
+ }
828
+ blob = payload instanceof myBlob ? payload : new myBlob([payload], {
829
+ type: mimeType
830
+ });
831
+ function dataUrlToBlob(strUrl) {
832
+ var parts = strUrl.split(/[:;,]/),
833
+ type = parts[1],
834
+ decoder = parts[2] == "base64" ? atob : decodeURIComponent,
835
+ binData = decoder(parts.pop()),
836
+ mx = binData.length,
837
+ i = 0,
838
+ uiArr = new Uint8Array(mx);
839
+ for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
840
+ return new myBlob([uiArr], {
841
+ type: type
842
+ });
843
+ }
844
+ function saver(url, winMode) {
845
+ if ('download' in anchor) {
846
+ //html5 A[download]
847
+ anchor.href = url;
848
+ anchor.setAttribute("download", fileName);
849
+ anchor.className = "download-js-link";
850
+ anchor.innerHTML = "downloading...";
851
+ anchor.style.display = "none";
852
+ document.body.appendChild(anchor);
853
+ setTimeout(function () {
854
+ anchor.click();
855
+ document.body.removeChild(anchor);
856
+ if (winMode === true) {
857
+ setTimeout(function () {
858
+ self.URL.revokeObjectURL(anchor.href);
859
+ }, 250);
860
+ }
861
+ }, 66);
862
+ return true;
863
+ }
864
+
865
+ // handle non-a[download] safari as best we can:
866
+ if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
867
+ if (/^data:/.test(url)) url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
868
+ if (!window.open(url)) {
869
+ // popup blocked, offer direct download:
870
+ if (confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")) {
871
+ location.href = url;
872
+ }
873
+ }
874
+ return true;
875
+ }
876
+
877
+ //do iframe dataURL download (old ch+FF):
878
+ var f = document.createElement("iframe");
879
+ document.body.appendChild(f);
880
+ if (!winMode && /^data:/.test(url)) {
881
+ // force a mime that will download:
882
+ url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
883
+ }
884
+ f.src = url;
885
+ setTimeout(function () {
886
+ document.body.removeChild(f);
887
+ }, 333);
888
+ } //end saver
889
+
890
+ if (navigator.msSaveBlob) {
891
+ // IE10+ : (has Blob, but not a[download] or URL)
892
+ return navigator.msSaveBlob(blob, fileName);
893
+ }
894
+ if (self.URL) {
895
+ // simple fast and modern way using Blob and URL:
896
+ saver(self.URL.createObjectURL(blob), true);
897
+ } else {
898
+ // handle non-Blob()+non-URL browsers:
899
+ if (typeof blob === "string" || blob.constructor === toString) {
900
+ try {
901
+ return saver("data:" + mimeType + ";base64," + self.btoa(blob));
902
+ } catch (y) {
903
+ return saver("data:" + mimeType + "," + encodeURIComponent(blob));
904
+ }
905
+ }
906
+
907
+ // Blob but not URL support:
908
+ reader = new FileReader();
909
+ reader.onload = function (e) {
910
+ saver(this.result);
911
+ };
912
+ reader.readAsDataURL(blob);
913
+ }
914
+ return true;
915
+ }; /* end download() */
916
+ });
917
+ } (download$1));
918
+
919
+ var download = downloadExports;
920
+
921
+ var classnamesExports = {};
922
+ var classnames = {
923
+ get exports(){ return classnamesExports; },
924
+ set exports(v){ classnamesExports = v; },
925
+ };
918
926
 
919
927
  /*!
920
928
  Copyright (c) 2018 Jed Watson.
@@ -923,50 +931,50 @@
923
931
  */
924
932
 
925
933
  (function (module) {
926
- /* global define */
927
-
928
- (function () {
929
-
930
- var hasOwn = {}.hasOwnProperty;
931
- function classNames() {
932
- var classes = [];
933
- for (var i = 0; i < arguments.length; i++) {
934
- var arg = arguments[i];
935
- if (!arg) continue;
936
- var argType = typeof arg;
937
- if (argType === 'string' || argType === 'number') {
938
- classes.push(arg);
939
- } else if (Array.isArray(arg)) {
940
- if (arg.length) {
941
- var inner = classNames.apply(null, arg);
942
- if (inner) {
943
- classes.push(inner);
944
- }
945
- }
946
- } else if (argType === 'object') {
947
- if (arg.toString === Object.prototype.toString) {
948
- for (var key in arg) {
949
- if (hasOwn.call(arg, key) && arg[key]) {
950
- classes.push(key);
951
- }
952
- }
953
- } else {
954
- classes.push(arg.toString());
955
- }
956
- }
957
- }
958
- return classes.join(' ');
959
- }
960
- if (module.exports) {
961
- classNames.default = classNames;
962
- module.exports = classNames;
963
- } else {
964
- window.classNames = classNames;
965
- }
966
- })();
967
- }(classnames));
968
-
969
- var classNames = classnames.exports;
934
+ /* global define */
935
+
936
+ (function () {
937
+
938
+ var hasOwn = {}.hasOwnProperty;
939
+ function classNames() {
940
+ var classes = [];
941
+ for (var i = 0; i < arguments.length; i++) {
942
+ var arg = arguments[i];
943
+ if (!arg) continue;
944
+ var argType = typeof arg;
945
+ if (argType === 'string' || argType === 'number') {
946
+ classes.push(arg);
947
+ } else if (Array.isArray(arg)) {
948
+ if (arg.length) {
949
+ var inner = classNames.apply(null, arg);
950
+ if (inner) {
951
+ classes.push(inner);
952
+ }
953
+ }
954
+ } else if (argType === 'object') {
955
+ if (arg.toString === Object.prototype.toString) {
956
+ for (var key in arg) {
957
+ if (hasOwn.call(arg, key) && arg[key]) {
958
+ classes.push(key);
959
+ }
960
+ }
961
+ } else {
962
+ classes.push(arg.toString());
963
+ }
964
+ }
965
+ }
966
+ return classes.join(' ');
967
+ }
968
+ if (module.exports) {
969
+ classNames.default = classNames;
970
+ module.exports = classNames;
971
+ } else {
972
+ window.classNames = classNames;
973
+ }
974
+ })();
975
+ } (classnames));
976
+
977
+ var classNames = classnamesExports;
970
978
 
971
979
  function createCommonjsModule(fn, module) {
972
980
  return module = {
@@ -1156,6 +1164,26 @@
1156
1164
  return nativeHasOwnProperty$1.call(target, key);
1157
1165
  }
1158
1166
 
1167
+ /**
1168
+ * Find element index in collection.
1169
+ *
1170
+ * @param {Array|Object} collection
1171
+ * @param {Function} matcher
1172
+ *
1173
+ * @return {Object}
1174
+ */
1175
+ function findIndex(collection, matcher) {
1176
+ matcher = toMatcher$1(matcher);
1177
+ let idx = isArray$3(collection) ? -1 : undefined;
1178
+ forEach$1(collection, function (val, key) {
1179
+ if (matcher(val, key)) {
1180
+ idx = key;
1181
+ return false;
1182
+ }
1183
+ });
1184
+ return idx;
1185
+ }
1186
+
1159
1187
  /**
1160
1188
  * Iterate over collection; returning something
1161
1189
  * (non-undefined) will stop iteration.
@@ -1181,6 +1209,11 @@
1181
1209
  }
1182
1210
  }
1183
1211
  }
1212
+ function toMatcher$1(matcher) {
1213
+ return isFunction$1(matcher) ? matcher : e => {
1214
+ return e === matcher;
1215
+ };
1216
+ }
1184
1217
  function identity$1(arg) {
1185
1218
  return arg;
1186
1219
  }
@@ -1221,7 +1254,7 @@
1221
1254
  * @param {(string|number)[]} path The path to the nested value.
1222
1255
  * @param {any} value The value to set.
1223
1256
  */
1224
- function set$1(target, path, value) {
1257
+ function set$2(target, path, value) {
1225
1258
  let currentTarget = target;
1226
1259
  forEach$1(path, function (key, idx) {
1227
1260
  if (typeof key !== 'number' && typeof key !== 'string') {
@@ -8056,12 +8089,12 @@
8056
8089
  /// The default maximum length of a `TreeBuffer` node.
8057
8090
  const DefaultBufferLength = 1024;
8058
8091
  let nextPropID = 0;
8059
- class Range$2 {
8092
+ let Range$2 = class Range {
8060
8093
  constructor(from, to) {
8061
8094
  this.from = from;
8062
8095
  this.to = to;
8063
8096
  }
8064
- }
8097
+ };
8065
8098
  /// Each [node type](#common.NodeType) or [individual tree](#common.Tree)
8066
8099
  /// can have metadata associated with it in props. Instances of this
8067
8100
  /// class represent prop names.
@@ -12039,7 +12072,7 @@
12039
12072
  [FilterExpression$1]: 'FilterExpression',
12040
12073
  [ArithmeticExpression$1]: 'ArithmeticExpression'
12041
12074
  };
12042
- class ValueProducer$1 {
12075
+ let ValueProducer$1 = class ValueProducer {
12043
12076
  /**
12044
12077
  * @param { Function } fn
12045
12078
  */
@@ -12058,7 +12091,7 @@
12058
12091
  static of(fn) {
12059
12092
  return new ValueProducer$1(fn);
12060
12093
  }
12061
- }
12094
+ };
12062
12095
  const dateTimeLiterals$1 = {
12063
12096
  'date and time': 1,
12064
12097
  'date': 1,
@@ -12066,7 +12099,7 @@
12066
12099
  'duration': 1
12067
12100
  };
12068
12101
  const dateTimeIdentifiers$1 = Object.keys(dateTimeLiterals$1);
12069
- class Variables$1 {
12102
+ let Variables$1 = class Variables {
12070
12103
  constructor({
12071
12104
  name = 'Expressions',
12072
12105
  tokens = [],
@@ -12264,7 +12297,7 @@
12264
12297
  raw
12265
12298
  });
12266
12299
  }
12267
- }
12300
+ };
12268
12301
 
12269
12302
  /**
12270
12303
  * @param { string } name
@@ -12749,11 +12782,11 @@
12749
12782
  }
12750
12783
  return null;
12751
12784
  }
12752
- class Range$1 {
12785
+ let Range$1 = class Range {
12753
12786
  constructor(props) {
12754
12787
  Object.assign(this, props);
12755
12788
  }
12756
- }
12789
+ };
12757
12790
  function isNumber$1(obj) {
12758
12791
  return typeof obj === 'number';
12759
12792
  }
@@ -12839,7 +12872,7 @@
12839
12872
  if (arguments.length !== 1) {
12840
12873
  return null;
12841
12874
  }
12842
- return toString$1(from);
12875
+ return toString$2(from);
12843
12876
  }, ['any']),
12844
12877
  // date(from) => date string
12845
12878
  // date(from) => date and time
@@ -13365,17 +13398,17 @@
13365
13398
  }
13366
13399
  function toKeyString(key) {
13367
13400
  if (typeof key === 'string' && /\W/.test(key)) {
13368
- return toString$1(key, true);
13401
+ return toString$2(key, true);
13369
13402
  }
13370
13403
  return key;
13371
13404
  }
13372
13405
  function toDeepString(obj) {
13373
- return toString$1(obj, true);
13406
+ return toString$2(obj, true);
13374
13407
  }
13375
13408
  function escapeStr(str) {
13376
13409
  return str.replace(/("|\\)/g, '\\$1');
13377
13410
  }
13378
- function toString$1(obj, wrap = false) {
13411
+ function toString$2(obj, wrap = false) {
13379
13412
  var _a, _b, _c, _d;
13380
13413
  const type = getType(obj);
13381
13414
  if (type === 'nil') {
@@ -18879,7 +18912,7 @@
18879
18912
  }
18880
18913
  }
18881
18914
  Validator.$inject = [];
18882
- class FormFieldRegistry$1 {
18915
+ let FormFieldRegistry$1 = class FormFieldRegistry {
18883
18916
  constructor(eventBus) {
18884
18917
  this._eventBus = eventBus;
18885
18918
  this._formFields = {};
@@ -18925,7 +18958,7 @@
18925
18958
  this._ids.clear();
18926
18959
  this._keys.clear();
18927
18960
  }
18928
- }
18961
+ };
18929
18962
  FormFieldRegistry$1.$inject = ['eventBus'];
18930
18963
 
18931
18964
  /**
@@ -18965,7 +18998,7 @@
18965
18998
  } while (cursor.next());
18966
18999
  return Array.from(variables);
18967
19000
  }
18968
- function isExpression$2(value) {
19001
+ function isExpression$1(value) {
18969
19002
  return isString$3(value) && value.startsWith('=');
18970
19003
  }
18971
19004
 
@@ -19016,7 +19049,10 @@
19016
19049
  [VALUES_SOURCES.INPUT]: ['valuesKey']
19017
19050
  };
19018
19051
  const VALUES_SOURCES_DEFAULTS = {
19019
- [VALUES_SOURCES.STATIC]: [],
19052
+ [VALUES_SOURCES.STATIC]: [{
19053
+ label: 'Value',
19054
+ value: 'value'
19055
+ }],
19020
19056
  [VALUES_SOURCES.INPUT]: ''
19021
19057
  };
19022
19058
 
@@ -19125,13 +19161,7 @@
19125
19161
  // remove duplicates
19126
19162
  return Array.from(new Set(variables));
19127
19163
  }
19128
-
19129
- // helper ///////////////
19130
-
19131
- function isExpression$1(value) {
19132
- return isString$3(value) && value.startsWith('=');
19133
- }
19134
- class Importer$1 {
19164
+ let Importer$1 = class Importer {
19135
19165
  /**
19136
19166
  * @constructor
19137
19167
  * @param { import('../core').FormFieldRegistry } formFieldRegistry
@@ -19260,7 +19290,7 @@
19260
19290
  return initializedData;
19261
19291
  }, data);
19262
19292
  }
19263
- }
19293
+ };
19264
19294
  Importer$1.$inject = ['formFieldRegistry', 'formFields'];
19265
19295
  var importModule$1 = {
19266
19296
  importer: ['type', Importer$1]
@@ -19439,15 +19469,14 @@
19439
19469
  })
19440
19470
  });
19441
19471
  }
19442
- Button.create = function (options = {}) {
19443
- return {
19444
- action: 'submit',
19445
- ...options
19446
- };
19447
- };
19472
+ Button.create = (options = {}) => ({
19473
+ action: 'submit',
19474
+ ...options
19475
+ });
19448
19476
  Button.type = type$b;
19449
19477
  Button.label = 'Button';
19450
19478
  Button.keyed = true;
19479
+ Button.group = 'action';
19451
19480
  const FormRenderContext = D$1({
19452
19481
  Empty: props => {
19453
19482
  return null;
@@ -19459,6 +19488,7 @@
19459
19488
  return props.children;
19460
19489
  }
19461
19490
  });
19491
+ var FormRenderContext$1 = FormRenderContext;
19462
19492
 
19463
19493
  /**
19464
19494
  * @param {string} type
@@ -19471,6 +19501,7 @@
19471
19501
  getService: getService$2,
19472
19502
  formId: null
19473
19503
  });
19504
+ var FormContext$1 = FormContext;
19474
19505
  function Description$2(props) {
19475
19506
  const {
19476
19507
  description
@@ -19542,7 +19573,7 @@
19542
19573
  };
19543
19574
  const {
19544
19575
  formId
19545
- } = F$1(FormContext);
19576
+ } = F$1(FormContext$1);
19546
19577
  return e$1("div", {
19547
19578
  class: classNames(formFieldClasses(type$a, {
19548
19579
  errors,
@@ -19569,11 +19600,9 @@
19569
19600
  })]
19570
19601
  });
19571
19602
  }
19572
- Checkbox$1.create = function (options = {}) {
19573
- return {
19574
- ...options
19575
- };
19576
- };
19603
+ Checkbox$1.create = (options = {}) => ({
19604
+ ...options
19605
+ });
19577
19606
  Checkbox$1.type = type$a;
19578
19607
  Checkbox$1.label = 'Checkbox';
19579
19608
  Checkbox$1.keyed = true;
@@ -19581,10 +19610,11 @@
19581
19610
  Checkbox$1.sanitizeValue = ({
19582
19611
  value
19583
19612
  }) => value === true;
19613
+ Checkbox$1.group = 'selection';
19584
19614
  function useService$2(type, strict) {
19585
19615
  const {
19586
19616
  getService
19587
- } = F$1(FormContext);
19617
+ } = F$1(FormContext$1);
19588
19618
  return getService(type, strict);
19589
19619
  }
19590
19620
 
@@ -19680,8 +19710,8 @@
19680
19710
  if (is12h) {
19681
19711
  const isPM = workingString.includes('pm');
19682
19712
  const digits = workingString.match(/\d+/g);
19683
- const displayHour = parseInt(digits?.[0]);
19684
- const minute = parseInt(digits?.[1]) || 0;
19713
+ const displayHour = parseInt(digits && digits[0]);
19714
+ const minute = parseInt(digits && digits[1]) || 0;
19685
19715
  const isValidDisplayHour = isNumber$3(displayHour) && displayHour >= 1 && displayHour <= 12;
19686
19716
  const isValidMinute = minute >= 0 && minute <= 59;
19687
19717
  if (!isValidDisplayHour || !isValidMinute) return null;
@@ -19689,8 +19719,8 @@
19689
19719
  return hour * 60 + minute;
19690
19720
  } else {
19691
19721
  const digits = workingString.match(/\d+/g);
19692
- const hour = parseInt(digits?.[0]);
19693
- const minute = parseInt(digits?.[1]);
19722
+ const hour = parseInt(digits && digits[0]);
19723
+ const minute = parseInt(digits && digits[1]);
19694
19724
  const isValidHour = isNumber$3(hour) && hour >= 0 && hour <= 23;
19695
19725
  const isValidMinute = isNumber$3(minute) && minute >= 0 && minute <= 59;
19696
19726
  if (!isValidHour || !isValidMinute) return null;
@@ -19891,7 +19921,7 @@
19891
19921
  } = useValuesAsync(field);
19892
19922
  const {
19893
19923
  formId
19894
- } = F$1(FormContext);
19924
+ } = F$1(FormContext$1);
19895
19925
  return e$1("div", {
19896
19926
  class: classNames(formFieldClasses(type$9, {
19897
19927
  errors,
@@ -19923,13 +19953,18 @@
19923
19953
  })]
19924
19954
  });
19925
19955
  }
19926
- Checklist.create = function (options = {}) {
19927
- if (options.valuesKey) return options;
19928
- return {
19929
- values: [{
19956
+ Checklist.create = (options = {}) => {
19957
+ const defaults = {};
19958
+
19959
+ // provide default values if valuesKey isn't set
19960
+ if (!options.valuesKey) {
19961
+ defaults.values = [{
19930
19962
  label: 'Value',
19931
19963
  value: 'value'
19932
- }],
19964
+ }];
19965
+ }
19966
+ return {
19967
+ ...defaults,
19933
19968
  ...options
19934
19969
  };
19935
19970
  };
@@ -19938,6 +19973,7 @@
19938
19973
  Checklist.keyed = true;
19939
19974
  Checklist.emptyValue = [];
19940
19975
  Checklist.sanitizeValue = sanitizeMultiSelectValue;
19976
+ Checklist.group = 'selection';
19941
19977
 
19942
19978
  /**
19943
19979
  * Check if condition is met with given variables.
@@ -19980,7 +20016,7 @@
19980
20016
  const {
19981
20017
  Element,
19982
20018
  Empty
19983
- } = F$1(FormRenderContext);
20019
+ } = F$1(FormRenderContext$1);
19984
20020
  const FormFieldComponent = formFields.get(field.type);
19985
20021
  if (!FormFieldComponent) {
19986
20022
  throw new Error(`cannot render field <${field.type}>`);
@@ -20011,7 +20047,7 @@
20011
20047
  const {
20012
20048
  Children,
20013
20049
  Empty
20014
- } = F$1(FormRenderContext);
20050
+ } = F$1(FormRenderContext$1);
20015
20051
  const {
20016
20052
  field
20017
20053
  } = props;
@@ -20030,16 +20066,16 @@
20030
20066
  }), components.length ? null : e$1(Empty, {})]
20031
20067
  });
20032
20068
  }
20033
- Default.create = function (options = {}) {
20034
- return {
20035
- components: [],
20036
- ...options
20037
- };
20038
- };
20069
+ Default.create = (options = {}) => ({
20070
+ components: [],
20071
+ ...options
20072
+ });
20039
20073
  Default.type = 'default';
20040
20074
  Default.keyed = false;
20041
- function _extends$h() {
20042
- _extends$h = Object.assign ? Object.assign.bind() : function (target) {
20075
+ Default.label = null;
20076
+ Default.group = null;
20077
+ function _extends$j() {
20078
+ _extends$j = Object.assign ? Object.assign.bind() : function (target) {
20043
20079
  for (var i = 1; i < arguments.length; i++) {
20044
20080
  var source = arguments[i];
20045
20081
  for (var key in source) {
@@ -20050,12 +20086,12 @@
20050
20086
  }
20051
20087
  return target;
20052
20088
  };
20053
- return _extends$h.apply(this, arguments);
20089
+ return _extends$j.apply(this, arguments);
20054
20090
  }
20055
20091
  var CalendarIcon = ({
20056
20092
  styles = {},
20057
20093
  ...props
20058
- }) => /*#__PURE__*/React.createElement("svg", _extends$h({
20094
+ }) => /*#__PURE__*/React.createElement("svg", _extends$j({
20059
20095
  width: "14",
20060
20096
  height: "15",
20061
20097
  viewBox: "0 0 28 30",
@@ -20064,8 +20100,8 @@
20064
20100
  }, props), /*#__PURE__*/React.createElement("path", {
20065
20101
  fillRule: "evenodd",
20066
20102
  clipRule: "evenodd",
20067
- d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z",
20068
- fill: "currentColor"
20103
+ fill: "currentColor",
20104
+ d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z"
20069
20105
  }));
20070
20106
  function InputAdorner(props) {
20071
20107
  const {
@@ -20077,10 +20113,10 @@
20077
20113
  disabled,
20078
20114
  hasErrors
20079
20115
  } = props;
20080
- const onAdornmentClick = () => inputRef?.current?.focus();
20116
+ const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
20081
20117
  return e$1("div", {
20082
20118
  class: classNames('fjs-input-group', {
20083
- 'disabled': disabled
20119
+ 'fjs-disabled': disabled
20084
20120
  }, {
20085
20121
  'hasErrors': hasErrors
20086
20122
  }),
@@ -20133,14 +20169,10 @@
20133
20169
  dateFormat: 'm/d/Y',
20134
20170
  static: true,
20135
20171
  clickOpens: false,
20172
+ // TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
20173
+ minDate: disallowPassedDates ? 'today' : '01/01/1900',
20136
20174
  errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
20137
20175
  };
20138
- if (disallowPassedDates) {
20139
- config = {
20140
- ...config,
20141
- minDate: 'today'
20142
- };
20143
- }
20144
20176
  const instance = flatpickr(dateInputRef.current, config);
20145
20177
  setFlatpickrInstance(instance);
20146
20178
  const onCalendarFocusOut = e => {
@@ -20224,7 +20256,7 @@
20224
20256
  class: 'fjs-input',
20225
20257
  disabled: disabled,
20226
20258
  placeholder: "mm/dd/yyyy",
20227
- autoComplete: "false",
20259
+ autoComplete: "off",
20228
20260
  onFocus: onInputFocus,
20229
20261
  onKeyDown: onInputKeyDown,
20230
20262
  onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
@@ -20236,8 +20268,8 @@
20236
20268
  })]
20237
20269
  });
20238
20270
  }
20239
- function _extends$g() {
20240
- _extends$g = Object.assign ? Object.assign.bind() : function (target) {
20271
+ function _extends$i() {
20272
+ _extends$i = Object.assign ? Object.assign.bind() : function (target) {
20241
20273
  for (var i = 1; i < arguments.length; i++) {
20242
20274
  var source = arguments[i];
20243
20275
  for (var key in source) {
@@ -20248,25 +20280,25 @@
20248
20280
  }
20249
20281
  return target;
20250
20282
  };
20251
- return _extends$g.apply(this, arguments);
20283
+ return _extends$i.apply(this, arguments);
20252
20284
  }
20253
20285
  var ClockIcon = ({
20254
20286
  styles = {},
20255
20287
  ...props
20256
- }) => /*#__PURE__*/React.createElement("svg", _extends$g({
20288
+ }) => /*#__PURE__*/React.createElement("svg", _extends$i({
20257
20289
  width: "16",
20258
20290
  height: "16",
20259
20291
  viewBox: "0 0 28 29",
20260
20292
  fill: "none",
20261
20293
  xmlns: "http://www.w3.org/2000/svg"
20262
20294
  }, props), /*#__PURE__*/React.createElement("path", {
20263
- d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
20264
- fill: "currentColor"
20295
+ fill: "currentColor",
20296
+ d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z"
20265
20297
  }), /*#__PURE__*/React.createElement("path", {
20266
20298
  fillRule: "evenodd",
20267
20299
  clipRule: "evenodd",
20268
- d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z",
20269
- fill: "currentColor"
20300
+ fill: "currentColor",
20301
+ d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z"
20270
20302
  }));
20271
20303
  function useKeyDownAction(targetKey, action, listenerElement = window) {
20272
20304
  function downHandler({
@@ -20287,7 +20319,7 @@
20287
20319
  const NOOP = () => {};
20288
20320
  function DropdownList(props) {
20289
20321
  const {
20290
- keyEventsListener = window,
20322
+ listenerElement = window,
20291
20323
  values = [],
20292
20324
  getLabel = DEFAULT_LABEL_GETTER,
20293
20325
  onValueSelected = NOOP,
@@ -20317,18 +20349,18 @@
20317
20349
  changeFocusedValueIndex(-1);
20318
20350
  setMouseControl(false);
20319
20351
  }
20320
- }, keyEventsListener);
20352
+ }, listenerElement);
20321
20353
  useKeyDownAction('ArrowDown', () => {
20322
20354
  if (values.length) {
20323
20355
  changeFocusedValueIndex(1);
20324
20356
  setMouseControl(false);
20325
20357
  }
20326
- }, keyEventsListener);
20358
+ }, listenerElement);
20327
20359
  useKeyDownAction('Enter', () => {
20328
20360
  if (focusedItem) {
20329
20361
  onValueSelected(focusedItem);
20330
20362
  }
20331
- }, keyEventsListener);
20363
+ }, listenerElement);
20332
20364
  y(() => {
20333
20365
  const individualEntries = dropdownContainer.current.children;
20334
20366
  if (individualEntries.length && !mouseControl) {
@@ -20500,7 +20532,7 @@
20500
20532
  value: rawValue,
20501
20533
  disabled: disabled,
20502
20534
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
20503
- autoComplete: "false",
20535
+ autoComplete: "off",
20504
20536
  onFocus: () => useDropdown && setDropdownIsOpen(true),
20505
20537
  onClick: () => useDropdown && setDropdownIsOpen(true)
20506
20538
 
@@ -20551,7 +20583,7 @@
20551
20583
  } = validate;
20552
20584
  const {
20553
20585
  formId
20554
- } = F$1(FormContext);
20586
+ } = F$1(FormContext$1);
20555
20587
  const getNullDateTime = () => ({
20556
20588
  date: new Date(Date.parse(null)),
20557
20589
  time: null
@@ -20692,12 +20724,12 @@
20692
20724
  })]
20693
20725
  });
20694
20726
  }
20695
- Datetime.create = function (options = {}) {
20696
- const newOptions = {};
20697
- set$1(newOptions, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
20698
- set$1(newOptions, DATE_LABEL_PATH, 'Date');
20727
+ Datetime.create = (options = {}) => {
20728
+ const defaults = {};
20729
+ set$2(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
20730
+ set$2(defaults, DATE_LABEL_PATH, 'Date');
20699
20731
  return {
20700
- ...newOptions,
20732
+ ...defaults,
20701
20733
  ...options
20702
20734
  };
20703
20735
  };
@@ -20705,6 +20737,8 @@
20705
20737
  Datetime.keyed = true;
20706
20738
  Datetime.emptyValue = null;
20707
20739
  Datetime.sanitizeValue = sanitizeDateTimePickerValue;
20740
+ Datetime.label = 'Date time';
20741
+ Datetime.group = 'basic-input';
20708
20742
 
20709
20743
  /**
20710
20744
  * This file must not be changed or exchanged.
@@ -20866,8 +20900,8 @@
20866
20900
  function isExpression(value) {
20867
20901
  return isString$3(value) && value.startsWith('=');
20868
20902
  }
20869
- function _extends$f() {
20870
- _extends$f = Object.assign ? Object.assign.bind() : function (target) {
20903
+ function _extends$h() {
20904
+ _extends$h = Object.assign ? Object.assign.bind() : function (target) {
20871
20905
  for (var i = 1; i < arguments.length; i++) {
20872
20906
  var source = arguments[i];
20873
20907
  for (var key in source) {
@@ -20878,12 +20912,12 @@
20878
20912
  }
20879
20913
  return target;
20880
20914
  };
20881
- return _extends$f.apply(this, arguments);
20915
+ return _extends$h.apply(this, arguments);
20882
20916
  }
20883
20917
  var ImagePlaceholder = ({
20884
20918
  styles = {},
20885
20919
  ...props
20886
- }) => /*#__PURE__*/React.createElement("svg", _extends$f({
20920
+ }) => /*#__PURE__*/React.createElement("svg", _extends$h({
20887
20921
  width: "64",
20888
20922
  height: "64",
20889
20923
  viewBox: "0 0 1280 1280",
@@ -20922,7 +20956,7 @@
20922
20956
  const altText = useExpressionValue(alt);
20923
20957
  const {
20924
20958
  formId
20925
- } = F$1(FormContext);
20959
+ } = F$1(FormContext$1);
20926
20960
  return e$1("div", {
20927
20961
  class: formFieldClasses(type$7),
20928
20962
  children: e$1("div", {
@@ -20941,13 +20975,71 @@
20941
20975
  })
20942
20976
  });
20943
20977
  }
20944
- Image.create = function (options = {}) {
20945
- return {
20946
- ...options
20947
- };
20948
- };
20978
+ Image.create = (options = {}) => ({
20979
+ ...options
20980
+ });
20949
20981
  Image.type = type$7;
20950
20982
  Image.keyed = false;
20983
+ Image.label = 'Image view';
20984
+ Image.group = 'presentation';
20985
+ function _extends$g() {
20986
+ _extends$g = Object.assign ? Object.assign.bind() : function (target) {
20987
+ for (var i = 1; i < arguments.length; i++) {
20988
+ var source = arguments[i];
20989
+ for (var key in source) {
20990
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20991
+ target[key] = source[key];
20992
+ }
20993
+ }
20994
+ }
20995
+ return target;
20996
+ };
20997
+ return _extends$g.apply(this, arguments);
20998
+ }
20999
+ var AngelDownIcon = ({
21000
+ styles = {},
21001
+ ...props
21002
+ }) => /*#__PURE__*/React.createElement("svg", _extends$g({
21003
+ xmlns: "http://www.w3.org/2000/svg",
21004
+ width: "8",
21005
+ height: "8"
21006
+ }, props), /*#__PURE__*/React.createElement("path", {
21007
+ fillRule: "evenodd",
21008
+ clipRule: "evenodd",
21009
+ fill: "currentColor",
21010
+ stroke: "currentColor",
21011
+ strokeWidth: ".5",
21012
+ d: "M7.75 1.336L4 6.125.258 1.335 0 1.54l4 5.125L8 1.54zm0 0"
21013
+ }));
21014
+ function _extends$f() {
21015
+ _extends$f = Object.assign ? Object.assign.bind() : function (target) {
21016
+ for (var i = 1; i < arguments.length; i++) {
21017
+ var source = arguments[i];
21018
+ for (var key in source) {
21019
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21020
+ target[key] = source[key];
21021
+ }
21022
+ }
21023
+ }
21024
+ return target;
21025
+ };
21026
+ return _extends$f.apply(this, arguments);
21027
+ }
21028
+ var AngelUpIcon = ({
21029
+ styles = {},
21030
+ ...props
21031
+ }) => /*#__PURE__*/React.createElement("svg", _extends$f({
21032
+ xmlns: "http://www.w3.org/2000/svg",
21033
+ width: "8",
21034
+ height: "8"
21035
+ }, props), /*#__PURE__*/React.createElement("path", {
21036
+ fillRule: "evenodd",
21037
+ clipRule: "evenodd",
21038
+ fill: "currentColor",
21039
+ stroke: "currentColor",
21040
+ strokeWidth: ".5",
21041
+ d: "M7.75 6.664L4 1.875.258 6.665 0 6.46l4-5.125L8 6.46zm0 0"
21042
+ }));
20951
21043
  const type$6 = 'number';
20952
21044
  function Numberfield(props) {
20953
21045
  const {
@@ -21075,7 +21167,7 @@
21075
21167
  };
21076
21168
  const {
21077
21169
  formId
21078
- } = F$1(FormContext);
21170
+ } = F$1(FormContext$1);
21079
21171
  return e$1("div", {
21080
21172
  class: formFieldClasses(type$6, {
21081
21173
  errors,
@@ -21091,7 +21183,7 @@
21091
21183
  post: suffixAdorner,
21092
21184
  children: e$1("div", {
21093
21185
  class: classNames('fjs-vertical-group', {
21094
- 'disabled': disabled
21186
+ 'fjs-disabled': disabled
21095
21187
  }, {
21096
21188
  'hasErrors': errors.length
21097
21189
  }),
@@ -21113,22 +21205,24 @@
21113
21205
  value: displayValue
21114
21206
  }), e$1("div", {
21115
21207
  class: classNames('fjs-number-arrow-container', {
21116
- 'disabled': disabled
21208
+ 'fjs-disabled': disabled
21117
21209
  }),
21118
21210
  children: [e$1("button", {
21119
21211
  class: "fjs-number-arrow-up",
21120
21212
  type: "button",
21213
+ "aria-label": "Increment",
21121
21214
  onClick: () => increment(),
21122
21215
  tabIndex: -1,
21123
- children: "\u02C4"
21216
+ children: e$1(AngelUpIcon, {})
21124
21217
  }), e$1("div", {
21125
21218
  class: "fjs-number-arrow-separator"
21126
21219
  }), e$1("button", {
21127
21220
  class: "fjs-number-arrow-down",
21128
21221
  type: "button",
21222
+ "aria-label": "Decrement",
21129
21223
  onClick: () => decrement(),
21130
21224
  tabIndex: -1,
21131
- children: "\u02C5"
21225
+ children: e$1(AngelDownIcon, {})
21132
21226
  })]
21133
21227
  })]
21134
21228
  })
@@ -21139,7 +21233,9 @@
21139
21233
  })]
21140
21234
  });
21141
21235
  }
21142
- Numberfield.create = (options = {}) => options;
21236
+ Numberfield.create = (options = {}) => ({
21237
+ ...options
21238
+ });
21143
21239
  Numberfield.sanitizeValue = ({
21144
21240
  value,
21145
21241
  formField
@@ -21157,6 +21253,7 @@
21157
21253
  Numberfield.keyed = true;
21158
21254
  Numberfield.label = 'Number';
21159
21255
  Numberfield.emptyValue = null;
21256
+ Numberfield.group = 'basic-input';
21160
21257
  const type$5 = 'radio';
21161
21258
  function Radio(props) {
21162
21259
  const {
@@ -21186,7 +21283,7 @@
21186
21283
  } = useValuesAsync(field);
21187
21284
  const {
21188
21285
  formId
21189
- } = F$1(FormContext);
21286
+ } = F$1(FormContext$1);
21190
21287
  return e$1("div", {
21191
21288
  class: formFieldClasses(type$5, {
21192
21289
  errors,
@@ -21220,12 +21317,17 @@
21220
21317
  });
21221
21318
  }
21222
21319
  Radio.create = function (options = {}) {
21223
- if (options.valuesKey) return options;
21224
- return {
21225
- values: [{
21320
+ const defaults = {};
21321
+
21322
+ // provide default values if valuesKey isn't set
21323
+ if (!options.valuesKey) {
21324
+ defaults.values = [{
21226
21325
  label: 'Value',
21227
21326
  value: 'value'
21228
- }],
21327
+ }];
21328
+ }
21329
+ return {
21330
+ ...defaults,
21229
21331
  ...options
21230
21332
  };
21231
21333
  };
@@ -21234,38 +21336,306 @@
21234
21336
  Radio.keyed = true;
21235
21337
  Radio.emptyValue = null;
21236
21338
  Radio.sanitizeValue = sanitizeSingleSelectValue;
21339
+ Radio.group = 'selection';
21340
+ function _extends$e() {
21341
+ _extends$e = Object.assign ? Object.assign.bind() : function (target) {
21342
+ for (var i = 1; i < arguments.length; i++) {
21343
+ var source = arguments[i];
21344
+ for (var key in source) {
21345
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21346
+ target[key] = source[key];
21347
+ }
21348
+ }
21349
+ }
21350
+ return target;
21351
+ };
21352
+ return _extends$e.apply(this, arguments);
21353
+ }
21354
+ var XMarkIcon = ({
21355
+ styles = {},
21356
+ ...props
21357
+ }) => /*#__PURE__*/React.createElement("svg", _extends$e({
21358
+ xmlns: "http://www.w3.org/2000/svg",
21359
+ width: "8",
21360
+ height: "8"
21361
+ }, props), /*#__PURE__*/React.createElement("path", {
21362
+ fillRule: "evenodd",
21363
+ clipRule: "evenodd",
21364
+ fill: "currentColor",
21365
+ stroke: "currentColor",
21366
+ strokeWidth: ".5",
21367
+ d: "M4 3.766L7.43.336l.234.234L4.234 4l3.43 3.43-.234.234L4 4.234.57 7.664.336 7.43 3.766 4 .336.57.57.336zm0 0"
21368
+ }));
21369
+ function SearchableSelect(props) {
21370
+ const {
21371
+ id,
21372
+ disabled,
21373
+ errors,
21374
+ field,
21375
+ value
21376
+ } = props;
21377
+ const {
21378
+ formId
21379
+ } = F$1(FormContext$1);
21380
+ const [filter, setFilter] = l$2('');
21381
+ const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
21382
+ const [shouldApplyFilter, setShouldApplyFilter] = l$2(true);
21383
+ const [isEscapeClosed, setIsEscapeClose] = l$2(false);
21384
+ const searchbarRef = s$1();
21385
+ const {
21386
+ state: loadState,
21387
+ values: options
21388
+ } = useValuesAsync(field);
21389
+
21390
+ // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
21391
+ const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
21392
+ [o.value]: options[x]
21393
+ }))), [options]);
21394
+ const valueLabel = d(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
21395
+
21396
+ // whenever we change the underlying value, set the label to it
21397
+ y(() => {
21398
+ setFilter(valueLabel);
21399
+ }, [valueLabel]);
21400
+ const filteredOptions = d(() => {
21401
+ if (loadState === LOAD_STATES.LOADED) {
21402
+ return shouldApplyFilter ? options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase())) : options;
21403
+ }
21404
+ return [];
21405
+ }, [filter, loadState, options, shouldApplyFilter]);
21406
+ const onChange = ({
21407
+ target
21408
+ }) => {
21409
+ setIsEscapeClose(false);
21410
+ setIsDropdownExpanded(true);
21411
+ setShouldApplyFilter(true);
21412
+ setFilter(target.value || '');
21413
+ };
21414
+ const setValue = A$1(option => {
21415
+ setFilter(option && option.label || '');
21416
+ props.onChange({
21417
+ value: option && option.value || null,
21418
+ field
21419
+ });
21420
+ }, [field, props]);
21421
+ const onInputKeyDown = A$1(keyDownEvent => {
21422
+ switch (keyDownEvent.key) {
21423
+ case 'ArrowUp':
21424
+ keyDownEvent.preventDefault();
21425
+ break;
21426
+ case 'ArrowDown':
21427
+ {
21428
+ if (!isDropdownExpanded) {
21429
+ setIsDropdownExpanded(true);
21430
+ setShouldApplyFilter(false);
21431
+ }
21432
+ keyDownEvent.preventDefault();
21433
+ break;
21434
+ }
21435
+ case 'Escape':
21436
+ setIsEscapeClose(true);
21437
+ break;
21438
+ case 'Enter':
21439
+ if (isEscapeClosed) {
21440
+ setIsEscapeClose(false);
21441
+ }
21442
+ break;
21443
+ }
21444
+ }, [isDropdownExpanded, isEscapeClosed]);
21445
+ const displayState = d(() => {
21446
+ const ds = {};
21447
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
21448
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
21449
+ ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
21450
+ return ds;
21451
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
21452
+ const onAngelMouseDown = A$1(e => {
21453
+ setIsEscapeClose(false);
21454
+ setIsDropdownExpanded(!isDropdownExpanded);
21455
+ const searchbar = searchbarRef.current;
21456
+ isDropdownExpanded ? searchbar.blur() : searchbar.focus();
21457
+ e.preventDefault();
21458
+ }, [isDropdownExpanded]);
21459
+ return e$1(d$1, {
21460
+ children: [e$1("div", {
21461
+ id: prefixId(`${id}`, formId),
21462
+ class: classNames('fjs-input-group', {
21463
+ 'disabled': disabled
21464
+ }, {
21465
+ 'hasErrors': errors.length
21466
+ }),
21467
+ children: [e$1("input", {
21468
+ disabled: disabled,
21469
+ class: "fjs-input",
21470
+ ref: searchbarRef,
21471
+ id: prefixId(`${id}-search`, formId),
21472
+ onChange: onChange,
21473
+ type: "text",
21474
+ value: filter,
21475
+ placeholder: 'Search',
21476
+ autoComplete: "off",
21477
+ onKeyDown: e => onInputKeyDown(e),
21478
+ onMouseDown: () => {
21479
+ setIsEscapeClose(false);
21480
+ setIsDropdownExpanded(true);
21481
+ setShouldApplyFilter(false);
21482
+ },
21483
+ onFocus: () => {
21484
+ setIsDropdownExpanded(true);
21485
+ setShouldApplyFilter(false);
21486
+ },
21487
+ onBlur: () => {
21488
+ setIsDropdownExpanded(false);
21489
+ setFilter(valueLabel);
21490
+ }
21491
+ }), displayState.displayCross && e$1("span", {
21492
+ class: "fjs-select-cross",
21493
+ onMouseDown: e => {
21494
+ setValue(null);
21495
+ e.preventDefault();
21496
+ },
21497
+ children: [e$1(XMarkIcon, {}), " "]
21498
+ }), e$1("span", {
21499
+ class: "fjs-select-arrow",
21500
+ onMouseDown: e => onAngelMouseDown(e),
21501
+ children: displayState.displayDropdown ? e$1(AngelUpIcon, {}) : e$1(AngelDownIcon, {})
21502
+ })]
21503
+ }), e$1("div", {
21504
+ class: "fjs-select-anchor",
21505
+ children: displayState.displayDropdown && e$1(DropdownList, {
21506
+ values: filteredOptions,
21507
+ getLabel: o => o.label,
21508
+ onValueSelected: o => {
21509
+ setValue(o);
21510
+ setIsDropdownExpanded(false);
21511
+ },
21512
+ listenerElement: searchbarRef.current
21513
+ })
21514
+ })]
21515
+ });
21516
+ }
21517
+ function SimpleSelect(props) {
21518
+ const {
21519
+ id,
21520
+ disabled,
21521
+ errors,
21522
+ field,
21523
+ value
21524
+ } = props;
21525
+ const {
21526
+ formId
21527
+ } = F$1(FormContext$1);
21528
+ const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
21529
+ const selectRef = s$1();
21530
+ const {
21531
+ state: loadState,
21532
+ values: options
21533
+ } = useValuesAsync(field);
21534
+
21535
+ // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
21536
+ const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
21537
+ [o.value]: options[x]
21538
+ }))), [options]);
21539
+ const valueLabel = d(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
21540
+ const setValue = A$1(option => {
21541
+ props.onChange({
21542
+ value: option && option.value || null,
21543
+ field
21544
+ });
21545
+ }, [field, props]);
21546
+ const displayState = d(() => {
21547
+ const ds = {};
21548
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
21549
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
21550
+ ds.displayDropdown = !disabled && isDropdownExpanded;
21551
+ return ds;
21552
+ }, [disabled, isDropdownExpanded, loadState, value]);
21553
+ const onMouseDown = A$1(e => {
21554
+ const select = selectRef.current;
21555
+ setIsDropdownExpanded(!isDropdownExpanded);
21556
+ if (isDropdownExpanded) {
21557
+ select.blur();
21558
+ } else {
21559
+ select.focus();
21560
+ }
21561
+ e.preventDefault();
21562
+ }, [isDropdownExpanded]);
21563
+ const initialFocusIndex = d(() => value && findIndex(options, o => o.value === value) || 0, [options, value]);
21564
+ return e$1(d$1, {
21565
+ children: [e$1("div", {
21566
+ ref: selectRef,
21567
+ id: prefixId(`${id}`, formId),
21568
+ class: classNames('fjs-input-group', {
21569
+ 'disabled': disabled
21570
+ }, {
21571
+ 'hasErrors': errors.length
21572
+ }),
21573
+ onFocus: () => setIsDropdownExpanded(true),
21574
+ onBlur: () => setIsDropdownExpanded(false),
21575
+ onMouseDown: e => onMouseDown(e),
21576
+ tabIndex: disabled ? undefined : 0,
21577
+ children: [e$1("div", {
21578
+ class: classNames('fjs-select-display', {
21579
+ 'fjs-select-placeholder': !value
21580
+ }),
21581
+ id: prefixId(`${id}-display`, formId),
21582
+ children: valueLabel || 'Select'
21583
+ }), displayState.displayCross && e$1("span", {
21584
+ class: "fjs-select-cross",
21585
+ onMouseDown: e => {
21586
+ setValue(null);
21587
+ e.stopPropagation();
21588
+ },
21589
+ children: e$1(XMarkIcon, {})
21590
+ }), e$1("span", {
21591
+ class: "fjs-select-arrow",
21592
+ children: displayState.displayDropdown ? e$1(AngelUpIcon, {}) : e$1(AngelDownIcon, {})
21593
+ })]
21594
+ }), e$1("div", {
21595
+ class: "fjs-select-anchor",
21596
+ children: displayState.displayDropdown && e$1(DropdownList, {
21597
+ values: options,
21598
+ getLabel: o => o.label,
21599
+ initialFocusIndex: initialFocusIndex,
21600
+ onValueSelected: o => {
21601
+ setValue(o);
21602
+ setIsDropdownExpanded(false);
21603
+ },
21604
+ listenerElement: selectRef.current
21605
+ })
21606
+ })]
21607
+ });
21608
+ }
21237
21609
  const type$4 = 'select';
21238
21610
  function Select$1(props) {
21239
21611
  const {
21240
21612
  disabled,
21241
21613
  errors = [],
21242
21614
  field,
21615
+ onChange,
21243
21616
  value
21244
21617
  } = props;
21245
21618
  const {
21246
21619
  description,
21247
21620
  id,
21248
21621
  label,
21622
+ searchable = false,
21249
21623
  validate = {}
21250
21624
  } = field;
21251
21625
  const {
21252
21626
  required
21253
21627
  } = validate;
21254
- const onChange = ({
21255
- target
21256
- }) => {
21257
- props.onChange({
21258
- field,
21259
- value: target.value === '' ? null : target.value
21260
- });
21261
- };
21262
- const {
21263
- state: loadState,
21264
- values: options
21265
- } = useValuesAsync(field);
21266
21628
  const {
21267
21629
  formId
21268
- } = F$1(FormContext);
21630
+ } = F$1(FormContext$1);
21631
+ const selectProps = d(() => ({
21632
+ id,
21633
+ disabled,
21634
+ errors,
21635
+ field,
21636
+ value,
21637
+ onChange
21638
+ }), [disabled, errors, field, id, value, onChange]);
21269
21639
  return e$1("div", {
21270
21640
  class: formFieldClasses(type$4, {
21271
21641
  errors,
@@ -21275,20 +21645,10 @@
21275
21645
  id: prefixId(id, formId),
21276
21646
  label: label,
21277
21647
  required: required
21278
- }), e$1("select", {
21279
- class: "fjs-select",
21280
- disabled: disabled,
21281
- id: prefixId(id, formId),
21282
- onChange: onChange,
21283
- value: value || '',
21284
- children: [e$1("option", {
21285
- value: ""
21286
- }), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
21287
- return e$1("option", {
21288
- value: option.value,
21289
- children: option.label
21290
- }, `${id}-${index}`);
21291
- })]
21648
+ }), searchable ? e$1(SearchableSelect, {
21649
+ ...selectProps
21650
+ }) : e$1(SimpleSelect, {
21651
+ ...selectProps
21292
21652
  }), e$1(Description$2, {
21293
21653
  description: description
21294
21654
  }), e$1(Errors, {
@@ -21296,13 +21656,18 @@
21296
21656
  })]
21297
21657
  });
21298
21658
  }
21299
- Select$1.create = function (options = {}) {
21300
- if (options.valuesKey) return options;
21301
- return {
21302
- values: [{
21659
+ Select$1.create = (options = {}) => {
21660
+ const defaults = {};
21661
+
21662
+ // provide default values if valuesKey isn't set
21663
+ if (!options.valuesKey) {
21664
+ defaults.values = [{
21303
21665
  label: 'Value',
21304
21666
  value: 'value'
21305
- }],
21667
+ }];
21668
+ }
21669
+ return {
21670
+ ...defaults,
21306
21671
  ...options
21307
21672
  };
21308
21673
  };
@@ -21311,34 +21676,7 @@
21311
21676
  Select$1.keyed = true;
21312
21677
  Select$1.emptyValue = null;
21313
21678
  Select$1.sanitizeValue = sanitizeSingleSelectValue;
21314
- function _extends$e() {
21315
- _extends$e = Object.assign ? Object.assign.bind() : function (target) {
21316
- for (var i = 1; i < arguments.length; i++) {
21317
- var source = arguments[i];
21318
- for (var key in source) {
21319
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21320
- target[key] = source[key];
21321
- }
21322
- }
21323
- }
21324
- return target;
21325
- };
21326
- return _extends$e.apply(this, arguments);
21327
- }
21328
- var CloseIcon = ({
21329
- styles = {},
21330
- ...props
21331
- }) => /*#__PURE__*/React.createElement("svg", _extends$e({
21332
- width: "16",
21333
- height: "16",
21334
- fill: "none",
21335
- xmlns: "http://www.w3.org/2000/svg"
21336
- }, props), /*#__PURE__*/React.createElement("path", {
21337
- fillRule: "evenodd",
21338
- clipRule: "evenodd",
21339
- d: "M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7z",
21340
- fill: "currentColor"
21341
- }));
21679
+ Select$1.group = 'selection';
21342
21680
  const type$3 = 'taglist';
21343
21681
  function Taglist(props) {
21344
21682
  const {
@@ -21354,7 +21692,7 @@
21354
21692
  } = field;
21355
21693
  const {
21356
21694
  formId
21357
- } = F$1(FormContext);
21695
+ } = F$1(FormContext$1);
21358
21696
  const [filter, setFilter] = l$2('');
21359
21697
  const [filteredOptions, setFilteredOptions] = l$2([]);
21360
21698
  const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
@@ -21442,6 +21780,7 @@
21442
21780
  searchbarRef.current.focus();
21443
21781
  }
21444
21782
  };
21783
+ const shouldDisplayDropdown = d(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
21445
21784
  return e$1("div", {
21446
21785
  class: formFieldClasses(type$3, {
21447
21786
  errors,
@@ -21452,23 +21791,25 @@
21452
21791
  id: prefixId(`${id}-search`, formId)
21453
21792
  }), e$1("div", {
21454
21793
  class: classNames('fjs-taglist', {
21455
- 'disabled': disabled
21794
+ 'fjs-disabled': disabled
21456
21795
  }),
21457
- children: [!disabled && loadState === LOAD_STATES.LOADED && e$1("div", {
21796
+ children: [loadState === LOAD_STATES.LOADED && e$1("div", {
21458
21797
  class: "fjs-taglist-tags",
21459
21798
  children: values.map(v => {
21460
21799
  return e$1("div", {
21461
- class: "fjs-taglist-tag",
21800
+ class: classNames('fjs-taglist-tag', {
21801
+ 'fjs-disabled': disabled
21802
+ }),
21462
21803
  onMouseDown: e => e.preventDefault(),
21463
21804
  children: [e$1("span", {
21464
21805
  class: "fjs-taglist-tag-label",
21465
21806
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
21466
- }), e$1("button", {
21807
+ }), !disabled && e$1("button", {
21467
21808
  type: "button",
21468
21809
  title: "Remove tag",
21469
21810
  class: "fjs-taglist-tag-remove",
21470
21811
  onClick: event => onTagRemoveClick(event, v),
21471
- children: e$1(CloseIcon, {})
21812
+ children: e$1(XMarkIcon, {})
21472
21813
  })]
21473
21814
  });
21474
21815
  })
@@ -21480,7 +21821,7 @@
21480
21821
  onChange: onFilterChange,
21481
21822
  type: "text",
21482
21823
  value: filter,
21483
- placeholder: 'Search',
21824
+ placeholder: disabled ? '' : 'Search',
21484
21825
  autoComplete: "off",
21485
21826
  onKeyDown: e => onInputKeyDown(e),
21486
21827
  onMouseDown: () => setIsEscapeClose(false),
@@ -21492,7 +21833,7 @@
21492
21833
  })]
21493
21834
  }), e$1("div", {
21494
21835
  class: "fjs-taglist-anchor",
21495
- children: !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed && e$1(DropdownList, {
21836
+ children: shouldDisplayDropdown && e$1(DropdownList, {
21496
21837
  values: filteredOptions,
21497
21838
  getLabel: o => o.label,
21498
21839
  onValueSelected: o => selectValue(o.value),
@@ -21506,21 +21847,219 @@
21506
21847
  })]
21507
21848
  });
21508
21849
  }
21509
- Taglist.create = function (options = {}) {
21510
- if (options.valuesKey) return options;
21511
- return {
21512
- values: [{
21850
+ Taglist.create = (options = {}) => {
21851
+ const defaults = {};
21852
+
21853
+ // provide default values if valuesKey isn't set
21854
+ if (!options.valuesKey) {
21855
+ defaults.values = [{
21513
21856
  label: 'Value',
21514
21857
  value: 'value'
21515
- }],
21858
+ }];
21859
+ }
21860
+ return {
21861
+ ...defaults,
21516
21862
  ...options
21517
21863
  };
21518
21864
  };
21519
21865
  Taglist.type = type$3;
21520
- Taglist.label = 'Taglist';
21866
+ Taglist.label = 'Tag list';
21521
21867
  Taglist.keyed = true;
21522
21868
  Taglist.emptyValue = [];
21523
21869
  Taglist.sanitizeValue = sanitizeMultiSelectValue;
21870
+ Taglist.group = 'selection';
21871
+ const type$2 = 'text';
21872
+ function Text$2(props) {
21873
+ const {
21874
+ field,
21875
+ disableLinks
21876
+ } = props;
21877
+ const {
21878
+ text = ''
21879
+ } = field;
21880
+ const textValue = useExpressionValue(text) || '';
21881
+ const componentOverrides = disableLinks ? {
21882
+ 'a': DisabledLink
21883
+ } : {};
21884
+ return e$1("div", {
21885
+ class: formFieldClasses(type$2),
21886
+ children: e$1(Markup, {
21887
+ markup: safeMarkdown(textValue),
21888
+ components: componentOverrides,
21889
+ trim: false
21890
+ })
21891
+ });
21892
+ }
21893
+ Text$2.create = (options = {}) => ({
21894
+ text: '# Text',
21895
+ ...options
21896
+ });
21897
+ Text$2.type = type$2;
21898
+ Text$2.keyed = false;
21899
+ Text$2.group = 'presentation';
21900
+ Text$2.label = 'Text view';
21901
+ function DisabledLink({
21902
+ href,
21903
+ children
21904
+ }) {
21905
+ return e$1("a", {
21906
+ class: "fjs-disabled-link",
21907
+ href: href,
21908
+ tabIndex: -1,
21909
+ children: children
21910
+ });
21911
+ }
21912
+ const type$1 = 'textfield';
21913
+ function Textfield$1(props) {
21914
+ const {
21915
+ disabled,
21916
+ errors = [],
21917
+ field,
21918
+ value = ''
21919
+ } = props;
21920
+ const {
21921
+ description,
21922
+ id,
21923
+ label,
21924
+ appearance = {},
21925
+ validate = {}
21926
+ } = field;
21927
+ const {
21928
+ prefixAdorner,
21929
+ suffixAdorner
21930
+ } = appearance;
21931
+ const {
21932
+ required
21933
+ } = validate;
21934
+ const onChange = ({
21935
+ target
21936
+ }) => {
21937
+ props.onChange({
21938
+ field,
21939
+ value: target.value
21940
+ });
21941
+ };
21942
+ const {
21943
+ formId
21944
+ } = F$1(FormContext$1);
21945
+ return e$1("div", {
21946
+ class: formFieldClasses(type$1, {
21947
+ errors,
21948
+ disabled
21949
+ }),
21950
+ children: [e$1(Label$1, {
21951
+ id: prefixId(id, formId),
21952
+ label: label,
21953
+ required: required
21954
+ }), e$1(InputAdorner, {
21955
+ disabled: disabled,
21956
+ pre: prefixAdorner,
21957
+ post: suffixAdorner,
21958
+ children: e$1("input", {
21959
+ class: "fjs-input",
21960
+ disabled: disabled,
21961
+ id: prefixId(id, formId),
21962
+ onInput: onChange,
21963
+ type: "text",
21964
+ value: value
21965
+ })
21966
+ }), e$1(Description$2, {
21967
+ description: description
21968
+ }), e$1(Errors, {
21969
+ errors: errors
21970
+ })]
21971
+ });
21972
+ }
21973
+ Textfield$1.create = (options = {}) => ({
21974
+ ...options
21975
+ });
21976
+ Textfield$1.type = type$1;
21977
+ Textfield$1.label = 'Text field';
21978
+ Textfield$1.keyed = true;
21979
+ Textfield$1.emptyValue = '';
21980
+ Textfield$1.sanitizeValue = ({
21981
+ value
21982
+ }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
21983
+ Textfield$1.group = 'basic-input';
21984
+ const type = 'textarea';
21985
+ function Textarea(props) {
21986
+ const {
21987
+ disabled,
21988
+ errors = [],
21989
+ field,
21990
+ value = ''
21991
+ } = props;
21992
+ const {
21993
+ description,
21994
+ id,
21995
+ label,
21996
+ validate = {}
21997
+ } = field;
21998
+ const {
21999
+ required
22000
+ } = validate;
22001
+ const textareaRef = s$1();
22002
+ const onInput = ({
22003
+ target
22004
+ }) => {
22005
+ props.onChange({
22006
+ field,
22007
+ value: target.value
22008
+ });
22009
+ };
22010
+ const autoSizeTextarea = A$1(textarea => {
22011
+ // Ensures the textarea shrinks back, and improves resizing behavior consistency
22012
+ textarea.style.height = '0px';
22013
+ const computed = window.getComputedStyle(textarea);
22014
+ const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
22015
+ const minHeight = 75;
22016
+ const maxHeight = 350;
22017
+ const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
22018
+ textarea.style.height = `${displayHeight}px`;
22019
+
22020
+ // Overflow is hidden by default to hide scrollbar flickering
22021
+ textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
22022
+ }, []);
22023
+ y(() => {
22024
+ autoSizeTextarea(textareaRef.current);
22025
+ }, [autoSizeTextarea, value]);
22026
+ const {
22027
+ formId
22028
+ } = F$1(FormContext$1);
22029
+ return e$1("div", {
22030
+ class: formFieldClasses(type, {
22031
+ errors,
22032
+ disabled
22033
+ }),
22034
+ children: [e$1(Label$1, {
22035
+ id: prefixId(id, formId),
22036
+ label: label,
22037
+ required: required
22038
+ }), e$1("textarea", {
22039
+ class: "fjs-textarea",
22040
+ disabled: disabled,
22041
+ id: prefixId(id, formId),
22042
+ onInput: onInput,
22043
+ value: value,
22044
+ ref: textareaRef
22045
+ }), e$1(Description$2, {
22046
+ description: description
22047
+ }), e$1(Errors, {
22048
+ errors: errors
22049
+ })]
22050
+ });
22051
+ }
22052
+ Textarea.create = (options = {}) => ({
22053
+ ...options
22054
+ });
22055
+ Textarea.type = type;
22056
+ Textarea.label = 'Text area';
22057
+ Textarea.keyed = true;
22058
+ Textarea.emptyValue = '';
22059
+ Textarea.sanitizeValue = ({
22060
+ value
22061
+ }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22062
+ Textarea.group = 'basic-input';
21524
22063
  function _extends$d() {
21525
22064
  _extends$d = Object.assign ? Object.assign.bind() : function (target) {
21526
22065
  for (var i = 1; i < arguments.length; i++) {
@@ -21831,8 +22370,8 @@
21831
22370
  }, props), /*#__PURE__*/React.createElement("path", {
21832
22371
  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"
21833
22372
  }));
21834
- function _extends$2() {
21835
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
22373
+ function _extends$2$1() {
22374
+ _extends$2$1 = Object.assign ? Object.assign.bind() : function (target) {
21836
22375
  for (var i = 1; i < arguments.length; i++) {
21837
22376
  var source = arguments[i];
21838
22377
  for (var key in source) {
@@ -21843,12 +22382,12 @@
21843
22382
  }
21844
22383
  return target;
21845
22384
  };
21846
- return _extends$2.apply(this, arguments);
22385
+ return _extends$2$1.apply(this, arguments);
21847
22386
  }
21848
22387
  var TextfieldIcon = ({
21849
22388
  styles = {},
21850
22389
  ...props
21851
- }) => /*#__PURE__*/React.createElement("svg", _extends$2({
22390
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2$1({
21852
22391
  xmlns: "http://www.w3.org/2000/svg",
21853
22392
  width: "54",
21854
22393
  height: "54"
@@ -21856,8 +22395,8 @@
21856
22395
  fillRule: "evenodd",
21857
22396
  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"
21858
22397
  }));
21859
- function _extends$1() {
21860
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
22398
+ function _extends$1$1() {
22399
+ _extends$1$1 = Object.assign ? Object.assign.bind() : function (target) {
21861
22400
  for (var i = 1; i < arguments.length; i++) {
21862
22401
  var source = arguments[i];
21863
22402
  for (var key in source) {
@@ -21868,12 +22407,12 @@
21868
22407
  }
21869
22408
  return target;
21870
22409
  };
21871
- return _extends$1.apply(this, arguments);
22410
+ return _extends$1$1.apply(this, arguments);
21872
22411
  }
21873
22412
  var TextareaIcon = ({
21874
22413
  styles = {},
21875
22414
  ...props
21876
- }) => /*#__PURE__*/React.createElement("svg", _extends$1({
22415
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1$1({
21877
22416
  xmlns: "http://www.w3.org/2000/svg",
21878
22417
  width: "54",
21879
22418
  height: "54"
@@ -21881,8 +22420,8 @@
21881
22420
  fillRule: "evenodd",
21882
22421
  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"
21883
22422
  }));
21884
- function _extends$i() {
21885
- _extends$i = Object.assign ? Object.assign.bind() : function (target) {
22423
+ function _extends$k() {
22424
+ _extends$k = Object.assign ? Object.assign.bind() : function (target) {
21886
22425
  for (var i = 1; i < arguments.length; i++) {
21887
22426
  var source = arguments[i];
21888
22427
  for (var key in source) {
@@ -21893,12 +22432,12 @@
21893
22432
  }
21894
22433
  return target;
21895
22434
  };
21896
- return _extends$i.apply(this, arguments);
22435
+ return _extends$k.apply(this, arguments);
21897
22436
  }
21898
22437
  var ImageIcon = ({
21899
22438
  styles = {},
21900
22439
  ...props
21901
- }) => /*#__PURE__*/React.createElement("svg", _extends$i({
22440
+ }) => /*#__PURE__*/React.createElement("svg", _extends$k({
21902
22441
  width: "54",
21903
22442
  height: "54",
21904
22443
  fill: "none",
@@ -21930,222 +22469,12 @@
21930
22469
  textarea: TextareaIcon,
21931
22470
  default: FormIcon
21932
22471
  };
21933
- const type$2 = 'text';
21934
- function Text$2(props) {
21935
- const {
21936
- field,
21937
- disabled
21938
- } = props;
21939
- const {
21940
- text = ''
21941
- } = field;
21942
- const textValue = useExpressionValue(text) || '';
21943
- return e$1("div", {
21944
- class: formFieldClasses(type$2),
21945
- children: renderText(field, textValue, disabled)
21946
- });
21947
- }
21948
- Text$2.create = function (options = {}) {
21949
- return {
21950
- text: '# Text',
21951
- ...options
21952
- };
21953
- };
21954
- Text$2.type = type$2;
21955
- Text$2.keyed = false;
21956
-
21957
- // helper //////////////
21958
-
21959
- function renderText(field, content, disabled) {
21960
- const {
21961
- text
21962
- } = field;
21963
- const Icon = iconsByType['text'];
21964
- if (disabled) {
21965
- if (!text) {
21966
- return e$1("div", {
21967
- class: "fjs-form-field-placeholder",
21968
- children: [e$1(Icon, {
21969
- viewBox: "0 0 54 54"
21970
- }), "Text view is empty"]
21971
- });
21972
- }
21973
- if (isExpression$2(text)) {
21974
- return e$1("div", {
21975
- class: "fjs-form-field-placeholder",
21976
- children: [e$1(Icon, {
21977
- viewBox: "0 0 54 54"
21978
- }), "Text view is populated by an expression"]
21979
- });
21980
- }
21981
- }
21982
- return e$1(Markup, {
21983
- markup: safeMarkdown(content),
21984
- trim: false
21985
- });
21986
- }
21987
- const type$1 = 'textfield';
21988
- function Textfield$1(props) {
21989
- const {
21990
- disabled,
21991
- errors = [],
21992
- field,
21993
- value = ''
21994
- } = props;
21995
- const {
21996
- description,
21997
- id,
21998
- label,
21999
- appearance = {},
22000
- validate = {}
22001
- } = field;
22002
- const {
22003
- prefixAdorner,
22004
- suffixAdorner
22005
- } = appearance;
22006
- const {
22007
- required
22008
- } = validate;
22009
- const onChange = ({
22010
- target
22011
- }) => {
22012
- props.onChange({
22013
- field,
22014
- value: target.value
22015
- });
22016
- };
22017
- const {
22018
- formId
22019
- } = F$1(FormContext);
22020
- return e$1("div", {
22021
- class: formFieldClasses(type$1, {
22022
- errors,
22023
- disabled
22024
- }),
22025
- children: [e$1(Label$1, {
22026
- id: prefixId(id, formId),
22027
- label: label,
22028
- required: required
22029
- }), e$1(InputAdorner, {
22030
- disabled: disabled,
22031
- pre: prefixAdorner,
22032
- post: suffixAdorner,
22033
- children: e$1("input", {
22034
- class: "fjs-input",
22035
- disabled: disabled,
22036
- id: prefixId(id, formId),
22037
- onInput: onChange,
22038
- type: "text",
22039
- value: value
22040
- })
22041
- }), e$1(Description$2, {
22042
- description: description
22043
- }), e$1(Errors, {
22044
- errors: errors
22045
- })]
22046
- });
22047
- }
22048
- Textfield$1.create = function (options = {}) {
22049
- return {
22050
- ...options
22051
- };
22052
- };
22053
- Textfield$1.type = type$1;
22054
- Textfield$1.label = 'Text field';
22055
- Textfield$1.keyed = true;
22056
- Textfield$1.emptyValue = '';
22057
- Textfield$1.sanitizeValue = ({
22058
- value
22059
- }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22060
- const type = 'textarea';
22061
- function Textarea(props) {
22062
- const {
22063
- disabled,
22064
- errors = [],
22065
- field,
22066
- value = ''
22067
- } = props;
22068
- const {
22069
- description,
22070
- id,
22071
- label,
22072
- validate = {}
22073
- } = field;
22074
- const {
22075
- required
22076
- } = validate;
22077
- const textareaRef = s$1();
22078
- const onInput = ({
22079
- target
22080
- }) => {
22081
- props.onChange({
22082
- field,
22083
- value: target.value
22084
- });
22085
- };
22086
- const autoSizeTextarea = A$1(textarea => {
22087
- // Ensures the textarea shrinks back, and improves resizing behavior consistency
22088
- textarea.style.height = '0px';
22089
- const computed = window.getComputedStyle(textarea);
22090
- const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
22091
- const minHeight = 75;
22092
- const maxHeight = 350;
22093
- const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
22094
- textarea.style.height = `${displayHeight}px`;
22095
-
22096
- // Overflow is hidden by default to hide scrollbar flickering
22097
- textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
22098
- }, []);
22099
- y(() => {
22100
- autoSizeTextarea(textareaRef.current);
22101
- }, [autoSizeTextarea, value]);
22102
- const {
22103
- formId
22104
- } = F$1(FormContext);
22105
- return e$1("div", {
22106
- class: formFieldClasses(type, {
22107
- errors,
22108
- disabled
22109
- }),
22110
- children: [e$1(Label$1, {
22111
- id: prefixId(id, formId),
22112
- label: label,
22113
- required: required
22114
- }), e$1("textarea", {
22115
- class: "fjs-textarea",
22116
- disabled: disabled,
22117
- id: prefixId(id, formId),
22118
- onInput: onInput,
22119
- value: value,
22120
- ref: textareaRef
22121
- }), e$1(Description$2, {
22122
- description: description
22123
- }), e$1(Errors, {
22124
- errors: errors
22125
- })]
22126
- });
22127
- }
22128
- Textarea.create = function (options = {}) {
22129
- return {
22130
- ...options
22131
- };
22132
- };
22133
- Textarea.type = type;
22134
- Textarea.label = 'Text area';
22135
- Textarea.keyed = true;
22136
- Textarea.emptyValue = '';
22137
- Textarea.sanitizeValue = ({
22138
- value
22139
- }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22140
22472
  const formFields = [Button, Checkbox$1, Checklist, Default, Image, Numberfield, Datetime, Radio, Select$1, Taglist, Text$2, Textfield$1, Textarea];
22141
22473
  class FormFields {
22142
22474
  constructor() {
22143
22475
  this._formFields = {};
22144
22476
  formFields.forEach(formField => {
22145
- const {
22146
- type
22147
- } = formField;
22148
- this.register(type, formField);
22477
+ this.register(formField.type, formField);
22149
22478
  });
22150
22479
  }
22151
22480
  register(type, formField) {
@@ -22186,7 +22515,7 @@
22186
22515
  if (!schema) {
22187
22516
  return null;
22188
22517
  }
22189
- return e$1(FormContext.Provider, {
22518
+ return e$1(FormContext$1.Provider, {
22190
22519
  value: formContext,
22191
22520
  children: e$1(FormComponent, {
22192
22521
  onChange: onChange,
@@ -22403,7 +22732,7 @@
22403
22732
  }
22404
22733
  const value = get$1(data, _path);
22405
22734
  const fieldErrors = validator.validateField(field, value);
22406
- return set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22735
+ return set$2(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22407
22736
  }, /** @type {Errors} */{});
22408
22737
  this._setState({
22409
22738
  errors
@@ -22452,7 +22781,7 @@
22452
22781
  * @param {any} value
22453
22782
  */
22454
22783
  setProperty(property, value) {
22455
- const properties = set$1(this._getState().properties, [property], value);
22784
+ const properties = set$2(this._getState().properties, [property], value);
22456
22785
  this._setState({
22457
22786
  properties
22458
22787
  });
@@ -22517,8 +22846,8 @@
22517
22846
  } = this._getState();
22518
22847
  const validator = this.get('validator');
22519
22848
  const fieldErrors = validator.validateField(field, value);
22520
- set$1(data, _path, value);
22521
- set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22849
+ set$2(data, _path, value);
22850
+ set$2(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22522
22851
  this._setState({
22523
22852
  data: clone(data),
22524
22853
  errors: clone(errors)
@@ -22584,7 +22913,7 @@
22584
22913
  return conditionChecker.applyConditions(toFilter, data);
22585
22914
  }
22586
22915
  }
22587
- const schemaVersion = 6;
22916
+ const schemaVersion = 7;
22588
22917
 
22589
22918
  /**
22590
22919
  * Flatten array, one level deep.
@@ -22895,7 +23224,7 @@
22895
23224
  * @param {(string|number)[]} path The path to the nested value.
22896
23225
  * @param {any} value The value to set.
22897
23226
  */
22898
- function set(target, path, value) {
23227
+ function set$1(target, path, value) {
22899
23228
  let currentTarget = target;
22900
23229
  forEach(path, function (key, idx) {
22901
23230
  if (typeof key !== 'number' && typeof key !== 'string') {
@@ -23214,14 +23543,14 @@
23214
23543
  function rmClass(el, className) {
23215
23544
  el.className = el.className.replace(lookupClass(className), ' ').trim();
23216
23545
  }
23217
- var classes$1 = {
23546
+ var classes$2 = {
23218
23547
  add: addClass,
23219
23548
  rm: rmClass
23220
23549
  };
23221
23550
 
23222
23551
  var emitter = emitter$1;
23223
23552
  var crossvent = crossvent$1;
23224
- var classes = classes$1;
23553
+ var classes$1 = classes$2;
23225
23554
  var doc$1 = document;
23226
23555
  var documentElement = doc$1.documentElement;
23227
23556
  function dragula(initialContainers, options) {
@@ -23376,7 +23705,7 @@
23376
23705
  var offset = getOffset(_item);
23377
23706
  _offsetX = getCoord('pageX', e) - offset.left;
23378
23707
  _offsetY = getCoord('pageY', e) - offset.top;
23379
- classes.add(_copy || _item, 'gu-transit');
23708
+ classes$1.add(_copy || _item, 'gu-transit');
23380
23709
  renderMirrorImage();
23381
23710
  drag(e);
23382
23711
  }
@@ -23520,7 +23849,7 @@
23520
23849
  ungrab();
23521
23850
  removeMirrorImage();
23522
23851
  if (item) {
23523
- classes.rm(item, 'gu-transit');
23852
+ classes$1.rm(item, 'gu-transit');
23524
23853
  }
23525
23854
  if (_renderTimer) {
23526
23855
  clearTimeout(_renderTimer);
@@ -23624,11 +23953,11 @@
23624
23953
  }
23625
23954
  }
23626
23955
  function spillOver(el) {
23627
- classes.rm(el, 'gu-hide');
23956
+ classes$1.rm(el, 'gu-hide');
23628
23957
  }
23629
23958
  function spillOut(el) {
23630
23959
  if (drake.dragging) {
23631
- classes.add(el, 'gu-hide');
23960
+ classes$1.add(el, 'gu-hide');
23632
23961
  }
23633
23962
  }
23634
23963
  function renderMirrorImage() {
@@ -23639,16 +23968,16 @@
23639
23968
  _mirror = _item.cloneNode(true);
23640
23969
  _mirror.style.width = getRectWidth(rect) + 'px';
23641
23970
  _mirror.style.height = getRectHeight(rect) + 'px';
23642
- classes.rm(_mirror, 'gu-transit');
23643
- classes.add(_mirror, 'gu-mirror');
23971
+ classes$1.rm(_mirror, 'gu-transit');
23972
+ classes$1.add(_mirror, 'gu-mirror');
23644
23973
  o.mirrorContainer.appendChild(_mirror);
23645
23974
  touchy(documentElement, 'add', 'mousemove', drag);
23646
- classes.add(o.mirrorContainer, 'gu-unselectable');
23975
+ classes$1.add(o.mirrorContainer, 'gu-unselectable');
23647
23976
  drake.emit('cloned', _mirror, _item, 'mirror');
23648
23977
  }
23649
23978
  function removeMirrorImage() {
23650
23979
  if (_mirror) {
23651
- classes.rm(o.mirrorContainer, 'gu-unselectable');
23980
+ classes$1.rm(o.mirrorContainer, 'gu-unselectable');
23652
23981
  touchy(documentElement, 'remove', 'mousemove', drag);
23653
23982
  getParent(_mirror).removeChild(_mirror);
23654
23983
  _mirror = null;
@@ -23836,7 +24165,7 @@
23836
24165
  }
23837
24166
  var dragula_1 = dragula;
23838
24167
 
23839
- function _mergeNamespaces(n, m) {
24168
+ function _mergeNamespaces$1(n, m) {
23840
24169
  m.forEach(function (e) {
23841
24170
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
23842
24171
  if (k !== 'default' && !(k in n)) {
@@ -23853,6 +24182,140 @@
23853
24182
  return Object.freeze(n);
23854
24183
  }
23855
24184
 
24185
+ /**
24186
+ * Taken from https://github.com/component/classes
24187
+ *
24188
+ * Without the component bits.
24189
+ */
24190
+
24191
+ /**
24192
+ * toString reference.
24193
+ */
24194
+
24195
+ const toString$1 = Object.prototype.toString;
24196
+
24197
+ /**
24198
+ * Wrap `el` in a `ClassList`.
24199
+ *
24200
+ * @param {Element} el
24201
+ * @return {ClassList}
24202
+ * @api public
24203
+ */
24204
+
24205
+ function classes(el) {
24206
+ return new ClassList(el);
24207
+ }
24208
+
24209
+ /**
24210
+ * Initialize a new ClassList for `el`.
24211
+ *
24212
+ * @param {Element} el
24213
+ * @api private
24214
+ */
24215
+
24216
+ function ClassList(el) {
24217
+ if (!el || !el.nodeType) {
24218
+ throw new Error('A DOM element reference is required');
24219
+ }
24220
+ this.el = el;
24221
+ this.list = el.classList;
24222
+ }
24223
+
24224
+ /**
24225
+ * Add class `name` if not already present.
24226
+ *
24227
+ * @param {String} name
24228
+ * @return {ClassList}
24229
+ * @api public
24230
+ */
24231
+
24232
+ ClassList.prototype.add = function (name) {
24233
+ this.list.add(name);
24234
+ return this;
24235
+ };
24236
+
24237
+ /**
24238
+ * Remove class `name` when present, or
24239
+ * pass a regular expression to remove
24240
+ * any which match.
24241
+ *
24242
+ * @param {String|RegExp} name
24243
+ * @return {ClassList}
24244
+ * @api public
24245
+ */
24246
+
24247
+ ClassList.prototype.remove = function (name) {
24248
+ if ('[object RegExp]' == toString$1.call(name)) {
24249
+ return this.removeMatching(name);
24250
+ }
24251
+ this.list.remove(name);
24252
+ return this;
24253
+ };
24254
+
24255
+ /**
24256
+ * Remove all classes matching `re`.
24257
+ *
24258
+ * @param {RegExp} re
24259
+ * @return {ClassList}
24260
+ * @api private
24261
+ */
24262
+
24263
+ ClassList.prototype.removeMatching = function (re) {
24264
+ const arr = this.array();
24265
+ for (let i = 0; i < arr.length; i++) {
24266
+ if (re.test(arr[i])) {
24267
+ this.remove(arr[i]);
24268
+ }
24269
+ }
24270
+ return this;
24271
+ };
24272
+
24273
+ /**
24274
+ * Toggle class `name`, can force state via `force`.
24275
+ *
24276
+ * For browsers that support classList, but do not support `force` yet,
24277
+ * the mistake will be detected and corrected.
24278
+ *
24279
+ * @param {String} name
24280
+ * @param {Boolean} force
24281
+ * @return {ClassList}
24282
+ * @api public
24283
+ */
24284
+
24285
+ ClassList.prototype.toggle = function (name, force) {
24286
+ if ('undefined' !== typeof force) {
24287
+ if (force !== this.list.toggle(name, force)) {
24288
+ this.list.toggle(name); // toggle again to correct
24289
+ }
24290
+ } else {
24291
+ this.list.toggle(name);
24292
+ }
24293
+ return this;
24294
+ };
24295
+
24296
+ /**
24297
+ * Return an array of classes.
24298
+ *
24299
+ * @return {Array}
24300
+ * @api public
24301
+ */
24302
+
24303
+ ClassList.prototype.array = function () {
24304
+ return Array.from(this.list);
24305
+ };
24306
+
24307
+ /**
24308
+ * Check if class `name` is present.
24309
+ *
24310
+ * @param {String} name
24311
+ * @return {ClassList}
24312
+ * @api public
24313
+ */
24314
+
24315
+ ClassList.prototype.has = ClassList.prototype.contains = function (name) {
24316
+ return this.list.contains(name);
24317
+ };
24318
+
23856
24319
  /**
23857
24320
  * @param { HTMLElement } element
23858
24321
  * @param { String } selector
@@ -23916,7 +24379,7 @@
23916
24379
  el[unbind$1$1](prefix$1 + type, fn, capture || false);
23917
24380
  return fn;
23918
24381
  };
23919
- var event = /*#__PURE__*/_mergeNamespaces({
24382
+ var event = /*#__PURE__*/_mergeNamespaces$1({
23920
24383
  __proto__: null,
23921
24384
  bind: bind_1,
23922
24385
  unbind: unbind_1,
@@ -24020,7 +24483,11 @@
24020
24483
  return el.querySelector(selector);
24021
24484
  }
24022
24485
 
24023
- var arrayMove$1 = {exports: {}};
24486
+ var arrayMoveExports = {};
24487
+ var arrayMove$1 = {
24488
+ get exports(){ return arrayMoveExports; },
24489
+ set exports(v){ arrayMoveExports = v; },
24490
+ };
24024
24491
 
24025
24492
  const arrayMoveMutate = (array, from, to) => {
24026
24493
  const startIndex = from < 0 ? array.length + from : from;
@@ -24036,12 +24503,12 @@
24036
24503
  return array;
24037
24504
  };
24038
24505
  arrayMove$1.exports = arrayMove;
24039
- var mutate = arrayMove$1.exports.mutate = arrayMoveMutate;
24506
+ var mutate = arrayMoveExports.mutate = arrayMoveMutate;
24040
24507
 
24041
24508
  /**
24042
24509
  The data structure for documents. @nonabstract
24043
24510
  */
24044
- class Text$1 {
24511
+ let Text$1 = class Text {
24045
24512
  /**
24046
24513
  @internal
24047
24514
  */
@@ -24159,7 +24626,7 @@
24159
24626
  if (text.length == 1 && !text[0]) return Text$1.empty;
24160
24627
  return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
24161
24628
  }
24162
- }
24629
+ };
24163
24630
  // Leaves store an array of line strings. There are always line breaks
24164
24631
  // between these strings. Leaves are limited in size and have to be
24165
24632
  // contained in TextNode instances for bigger documents.
@@ -28030,7 +28497,6 @@
28030
28497
  222: "\""
28031
28498
  };
28032
28499
  var chrome$1 = typeof navigator != "undefined" && /Chrome\/(\d+)/.exec(navigator.userAgent);
28033
- typeof navigator != "undefined" && /Gecko\/\d+/.test(navigator.userAgent);
28034
28500
  var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
28035
28501
  var ie$1 = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
28036
28502
  var brokenModifierNames = mac || chrome$1 && +chrome$1[1] < 57;
@@ -30214,7 +30680,7 @@
30214
30680
  }
30215
30681
  }
30216
30682
  // Reused array of character types
30217
- const types$1 = [];
30683
+ const types = [];
30218
30684
  function computeOrder(line, direction) {
30219
30685
  let len = line.length,
30220
30686
  outerType = direction == LTR ? 1 /* T.L */ : 2 /* T.R */,
@@ -30233,7 +30699,7 @@
30233
30699
  for (let i = 0, prev = outerType, prevStrong = outerType; i < len; i++) {
30234
30700
  let type = charType(line.charCodeAt(i));
30235
30701
  if (type == 512 /* T.NSM */) type = prev;else if (type == 8 /* T.EN */ && prevStrong == 4 /* T.AL */) type = 16 /* T.AN */;
30236
- types$1[i] = type == 4 /* T.AL */ ? 2 /* T.R */ : type;
30702
+ types[i] = type == 4 /* T.AL */ ? 2 /* T.R */ : type;
30237
30703
  if (type & 7 /* T.Strong */) prevStrong = type;
30238
30704
  prev = type;
30239
30705
  }
@@ -30246,17 +30712,17 @@
30246
30712
  // found, then change the type of the European number to L.
30247
30713
  // (Left after this: L, R, EN+AN, NI)
30248
30714
  for (let i = 0, prev = outerType, prevStrong = outerType; i < len; i++) {
30249
- let type = types$1[i];
30715
+ let type = types[i];
30250
30716
  if (type == 128 /* T.CS */) {
30251
- if (i < len - 1 && prev == types$1[i + 1] && prev & 24 /* T.Num */) type = types$1[i] = prev;else types$1[i] = 256 /* T.NI */;
30717
+ if (i < len - 1 && prev == types[i + 1] && prev & 24 /* T.Num */) type = types[i] = prev;else types[i] = 256 /* T.NI */;
30252
30718
  } else if (type == 64 /* T.ET */) {
30253
30719
  let end = i + 1;
30254
- while (end < len && types$1[end] == 64 /* T.ET */) end++;
30255
- let replace = i && prev == 8 /* T.EN */ || end < len && types$1[end] == 8 /* T.EN */ ? prevStrong == 1 /* T.L */ ? 1 /* T.L */ : 8 /* T.EN */ : 256 /* T.NI */;
30256
- for (let j = i; j < end; j++) types$1[j] = replace;
30720
+ while (end < len && types[end] == 64 /* T.ET */) end++;
30721
+ let replace = i && prev == 8 /* T.EN */ || end < len && types[end] == 8 /* T.EN */ ? prevStrong == 1 /* T.L */ ? 1 /* T.L */ : 8 /* T.EN */ : 256 /* T.NI */;
30722
+ for (let j = i; j < end; j++) types[j] = replace;
30257
30723
  i = end - 1;
30258
30724
  } else if (type == 8 /* T.EN */ && prevStrong == 1 /* T.L */) {
30259
- types$1[i] = 1 /* T.L */;
30725
+ types[i] = 1 /* T.L */;
30260
30726
  }
30261
30727
 
30262
30728
  prev = type;
@@ -30276,7 +30742,7 @@
30276
30742
  if (BracketStack[sJ + 1] == -br) {
30277
30743
  let flags = BracketStack[sJ + 2];
30278
30744
  let type = flags & 2 /* Bracketed.EmbedInside */ ? outerType : !(flags & 4 /* Bracketed.OppositeInside */) ? 0 : flags & 1 /* Bracketed.OppositeBefore */ ? oppositeType : outerType;
30279
- if (type) types$1[i] = types$1[BracketStack[sJ]] = type;
30745
+ if (type) types[i] = types[BracketStack[sJ]] = type;
30280
30746
  sI = sJ;
30281
30747
  break;
30282
30748
  }
@@ -30288,7 +30754,7 @@
30288
30754
  BracketStack[sI++] = ch;
30289
30755
  BracketStack[sI++] = context;
30290
30756
  }
30291
- } else if ((type = types$1[i]) == 2 /* T.R */ || type == 1 /* T.L */) {
30757
+ } else if ((type = types[i]) == 2 /* T.R */ || type == 1 /* T.L */) {
30292
30758
  let embed = type == outerType;
30293
30759
  context = embed ? 0 : 1 /* Bracketed.OppositeBefore */;
30294
30760
  for (let sJ = sI - 3; sJ >= 0; sJ -= 3) {
@@ -30311,13 +30777,13 @@
30311
30777
  // N2. Any remaining neutrals take the embedding direction.
30312
30778
  // (Left after this: L, R, EN+AN)
30313
30779
  for (let i = 0; i < len; i++) {
30314
- if (types$1[i] == 256 /* T.NI */) {
30780
+ if (types[i] == 256 /* T.NI */) {
30315
30781
  let end = i + 1;
30316
- while (end < len && types$1[end] == 256 /* T.NI */) end++;
30317
- let beforeL = (i ? types$1[i - 1] : outerType) == 1 /* T.L */;
30318
- let afterL = (end < len ? types$1[end] : outerType) == 1 /* T.L */;
30782
+ while (end < len && types[end] == 256 /* T.NI */) end++;
30783
+ let beforeL = (i ? types[i - 1] : outerType) == 1 /* T.L */;
30784
+ let afterL = (end < len ? types[end] : outerType) == 1 /* T.L */;
30319
30785
  let replace = beforeL == afterL ? beforeL ? 1 /* T.L */ : 2 /* T.R */ : outerType;
30320
- for (let j = i; j < end; j++) types$1[j] = replace;
30786
+ for (let j = i; j < end; j++) types[j] = replace;
30321
30787
  i = end - 1;
30322
30788
  }
30323
30789
  }
@@ -30330,13 +30796,13 @@
30330
30796
  if (outerType == 1 /* T.L */) {
30331
30797
  for (let i = 0; i < len;) {
30332
30798
  let start = i,
30333
- rtl = types$1[i++] != 1 /* T.L */;
30334
- while (i < len && rtl == (types$1[i] != 1 /* T.L */)) i++;
30799
+ rtl = types[i++] != 1 /* T.L */;
30800
+ while (i < len && rtl == (types[i] != 1 /* T.L */)) i++;
30335
30801
  if (rtl) {
30336
30802
  for (let j = i; j > start;) {
30337
30803
  let end = j,
30338
- l = types$1[--j] != 2 /* T.R */;
30339
- while (j > start && l == (types$1[j - 1] != 2 /* T.R */)) j--;
30804
+ l = types[--j] != 2 /* T.R */;
30805
+ while (j > start && l == (types[j - 1] != 2 /* T.R */)) j--;
30340
30806
  order.push(new BidiSpan(j, end, l ? 2 : 1));
30341
30807
  }
30342
30808
  } else {
@@ -30346,8 +30812,8 @@
30346
30812
  } else {
30347
30813
  for (let i = 0; i < len;) {
30348
30814
  let start = i,
30349
- rtl = types$1[i++] == 2 /* T.R */;
30350
- while (i < len && rtl == (types$1[i] == 2 /* T.R */)) i++;
30815
+ rtl = types[i++] == 2 /* T.R */;
30816
+ while (i < len && rtl == (types[i] == 2 /* T.R */)) i++;
30351
30817
  order.push(new BidiSpan(start, i, rtl ? 1 : 2));
30352
30818
  }
30353
30819
  }
@@ -44343,9 +44809,12 @@
44343
44809
  });
44344
44810
 
44345
44811
  var componentEvent = {};
44346
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
44347
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
44812
+ var bind$1, unbind$1, prefix;
44813
+ function detect() {
44814
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
44815
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
44348
44816
  prefix = bind$1 !== 'addEventListener' ? 'on' : '';
44817
+ }
44349
44818
 
44350
44819
  /**
44351
44820
  * Bind `el` event `type` to `fn`.
@@ -44359,6 +44828,7 @@
44359
44828
  */
44360
44829
 
44361
44830
  componentEvent.bind = function (el, type, fn, capture) {
44831
+ if (!bind$1) detect();
44362
44832
  el[bind$1](prefix + type, fn, capture || false);
44363
44833
  return fn;
44364
44834
  };
@@ -44375,6 +44845,7 @@
44375
44845
  */
44376
44846
 
44377
44847
  componentEvent.unbind = function (el, type, fn, capture) {
44848
+ if (!unbind$1) detect();
44378
44849
  el[unbind$1](prefix + type, fn, capture || false);
44379
44850
  return fn;
44380
44851
  };
@@ -44472,6 +44943,71 @@
44472
44943
  }
44473
44944
  var domify$1 = domify;
44474
44945
 
44946
+ /**
44947
+ * Create an array of syntax errors in the given tree.
44948
+ *
44949
+ * @param {Tree} syntaxTree
44950
+ * @returns {LintMessage[]} array of syntax errors
44951
+ */
44952
+ function lintSyntax(syntaxTree) {
44953
+ const lintMessages = [];
44954
+ syntaxTree.iterate({
44955
+ enter: node => {
44956
+ if (node.type.isError) {
44957
+ const error = node.toString();
44958
+
44959
+ /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
44960
+ const match = /\((.*?)\)/.exec(error);
44961
+ const nodeType = match && match[1];
44962
+ let message;
44963
+ if (nodeType) {
44964
+ message = 'unexpected ' + nodeType;
44965
+ } else {
44966
+ message = 'expression expected';
44967
+ }
44968
+ lintMessages.push({
44969
+ from: node.from,
44970
+ to: node.to,
44971
+ severity: 'error',
44972
+ message: message,
44973
+ type: 'syntaxError'
44974
+ });
44975
+ }
44976
+ }
44977
+ });
44978
+ return lintMessages;
44979
+ }
44980
+
44981
+ /**
44982
+ * Generates lint messages for the given syntax tree.
44983
+ *
44984
+ * @param {Tree} syntaxTree
44985
+ * @returns {LintMessage[]} array of all lint messages
44986
+ */
44987
+ function lintAll(syntaxTree) {
44988
+ const lintMessages = [...lintSyntax(syntaxTree)];
44989
+ return lintMessages;
44990
+ }
44991
+
44992
+ /**
44993
+ * CodeMirror extension that provides linting for FEEL expressions.
44994
+ *
44995
+ * @param {EditorView} editorView
44996
+ * @returns {Source} CodeMirror linting source
44997
+ */
44998
+ const cmFeelLinter = () => editorView => {
44999
+ // don't lint if the Editor is empty
45000
+ if (editorView.state.doc.length === 0) {
45001
+ return [];
45002
+ }
45003
+ const tree = syntaxTree(editorView.state);
45004
+ const messages = lintAll(tree);
45005
+ return messages.map(message => ({
45006
+ ...message,
45007
+ source: 'syntaxError'
45008
+ }));
45009
+ };
45010
+
44475
45011
  // helpers ///////////////////////////////
44476
45012
 
44477
45013
  function isNodeEmpty(node) {
@@ -44743,9 +45279,10 @@
44743
45279
  label: tag.name,
44744
45280
  type: 'function',
44745
45281
  info: () => {
44746
- const html = domify$1(tag.description);
45282
+ const html = domify$1(`<div class="description">${tag.description}<div>`);
44747
45283
  return html;
44748
- }
45284
+ },
45285
+ boost: -1
44749
45286
  }));
44750
45287
  var builtins = context => {
44751
45288
  let nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
@@ -44776,6 +45313,86 @@
44776
45313
  * @type {Facet<import('..').Variable[]>} Variable
44777
45314
  */
44778
45315
  const variablesFacet$1 = Facet.define();
45316
+ var pathExpression = context => {
45317
+ const variables = context.state.facet(variablesFacet$1)[0];
45318
+ const nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
45319
+ if (!isPathExpression(nodeBefore)) {
45320
+ return;
45321
+ }
45322
+ const expression = findPathExpression(nodeBefore);
45323
+
45324
+ // if the cursor is directly after the `.`, variable starts at the cursor position
45325
+ const from = nodeBefore === expression ? context.pos : nodeBefore.from;
45326
+ const path = getPath(expression, context);
45327
+ let options = variables;
45328
+ for (var i = 0; i < path.length - 1; i++) {
45329
+ var childVar = options.find(val => val.name === path[i].name);
45330
+ if (!childVar) {
45331
+ return null;
45332
+ }
45333
+
45334
+ // only suggest if variable type matches
45335
+ if (childVar.isList !== 'optional' && !!childVar.isList !== path[i].isList) {
45336
+ return;
45337
+ }
45338
+ options = childVar.entries;
45339
+ }
45340
+ if (!options) return;
45341
+ options = options.map(v => ({
45342
+ label: v.name,
45343
+ type: 'variable',
45344
+ info: v.info,
45345
+ detail: v.detail
45346
+ }));
45347
+ const result = {
45348
+ from: from,
45349
+ options: options
45350
+ };
45351
+ return result;
45352
+ };
45353
+ function findPathExpression(node) {
45354
+ while (node) {
45355
+ if (node.name === 'PathExpression') {
45356
+ return node;
45357
+ }
45358
+ node = node.parent;
45359
+ }
45360
+ }
45361
+
45362
+ // parses the path expression into a list of variable names with type information
45363
+ // e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ]
45364
+ function getPath(node, context) {
45365
+ let path = [];
45366
+ for (let child = node.firstChild; child; child = child.nextSibling) {
45367
+ if (child.name === 'PathExpression') {
45368
+ path.push(...getPath(child, context));
45369
+ } else if (child.name === 'FilterExpression') {
45370
+ path.push(...getFilter(child, context));
45371
+ } else {
45372
+ path.push({
45373
+ name: getNodeContent(child, context),
45374
+ isList: false
45375
+ });
45376
+ }
45377
+ }
45378
+ return path;
45379
+ }
45380
+ function getFilter(node, context) {
45381
+ const list = node.firstChild;
45382
+ if (list.name === 'PathExpression') {
45383
+ const path = getPath(list, context);
45384
+ const last = path[path.length - 1];
45385
+ last.isList = true;
45386
+ return path;
45387
+ }
45388
+ return [{
45389
+ name: getNodeContent(list, context),
45390
+ isList: true
45391
+ }];
45392
+ }
45393
+ function getNodeContent(node, context) {
45394
+ return context.state.sliceDoc(node.from, node.to);
45395
+ }
44779
45396
 
44780
45397
  /**
44781
45398
  * @type {import('@codemirror/autocomplete').CompletionSource}
@@ -44816,48 +45433,16 @@
44816
45433
  };
44817
45434
  function autocompletion$1() {
44818
45435
  return [autocompletion$2({
44819
- override: [variables, builtins, completeFromList(snippets)]
45436
+ override: [variables, builtins, completeFromList(snippets.map(s => ({
45437
+ ...s,
45438
+ boost: -1
45439
+ }))), pathExpression]
44820
45440
  })];
44821
45441
  }
44822
45442
  function language() {
44823
45443
  return new LanguageSupport(feelLanguage, []);
44824
45444
  }
44825
- const FeelLinter = function (editorView) {
44826
- const messages = [];
44827
-
44828
- // don't lint if the Editor is empty
44829
- if (editorView.state.doc.length === 0) {
44830
- return messages;
44831
- }
44832
- const tree = syntaxTree(editorView.state);
44833
- tree.iterate({
44834
- enter: node => {
44835
- if (node.type.isError) {
44836
- const error = node.toString();
44837
-
44838
- /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
44839
- const match = /\((.*?)\)/.exec(error);
44840
- const nodeType = match && match[1];
44841
- let message;
44842
- if (nodeType) {
44843
- message = 'unexpected ' + nodeType;
44844
- } else {
44845
- message = 'expression expected';
44846
- }
44847
- messages.push({
44848
- from: node.from,
44849
- to: node.to,
44850
- severity: 'error',
44851
- message: message,
44852
- source: 'syntaxError'
44853
- });
44854
- }
44855
- }
44856
- });
44857
- return messages;
44858
- };
44859
- var syntaxLinter = linter$1(FeelLinter);
44860
- var linter = [syntaxLinter];
45445
+ var linter = [linter$1(cmFeelLinter())];
44861
45446
  const baseTheme$2 = EditorView.theme({
44862
45447
  '& .cm-content': {
44863
45448
  padding: '0px'
@@ -44936,9 +45521,11 @@
44936
45521
 
44937
45522
  /**
44938
45523
  * @typedef {object} Variable
44939
- * @property {string} name
44940
- * @property {string} [info]
44941
- * @property {string} [detail]
45524
+ * @property {string} name name or key of the variable
45525
+ * @property {string} [info] short information about the variable, e.g. type
45526
+ * @property {string} [detail] longer description of the variable content
45527
+ * @property {boolean} [isList] whether the variable is a list
45528
+ * @property {array<Variable>} [schema] array of child variables if the variable is a context or list
44942
45529
  */
44943
45530
 
44944
45531
  const autocompletionConf = new Compartment();
@@ -46646,9 +47233,118 @@
46646
47233
  var importModule = {
46647
47234
  importer: ['type', Importer]
46648
47235
  };
47236
+ function editorFormFieldClasses(type, {
47237
+ disabled = false
47238
+ } = {}) {
47239
+ if (!type) {
47240
+ throw new Error('type required');
47241
+ }
47242
+ return classNames('fjs-form-field', `fjs-form-field-${type}`, {
47243
+ 'fjs-disabled': disabled
47244
+ });
47245
+ }
47246
+ function _extends$2() {
47247
+ _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
47248
+ for (var i = 1; i < arguments.length; i++) {
47249
+ var source = arguments[i];
47250
+ for (var key in source) {
47251
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47252
+ target[key] = source[key];
47253
+ }
47254
+ }
47255
+ }
47256
+ return target;
47257
+ };
47258
+ return _extends$2.apply(this, arguments);
47259
+ }
47260
+ var CloseIcon = ({
47261
+ styles = {},
47262
+ ...props
47263
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2({
47264
+ width: "16",
47265
+ height: "16",
47266
+ fill: "currentColor",
47267
+ xmlns: "http://www.w3.org/2000/svg"
47268
+ }, props), /*#__PURE__*/React.createElement("path", {
47269
+ fillRule: "evenodd",
47270
+ clipRule: "evenodd",
47271
+ d: "M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7z"
47272
+ }));
47273
+ function _extends$1() {
47274
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
47275
+ for (var i = 1; i < arguments.length; i++) {
47276
+ var source = arguments[i];
47277
+ for (var key in source) {
47278
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47279
+ target[key] = source[key];
47280
+ }
47281
+ }
47282
+ }
47283
+ return target;
47284
+ };
47285
+ return _extends$1.apply(this, arguments);
47286
+ }
47287
+ var SearchIcon = ({
47288
+ styles = {},
47289
+ ...props
47290
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
47291
+ width: "15",
47292
+ height: "15",
47293
+ fill: "none",
47294
+ xmlns: "http://www.w3.org/2000/svg"
47295
+ }, props), /*#__PURE__*/React.createElement("path", {
47296
+ d: "M14.5 13.793l-3.776-3.776a5.508 5.508 0 10-.707.707l3.776 3.776.707-.707zM2 6.5a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0z",
47297
+ fill: "currentColor"
47298
+ }));
47299
+ function EditorText(props) {
47300
+ const {
47301
+ type,
47302
+ text = ''
47303
+ } = props.field;
47304
+ const Icon = iconsByType['text'];
47305
+ if (!text) {
47306
+ return e$1("div", {
47307
+ class: editorFormFieldClasses(type),
47308
+ children: e$1("div", {
47309
+ class: "fjs-form-field-placeholder",
47310
+ children: [e$1(Icon, {
47311
+ viewBox: "0 0 54 54"
47312
+ }), "Text view is empty"]
47313
+ })
47314
+ });
47315
+ }
47316
+ if (isExpression$1(text)) {
47317
+ return e$1("div", {
47318
+ class: editorFormFieldClasses(type),
47319
+ children: e$1("div", {
47320
+ class: "fjs-form-field-placeholder",
47321
+ children: [e$1(Icon, {
47322
+ viewBox: "0 0 54 54"
47323
+ }), "Text view is populated by an expression"]
47324
+ })
47325
+ });
47326
+ }
47327
+ return e$1(Text$2, {
47328
+ ...props,
47329
+ disableLinks: true
47330
+ });
47331
+ }
47332
+ EditorText.create = Text$2.create;
47333
+ EditorText.type = Text$2.type;
47334
+ EditorText.keyed = Text$2.keyed;
47335
+ const editorFormFields = [EditorText];
47336
+ class EditorFormFields extends FormFields {
47337
+ constructor() {
47338
+ super();
47339
+ editorFormFields.forEach(formField => {
47340
+ this.register(formField.type, formField);
47341
+ });
47342
+ }
47343
+ }
46649
47344
  const DragAndDropContext = D$1({
46650
47345
  drake: null
46651
47346
  });
47347
+ var DragAndDropContext$1 = DragAndDropContext;
46652
47348
 
46653
47349
  /**
46654
47350
  * @param {string} type
@@ -46660,10 +47356,11 @@
46660
47356
  const FormEditorContext = D$1({
46661
47357
  getService: getService$1
46662
47358
  });
47359
+ var FormEditorContext$1 = FormEditorContext;
46663
47360
  function useService$1(type, strict) {
46664
47361
  const {
46665
47362
  getService
46666
- } = F$1(FormEditorContext);
47363
+ } = F$1(FormEditorContext$1);
46667
47364
  return getService(type, strict);
46668
47365
  }
46669
47366
  function _extends() {
@@ -46690,6 +47387,147 @@
46690
47387
  }, props), /*#__PURE__*/React.createElement("path", {
46691
47388
  d: "M10 4v8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V4h9zM8 6H3v4.8c0 .66.5 1.2 1.111 1.2H6.89C7.5 12 8 11.46 8 10.8V6zm3-5H8.5l-1-1h-4l-1 1H0v1.5h11V1z"
46692
47389
  }));
47390
+ const PALETTE_ENTRIES = formFields.filter(f => f.type !== 'default').map(f => {
47391
+ return {
47392
+ label: f.label,
47393
+ type: f.type,
47394
+ group: f.group
47395
+ };
47396
+ });
47397
+ const PALETTE_GROUPS = [{
47398
+ label: 'Basic input',
47399
+ id: 'basic-input'
47400
+ }, {
47401
+ label: 'Selection',
47402
+ id: 'selection'
47403
+ }, {
47404
+ label: 'Presentation',
47405
+ id: 'presentation'
47406
+ }, {
47407
+ label: 'Action',
47408
+ id: 'action'
47409
+ }];
47410
+ function Palette(props) {
47411
+ const [entries, setEntries] = l$2(PALETTE_ENTRIES);
47412
+ const [searchTerm, setSearchTerm] = l$2('');
47413
+ const inputRef = s$1();
47414
+ const groups = groupEntries(entries);
47415
+
47416
+ // filter entries on search change
47417
+ y(() => {
47418
+ const filter = entry => {
47419
+ if (!searchTerm) {
47420
+ return true;
47421
+ }
47422
+ const search = entry.label.toLowerCase();
47423
+ return searchTerm.toLowerCase().split(/\s/g).every(term => search.includes(term));
47424
+ };
47425
+ const entries = PALETTE_ENTRIES.filter(filter);
47426
+ setEntries(entries);
47427
+ }, [searchTerm]);
47428
+ const handleInput = A$1(event => {
47429
+ setSearchTerm(() => event.target.value);
47430
+ }, [setSearchTerm]);
47431
+ const handleClear = A$1(event => {
47432
+ setSearchTerm('');
47433
+ inputRef.current.focus();
47434
+ }, [inputRef, setSearchTerm]);
47435
+ return e$1("div", {
47436
+ class: "fjs-palette",
47437
+ children: [e$1("div", {
47438
+ class: "fjs-palette-header",
47439
+ title: "Components",
47440
+ children: "Components"
47441
+ }), e$1("div", {
47442
+ class: "fjs-palette-search-container",
47443
+ children: [e$1("span", {
47444
+ class: "fjs-palette-search-icon",
47445
+ children: e$1(SearchIcon, {})
47446
+ }), e$1("input", {
47447
+ class: "fjs-palette-search",
47448
+ ref: inputRef,
47449
+ type: "text",
47450
+ placeholder: "Search components",
47451
+ value: searchTerm,
47452
+ onInput: handleInput
47453
+ }), searchTerm && e$1("button", {
47454
+ title: "Clear content",
47455
+ class: "fjs-palette-search-clear",
47456
+ onClick: handleClear,
47457
+ children: e$1(CloseIcon, {})
47458
+ })]
47459
+ }), e$1("div", {
47460
+ class: "fjs-palette-entries",
47461
+ children: [groups.map(({
47462
+ label,
47463
+ entries,
47464
+ id
47465
+ }) => e$1("div", {
47466
+ class: "fjs-palette-group",
47467
+ "data-group-id": id,
47468
+ children: [e$1("span", {
47469
+ class: "fjs-palette-group-title",
47470
+ children: label
47471
+ }), e$1("div", {
47472
+ class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
47473
+ children: entries.map(({
47474
+ label,
47475
+ type
47476
+ }) => {
47477
+ const Icon = iconsByType[type];
47478
+ return e$1("div", {
47479
+ class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
47480
+ "data-field-type": type,
47481
+ title: `Create a ${label} element`,
47482
+ children: [Icon ? e$1(Icon, {
47483
+ class: "fjs-palette-field-icon",
47484
+ width: "36",
47485
+ height: "36",
47486
+ viewBox: "0 0 54 54"
47487
+ }) : null, e$1("span", {
47488
+ class: "fjs-palette-field-text",
47489
+ children: label
47490
+ })]
47491
+ });
47492
+ })
47493
+ })]
47494
+ })), groups.length == 0 && e$1("div", {
47495
+ class: "fjs-palette-no-entries",
47496
+ children: "No components found."
47497
+ })]
47498
+ })]
47499
+ });
47500
+ }
47501
+
47502
+ // helpers ///////
47503
+
47504
+ function groupEntries(entries) {
47505
+ const groups = PALETTE_GROUPS.map(group => {
47506
+ return {
47507
+ ...group,
47508
+ entries: []
47509
+ };
47510
+ });
47511
+ const getGroup = id => groups.find(group => id === group.id);
47512
+ entries.forEach(entry => {
47513
+ const {
47514
+ group
47515
+ } = entry;
47516
+ getGroup(group).entries.push(entry);
47517
+ });
47518
+ return groups.filter(g => g.entries.length);
47519
+ }
47520
+ const CURSOR_CLS_PATTERN = /^fjs-cursor-.*$/;
47521
+ function set(mode) {
47522
+ const classes$1 = classes(document.body);
47523
+ classes$1.removeMatching(CURSOR_CLS_PATTERN);
47524
+ if (mode) {
47525
+ classes$1.add('fjs-cursor-' + mode);
47526
+ }
47527
+ }
47528
+ function unset() {
47529
+ set(null);
47530
+ }
46693
47531
  function ContextPad(props) {
46694
47532
  if (!props.children) {
46695
47533
  return null;
@@ -46813,6 +47651,9 @@
46813
47651
  drake
46814
47652
  };
46815
47653
  y(() => {
47654
+ const handleDragEvent = (type, context) => {
47655
+ return eventBus.fire(type, context);
47656
+ };
46816
47657
  const createDragulaInstance = () => {
46817
47658
  const dragulaInstance = dragula_1({
46818
47659
  isContainer(el) {
@@ -46827,6 +47668,56 @@
46827
47668
  slideFactorX: 10,
46828
47669
  slideFactorY: 5
46829
47670
  });
47671
+
47672
+ // bind life cycle events
47673
+ dragulaInstance.on('drag', (element, source) => {
47674
+ handleDragEvent('drag.start', {
47675
+ element,
47676
+ source
47677
+ });
47678
+ });
47679
+ dragulaInstance.on('dragend', element => {
47680
+ handleDragEvent('drag.end', {
47681
+ element
47682
+ });
47683
+ });
47684
+ dragulaInstance.on('drop', (element, target, source, sibling) => {
47685
+ handleDragEvent('drag.drop', {
47686
+ element,
47687
+ target,
47688
+ source,
47689
+ sibling
47690
+ });
47691
+ });
47692
+ dragulaInstance.on('over', (element, container, source) => {
47693
+ handleDragEvent('drag.hover', {
47694
+ element,
47695
+ container,
47696
+ source
47697
+ });
47698
+ });
47699
+ dragulaInstance.on('out', (element, container, source) => {
47700
+ handleDragEvent('drag.out', {
47701
+ element,
47702
+ container,
47703
+ source
47704
+ });
47705
+ });
47706
+ dragulaInstance.on('cancel', (element, container, source) => {
47707
+ handleDragEvent('drag.cancel', {
47708
+ element,
47709
+ container,
47710
+ source
47711
+ });
47712
+ });
47713
+
47714
+ // set custom styling
47715
+ dragulaInstance.on('drag', () => {
47716
+ set('grabbing');
47717
+ });
47718
+ dragulaInstance.on('dragend', () => {
47719
+ unset();
47720
+ });
46830
47721
  dragulaInstance.on('drop', (el, target, source, sibling) => {
46831
47722
  dragulaInstance.remove();
46832
47723
  if (!target) {
@@ -46883,9 +47774,7 @@
46883
47774
  const formContext = {
46884
47775
  getService(type, strict = true) {
46885
47776
  // TODO(philippfromme): clean up
46886
- if (type === 'formFieldRegistry') {
46887
- return new Map();
46888
- } else if (type === 'form') {
47777
+ if (type === 'form') {
46889
47778
  return {
46890
47779
  _getState() {
46891
47780
  return {
@@ -46923,16 +47812,16 @@
46923
47812
  }, [propertiesPanelRef, propertiesPanel, hasDefaultPropertiesPanel]);
46924
47813
  return e$1("div", {
46925
47814
  class: "fjs-form-editor",
46926
- children: [e$1(DragAndDropContext.Provider, {
47815
+ children: [e$1(DragAndDropContext$1.Provider, {
46927
47816
  value: dragAndDropContext,
46928
47817
  children: [hasDefaultPalette && e$1("div", {
46929
47818
  class: "fjs-editor-palette-container",
46930
47819
  ref: paletteRef
46931
47820
  }), e$1("div", {
46932
47821
  class: "fjs-form-container",
46933
- children: e$1(FormContext.Provider, {
47822
+ children: e$1(FormContext$1.Provider, {
46934
47823
  value: formContext,
46935
- children: e$1(FormRenderContext.Provider, {
47824
+ children: e$1(FormRenderContext$1.Provider, {
46936
47825
  value: formRenderContext,
46937
47826
  children: e$1(FormComponent, {
46938
47827
  onSubmit: onSubmit,
@@ -46961,14 +47850,32 @@
46961
47850
  function CreatePreview(props) {
46962
47851
  const {
46963
47852
  drake
46964
- } = F$1(DragAndDropContext);
47853
+ } = F$1(DragAndDropContext$1);
46965
47854
  function handleCloned(clone, original, type) {
46966
47855
  const fieldType = clone.dataset.fieldType;
46967
47856
  const Icon = iconsByType[fieldType];
47857
+ const {
47858
+ label
47859
+ } = findPaletteEntry(fieldType);
46968
47860
  if (fieldType) {
46969
47861
  clone.innerHTML = '';
46970
47862
  clone.class = 'gu-mirror';
46971
- S$1(e$1(Icon, {}), clone);
47863
+ if (original.classList.contains('fjs-palette-field')) {
47864
+ S$1(e$1("div", {
47865
+ class: "fjs-palette-field",
47866
+ children: [e$1(Icon, {
47867
+ class: "fjs-palette-field-icon",
47868
+ width: "36",
47869
+ height: "36",
47870
+ viewBox: "0 0 54 54"
47871
+ }), e$1("span", {
47872
+ class: "fjs-palette-field-text",
47873
+ children: label
47874
+ })]
47875
+ }), clone);
47876
+ } else {
47877
+ S$1(e$1(Icon, {}), clone);
47878
+ }
46972
47879
  }
46973
47880
  }
46974
47881
  y(() => {
@@ -46989,6 +47896,9 @@
46989
47896
  function defaultPropertiesPanel(propertiesPanelConfig) {
46990
47897
  return !(propertiesPanelConfig && propertiesPanelConfig.parent);
46991
47898
  }
47899
+ function findPaletteEntry(type) {
47900
+ return PALETTE_ENTRIES.find(entry => entry.type === type);
47901
+ }
46992
47902
  class Renderer {
46993
47903
  constructor(renderConfig, eventBus, formEditor, injector) {
46994
47904
  const {
@@ -47013,7 +47923,7 @@
47013
47923
  }
47014
47924
  return e$1("div", {
47015
47925
  class: `fjs-container fjs-editor-container ${compact ? 'fjs-editor-compact' : ''}`,
47016
- children: e$1(FormEditorContext.Provider, {
47926
+ children: e$1(FormEditorContext$1.Provider, {
47017
47927
  value: formEditorContext,
47018
47928
  children: e$1(FormEditor$1, {})
47019
47929
  })
@@ -47030,7 +47940,7 @@
47030
47940
  Renderer.$inject = ['config.renderer', 'eventBus', 'formEditor', 'injector'];
47031
47941
  var renderModule = {
47032
47942
  __init__: ['formFields', 'renderer'],
47033
- formFields: ['type', FormFields],
47943
+ formFields: ['type', EditorFormFields],
47034
47944
  renderer: ['type', Renderer]
47035
47945
  };
47036
47946
  var core = {
@@ -48851,78 +49761,6 @@
48851
49761
  selection: ['type', Selection],
48852
49762
  selectionBehavior: ['type', SelectionBehavior]
48853
49763
  };
48854
- const types = [{
48855
- label: 'Text field',
48856
- type: 'textfield'
48857
- }, {
48858
- label: 'Text area',
48859
- type: 'textarea'
48860
- }, {
48861
- label: 'Number',
48862
- type: 'number'
48863
- }, {
48864
- label: 'Datetime',
48865
- type: 'datetime'
48866
- }, {
48867
- label: 'Checkbox',
48868
- type: 'checkbox'
48869
- }, {
48870
- label: 'Checklist',
48871
- type: 'checklist'
48872
- }, {
48873
- label: 'Taglist',
48874
- type: 'taglist'
48875
- }, {
48876
- label: 'Radio',
48877
- type: 'radio'
48878
- }, {
48879
- label: 'Select',
48880
- type: 'select'
48881
- }, {
48882
- label: 'Text view',
48883
- type: 'text'
48884
- }, {
48885
- label: 'Image view',
48886
- type: 'image'
48887
- }, {
48888
- label: 'Button',
48889
- type: 'button'
48890
- }];
48891
- function Palette(props) {
48892
- return e$1("div", {
48893
- class: "fjs-palette",
48894
- children: [e$1("div", {
48895
- class: "fjs-palette-header",
48896
- title: "Form elements library",
48897
- children: [e$1("span", {
48898
- class: "fjs-hide-compact",
48899
- children: "FORM ELEMENTS "
48900
- }), "LIBRARY"]
48901
- }), e$1("div", {
48902
- class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
48903
- children: types.map(({
48904
- label,
48905
- type
48906
- }) => {
48907
- const Icon = iconsByType[type];
48908
- return e$1("div", {
48909
- class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
48910
- "data-field-type": type,
48911
- title: `Create a ${label} element`,
48912
- children: [Icon ? e$1(Icon, {
48913
- class: "fjs-palette-field-icon",
48914
- width: "36",
48915
- height: "36",
48916
- viewBox: "0 0 54 54"
48917
- }) : null, e$1("span", {
48918
- class: "fjs-palette-field-text",
48919
- children: label
48920
- })]
48921
- });
48922
- })
48923
- })]
48924
- });
48925
- }
48926
49764
  class PaletteRenderer {
48927
49765
  constructor(paletteConfig, eventBus) {
48928
49766
  const {
@@ -49142,19 +49980,19 @@
49142
49980
  errors: {}
49143
49981
  });
49144
49982
 
49145
- /**
49146
- * @typedef {Function} <propertiesPanel.showEntry> callback
49147
- *
49148
- * @example
49149
- *
49150
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
49151
- * // ...
49152
- * });
49153
- *
49154
- * @param {Object} context
49155
- * @param {boolean} [context.focus]
49156
- *
49157
- * @returns void
49983
+ /**
49984
+ * @typedef {Function} <propertiesPanel.showEntry> callback
49985
+ *
49986
+ * @example
49987
+ *
49988
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
49989
+ * // ...
49990
+ * });
49991
+ *
49992
+ * @param {Object} context
49993
+ * @param {boolean} [context.focus]
49994
+ *
49995
+ * @returns void
49158
49996
  */
49159
49997
  const EventContext = D$1({
49160
49998
  eventBus: null
@@ -49166,20 +50004,20 @@
49166
50004
  setLayoutForKey: () => {}
49167
50005
  });
49168
50006
 
49169
- /**
49170
- * Accesses the global DescriptionContext and returns a description for a given id and element.
49171
- *
49172
- * @example
49173
- * ```jsx
49174
- * function TextField(props) {
49175
- * const description = useDescriptionContext('input1', element);
49176
- * }
49177
- * ```
49178
- *
49179
- * @param {string} id
49180
- * @param {object} element
49181
- *
49182
- * @returns {string}
50007
+ /**
50008
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
50009
+ *
50010
+ * @example
50011
+ * ```jsx
50012
+ * function TextField(props) {
50013
+ * const description = useDescriptionContext('input1', element);
50014
+ * }
50015
+ * ```
50016
+ *
50017
+ * @param {string} id
50018
+ * @param {object} element
50019
+ *
50020
+ * @returns {string}
49183
50021
  */
49184
50022
  function useDescriptionContext(id, element) {
49185
50023
  const {
@@ -49194,11 +50032,11 @@
49194
50032
  return errors[id];
49195
50033
  }
49196
50034
 
49197
- /**
49198
- * Subscribe to an event immediately. Update subscription after inputs changed.
49199
- *
49200
- * @param {string} event
49201
- * @param {Function} callback
50035
+ /**
50036
+ * Subscribe to an event immediately. Update subscription after inputs changed.
50037
+ *
50038
+ * @param {string} event
50039
+ * @param {Function} callback
49202
50040
  */
49203
50041
  function useEvent(event, callback, eventBus) {
49204
50042
  const eventContext = F$1(EventContext);
@@ -49228,20 +50066,20 @@
49228
50066
  }, [callback, event, eventBus]);
49229
50067
  }
49230
50068
 
49231
- /**
49232
- * Creates a state that persists in the global LayoutContext.
49233
- *
49234
- * @example
49235
- * ```jsx
49236
- * function Group(props) {
49237
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
49238
- * }
49239
- * ```
49240
- *
49241
- * @param {(string|number)[]} path
49242
- * @param {any} [defaultValue]
49243
- *
49244
- * @returns {[ any, Function ]}
50069
+ /**
50070
+ * Creates a state that persists in the global LayoutContext.
50071
+ *
50072
+ * @example
50073
+ * ```jsx
50074
+ * function Group(props) {
50075
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
50076
+ * }
50077
+ * ```
50078
+ *
50079
+ * @param {(string|number)[]} path
50080
+ * @param {any} [defaultValue]
50081
+ *
50082
+ * @returns {[ any, Function ]}
49245
50083
  */
49246
50084
  function useLayoutState(path, defaultValue) {
49247
50085
  const {
@@ -49260,11 +50098,11 @@
49260
50098
  return [value, setState];
49261
50099
  }
49262
50100
 
49263
- /**
49264
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
49265
- * state on updates.
49266
- *
49267
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
50101
+ /**
50102
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
50103
+ * state on updates.
50104
+ *
50105
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
49268
50106
  */
49269
50107
 
49270
50108
  function usePrevious(value) {
@@ -49275,12 +50113,12 @@
49275
50113
  return ref.current;
49276
50114
  }
49277
50115
 
49278
- /**
49279
- * Subscribe to `propertiesPanel.showEntry`.
49280
- *
49281
- * @param {string} id
49282
- *
49283
- * @returns {import('preact').Ref}
50116
+ /**
50117
+ * Subscribe to `propertiesPanel.showEntry`.
50118
+ *
50119
+ * @param {string} id
50120
+ *
50121
+ * @returns {import('preact').Ref}
49284
50122
  */
49285
50123
  function useShowEntryEvent(id) {
49286
50124
  const {
@@ -49311,20 +50149,20 @@
49311
50149
  return ref;
49312
50150
  }
49313
50151
 
49314
- /**
49315
- * @callback setSticky
49316
- * @param {boolean} value
50152
+ /**
50153
+ * @callback setSticky
50154
+ * @param {boolean} value
49317
50155
  */
49318
50156
 
49319
- /**
49320
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
49321
- * If sticky is observered setSticky(true) will be called.
49322
- * If sticky mode is left, setSticky(false) will be called.
49323
- *
49324
- *
49325
- * @param {Object} ref
49326
- * @param {string} scrollContainerSelector
49327
- * @param {setSticky} setSticky
50157
+ /**
50158
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
50159
+ * If sticky is observered setSticky(true) will be called.
50160
+ * If sticky mode is left, setSticky(false) will be called.
50161
+ *
50162
+ *
50163
+ * @param {Object} ref
50164
+ * @param {string} scrollContainerSelector
50165
+ * @param {setSticky} setSticky
49328
50166
  */
49329
50167
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
49330
50168
  y(() => {
@@ -49363,19 +50201,19 @@
49363
50201
  }, [ref, scrollContainerSelector, setSticky]);
49364
50202
  }
49365
50203
 
49366
- /**
49367
- * Creates a static function reference with changing body.
49368
- * This is necessary when external libraries require a callback function
49369
- * that has references to state variables.
49370
- *
49371
- * Usage:
49372
- * const callback = useStaticCallback((val) => {val === currentState});
49373
- *
49374
- * The `callback` reference is static and can be safely used in external
49375
- * libraries or as a prop that does not cause rerendering of children.
49376
- *
49377
- * @param {Function} callback function with changing reference
49378
- * @returns {Function} static function reference
50204
+ /**
50205
+ * Creates a static function reference with changing body.
50206
+ * This is necessary when external libraries require a callback function
50207
+ * that has references to state variables.
50208
+ *
50209
+ * Usage:
50210
+ * const callback = useStaticCallback((val) => {val === currentState});
50211
+ *
50212
+ * The `callback` reference is static and can be safely used in external
50213
+ * libraries or as a prop that does not cause rerendering of children.
50214
+ *
50215
+ * @param {Function} callback function with changing reference
50216
+ * @returns {Function} static function reference
49379
50217
  */
49380
50218
  function useStaticCallback(callback) {
49381
50219
  const callbackRef = s$1(callback);
@@ -49467,13 +50305,13 @@
49467
50305
  });
49468
50306
  }
49469
50307
 
49470
- /**
49471
- * @typedef { {
49472
- * text: (element: object) => string,
49473
- * icon?: (element: Object) => import('preact').Component
49474
- * } } PlaceholderDefinition
49475
- *
49476
- * @param { PlaceholderDefinition } props
50308
+ /**
50309
+ * @typedef { {
50310
+ * text: (element: object) => string,
50311
+ * icon?: (element: Object) => import('preact').Component
50312
+ * } } PlaceholderDefinition
50313
+ *
50314
+ * @param { PlaceholderDefinition } props
49477
50315
  */
49478
50316
  function Placeholder(props) {
49479
50317
  const {
@@ -49498,72 +50336,72 @@
49498
50336
  };
49499
50337
  const DEFAULT_DESCRIPTION = {};
49500
50338
 
49501
- /**
49502
- * @typedef { {
49503
- * component: import('preact').Component,
49504
- * id: String,
49505
- * isEdited?: Function
49506
- * } } EntryDefinition
49507
- *
49508
- * @typedef { {
49509
- * autoFocusEntry: String,
49510
- * autoOpen?: Boolean,
49511
- * entries: Array<EntryDefinition>,
49512
- * id: String,
49513
- * label: String,
49514
- * remove: (event: MouseEvent) => void
49515
- * } } ListItemDefinition
49516
- *
49517
- * @typedef { {
49518
- * add: (event: MouseEvent) => void,
49519
- * component: import('preact').Component,
49520
- * element: Object,
49521
- * id: String,
49522
- * items: Array<ListItemDefinition>,
49523
- * label: String,
49524
- * shouldSort?: Boolean,
49525
- * shouldOpen?: Boolean
49526
- * } } ListGroupDefinition
49527
- *
49528
- * @typedef { {
49529
- * component?: import('preact').Component,
49530
- * entries: Array<EntryDefinition>,
49531
- * id: String,
49532
- * label: String,
49533
- * shouldOpen?: Boolean
49534
- * } } GroupDefinition
49535
- *
49536
- * @typedef { {
49537
- * [id: String]: GetDescriptionFunction
49538
- * } } DescriptionConfig
49539
- *
49540
- * @callback { {
49541
- * @param {string} id
49542
- * @param {Object} element
49543
- * @returns {string}
49544
- * } } GetDescriptionFunction
49545
- *
49546
- * @typedef { {
49547
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
49548
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
49549
- * } } PlaceholderProvider
49550
- *
50339
+ /**
50340
+ * @typedef { {
50341
+ * component: import('preact').Component,
50342
+ * id: String,
50343
+ * isEdited?: Function
50344
+ * } } EntryDefinition
50345
+ *
50346
+ * @typedef { {
50347
+ * autoFocusEntry: String,
50348
+ * autoOpen?: Boolean,
50349
+ * entries: Array<EntryDefinition>,
50350
+ * id: String,
50351
+ * label: String,
50352
+ * remove: (event: MouseEvent) => void
50353
+ * } } ListItemDefinition
50354
+ *
50355
+ * @typedef { {
50356
+ * add: (event: MouseEvent) => void,
50357
+ * component: import('preact').Component,
50358
+ * element: Object,
50359
+ * id: String,
50360
+ * items: Array<ListItemDefinition>,
50361
+ * label: String,
50362
+ * shouldSort?: Boolean,
50363
+ * shouldOpen?: Boolean
50364
+ * } } ListGroupDefinition
50365
+ *
50366
+ * @typedef { {
50367
+ * component?: import('preact').Component,
50368
+ * entries: Array<EntryDefinition>,
50369
+ * id: String,
50370
+ * label: String,
50371
+ * shouldOpen?: Boolean
50372
+ * } } GroupDefinition
50373
+ *
50374
+ * @typedef { {
50375
+ * [id: String]: GetDescriptionFunction
50376
+ * } } DescriptionConfig
50377
+ *
50378
+ * @callback { {
50379
+ * @param {string} id
50380
+ * @param {Object} element
50381
+ * @returns {string}
50382
+ * } } GetDescriptionFunction
50383
+ *
50384
+ * @typedef { {
50385
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
50386
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
50387
+ * } } PlaceholderProvider
50388
+ *
49551
50389
  */
49552
50390
 
49553
- /**
49554
- * A basic properties panel component. Describes *how* content will be rendered, accepts
49555
- * data from implementor to describe *what* will be rendered.
49556
- *
49557
- * @param {Object} props
49558
- * @param {Object|Array} props.element
49559
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
49560
- * @param {PlaceholderProvider} [props.placeholderProvider]
49561
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
49562
- * @param {Object} [props.layoutConfig]
49563
- * @param {Function} [props.layoutChanged]
49564
- * @param {DescriptionConfig} [props.descriptionConfig]
49565
- * @param {Function} [props.descriptionLoaded]
49566
- * @param {Object} [props.eventBus]
50391
+ /**
50392
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
50393
+ * data from implementor to describe *what* will be rendered.
50394
+ *
50395
+ * @param {Object} props
50396
+ * @param {Object|Array} props.element
50397
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
50398
+ * @param {PlaceholderProvider} [props.placeholderProvider]
50399
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
50400
+ * @param {Object} [props.layoutConfig]
50401
+ * @param {Function} [props.layoutChanged]
50402
+ * @param {DescriptionConfig} [props.descriptionConfig]
50403
+ * @param {Function} [props.descriptionLoaded]
50404
+ * @param {Object} [props.eventBus]
49567
50405
  */
49568
50406
  function PropertiesPanel(props) {
49569
50407
  const {
@@ -49590,7 +50428,7 @@
49590
50428
  };
49591
50429
  const setLayoutForKey = (key, config) => {
49592
50430
  const newLayout = assign({}, layout);
49593
- set(newLayout, key, config);
50431
+ set$1(newLayout, key, config);
49594
50432
  setLayout(newLayout);
49595
50433
  };
49596
50434
  const layoutContext = {
@@ -49788,8 +50626,8 @@
49788
50626
  }
49789
50627
  const noop$2 = () => {};
49790
50628
 
49791
- /**
49792
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
50629
+ /**
50630
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
49793
50631
  */
49794
50632
  function ListGroup(props) {
49795
50633
  const {
@@ -49952,8 +50790,8 @@
49952
50790
 
49953
50791
  // helpers ////////////////////
49954
50792
 
49955
- /**
49956
- * Sorts given items alphanumeric by label
50793
+ /**
50794
+ * Sorts given items alphanumeric by label
49957
50795
  */
49958
50796
  function sortItems(items) {
49959
50797
  return sortBy(items, i => i.label.toLowerCase());
@@ -50027,17 +50865,17 @@
50027
50865
  });
50028
50866
  }
50029
50867
 
50030
- /**
50031
- * @param {Object} props
50032
- * @param {Object} props.element
50033
- * @param {String} props.id
50034
- * @param {String} props.description
50035
- * @param {String} props.label
50036
- * @param {Function} props.getValue
50037
- * @param {Function} props.setValue
50038
- * @param {Function} props.onFocus
50039
- * @param {Function} props.onBlur
50040
- * @param {boolean} [props.disabled]
50868
+ /**
50869
+ * @param {Object} props
50870
+ * @param {Object} props.element
50871
+ * @param {String} props.id
50872
+ * @param {String} props.description
50873
+ * @param {String} props.label
50874
+ * @param {Function} props.getValue
50875
+ * @param {Function} props.setValue
50876
+ * @param {Function} props.onFocus
50877
+ * @param {Function} props.onBlur
50878
+ * @param {boolean} [props.disabled]
50041
50879
  */
50042
50880
  function CheckboxEntry(props) {
50043
50881
  const {
@@ -50125,10 +50963,10 @@
50125
50963
  y(() => {
50126
50964
  let editor;
50127
50965
 
50128
- /* Trigger FEEL toggle when
50129
- *
50130
- * - `backspace` is pressed
50131
- * - AND the cursor is at the beginning of the input
50966
+ /* Trigger FEEL toggle when
50967
+ *
50968
+ * - `backspace` is pressed
50969
+ * - AND the cursor is at the beginning of the input
50132
50970
  */
50133
50971
  const onKeyDown = e => {
50134
50972
  if (e.key !== 'Backspace' || !editor) {
@@ -50199,10 +51037,10 @@
50199
51037
  }
50200
51038
  const noop$1 = () => {};
50201
51039
 
50202
- /**
50203
- * @param {Object} props
50204
- * @param {Object} props.label
50205
- * @param {String} props.feel
51040
+ /**
51041
+ * @param {Object} props
51042
+ * @param {Object} props.label
51043
+ * @param {String} props.feel
50206
51044
  */
50207
51045
  function FeelIcon(props) {
50208
51046
  const {
@@ -50476,17 +51314,17 @@
50476
51314
  });
50477
51315
  });
50478
51316
 
50479
- /**
50480
- * @param {Object} props
50481
- * @param {Object} props.element
50482
- * @param {String} props.id
50483
- * @param {String} props.description
50484
- * @param {Boolean} props.debounce
50485
- * @param {Boolean} props.disabled
50486
- * @param {String} props.label
50487
- * @param {Function} props.getValue
50488
- * @param {Function} props.setValue
50489
- * @param {Function} props.validate
51317
+ /**
51318
+ * @param {Object} props
51319
+ * @param {Object} props.element
51320
+ * @param {String} props.id
51321
+ * @param {String} props.description
51322
+ * @param {Boolean} props.debounce
51323
+ * @param {Boolean} props.disabled
51324
+ * @param {String} props.label
51325
+ * @param {Function} props.getValue
51326
+ * @param {Function} props.setValue
51327
+ * @param {Function} props.validate
50490
51328
  */
50491
51329
  function FeelEntry(props) {
50492
51330
  const {
@@ -50571,19 +51409,19 @@
50571
51409
  });
50572
51410
  }
50573
51411
 
50574
- /**
50575
- * @param {Object} props
50576
- * @param {Object} props.element
50577
- * @param {String} props.id
50578
- * @param {String} props.description
50579
- * @param {Boolean} props.debounce
50580
- * @param {Boolean} props.disabled
50581
- * @param {String} props.label
50582
- * @param {Function} props.getValue
50583
- * @param {Function} props.setValue
50584
- * @param {Function} props.onFocus
50585
- * @param {Function} props.onBlur
50586
- * @param {Function} props.validate
51412
+ /**
51413
+ * @param {Object} props
51414
+ * @param {Object} props.element
51415
+ * @param {String} props.id
51416
+ * @param {String} props.description
51417
+ * @param {Boolean} props.debounce
51418
+ * @param {Boolean} props.disabled
51419
+ * @param {String} props.label
51420
+ * @param {Function} props.getValue
51421
+ * @param {Function} props.setValue
51422
+ * @param {Function} props.onFocus
51423
+ * @param {Function} props.onBlur
51424
+ * @param {Function} props.validate
50587
51425
  */
50588
51426
  function FeelTextArea(props) {
50589
51427
  return e$1(FeelEntry, {
@@ -50662,21 +51500,22 @@
50662
51500
  });
50663
51501
  }
50664
51502
 
50665
- /**
50666
- * @param {Object} props
50667
- * @param {Boolean} props.debounce
50668
- * @param {String} props.description
50669
- * @param {Boolean} props.disabled
50670
- * @param {Object} props.element
50671
- * @param {Function} props.getValue
50672
- * @param {String} props.id
50673
- * @param {String} props.label
50674
- * @param {String} props.max
50675
- * @param {String} props.min
50676
- * @param {Function} props.setValue
50677
- * @param {Function} props.onFocus
50678
- * @param {Function} props.onBlur
50679
- * @param {String} props.step
51503
+ /**
51504
+ * @param {Object} props
51505
+ * @param {Boolean} props.debounce
51506
+ * @param {String} props.description
51507
+ * @param {Boolean} props.disabled
51508
+ * @param {Object} props.element
51509
+ * @param {Function} props.getValue
51510
+ * @param {String} props.id
51511
+ * @param {String} props.label
51512
+ * @param {String} props.max
51513
+ * @param {String} props.min
51514
+ * @param {Function} props.setValue
51515
+ * @param {Function} props.onFocus
51516
+ * @param {Function} props.onBlur
51517
+ * @param {String} props.step
51518
+ * @param {Function} props.validate
50680
51519
  */
50681
51520
  function NumberFieldEntry(props) {
50682
51521
  const {
@@ -50692,25 +51531,55 @@
50692
51531
  setValue,
50693
51532
  step,
50694
51533
  onFocus,
50695
- onBlur
51534
+ onBlur,
51535
+ validate
50696
51536
  } = props;
50697
- const value = getValue(element);
51537
+ const [cachedInvalidValue, setCachedInvalidValue] = l$2(null);
51538
+ const globalError = useError(id);
51539
+ const [localError, setLocalError] = l$2(null);
51540
+ let value = getValue(element);
51541
+ const previousValue = usePrevious(value);
51542
+ y(() => {
51543
+ if (isFunction(validate)) {
51544
+ const newValidationError = validate(value) || null;
51545
+ setLocalError(newValidationError);
51546
+ }
51547
+ }, [value]);
51548
+ const onInput = newValue => {
51549
+ let newValidationError = null;
51550
+ if (isFunction(validate)) {
51551
+ newValidationError = validate(newValue) || null;
51552
+ }
51553
+ if (newValidationError) {
51554
+ setCachedInvalidValue(newValue);
51555
+ } else {
51556
+ setValue(newValue);
51557
+ }
51558
+ setLocalError(newValidationError);
51559
+ };
51560
+ if (previousValue === value && localError) {
51561
+ value = cachedInvalidValue;
51562
+ }
51563
+ const error = globalError || localError;
50698
51564
  return e$1("div", {
50699
- class: "bio-properties-panel-entry",
51565
+ class: classNames('bio-properties-panel-entry', error ? 'has-error' : ''),
50700
51566
  "data-entry-id": id,
50701
51567
  children: [e$1(NumberField, {
50702
51568
  debounce: debounce,
50703
51569
  disabled: disabled,
50704
51570
  id: id,
50705
51571
  label: label,
50706
- onInput: setValue,
50707
51572
  onFocus: onFocus,
50708
51573
  onBlur: onBlur,
51574
+ onInput: onInput,
50709
51575
  max: max,
50710
51576
  min: min,
50711
51577
  step: step,
50712
51578
  value: value
50713
- }, element), e$1(Description$1, {
51579
+ }, element), error && e$1("div", {
51580
+ class: "bio-properties-panel-error",
51581
+ children: error
51582
+ }), e$1(Description$1, {
50714
51583
  forId: id,
50715
51584
  element: element,
50716
51585
  value: description
@@ -50732,7 +51601,7 @@
50732
51601
  label,
50733
51602
  onChange,
50734
51603
  options = [],
50735
- value,
51604
+ value = '',
50736
51605
  disabled,
50737
51606
  onFocus,
50738
51607
  onBlur
@@ -50781,18 +51650,18 @@
50781
51650
  });
50782
51651
  }
50783
51652
 
50784
- /**
50785
- * @param {object} props
50786
- * @param {object} props.element
50787
- * @param {string} props.id
50788
- * @param {string} [props.description]
50789
- * @param {string} props.label
50790
- * @param {Function} props.getValue
50791
- * @param {Function} props.setValue
50792
- * @param {Function} props.onFocus
50793
- * @param {Function} props.onBlur
50794
- * @param {Function} props.getOptions
50795
- * @param {boolean} [props.disabled]
51653
+ /**
51654
+ * @param {object} props
51655
+ * @param {object} props.element
51656
+ * @param {string} props.id
51657
+ * @param {string} [props.description]
51658
+ * @param {string} props.label
51659
+ * @param {Function} props.getValue
51660
+ * @param {Function} props.setValue
51661
+ * @param {Function} props.onFocus
51662
+ * @param {Function} props.onBlur
51663
+ * @param {Function} props.getOptions
51664
+ * @param {boolean} [props.disabled]
50796
51665
  */
50797
51666
  function SelectEntry(props) {
50798
51667
  const {
@@ -50894,20 +51763,20 @@
50894
51763
  });
50895
51764
  }
50896
51765
 
50897
- /**
50898
- * @param {object} props
50899
- * @param {object} props.element
50900
- * @param {string} props.id
50901
- * @param {string} props.description
50902
- * @param {boolean} props.debounce
50903
- * @param {string} props.label
50904
- * @param {Function} props.getValue
50905
- * @param {Function} props.setValue
50906
- * @param {Function} props.onFocus
50907
- * @param {Function} props.onBlur
50908
- * @param {number} props.rows
50909
- * @param {boolean} props.monospace
50910
- * @param {boolean} [props.disabled]
51766
+ /**
51767
+ * @param {object} props
51768
+ * @param {object} props.element
51769
+ * @param {string} props.id
51770
+ * @param {string} props.description
51771
+ * @param {boolean} props.debounce
51772
+ * @param {string} props.label
51773
+ * @param {Function} props.getValue
51774
+ * @param {Function} props.setValue
51775
+ * @param {Function} props.onFocus
51776
+ * @param {Function} props.onBlur
51777
+ * @param {number} props.rows
51778
+ * @param {boolean} props.monospace
51779
+ * @param {boolean} [props.disabled]
50911
51780
  */
50912
51781
  function TextAreaEntry(props) {
50913
51782
  const {
@@ -51010,19 +51879,19 @@
51010
51879
  });
51011
51880
  }
51012
51881
 
51013
- /**
51014
- * @param {Object} props
51015
- * @param {Object} props.element
51016
- * @param {String} props.id
51017
- * @param {String} props.description
51018
- * @param {Boolean} props.debounce
51019
- * @param {Boolean} props.disabled
51020
- * @param {String} props.label
51021
- * @param {Function} props.getValue
51022
- * @param {Function} props.setValue
51023
- * @param {Function} props.onFocus
51024
- * @param {Function} props.onBlur
51025
- * @param {Function} props.validate
51882
+ /**
51883
+ * @param {Object} props
51884
+ * @param {Object} props.element
51885
+ * @param {String} props.id
51886
+ * @param {String} props.description
51887
+ * @param {Boolean} props.debounce
51888
+ * @param {Boolean} props.disabled
51889
+ * @param {String} props.label
51890
+ * @param {Function} props.getValue
51891
+ * @param {Function} props.setValue
51892
+ * @param {Function} props.onFocus
51893
+ * @param {Function} props.onBlur
51894
+ * @param {Function} props.validate
51026
51895
  */
51027
51896
  function TextfieldEntry(props) {
51028
51897
  const {
@@ -51107,6 +51976,7 @@
51107
51976
  const PropertiesPanelContext = D$1({
51108
51977
  getService
51109
51978
  });
51979
+ var FormPropertiesPanelContext = PropertiesPanelContext;
51110
51980
  function arrayAdd(array, index, item) {
51111
51981
  const copy = [...array];
51112
51982
  copy.splice(index, 0, item);
@@ -51254,7 +52124,7 @@
51254
52124
  function useService(type, strict) {
51255
52125
  const {
51256
52126
  getService
51257
- } = F$1(PropertiesPanelContext);
52127
+ } = F$1(FormPropertiesPanelContext);
51258
52128
  return getService(type, strict);
51259
52129
  }
51260
52130
 
@@ -51860,6 +52730,45 @@
51860
52730
  setValue
51861
52731
  });
51862
52732
  };
52733
+ function simpleBoolEntryFactory(options) {
52734
+ const {
52735
+ id,
52736
+ label,
52737
+ path,
52738
+ props
52739
+ } = options;
52740
+ const {
52741
+ editField,
52742
+ field
52743
+ } = props;
52744
+ return {
52745
+ id,
52746
+ label,
52747
+ path,
52748
+ field,
52749
+ editField,
52750
+ component: SimpleBoolComponent,
52751
+ isEdited: isEdited$7
52752
+ };
52753
+ }
52754
+ const SimpleBoolComponent = props => {
52755
+ const {
52756
+ id,
52757
+ label,
52758
+ path,
52759
+ field,
52760
+ editField
52761
+ } = props;
52762
+ const getValue = () => get(field, path, '');
52763
+ const setValue = value => editField(field, path, value);
52764
+ return CheckboxEntry({
52765
+ element: field,
52766
+ getValue,
52767
+ id,
52768
+ label,
52769
+ setValue
52770
+ });
52771
+ };
51863
52772
  function LabelEntry(props) {
51864
52773
  const {
51865
52774
  field
@@ -52036,11 +52945,15 @@
52036
52945
  debounce,
52037
52946
  label: 'Decimal digits',
52038
52947
  element: field,
52039
- min: 0,
52040
- step: 1,
52948
+ step: 'any',
52041
52949
  getValue,
52042
52950
  id,
52043
- setValue
52951
+ setValue,
52952
+ validate: value => {
52953
+ if (value === undefined || value === null) return;
52954
+ if (value < 0) return 'Should be greater than or equal to zero.';
52955
+ if (!Number.isInteger(value)) return 'Should be an integer.';
52956
+ }
52044
52957
  });
52045
52958
  }
52046
52959
  function NumberArrowStep(props) {
@@ -52129,7 +53042,7 @@
52129
53042
  element: field,
52130
53043
  getValue,
52131
53044
  id,
52132
- label: 'Serialize to string',
53045
+ label: 'Output as string',
52133
53046
  description: 'Allows arbitrary precision values',
52134
53047
  setValue
52135
53048
  });
@@ -52368,6 +53281,24 @@
52368
53281
  setValue
52369
53282
  });
52370
53283
  }
53284
+ function SelectEntries(props) {
53285
+ const {
53286
+ field
53287
+ } = props;
53288
+ const {
53289
+ type
53290
+ } = field;
53291
+ if (type !== 'select') {
53292
+ return [];
53293
+ }
53294
+ const entries = [simpleBoolEntryFactory({
53295
+ id: 'searchable',
53296
+ path: ['searchable'],
53297
+ label: 'Searchable',
53298
+ props
53299
+ })];
53300
+ return entries;
53301
+ }
52371
53302
  function ValueEntry(props) {
52372
53303
  const {
52373
53304
  editField,
@@ -52406,7 +53337,7 @@
52406
53337
  const debounce = useService('debounce');
52407
53338
  const setValue = value => {
52408
53339
  const values = get(field, ['values']);
52409
- return editField(field, 'values', set(values, [index, 'label'], value));
53340
+ return editField(field, 'values', set$1(values, [index, 'label'], value));
52410
53341
  };
52411
53342
  const getValue = () => {
52412
53343
  return get(field, ['values', index, 'label']);
@@ -52432,7 +53363,7 @@
52432
53363
  const debounce = useService('debounce');
52433
53364
  const setValue = value => {
52434
53365
  const values = get(field, ['values']);
52435
- return editField(field, 'values', set(values, [index, 'value'], value));
53366
+ return editField(field, 'values', set$1(values, [index, 'value'], value));
52436
53367
  };
52437
53368
  const getValue = () => {
52438
53369
  return get(field, ['values', index, 'value']);
@@ -52742,7 +53673,7 @@
52742
53673
  const onChange = key => {
52743
53674
  return value => {
52744
53675
  const appearance = get(field, ['appearance'], {});
52745
- editField(field, ['appearance'], set(appearance, [key], value));
53676
+ editField(field, ['appearance'], set$1(appearance, [key], value));
52746
53677
  };
52747
53678
  };
52748
53679
  const getValue = key => {
@@ -52890,6 +53821,9 @@
52890
53821
  }), ...AltTextEntry({
52891
53822
  field,
52892
53823
  editField
53824
+ }), ...SelectEntries({
53825
+ field,
53826
+ editField
52893
53827
  }), ...DisabledEntry({
52894
53828
  field,
52895
53829
  editField
@@ -52950,14 +53884,14 @@
52950
53884
  type
52951
53885
  } = field;
52952
53886
  const validate = get(field, ['validate'], {});
52953
- const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate?.validationType);
53887
+ const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate && validate.validationType);
52954
53888
  if (!(INPUTS.includes(type) && type !== 'checkbox' && type !== 'checklist' && type !== 'taglist')) {
52955
53889
  return null;
52956
53890
  }
52957
53891
  const onChange = key => {
52958
53892
  return value => {
52959
53893
  const validate = get(field, ['validate'], {});
52960
- editField(field, ['validate'], set(validate, [key], value));
53894
+ editField(field, ['validate'], set$1(validate, [key], value));
52961
53895
  };
52962
53896
  };
52963
53897
  const getValue = key => {
@@ -53098,7 +54032,7 @@
53098
54032
  element: field,
53099
54033
  getValue: getValue('pattern'),
53100
54034
  id,
53101
- label: 'Regular expression pattern',
54035
+ label: 'Custom regular expression',
53102
54036
  setValue: onChange('pattern')
53103
54037
  });
53104
54038
  }
@@ -53154,7 +54088,7 @@
53154
54088
  element: field,
53155
54089
  getValue: getValue('validationType'),
53156
54090
  id,
53157
- label: 'Regular expression validation',
54091
+ label: 'Validation pattern',
53158
54092
  setValue,
53159
54093
  getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
53160
54094
  });
@@ -53395,7 +54329,7 @@
53395
54329
  "data-field": selectedFormField && selectedFormField.id,
53396
54330
  onFocusCapture: onFocus,
53397
54331
  onBlurCapture: onBlur,
53398
- children: e$1(PropertiesPanelContext.Provider, {
54332
+ children: e$1(FormPropertiesPanelContext.Provider, {
53399
54333
  value: propertiesPanelContext,
53400
54334
  children: e$1(PropertiesPanel, {
53401
54335
  element: selectedFormField,
@@ -53656,7 +54590,7 @@
53656
54590
  * @param {any} value
53657
54591
  */
53658
54592
  setProperty(property, value) {
53659
- const properties = set(this._getState().properties, [property], value);
54593
+ const properties = set$1(this._getState().properties, [property], value);
53660
54594
  this._setState({
53661
54595
  properties
53662
54596
  });
@@ -55655,6 +56589,4 @@
55655
56589
 
55656
56590
  exports.Playground = Playground;
55657
56591
 
55658
- Object.defineProperty(exports, '__esModule', { value: true });
55659
-
55660
- })));
56592
+ }));