@bpmn-io/properties-panel 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,26 @@ All notable changes to [`@bpmn-io/properties-panel`](https://github.com/bpmn-io/
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
+ ## 0.11.0
10
+
11
+ * `FEAT`: all group and entry components specified as `component` are actual components, not elements ([#134](https://github.com/bpmn-io/properties-panel/pull/134))
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * `component` property of an entry must be an actual component, not an element
16
+
17
+ ## 0.10.2
18
+
19
+ * `FIX`: add missing aria label for `simple` component ([67f374](https://github.com/bpmn-io/properties-panel/commit/67f37491ab8dc8493c8dd1e749d7418d11825125))
20
+ * `CHORE`: add a11y tests ([0bdd6a](https://github.com/bpmn-io/properties-panel/commit/0bdd6a99a73047e9776da44ff834c524c66b9589) and [a2fc27](https://github.com/bpmn-io/properties-panel/commit/a2fc27530b2b5ec90f5d2e9ee0438a814e0f57e4))
21
+ * `STYLE`: use consistent add/arrow fill color ([272d4b](https://github.com/bpmn-io/properties-panel/commit/272d4be6585ee89c7f7c55c3e2e2346ad92618db))
22
+
23
+ ## 0.10.1
24
+
25
+ * `FIX`: properly update layout ([#125](https://github.com/bpmn-io/properties-panel/pull/125))
26
+ * `FIX`: delete button now shows on tabbing ([#505](https://github.com/bpmn-io/bpmn-js-properties-panel/issues/505))
27
+ * `FIX`: use POSIX paths when re-exporting preact on Windows ([#127](https://github.com/bpmn-io/properties-panel/issues/127))
28
+
9
29
  ## 0.10.0
10
30
 
11
31
  * `FEAT`: reexport `preact` used in the package ([#124](https://github.com/bpmn-io/properties-panel/pull/124))
@@ -46,7 +46,6 @@
46
46
  --group-bottom-border-color: var(--color-grey-225-10-75);
47
47
 
48
48
  --add-entry-fill-color: var(--color-grey-225-10-35);
49
- --add-entry-empty-fill-color: var(--color-grey-225-10-75);
50
49
  --add-entry-hover-fill-color: var(--color-white);
51
50
  --add-entry-hover-background-color: var(--color-blue-205-100-50);
52
51
  --add-entry-label-color: var(--color-white);
@@ -56,7 +55,6 @@
56
55
 
57
56
  --arrow-fill-color: var(--color-grey-225-10-35);
58
57
  --arrow-hover-background-color: var(--color-grey-225-10-95);
59
- --arrow-empty-fill-color: var(--color-grey-225-10-75);
60
58
 
61
59
  --dot-color: var(--color-grey-225-10-35);
62
60
 
@@ -86,13 +84,12 @@
86
84
 
87
85
  --list-entry-dot-background-color: var(--color-grey-225-10-35);
88
86
  --list-entry-header-button-fill-color: var(--color-grey-225-10-35);
89
- --list-entry-add-entry-empty-fill-color: var(--color-white);
90
87
  --list-entry-add-entry-empty-background-color: var(--color-blue-205-100-50);
91
88
  --list-entry-add-entry-empty-hover-background-color: var(--color-blue-205-100-45);
92
89
  --list-entry-add-entry-label-color: var(--color-white);
93
90
  --list-entry-add-entry-background-color: var(--color-blue-205-100-50);
94
91
  --list-entry-add-entry-fill-color: var(--color-white);
95
-
92
+
96
93
  --dropdown-item-background-color: var(--color-white);
97
94
  --dropdown-item-hover-background-color: var(--color-grey-225-10-95);
98
95
  --dropdown-separator-background-color: var(--color-grey-225-10-75);
@@ -256,7 +253,6 @@
256
253
  }
257
254
 
258
255
  .bio-properties-panel-group-header.empty .bio-properties-panel-add-entry {
259
- fill: var(--add-entry-empty-fill-color);
260
256
  margin-right: 69px;
261
257
  padding-left: 6px;
262
258
  }
@@ -307,10 +303,6 @@
307
303
  transform: rotate(90deg);
308
304
  }
309
305
 
310
- .bio-properties-panel-group-header.empty .bio-properties-panel-arrow {
311
- fill: var(--arrow-empty-fill-color);
312
- }
313
-
314
306
  .bio-properties-panel-dot {
315
307
  align-self: center;
316
308
  height: 8px;
@@ -364,7 +356,7 @@
364
356
  margin: 2px 0 1px;
365
357
  }
366
358
 
367
- .bio-properties-panel-description,
359
+ .bio-properties-panel-description,
368
360
  .bio-properties-panel-description p,
369
361
  .bio-properties-panel-description span,
370
362
  .bio-properties-panel-description div {
@@ -642,7 +634,9 @@ textarea.bio-properties-panel-input {
642
634
  }
643
635
 
644
636
  .bio-properties-panel-list-entry-item:hover .bio-properties-panel-remove-list-entry,
645
- .bio-properties-panel-collapsible-entry:hover > .bio-properties-panel-collapsible-entry-header .bio-properties-panel-remove-entry {
637
+ .bio-properties-panel-collapsible-entry:hover > .bio-properties-panel-collapsible-entry-header .bio-properties-panel-remove-entry,
638
+ .bio-properties-panel-collapsible-entry:focus-within > .bio-properties-panel-collapsible-entry-header .bio-properties-panel-remove-entry
639
+ {
646
640
  visibility: visible;
647
641
  }
648
642
 
@@ -797,16 +791,10 @@ textarea.bio-properties-panel-input {
797
791
  }
798
792
 
799
793
  .bio-properties-panel-list-entry.empty .bio-properties-panel-add-entry {
800
- fill: var(--list-entry-add-entry-empty-fill-color);
801
- background-color: var(--list-entry-add-entry-empty-background-color);
802
794
  margin-right: 16px;
803
795
  padding-left: 6px;
804
796
  }
805
797
 
806
- .bio-properties-panel-list-entry.empty .bio-properties-panel-add-entry:hover {
807
- background-color: var(--list-entry-add-entry-empty-hover-background-color);
808
- }
809
-
810
798
  .bio-properties-panel-list-entry.empty .bio-properties-panel-add-entry-label {
811
799
  color: var(--list-entry-add-entry-label-color);
812
800
  padding: 4px 6px 3px 2px;
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { useRef, useEffect, useMemo, useContext, useState } from '../preact/hooks';
2
- import { isFunction, get, set, sortBy, find, isNumber, debounce } from 'min-dash';
2
+ import { isFunction, get, assign, set, sortBy, find, isNumber, debounce } from 'min-dash';
3
3
  import classnames from 'classnames';
4
4
  import { jsxs, jsx } from '../preact/jsx-runtime';
5
5
  import { query } from 'min-dom';
6
- import { createContext } from '../preact';
6
+ import { createContext, createElement } from '../preact';
7
7
  import '../preact/compat';
8
8
 
9
9
  /**
@@ -221,8 +221,9 @@ DeleteIcon.defaultProps = {
221
221
 
222
222
  function Group(props) {
223
223
  const {
224
- id,
224
+ element,
225
225
  entries = [],
226
+ id,
226
227
  label
227
228
  } = props;
228
229
  const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
@@ -270,7 +271,16 @@ function Group(props) {
270
271
  })]
271
272
  }), jsx("div", {
272
273
  class: classnames('bio-properties-panel-group-entries', open ? 'open' : ''),
273
- children: entries.map(e => e.component)
274
+ children: entries.map(entry => {
275
+ const {
276
+ component: Component,
277
+ id
278
+ } = entry;
279
+ return createElement(Component, { ...entry,
280
+ key: id,
281
+ element: element
282
+ });
283
+ })
274
284
  })]
275
285
  });
276
286
  }
@@ -288,7 +298,7 @@ const DEFAULT_LAYOUT = {
288
298
  const DEFAULT_DESCRIPTION = {};
289
299
  /**
290
300
  * @typedef { {
291
- * component: import('preact').ComponentChild,
301
+ * component: import('preact').Component,
292
302
  * id: String,
293
303
  * isEdited?: Function
294
304
  * } } EntryDefinition
@@ -357,7 +367,7 @@ function PropertiesPanel(props) {
357
367
  descriptionLoaded
358
368
  } = props; // set-up layout context
359
369
 
360
- const [layout, setLayout] = useState(createLayoutContext(layoutConfig));
370
+ const [layout, setLayout] = useState(createLayout(layoutConfig));
361
371
  useEffect(() => {
362
372
  if (typeof layoutChanged === 'function') {
363
373
  layoutChanged(layout);
@@ -369,7 +379,9 @@ function PropertiesPanel(props) {
369
379
  };
370
380
 
371
381
  const setLayoutForKey = (key, config) => {
372
- setLayout(set(layout, key, config));
382
+ const newLayout = assign({}, layout);
383
+ set(newLayout, key, config);
384
+ setLayout(newLayout);
373
385
  };
374
386
 
375
387
  const layoutContext = {
@@ -414,13 +426,13 @@ function PropertiesPanel(props) {
414
426
  class: "bio-properties-panel-scroll-container",
415
427
  children: groups.map(group => {
416
428
  const {
417
- component: GroupComponent = Group,
429
+ component: Component = Group,
418
430
  id
419
431
  } = group;
420
- return jsx(GroupComponent, {
421
- element: element,
422
- ...group
423
- }, id);
432
+ return createElement(Component, { ...group,
433
+ key: id,
434
+ element: element
435
+ });
424
436
  })
425
437
  })]
426
438
  })
@@ -428,7 +440,7 @@ function PropertiesPanel(props) {
428
440
  });
429
441
  } // helpers //////////////////
430
442
 
431
- function createLayoutContext(overrides) {
443
+ function createLayout(overrides) {
432
444
  return { ...DEFAULT_LAYOUT,
433
445
  ...overrides
434
446
  };
@@ -553,11 +565,12 @@ function HeaderButton(props) {
553
565
 
554
566
  function CollapsibleEntry(props) {
555
567
  const {
556
- id,
568
+ element,
557
569
  entries = [],
570
+ id,
558
571
  label,
559
- remove,
560
- open: shouldOpen
572
+ open: shouldOpen,
573
+ remove
561
574
  } = props;
562
575
  const [open, setOpen] = useState(shouldOpen);
563
576
 
@@ -589,15 +602,24 @@ function CollapsibleEntry(props) {
589
602
  }) : null]
590
603
  }), jsx("div", {
591
604
  class: classnames('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''),
592
- children: entries.map(e => e.component)
605
+ children: entries.map(entry => {
606
+ const {
607
+ component: Component,
608
+ id
609
+ } = entry;
610
+ return createElement(Component, { ...entry,
611
+ key: id,
612
+ element: element
613
+ });
614
+ })
593
615
  })]
594
616
  });
595
617
  }
596
618
 
597
619
  function ListItem(props) {
598
620
  const {
599
- autoOpen,
600
- autoFocusEntry
621
+ autoFocusEntry,
622
+ autoOpen
601
623
  } = props; // focus specified entry on auto open
602
624
 
603
625
  useEffect(() => {
@@ -630,13 +652,13 @@ const noop = () => {};
630
652
 
631
653
  function ListGroup(props) {
632
654
  const {
655
+ add,
633
656
  element,
634
657
  id,
635
658
  items,
636
659
  label,
637
- add,
638
- shouldSort = true,
639
- shouldOpen = true
660
+ shouldOpen = true,
661
+ shouldSort = true
640
662
  } = props;
641
663
  const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
642
664
  const [ordering, setOrdering] = useState([]);
@@ -754,11 +776,16 @@ function ListGroup(props) {
754
776
  return;
755
777
  }
756
778
 
757
- return jsx(ListItem, {
758
- // if item was added, open first or last item based on ordering
759
- autoOpen: newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1),
760
- ...item
761
- }, item.id);
779
+ const {
780
+ id
781
+ } = item;
782
+ return createElement(ListItem, { ...item,
783
+ element: element,
784
+ index: index,
785
+ key: id // if item was added, open first or last item based on ordering
786
+ ,
787
+ autoOpen: newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1)
788
+ });
762
789
  })
763
790
  })]
764
791
  });
@@ -881,7 +908,7 @@ function List(props) {
881
908
  id,
882
909
  element,
883
910
  items = [],
884
- renderItem,
911
+ component,
885
912
  label = '<empty>',
886
913
  open: shouldOpen,
887
914
  onAdd,
@@ -951,12 +978,13 @@ function List(props) {
951
978
  })]
952
979
  }), hasItems && jsx(ItemsList, {
953
980
  autoFocusEntry: autoFocusEntry,
981
+ component: component,
982
+ element: element,
954
983
  id: id,
955
- open: open,
956
984
  items: sortedItems,
957
985
  newItems: newItems,
958
986
  onRemove: onRemove,
959
- renderItem: renderItem
987
+ open: open
960
988
  })]
961
989
  });
962
990
  }
@@ -964,12 +992,13 @@ function List(props) {
964
992
  function ItemsList(props) {
965
993
  const {
966
994
  autoFocusEntry,
995
+ component: Component,
996
+ element,
967
997
  id,
968
998
  items,
969
999
  newItems,
970
- open,
971
1000
  onRemove,
972
- renderItem
1001
+ open
973
1002
  } = props;
974
1003
  const getKey = useKeyFactory();
975
1004
  const newItem = newItems[0];
@@ -996,7 +1025,13 @@ function ItemsList(props) {
996
1025
  const key = getKey(item);
997
1026
  return jsxs("li", {
998
1027
  class: "bio-properties-panel-list-entry-item",
999
- children: [renderItem(item, index, item === newItem), onRemove && jsx("button", {
1028
+ children: [jsx(Component, {
1029
+ element: element,
1030
+ id: id,
1031
+ index: index,
1032
+ item: item,
1033
+ open: item === newItem
1034
+ }), onRemove && jsx("button", {
1000
1035
  type: "button",
1001
1036
  title: "Delete item",
1002
1037
  class: "bio-properties-panel-remove-entry bio-properties-panel-remove-list-entry",
@@ -1277,6 +1312,7 @@ function Simple(props) {
1277
1312
  disabled: disabled,
1278
1313
  class: "bio-properties-panel-input",
1279
1314
  onInput: handleInput,
1315
+ "aria-label": value || '<empty>',
1280
1316
  onFocus: onFocus,
1281
1317
  onBlur: onBlur,
1282
1318
  value: value || ''