@knime/kds-components 0.23.0 → 0.23.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.
package/dist/index.js CHANGED
@@ -1091,11 +1091,22 @@ const resolveNuxtLinkComponent = () => {
1091
1091
  return fallbackComponent;
1092
1092
  };
1093
1093
 
1094
+ function isExternalUrl(url) {
1095
+ const normalized = url.trim();
1096
+ if (!normalized) {
1097
+ return false;
1098
+ }
1099
+ if (normalized.startsWith("#") || normalized.startsWith("/") && !normalized.startsWith("//") || normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("?")) {
1100
+ return false;
1101
+ }
1102
+ return true;
1103
+ }
1104
+
1094
1105
  const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1095
1106
  __name: "KdsLinkButton",
1096
1107
  props: {
1097
1108
  size: {},
1098
- disabled: { type: Boolean },
1109
+ disabled: { type: Boolean, default: false },
1099
1110
  title: {},
1100
1111
  variant: { default: "filled" },
1101
1112
  label: {},
@@ -1110,23 +1121,33 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1110
1121
  },
1111
1122
  emits: ["click"],
1112
1123
  setup(__props, { emit: __emit }) {
1113
- const props = createPropsRestProxy(__props, ["variant", "download", "rel", "target"]);
1124
+ const rawProps = createPropsRestProxy(__props, ["variant", "disabled", "download", "rel", "target"]);
1125
+ const props = computed(() => {
1126
+ if (isExternalUrl(rawProps.to)) {
1127
+ return {
1128
+ ...rawProps,
1129
+ trailingIcon: "external-link"
1130
+ };
1131
+ }
1132
+ return rawProps;
1133
+ });
1114
1134
  const component = computed(() => {
1115
- if (props.disabled) {
1135
+ if (__props.disabled) {
1116
1136
  return "button";
1117
1137
  }
1118
1138
  return resolveNuxtLinkComponent();
1119
1139
  });
1120
1140
  const emit = __emit;
1121
1141
  return (_ctx, _cache) => {
1122
- return openBlock(), createBlock(BaseButton, mergeProps(props, {
1142
+ return openBlock(), createBlock(BaseButton, mergeProps(props.value, {
1123
1143
  variant: __props.variant,
1144
+ disabled: __props.disabled,
1124
1145
  download: __props.download,
1125
1146
  rel: __props.rel,
1126
1147
  target: __props.target,
1127
1148
  component: component.value,
1128
1149
  onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
1129
- }), null, 16, ["variant", "download", "rel", "target", "component"]);
1150
+ }), null, 16, ["variant", "disabled", "download", "rel", "target", "component"]);
1130
1151
  };
1131
1152
  }
1132
1153
  });
@@ -1331,21 +1352,11 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1331
1352
  setup(__props, { emit: __emit }) {
1332
1353
  const emit = __emit;
1333
1354
  const linkComponent = resolveNuxtLinkComponent();
1334
- function inferVariantFromTo(to) {
1335
- const normalized = to.trim();
1336
- if (!normalized) {
1337
- return "internal";
1338
- }
1339
- if (normalized.startsWith("#") || normalized.startsWith("/") && !normalized.startsWith("//") || normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("?")) {
1340
- return "internal";
1341
- }
1342
- return "external";
1343
- }
1344
1355
  const variant = computed(() => {
1345
1356
  if (__props.download || __props.fileSize !== void 0) {
1346
1357
  return "document";
1347
1358
  }
1348
- return inferVariantFromTo(__props.to);
1359
+ return isExternalUrl(__props.to) ? "external" : "internal";
1349
1360
  });
1350
1361
  const effectiveTarget = computed(
1351
1362
  () => __props.target ?? (variant.value === "external" ? "_blank" : void 0)
@@ -1429,7 +1440,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1429
1440
  }
1430
1441
  });
1431
1442
 
1432
- const KdsLink = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["__scopeId", "data-v-65e776f1"]]);
1443
+ const KdsLink = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["__scopeId", "data-v-56e748a8"]]);
1433
1444
 
