@knime/kds-components 0.11.0 → 0.13.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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, normalizeStyle, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, useTemplateRef, createCommentVNode, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, createVNode, defineAsyncComponent, useId, Fragment, renderList, onBeforeUpdate, nextTick, withModifiers, normalizeProps, guardReactiveProps, withDirectives, vModelText, onBeforeUnmount, createTextVNode, useCssVars, mergeDefaults, createSlots } from 'vue';
1
+ import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, normalizeStyle, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, useTemplateRef, createCommentVNode, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, createVNode, defineAsyncComponent, useId, Fragment, renderList, onBeforeUpdate, nextTick, withModifiers, normalizeProps, guardReactiveProps, withDirectives, vModelText, watchEffect, createTextVNode, useCssVars, mergeDefaults, createSlots } from 'vue';
2
2
  import { useLocalStorage, useDark, usePreferredDark, useResizeObserver, useMutationObserver, useElementSize } from '@vueuse/core';
3
3
 
4
4
  import './index.css';const kdsAvatarSize = {
@@ -2866,7 +2866,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2866
2866
 
2867
2867
  const KdsTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2e4d2d42"]]);
2868
2868
 
2869
- const _hoisted_1$9 = ["id", "popover", "role", "aria-label"];
2869
+ const _hoisted_1$9 = ["id", "role", "aria-label"];
2870
2870
  const _hoisted_2$3 = {
2871
2871
  key: 0,
2872
2872
  class: "kds-popover-default-content"
@@ -2874,8 +2874,6 @@ const _hoisted_2$3 = {
2874
2874
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2875
2875
  __name: "KdsPopover",
2876
2876
  props: /* @__PURE__ */ mergeModels({
2877
- activatorEl: {},
2878
- anchorEl: {},
2879
2877
  placement: { default: "bottom-left" },
2880
2878
  role: { default: "dialog" },
2881
2879
  fullWidth: { type: Boolean, default: false },
@@ -2886,71 +2884,28 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2886
2884
  "modelModifiers": {}
2887
2885
  }),
2888
2886
  emits: ["update:modelValue"],
2889
- setup(__props) {
2887
+ setup(__props, { expose: __expose }) {
2890
2888
  const props = __props;
2891
2889
  const open = useModel(__props, "modelValue");
2892
2890
  const popoverEl = useTemplateRef("popoverEl");
2893
2891
  const popoverId = useId();
2894
2892
  const anchorName = `--anchor-${popoverId}`;
2895
- const resolveElement = (el) => {
2896
- if (!el) {
2897
- return null;
2898
- }
2899
- const maybeInstance = el;
2900
- const candidate = maybeInstance.$el ?? el;
2901
- return candidate instanceof HTMLElement ? candidate : null;
2902
- };
2903
- const setA11yAttributes = (el, options) => {
2904
- if (!el) {
2905
- return;
2906
- }
2907
- if (options === null) {
2908
- el.removeAttribute("aria-expanded");
2909
- el.removeAttribute("aria-controls");
2910
- el.removeAttribute("aria-haspopup");
2911
- return;
2912
- }
2913
- el.setAttribute("aria-expanded", String(options.expanded));
2914
- el.setAttribute("aria-controls", options.popoverId);
2915
- el.setAttribute("aria-haspopup", props.role);
2916
- };
2917
- watch(open, (isOpen) => {
2918
- if (isOpen) {
2893
+ watchEffect(() => {
2894
+ if (open.value) {
2919
2895
  popoverEl.value?.showPopover?.();
2920
2896
  } else {
2921
2897
  popoverEl.value?.hidePopover?.();
2922
2898
  }
2923
- const activatorElement = resolveElement(unref(props.activatorEl));
2924
- activatorElement?.setAttribute("aria-expanded", String(isOpen));
2925
- });
2926
- watch(
2927
- () => [unref(props.anchorEl), unref(props.activatorEl)],
2928
- ([nextAnchorEl, nextActivatorEl], prev) => {
2929
- const [prevAnchorEl, prevActivatorEl] = prev ?? [null, null];
2930
- const prevAnchor = resolveElement(prevAnchorEl ?? null) ?? resolveElement(prevActivatorEl);
2931
- prevAnchor?.style.removeProperty("anchor-name");
2932
- const prevActivator = resolveElement(prevActivatorEl);
2933
- setA11yAttributes(prevActivator, null);
2934
- const nextAnchor = resolveElement(nextAnchorEl ?? null) ?? resolveElement(nextActivatorEl);
2935
- nextAnchor?.style.setProperty("anchor-name", anchorName);
2936
- const nextActivator = resolveElement(nextActivatorEl);
2937
- setA11yAttributes(nextActivator, { expanded: open.value, popoverId });
2938
- },
2939
- { immediate: true }
2940
- );
2941
- onBeforeUnmount(() => {
2942
- const anchor = resolveElement(unref(props.anchorEl) ?? null) ?? resolveElement(unref(props.activatorEl));
2943
- anchor?.style.removeProperty("anchor-name");
2944
- const activator = resolveElement(unref(props.activatorEl));
2945
- setA11yAttributes(activator, null);
2946
2899
  });
2900
+ const anchorStyle = { "anchor-name": anchorName };
2901
+ __expose({ anchorStyle, popoverId });
2947
2902
  return (_ctx, _cache) => {
2948
2903
  return openBlock(), createElementBlock("div", {
2949
2904
  id: unref(popoverId),
2950
2905
  ref_key: "popoverEl",
2951
2906
  ref: popoverEl,
2952
2907
  class: normalizeClass(["kds-popover", ["floating", props.placement, { "full-width": props.fullWidth }]]),
2953
- popover: unref(props.activatorEl) ? "auto" : void 0,
2908
+ popover: "auto",
2954
2909
  style: normalizeStyle({ "position-anchor": anchorName }),
2955
2910
  role: props.role,
2956
2911
  "aria-label": props.popoverAriaLabel,
@@ -2964,7 +2919,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2964
2919
  }
2965
2920
  });
2966
2921
 
2967
- const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-22bbe124"]]);
2922
+ const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9125d023"]]);
2968
2923
 
2969
2924
  const _hoisted_1$8 = { class: "kds-info-popover-content" };
2970
2925
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
@@ -2986,7 +2941,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2986
2941
 
2987
2942
  const InfoPopover = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-951f2a2b"]]);
2988
2943
 
2989
- const _hoisted_1$7 = ["aria-pressed"];
2944
+ const _hoisted_1$7 = ["aria-pressed", "aria-expanded", "aria-controls"];
2990
2945
  const TITLE = "Click for more information";
2991
2946
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2992
2947
  __name: "KdsInfoToggleButton",
@@ -3001,15 +2956,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3001
2956
  setup(__props) {
3002
2957
  const props = __props;
3003
2958
  const modelValue = useModel(__props, "modelValue");
3004
- const buttonEl = useTemplateRef("buttonEl");
2959
+ const popoverEl = useTemplateRef("popoverEl");
3005
2960
  const isHovered = ref(false);
3006
2961
  const isFocused = ref(false);
3007
2962
  return (_ctx, _cache) => {
3008
2963
  return openBlock(), createElementBlock(Fragment, null, [
3009
- createElementVNode("button", mergeProps({
3010
- ref_key: "buttonEl",
3011
- ref: buttonEl
3012
- }, _ctx.$attrs, {
2964
+ createElementVNode("button", mergeProps(_ctx.$attrs, {
3013
2965
  class: {
3014
2966
  "info-toggle-button": true,
3015
2967
  selected: modelValue.value,
@@ -3018,6 +2970,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3018
2970
  title: TITLE,
3019
2971
  "aria-label": TITLE,
3020
2972
  "aria-pressed": modelValue.value,
2973
+ "aria-expanded": modelValue.value,
2974
+ "aria-controls": popoverEl.value?.popoverId,
2975
+ "aria-haspopup": "dialog",
2976
+ style: popoverEl.value?.anchorStyle,
3021
2977
  type: "button",
3022
2978
  onClick: _cache[0] || (_cache[0] = ($event) => modelValue.value = !modelValue.value),
3023
2979
  onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
@@ -3031,9 +2987,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3031
2987
  })
3032
2988
  ], 16, _hoisted_1$7),
3033
2989
  createVNode(KdsPopover, {
2990
+ ref_key: "popoverEl",
2991
+ ref: popoverEl,
3034
2992
  modelValue: modelValue.value,
3035
2993
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => modelValue.value = $event),
3036
- "activator-el": buttonEl.value,
3037
2994
  placement: "top-right",
3038
2995
  "popover-aria-label": "Description"
3039
2996
  }, {
@@ -3048,13 +3005,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3048
3005
  }, 8, ["content"])
3049
3006
  ]),
3050
3007
  _: 3
3051
- }, 8, ["modelValue", "activator-el"])
3008
+ }, 8, ["modelValue"])
3052
3009
  ], 64);
3053
3010
  };
3054
3011
  }
3055
3012
  });
3056
3013
 
3057
- const KdsInfoToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-9c9e8369"]]);
3014
+ const KdsInfoToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-f98c9924"]]);
3058
3015
 
3059
3016
  const KdsInfoToggleButton$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3060
3017
  __proto__: null,
@@ -3081,7 +3038,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3081
3038
 
3082
3039
  const VariablePopover = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-54c206b9"]]);
3083
3040
 
3084
- const _hoisted_1$5 = ["title", "aria-label", "aria-pressed"];
3041
+ const _hoisted_1$5 = ["title", "aria-label", "aria-pressed", "aria-expanded", "aria-controls"];
3085
3042
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3086
3043
  __name: "KdsVariableToggleButton",
3087
3044
  props: /* @__PURE__ */ mergeModels({
@@ -3098,7 +3055,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3098
3055
  setup(__props) {
3099
3056
  const props = __props;
3100
3057
  const modelValue = useModel(__props, "modelValue");
3101
- const buttonEl = useTemplateRef("buttonEl");
3058
+ const popoverEl = useTemplateRef("popoverEl");
3102
3059
  const isHovered = ref(false);
3103
3060
  const isFocused = ref(false);
3104
3061
  const iconState = computed(() => {
@@ -3146,10 +3103,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3146
3103
  });
3147
3104
  return (_ctx, _cache) => {
3148
3105
  return openBlock(), createElementBlock(Fragment, null, [
3149
- createElementVNode("button", mergeProps({
3150
- ref_key: "buttonEl",
3151
- ref: buttonEl
3152
- }, _ctx.$attrs, {
3106
+ createElementVNode("button", mergeProps(_ctx.$attrs, {
3153
3107
  class: {
3154
3108
  "variable-toggle-button": true,
3155
3109
  error: props.error,
@@ -3159,6 +3113,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3159
3113
  title: title.value,
3160
3114
  "aria-label": title.value,
3161
3115
  "aria-pressed": modelValue.value,
3116
+ "aria-expanded": modelValue.value,
3117
+ "aria-controls": popoverEl.value?.popoverId,
3118
+ "aria-haspopup": "dialog",
3119
+ style: popoverEl.value?.anchorStyle,
3162
3120
  type: "button",
3163
3121
  onClick: _cache[0] || (_cache[0] = ($event) => modelValue.value = !modelValue.value),
3164
3122
  onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
@@ -3172,9 +3130,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3172
3130
  }, null, 8, ["name"])
3173
3131
  ], 16, _hoisted_1$5),
3174
3132
  createVNode(KdsPopover, {
3133
+ ref_key: "popoverEl",
3134
+ ref: popoverEl,
3175
3135
  modelValue: modelValue.value,
3176
3136
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => modelValue.value = $event),
3177
- "activator-el": buttonEl.value,
3178
3137
  placement: "bottom-right",
3179
3138
  "popover-aria-label": "Flow Variable settings"
3180
3139
  }, {
@@ -3189,13 +3148,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3189
3148
  }, 8, ["content"])
3190
3149
  ]),
3191
3150
  _: 3
3192
- }, 8, ["modelValue", "activator-el"])
3151
+ }, 8, ["modelValue"])
3193
3152
  ], 64);
3194
3153
  };
3195
3154
  }
