@bpmn-io/form-js-playground 1.7.0-alpha.0 → 1.7.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.
@@ -54112,7 +54112,8 @@
54112
54112
  }
54113
54113
  function Description$2(props) {
54114
54114
  const {
54115
- description
54115
+ description,
54116
+ id
54116
54117
  } = props;
54117
54118
  const evaluatedDescription = useSingleLineTemplateEvaluation(description || '', {
54118
54119
  debug: true
@@ -54121,6 +54122,7 @@
54121
54122
  return null;
54122
54123
  }
54123
54124
  return e("div", {
54125
+ id: id,
54124
54126
  class: "fjs-form-field-description",
54125
54127
  children: evaluatedDescription
54126
54128
  });
@@ -54149,6 +54151,7 @@
54149
54151
  function Label$3(props) {
54150
54152
  const {
54151
54153
  id,
54154
+ htmlFor,
54152
54155
  label,
54153
54156
  collapseOnEmpty = true,
54154
54157
  required = false
@@ -54157,12 +54160,14 @@
54157
54160
  debug: true
54158
54161
  });
54159
54162
  return e("label", {
54160
- for: id,
54163
+ id: id,
54164
+ for: htmlFor,
54161
54165
  class: classNames('fjs-form-field-label', {
54162
54166
  'fjs-incollapsible-label': !collapseOnEmpty
54163
54167
  }, props['class']),
54164
54168
  children: [props.children, evaluatedLabel, required && e("span", {
54165
54169
  class: "fjs-asterix",
54170
+ "aria-hidden": true,
54166
54171
  children: "*"
54167
54172
  })]
54168
54173
  });
@@ -54172,7 +54177,6 @@
54172
54177
  const {
54173
54178
  disabled,
54174
54179
  errors = [],
54175
- errorMessageId,
54176
54180
  domId,
54177
54181
  onBlur,
54178
54182
  onFocus,
@@ -54196,6 +54200,8 @@
54196
54200
  value: target.checked
54197
54201
  });
54198
54202
  };
54203
+ const descriptionId = `${domId}-description`;
54204
+ const errorMessageId = `${domId}-error-message`;
54199
54205
  return e("div", {
54200
54206
  class: classNames(formFieldClasses(type$f, {
54201
54207
  errors,
@@ -54205,7 +54211,7 @@
54205
54211
  'fjs-checked': value
54206
54212
  }),
54207
54213
  children: [e(Label$3, {
54208
- id: domId,
54214
+ htmlFor: domId,
54209
54215
  label: label,
54210
54216
  required: required,
54211
54217
  children: e("input", {
@@ -54218,13 +54224,16 @@
54218
54224
  onChange: onChange,
54219
54225
  onBlur: () => onBlur && onBlur(),
54220
54226
  onFocus: () => onFocus && onFocus(),
54221
- "aria-describedby": errorMessageId
54227
+ required: required,
54228
+ "aria-invalid": errors.length > 0,
54229
+ "aria-describedby": [descriptionId, errorMessageId].join(' ')
54222
54230
  })
54223
54231
  }), e(Description$2, {
54232
+ id: descriptionId,
54224
54233
  description: description
54225
54234
  }), e(Errors, {
54226
- errors: errors,
54227
- id: errorMessageId
54235
+ id: errorMessageId,
54236
+ errors: errors
54228
54237
  })]
54229
54238
  });
54230
54239
  }
@@ -54246,7 +54255,6 @@
54246
54255
  const {
54247
54256
  disabled,
54248
54257
  errors = [],
54249
- errorMessageId,
54250
54258
  domId,
54251
54259
  onBlur,
54252
54260
  onFocus,
@@ -54293,6 +54301,8 @@
54293
54301
  values,
54294
54302
  onChange: props.onChange
54295
54303
  });