1434
1445
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
1435
1446
  __name: "KdsToggleButton",
@@ -1558,7 +1569,7 @@ const kdsProgressButtonState = {
1558
1569
  };
1559
1570
  const kdsProgressButtonStates = Object.values(kdsProgressButtonState);
1560
1571
 
1561
- const _hoisted_1$F = { class: "kds-empty-state" };
1572
+ const _hoisted_1$F = ["aria-disabled"];
1562
1573
  const _hoisted_2$o = { class: "kds-empty-state-headline" };
1563
1574
  const _hoisted_3$h = {
1564
1575
  key: 1,
@@ -1573,12 +1584,14 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
1573
1584
  props: {
1574
1585
  headline: {},
1575
1586
  description: {},
1587
+ loadingSpinner: { type: Boolean },
1588
+ disabled: { type: Boolean, default: false },
1576
1589
  button: {},
1577
- loadingSpinner: { type: Boolean }
1590
+ secondaryButton: {}
1578
1591
  },
1579
- emits: ["buttonClick"],
1592
+ emits: ["buttonClick", "secondaryButtonClick"],
1580
1593
  setup(__props, { emit: __emit }) {
1581
- const props = __props;
1594
+ const props = createPropsRestProxy(__props, ["disabled"]);
1582
1595
  const emit = __emit;
1583
1596
  const isLinkButton = computed(
1584
1597
  () => props.button && "to" in props.button && props.button.to !== void 0
@@ -1586,8 +1599,17 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
1586
1599
  const buttonComponent = computed(
1587
1600
  () => isLinkButton.value ? _sfc_main$13 : _sfc_main$14
1588
1601
  );
1602
+ const isSecondaryLinkButton = computed(
1603
+ () => props.secondaryButton && "to" in props.secondaryButton && props.secondaryButton.to !== void 0
1604
+ );
1605
+ const secondaryButtonComponent = computed(
1606
+ () => isSecondaryLinkButton.value ? _sfc_main$13 : _sfc_main$14
1607
+ );
1589
1608
  return (_ctx, _cache) => {
1590
- return openBlock(), createElementBlock("div", _hoisted_1$F, [
1609
+ return openBlock(), createElementBlock("div", {
1610
+ class: normalizeClass(["kds-empty-state", { disabled: __props.disabled }]),
1611
+ "aria-disabled": __props.disabled || void 0
1612
+ }, [
1591
1613
  props.loadingSpinner ? (openBlock(), createBlock(KdsLoadingSpinner, {
1592
1614
  key: 0,
1593
1615
  "data-testid": "loading-spinner",
@@ -1599,15 +1621,20 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
1599
1621
  props.description ? (openBlock(), createElementBlock("p", _hoisted_3$h, toDisplayString(props.description), 1)) : createCommentVNode("", true),
1600
1622
  props.button ? (openBlock(), createElementBlock("div", _hoisted_4$d, [
1601
1623
  (openBlock(), createBlock(resolveDynamicComponent(buttonComponent.value), mergeProps(props.button, {
1602
- onClick: _cache[0] || (_cache[0] = ($event) => emit("buttonClick", $event))
1603
- }), null, 16))
1624
+ disabled: props.button?.disabled || __props.disabled,
1625
+ onClick: _cache[0] || (_cache[0] = ($event) => !__props.disabled && emit("buttonClick", $event))
1626
+ }), null, 16, ["disabled"])),
1627
+ props.secondaryButton ? (openBlock(), createBlock(resolveDynamicComponent(secondaryButtonComponent.value), mergeProps({ key: 0 }, props.secondaryButton, {
1628
+ disabled: props.secondaryButton?.disabled || __props.disabled,
1629
+ onClick: _cache[1] || (_cache[1] = ($event) => !__props.disabled && emit("secondaryButtonClick", $event))
1630
+ }), null, 16, ["disabled"])) : createCommentVNode("", true)
1604
1631
  ])) : createCommentVNode("", true)
1605
- ]);
1632
+ ], 10, _hoisted_1$F);
1606
1633
  };
1607
1634
  }
1608
1635
  });
