@knime/kds-components 11.3.0 → 11.4.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
@@ -1,5 +1,20 @@
1
1
  # @knime/kds-components
2
2
 
3
+ ## 11.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 37a5552: `KdsSplitPanel`: add the `hideSplitterWhenClosed` prop to hide the splitter control entirely while the secondary pane is collapsed, instead of leaving it visible as a thin bar.
8
+
9
+ ### Patch Changes
10
+
11
+ - b67f51c: - `KdsContextMenu`:
12
+ - hide the focus ring of a menu opened with the pointer until a key is pressed inside it
13
+ - prevent the native browser context menu when right-clicking anywhere on the menu popover
14
+ - 37a5552: `KdsSplitPanel`: fix a nested panel rendering its splitter with the closed (thicker) style while it is actually expanded, caused by inheriting the `--splitter-thickness` custom property from a closed ancestor panel.
15
+ - Updated dependencies
16
+ - @knime/kds-styles@11.4.0
17
+
3
18
  ## 11.3.0
4
19
 
5
20
  ### Minor Changes
package/dist/index.css CHANGED
@@ -1402,7 +1402,7 @@ body:has(dialog.modal[open]) {
1402
1402
  }
1403
1403
 
1404
1404
  .kds-menu-container {
1405
- &[data-v-1dcd01cb] {
1405
+ &[data-v-e83a636c] {
1406
1406
  display: flex;
1407
1407
  flex-direction: column;
1408
1408
  gap: var(--kds-spacing-container-0-10x);
@@ -1414,12 +1414,15 @@ body:has(dialog.modal[open]) {
1414
1414
  border-radius: var(--kds-border-radius-container-0-50x);
1415
1415
  box-shadow: var(--kds-elevation-level-3);
1416
1416
  }
1417
- &[data-v-1dcd01cb]:focus-visible {
1417
+ &.hide-focus-ring[data-v-e83a636c]:focus-visible {
1418
+ outline: none;
1419
+ }
1420
+ &[data-v-e83a636c]:focus-visible:not(.hide-focus-ring) {
1418
1421
  outline: var(--kds-border-action-focused);
1419
1422
  outline-offset: var(--kds-spacing-offset-focus);
1420
1423
  }
1421
1424
  }
1422
- .submenu-popover[data-v-1dcd01cb] {
1425
+ .submenu-popover[data-v-e83a636c] {
1423
1426
  inset: anchor(top) auto auto anchor(right);
1424
1427
  padding: 0 var(--kds-spacing-container-0-25x);
1425
1428
  margin: 0;
@@ -5061,41 +5064,47 @@ tbody[data-v-d13e0460]:has(.empty) {
5061
5064
  }
5062
5065
 
5063
5066
  .switch-icon {
5064
- &[data-v-a2cc6943] {
5067
+ &[data-v-d6459278] {
5065
5068
  position: relative;
5066
5069
  }
5067
- &[data-v-a2cc6943]:not(.closed) {
5070
+ &[data-v-d6459278]:not(.closed) {
5068
5071
  visibility: hidden;
5069
5072
  }
5070
5073
  &.direction-left {
5071
- &.closed[data-v-a2cc6943] {
5074
+ &.closed[data-v-d6459278] {
5072
5075
  transform: scaleX(-1);
5073
5076
  }
5074
5077
  }
5075
5078
  &.direction-right {
5076
- &[data-v-a2cc6943]:not(.closed) {
5079
+ &[data-v-d6459278]:not(.closed) {
5077
5080
  transform: scaleX(-1);
5078
5081
  }
5079
5082
  }
5080
5083
  &.direction-up {
5081
- &[data-v-a2cc6943] {
5084
+ &[data-v-d6459278] {
5082
5085
  transform: rotate(90deg);
5083
5086
  }
5084
- &.closed[data-v-a2cc6943] {
5087
+ &.closed[data-v-d6459278] {
5085
5088
  transform: rotate(-90deg);
5086
5089
  }
5087
5090
  }
5088
5091
  &.direction-down {
5089
- &[data-v-a2cc6943] {
5092
+ &[data-v-d6459278] {
5090
5093
  transform: rotate(-90deg);
5091
5094
  }
5092
- &.closed[data-v-a2cc6943] {
5095
+ &.closed[data-v-d6459278] {
5093
5096
  transform: rotate(90deg);
5094
5097
  }
5095
5098
  }
5096
5099
  }
5097
5100
  .splitter-root {
5098
- &[data-v-a2cc6943] {
5101
+ &[data-v-d6459278] {
5102
+ /*
5103
+ * Reset explicitly: custom properties inherit, and this is only ever set
5104
+ * by the `&.closed` rule below. Without this reset, an open nested
5105
+ * KdsSplitPanel inherits the closed thickness from a closed ancestor panel.
5106
+ */
5107
+ --splitter-thickness: initial;
5099
5108
  --splitter-background-color: var(--kds-color-surface-default);
5100
5109
  --splitter-border: var(--kds-border-base-subtle);
5101
5110
  --splitter-touch-zone: calc(
@@ -5112,26 +5121,26 @@ tbody[data-v-d13e0460]:has(.empty) {
5112
5121
  var(--splitter-background-color);
5113
5122
  --splitter-hover-transition: border-color 150ms ease-in;
5114
5123
  }
5115
- &.closed[data-v-a2cc6943] {
5124
+ &.closed[data-v-d6459278] {
5116
5125
  --splitter-thickness: var(--splitter-closed-size);
5117
5126
  --splitter-background-color: var(--kds-color-surface-muted);
5118
5127
  }
5119
5128
  }
5120
- .secondary-wrapper[data-v-a2cc6943] {
5129
+ .secondary-wrapper[data-v-d6459278] {
5121
5130
  width: 100%;
5122
5131
  height: 100%;
5123
5132
  }
5124
5133
 
5125
5134
  /* snap overlay and message */
5126
- .will-snap[data-v-a2cc6943] {
5135
+ .will-snap[data-v-d6459278] {
5127
5136
  --will-snap-background-color: var(--kds-color-surface-muted);
5128
5137
  --splitter-background-color: var(--will-snap-background-color) !important;
5129
5138
  }
5130
5139
  .secondary-wrapper.will-snap {
5131
- &[data-v-a2cc6943] {
5140
+ &[data-v-d6459278] {
5132
5141
  position: relative;
5133
5142
  }
5134
- &[data-v-a2cc6943]::after {
5143
+ &[data-v-d6459278]::after {
5135
5144
  position: absolute;
5136
5145
  inset: 0;
5137
5146
  z-index: var(--splitter-z-index, 1);
@@ -5139,7 +5148,7 @@ tbody[data-v-d13e0460]:has(.empty) {
5139
5148
  background-color: var(--will-snap-background-color);
5140
5149
  }
5141
5150
  }
5142
- .snap-message[data-v-a2cc6943] {
5151
+ .snap-message[data-v-d6459278] {
5143
5152
  position: absolute;
5144
5153
  inset: 0;
5145
5154
  z-index: calc(var(--splitter-z-index, 1) + 1);
package/dist/index.js CHANGED
@@ -11753,14 +11753,19 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
11753
11753
  ariaLabel: { default: "Menu" },
11754
11754
  items: {},
11755
11755
  menuMaxHeight: {},
11756
- variant: { default: () => kdsListItemVariant.SMALL }
11756
+ variant: { default: () => kdsListItemVariant.SMALL },
11757
+ hideFocusRingUntilKeydown: {
11758
+ type: Boolean,
11759
+ default: false
11760
+ }
11757
11761
  },
11758
11762
  emits: ["itemClick"],
11759
11763
  setup(__props, { expose: __expose, emit: __emit }) {
11760
11764
  const props = createPropsRestProxy(__props, [
11761
11765
  "ariaLabel",
11762
11766
  "menuMaxHeight",
11763
- "variant"
11767
+ "variant",
11768
+ "hideFocusRingUntilKeydown"
11764
11769
  ]);
11765
11770
  const emit = __emit;
11766
11771
  const { itemsWithPrefix, toUnprefixedId } = useStableItemIds({ items: computed(() => props.items) });
@@ -11858,7 +11863,9 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
11858
11863
  const activeElement = getActiveElement();
11859
11864
  return activeElement === event.target && activeElement === containerEl.value;
11860
11865
  };
11866
+ const hasKeydown = ref(false);
11861
11867
  const handleKeydown = (event) => {
11868
+ hasKeydown.value = true;
11862
11869
  if (!shouldNavigate(event)) return;
11863
11870
  if (enabledItems.value.length === 0) return;
11864
11871
  const currentIndex = findEnabledIndex(activeId.value);
@@ -11968,7 +11975,7 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
11968
11975
  ref_key: "containerEl",
11969
11976
  ref: containerEl,
11970
11977
  role: "menu",
11971
- class: "kds-menu-container",
11978
+ class: normalizeClass(["kds-menu-container", { "hide-focus-ring": __props.hideFocusRingUntilKeydown && !hasKeydown.value }]),
11972
11979
  "aria-label": __props.ariaLabel,
11973
11980
  tabindex: 0,
11974
11981
  style: normalizeStyle({ maxHeight: __props.menuMaxHeight }),
@@ -12031,10 +12038,10 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
12031
12038
  "onClick",
12032
12039
  "onMouseenter"
12033
12040
  ]);
12034
- }), 128))], 44, _hoisted_1$67);
12041
+ }), 128))], 46, _hoisted_1$67);
12035
12042
  };
12036
12043
  }
12037
- }), [["__scopeId", "data-v-1dcd01cb"]]);
12044
+ }), [["__scopeId", "data-v-e83a636c"]]);
12038
12045
  //#endregion
12039
12046
  //#region src/components/buttons/KdsMenuButton/KdsMenuButton.vue
12040
12047
  var KdsMenuButton_default = /* @__PURE__ */ defineComponent({
@@ -26968,6 +26975,35 @@ var KdsMenu_default = /* @__PURE__ */ defineComponent({
26968
26975
  }
26969
26976
  });
26970
26977
  //#endregion
26978
+ //#region src/util/useKeyPressedUntilMouseClick.ts
26979
+ var defaultKeys = [
26980
+ "Tab",
26981
+ "ArrowUp",
26982
+ "ArrowDown",
26983
+ "ArrowLeft",
26984
+ "ArrowRight",
26985
+ " ",
26986
+ "Enter"
26987
+ ];
26988
+ var useKeyPressedUntilMouseClick = (keys = defaultKeys) => {
26989
+ const hasUsedKeyboard = ref(false);
26990
+ const turnKeyboardUsageOn = (event) => {
26991
+ if (keys.includes(event.key)) hasUsedKeyboard.value = true;
26992
+ };
26993
+ const turnKeyboardUsageOff = () => {
26994
+ hasUsedKeyboard.value = false;
26995
+ };
26996
+ onMounted(() => {
26997
+ document.addEventListener("keydown", turnKeyboardUsageOn, { capture: true });
26998
+ document.addEventListener("pointerdown", turnKeyboardUsageOff, { capture: true });
26999
+ });
27000
+ onUnmounted(() => {
27001
+ document.removeEventListener("keydown", turnKeyboardUsageOn, true);
27002
+ document.removeEventListener("pointerdown", turnKeyboardUsageOff, true);
27003
+ });
27004
+ return hasUsedKeyboard;
27005
+ };
27006
+ //#endregion
26971
27007
  //#region src/components/lists/ContextMenu/KdsContextMenu.vue
26972
27008
  var KdsContextMenu_default = /* @__PURE__ */ defineComponent({
26973
27009
  inheritAttrs: false,
@@ -27002,9 +27038,17 @@ var KdsContextMenu_default = /* @__PURE__ */ defineComponent({
27002
27038
  open.value = false;
27003
27039
  emit("itemClick", itemId);
27004
27040
  };
27041
+ const openedWithKeyboard = useKeyPressedUntilMouseClick([
27042
+ "ContextMenu",
27043
+ "F10",
27044
+ "Enter",
27045
+ " "
27046
+ ]);
27047
+ const hideFocusRing = ref(false);
27005
27048
  const menuContainerEl = useTemplateRef("menuContainer");
27006
27049
  watch(open, (isOpen, _oldVal, onCleanup) => {
27007
27050
  if (!isOpen) return;
27051
+ hideFocusRing.value = !openedWithKeyboard.value;
27008
27052
  if (menuContainerEl.value) {
27009
27053
  menuContainerEl.value.focus();
27010
27054
  return;
@@ -27016,11 +27060,12 @@ var KdsContextMenu_default = /* @__PURE__ */ defineComponent({
27016
27060
  return (_ctx, _cache) => {
27017
27061
  return openBlock(), createBlock(KdsPopover_default, {
27018
27062
  modelValue: open.value,
27019
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => open.value = $event),
27063
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => open.value = $event),
27020
27064
  placement: "custom",
27021
27065
  "custom-placement-position": __props.position,
27022
27066
  "popover-type": __props.popoverMode,
27023
- "aria-label": "Menu"
27067
+ "aria-label": "Menu",
27068
+ onContextmenu: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"]))
27024
27069
  }, {
27025
27070
  default: withCtx(() => [open.value ? (openBlock(), createBlock(KdsMenuContainer_default, {
27026
27071
  key: 0,
@@ -27030,14 +27075,15 @@ var KdsContextMenu_default = /* @__PURE__ */ defineComponent({
27030
27075
  items: props.items,
27031
27076
  "menu-max-height": __props.menuMaxHeight,
27032
27077
  variant: __props.variant,
27033
- onItemClick,
27034
- onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
27078
+ "hide-focus-ring-until-keydown": hideFocusRing.value,
27079
+ onItemClick
27035
27080
  }, null, 8, [
27036
27081
  "id",
27037
27082
  "aria-label",
27038
27083
  "items",
27039
27084
  "menu-max-height",
27040
- "variant"
27085
+ "variant",
27086
+ "hide-focus-ring-until-keydown"
27041
27087
  ])) : createCommentVNode("", true)]),
27042
27088
  _: 1
27043
27089
  }, 8, [
@@ -27912,35 +27958,6 @@ var useFocusableMultiSelection = (options) => {
27912
27958
  };
27913
27959
  };
27914
27960
  //#endregion
27915
- //#region src/util/useKeyPressedUntilMouseClick.ts
27916
- var defaultKeys = [
27917
- "Tab",
27918
- "ArrowUp",
27919
- "ArrowDown",
27920
- "ArrowLeft",
27921
- "ArrowRight",
27922
- " ",
27923
- "Enter"
27924
- ];
27925
- var useKeyPressedUntilMouseClick = (keys = defaultKeys) => {
27926
- const hasUsedKeyboard = ref(false);
27927
- const turnKeyboardUsageOn = (event) => {
27928
- if (keys.includes(event.key)) hasUsedKeyboard.value = true;
27929
- };
27930
- const turnKeyboardUsageOff = () => {
27931
- hasUsedKeyboard.value = false;
27932
- };
27933
- onMounted(() => {
27934
- document.addEventListener("keydown", turnKeyboardUsageOn, { capture: true });
27935
- document.addEventListener("pointerdown", turnKeyboardUsageOff, { capture: true });
27936
- });
27937
- onUnmounted(() => {
27938
- document.removeEventListener("keydown", turnKeyboardUsageOn, true);
27939
- document.removeEventListener("pointerdown", turnKeyboardUsageOff, true);
27940
- });
27941
- return hasUsedKeyboard;
27942
- };
27943
- //#endregion
27944
27961
  //#region src/util/useKdsNameValidator.ts
27945
27962
  var INVALID_NAME_CHARACTERS = /[*?#:";<>%~|/\\]/;
27946
27963
  var NAME_CHAR_LIMIT = 255;
@@ -35791,6 +35808,10 @@ var KdsSplitPanel_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
35791
35808
  showSnapEmptyState: {
35792
35809
  type: Boolean,
35793
35810
  default: false
35811
+ },
35812
+ hideSplitterWhenClosed: {
35813
+ type: Boolean,
35814
+ default: false
35794
35815
  }
35795
35816
  }, {
35796
35817
  "expanded": {
@@ -35834,7 +35855,10 @@ var KdsSplitPanel_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
35834
35855
  };
35835
35856
  const sizePane = computed(() => directionSizePaneMap[__props.direction]);
35836
35857
  const isSecondaryReverse = computed(() => [kdsSplitPanelDirection.LEFT, kdsSplitPanelDirection.UP].includes(__props.direction));
35837
- const hiddenPane = computed(() => __props.hideSecondaryPane ? sizePane.value : void 0);
35858
+ const hiddenPane = computed(() => {
35859
+ if (__props.hideSecondaryPane) return sizePane.value;
35860
+ if (__props.hideSplitterWhenClosed && !expanded.value) return sizePane.value;
35861
+ });
35838
35862
  const previousSecondarySize = ref(secondarySize.value);
35839
35863
  const willSnap = computed(() => {
35840
35864
  if (__props.usePixel) return __props.secondarySnapSize > pixelSize.value;
@@ -35958,7 +35982,7 @@ var KdsSplitPanel_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
35958
35982
  ]);
35959
35983
  };
35960
35984
  }
35961
- }), [["__scopeId", "data-v-a2cc6943"]]);
35985
+ }), [["__scopeId", "data-v-d6459278"]]);
35962
35986
  //#endregion
35963
35987
  //#region src/layouts/panels/TabPanel/TabBar/useTabBarAdaptiveLayout.ts
35964
35988
  /**