@bpmn-io/form-js-playground 1.7.0 → 1.7.2

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.
@@ -53323,20 +53323,59 @@
53323
53323
  }, [conditionChecker, condition, expressionContextInfo]);
53324
53324
  }
53325
53325
 
53326
- // parses the options data from the provided form field and form data
53327
- function getOptionsData(formField, formData) {
53326
+ /**
53327
+ * Returns the options data for the provided if they can be simply determined, ignoring expression defined options.
53328
+ *
53329
+ * @param {object} formField
53330
+ * @param {object} formData
53331
+ */
53332
+ function getSimpleOptionsData(formField, formData) {
53328
53333
  const {
53334
+ valuesExpression: optionsExpression,
53329
53335
  valuesKey: optionsKey,
53330
53336
  values: staticOptions
53331
53337
  } = formField;
53338
+ if (optionsExpression) {
53339
+ return null;
53340
+ }
53332
53341
  return optionsKey ? get$1(formData, [optionsKey]) : staticOptions;
53333
53342
  }
53334
53343
 
53335
- // transforms the provided options into a normalized format, trimming invalid options
53344
+ /**
53345
+ * Normalizes the provided options data to a format that can be used by the select components.
53346
+ * If the options data is not valid, it is filtered out.
53347
+ *
53348
+ * @param {any[]} optionsData
53349
+ *
53350
+ * @returns {object[]}
53351
+ */
53336
53352
  function normalizeOptionsData(optionsData) {
53337
53353
  return optionsData.filter(_isAllowedValue).map(_normalizeOption).filter(o => !isNil$1(o));
53338
53354
  }
53339
53355
 
53356
+ /**
53357
+ * Creates an options object with default values if no options are provided.
53358
+ *
53359
+ * @param {object} options
53360
+ *
53361
+ * @returns {object}
53362
+ */
53363
+ function createEmptyOptions(options = {}) {
53364
+ const defaults = {};
53365
+
53366
+ // provide default options if valuesKey and valuesExpression are not set
53367
+ if (!options.valuesKey && !options.valuesExpression) {
53368
+ defaults.values = [{
53369
+ label: 'Value',
53370
+ value: 'value'
53371
+ }];
53372
+ }
53373
+ return {
53374
+ ...defaults,
53375
+ ...options
53376
+ };
53377
+ }
53378
+
53340
53379
  /**
53341
53380
  * Converts the provided option to a normalized format.
53342
53381
  * If the option is not valid, null is returned.
@@ -53387,21 +53426,6 @@
53387
53426
  }
53388
53427
  return _isAllowedPrimitive(value);
53389
53428
  }
53390
- function createEmptyOptions(options = {}) {
53391
- const defaults = {};
53392
-
53393
- // provide default options if valuesKey and valuesExpression are not set
53394
- if (!options.valuesKey && !options.valuesExpression) {
53395
- defaults.values = [{
53396
- label: 'Value',
53397
- value: 'value'
53398
- }];
53399
- }
53400
- return {
53401
- ...defaults,
53402
- ...options
53403
- };
53404
- }
53405
53429
 
53406
53430
  /**
53407
53431
  * Evaluate a string reactively based on the expressionLanguage and form data.
@@ -53421,29 +53445,20 @@
53421
53445
  return value;
53422
53446
  }, [expressionLanguage, expressionContextInfo, value]);
53423
53447
  }
53424
- function usePrevious$1(value, defaultValue = null) {
53425
- const ref = s$1(defaultValue);
53426
- y(() => ref.current = value, [value]);
53427
- return ref.current;
53428
- }
53429
53448
 
53430
53449
  /**
53431
53450
  * A custom hook to manage state changes with deep comparison.
53432
53451
  *
53433
- * @param {any} value - The current value to manage.
53434
- * @param {any} defaultValue - The initial default value for the state.
53435
- * @returns {any} - Returns the current state.
53452
+ * @template T
53453
+ * @param {T} value - The current value to manage.
53454
+ * @returns {T} - Returns the current state.
53436
53455
  */
53437
- function useDeepCompareState(value, defaultValue) {
53438
- const [state, setState] = l$1(defaultValue);
53439
- const previous = usePrevious$1(value, defaultValue);
53440
- const changed = !isEqual$1(previous, value);
53441
- y(() => {
53442
- if (changed) {
53443
- setState(value);
53444
- }
53445
- }, [changed, value]);
53446
- return state;
53456
+ function useDeepCompareMemoize(value) {
53457
+ const ref = s$1();
53458
+ if (!isEqual$1(value, ref.current)) {
53459
+ ref.current = value;
53460
+ }
53461
+ return ref.current;
53447
53462
  }
53448
53463
 
53449
53464
  /**
@@ -53473,15 +53488,10 @@
53473
53488
  valuesKey: optionsKey,
53474
53489
  values: staticOptions
53475
53490
  } = field;
53476
- const [optionsGetter, setOptionsGetter] = l$1({
53477
- options: [],
53478
- error: undefined,
53479
- loadState: LOAD_STATES.LOADING
53480
- });
53481
53491
  const initialData = useService$2('form')._getState().initialData;
53482
53492
  const expressionEvaluation = useExpressionEvaluation(optionsExpression);
53483
- const evaluatedOptions = useDeepCompareState(expressionEvaluation || [], []);
53484
- y(() => {
53493
+ const evaluatedOptions = useDeepCompareMemoize(expressionEvaluation || []);
53494
+ const optionsGetter = d(() => {
53485
53495
  let options = [];
53486
53496
 
53487
53497
  // dynamic options
@@ -53496,18 +53506,16 @@
53496
53506
  options = Array.isArray(staticOptions) ? staticOptions : [];
53497
53507
 
53498
53508
  // expression
53499
- } else if (optionsExpression) {
53500
- if (evaluatedOptions && Array.isArray(evaluatedOptions)) {
53501
- options = evaluatedOptions;
53502
- }
53509
+ } else if (optionsExpression && evaluatedOptions && Array.isArray(evaluatedOptions)) {
53510
+ options = evaluatedOptions;
53511
+
53512
+ // error case
53503
53513
  } else {
53504
- setOptionsGetter(buildErrorState('No options source defined in the form definition'));
53505
- return;
53514
+ return buildErrorState('No options source defined in the form definition');
53506
53515
  }
53507
53516
 
53508
53517
  // normalize data to support primitives and partially defined objects
53509
- options = normalizeOptionsData(options);
53510
- setOptionsGetter(buildLoadedState(options));
53518
+ return buildLoadedState(normalizeOptionsData(options));
53511
53519
  }, [optionsKey, staticOptions, initialData, optionsExpression, evaluatedOptions]);
53512
53520
  return optionsGetter;
53513
53521
  }
@@ -53552,14 +53560,14 @@
53552
53560
  };
53553
53561
  };
53554
53562
 
53555
- /**
53556
- * A custom hook to build up security attributes from form configuration.
53557
- *
53558
- * @param {Object} security - The security configuration.
53559
- * @returns {Array} - Returns a tuple with sandbox and allow attributes.
53563
+ /**
53564
+ * A custom hook to build up security attributes from form configuration.
53565
+ *
53566
+ * @param {Object} security - The security configuration.
53567
+ * @returns {Array} - Returns a tuple with sandbox and allow attributes.
53560
53568
  */
53561
53569
  function useSecurityAttributesMap(security) {
53562
- const securityMemoized = useDeepCompareState(security);
53570
+ const securityMemoized = useDeepCompareMemoize(security);
53563
53571
  const sandbox = d(() => SECURITY_ATTRIBUTES_DEFINITIONS.filter(({
53564
53572
  attribute
53565
53573
  }) => attribute === SANDBOX_ATTRIBUTE).filter(({
@@ -53729,6 +53737,11 @@
53729
53737
  }
53730
53738
  return readonly || false;
53731
53739
  }
53740
+ function usePrevious$1(value, defaultValue = null) {
53741
+ const ref = s$1(defaultValue);
53742
+ y(() => ref.current = value, [value]);
53743
+ return ref.current;
53744
+ }
53732
53745
  function useFlushDebounce(func) {
53733
53746
  const timeoutRef = s$1(null);
53734
53747
  const lastArgsRef = s$1(null);
@@ -53991,8 +54004,16 @@
53991
54004
  data,
53992
54005
  value
53993
54006
  } = options;
54007
+ const {
54008
+ valuesExpression: optionsExpression
54009
+ } = formField;
53994
54010
  try {
53995
- const validValues = normalizeOptionsData(getOptionsData(formField, data)).map(v => v.value);
54011
+ // if options are expression evaluated, we don't need to sanitize the value against the options
54012
+ // and defer to the field's internal validation
54013
+ if (optionsExpression) {
54014
+ return value;
54015
+ }
54016
+ const validValues = normalizeOptionsData(getSimpleOptionsData(formField, data)).map(v => v.value);
53996
54017
  return hasEqualValue(value, validValues) ? value : null;
53997
54018
  } catch (error) {
53998
54019
  // use default value in case of formatting error
@@ -54006,8 +54027,16 @@
54006
54027
  data,
54007
54028
  value
54008
54029
  } = options;
54030
+ const {
54031
+ valuesExpression: optionsExpression
54032
+ } = formField;
54009
54033
  try {
54010
- const validValues = normalizeOptionsData(getOptionsData(formField, data)).map(v => v.value);
54034
+ // if options are expression evaluated, we don't need to sanitize the values against the options
54035
+ // and defer to the field's internal validation
54036
+ if (optionsExpression) {
54037
+ return value;
54038
+ }
54039
+ const validValues = normalizeOptionsData(getSimpleOptionsData(formField, data)).map(v => v.value);
54011
54040
  return value.filter(v => hasEqualValue(v, validValues));
54012
54041
  } catch (error) {
54013
54042
  // use default value in case of formatting error
@@ -54093,7 +54122,7 @@
54093
54122
  onChange,
54094
54123
  values
54095
54124
  } = props;
54096
- const memoizedValues = useDeepCompareState(values, []);
54125
+ const memoizedValues = useDeepCompareMemoize(values || []);
54097
54126
 
54098
54127
  // ensures that the values are always a subset of the possible options
54099
54128
  y(() => {
@@ -54112,7 +54141,8 @@
54112
54141
  }
54113
54142
  function Description$2(props) {
54114
54143
  const {
54115
- description
54144
+ description,
54145
+ id
54116
54146
  } = props;
54117
54147
  const evaluatedDescription = useSingleLineTemplateEvaluation(description || '', {
54118
54148
  debug: true
@@ -54121,6 +54151,7 @@
54121
54151
  return null;
54122
54152
  }
54123
54153
  return e("div", {
54154
+ id: id,
54124
54155
  class: "fjs-form-field-description",
54125
54156
  children: evaluatedDescription
54126
54157
  });
@@ -54149,6 +54180,7 @@
54149
54180
  function Label$3(props) {
54150
54181
  const {
54151
54182
  id,
54183
+ htmlFor,
54152
54184
  label,
54153
54185
  collapseOnEmpty = true,
54154
54186
  required = false
@@ -54157,12 +54189,14 @@
54157
54189
  debug: true
54158
54190
  });
54159
54191
  return e("label", {
54160
- for: id,
54192
+ id: id,
54193
+ for: htmlFor,
54161
54194
  class: classNames('fjs-form-field-label', {
54162
54195
  'fjs-incollapsible-label': !collapseOnEmpty
54163
54196
  }, props['class']),
54164
54197
  children: [props.children, evaluatedLabel, required && e("span", {
54165
54198
  class: "fjs-asterix",
54199
+ "aria-hidden": true,
54166
54200
  children: "*"
54167
54201
  })]
54168
54202
  });
@@ -54172,7 +54206,6 @@
54172
54206
  const {
54173
54207
  disabled,
54174
54208
  errors = [],
54175
- errorMessageId,
54176
54209
  domId,
54177
54210
  onBlur,
54178
54211
  onFocus,
@@ -54196,6 +54229,8 @@
54196
54229
  value: target.checked
54197
54230
  });
54198
54231
  };
54232
+ const descriptionId = `${domId}-description`;
54233
+ const errorMessageId = `${domId}-error-message`;
54199
54234
  return e("div", {
54200
54235
  class: classNames(formFieldClasses(type$f, {
54201
54236
  errors,
@@ -54205,7 +54240,7 @@
54205
54240
  'fjs-checked': value
54206
54241
  }),
54207
54242
  children: [e(Label$3, {
54208
- id: domId,
54243
+ htmlFor: domId,
54209
54244
  label: label,
54210
54245
  required: required,
54211
54246
  children: e("input", {
@@ -54218,13 +54253,16 @@
54218
54253
  onChange: onChange,
54219
54254
  onBlur: () => onBlur && onBlur(),
54220
54255
  onFocus: () => onFocus && onFocus(),
54221
- "aria-describedby": errorMessageId
54256
+ required: required,
54257
+ "aria-invalid": errors.length > 0,
54258
+ "aria-describedby": [descriptionId, errorMessageId].join(' ')
54222
54259
  })
54223
54260
  }), e(Description$2, {
54261
+ id: descriptionId,
54224
54262
  description: description
54225
54263
  }), e(Errors, {
54226
- errors: errors,
54227
- id: errorMessageId
54264
+ id: errorMessageId,
54265
+ errors: errors
54228
54266
  })]
54229
54267
  });
54230
54268
  }
@@ -54246,7 +54284,6 @@
54246
54284
  const {
54247
54285
  disabled,
54248
54286
  errors = [],
54249
- errorMessageId,
54250
54287
  domId,
54251
54288
  onBlur,
54252
54289
  onFocus,
@@ -54293,6 +54330,8 @@
54293
54330
  values,
54294
54331
  onChange: props.onChange
54295
54332
  });
54333
+ const descriptionId = `${domId}-description`;
54334
+ const errorMessageId = `${domId}-error-message`;
54296
54335
  return e("div", {
54297
54336
  class: classNames(formFieldClasses(type$e, {
54298
54337
  errors,
@@ -54307,7 +54346,7 @@
54307
54346
  const itemDomId = `${domId}-${index}`;
54308
54347
  const isChecked = hasEqualValue(o.value, values);
54309
54348
  return e(Label$3, {
54310
- id: itemDomId,
54349
+ htmlFor: itemDomId,
54311
54350
  label: o.label,
54312
54351
  class: classNames({
54313
54352
  'fjs-checked': isChecked
@@ -54323,14 +54362,17 @@
54323
54362
  onClick: () => toggleCheckbox(o.value),
54324
54363
  onBlur: onCheckboxBlur,
54325
54364
  onFocus: onCheckboxFocus,
54326
- "aria-describedby": errorMessageId
54365
+ required: required,
54366
+ "aria-invalid": errors.length > 0,
54367
+ "aria-describedby": [descriptionId, errorMessageId].join(' ')
54327
54368
  })
54328
54369
  });
54329
54370
  }), e(Description$2, {
54371
+ id: descriptionId,
54330
54372
  description: description
54331
54373
  }), e(Errors, {
54332
- errors: errors,
54333
- id: errorMessageId
54374
+ id: errorMessageId,
54375
+ errors: errors
54334
54376
  })]
54335
54377
  });
54336
54378
  }
@@ -54409,6 +54451,7 @@
54409
54451
  }
54410
54452
  }, [viewerCommands, field, initialValue, initialValidationTrigger, indexes]);
54411
54453
  const onBlur = A$1(() => {
54454
+ const value = get$1(data, valuePath);
54412
54455
  if (initialValidationTrigger) {
54413
54456
  setInitialValidationTrigger(false);
54414
54457
  viewerCommands.updateFieldValidation(field, value, indexes);
@@ -54416,7 +54459,7 @@
54416
54459
  eventBus.fire('formField.blur', {
54417
54460
  formField: field
54418
54461
  });
54419
- }, [eventBus, field, indexes, value, viewerCommands, initialValidationTrigger]);
54462
+ }, [eventBus, field, indexes, viewerCommands, initialValidationTrigger, data, valuePath]);
54420
54463
  const onFocus = A$1(() => {
54421
54464
  eventBus.fire('formField.focus', {
54422
54465
  formField: field
@@ -54440,7 +54483,6 @@
54440
54483
  }
54441
54484
  const domId = `${prefixId$2(field.id, formId, indexes)}`;
54442
54485
  const fieldErrors = get$1(errors, [field.id, ...Object.values(indexes || {})]) || [];
54443
- const errorMessageId = errors.length === 0 ? undefined : `${domId}-error-message`;
54444
54486
  return e(Column, {
54445
54487
  field: field,
54446
54488
  class: gridColumnClasses(field),
@@ -54451,7 +54493,6 @@
54451
54493
  ...props,
54452
54494
  disabled: disabled,
54453
54495
  errors: fieldErrors,
54454
- errorMessageId: errorMessageId,
54455
54496
  domId: domId,
54456
54497
  onChange: disabled || readonly ? noop$1$1 : onChangeIndexed,
54457
54498
  onBlur: disabled || readonly ? noop$1$1 : onBlur,
@@ -54771,7 +54812,7 @@
54771
54812
  const [forceFocusCalendar, setForceFocusCalendar] = l$1(false);
54772
54813
 
54773
54814
  // ensures we render based on date value instead of reference
54774
- const date = useDeepCompareState(dateObject, null);
54815
+ const date = useDeepCompareMemoize(dateObject);
54775
54816
 
54776
54817
  // shorts the date value back to the source
54777
54818
  y(() => {
@@ -54862,7 +54903,7 @@
54862
54903
  return e("div", {
54863
54904
  class: "fjs-datetime-subsection",
54864
54905
  children: [e(Label$3, {
54865
- id: domId,
54906
+ htmlFor: domId,
54866
54907
  label: label,
54867
54908
  collapseOnEmpty: collapseLabelOnEmpty,
54868
54909
  required: required
@@ -55144,7 +55185,7 @@
55144
55185
  return e("div", {
55145
55186
  class: "fjs-datetime-subsection",
55146
55187
  children: [e(Label$3, {
55147
- id: domId,
55188
+ htmlFor: domId,
55148
55189
  label: label,
55149
55190
  collapseOnEmpty: collapseLabelOnEmpty,
55150
55191
  required: required
@@ -55331,6 +55372,7 @@
55331
55372
  });
55332
55373
  }, []);
55333
55374
  const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
55375
+ const descriptionId = `${prefixId$2(id, formId)}-description`;
55334
55376
  const datePickerProps = {
55335
55377
  label: dateLabel,
55336
55378
  collapseLabelOnEmpty: !timeLabel,
@@ -55343,7 +55385,7 @@
55343
55385
  date: dateTime.date,
55344
55386
  readonly,
55345
55387
  setDate,
55346
- 'aria-describedby': errorMessageId
55388
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
55347
55389
  };
55348
55390
  const timePickerProps = {
55349
55391
  label: timeLabel,
@@ -55358,7 +55400,7 @@
55358
55400
  timeInterval,
55359
55401
  time: dateTime.time,
55360
55402
  setTime,
55361
- 'aria-describedby': errorMessageId
55403
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
55362
55404
  };
55363
55405
  return e("div", {
55364
55406
  class: formFieldClasses(type$d, {
@@ -55377,6 +55419,7 @@
55377
55419
  ...timePickerProps
55378
55420
  })]
55379
55421
  }), e(Description$2, {
55422
+ id: descriptionId,
55380
55423
  description: description
55381
55424
  }), e(Errors, {
55382
55425
  errors: allErrors,
@@ -55478,7 +55521,7 @@
55478
55521
  readonly
55479
55522
  }),
55480
55523
  children: [e(Label$3, {
55481
- id: domId,
55524
+ htmlFor: domId,
55482
55525
  label: evaluatedLabel
55483
55526
  }), !evaluatedUrl && e(IFramePlaceholder, {
55484
55527
  text: "No content to show."
@@ -56283,7 +56326,6 @@
56283
56326
  const {
56284
56327
  disabled,
56285
56328
  errors = [],
56286
- errorMessageId,
56287
56329
  domId,
56288
56330
  onBlur,
56289
56331
  onFocus,
@@ -56421,6 +56463,8 @@
56421
56463
  e.preventDefault();
56422
56464
  }
56423
56465
  };
56466
+ const descriptionId = `${domId}-description`;
56467
+ const errorMessageId = `${domId}-error-message`;
56424
56468
  return e("div", {
56425
56469
  class: formFieldClasses(type$a, {
56426
56470
  errors,
@@ -56428,7 +56472,7 @@
56428
56472
  readonly
56429
56473
  }),
56430
56474
  children: [e(Label$3, {
56431
- id: domId,
56475
+ htmlFor: domId,
56432
56476
  label: label,
56433
56477
  required: required
56434
56478
  }), e(TemplatedInputAdorner, {
@@ -56463,15 +56507,17 @@
56463
56507
  autoComplete: "off",
56464
56508
  step: incrementAmount,
56465
56509
  value: displayValue,
56466
- "aria-describedby": errorMessageId
56510
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
56511
+ required: required,
56512
+ "aria-invalid": errors.length > 0
56467
56513
  }), e("div", {
56468
56514
  class: classNames('fjs-number-arrow-container', {
56469
56515
  'fjs-disabled': disabled,
56470
56516
  'fjs-readonly': readonly
56471
56517
  }),
56472
56518
  children: [e("button", {
56473
- class: "fjs-number-arrow-up",
56474
56519
  type: "button",
56520
+ class: "fjs-number-arrow-up",
56475
56521
  "aria-label": "Increment",
56476
56522
  onClick: () => increment(),
56477
56523
  tabIndex: -1,
@@ -56479,8 +56525,8 @@
56479
56525
  }), e("div", {
56480
56526
  class: "fjs-number-arrow-separator"
56481
56527
  }), e("button", {
56482
- class: "fjs-number-arrow-down",
56483
56528
  type: "button",
56529
+ class: "fjs-number-arrow-down",
56484
56530
  "aria-label": "Decrement",
56485
56531
  onClick: () => decrement(),
56486
56532
  tabIndex: -1,
@@ -56489,10 +56535,11 @@
56489
56535
  })]
56490
56536
  })
56491
56537
  }), e(Description$2, {
56538
+ id: descriptionId,
56492
56539
  description: description
56493
56540
  }), e(Errors, {
56494
- errors: errors,
56495
- id: errorMessageId
56541
+ id: errorMessageId,
56542
+ errors: errors
56496
56543
  })]
56497
56544
  });
56498
56545
  }
@@ -56521,7 +56568,6 @@
56521
56568
  const {
56522
56569
  disabled,
56523
56570
  errors = [],
56524
- errorMessageId,
56525
56571
  domId,
56526
56572
  onBlur,
56527
56573
  onFocus,
@@ -56567,6 +56613,8 @@
56567
56613
  value,
56568
56614
  onChange: props.onChange
56569
56615
  });
56616
+ const descriptionId = `${domId}-description`;
56617
+ const errorMessageId = `${domId}-error-message`;
56570
56618
  return e("div", {
56571
56619
  class: formFieldClasses(type$9, {
56572
56620
  errors,
@@ -56581,7 +56629,7 @@
56581
56629
  const itemDomId = `${domId}-${index}`;
56582
56630
  const isChecked = isEqual$1(option.value, value);
56583
56631
  return e(Label$3, {
56584
- id: itemDomId,
56632
+ htmlFor: itemDomId,
56585
56633
  label: option.label,
56586
56634
  class: classNames({
56587
56635
  'fjs-checked': isChecked
@@ -56597,14 +56645,17 @@
56597
56645
  onClick: () => onChange(option.value),
56598
56646
  onBlur: onRadioBlur,
56599
56647
  onFocus: onRadioFocus,
56600
- "aria-describedby": errorMessageId
56648
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
56649
+ required: required,
56650
+ "aria-invalid": errors.length > 0
56601
56651
  })
56602
56652
  }, index);
56603
56653
  }), e(Description$2, {
56654
+ id: descriptionId,
56604
56655
  description: description
56605
56656
  }), e(Errors, {
56606
- errors: errors,
56607
- id: errorMessageId
56657
+ id: errorMessageId,
56658
+ errors: errors
56608
56659
  })]
56609
56660
  });
56610
56661
  }
@@ -56680,7 +56731,7 @@
56680
56731
 
56681
56732
  // whenever we change the underlying value, set the label to it
56682
56733
  y(() => {
56683
- setFilter(label);
56734
+ setFilter(label || '');
56684
56735
  }, [label]);
56685
56736
  const filteredOptions = d(() => {
56686
56737
  if (loadState !== LOAD_STATES.LOADED) {
@@ -56760,7 +56811,7 @@
56760
56811
  }, [onFocus]);
56761
56812
  const onInputBlur = A$1(() => {
56762
56813
  setIsDropdownExpanded(false);
56763
- setFilter(label);
56814
+ setFilter(label || '');
56764
56815
  onBlur && onBlur();
56765
56816
  }, [onBlur, label]);
56766
56817
  return e(d$1, {
@@ -56855,6 +56906,9 @@
56855
56906
  }, [disabled, isDropdownExpanded, loadState, readonly, value]);
56856
56907
  const onMouseDown = A$1(e => {
56857
56908
  const input = inputRef.current;
56909
+ if (disabled || !input) {
56910
+ return;
56911
+ }
56858
56912
  setIsDropdownExpanded(!isDropdownExpanded);
56859
56913
  if (isDropdownExpanded) {
56860
56914
  input.blur();
@@ -56862,7 +56916,7 @@
56862
56916
  input.focus();
56863
56917
  }
56864
56918
  e.preventDefault();
56865
- }, [isDropdownExpanded]);
56919
+ }, [disabled, isDropdownExpanded]);
56866
56920
  const initialFocusIndex = d(() => value && findIndex$1(options, o => o.value === value) || 0, [options, value]);
56867
56921
  const onInputFocus = A$1(() => {
56868
56922
  if (!readonly) {
@@ -56933,7 +56987,6 @@
56933
56987
  const {
56934
56988
  disabled,
56935
56989
  errors = [],
56936
- errorMessageId,
56937
56990
  domId,
56938
56991
  onBlur,
56939
56992
  onFocus,
@@ -56951,6 +57004,8 @@
56951
57004
  const {
56952
57005
  required
56953
57006
  } = validate;
57007
+ const descriptionId = `${domId}-description`;
57008
+ const errorMessageId = `${domId}-error-message`;
56954
57009
  const selectProps = {
56955
57010
  domId,
56956
57011
  disabled,
@@ -56961,7 +57016,9 @@
56961
57016
  value,
56962
57017
  onChange,
56963
57018
  readonly,
56964
- 'aria-describedby': errorMessageId
57019
+ required,
57020
+ 'aria-invalid': errors.length > 0,
57021
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
56965
57022
  };
56966
57023
  return e("div", {
56967
57024
  class: formFieldClasses(type$8, {
@@ -56976,7 +57033,7 @@
56976
57033
  }
56977
57034
  },
56978
57035
  children: [e(Label$3, {
56979
- id: domId,
57036
+ htmlFor: domId,
56980
57037
  label: label,
56981
57038
  required: required
56982
57039
  }), searchable ? e(SearchableSelect, {
@@ -56984,10 +57041,11 @@
56984
57041
  }) : e(SimpleSelect, {
56985
57042
  ...selectProps
56986
57043
  }), e(Description$2, {
57044
+ id: descriptionId,
56987
57045
  description: description
56988
57046
  }), e(Errors, {
56989
- errors: errors,
56990
- id: errorMessageId
57047
+ id: errorMessageId,
57048
+ errors: errors
56991
57049
  })]
56992
57050
  });
56993
57051
  }
@@ -57115,7 +57173,6 @@
57115
57173
  const {
57116
57174
  disabled,
57117
57175
  errors = [],
57118
- errorMessageId,
57119
57176
  onFocus,
57120
57177
  domId,
57121
57178
  onBlur,
@@ -57143,7 +57200,7 @@
57143
57200
  } = useOptionsAsync(field);
57144
57201
 
57145
57202
  // ensures we render based on array content instead of reference
57146
- const values = useDeepCompareState(value || [], []);
57203
+ const values = useDeepCompareMemoize(value || []);
57147
57204
  useCleanupMultiSelectValue({
57148
57205
  field,
57149
57206
  loadState,
@@ -57251,6 +57308,8 @@
57251
57308
  inputRef.current.focus();
57252
57309
  };
57253
57310
  const shouldDisplayDropdown = d(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
57311
+ const descriptionId = `${domId}-description`;
57312
+ const errorMessageId = `${domId}-error-message`;
57254
57313
  return e("div", {
57255
57314
  ref: focusScopeRef,
57256
57315
  class: formFieldClasses(type$5, {
@@ -57267,7 +57326,7 @@
57267
57326
  children: [e(Label$3, {
57268
57327
  label: label,
57269
57328
  required: required,
57270
- id: domId
57329
+ htmlFor: domId
57271
57330
  }), !disabled && !readonly && !!values.length && e(SkipLink, {
57272
57331
  className: "fjs-taglist-skip-link",
57273
57332
  label: "Skip to search",
@@ -57315,7 +57374,9 @@
57315
57374
  onMouseDown: () => setIsEscapeClose(false),
57316
57375
  onFocus: onInputFocus,
57317
57376
  onBlur: onInputBlur,
57318
- "aria-describedby": errorMessageId
57377
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57378
+ required: required,
57379
+ "aria-invalid": errors.length > 0
57319
57380
  })]
57320
57381
  }), e("div", {
57321
57382
  class: "fjs-taglist-anchor",
@@ -57327,10 +57388,11 @@
57327
57388
  listenerElement: inputRef.current
57328
57389
  })
57329
57390
  }), e(Description$2, {
57391
+ id: descriptionId,
57330
57392
  description: description
57331
57393
  }), e(Errors, {
57332
- errors: errors,
57333
- id: errorMessageId
57394
+ id: errorMessageId,
57395
+ errors: errors
57334
57396
  })]
57335
57397
  });
57336
57398
  }
@@ -57643,7 +57705,6 @@
57643
57705
  const {
57644
57706
  disabled,
57645
57707
  errors = [],
57646
- errorMessageId,
57647
57708
  domId,
57648
57709
  onBlur,
57649
57710
  onFocus,
@@ -57679,6 +57740,8 @@
57679
57740
  const onInputFocus = () => {
57680
57741
  onFocus && onFocus();
57681
57742
  };
57743
+ const descriptionId = `${domId}-description`;
57744
+ const errorMessageId = `${domId}-error-message`;
57682
57745
  return e("div", {
57683
57746
  class: formFieldClasses(type$2, {
57684
57747
  errors,
@@ -57686,7 +57749,7 @@
57686
57749
  readonly
57687
57750
  }),
57688
57751
  children: [e(Label$3, {
57689
- id: domId,
57752
+ htmlFor: domId,
57690
57753
  label: label,
57691
57754
  required: required
57692
57755
  }), e(TemplatedInputAdorner, {
@@ -57704,13 +57767,16 @@
57704
57767
  onFocus: onInputFocus,
57705
57768
  type: "text",
57706
57769
  value: value,
57707
- "aria-describedby": errorMessageId
57770
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57771
+ required: required,
57772
+ "aria-invalid": errors.length > 0
57708
57773
  })
57709
57774
  }), e(Description$2, {
57775
+ id: descriptionId,
57710
57776
  description: description
57711
57777
  }), e(Errors, {
57712
- errors: errors,
57713
- id: errorMessageId
57778
+ id: errorMessageId,
57779
+ errors: errors
57714
57780
  })]
57715
57781
  });
57716
57782
  }
@@ -57742,7 +57808,6 @@
57742
57808
  const {
57743
57809
  disabled,
57744
57810
  errors = [],
57745
- errorMessageId,
57746
57811
  domId,
57747
57812
  onBlur,
57748
57813
  onFocus,
@@ -57786,6 +57851,8 @@
57786
57851
  y(() => {
57787
57852
  autoSizeTextarea(textareaRef.current);
57788
57853
  }, []);
57854
+ const descriptionId = `${domId}-description`;
57855
+ const errorMessageId = `${domId}-error-message`;
57789
57856
  return e("div", {
57790
57857
  class: formFieldClasses(type$1, {
57791
57858
  errors,
@@ -57793,7 +57860,7 @@
57793
57860
  readonly
57794
57861
  }),
57795
57862
  children: [e(Label$3, {
57796
- id: domId,
57863
+ htmlFor: domId,
57797
57864
  label: label,
57798
57865
  required: required
57799
57866
  }), e("textarea", {
@@ -57806,12 +57873,15 @@
57806
57873
  onFocus: onInputFocus,
57807
57874
  value: value,
57808
57875
  ref: textareaRef,
57809
- "aria-describedby": errorMessageId
57876
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57877
+ required: required,
57878
+ "aria-invalid": errors.length > 0
57810
57879
  }), e(Description$2, {
57880
+ id: descriptionId,
57811
57881
  description: description
57812
57882
  }), e(Errors, {
57813
- errors: errors,
57814
- id: errorMessageId
57883
+ id: errorMessageId,
57884
+ errors: errors
57815
57885
  })]
57816
57886
  });
57817
57887
  }
@@ -58027,7 +58097,7 @@
58027
58097
  return e("div", {
58028
58098
  class: formFieldClasses(type),
58029
58099
  children: [e(Label$3, {
58030
- id: prefixId$2(id),
58100
+ htmlFor: prefixId$2(id),
58031
58101
  label: label
58032
58102
  }), e("div", {
58033
58103
  class: classNames('fjs-table-middle-container', {
@@ -58423,7 +58493,7 @@
58423
58493
  }
58424
58494
  }
58425
58495
  const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url', 'dataSource', 'columnsExpression'];
58426
- const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
58496
+ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'content', 'url'];
58427
58497
 
58428
58498
  /**
58429
58499
  * @typedef { import('../types').Schema } Schema
@@ -59452,47 +59522,17 @@
59452
59522
  };
59453
59523
  const parentExpressionContextInfo = F$1(LocalExpressionContext);
59454
59524
  return e(d$1, {
59455
- children: displayValues.map((value, index) => {
59456
- const elementProps = d(() => ({
59457
- ...restProps,
59458
- indexes: {
59459
- ...(indexes || {}),
59460
- [repeaterField.id]: index
59461
- }
59462
- }), [index]);
59463
- const localExpressionContextInfo = d(() => ({
59464
- data: parentExpressionContextInfo.data,
59465
- this: value,
59466
- parent: buildExpressionContext(parentExpressionContextInfo),
59467
- i: [...parentExpressionContextInfo.i, index + 1]
59468
- }), [index, value]);
59469
- return !showRemove ? e(LocalExpressionContext.Provider, {
59470
- value: localExpressionContextInfo,
59471
- children: e(RowsRenderer, {
59472
- ...elementProps
59473
- })
59474
- }) : e("div", {
59475
- class: "fjs-repeat-row-container",
59476
- children: [e("div", {
59477
- class: "fjs-repeat-row-rows",
59478
- children: e(LocalExpressionContext.Provider, {
59479
- value: localExpressionContextInfo,
59480
- children: e(RowsRenderer, {
59481
- ...elementProps
59482
- })
59483
- })
59484
- }), e("button", {
59485
- class: "fjs-repeat-row-remove",
59486
- type: "button",
59487
- "aria-label": `Remove list item ${index + 1}`,
59488
- onClick: () => onDeleteItem(index),
59489
- children: e("div", {
59490
- class: "fjs-repeat-row-remove-icon-container",
59491
- children: e(DeleteSvg, {})
59492
- })
59493
- })]
59494
- });
59495
- })
59525
+ children: displayValues.map((value, index) => e(RepetitionScaffold, {
59526
+ index: index,
59527
+ value: value,
59528
+ parentExpressionContextInfo: parentExpressionContextInfo,
59529
+ repeaterField: repeaterField,
59530
+ RowsRenderer: RowsRenderer,
59531
+ indexes: indexes,
59532
+ onDeleteItem: onDeleteItem,
59533
+ showRemove: showRemove,
59534
+ ...restProps
59535
+ }, index))
59496
59536
  });
59497
59537
  }
59498
59538
  RepeatFooter(props) {
@@ -59555,18 +59595,18 @@
59555
59595
  'fjs-remove-allowed': repeaterField.allowAddRemove
59556
59596
  }),
59557
59597
  children: [showAdd ? e("button", {
59598
+ type: "button",
59558
59599
  readOnly: readonly,
59559
59600
  disabled: disabled || readonly,
59560
59601
  class: "fjs-repeat-render-add",
59561
- type: "button",
59562
59602
  ref: addButtonRef,
59563
59603
  onClick: onAddItem,
59564
59604
  children: e(d$1, {
59565
59605
  children: [e(AddSvg, {}), " ", 'Add new']
59566
59606
  })
59567
59607
  }) : null, collapseEnabled ? e("button", {
59568
- class: "fjs-repeat-render-collapse",
59569
59608
  type: "button",
59609
+ class: "fjs-repeat-render-collapse",
59570
59610
  onClick: toggle,
59571
59611
  children: isCollapsed ? e(d$1, {
59572
59612
  children: [e(ExpandSvg, {}), " ", `Expand all (${values.length})`]
@@ -59584,6 +59624,73 @@
59584
59624
  return nonCollapsedItems ? nonCollapsedItems : DEFAULT_NON_COLLAPSED_ITEMS;
59585
59625
  }
59586
59626
  }
59627
+
59628
+ /**
59629
+ * Individual repetition of a repeated field and context scaffolding.
59630
+ *
59631
+ * @param {Object} props
59632
+ * @param {number} props.index
59633
+ * @param {Object} props.value
59634
+ * @param {Object} props.parentExpressionContextInfo
59635
+ * @param {Object} props.repeaterField
59636
+ * @param {Function} props.RowsRenderer
59637
+ * @param {Object} props.indexes
59638
+ * @param {Function} props.onDeleteItem
59639
+ * @param {boolean} props.showRemove
59640
+ */
59641
+
59642
+ const RepetitionScaffold = props => {
59643
+ const {
59644
+ index,
59645
+ value,
59646
+ parentExpressionContextInfo,
59647
+ repeaterField,
59648
+ RowsRenderer,
59649
+ indexes,
59650
+ onDeleteItem,
59651
+ showRemove,
59652
+ ...restProps
59653
+ } = props;
59654
+ const elementProps = d(() => ({
59655
+ ...restProps,
59656
+ indexes: {
59657
+ ...(indexes || {}),
59658
+ [repeaterField.id]: index
59659
+ }
59660
+ }), [index, indexes, repeaterField.id, restProps]);
59661
+ const localExpressionContextInfo = d(() => ({
59662
+ data: parentExpressionContextInfo.data,
59663
+ this: value,
59664
+ parent: buildExpressionContext(parentExpressionContextInfo),
59665
+ i: [...parentExpressionContextInfo.i, index + 1]
59666
+ }), [index, parentExpressionContextInfo, value]);
59667
+ return !showRemove ? e(LocalExpressionContext.Provider, {
59668
+ value: localExpressionContextInfo,
59669
+ children: e(RowsRenderer, {
59670
+ ...elementProps
59671
+ })
59672
+ }) : e("div", {
59673
+ class: "fjs-repeat-row-container",
59674
+ children: [e("div", {
59675
+ class: "fjs-repeat-row-rows",
59676
+ children: e(LocalExpressionContext.Provider, {
59677
+ value: localExpressionContextInfo,
59678
+ children: e(RowsRenderer, {
59679
+ ...elementProps
59680
+ })
59681
+ })
59682
+ }), e("button", {
59683
+ type: "button",
59684
+ class: "fjs-repeat-row-remove",
59685
+ "aria-label": `Remove list item ${index + 1}`,
59686
+ onClick: () => onDeleteItem(index),
59687
+ children: e("div", {
59688
+ class: "fjs-repeat-row-remove-icon-container",
59689
+ children: e(DeleteSvg, {})
59690
+ })
59691
+ })]
59692
+ });
59693
+ };
59587
59694
  RepeatRenderManager.$inject = ['form', 'formFields', 'formFieldRegistry', 'pathRegistry'];
59588
59695
  const RepeatRenderModule$1 = {
59589
59696
  __init__: ['repeatRenderManager'],
@@ -67651,6 +67758,7 @@
67651
67758
  }
67652
67759
  };
67653
67760
  return e("button", {
67761
+ type: "button",
67654
67762
  class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
67655
67763
  "data-field-type": type,
67656
67764
  title: `Create ${getIndefiniteArticle(type)} ${label} element`,
@@ -67742,6 +67850,7 @@
67742
67850
  value: searchTerm,
67743
67851
  onInput: handleInput
67744
67852
  }), searchTerm && e("button", {
67853
+ type: "button",
67745
67854
  title: "Clear content",
67746
67855
  class: "fjs-palette-search-clear",
67747
67856
  onClick: handleClear,
@@ -68486,6 +68595,7 @@
68486
68595
  field: field
68487
68596
  }), e(ContextPad, {
68488
68597
  children: selection.isSelected(field) && field.type !== 'default' ? e("button", {
68598
+ type: "button",
68489
68599
  title: getRemoveButtonTitle(field, formFields),
68490
68600
  class: "fjs-context-pad-item",
68491
68601
  onClick: onRemove,
@@ -75910,7 +76020,7 @@
75910
76020
  getValue,
75911
76021
  id,
75912
76022
  label: 'Disabled',
75913
- tooltip: 'Field cannot be edited by the end-user, and the data is not submitted.',
76023
+ tooltip: 'Field cannot be edited by the end-user, and the data is not submitted. Takes precedence over read only.',
75914
76024
  inline: true,
75915
76025
  setValue
75916
76026
  });
@@ -76540,11 +76650,10 @@
76540
76650
  description,
76541
76651
  editField,
76542
76652
  field,
76543
- id,
76544
- defaultValue = 60 // default value for spacer
76653
+ id
76545
76654
  } = props;
76546
76655
  const debounce = useService('debounce');
76547
- const getValue = e => get(field, ['height'], defaultValue);
76656
+ const getValue = e => get(field, ['height'], null);
76548
76657
  const setValue = (value, error) => {
76549
76658
  if (error) {
76550
76659
  return;
@@ -76571,7 +76680,7 @@
76571
76680
  */
76572
76681
  const validate$7 = value => {
76573
76682
  if (typeof value !== 'number') {
76574
- return null;
76683
+ return 'A number is required.';
76575
76684
  }
76576
76685
  if (!Number.isInteger(value)) {
76577
76686
  return 'Should be an integer.';
@@ -76583,7 +76692,6 @@
76583
76692
  function IFrameHeightEntry(props) {
76584
76693
  return [...HeightEntry({
76585
76694
  ...props,
76586
- defaultValue: 300,
76587
76695
  description: 'Height of the container in pixels.',
76588
76696
  isDefaultVisible: field => field.type === 'iframe'
76589
76697
  })];
@@ -76816,7 +76924,7 @@
76816
76924
 
76817
76925
  const description = e(d$1, {
76818
76926
  children: ["Supports HTML, styling, and templating. Styles are automatically scoped to the HTML component. ", e("a", {
76819
- href: "https://docs.camunda.io/docs/components/modeler/forms/form-element-library/forms-element-library-html/",
76927
+ href: "https://docs.camunda.io/docs/next/components/modeler/forms/form-element-library/forms-element-library-html/",
76820
76928
  target: "_blank",
76821
76929
  children: "Learn more"
76822
76930
  })]
@@ -77759,15 +77867,20 @@
77759
77867
  editField,
77760
77868
  field
77761
77869
  } = props;
77870
+ const {
77871
+ disabled
77872
+ } = field;
77762
77873
  const entries = [];
77763
- entries.push({
77764
- id: 'readonly',
77765
- component: Readonly,
77766
- editField: editField,
77767
- field: field,
77768
- isEdited: isEdited$6,
77769
- isDefaultVisible: field => INPUTS.includes(field.type)
77770
- });
77874
+ if (!disabled) {
77875
+ entries.push({
77876
+ id: 'readonly',
77877
+ component: Readonly,
77878
+ editField: editField,
77879
+ field: field,
77880
+ isEdited: isEdited$6,
77881
+ isDefaultVisible: field => INPUTS.includes(field.type)
77882
+ });
77883
+ }
77771
77884
  return entries;
77772
77885
  }
77773
77886
  function Readonly(props) {
@@ -79631,6 +79744,7 @@
79631
79744
  }), e("div", {
79632
79745
  class: "fjs-pgl-modal-footer",
79633
79746
  children: e("button", {
79747
+ type: "button",
79634
79748
  class: "fjs-pgl-button fjs-pgl-button-default",
79635
79749
  onClick: props.onClose,
79636
79750
  children: "Close"
@@ -81609,6 +81723,7 @@
81609
81723
  name: "Form Definition",
81610
81724
  children: [displayActions && e(Section.HeaderItem, {
81611
81725
  children: e("button", {
81726
+ type: "button",
81612
81727
  class: "fjs-pgl-button",
81613
81728
  title: "Download form definition",
81614
81729
  onClick: handleDownload,
@@ -81616,6 +81731,7 @@
81616
81731
  })
81617
81732
  }), displayActions && e(Section.HeaderItem, {
81618
81733
  children: e("button", {
81734
+ type: "button",
81619
81735
  class: "fjs-pgl-button",
81620
81736
  onClick: showEmbedModal,
81621
81737
  children: "Embed"