1609
1636
 
1610
- const KdsEmptyState = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__scopeId", "data-v-5da4d570"]]);
1637
+ const KdsEmptyState = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__scopeId", "data-v-e913660a"]]);
1611
1638
 
1612
1639
  const _sfc_main$_ = /* @__PURE__ */ defineComponent({
1613
1640
  __name: "ListItemAccessory",
@@ -1775,7 +1802,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
1775
1802
  }
1776
1803
  });
1777
1804
 
1778
- const KdsListItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__scopeId", "data-v-822789ec"]]);
1805
+ const KdsListItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__scopeId", "data-v-e3517d34"]]);
1779
1806
 
1780
1807
  const _sfc_main$Y = { };
1781
1808
 
@@ -1784,7 +1811,7 @@ const _hoisted_1$D = { class: "kds-list-item-divider" };
1784
1811
  function _sfc_render$8(_ctx, _cache) {
1785
1812
  return (openBlock(), createElementBlock("hr", _hoisted_1$D))
1786
1813
  }
1787
- const ListItemDivider = /*#__PURE__*/_export_sfc$1(_sfc_main$Y, [['render',_sfc_render$8],['__scopeId',"data-v-3ee92695"]]);
1814
+ const ListItemDivider = /*#__PURE__*/_export_sfc$1(_sfc_main$Y, [['render',_sfc_render$8],['__scopeId',"data-v-48d01ed1"]]);
1788
1815
 
1789
1816
  const _hoisted_1$C = { class: "kds-list-item-section-title" };
1790
1817
  const _hoisted_2$m = {
@@ -1821,7 +1848,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
1821
1848
  }
1822
1849
  });
1823
1850
 
1824
- const ListItemSectionTitle = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["__scopeId", "data-v-53382531"]]);
1851
+ const ListItemSectionTitle = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["__scopeId", "data-v-14b9ee99"]]);
1825
1852
 
1826
1853
  const _hoisted_1$B = ["role", "aria-busy", "aria-label", "aria-activedescendant", "tabindex"];
1827
1854
  const _hoisted_2$l = ["role"];
@@ -16109,9 +16136,12 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
16109
16136
  const KdsListItemButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__scopeId", "data-v-13945d12"]]);
16110
16137
 
16111
16138
  const _hoisted_1$j = { class: "kds-multi-select-dropdown-options" };
16112
- const _hoisted_2$8 = { class: "kds-multi-select-dropdown-search" };
16113
- const _hoisted_3$7 = {
16139
+ const _hoisted_2$8 = {
16114
16140
  key: 0,
16141
+ class: "kds-multi-select-dropdown-search"
16142
+ };
16143
+ const _hoisted_3$7 = {
16144
+ key: 1,
16115
16145
  class: "kds-multi-select-dropdown-footer"
16116
16146
  };
16117
16147
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
@@ -16150,6 +16180,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
16150
16180
  (option) => option.text.toLowerCase().includes(normalizedQuery)
16151
16181
  );
16152
16182
  });