3196
3155
  });
3197
3156
 
3198
- const KdsVariableToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ece95962"]]);
3157
+ const KdsVariableToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1541cbb3"]]);
3199
3158
 
3200
3159
  const _hoisted_1$4 = { class: "kds-empty-state" };
3201
3160
  const _hoisted_2$2 = { class: "kds-empty-state-headline" };
@@ -3695,19 +3654,5 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3695
3654
 
3696
3655
  const KdsDynamicModalProvider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-67e036b5"]]);
3697
3656
 
3698
- const kdsPopoverPlacement = {
3699
- TOP_LEFT: "top-left",
3700
- TOP_RIGHT: "top-right",
3701
- BOTTOM_LEFT: "bottom-left",
3702
- BOTTOM_RIGHT: "bottom-right"
3703
- };
3704
- const kdsPopoverPlacements = Object.values(kdsPopoverPlacement);
3705
- const kdsPopoverRole = {
3706
- DIALOG: "dialog",
3707
- MENU: "menu",
3708
- LISTBOX: "listbox"
3709
- };
3710
- const kdsPopoverRoles = Object.values(kdsPopoverRole);
3711
-
3712
- export { KdsAvatar, _sfc_main$t as KdsButton, KdsCardClickable, _sfc_main$m as KdsCheckbox, KdsCheckboxGroup, KdsColorSwatch, KdsDataType, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsLabel, _sfc_main$s as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsModal, KdsModalLayout, _sfc_main$e as KdsNumberInput, _sfc_main$d as KdsPatternInput, KdsPopover, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, _sfc_main$c as KdsSearchInput, KdsSubText, _sfc_main$b as KdsTextInput, KdsTextarea, _sfc_main$r as KdsToggleButton, KdsValueSwitch, KdsVariableToggleButton, kdsAvatarSize, kdsAvatarSizes, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
3657
+ export { KdsAvatar, _sfc_main$t as KdsButton, KdsCardClickable, _sfc_main$m as KdsCheckbox, KdsCheckboxGroup, KdsColorSwatch, KdsDataType, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsLabel, _sfc_main$s as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsModal, KdsModalLayout, _sfc_main$e as KdsNumberInput, _sfc_main$d as KdsPatternInput, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, _sfc_main$c as KdsSearchInput, KdsSubText, _sfc_main$b as KdsTextInput, KdsTextarea, _sfc_main$r as KdsToggleButton, KdsValueSwitch, KdsVariableToggleButton, kdsAvatarSize, kdsAvatarSizes, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
3713
3658
  //# sourceMappingURL=index.js.map