@bpmn-io/form-js-viewer 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/assets/form-js.css +146 -50
  2. package/dist/index.cjs +757 -484
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.es.js +678 -396
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/types/Form.d.ts +2 -2
  7. package/dist/types/index.d.ts +1 -1
  8. package/dist/types/render/components/form-fields/Button.d.ts +1 -0
  9. package/dist/types/render/components/form-fields/Checkbox.d.ts +1 -0
  10. package/dist/types/render/components/form-fields/Checklist.d.ts +7 -1
  11. package/dist/types/render/components/form-fields/Datetime.d.ts +2 -0
  12. package/dist/types/render/components/form-fields/Default.d.ts +2 -0
  13. package/dist/types/render/components/form-fields/Image.d.ts +2 -0
  14. package/dist/types/render/components/form-fields/Number.d.ts +1 -0
  15. package/dist/types/render/components/form-fields/Radio.d.ts +7 -1
  16. package/dist/types/render/components/form-fields/Select.d.ts +7 -1
  17. package/dist/types/render/components/form-fields/Taglist.d.ts +7 -1
  18. package/dist/types/render/components/form-fields/Text.d.ts +2 -0
  19. package/dist/types/render/components/form-fields/Textarea.d.ts +1 -0
  20. package/dist/types/render/components/form-fields/Textfield.d.ts +1 -0
  21. package/dist/types/render/components/form-fields/parts/SearchableSelect.d.ts +1 -0
  22. package/dist/types/render/components/form-fields/parts/SimpleSelect.d.ts +1 -0
  23. package/dist/types/render/components/icons/index.d.ts +1 -16
  24. package/dist/types/render/components/index.d.ts +1 -1
  25. package/dist/types/{src/types.d.ts → types.d.ts} +0 -0
  26. package/dist/types/util/constants/ValuesSourceConstants.d.ts +4 -1
  27. package/dist/types/util/index.d.ts +1 -0
  28. package/package.json +5 -5
package/dist/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var Ids = require('ids');
6
4
  var minDash = require('min-dash');
7
5
  var feelin = require('feelin');
@@ -16,16 +14,6 @@ var flatpickr = require('flatpickr');
16
14
  var Markup = require('preact-markup');
17
15
  var didi = require('didi');
18
16
 
19
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
-
21
- var Ids__default = /*#__PURE__*/_interopDefaultLegacy(Ids);
22
- var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
23
- var snarkdown__default = /*#__PURE__*/_interopDefaultLegacy(snarkdown);
24
- var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
25
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
- var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
27
- var Markup__default = /*#__PURE__*/_interopDefaultLegacy(Markup);
28
-
29
17
  /**
30
18
  * @typedef {object} Condition
31
19
  * @property {string} [hide]
@@ -580,7 +568,7 @@ function invokeFunction(fn, args) {
580
568
  }
581
569
 
582
570
  function countDecimals(number) {
583
- const num = Big__default['default'](number);
571
+ const num = Big(number);
584
572
  if (num.toString() === num.toFixed(0)) return 0;
585
573
  return num.toFixed().split('.')[1].length || 0;
586
574
  }
@@ -625,8 +613,8 @@ class Validator {
625
613
  errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
626
614
  }
627
615
  if (increment) {
628
- const bigValue = Big__default['default'](value);
629
- const bigIncrement = Big__default['default'](increment);
616
+ const bigValue = Big(value);
617
+ const bigIncrement = Big(increment);
630
618
  const offset = bigValue.mod(bigIncrement);
631
619
  if (offset.cmp(0) !== 0) {
632
620
  const previousValue = bigValue.minus(offset);
@@ -673,8 +661,8 @@ class FormFieldRegistry {
673
661
  this._eventBus = eventBus;
674
662
  this._formFields = {};
675
663
  eventBus.on('form.clear', () => this.clear());
676
- this._ids = new Ids__default['default']([32, 36, 1]);
677
- this._keys = new Ids__default['default']([32, 36, 1]);
664
+ this._ids = new Ids([32, 36, 1]);
665
+ this._keys = new Ids([32, 36, 1]);
678
666
  }
679
667
  add(formField) {
680
668
  const {
@@ -754,7 +742,7 @@ function getExpressionVariableNames(expression) {
754
742
  } while (cursor.next());
755
743
  return Array.from(variables);
756
744
  }
757
- function isExpression$2(value) {
745
+ function isExpression$1(value) {
758
746
  return minDash.isString(value) && value.startsWith('=');
759
747
  }
760
748
 
@@ -805,7 +793,10 @@ const VALUES_SOURCES_PATHS = {
805
793
  [VALUES_SOURCES.INPUT]: ['valuesKey']
806
794
  };
807
795
  const VALUES_SOURCES_DEFAULTS = {
808
- [VALUES_SOURCES.STATIC]: [],
796
+ [VALUES_SOURCES.STATIC]: [{
797
+ label: 'Value',
798
+ value: 'value'
799
+ }],
809
800
  [VALUES_SOURCES.INPUT]: ''
810
801
  };
811
802
 
@@ -931,12 +922,6 @@ function getSchemaVariables(schema) {
931
922
  return Array.from(new Set(variables));
932
923
  }
933
924
 
934
- // helper ///////////////
935
-
936
- function isExpression$1(value) {
937
- return minDash.isString(value) && value.startsWith('=');
938
- }
939
-
940
925
  class Importer {
941
926
  /**
942
927
  * @constructor
@@ -1195,7 +1180,7 @@ function formFieldClasses(type, {
1195
1180
  if (!type) {
1196
1181
  throw new Error('type required');
1197
1182
  }
1198
- return classNames__default['default']('fjs-form-field', `fjs-form-field-${type}`, {
1183
+ return classNames('fjs-form-field', `fjs-form-field-${type}`, {
1199
1184
  'fjs-has-errors': errors.length > 0,
1200
1185
  'fjs-disabled': disabled
1201
1186
  });
@@ -1207,7 +1192,7 @@ function prefixId(id, formId) {
1207
1192
  return `fjs-form-${id}`;
1208
1193
  }
1209
1194
  function markdownToHTML(markdown) {
1210
- const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown__default['default'](line) : `<p>${snarkdown__default['default'](line)}</p>`);
1195
+ const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown(line) : `<p>${snarkdown(line)}</p>`);
1211
1196
  return htmls.join('\n\n');
1212
1197
  }
1213
1198
 
@@ -1249,15 +1234,14 @@ function Button(props) {
1249
1234
  })
1250
1235
  });
1251
1236
  }
1252
- Button.create = function (options = {}) {
1253
- return {
1254
- action: 'submit',
1255
- ...options
1256
- };
1257
- };
1237
+ Button.create = (options = {}) => ({
1238
+ action: 'submit',
1239
+ ...options
1240
+ });
1258
1241
  Button.type = type$b;
1259
1242
  Button.label = 'Button';
1260
1243
  Button.keyed = true;
1244
+ Button.group = 'action';
1261
1245
 
1262
1246
  const FormRenderContext = preact.createContext({
1263
1247
  Empty: props => {
@@ -1270,6 +1254,7 @@ const FormRenderContext = preact.createContext({
1270
1254
  return props.children;
1271
1255
  }
1272
1256
  });
1257
+ var FormRenderContext$1 = FormRenderContext;
1273
1258
 
1274
1259
  /**
1275
1260
  * @param {string} type
@@ -1282,6 +1267,7 @@ const FormContext = preact.createContext({
1282
1267
  getService,
1283
1268
  formId: null
1284
1269
  });
1270
+ var FormContext$1 = FormContext;
1285
1271
 
1286
1272
  function Description(props) {
1287
1273
  const {
@@ -1324,7 +1310,7 @@ function Label(props) {
1324
1310
  } = props;
1325
1311
  return jsxRuntime.jsxs("label", {
1326
1312
  for: id,
1327
- class: classNames__default['default']('fjs-form-field-label', {
1313
+ class: classNames('fjs-form-field-label', {
1328
1314
  'fjs-incollapsible-label': !collapseOnEmpty
1329
1315
  }, props['class']),
1330
1316
  children: [props.children, label || '', required && jsxRuntime.jsx("span", {
@@ -1357,9 +1343,9 @@ function Checkbox(props) {
1357
1343
  };
1358
1344
  const {
1359
1345
  formId
1360
- } = hooks.useContext(FormContext);
1346
+ } = hooks.useContext(FormContext$1);
1361
1347
  return jsxRuntime.jsxs("div", {
1362
- class: classNames__default['default'](formFieldClasses(type$a, {
1348
+ class: classNames(formFieldClasses(type$a, {
1363
1349
  errors,
1364
1350
  disabled
1365
1351
  }), {
@@ -1384,11 +1370,9 @@ function Checkbox(props) {
1384
1370
  })]
1385
1371
  });
1386
1372
  }
1387
- Checkbox.create = function (options = {}) {
1388
- return {
1389
- ...options
1390
- };
1391
- };
1373
+ Checkbox.create = (options = {}) => ({
1374
+ ...options
1375
+ });
1392
1376
  Checkbox.type = type$a;
1393
1377
  Checkbox.label = 'Checkbox';
1394
1378
  Checkbox.keyed = true;
@@ -1396,11 +1380,12 @@ Checkbox.emptyValue = false;
1396
1380
  Checkbox.sanitizeValue = ({
1397
1381
  value
1398
1382
  }) => value === true;
1383
+ Checkbox.group = 'selection';
1399
1384
 
1400
1385
  function useService (type, strict) {
1401
1386
  const {
1402
1387
  getService
1403
- } = hooks.useContext(FormContext);
1388
+ } = hooks.useContext(FormContext$1);
1404
1389
  return getService(type, strict);
1405
1390
  }
1406
1391
 
@@ -1497,8 +1482,8 @@ function parseInputTime(stringTime) {
1497
1482
  if (is12h) {
1498
1483
  const isPM = workingString.includes('pm');
1499
1484
  const digits = workingString.match(/\d+/g);
1500
- const displayHour = parseInt(digits?.[0]);
1501
- const minute = parseInt(digits?.[1]) || 0;
1485
+ const displayHour = parseInt(digits && digits[0]);
1486
+ const minute = parseInt(digits && digits[1]) || 0;
1502
1487
  const isValidDisplayHour = minDash.isNumber(displayHour) && displayHour >= 1 && displayHour <= 12;
1503
1488
  const isValidMinute = minute >= 0 && minute <= 59;
1504
1489
  if (!isValidDisplayHour || !isValidMinute) return null;
@@ -1506,8 +1491,8 @@ function parseInputTime(stringTime) {
1506
1491
  return hour * 60 + minute;
1507
1492
  } else {
1508
1493
  const digits = workingString.match(/\d+/g);
1509
- const hour = parseInt(digits?.[0]);
1510
- const minute = parseInt(digits?.[1]);
1494
+ const hour = parseInt(digits && digits[0]);
1495
+ const minute = parseInt(digits && digits[1]);
1511
1496
  const isValidHour = minDash.isNumber(hour) && hour >= 0 && hour <= 23;
1512
1497
  const isValidMinute = minDash.isNumber(minute) && minute >= 0 && minute <= 59;
1513
1498
  if (!isValidHour || !isValidMinute) return null;
@@ -1710,9 +1695,9 @@ function Checklist(props) {
1710
1695
  } = useValuesAsync(field);
1711
1696
  const {
1712
1697
  formId
1713
- } = hooks.useContext(FormContext);
1698
+ } = hooks.useContext(FormContext$1);
1714
1699
  return jsxRuntime.jsxs("div", {
1715
- class: classNames__default['default'](formFieldClasses(type$9, {
1700
+ class: classNames(formFieldClasses(type$9, {
1716
1701
  errors,
1717
1702
  disabled
1718
1703
  })),
@@ -1722,7 +1707,7 @@ function Checklist(props) {
1722
1707
  return jsxRuntime.jsx(Label, {
1723
1708
  id: prefixId(`${id}-${index}`, formId),
1724
1709
  label: v.label,
1725
- class: classNames__default['default']({
1710
+ class: classNames({
1726
1711
  'fjs-checked': value.includes(v.value)
1727
1712
  }),
1728
1713
  required: false,
@@ -1742,13 +1727,18 @@ function Checklist(props) {
1742
1727
  })]
1743
1728
  });
1744
1729
  }
1745
- Checklist.create = function (options = {}) {
1746
- if (options.valuesKey) return options;
1747
- return {
1748
- values: [{
1730
+ Checklist.create = (options = {}) => {
1731
+ const defaults = {};
1732
+
1733
+ // provide default values if valuesKey isn't set
1734
+ if (!options.valuesKey) {
1735
+ defaults.values = [{
1749
1736
  label: 'Value',
1750
1737
  value: 'value'
1751
- }],
1738
+ }];
1739
+ }
1740
+ return {
1741
+ ...defaults,
1752
1742
  ...options
1753
1743
  };
1754
1744
  };
@@ -1757,6 +1747,7 @@ Checklist.label = 'Checklist';
1757
1747
  Checklist.keyed = true;
1758
1748
  Checklist.emptyValue = [];
1759
1749
  Checklist.sanitizeValue = sanitizeMultiSelectValue;
1750
+ Checklist.group = 'selection';
1760
1751
 
1761
1752
  /**
1762
1753
  * Check if condition is met with given variables.
@@ -1800,7 +1791,7 @@ function FormField(props) {
1800
1791
  const {
1801
1792
  Element,
1802
1793
  Empty
1803
- } = hooks.useContext(FormRenderContext);
1794
+ } = hooks.useContext(FormRenderContext$1);
1804
1795
  const FormFieldComponent = formFields.get(field.type);
1805
1796
  if (!FormFieldComponent) {
1806
1797
  throw new Error(`cannot render field <${field.type}>`);
@@ -1832,7 +1823,7 @@ function Default(props) {
1832
1823
  const {
1833
1824
  Children,
1834
1825
  Empty
1835
- } = hooks.useContext(FormRenderContext);
1826
+ } = hooks.useContext(FormRenderContext$1);
1836
1827
  const {
1837
1828
  field
1838
1829
  } = props;
@@ -1851,30 +1842,30 @@ function Default(props) {
1851
1842
  }), components.length ? null : jsxRuntime.jsx(Empty, {})]
1852
1843
  });
1853
1844
  }
1854
- Default.create = function (options = {}) {
1855
- return {
1856
- components: [],
1857
- ...options
1858
- };
1859
- };
1845
+ Default.create = (options = {}) => ({
1846
+ components: [],
1847
+ ...options
1848
+ });
1860
1849
  Default.type = 'default';
1861
1850
  Default.keyed = false;
1851
+ Default.label = null;
1852
+ Default.group = null;
1862
1853
 
1863
- function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
1854
+ function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
1864
1855
  var CalendarIcon = (({
1865
1856
  styles = {},
1866
1857
  ...props
1867
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$h({
1858
+ }) => /*#__PURE__*/React.createElement("svg", _extends$j({
1868
1859
  width: "14",
1869
1860
  height: "15",
1870
1861
  viewBox: "0 0 28 30",
1871
1862
  fill: "none",
1872
1863
  xmlns: "http://www.w3.org/2000/svg"
1873
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
1864
+ }, props), /*#__PURE__*/React.createElement("path", {
1874
1865
  fillRule: "evenodd",
1875
1866
  clipRule: "evenodd",
1876
- 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",
1877
- fill: "currentColor"
1867
+ fill: "currentColor",
1868
+ 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"
1878
1869
  })));