16183
+ const searchable = computed(() => {
16184
+ return __props.allowNewValues || props.possibleValues.length >= DROPDOWN_SEARCH_THRESHOLD;
16185
+ });
16153
16186
  const canAddNewValue = computed(() => {
16154
16187
  const trimmed = searchValue.value.trim();
16155
16188
  if (!__props.allowNewValues || trimmed.length === 0) {
@@ -16226,19 +16259,23 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
16226
16259
  __expose({
16227
16260
  focus: () => {
16228
16261
  initialSelectedIds.value = new Set(modelValue.value);
16229
- searchEl.value?.focus();
16262
+ if (searchable.value) {
16263
+ searchEl.value?.focus();
16264
+ } else {
16265
+ listContainerRef.value?.focus();
16266
+ }
16230
16267
  }
16231
16268
  });
16232
16269
  return (_ctx, _cache) => {
16233
16270
  return openBlock(), createElementBlock("div", _hoisted_1$j, [
16234
- createElementVNode("div", _hoisted_2$8, [
16271
+ searchable.value ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
16235
16272
  createVNode(BaseInput, {
16236
16273
  ref_key: "searchEl",
16237
16274
  ref: searchEl,
16238
16275
  modelValue: searchValue.value,
16239
16276
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
16240
16277
  type: "search",
16241
- placeholder: "Search",
16278
+ placeholder: __props.allowNewValues ? "Search or add new" : "Search",
16242
16279
  "aria-label": "Filter options",
16243
16280
  "aria-activedescendant": listContainerRef.value?.activeDescendant,
16244
16281
  "leading-icon": "search",
@@ -16246,8 +16283,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
16246
16283
  onKeydown: _cache[1] || (_cache[1] = ($event) => listContainerRef.value?.handleKeydown($event)),
16247
16284
  onFocus: _cache[2] || (_cache[2] = ($event) => listContainerRef.value?.handleFocus()),
16248
16285
  onBlur: _cache[3] || (_cache[3] = ($event) => listContainerRef.value?.handleBlur())
16249
- }, null, 8, ["modelValue", "aria-activedescendant"])
16250
- ]),
16286
+ }, null, 8, ["modelValue", "placeholder", "aria-activedescendant"])
16287
+ ])) : createCommentVNode("", true),
16251
16288
  createVNode(unref(KdsListContainer), {
16252
16289
  ref: "listContainer",
16253
16290
  class: normalizeClass(["kds-multi-select-dropdown-list", {
@@ -16256,10 +16293,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
16256
16293
  "possible-values": __props.loading ? [] : listOptions.value,
16257
16294
  loading: __props.loading,
16258
16295
  "empty-text": props.emptyText,
16259
- "controlled-externally": "",
16296
+ "controlled-externally": searchable.value,
16260
16297
  "aria-label": "Dropdown options",
16261
16298
  onItemClick: _cache[4] || (_cache[4] = ($event) => $event !== void 0 && onItemClick($event))
16262
- }, null, 8, ["class", "possible-values", "loading", "empty-text"]),
16299
+ }, null, 8, ["class", "possible-values", "loading", "empty-text", "controlled-externally"]),
16263
16300
  !__props.loading && visibleEnabledIds.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
16264
16301
  createVNode(unref(KdsListItemButton), {
16265
16302
  label: anyVisibleSelected.value ? "Clear all" : "Select all",
@@ -16273,7 +16310,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
16273
16310
  }
16274
16311
  });
16275
16312
 
16276
- const MultiSelectDropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__scopeId", "data-v-9b631765"]]);
16313
+ const MultiSelectDropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__scopeId", "data-v-3cac8f74"]]);
16277
16314
 
16278
16315
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
16279
16316
  __name: "KdsMultiSelectDropdown",
@@ -17137,8 +17174,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
17137
17174
  visiblePossibleValues.value.length === 0 && !visibleBottomValue.value ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
17138
17175
  createVNode(KdsEmptyState, {
17139
17176
  headline: __props.loading ? "Loading data…" : __props.emptyStateLabel,
17140
- "loading-spinner": __props.loading
17141
- }, null, 8, ["headline", "loading-spinner"])
17177
+ "loading-spinner": __props.loading,
17178
+ disabled: __props.disabled
17179
+ }, null, 8, ["headline", "loading-spinner", "disabled"])
17142
17180
  ])) : createCommentVNode("", true)
17143
17181
  ], 6)
17144
17182
  ]),
@@ -17151,7 +17189,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
17151
17189
  }
17152
17190
  });
17153
17191
 
17154
- const KdsMultiSelectListBox = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-24af1af0"]]);
17192
+ const KdsMultiSelectListBox = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-a95bec6e"]]);
17155
17193
 
17156
17194
  const _hoisted_1$f = { class: "kds-list-column" };
17157
17195
  const _hoisted_2$5 = { class: "kds-list-header" };