54304
+ const descriptionId = `${domId}-description`;
54305
+ const errorMessageId = `${domId}-error-message`;
54296
54306
  return e("div", {
54297
54307
  class: classNames(formFieldClasses(type$e, {
54298
54308
  errors,
@@ -54307,7 +54317,7 @@
54307
54317
  const itemDomId = `${domId}-${index}`;
54308
54318
  const isChecked = hasEqualValue(o.value, values);
54309
54319
  return e(Label$3, {
54310
- id: itemDomId,
54320
+ htmlFor: itemDomId,
54311
54321
  label: o.label,
54312
54322
  class: classNames({
54313
54323
  'fjs-checked': isChecked
@@ -54323,14 +54333,17 @@
54323
54333
  onClick: () => toggleCheckbox(o.value),
54324
54334
  onBlur: onCheckboxBlur,
54325
54335
  onFocus: onCheckboxFocus,
54326
- "aria-describedby": errorMessageId
54336
+ required: required,
54337
+ "aria-invalid": errors.length > 0,
54338
+ "aria-describedby": [descriptionId, errorMessageId].join(' ')
54327
54339
  })
54328
54340
  });
54329
54341
  }), e(Description$2, {
54342
+ id: descriptionId,
54330
54343
  description: description
54331
54344
  }), e(Errors, {
54332
- errors: errors,
54333
- id: errorMessageId
54345
+ id: errorMessageId,
54346
+ errors: errors
54334
54347
  })]
54335
54348
  });
54336
54349
  }
@@ -54369,6 +54382,10 @@
54369
54382
  const {
54370
54383
  formId
54371
54384
  } = F$1(FormContext);
54385
+
54386
+ // track whether we should trigger initial validation on certain actions, e.g. field blur
54387
+ // disabled straight away, if viewerCommands are not available
54388
+ const [initialValidationTrigger, setInitialValidationTrigger] = l$1(!!viewerCommands);
54372
54389
  const FormFieldComponent = formFields.get(field.type);
54373
54390
  if (!FormFieldComponent) {
54374
54391
  throw new Error(`cannot render field <${field.type}>`);
@@ -54382,26 +54399,48 @@
54382
54399
 
54383
54400
  // add precedence: global readonly > form field disabled
54384
54401
  const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
54402
+
54403
+ // ensures the initial validation behavior can be re-triggered upon form reset
54404
+ y(() => {
54405
+ if (!viewerCommands) {
54406
+ return;
54407
+ }
54408
+ const resetValidation = () => {
54409
+ setInitialValidationTrigger(true);
54410
+ };
54411
+ eventBus.on('import.done', resetValidation);
54412
+ eventBus.on('reset', resetValidation);
54413
+ return () => {
54414
+ eventBus.off('import.done', resetValidation);
54415
+ eventBus.off('reset', resetValidation);
54416
+ };
54417
+ }, [eventBus, viewerCommands]);
54418
+ y(() => {
54419
+ if (initialValidationTrigger && initialValue) {
54420
+ setInitialValidationTrigger(false);
54421
+ viewerCommands.updateFieldValidation(field, initialValue, indexes);
54422
+ }
54423
+ }, [viewerCommands, field, initialValue, initialValidationTrigger, indexes]);
54385
54424
  const onBlur = A$1(() => {
54386
- if (viewerCommands) {
54425
+ const value = get$1(data, valuePath);
54426
+ if (initialValidationTrigger) {
54427
+ setInitialValidationTrigger(false);
54387
54428
  viewerCommands.updateFieldValidation(field, value, indexes);
54388
54429
  }
54389
54430
  eventBus.fire('formField.blur', {
54390
54431
  formField: field
54391
54432
  });
54392
- }, [eventBus, viewerCommands, field, value, indexes]);
54433
+ }, [eventBus, field, indexes, viewerCommands, initialValidationTrigger, data, valuePath]);
54393
54434
  const onFocus = A$1(() => {
54394
54435
  eventBus.fire('formField.focus', {
54395
54436
  formField: field
54396
54437
  });
54397
54438
  }, [eventBus, field]);
54398
- y(() => {
54399
- if (viewerCommands && initialValue) {
54400
- viewerCommands.updateFieldValidation(field, initialValue, indexes);
54401
- }
54402
- }, [viewerCommands, field, initialValue, indexes]);
54403
54439
  const hidden = useCondition(field.conditional && field.conditional.hide || null);