1879
1870
 
1880
1871
  function InputAdorner(props) {
@@ -1887,10 +1878,10 @@ function InputAdorner(props) {
1887
1878
  disabled,
1888
1879
  hasErrors
1889
1880
  } = props;
1890
- const onAdornmentClick = () => inputRef?.current?.focus();
1881
+ const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
1891
1882
  return jsxRuntime.jsxs("div", {
1892
- class: classNames__default['default']('fjs-input-group', {
1893
- 'disabled': disabled
1883
+ class: classNames('fjs-input-group', {
1884
+ 'fjs-disabled': disabled
1894
1885
  }, {
1895
1886
  'hasErrors': hasErrors
1896
1887
  }),
@@ -1898,11 +1889,17 @@ function InputAdorner(props) {
1898
1889
  children: [pre !== null && jsxRuntime.jsxs("span", {
1899
1890
  class: "fjs-input-adornment border-right border-radius-left",
1900
1891
  onClick: onAdornmentClick,
1901
- children: [" ", pre, " "]
1892
+ children: [" ", minDash.isString(pre) ? jsxRuntime.jsx("span", {
1893
+ class: "fjs-input-adornment-text",
1894
+ children: pre
1895
+ }) : pre, " "]
1902
1896
  }), children, post !== null && jsxRuntime.jsxs("span", {
1903
1897
  class: "fjs-input-adornment border-left border-radius-right",
1904
1898
  onClick: onAdornmentClick,
1905
- children: [" ", post, " "]
1899
+ children: [" ", minDash.isString(post) ? jsxRuntime.jsx("span", {
1900
+ class: "fjs-input-adornment-text",
1901
+ children: post
1902
+ }) : post, " "]
1906
1903
  })]
1907
1904
  });
1908
1905
  }
@@ -1944,15 +1941,11 @@ function Datepicker(props) {
1944
1941
  dateFormat: 'm/d/Y',
1945
1942
  static: true,
1946
1943
  clickOpens: false,
1944
+ // TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
1945
+ minDate: disallowPassedDates ? 'today' : '01/01/1900',
1947
1946
  errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
1948
1947
  };
1949
- if (disallowPassedDates) {
1950
- config = {
1951
- ...config,
1952
- minDate: 'today'
1953
- };
1954
- }
1955
- const instance = flatpickr__default['default'](dateInputRef.current, config);
1948
+ const instance = flatpickr(dateInputRef.current, config);
1956
1949
  setFlatpickrInstance(instance);
1957
1950
  const onCalendarFocusOut = e => {
1958
1951
  if (!instance.calendarContainer.contains(e.relatedTarget) && e.relatedTarget != dateInputRef.current) {
@@ -2035,7 +2028,7 @@ function Datepicker(props) {
2035
2028
  class: 'fjs-input',
2036
2029
  disabled: disabled,
2037
2030
  placeholder: "mm/dd/yyyy",
2038
- autoComplete: "false",
2031
+ autoComplete: "off",
2039
2032
  onFocus: onInputFocus,
2040
2033
  onKeyDown: onInputKeyDown,
2041
2034
  onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
@@ -2048,24 +2041,24 @@ function Datepicker(props) {
2048
2041
  });
2049
2042
  }
2050
2043
 
2051
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
2044
+ function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
2052
2045
  var ClockIcon = (({
2053
2046
  styles = {},
2054
2047
  ...props
2055
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$g({
2048
+ }) => /*#__PURE__*/React.createElement("svg", _extends$i({
2056
2049
  width: "16",
2057
2050
  height: "16",
2058
2051
  viewBox: "0 0 28 29",
2059
2052
  fill: "none",
2060
2053
  xmlns: "http://www.w3.org/2000/svg"
2061
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2062
- d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
2063
- fill: "currentColor"
2064
- }), /*#__PURE__*/React__default['default'].createElement("path", {
2054
+ }, props), /*#__PURE__*/React.createElement("path", {
2055
+ fill: "currentColor",
2056
+ d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z"
2057
+ }), /*#__PURE__*/React.createElement("path", {
2065
2058
  fillRule: "evenodd",
2066
2059
  clipRule: "evenodd",
2067
- 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",
2068
- fill: "currentColor"
2060
+ fill: "currentColor",
2061
+ 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"
2069
2062
  })));
2070
2063
 
2071
2064
  function useKeyDownAction(targetKey, action, listenerElement = window) {
@@ -2088,7 +2081,7 @@ const DEFAULT_LABEL_GETTER = value => value;
2088
2081
  const NOOP = () => {};
2089
2082
  function DropdownList(props) {
2090
2083
  const {
2091
- keyEventsListener = window,
2084
+ listenerElement = window,
2092
2085
  values = [],
2093
2086
  getLabel = DEFAULT_LABEL_GETTER,
2094
2087
  onValueSelected = NOOP,
@@ -2118,18 +2111,18 @@ function DropdownList(props) {
2118
2111
  changeFocusedValueIndex(-1);
2119
2112
  setMouseControl(false);
2120
2113
  }
2121
- }, keyEventsListener);
2114
+ }, listenerElement);
2122
2115
  useKeyDownAction('ArrowDown', () => {
2123
2116
  if (values.length) {
2124
2117
  changeFocusedValueIndex(1);
2125
2118
  setMouseControl(false);
2126
2119
  }
2127
- }, keyEventsListener);
2120
+ }, listenerElement);
2128
2121
  useKeyDownAction('Enter', () => {
2129
2122
  if (focusedItem) {
2130
2123
  onValueSelected(focusedItem);
2131
2124
  }
2132
- }, keyEventsListener);
2125
+ }, listenerElement);
2133
2126
  hooks.useEffect(() => {
2134
2127
  const individualEntries = dropdownContainer.current.children;
2135
2128
  if (individualEntries.length && !mouseControl) {
@@ -2164,7 +2157,7 @@ function DropdownList(props) {
2164
2157
  },
2165
2158
  children: [values.length > 0 && values.map((v, i) => {
2166
2159
  return jsxRuntime.jsx("div", {
2167
- class: classNames__default['default']('fjs-dropdownlist-item', {
2160
+ class: classNames('fjs-dropdownlist-item', {
2168
2161
  'focused': focusedValueIndex === i
2169
2162
  }),
2170
2163
  onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
@@ -2302,7 +2295,7 @@ function Timepicker(props) {
2302
2295
  value: rawValue,
2303
2296
  disabled: disabled,
2304
2297
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
2305
- autoComplete: "false",
2298
+ autoComplete: "off",
2306
2299
  onFocus: () => useDropdown && setDropdownIsOpen(true),
2307
2300
  onClick: () => useDropdown && setDropdownIsOpen(true)
2308
2301
 
@@ -2353,7 +2346,7 @@ function Datetime(props) {
2353
2346
  } = validate;
2354
2347
  const {
2355
2348
  formId
2356
- } = hooks.useContext(FormContext);
2349
+ } = hooks.useContext(FormContext$1);
2357
2350
  const getNullDateTime = () => ({
2358
2351
  date: new Date(Date.parse(null)),
2359
2352
  time: null
@@ -2479,7 +2472,7 @@ function Datetime(props) {
2479
2472
  disabled
2480
2473
  }),
2481
2474
  children: [jsxRuntime.jsxs("div", {
2482
- class: classNames__default['default']('fjs-vertical-group'),
2475
+ class: classNames('fjs-vertical-group'),
2483
2476
  children: [useDatePicker && jsxRuntime.jsx(Datepicker, {
2484
2477
  ...datePickerProps
2485
2478
  }), useTimePicker && useDatePicker && jsxRuntime.jsx("div", {
@@ -2494,12 +2487,12 @@ function Datetime(props) {
2494
2487
  })]
2495
2488
  });
2496
2489
  }
2497
- Datetime.create = function (options = {}) {
2498
- const newOptions = {};
2499
- minDash.set(newOptions, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
2500
- minDash.set(newOptions, DATE_LABEL_PATH, 'Date');
2490
+ Datetime.create = (options = {}) => {
2491
+ const defaults = {};
2492
+ minDash.set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
2493
+ minDash.set(defaults, DATE_LABEL_PATH, 'Date');
2501
2494
  return {
2502
- ...newOptions,
2495
+ ...defaults,
2503
2496
  ...options
2504
2497
  };
2505
2498
  };
@@ -2507,6 +2500,8 @@ Datetime.type = type$8;
2507
2500
  Datetime.keyed = true;
2508
2501
  Datetime.emptyValue = null;
2509
2502
  Datetime.sanitizeValue = sanitizeDateTimePickerValue;
2503
+ Datetime.label = 'Date time';
2504
+ Datetime.group = 'basic-input';
2510
2505
 
2511
2506
  /**
2512
2507
  * This file must not be changed or exchanged.
@@ -2670,11 +2665,11 @@ function isExpression(value) {
2670
2665
  return minDash.isString(value) && value.startsWith('=');
2671
2666
  }
2672
2667
 
2673
- function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
2668
+ function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
2674
2669
  var ImagePlaceholder = (({
2675
2670
  styles = {},
2676
2671
  ...props
2677
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$f({
2672
+ }) => /*#__PURE__*/React.createElement("svg", _extends$h({
2678
2673
  width: "64",
2679
2674
  height: "64",
2680
2675
  viewBox: "0 0 1280 1280",
@@ -2683,16 +2678,16 @@ var ImagePlaceholder = (({
2683
2678
  clipRule: "evenodd",
2684
2679
  strokeLinejoin: "round",
2685
2680
  strokeMiterlimit: "2"
2686
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2681
+ }, props), /*#__PURE__*/React.createElement("path", {
2687
2682
  fill: "#e5e9ed",
2688
2683
  d: "M0 0h1280v1280H0z"
2689
- }), /*#__PURE__*/React__default['default'].createElement("path", {
2684
+ }), /*#__PURE__*/React.createElement("path", {
2690
2685
  d: "M910 410H370v470h540V410zm-57.333 57.333v355.334H427.333V467.333h425.334z",
2691
2686
  fill: "#cad3db"
2692
- }), /*#__PURE__*/React__default['default'].createElement("path", {
2687
+ }), /*#__PURE__*/React.createElement("path", {
2693
2688
  d: "M810 770H480v-60l100-170 130 170 100-65v125z",
2694
2689
  fill: "#cad3db"
2695
- }), /*#__PURE__*/React__default['default'].createElement("circle", {
2690
+ }), /*#__PURE__*/React.createElement("circle", {
2696
2691
  cx: "750",
2697
2692
  cy: "550",
2698
2693
  r: "50",
@@ -2714,7 +2709,7 @@ function Image(props) {
2714
2709
  const altText = useExpressionValue(alt);
2715
2710
  const {
2716
2711
  formId
2717
- } = hooks.useContext(FormContext);
2712
+ } = hooks.useContext(FormContext$1);
2718
2713
  return jsxRuntime.jsx("div", {
2719
2714
  class: formFieldClasses(type$7),
2720
2715
  children: jsxRuntime.jsxs("div", {
@@ -2733,13 +2728,47 @@ function Image(props) {
2733
2728
  })
2734
2729
  });
2735
2730
  }
2736
- Image.create = function (options = {}) {
2737
- return {
2738
- ...options
2739
- };
2740
- };
2731
+ Image.create = (options = {}) => ({
2732
+ ...options
2733
+ });
2741
2734
  Image.type = type$7;
2742
2735
  Image.keyed = false;
2736
+ Image.label = 'Image view';
2737
+ Image.group = 'presentation';
2738
+
2739
+ function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
2740
+ var AngelDownIcon = (({
2741
+ styles = {},
2742
+ ...props
2743
+ }) => /*#__PURE__*/React.createElement("svg", _extends$g({
2744
+ xmlns: "http://www.w3.org/2000/svg",
2745
+ width: "8",
2746
+ height: "8"
2747
+ }, props), /*#__PURE__*/React.createElement("path", {
2748
+ fillRule: "evenodd",
2749
+ clipRule: "evenodd",
2750
+ fill: "currentColor",
2751
+ stroke: "currentColor",
2752
+ strokeWidth: ".5",
2753
+ d: "M7.75 1.336L4 6.125.258 1.335 0 1.54l4 5.125L8 1.54zm0 0"
2754
+ })));
2755
+
2756
+ function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
2757
+ var AngelUpIcon = (({
2758
+ styles = {},
2759
+ ...props
2760
+ }) => /*#__PURE__*/React.createElement("svg", _extends$f({
2761
+ xmlns: "http://www.w3.org/2000/svg",
2762
+ width: "8",
2763
+ height: "8"
2764
+ }, props), /*#__PURE__*/React.createElement("path", {
2765
+ fillRule: "evenodd",
2766
+ clipRule: "evenodd",
2767
+ fill: "currentColor",
2768
+ stroke: "currentColor",
2769
+ strokeWidth: ".5",
2770
+ d: "M7.75 6.664L4 1.875.258 6.665 0 6.46l4-5.125L8 6.46zm0 0"
2771
+ })));
2743
2772
 
2744
2773
  const type$6 = 'number';
2745
2774
  function Numberfield(props) {
@@ -2782,12 +2811,12 @@ function Numberfield(props) {
2782
2811
  const displayValue = hooks.useMemo(() => {
2783
2812
  if (value === 'NaN') return 'NaN';
2784
2813
  if (stringValueCache === '-') return '-';
2785
- return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big__default['default'](value).toFixed() : '';
2814
+ return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big(value).toFixed() : '';
2786
2815
  }, [stringValueCache, value, cacheValueMatchesState]);
2787
2816
  const arrowIncrementValue = hooks.useMemo(() => {
2788
- if (incrementValue) return Big__default['default'](incrementValue);
2789
- if (decimalDigits) return Big__default['default'](`1e-${decimalDigits}`);
2790
- return Big__default['default']('1');
2817
+ if (incrementValue) return Big(incrementValue);
2818
+ if (decimalDigits) return Big(`1e-${decimalDigits}`);
2819
+ return Big('1');
2791
2820
  }, [decimalDigits, incrementValue]);
2792
2821
  const setValue = hooks.useCallback(stringValue => {
2793
2822
  if (isNullEquivalentValue(stringValue)) {
@@ -2820,14 +2849,14 @@ function Numberfield(props) {
2820
2849
  });
2821
2850
  }, [field, onChange, serializeToString]);
2822
2851
  const increment = () => {
2823
- const base = isValidNumber(value) ? Big__default['default'](value) : Big__default['default'](0);
2852
+ const base = isValidNumber(value) ? Big(value) : Big(0);
2824
2853
  const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
2825
2854
 
2826
2855
  // note: toFixed() behaves differently in big.js
2827
2856
  setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
2828
2857
  };
2829
2858
  const decrement = () => {
2830
- const base = isValidNumber(value) ? Big__default['default'](value) : Big__default['default'](0);
2859
+ const base = isValidNumber(value) ? Big(value) : Big(0);
2831
2860
  const offset = base.mod(arrowIncrementValue);
2832
2861
  if (offset.cmp(0) === 0) {
2833
2862
  // if we're already on a valid step, decrement
@@ -2868,7 +2897,7 @@ function Numberfield(props) {
2868
2897
  };
2869
2898
  const {
2870
2899
  formId
2871
- } = hooks.useContext(FormContext);
2900
+ } = hooks.useContext(FormContext$1);
2872
2901
  return jsxRuntime.jsxs("div", {
2873
2902
  class: formFieldClasses(type$6, {
2874
2903
  errors,
@@ -2883,8 +2912,8 @@ function Numberfield(props) {
2883
2912
  pre: prefixAdorner,
2884
2913
  post: suffixAdorner,
2885
2914
  children: jsxRuntime.jsxs("div", {
2886
- class: classNames__default['default']('fjs-vertical-group', {
2887
- 'disabled': disabled
2915
+ class: classNames('fjs-vertical-group', {
2916
+ 'fjs-disabled': disabled
2888
2917
  }, {
2889
2918
  'hasErrors': errors.length
2890
2919
  }),
@@ -2904,23 +2933,25 @@ function Numberfield(props) {
2904
2933
  step: arrowIncrementValue,
2905
2934
  value: displayValue
2906
2935
  }), jsxRuntime.jsxs("div", {
2907
- class: classNames__default['default']('fjs-number-arrow-container', {
2908
- 'disabled': disabled
2936
+ class: classNames('fjs-number-arrow-container', {
2937
+ 'fjs-disabled': disabled
2909
2938
  }),
2910
2939
  children: [jsxRuntime.jsx("button", {
2911
2940
  class: "fjs-number-arrow-up",
2912
2941
  type: "button",
2942
+ "aria-label": "Increment",
2913
2943
  onClick: () => increment(),
2914
2944
  tabIndex: -1,
2915
- children: "\u02C4"
2945
+ children: jsxRuntime.jsx(AngelUpIcon, {})
2916
2946
  }), jsxRuntime.jsx("div", {
2917
2947
  class: "fjs-number-arrow-separator"
2918
2948
  }), jsxRuntime.jsx("button", {
2919
2949
  class: "fjs-number-arrow-down",
2920
2950
  type: "button",
2951
+ "aria-label": "Decrement",
2921
2952
  onClick: () => decrement(),
2922
2953
  tabIndex: -1,
2923
- children: "\u02C5"
2954
+ children: jsxRuntime.jsx(AngelDownIcon, {})
2924
2955
  })]
2925
2956
  })]
2926
2957
  })
@@ -2931,7 +2962,9 @@ function Numberfield(props) {
2931
2962
  })]
2932
2963
  });
2933
2964
  }
2934
- Numberfield.create = (options = {}) => options;
2965
+ Numberfield.create = (options = {}) => ({
2966
+ ...options
2967
+ });
2935
2968
  Numberfield.sanitizeValue = ({
2936
2969
  value,
2937
2970
  formField
@@ -2949,6 +2982,7 @@ Numberfield.type = type$6;
2949
2982
  Numberfield.keyed = true;
2950
2983
  Numberfield.label = 'Number';
2951
2984
  Numberfield.emptyValue = null;
2985
+ Numberfield.group = 'basic-input';
2952
2986
 
2953
2987
  const type$5 = 'radio';
2954
2988
  function Radio(props) {
@@ -2979,7 +3013,7 @@ function Radio(props) {
2979
3013
  } = useValuesAsync(field);
2980
3014
  const {
2981
3015
  formId
2982
- } = hooks.useContext(FormContext);
3016
+ } = hooks.useContext(FormContext$1);
2983
3017
  return jsxRuntime.jsxs("div", {
2984
3018
  class: formFieldClasses(type$5, {
2985
3019
  errors,
@@ -2992,7 +3026,7 @@ function Radio(props) {
2992
3026
  return jsxRuntime.jsx(Label, {
2993
3027
  id: prefixId(`${id}-${index}`, formId),
2994
3028
  label: option.label,
2995
- class: classNames__default['default']({
3029
+ class: classNames({
2996
3030
  'fjs-checked': option.value === value
2997
3031
  }),
2998
3032
  required: false,
@@ -3013,12 +3047,17 @@ function Radio(props) {
3013
3047
  });
3014
3048
  }
3015
3049
  Radio.create = function (options = {}) {
3016
- if (options.valuesKey) return options;
3017
- return {
3018
- values: [{
3050
+ const defaults = {};
3051
+
3052
+ // provide default values if valuesKey isn't set
3053
+ if (!options.valuesKey) {
3054
+ defaults.values = [{
3019
3055
  label: 'Value',
3020
3056
  value: 'value'
3021
- }],
3057
+ }];
3058
+ }
3059
+ return {
3060
+ ...defaults,
3022
3061
  ...options
3023
3062
  };
3024
3063
  };
@@ -3027,6 +3066,266 @@ Radio.label = 'Radio';
3027
3066
  Radio.keyed = true;
3028
3067
  Radio.emptyValue = null;
3029
3068
  Radio.sanitizeValue = sanitizeSingleSelectValue;
3069
+ Radio.group = 'selection';
3070
+
3071
+ function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
3072
+ var XMarkIcon = (({
3073
+ styles = {},
3074
+ ...props
3075
+ }) => /*#__PURE__*/React.createElement("svg", _extends$e({
3076
+ xmlns: "http://www.w3.org/2000/svg",
3077
+ width: "8",
3078
+ height: "8"
3079
+ }, props), /*#__PURE__*/React.createElement("path", {
3080
+ fillRule: "evenodd",
3081
+ clipRule: "evenodd",
3082
+ fill: "currentColor",
3083
+ stroke: "currentColor",
3084
+ strokeWidth: ".5",
3085
+ 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"
3086
+ })));
3087
+
3088
+ function SearchableSelect(props) {
3089
+ const {
3090
+ id,
3091
+ disabled,
3092
+ errors,
3093
+ field,
3094
+ value
3095
+ } = props;
3096
+ const {
3097
+ formId
3098
+ } = hooks.useContext(FormContext$1);
3099
+ const [filter, setFilter] = hooks.useState('');
3100
+ const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
3101
+ const [shouldApplyFilter, setShouldApplyFilter] = hooks.useState(true);
3102
+ const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
3103
+ const searchbarRef = hooks.useRef();
3104
+ const {
3105
+ state: loadState,
3106
+ values: options
3107
+ } = useValuesAsync(field);
3108
+
3109
+ // 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
3110
+ const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
3111
+ [o.value]: options[x]
3112
+ }))), [options]);
3113
+ const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
3114
+
3115
+ // whenever we change the underlying value, set the label to it
3116
+ hooks.useEffect(() => {
3117
+ setFilter(valueLabel);
3118
+ }, [valueLabel]);
3119
+ const filteredOptions = hooks.useMemo(() => {
3120
+ if (loadState === LOAD_STATES.LOADED) {
3121
+ return shouldApplyFilter ? options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase())) : options;
3122
+ }
3123
+ return [];
3124
+ }, [filter, loadState, options, shouldApplyFilter]);
3125
+ const onChange = ({
3126
+ target
3127
+ }) => {
3128
+ setIsEscapeClose(false);
3129
+ setIsDropdownExpanded(true);
3130
+ setShouldApplyFilter(true);
3131
+ setFilter(target.value || '');
3132
+ };
3133
+ const setValue = hooks.useCallback(option => {
3134
+ setFilter(option && option.label || '');
3135
+ props.onChange({
3136
+ value: option && option.value || null,
3137
+ field
3138
+ });
3139
+ }, [field, props]);
3140
+ const onInputKeyDown = hooks.useCallback(keyDownEvent => {
3141
+ switch (keyDownEvent.key) {
3142
+ case 'ArrowUp':
3143
+ keyDownEvent.preventDefault();
3144
+ break;
3145
+ case 'ArrowDown':
3146
+ {
3147
+ if (!isDropdownExpanded) {
3148
+ setIsDropdownExpanded(true);
3149
+ setShouldApplyFilter(false);
3150
+ }
3151
+ keyDownEvent.preventDefault();
3152
+ break;
3153
+ }
3154
+ case 'Escape':
3155
+ setIsEscapeClose(true);
3156
+ break;
3157
+ case 'Enter':
3158
+ if (isEscapeClosed) {
3159
+ setIsEscapeClose(false);
3160
+ }
3161
+ break;
3162
+ }
3163
+ }, [isDropdownExpanded, isEscapeClosed]);
3164
+ const displayState = hooks.useMemo(() => {
3165
+ const ds = {};
3166
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
3167
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3168
+ ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
3169
+ return ds;
3170
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
3171
+ const onAngelMouseDown = hooks.useCallback(e => {
3172
+ setIsEscapeClose(false);
3173
+ setIsDropdownExpanded(!isDropdownExpanded);
3174
+ const searchbar = searchbarRef.current;
3175
+ isDropdownExpanded ? searchbar.blur() : searchbar.focus();
3176
+ e.preventDefault();
3177
+ }, [isDropdownExpanded]);
3178
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3179
+ children: [jsxRuntime.jsxs("div", {
3180
+ id: prefixId(`${id}`, formId),
3181
+ class: classNames('fjs-input-group', {
3182
+ 'disabled': disabled
3183
+ }, {
3184
+ 'hasErrors': errors.length
3185
+ }),
3186
+ children: [jsxRuntime.jsx("input", {
3187
+ disabled: disabled,
3188
+ class: "fjs-input",
3189
+ ref: searchbarRef,
3190
+ id: prefixId(`${id}-search`, formId),
3191
+ onChange: onChange,
3192
+ type: "text",
3193
+ value: filter,
3194
+ placeholder: 'Search',
3195
+ autoComplete: "off",
3196
+ onKeyDown: e => onInputKeyDown(e),
3197
+ onMouseDown: () => {
3198
+ setIsEscapeClose(false);
3199
+ setIsDropdownExpanded(true);
3200
+ setShouldApplyFilter(false);
3201
+ },
3202
+ onFocus: () => {
3203
+ setIsDropdownExpanded(true);
3204
+ setShouldApplyFilter(false);
3205
+ },
3206
+ onBlur: () => {
3207
+ setIsDropdownExpanded(false);
3208
+ setFilter(valueLabel);
3209
+ }
3210
+ }), displayState.displayCross && jsxRuntime.jsxs("span", {
3211
+ class: "fjs-select-cross",
3212
+ onMouseDown: e => {
3213
+ setValue(null);
3214
+ e.preventDefault();
3215
+ },
3216
+ children: [jsxRuntime.jsx(XMarkIcon, {}), " "]
3217
+ }), jsxRuntime.jsx("span", {
3218
+ class: "fjs-select-arrow",
3219
+ onMouseDown: e => onAngelMouseDown(e),
3220
+ children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
3221
+ })]
3222
+ }), jsxRuntime.jsx("div", {
3223
+ class: "fjs-select-anchor",
3224
+ children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
3225
+ values: filteredOptions,
3226
+ getLabel: o => o.label,
3227
+ onValueSelected: o => {
3228
+ setValue(o);
3229
+ setIsDropdownExpanded(false);
3230
+ },
3231
+ listenerElement: searchbarRef.current
3232
+ })
3233
+ })]
3234
+ });
3235
+ }
3236
+
3237
+ function SimpleSelect(props) {
3238
+ const {
3239
+ id,
3240
+ disabled,
3241
+ errors,
3242
+ field,
3243
+ value
3244
+ } = props;
3245
+ const {
3246
+ formId
3247
+ } = hooks.useContext(FormContext$1);
3248
+ const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
3249
+ const selectRef = hooks.useRef();
3250
+ const {
3251
+ state: loadState,
3252
+ values: options
3253
+ } = useValuesAsync(field);
3254
+
3255
+ // 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
3256
+ const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
3257
+ [o.value]: options[x]
3258
+ }))), [options]);
3259
+ const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
3260
+ const setValue = hooks.useCallback(option => {
3261
+ props.onChange({
3262
+ value: option && option.value || null,
3263
+ field
3264
+ });
3265
+ }, [field, props]);
3266
+ const displayState = hooks.useMemo(() => {
3267
+ const ds = {};
3268
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
3269
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
3270
+ ds.displayDropdown = !disabled && isDropdownExpanded;
3271
+ return ds;
3272
+ }, [disabled, isDropdownExpanded, loadState, value]);
3273
+ const onMouseDown = hooks.useCallback(e => {
3274
+ const select = selectRef.current;
3275
+ setIsDropdownExpanded(!isDropdownExpanded);
3276
+ if (isDropdownExpanded) {
3277
+ select.blur();
3278
+ } else {
3279
+ select.focus();
3280
+ }
3281
+ e.preventDefault();
3282
+ }, [isDropdownExpanded]);
3283
+ const initialFocusIndex = hooks.useMemo(() => value && minDash.findIndex(options, o => o.value === value) || 0, [options, value]);
3284
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3285
+ children: [jsxRuntime.jsxs("div", {
3286
+ ref: selectRef,
3287
+ id: prefixId(`${id}`, formId),
3288
+ class: classNames('fjs-input-group', {
3289
+ 'disabled': disabled
3290
+ }, {
3291
+ 'hasErrors': errors.length
3292
+ }),
3293
+ onFocus: () => setIsDropdownExpanded(true),
3294
+ onBlur: () => setIsDropdownExpanded(false),
3295
+ onMouseDown: e => onMouseDown(e),
3296
+ tabIndex: disabled ? undefined : 0,
3297
+ children: [jsxRuntime.jsx("div", {
3298
+ class: classNames('fjs-select-display', {
3299
+ 'fjs-select-placeholder': !value
3300
+ }),
3301
+ id: prefixId(`${id}-display`, formId),
3302
+ children: valueLabel || 'Select'
3303
+ }), displayState.displayCross && jsxRuntime.jsx("span", {
3304
+ class: "fjs-select-cross",
3305
+ onMouseDown: e => {
3306
+ setValue(null);
3307
+ e.stopPropagation();
3308
+ },
3309
+ children: jsxRuntime.jsx(XMarkIcon, {})
3310
+ }), jsxRuntime.jsx("span", {
3311
+ class: "fjs-select-arrow",
3312
+ children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
3313
+ })]
3314
+ }), jsxRuntime.jsx("div", {
3315
+ class: "fjs-select-anchor",
3316
+ children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
3317
+ values: options,
3318
+ getLabel: o => o.label,
3319
+ initialFocusIndex: initialFocusIndex,
3320
+ onValueSelected: o => {
3321
+ setValue(o);
3322
+ setIsDropdownExpanded(false);
3323
+ },
3324
+ listenerElement: selectRef.current
3325
+ })
3326
+ })]
3327
+ });
3328
+ }
3030
3329
 
3031
3330
  const type$4 = 'select';
3032
3331
  function Select(props) {
@@ -3034,32 +3333,30 @@ function Select(props) {
3034
3333
  disabled,
3035
3334
  errors = [],
3036
3335
  field,
3336
+ onChange,
3037
3337
  value
3038
3338
  } = props;
3039
3339
  const {
3040
3340
  description,
3041
3341
  id,
3042
3342
  label,
3343
+ searchable = false,
3043
3344
  validate = {}
3044
3345
  } = field;
3045
3346
  const {
3046
3347
  required
3047
3348
  } = validate;
3048
- const onChange = ({
3049
- target
3050
- }) => {
3051
- props.onChange({
3052
- field,
3053
- value: target.value === '' ? null : target.value
3054
- });
3055
- };
3056
- const {
3057
- state: loadState,
3058
- values: options
3059
- } = useValuesAsync(field);
3060
3349
  const {
3061
3350
  formId
3062
- } = hooks.useContext(FormContext);
3351
+ } = hooks.useContext(FormContext$1);
3352
+ const selectProps = hooks.useMemo(() => ({
3353
+ id,
3354
+ disabled,
3355
+ errors,
3356
+ field,
3357
+ value,
3358
+ onChange
3359
+ }), [disabled, errors, field, id, value, onChange]);
3063
3360
  return jsxRuntime.jsxs("div", {
3064
3361
  class: formFieldClasses(type$4, {
3065
3362
  errors,
@@ -3069,20 +3366,10 @@ function Select(props) {
3069
3366
  id: prefixId(id, formId),
3070
3367
  label: label,
3071
3368
  required: required
3072
- }), jsxRuntime.jsxs("select", {
3073
- class: "fjs-select",
3074
- disabled: disabled,
3075
- id: prefixId(id, formId),
3076
- onChange: onChange,
3077
- value: value || '',
3078
- children: [jsxRuntime.jsx("option", {
3079
- value: ""
3080
- }), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
3081
- return jsxRuntime.jsx("option", {
3082
- value: option.value,
3083
- children: option.label
3084
- }, `${id}-${index}`);
3085
- })]
3369
+ }), searchable ? jsxRuntime.jsx(SearchableSelect, {
3370
+ ...selectProps
3371
+ }) : jsxRuntime.jsx(SimpleSelect, {
3372
+ ...selectProps
3086
3373
  }), jsxRuntime.jsx(Description, {
3087
3374
  description: description
3088
3375
  }), jsxRuntime.jsx(Errors, {
@@ -3090,13 +3377,18 @@ function Select(props) {
3090
3377
  })]
3091
3378
  });
3092
3379
  }
3093
- Select.create = function (options = {}) {
3094
- if (options.valuesKey) return options;
3095
- return {
3096
- values: [{
3380
+ Select.create = (options = {}) => {
3381
+ const defaults = {};
3382
+
3383
+ // provide default values if valuesKey isn't set
3384
+ if (!options.valuesKey) {
3385
+ defaults.values = [{
3097
3386
  label: 'Value',
3098
3387
  value: 'value'
3099
- }],
3388
+ }];
3389
+ }
3390
+ return {
3391
+ ...defaults,
3100
3392
  ...options
3101
3393
  };
3102
3394
  };
@@ -3105,22 +3397,7 @@ Select.label = 'Select';
3105
3397
  Select.keyed = true;
3106
3398
  Select.emptyValue = null;
3107
3399
  Select.sanitizeValue = sanitizeSingleSelectValue;
3108
-
3109
- function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
3110
- var CloseIcon = (({
3111
- styles = {},
3112
- ...props
3113
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$e({
3114
- width: "16",
3115
- height: "16",
3116
- fill: "none",
3117
- xmlns: "http://www.w3.org/2000/svg"
3118
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3119
- fillRule: "evenodd",
3120
- clipRule: "evenodd",
3121
- 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",
3122
- fill: "currentColor"
3123
- })));
3400
+ Select.group = 'selection';
3124
3401
 
3125
3402
  const type$3 = 'taglist';
3126
3403
  function Taglist(props) {
@@ -3137,7 +3414,7 @@ function Taglist(props) {
3137
3414
  } = field;
3138
3415
  const {
3139
3416
  formId
3140
- } = hooks.useContext(FormContext);
3417
+ } = hooks.useContext(FormContext$1);
3141
3418
  const [filter, setFilter] = hooks.useState('');
3142
3419
  const [filteredOptions, setFilteredOptions] = hooks.useState([]);
3143
3420
  const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
@@ -3225,6 +3502,7 @@ function Taglist(props) {
3225
3502
  searchbarRef.current.focus();
3226
3503
  }
3227
3504
  };
3505
+ const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
3228
3506
  return jsxRuntime.jsxs("div", {
3229
3507
  class: formFieldClasses(type$3, {
3230
3508
  errors,
@@ -3234,24 +3512,26 @@ function Taglist(props) {
3234
3512
  label: label,
3235
3513
  id: prefixId(`${id}-search`, formId)
3236
3514
  }), jsxRuntime.jsxs("div", {
3237
- class: classNames__default['default']('fjs-taglist', {
3238
- 'disabled': disabled
3515
+ class: classNames('fjs-taglist', {
3516
+ 'fjs-disabled': disabled
3239
3517
  }),
3240
- children: [!disabled && loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
3518
+ children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
3241
3519
  class: "fjs-taglist-tags",
3242
3520
  children: values.map(v => {
3243
3521
  return jsxRuntime.jsxs("div", {
3244
- class: "fjs-taglist-tag",
3522
+ class: classNames('fjs-taglist-tag', {
3523
+ 'fjs-disabled': disabled
3524
+ }),
3245
3525
  onMouseDown: e => e.preventDefault(),
3246
3526
  children: [jsxRuntime.jsx("span", {
3247
3527
  class: "fjs-taglist-tag-label",
3248
3528
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
3249
- }), jsxRuntime.jsx("button", {
3529
+ }), !disabled && jsxRuntime.jsx("button", {
3250
3530
  type: "button",
3251
3531
  title: "Remove tag",
3252
3532
  class: "fjs-taglist-tag-remove",
3253
3533
  onClick: event => onTagRemoveClick(event, v),
3254
- children: jsxRuntime.jsx(CloseIcon, {})
3534
+ children: jsxRuntime.jsx(XMarkIcon, {})
3255
3535
  })]
3256
3536
  });
3257
3537
  })
@@ -3263,7 +3543,7 @@ function Taglist(props) {
3263
3543
  onChange: onFilterChange,
3264
3544
  type: "text",
3265
3545
  value: filter,
3266
- placeholder: 'Search',
3546
+ placeholder: disabled ? '' : 'Search',
3267
3547
  autoComplete: "off",
3268
3548
  onKeyDown: e => onInputKeyDown(e),
3269
3549
  onMouseDown: () => setIsEscapeClose(false),
@@ -3275,7 +3555,7 @@ function Taglist(props) {
3275
3555
  })]
3276
3556
  }), jsxRuntime.jsx("div", {
3277
3557
  class: "fjs-taglist-anchor",
3278
- children: !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed && jsxRuntime.jsx(DropdownList, {
3558
+ children: shouldDisplayDropdown && jsxRuntime.jsx(DropdownList, {
3279
3559
  values: filteredOptions,
3280
3560
  getLabel: o => o.label,
3281
3561
  onValueSelected: o => selectValue(o.value),
@@ -3289,62 +3569,263 @@ function Taglist(props) {
3289
3569
  })]
3290
3570
  });
3291
3571
  }
3292
- Taglist.create = function (options = {}) {
3293
- if (options.valuesKey) return options;
3294
- return {
3295
- values: [{
3572
+ Taglist.create = (options = {}) => {
3573
+ const defaults = {};
3574
+
3575
+ // provide default values if valuesKey isn't set
3576
+ if (!options.valuesKey) {
3577
+ defaults.values = [{
3296
3578
  label: 'Value',
3297
3579
  value: 'value'
3298
- }],
3580
+ }];
3581
+ }
3582
+ return {
3583
+ ...defaults,
3299
3584
  ...options
3300
3585
  };
3301
3586
  };
3302
3587
  Taglist.type = type$3;
3303
- Taglist.label = 'Taglist';
3588
+ Taglist.label = 'Tag list';
3304
3589
  Taglist.keyed = true;
3305
3590
  Taglist.emptyValue = [];
3306
3591
  Taglist.sanitizeValue = sanitizeMultiSelectValue;
3592
+ Taglist.group = 'selection';
3307
3593
 
3308
- function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
3309
- var ButtonIcon = (({
3310
- styles = {},
3311
- ...props
3312
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$d({
3313
- xmlns: "http://www.w3.org/2000/svg",
3314
- width: "54",
3315
- height: "54"
3316
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3317
- fillRule: "evenodd",
3318
- d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
3319
- })));
3320
-
3321
- function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
3322
- var CheckboxIcon = (({
3323
- styles = {},
3324
- ...props
3325
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$c({
3326
- xmlns: "http://www.w3.org/2000/svg",
3327
- width: "54",
3328
- height: "54"
3329
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3330
- d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
3331
- })));
3594
+ const type$2 = 'text';
3595
+ function Text(props) {
3596
+ const {
3597
+ field,
3598
+ disableLinks
3599
+ } = props;
3600
+ const {
3601
+ text = ''
3602
+ } = field;
3603
+ const textValue = useExpressionValue(text) || '';
3604
+ const componentOverrides = disableLinks ? {
3605
+ 'a': DisabledLink
3606
+ } : {};
3607
+ return jsxRuntime.jsx("div", {
3608
+ class: formFieldClasses(type$2),
3609
+ children: jsxRuntime.jsx(Markup, {
3610
+ markup: safeMarkdown(textValue),
3611
+ components: componentOverrides,
3612
+ trim: false
3613
+ })
3614
+ });
3615
+ }
3616
+ Text.create = (options = {}) => ({
3617
+ text: '# Text',
3618
+ ...options
3619
+ });
3620
+ Text.type = type$2;
3621
+ Text.keyed = false;
3622
+ Text.group = 'presentation';
3623
+ Text.label = 'Text view';
3624
+ function DisabledLink({
3625
+ href,
3626
+ children
3627
+ }) {
3628
+ return jsxRuntime.jsx("a", {
3629
+ class: "fjs-disabled-link",
3630
+ href: href,
3631
+ tabIndex: -1,
3632
+ children: children
3633
+ });
3634
+ }
3635
+
3636
+ const type$1 = 'textfield';
3637
+ function Textfield(props) {
3638
+ const {
3639
+ disabled,
3640
+ errors = [],
3641
+ field,
3642
+ value = ''
3643
+ } = props;
3644
+ const {
3645
+ description,
3646
+ id,
3647
+ label,
3648
+ appearance = {},
3649
+ validate = {}
3650
+ } = field;
3651
+ const {
3652
+ prefixAdorner,
3653
+ suffixAdorner
3654
+ } = appearance;
3655
+ const {
3656
+ required
3657
+ } = validate;
3658
+ const onChange = ({
3659
+ target
3660
+ }) => {
3661
+ props.onChange({
3662
+ field,
3663
+ value: target.value
3664
+ });
3665
+ };
3666
+ const {
3667
+ formId
3668
+ } = hooks.useContext(FormContext$1);
3669
+ return jsxRuntime.jsxs("div", {
3670
+ class: formFieldClasses(type$1, {
3671
+ errors,
3672
+ disabled
3673
+ }),
3674
+ children: [jsxRuntime.jsx(Label, {
3675
+ id: prefixId(id, formId),
3676
+ label: label,
3677
+ required: required
3678
+ }), jsxRuntime.jsx(InputAdorner, {
3679
+ disabled: disabled,
3680
+ pre: prefixAdorner,
3681
+ post: suffixAdorner,
3682
+ children: jsxRuntime.jsx("input", {
3683
+ class: "fjs-input",
3684
+ disabled: disabled,
3685
+ id: prefixId(id, formId),
3686
+ onInput: onChange,
3687
+ type: "text",
3688
+ value: value
3689
+ })
3690
+ }), jsxRuntime.jsx(Description, {
3691
+ description: description
3692
+ }), jsxRuntime.jsx(Errors, {
3693
+ errors: errors
3694
+ })]
3695
+ });
3696
+ }
3697
+ Textfield.create = (options = {}) => ({
3698
+ ...options
3699
+ });
3700
+ Textfield.type = type$1;
3701
+ Textfield.label = 'Text field';
3702
+ Textfield.keyed = true;
3703
+ Textfield.emptyValue = '';
3704
+ Textfield.sanitizeValue = ({
3705
+ value
3706
+ }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
3707
+ Textfield.group = 'basic-input';
3708
+
3709
+ const type = 'textarea';
3710
+ function Textarea(props) {
3711
+ const {
3712
+ disabled,
3713
+ errors = [],
3714
+ field,
3715
+ value = ''
3716
+ } = props;
3717
+ const {
3718
+ description,
3719
+ id,
3720
+ label,
3721
+ validate = {}
3722
+ } = field;
3723
+ const {
3724
+ required
3725
+ } = validate;
3726
+ const textareaRef = hooks.useRef();
3727
+ const onInput = ({
3728
+ target
3729
+ }) => {
3730
+ props.onChange({
3731
+ field,
3732
+ value: target.value
3733
+ });
3734
+ };
3735
+ const autoSizeTextarea = hooks.useCallback(textarea => {
3736
+ // Ensures the textarea shrinks back, and improves resizing behavior consistency
3737
+ textarea.style.height = '0px';
3738
+ const computed = window.getComputedStyle(textarea);
3739
+ 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'));
3740
+ const minHeight = 75;
3741
+ const maxHeight = 350;
3742
+ const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
3743
+ textarea.style.height = `${displayHeight}px`;
3744
+
3745
+ // Overflow is hidden by default to hide scrollbar flickering
3746
+ textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
3747
+ }, []);
3748
+ hooks.useEffect(() => {
3749
+ autoSizeTextarea(textareaRef.current);
3750
+ }, [autoSizeTextarea, value]);
3751
+ const {
3752
+ formId
3753
+ } = hooks.useContext(FormContext$1);
3754
+ return jsxRuntime.jsxs("div", {
3755
+ class: formFieldClasses(type, {
3756
+ errors,
3757
+ disabled
3758
+ }),
3759
+ children: [jsxRuntime.jsx(Label, {
3760
+ id: prefixId(id, formId),
3761
+ label: label,
3762
+ required: required
3763
+ }), jsxRuntime.jsx("textarea", {
3764
+ class: "fjs-textarea",
3765
+ disabled: disabled,
3766
+ id: prefixId(id, formId),
3767
+ onInput: onInput,
3768
+ value: value,
3769
+ ref: textareaRef
3770
+ }), jsxRuntime.jsx(Description, {
3771
+ description: description
3772
+ }), jsxRuntime.jsx(Errors, {
3773
+ errors: errors
3774
+ })]
3775
+ });
3776
+ }
3777
+ Textarea.create = (options = {}) => ({
3778
+ ...options
3779
+ });
3780
+ Textarea.type = type;
3781
+ Textarea.label = 'Text area';
3782
+ Textarea.keyed = true;
3783
+ Textarea.emptyValue = '';
3784
+ Textarea.sanitizeValue = ({
3785
+ value
3786
+ }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
3787
+ Textarea.group = 'basic-input';
3788
+
3789
+ function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
3790
+ var ButtonIcon = (({
3791
+ styles = {},
3792
+ ...props
3793
+ }) => /*#__PURE__*/React.createElement("svg", _extends$d({
3794
+ xmlns: "http://www.w3.org/2000/svg",
3795
+ width: "54",
3796
+ height: "54"
3797
+ }, props), /*#__PURE__*/React.createElement("path", {
3798
+ fillRule: "evenodd",
3799
+ d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
3800
+ })));
3801
+
3802
+ function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
3803
+ var CheckboxIcon = (({
3804
+ styles = {},
3805
+ ...props
3806
+ }) => /*#__PURE__*/React.createElement("svg", _extends$c({
3807
+ xmlns: "http://www.w3.org/2000/svg",
3808
+ width: "54",
3809
+ height: "54"
3810
+ }, props), /*#__PURE__*/React.createElement("path", {
3811
+ d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
3812
+ })));
3332
3813
 
3333
3814
  function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
3334
3815
  var ChecklistIcon = (({
3335
3816
  styles = {},
3336
3817
  ...props
3337
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
3818
+ }) => /*#__PURE__*/React.createElement("svg", _extends$b({
3338
3819
  xmlns: "http://www.w3.org/2000/svg",
3339
3820
  width: "54",
3340
3821
  height: "54",
3341
3822
  fill: "none"
3342
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3823
+ }, props), /*#__PURE__*/React.createElement("path", {
3343
3824
  fillRule: "evenodd",
3344
3825
  clipRule: "evenodd",
3345
3826
  d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
3346
3827
  fill: "#161616"
3347
- }), /*#__PURE__*/React__default['default'].createElement("path", {
3828
+ }), /*#__PURE__*/React.createElement("path", {
3348
3829
  d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
3349
3830
  fill: "#161616"
3350
3831
  })));
@@ -3353,20 +3834,20 @@ function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : func
3353
3834
  var DatetimeIcon = (({
3354
3835
  styles = {},
3355
3836
  ...props
3356
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
3837
+ }) => /*#__PURE__*/React.createElement("svg", _extends$a({
3357
3838
  xmlns: "http://www.w3.org/2000/svg",
3358
3839
  width: "54",
3359
3840
  height: "54",
3360
3841
  fill: "none"
3361
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3842
+ }, props), /*#__PURE__*/React.createElement("path", {
3362
3843
  fill: "#000",
3363
3844
  fillRule: "evenodd",
3364
3845
  d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36c-1.132 0-2.06.928-2.06 2.06v23.549c0 1.132.928 2.06 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592c.39 0 .707.317.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z",
3365
3846
  clipRule: "evenodd"
3366
- }), /*#__PURE__*/React__default['default'].createElement("path", {
3847
+ }), /*#__PURE__*/React.createElement("path", {
3367
3848
  fill: "#000",
3368
3849
  d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
3369
- }), /*#__PURE__*/React__default['default'].createElement("path", {
3850
+ }), /*#__PURE__*/React.createElement("path", {
3370
3851
  fill: "#000",
3371
3852
  fillRule: "evenodd",
3372
3853
  d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z",
@@ -3377,17 +3858,17 @@ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : func
3377
3858
  var TaglistIcon = (({
3378
3859
  styles = {},
3379
3860
  ...props
3380
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
3861
+ }) => /*#__PURE__*/React.createElement("svg", _extends$9({
3381
3862
  width: "54",
3382
3863
  height: "54",
3383
3864
  fill: "none",
3384
3865
  xmlns: "http://www.w3.org/2000/svg"
3385
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3866
+ }, props), /*#__PURE__*/React.createElement("path", {
3386
3867
  fillRule: "evenodd",
3387
3868
  clipRule: "evenodd",
3388
3869
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
3389
3870
  fill: "#000"
3390
- }), /*#__PURE__*/React__default['default'].createElement("path", {
3871
+ }), /*#__PURE__*/React.createElement("path", {
3391
3872
  d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
3392
3873
  fill: "#505562"
3393
3874
  })));
@@ -3396,23 +3877,23 @@ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : func
3396
3877
  var FormIcon = (({
3397
3878
  styles = {},
3398
3879
  ...props
3399
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
3880
+ }) => /*#__PURE__*/React.createElement("svg", _extends$8({
3400
3881
  xmlns: "http://www.w3.org/2000/svg",
3401
3882
  width: "54",
3402
3883
  height: "54"
3403
- }, props), /*#__PURE__*/React__default['default'].createElement("rect", {
3884
+ }, props), /*#__PURE__*/React.createElement("rect", {
3404
3885
  x: "15",
3405
3886
  y: "17",
3406
3887
  width: "24",
3407
3888
  height: "4",
3408
3889
  rx: "1"
3409
- }), /*#__PURE__*/React__default['default'].createElement("rect", {
3890
+ }), /*#__PURE__*/React.createElement("rect", {
3410
3891
  x: "15",
3411
3892
  y: "25",
3412
3893
  width: "24",
3413
3894
  height: "4",
3414
3895
  rx: "1"
3415
- }), /*#__PURE__*/React__default['default'].createElement("rect", {
3896
+ }), /*#__PURE__*/React.createElement("rect", {
3416
3897
  x: "15",
3417
3898
  y: "33",
3418
3899
  width: "13",
@@ -3424,11 +3905,11 @@ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : func
3424
3905
  var ColumnsIcon = (({
3425
3906
  styles = {},
3426
3907
  ...props
3427
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
3908
+ }) => /*#__PURE__*/React.createElement("svg", _extends$7({
3428
3909
  xmlns: "http://www.w3.org/2000/svg",
3429
3910
  width: "54",
3430
3911
  height: "54"
3431
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3912
+ }, props), /*#__PURE__*/React.createElement("path", {
3432
3913
  fillRule: "evenodd",
3433
3914
  d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
3434
3915
  })));
@@ -3437,11 +3918,11 @@ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : func
3437
3918
  var NumberIcon = (({
3438
3919
  styles = {},
3439
3920
  ...props
3440
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
3921
+ }) => /*#__PURE__*/React.createElement("svg", _extends$6({
3441
3922
  xmlns: "http://www.w3.org/2000/svg",
3442
3923
  width: "54",
3443
3924
  height: "54"
3444
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3925
+ }, props), /*#__PURE__*/React.createElement("path", {
3445
3926
  fillRule: "evenodd",
3446
3927
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
3447
3928
  })));
@@ -3450,11 +3931,11 @@ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : func
3450
3931
  var RadioIcon = (({
3451
3932
  styles = {},
3452
3933
  ...props
3453
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
3934
+ }) => /*#__PURE__*/React.createElement("svg", _extends$5({
3454
3935
  xmlns: "http://www.w3.org/2000/svg",
3455
3936
  width: "54",
3456
3937
  height: "54"
3457
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3938
+ }, props), /*#__PURE__*/React.createElement("path", {
3458
3939
  d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
3459
3940
  })));
3460
3941
 
@@ -3462,11 +3943,11 @@ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : func
3462
3943
  var SelectIcon = (({
3463
3944
  styles = {},
3464
3945
  ...props
3465
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
3946
+ }) => /*#__PURE__*/React.createElement("svg", _extends$4({
3466
3947
  xmlns: "http://www.w3.org/2000/svg",
3467
3948
  width: "54",
3468
3949
  height: "54"
3469
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3950
+ }, props), /*#__PURE__*/React.createElement("path", {
3470
3951
  fillRule: "evenodd",
3471
3952
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
3472
3953
  })));
@@ -3475,11 +3956,11 @@ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : func
3475
3956
  var TextIcon = (({
3476
3957
  styles = {},
3477
3958
  ...props
3478
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
3959
+ }) => /*#__PURE__*/React.createElement("svg", _extends$3({
3479
3960
  xmlns: "http://www.w3.org/2000/svg",
3480
3961
  width: "54",
3481
3962
  height: "54"
3482
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3963
+ }, props), /*#__PURE__*/React.createElement("path", {
3483
3964
  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"
3484
3965
  })));
3485
3966
 
@@ -3487,11 +3968,11 @@ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : func
3487
3968
  var TextfieldIcon = (({
3488
3969
  styles = {},
3489
3970
  ...props
3490
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
3971
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2({
3491
3972
  xmlns: "http://www.w3.org/2000/svg",
3492
3973
  width: "54",
3493
3974
  height: "54"
3494
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3975
+ }, props), /*#__PURE__*/React.createElement("path", {
3495
3976
  fillRule: "evenodd",
3496
3977
  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"
3497
3978
  })));
@@ -3500,11 +3981,11 @@ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : func
3500
3981
  var TextareaIcon = (({
3501
3982
  styles = {},
3502
3983
  ...props
3503
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
3984
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
3504
3985
  xmlns: "http://www.w3.org/2000/svg",
3505
3986
  width: "54",
3506
3987
  height: "54"
3507
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
3988
+ }, props), /*#__PURE__*/React.createElement("path", {
3508
3989
  fillRule: "evenodd",
3509
3990
  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"
3510
3991
  })));
@@ -3513,249 +3994,41 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3513
3994
  var ImageIcon = (({
3514
3995
  styles = {},
3515
3996
  ...props
3516
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
3997
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
3517
3998
  width: "54",
3518
3999
  height: "54",
3519
4000
  fill: "none",
3520
4001
  xmlns: "http://www.w3.org/2000/svg"
3521
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
4002
+ }, props), /*#__PURE__*/React.createElement("path", {
3522
4003
  fillRule: "evenodd",
3523
4004
  clipRule: "evenodd",
3524
4005
  d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
3525
4006
  fill: "#000"
3526
- }), /*#__PURE__*/React__default['default'].createElement("path", {
4007
+ }), /*#__PURE__*/React.createElement("path", {
3527
4008
  fillRule: "evenodd",
3528
4009
  clipRule: "evenodd",
3529
4010
  d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
3530
4011
  fill: "#000"
3531
4012
  })));
3532
4013
 
3533
- const iconsByType = {
3534
- button: ButtonIcon,
3535
- checkbox: CheckboxIcon,
3536
- checklist: ChecklistIcon,
3537
- columns: ColumnsIcon,
3538
- datetime: DatetimeIcon,
3539
- image: ImageIcon,
3540
- number: NumberIcon,
3541
- radio: RadioIcon,
3542
- select: SelectIcon,
3543
- taglist: TaglistIcon,
3544
- text: TextIcon,
3545
- textfield: TextfieldIcon,
3546
- textarea: TextareaIcon,
3547
- default: FormIcon
3548
- };
3549
-
3550
- const type$2 = 'text';
3551
- function Text(props) {
3552
- const {
3553
- field,
3554
- disabled
3555
- } = props;
3556
- const {
3557
- text = ''
3558
- } = field;
3559
- const textValue = useExpressionValue(text) || '';
3560
- return jsxRuntime.jsx("div", {
3561
- class: formFieldClasses(type$2),
3562
- children: renderText(field, textValue, disabled)
3563
- });
3564
- }
3565
- Text.create = function (options = {}) {
4014
+ const iconsByType = type => {
3566
4015
  return {
3567
- text: '# Text',
3568
- ...options
3569
- };
4016
+ button: ButtonIcon,
4017
+ checkbox: CheckboxIcon,
4018
+ checklist: ChecklistIcon,
4019
+ columns: ColumnsIcon,
4020
+ datetime: DatetimeIcon,
4021
+ image: ImageIcon,
4022
+ number: NumberIcon,
4023
+ radio: RadioIcon,
4024
+ select: SelectIcon,
4025
+ taglist: TaglistIcon,
4026
+ text: TextIcon,
4027
+ textfield: TextfieldIcon,
4028
+ textarea: TextareaIcon,
4029
+ default: FormIcon
4030
+ }[type];
3570
4031
  };
3571
- Text.type = type$2;
3572
- Text.keyed = false;
3573
-
3574
- // helper //////////////
3575
-
3576
- function renderText(field, content, disabled) {
3577
- const {
3578
- text
3579
- } = field;
3580
- const Icon = iconsByType['text'];
3581
- if (disabled) {
3582
- if (!text) {
3583
- return jsxRuntime.jsxs("div", {
3584
- class: "fjs-form-field-placeholder",
3585
- children: [jsxRuntime.jsx(Icon, {
3586
- viewBox: "0 0 54 54"
3587
- }), "Text view is empty"]
3588
- });
3589
- }
3590
- if (isExpression$2(text)) {
3591
- return jsxRuntime.jsxs("div", {
3592
- class: "fjs-form-field-placeholder",
3593
- children: [jsxRuntime.jsx(Icon, {
3594
- viewBox: "0 0 54 54"
3595
- }), "Text view is populated by an expression"]
3596
- });
3597
- }
3598
- }
3599
- return jsxRuntime.jsx(Markup__default['default'], {
3600
- markup: safeMarkdown(content),
3601
- trim: false
3602
- });
3603
- }
3604
-
3605
- const type$1 = 'textfield';
3606
- function Textfield(props) {
3607
- const {
3608
- disabled,
3609
- errors = [],
3610
- field,
3611
- value = ''
3612
- } = props;
3613
- const {
3614
- description,
3615
- id,
3616
- label,
3617
- appearance = {},
3618
- validate = {}
3619
- } = field;
3620
- const {
3621
- prefixAdorner,
3622
- suffixAdorner
3623
- } = appearance;
3624
- const {
3625
- required
3626
- } = validate;
3627
- const onChange = ({
3628
- target
3629
- }) => {
3630
- props.onChange({
3631
- field,
3632
- value: target.value
3633
- });
3634
- };
3635
- const {
3636
- formId
3637
- } = hooks.useContext(FormContext);
3638
- return jsxRuntime.jsxs("div", {
3639
- class: formFieldClasses(type$1, {
3640
- errors,
3641
- disabled
3642
- }),
3643
- children: [jsxRuntime.jsx(Label, {
3644
- id: prefixId(id, formId),
3645
- label: label,
3646
- required: required
3647
- }), jsxRuntime.jsx(InputAdorner, {
3648
- disabled: disabled,
3649
- pre: prefixAdorner,
3650
- post: suffixAdorner,
3651
- children: jsxRuntime.jsx("input", {
3652
- class: "fjs-input",
3653
- disabled: disabled,
3654
- id: prefixId(id, formId),
3655
- onInput: onChange,
3656
- type: "text",
3657
- value: value
3658
- })
3659
- }), jsxRuntime.jsx(Description, {
3660
- description: description
3661
- }), jsxRuntime.jsx(Errors, {
3662
- errors: errors
3663
- })]
3664
- });
3665
- }
3666
- Textfield.create = function (options = {}) {
3667
- return {
3668
- ...options
3669
- };
3670
- };
3671
- Textfield.type = type$1;
3672
- Textfield.label = 'Text field';
3673
- Textfield.keyed = true;
3674
- Textfield.emptyValue = '';
3675
- Textfield.sanitizeValue = ({
3676
- value
3677
- }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
3678
-
3679
- const type = 'textarea';
3680
- function Textarea(props) {
3681
- const {
3682
- disabled,
3683
- errors = [],
3684
- field,
3685
- value = ''
3686
- } = props;
3687
- const {
3688
- description,
3689
- id,
3690
- label,
3691
- validate = {}
3692
- } = field;
3693
- const {
3694
- required
3695
- } = validate;
3696
- const textareaRef = hooks.useRef();
3697
- const onInput = ({
3698
- target
3699
- }) => {
3700
- props.onChange({
3701
- field,
3702
- value: target.value
3703
- });
3704
- };
3705
- const autoSizeTextarea = hooks.useCallback(textarea => {
3706
- // Ensures the textarea shrinks back, and improves resizing behavior consistency
3707
- textarea.style.height = '0px';
3708
- const computed = window.getComputedStyle(textarea);
3709
- 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'));
3710
- const minHeight = 75;
3711
- const maxHeight = 350;
3712
- const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
3713
- textarea.style.height = `${displayHeight}px`;
3714
-
3715
- // Overflow is hidden by default to hide scrollbar flickering
3716
- textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
3717
- }, []);
3718
- hooks.useEffect(() => {
3719
- autoSizeTextarea(textareaRef.current);
3720
- }, [autoSizeTextarea, value]);
3721
- const {
3722
- formId
3723
- } = hooks.useContext(FormContext);
3724
- return jsxRuntime.jsxs("div", {
3725
- class: formFieldClasses(type, {
3726
- errors,
3727
- disabled
3728
- }),
3729
- children: [jsxRuntime.jsx(Label, {
3730
- id: prefixId(id, formId),
3731
- label: label,
3732
- required: required
3733
- }), jsxRuntime.jsx("textarea", {
3734
- class: "fjs-textarea",
3735
- disabled: disabled,
3736
- id: prefixId(id, formId),
3737
- onInput: onInput,
3738
- value: value,
3739
- ref: textareaRef
3740
- }), jsxRuntime.jsx(Description, {
3741
- description: description
3742
- }), jsxRuntime.jsx(Errors, {
3743
- errors: errors
3744
- })]
3745
- });
3746
- }
3747
- Textarea.create = function (options = {}) {
3748
- return {
3749
- ...options
3750
- };
3751
- };
3752
- Textarea.type = type;
3753
- Textarea.label = 'Text area';
3754
- Textarea.keyed = true;
3755
- Textarea.emptyValue = '';
3756
- Textarea.sanitizeValue = ({
3757
- value
3758
- }) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
3759
4032
 
3760
4033
  const formFields = [Button, Checkbox, Checklist, Default, Image, Numberfield, Datetime, Radio, Select, Taglist, Text, Textfield, Textarea];
3761
4034
 
@@ -3763,10 +4036,7 @@ class FormFields {
3763
4036
  constructor() {
3764
4037
  this._formFields = {};
3765
4038
  formFields.forEach(formField => {
3766
- const {
3767
- type
3768
- } = formField;
3769
- this.register(type, formField);
4039
+ this.register(formField.type, formField);
3770
4040
  });
3771
4041
  }
3772
4042
  register(type, formField) {
@@ -3808,7 +4078,7 @@ function Renderer(config, eventBus, form, injector) {
3808
4078
  if (!schema) {
3809
4079
  return null;
3810
4080
  }
3811
- return jsxRuntime.jsx(FormContext.Provider, {
4081
+ return jsxRuntime.jsx(FormContext$1.Provider, {
3812
4082
  value: formContext,
3813
4083
  children: jsxRuntime.jsx(FormComponent, {
3814
4084
  onChange: onChange,
@@ -3866,7 +4136,7 @@ var core = {
3866
4136
  * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
3867
4137
  */
3868
4138
 
3869
- const ids = new Ids__default['default']([32, 36, 1]);
4139
+ const ids = new Ids([32, 36, 1]);
3870
4140
 
3871
4141
  /**
3872
4142
  * The form.
@@ -4209,7 +4479,7 @@ class Form {
4209
4479
  }
4210
4480
  }
4211
4481
 
4212
- const schemaVersion = 6;
4482
+ const schemaVersion = 7;
4213
4483
 
4214
4484
  /**
4215
4485
  * @typedef { import('./types').CreateFormOptions } CreateFormOptions
@@ -4246,10 +4516,10 @@ exports.Datetime = Datetime;
4246
4516
  exports.Default = Default;
4247
4517
  exports.Form = Form;
4248
4518
  exports.FormComponent = FormComponent;
4249
- exports.FormContext = FormContext;
4519
+ exports.FormContext = FormContext$1;
4250
4520
  exports.FormFieldRegistry = FormFieldRegistry;
4251
4521
  exports.FormFields = FormFields;
4252
- exports.FormRenderContext = FormRenderContext;
4522
+ exports.FormRenderContext = FormRenderContext$1;
4253
4523
  exports.Image = Image;
4254
4524
  exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
4255
4525
  exports.Numberfield = Numberfield;
@@ -4278,9 +4548,12 @@ exports.findErrors = findErrors;
4278
4548
  exports.formFields = formFields;
4279
4549
  exports.generateIdForType = generateIdForType;
4280
4550
  exports.generateIndexForType = generateIndexForType;
4551
+ exports.getExpressionVariableNames = getExpressionVariableNames;
4281
4552
  exports.getSchemaVariables = getSchemaVariables;
4282
4553
  exports.getValuesSource = getValuesSource;
4554
+ exports.getVariableNames = getVariableNames;
4283
4555
  exports.iconsByType = iconsByType;
4556
+ exports.isExpression = isExpression$1;
4284
4557
  exports.isRequired = isRequired;
4285
4558
  exports.pathParse = pathParse;
4286
4559
  exports.pathStringify = pathStringify;