54404
54440
  const onChangeIndexed = A$1(update => {
54441
+ // any data change will trigger validation
54442
+ setInitialValidationTrigger(false);
54443
+
54405
54444
  // add indexes of the keyed field to the update, if any
54406
54445
  onChange(FormFieldComponent.config.keyed ? {
54407
54446
  ...update,
@@ -54415,7 +54454,6 @@
54415
54454
  }
54416
54455
  const domId = `${prefixId$2(field.id, formId, indexes)}`;
54417
54456
  const fieldErrors = get$1(errors, [field.id, ...Object.values(indexes || {})]) || [];
54418
- const errorMessageId = errors.length === 0 ? undefined : `${domId}-error-message`;
54419
54457
  return e(Column, {
54420
54458
  field: field,
54421
54459
  class: gridColumnClasses(field),
@@ -54426,7 +54464,6 @@
54426
54464
  ...props,
54427
54465
  disabled: disabled,
54428
54466
  errors: fieldErrors,
54429
- errorMessageId: errorMessageId,
54430
54467
  domId: domId,
54431
54468
  onChange: disabled || readonly ? noop$1$1 : onChangeIndexed,
54432
54469
  onBlur: disabled || readonly ? noop$1$1 : onBlur,
@@ -54837,7 +54874,7 @@
54837
54874
  return e("div", {
54838
54875
  class: "fjs-datetime-subsection",
54839
54876
  children: [e(Label$3, {
54840
- id: domId,
54877
+ htmlFor: domId,
54841
54878
  label: label,
54842
54879
  collapseOnEmpty: collapseLabelOnEmpty,
54843
54880
  required: required
@@ -55119,7 +55156,7 @@
55119
55156
  return e("div", {
55120
55157
  class: "fjs-datetime-subsection",
55121
55158
  children: [e(Label$3, {
55122
- id: domId,
55159
+ htmlFor: domId,
55123
55160
  label: label,
55124
55161
  collapseOnEmpty: collapseLabelOnEmpty,
55125
55162
  required: required
@@ -55306,6 +55343,7 @@
55306
55343
  });
55307
55344
  }, []);
55308
55345
  const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
55346
+ const descriptionId = `${prefixId$2(id, formId)}-description`;
55309
55347
  const datePickerProps = {
55310
55348
  label: dateLabel,
55311
55349
  collapseLabelOnEmpty: !timeLabel,
@@ -55318,7 +55356,7 @@
55318
55356
  date: dateTime.date,
55319
55357
  readonly,
55320
55358
  setDate,
55321
- 'aria-describedby': errorMessageId
55359
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
55322
55360
  };
55323
55361
  const timePickerProps = {
55324
55362
  label: timeLabel,
@@ -55333,7 +55371,7 @@
55333
55371
  timeInterval,
55334
55372
  time: dateTime.time,
55335
55373
  setTime,
55336
- 'aria-describedby': errorMessageId
55374
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
55337
55375
  };
55338
55376
  return e("div", {
55339
55377
  class: formFieldClasses(type$d, {
@@ -55352,6 +55390,7 @@
55352
55390
  ...timePickerProps
55353
55391
  })]
55354
55392
  }), e(Description$2, {
55393
+ id: descriptionId,
55355
55394
  description: description
55356
55395
  }), e(Errors, {
55357
55396
  errors: allErrors,
@@ -55453,7 +55492,7 @@
55453
55492
  readonly
55454
55493
  }),
55455
55494
  children: [e(Label$3, {
55456
- id: domId,
55495
+ htmlFor: domId,
55457
55496
  label: evaluatedLabel
55458
55497
  }), !evaluatedUrl && e(IFramePlaceholder, {
55459
55498
  text: "No content to show."
@@ -56258,7 +56297,6 @@
56258
56297
  const {
56259
56298
  disabled,
56260
56299
  errors = [],
56261
- errorMessageId,
56262
56300
  domId,
56263
56301
  onBlur,
56264
56302
  onFocus,
@@ -56396,6 +56434,8 @@
56396
56434
  e.preventDefault();
56397
56435
  }
56398
56436
  };
56437
+ const descriptionId = `${domId}-description`;
56438
+ const errorMessageId = `${domId}-error-message`;
56399
56439
  return e("div", {
56400
56440
  class: formFieldClasses(type$a, {
56401
56441
  errors,
@@ -56403,7 +56443,7 @@
56403
56443
  readonly
56404
56444
  }),
56405
56445
  children: [e(Label$3, {
56406
- id: domId,
56446
+ htmlFor: domId,
56407
56447
  label: label,
56408
56448
  required: required
56409
56449
  }), e(TemplatedInputAdorner, {
@@ -56438,7 +56478,9 @@
56438
56478
  autoComplete: "off",
56439
56479
  step: incrementAmount,
56440
56480
  value: displayValue,
56441
- "aria-describedby": errorMessageId
56481
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
56482
+ required: required,
56483
+ "aria-invalid": errors.length > 0
56442
56484
  }), e("div", {
56443
56485
  class: classNames('fjs-number-arrow-container', {
56444
56486
  'fjs-disabled': disabled,
@@ -56464,10 +56506,11 @@
56464
56506
  })]
56465
56507
  })
56466
56508
  }), e(Description$2, {
56509
+ id: descriptionId,
56467
56510
  description: description
56468
56511
  }), e(Errors, {
56469
- errors: errors,
56470
- id: errorMessageId
56512
+ id: errorMessageId,
56513
+ errors: errors
56471
56514
  })]
56472
56515
  });
56473
56516
  }
@@ -56496,7 +56539,6 @@
56496
56539
  const {
56497
56540
  disabled,
56498
56541
  errors = [],
56499
- errorMessageId,
56500
56542
  domId,
56501
56543
  onBlur,
56502
56544
  onFocus,
@@ -56542,6 +56584,8 @@
56542
56584
  value,
56543
56585
  onChange: props.onChange
56544
56586
  });
56587
+ const descriptionId = `${domId}-description`;
56588
+ const errorMessageId = `${domId}-error-message`;
56545
56589
  return e("div", {
56546
56590
  class: formFieldClasses(type$9, {
56547
56591
  errors,
@@ -56556,7 +56600,7 @@
56556
56600
  const itemDomId = `${domId}-${index}`;
56557
56601
  const isChecked = isEqual$1(option.value, value);
56558
56602
  return e(Label$3, {
56559
- id: itemDomId,
56603
+ htmlFor: itemDomId,
56560
56604
  label: option.label,
56561
56605
  class: classNames({
56562
56606
  'fjs-checked': isChecked
@@ -56572,14 +56616,17 @@
56572
56616
  onClick: () => onChange(option.value),
56573
56617
  onBlur: onRadioBlur,
56574
56618
  onFocus: onRadioFocus,
56575
- "aria-describedby": errorMessageId
56619
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
56620
+ required: required,
56621
+ "aria-invalid": errors.length > 0
56576
56622
  })
56577
56623
  }, index);
56578
56624
  }), e(Description$2, {
56625
+ id: descriptionId,
56579
56626
  description: description
56580
56627
  }), e(Errors, {
56581
- errors: errors,
56582
- id: errorMessageId
56628
+ id: errorMessageId,
56629
+ errors: errors
56583
56630
  })]
56584
56631
  });
56585
56632
  }
@@ -56655,7 +56702,7 @@
56655
56702
 
56656
56703
  // whenever we change the underlying value, set the label to it
56657
56704
  y(() => {
56658
- setFilter(label);
56705
+ setFilter(label || '');
56659
56706
  }, [label]);
56660
56707
  const filteredOptions = d(() => {
56661
56708
  if (loadState !== LOAD_STATES.LOADED) {
@@ -56735,7 +56782,7 @@
56735
56782
  }, [onFocus]);
56736
56783
  const onInputBlur = A$1(() => {
56737
56784
  setIsDropdownExpanded(false);
56738
- setFilter(label);
56785
+ setFilter(label || '');
56739
56786
  onBlur && onBlur();
56740
56787
  }, [onBlur, label]);
56741
56788
  return e(d$1, {
@@ -56830,6 +56877,9 @@
56830
56877
  }, [disabled, isDropdownExpanded, loadState, readonly, value]);
56831
56878
  const onMouseDown = A$1(e => {
56832
56879
  const input = inputRef.current;
56880
+ if (disabled || !input) {
56881
+ return;
56882
+ }
56833
56883
  setIsDropdownExpanded(!isDropdownExpanded);
56834
56884
  if (isDropdownExpanded) {
56835
56885
  input.blur();
@@ -56837,7 +56887,7 @@
56837
56887
  input.focus();
56838
56888
  }
56839
56889
  e.preventDefault();
56840
- }, [isDropdownExpanded]);
56890
+ }, [disabled, isDropdownExpanded]);
56841
56891
  const initialFocusIndex = d(() => value && findIndex$1(options, o => o.value === value) || 0, [options, value]);
56842
56892
  const onInputFocus = A$1(() => {
56843
56893
  if (!readonly) {
@@ -56908,7 +56958,6 @@
56908
56958
  const {
56909
56959
  disabled,
56910
56960
  errors = [],
56911
- errorMessageId,
56912
56961
  domId,
56913
56962
  onBlur,
56914
56963
  onFocus,
@@ -56926,6 +56975,8 @@
56926
56975
  const {
56927
56976
  required
56928
56977
  } = validate;
56978
+ const descriptionId = `${domId}-description`;
56979
+ const errorMessageId = `${domId}-error-message`;
56929
56980
  const selectProps = {
56930
56981
  domId,
56931
56982
  disabled,
@@ -56936,7 +56987,9 @@
56936
56987
  value,
56937
56988
  onChange,
56938
56989
  readonly,
56939
- 'aria-describedby': errorMessageId
56990
+ required,
56991
+ 'aria-invalid': errors.length > 0,
56992
+ 'aria-describedby': [descriptionId, errorMessageId].join(' ')
56940
56993
  };
56941
56994
  return e("div", {
56942
56995
  class: formFieldClasses(type$8, {
@@ -56951,7 +57004,7 @@
56951
57004
  }
56952
57005
  },
56953
57006
  children: [e(Label$3, {
56954
- id: domId,
57007
+ htmlFor: domId,
56955
57008
  label: label,
56956
57009
  required: required
56957
57010
  }), searchable ? e(SearchableSelect, {
@@ -56959,10 +57012,11 @@
56959
57012
  }) : e(SimpleSelect, {
56960
57013
  ...selectProps
56961
57014
  }), e(Description$2, {
57015
+ id: descriptionId,
56962
57016
  description: description
56963
57017
  }), e(Errors, {
56964
- errors: errors,
56965
- id: errorMessageId
57018
+ id: errorMessageId,
57019
+ errors: errors
56966
57020
  })]
56967
57021
  });
56968
57022
  }
@@ -57090,7 +57144,6 @@
57090
57144
  const {
57091
57145
  disabled,
57092
57146
  errors = [],
57093
- errorMessageId,
57094
57147
  onFocus,
57095
57148
  domId,
57096
57149
  onBlur,
@@ -57226,6 +57279,8 @@
57226
57279
  inputRef.current.focus();
57227
57280
  };
57228
57281
  const shouldDisplayDropdown = d(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
57282
+ const descriptionId = `${domId}-description`;
57283
+ const errorMessageId = `${domId}-error-message`;
57229
57284
  return e("div", {
57230
57285
  ref: focusScopeRef,
57231
57286
  class: formFieldClasses(type$5, {
@@ -57242,7 +57297,7 @@
57242
57297
  children: [e(Label$3, {
57243
57298
  label: label,
57244
57299
  required: required,
57245
- id: domId
57300
+ htmlFor: domId
57246
57301
  }), !disabled && !readonly && !!values.length && e(SkipLink, {
57247
57302
  className: "fjs-taglist-skip-link",
57248
57303
  label: "Skip to search",
@@ -57290,7 +57345,9 @@
57290
57345
  onMouseDown: () => setIsEscapeClose(false),
57291
57346
  onFocus: onInputFocus,
57292
57347
  onBlur: onInputBlur,
57293
- "aria-describedby": errorMessageId
57348
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57349
+ required: required,
57350
+ "aria-invalid": errors.length > 0
57294
57351
  })]
57295
57352
  }), e("div", {
57296
57353
  class: "fjs-taglist-anchor",
@@ -57302,10 +57359,11 @@
57302
57359
  listenerElement: inputRef.current
57303
57360
  })
57304
57361
  }), e(Description$2, {
57362
+ id: descriptionId,
57305
57363
  description: description
57306
57364
  }), e(Errors, {
57307
- errors: errors,
57308
- id: errorMessageId
57365
+ id: errorMessageId,
57366
+ errors: errors
57309
57367
  })]
57310
57368
  });
57311
57369
  }
@@ -57618,7 +57676,6 @@
57618
57676
  const {
57619
57677
  disabled,
57620
57678
  errors = [],
57621
- errorMessageId,
57622
57679
  domId,
57623
57680
  onBlur,
57624
57681
  onFocus,
@@ -57654,6 +57711,8 @@
57654
57711
  const onInputFocus = () => {
57655
57712
  onFocus && onFocus();
57656
57713
  };
57714
+ const descriptionId = `${domId}-description`;
57715
+ const errorMessageId = `${domId}-error-message`;
57657
57716
  return e("div", {
57658
57717
  class: formFieldClasses(type$2, {
57659
57718
  errors,
@@ -57661,7 +57720,7 @@
57661
57720
  readonly
57662
57721
  }),
57663
57722
  children: [e(Label$3, {
57664
- id: domId,
57723
+ htmlFor: domId,
57665
57724
  label: label,
57666
57725
  required: required
57667
57726
  }), e(TemplatedInputAdorner, {
@@ -57679,13 +57738,16 @@
57679
57738
  onFocus: onInputFocus,
57680
57739
  type: "text",
57681
57740
  value: value,
57682
- "aria-describedby": errorMessageId
57741
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57742
+ required: required,
57743
+ "aria-invalid": errors.length > 0
57683
57744
  })
57684
57745
  }), e(Description$2, {
57746
+ id: descriptionId,
57685
57747
  description: description
57686
57748
  }), e(Errors, {
57687
- errors: errors,
57688
- id: errorMessageId
57749
+ id: errorMessageId,
57750
+ errors: errors
57689
57751
  })]
57690
57752
  });
57691
57753
  }
@@ -57717,7 +57779,6 @@
57717
57779
  const {
57718
57780
  disabled,
57719
57781
  errors = [],
57720
- errorMessageId,
57721
57782
  domId,
57722
57783
  onBlur,
57723
57784
  onFocus,
@@ -57734,7 +57795,7 @@
57734
57795
  required
57735
57796
  } = validate;
57736
57797
  const textareaRef = s$1();
57737
- const [onInputChange, flushOnChange] = useFlushDebounce(({
57798
+ const [onChange, flushOnChange] = useFlushDebounce(({
57738
57799
  target
57739
57800
  }) => {
57740
57801
  props.onChange({
@@ -57749,12 +57810,20 @@
57749
57810
  const onInputFocus = () => {
57750
57811
  onFocus && onFocus();
57751
57812
  };
57813
+ const onInputChange = event => {
57814
+ onChange({
57815
+ target: event.target
57816
+ });
57817
+ autoSizeTextarea(textareaRef.current);
57818
+ };
57752
57819
  h$1(() => {
57753
57820
  autoSizeTextarea(textareaRef.current);
57754
57821
  }, [value]);
57755
57822
  y(() => {
57756
57823
  autoSizeTextarea(textareaRef.current);
57757
57824
  }, []);
57825
+ const descriptionId = `${domId}-description`;
57826
+ const errorMessageId = `${domId}-error-message`;
57758
57827
  return e("div", {
57759
57828
  class: formFieldClasses(type$1, {
57760
57829
  errors,
@@ -57762,7 +57831,7 @@
57762
57831
  readonly
57763
57832
  }),
57764
57833
  children: [e(Label$3, {
57765
- id: domId,
57834
+ htmlFor: domId,
57766
57835
  label: label,
57767
57836
  required: required
57768
57837
  }), e("textarea", {
@@ -57775,12 +57844,15 @@
57775
57844
  onFocus: onInputFocus,
57776
57845
  value: value,
57777
57846
  ref: textareaRef,
57778
- "aria-describedby": errorMessageId
57847
+ "aria-describedby": [descriptionId, errorMessageId].join(' '),
57848
+ required: required,
57849
+ "aria-invalid": errors.length > 0
57779
57850
  }), e(Description$2, {
57851
+ id: descriptionId,
57780
57852
  description: description
57781
57853
  }), e(Errors, {
57782
- errors: errors,
57783
- id: errorMessageId
57854
+ id: errorMessageId,
57855
+ errors: errors
57784
57856
  })]
57785
57857
  });
57786
57858
  }
@@ -57996,7 +58068,7 @@
57996
58068
  return e("div", {
57997
58069
  class: formFieldClasses(type),
57998
58070
  children: [e(Label$3, {
57999
- id: prefixId$2(id),
58071
+ htmlFor: prefixId$2(id),
58000
58072
  label: label
58001
58073
  }), e("div", {
58002
58074
  class: classNames('fjs-table-middle-container', {
@@ -58392,7 +58464,7 @@
58392
58464
  }
58393
58465
  }
58394
58466
  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'];
58395
- const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
58467
+ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'content', 'url'];
58396
58468
 
58397
58469
  /**
58398
58470
  * @typedef { import('../types').Schema } Schema
@@ -59421,47 +59493,17 @@
59421
59493
  };
59422
59494
  const parentExpressionContextInfo = F$1(LocalExpressionContext);
59423
59495
  return e(d$1, {
59424
- children: displayValues.map((value, index) => {
59425
- const elementProps = d(() => ({
59426
- ...restProps,
59427
- indexes: {
59428
- ...(indexes || {}),
59429
- [repeaterField.id]: index
59430
- }
59431
- }), [index]);
59432
- const localExpressionContextInfo = d(() => ({
59433
- data: parentExpressionContextInfo.data,
59434
- this: value,
59435
- parent: buildExpressionContext(parentExpressionContextInfo),
59436
- i: [...parentExpressionContextInfo.i, index + 1]
59437
- }), [index, value]);
59438
- return !showRemove ? e(LocalExpressionContext.Provider, {
59439
- value: localExpressionContextInfo,
59440
- children: e(RowsRenderer, {
59441
- ...elementProps
59442
- })
59443
- }) : e("div", {
59444
- class: "fjs-repeat-row-container",
59445
- children: [e("div", {
59446
- class: "fjs-repeat-row-rows",
59447
- children: e(LocalExpressionContext.Provider, {
59448
- value: localExpressionContextInfo,
59449
- children: e(RowsRenderer, {
59450
- ...elementProps
59451
- })
59452
- })
59453
- }), e("button", {
59454
- class: "fjs-repeat-row-remove",
59455
- type: "button",
59456
- "aria-label": `Remove list item ${index + 1}`,
59457
- onClick: () => onDeleteItem(index),
59458
- children: e("div", {
59459
- class: "fjs-repeat-row-remove-icon-container",
59460
- children: e(DeleteSvg, {})
59461
- })
59462
- })]
59463
- });
59464
- })
59496
+ children: displayValues.map((value, index) => e(RepetitionScaffold, {
59497
+ index: index,
59498
+ value: value,
59499
+ parentExpressionContextInfo: parentExpressionContextInfo,
59500
+ repeaterField: repeaterField,
59501
+ RowsRenderer: RowsRenderer,
59502
+ indexes: indexes,
59503
+ onDeleteItem: onDeleteItem,
59504
+ showRemove: showRemove,
59505
+ ...restProps
59506
+ }, index))
59465
59507
  });
59466
59508
  }
59467
59509
  RepeatFooter(props) {
@@ -59553,6 +59595,73 @@
59553
59595
  return nonCollapsedItems ? nonCollapsedItems : DEFAULT_NON_COLLAPSED_ITEMS;
59554
59596
  }
59555
59597
  }
59598
+
59599
+ /**
59600
+ * Individual repetition of a repeated field and context scaffolding.
59601
+ *
59602
+ * @param {Object} props
59603
+ * @param {number} props.index
59604
+ * @param {Object} props.value
59605
+ * @param {Object} props.parentExpressionContextInfo
59606
+ * @param {Object} props.repeaterField
59607
+ * @param {Function} props.RowsRenderer
59608
+ * @param {Object} props.indexes
59609
+ * @param {Function} props.onDeleteItem
59610
+ * @param {boolean} props.showRemove
59611
+ */
59612
+
59613
+ const RepetitionScaffold = props => {
59614
+ const {
59615
+ index,
59616
+ value,
59617
+ parentExpressionContextInfo,
59618
+ repeaterField,
59619
+ RowsRenderer,
59620
+ indexes,
59621
+ onDeleteItem,
59622
+ showRemove,
59623
+ ...restProps
59624
+ } = props;
59625
+ const elementProps = d(() => ({
59626
+ ...restProps,
59627
+ indexes: {
59628
+ ...(indexes || {}),
59629
+ [repeaterField.id]: index
59630
+ }
59631
+ }), [index, indexes, repeaterField.id, restProps]);
59632
+ const localExpressionContextInfo = d(() => ({
59633
+ data: parentExpressionContextInfo.data,
59634
+ this: value,
59635
+ parent: buildExpressionContext(parentExpressionContextInfo),
59636
+ i: [...parentExpressionContextInfo.i, index + 1]
59637
+ }), [index, parentExpressionContextInfo, value]);
59638
+ return !showRemove ? e(LocalExpressionContext.Provider, {
59639
+ value: localExpressionContextInfo,
59640
+ children: e(RowsRenderer, {
59641
+ ...elementProps
59642
+ })
59643
+ }) : e("div", {
59644
+ class: "fjs-repeat-row-container",
59645
+ children: [e("div", {
59646
+ class: "fjs-repeat-row-rows",
59647
+ children: e(LocalExpressionContext.Provider, {
59648
+ value: localExpressionContextInfo,
59649
+ children: e(RowsRenderer, {
59650
+ ...elementProps
59651
+ })
59652
+ })
59653
+ }), e("button", {
59654
+ class: "fjs-repeat-row-remove",
59655
+ type: "button",
59656
+ "aria-label": `Remove list item ${index + 1}`,
59657
+ onClick: () => onDeleteItem(index),
59658
+ children: e("div", {
59659
+ class: "fjs-repeat-row-remove-icon-container",
59660
+ children: e(DeleteSvg, {})
59661
+ })
59662
+ })]
59663
+ });
59664
+ };
59556
59665
  RepeatRenderManager.$inject = ['form', 'formFields', 'formFieldRegistry', 'pathRegistry'];
59557
59666
  const RepeatRenderModule$1 = {
59558
59667
  __init__: ['repeatRenderManager'],
@@ -60981,10 +61090,10 @@
60981
61090
  }
60982
61091
  }
60983
61092
  clear() {
60984
- // clear form services
61093
+ // clear diagram services (e.g. EventBus)
60985
61094
  this._emit('diagram.clear');
60986
61095
 
60987
- // clear diagram services (e.g. EventBus)
61096
+ // clear form services
60988
61097
  this._emit('form.clear');
60989
61098
  }
60990
61099
 
@@ -76509,11 +76618,10 @@
76509
76618
  description,
76510
76619
  editField,
76511
76620
  field,
76512
- id,
76513
- defaultValue = 60 // default value for spacer
76621
+ id
76514
76622
  } = props;
76515
76623
  const debounce = useService('debounce');
76516
- const getValue = e => get(field, ['height'], defaultValue);
76624
+ const getValue = e => get(field, ['height'], null);
76517
76625
  const setValue = (value, error) => {
76518
76626
  if (error) {
76519
76627
  return;
@@ -76540,7 +76648,7 @@
76540
76648
  */
76541
76649
  const validate$7 = value => {
76542
76650
  if (typeof value !== 'number') {
76543
- return null;
76651
+ return 'A number is required.';
76544
76652
  }
76545
76653
  if (!Number.isInteger(value)) {
76546
76654
  return 'Should be an integer.';
@@ -76552,7 +76660,6 @@
76552
76660
  function IFrameHeightEntry(props) {
76553
76661
  return [...HeightEntry({
76554
76662
  ...props,
76555
- defaultValue: 300,
76556
76663
  description: 'Height of the container in pixels.',
76557
76664
  isDefaultVisible: field => field.type === 'iframe'
76558
76665
  })];
@@ -76785,7 +76892,7 @@
76785
76892
 
76786
76893
  const description = e(d$1, {
76787
76894
  children: ["Supports HTML, styling, and templating. Styles are automatically scoped to the HTML component. ", e("a", {
76788
- href: "https://docs.camunda.io/docs/components/modeler/forms/form-element-library/forms-element-library-html/",
76895
+ href: "https://docs.camunda.io/docs/next/components/modeler/forms/form-element-library/forms-element-library-html/",
76789
76896
  target: "_blank",
76790
76897
  children: "Learn more"
76791
76898
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "1.7.0-alpha.0",
3
+ "version": "1.7.1",
4
4
  "description": "A form-js playground",
5
5
  "files": [
6
6
  "dist"
@@ -44,8 +44,8 @@
44
44
  "url": "https://github.com/bpmn-io"
45
45
  },
46
46
  "dependencies": {
47
- "@bpmn-io/form-js-editor": "^1.7.0-alpha.0",
48
- "@bpmn-io/form-js-viewer": "^1.7.0-alpha.0",
47
+ "@bpmn-io/form-js-editor": "^1.7.1",
48
+ "@bpmn-io/form-js-viewer": "^1.7.1",
49
49
  "@codemirror/autocomplete": "^6.12.0",
50
50
  "@codemirror/commands": "^6.1.2",
51
51
  "@codemirror/lang-json": "^6.0.1",
@@ -70,5 +70,5 @@
70
70
  "rollup-plugin-css-only": "^4.0.0",
71
71
  "style-loader": "^3.3.0"
72
72
  },
73
- "gitHead": "bd5c0a61044cb4378925784a826bf5b711a5c82b"
73
+ "gitHead": "f6ffe2569d2d2f7fe6214ad5bb00b76f1d74ef1a"
74
74
  }