@knime/kds-components 0.5.4 → 0.5.5
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/forms/RadioButton/KdsRadioButton.vue.d.ts +15 -0
- package/dist/forms/RadioButton/KdsRadioButton.vue.d.ts.map +1 -0
- package/dist/forms/RadioButton/KdsRadioButtonGroup.vue.d.ts +3 -0
- package/dist/forms/RadioButton/KdsRadioButtonGroup.vue.d.ts.map +1 -0
- package/dist/forms/RadioButton/types.d.ts +23 -0
- package/dist/forms/RadioButton/types.d.ts.map +1 -0
- package/dist/forms/index.d.ts +3 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/types.d.ts +15 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/index.css +195 -55
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +313 -54
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const useIcon = ({
|
|
|
35
35
|
return iconComponent;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const _sfc_main$
|
|
38
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
39
39
|
__name: "KdsIcon",
|
|
40
40
|
props: {
|
|
41
41
|
name: {},
|
|
@@ -68,13 +68,13 @@ const _export_sfc = (sfc, props) => {
|
|
|
68
68
|
return target;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
71
|
+
const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-d965b88c"]]);
|
|
72
72
|
|
|
73
|
-
const _hoisted_1$
|
|
73
|
+
const _hoisted_1$8 = {
|
|
74
74
|
key: 1,
|
|
75
75
|
class: "label"
|
|
76
76
|
};
|
|
77
|
-
const _sfc_main$
|
|
77
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
78
78
|
__name: "BaseButton",
|
|
79
79
|
props: {
|
|
80
80
|
size: { default: "medium" },
|
|
@@ -127,7 +127,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
127
127
|
name: props.leadingIcon,
|
|
128
128
|
size: iconSize.value
|
|
129
129
|
}, null, 8, ["name", "size"])) : createCommentVNode("", true),
|
|
130
|
-
props.label ? (openBlock(), createElementBlock("span", _hoisted_1$
|
|
130
|
+
props.label ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(props.label), 1)) : createCommentVNode("", true),
|
|
131
131
|
props.trailingIcon && props.label ? (openBlock(), createBlock(KdsIcon, {
|
|
132
132
|
key: 2,
|
|
133
133
|
name: props.trailingIcon,
|
|
@@ -140,9 +140,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
143
|
+
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-dd209f83"]]);
|
|
144
144
|
|
|
145
|
-
const _sfc_main$
|
|
145
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
146
146
|
__name: "KdsButton",
|
|
147
147
|
props: {
|
|
148
148
|
size: {},
|
|
@@ -195,7 +195,7 @@ const resolveNuxtLinkComponent = () => {
|
|
|
195
195
|
return fallbackComponent;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
const _sfc_main$
|
|
198
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
199
199
|
__name: "KdsLinkButton",
|
|
200
200
|
props: {
|
|
201
201
|
size: {},
|
|
@@ -231,7 +231,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
const _sfc_main$
|
|
234
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
235
235
|
__name: "KdsToggleButton",
|
|
236
236
|
props: /* @__PURE__ */ mergeModels({
|
|
237
237
|
size: {},
|
|
@@ -260,15 +260,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
|
|
263
|
-
const _hoisted_1$
|
|
264
|
-
const _hoisted_2$
|
|
265
|
-
const _hoisted_3$
|
|
263
|
+
const _hoisted_1$7 = ["disabled", "aria-checked", "aria-describedby", "aria-invalid", "title"];
|
|
264
|
+
const _hoisted_2$4 = { class: "control" };
|
|
265
|
+
const _hoisted_3$4 = {
|
|
266
266
|
key: 0,
|
|
267
267
|
class: "content"
|
|
268
268
|
};
|
|
269
|
-
const _hoisted_4$
|
|
270
|
-
const _hoisted_5 = ["id"];
|
|
271
|
-
const _sfc_main$
|
|
269
|
+
const _hoisted_4$2 = { class: "label" };
|
|
270
|
+
const _hoisted_5$1 = ["id"];
|
|
271
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
272
272
|
__name: "KdsCheckbox",
|
|
273
273
|
props: {
|
|
274
274
|
modelValue: { type: [Boolean, String], default: false },
|
|
@@ -325,7 +325,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
325
325
|
role: "checkbox",
|
|
326
326
|
onClick: handleClick
|
|
327
327
|
}, [
|
|
328
|
-
createElementVNode("div", _hoisted_2$
|
|
328
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
329
329
|
icon.value ? (openBlock(), createBlock(KdsIcon, {
|
|
330
330
|
key: 0,
|
|
331
331
|
name: icon.value,
|
|
@@ -333,20 +333,20 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
333
333
|
size: "xsmall"
|
|
334
334
|
}, null, 8, ["name"])) : createCommentVNode("", true)
|
|
335
335
|
]),
|
|
336
|
-
props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
337
|
-
createElementVNode("div", _hoisted_4$
|
|
336
|
+
props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
|
|
337
|
+
createElementVNode("div", _hoisted_4$2, toDisplayString(props.label), 1),
|
|
338
338
|
props.helperText ? (openBlock(), createElementBlock("div", {
|
|
339
339
|
key: 0,
|
|
340
340
|
id: `${unref(id)}-helper`,
|
|
341
341
|
class: "helper-text"
|
|
342
|
-
}, toDisplayString(props.helperText), 9, _hoisted_5)) : createCommentVNode("", true)
|
|
342
|
+
}, toDisplayString(props.helperText), 9, _hoisted_5$1)) : createCommentVNode("", true)
|
|
343
343
|
])) : createCommentVNode("", true)
|
|
344
|
-
], 10, _hoisted_1$
|
|
344
|
+
], 10, _hoisted_1$7);
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
348
|
|
|
349
|
-
const KdsCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
349
|
+
const KdsCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-a0ec0f68"]]);
|
|
350
350
|
|
|
351
351
|
const ID_TO_ICON_MAP = {
|
|
352
352
|
// Flow Variables
|
|
@@ -492,8 +492,8 @@ const typeIconNames = [
|
|
|
492
492
|
"xml-datatype"
|
|
493
493
|
];
|
|
494
494
|
|
|
495
|
-
const _hoisted_1$
|
|
496
|
-
const _sfc_main$
|
|
495
|
+
const _hoisted_1$6 = ["title"];
|
|
496
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
497
497
|
__name: "KdsDataType",
|
|
498
498
|
props: {
|
|
499
499
|
iconName: { default: "unknown-datatype" },
|
|
@@ -533,12 +533,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
533
533
|
"aria-hidden": "true",
|
|
534
534
|
focusable: "false"
|
|
535
535
|
}, null, 8, ["class"]))
|
|
536
|
-
], 10, _hoisted_1$
|
|
536
|
+
], 10, _hoisted_1$6);
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
});
|
|
540
540
|
|
|
541
|
-
const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
541
|
+
const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-f7d93fdf"]]);
|
|
542
542
|
|
|
543
543
|
const modalLayoutPropsDefault = {
|
|
544
544
|
title: "",
|
|
@@ -554,14 +554,14 @@ const modalPropsDefault = {
|
|
|
554
554
|
...modalLayoutPropsDefault
|
|
555
555
|
};
|
|
556
556
|
|
|
557
|
-
const _hoisted_1$
|
|
558
|
-
const _hoisted_2$
|
|
559
|
-
const _hoisted_3$
|
|
560
|
-
const _hoisted_4 = {
|
|
557
|
+
const _hoisted_1$5 = { class: "modal-header" };
|
|
558
|
+
const _hoisted_2$3 = { class: "modal-header-title" };
|
|
559
|
+
const _hoisted_3$3 = ["data-variant"];
|
|
560
|
+
const _hoisted_4$1 = {
|
|
561
561
|
key: 0,
|
|
562
562
|
class: "modal-footer"
|
|
563
563
|
};
|
|
564
|
-
const _sfc_main$
|
|
564
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
565
565
|
...{ inheritAttrs: false },
|
|
566
566
|
__name: "KdsModalLayout",
|
|
567
567
|
props: /* @__PURE__ */ mergeDefaults({
|
|
@@ -578,14 +578,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
578
578
|
const props = __props;
|
|
579
579
|
return (_ctx, _cache) => {
|
|
580
580
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
581
|
-
createElementVNode("header", _hoisted_1$
|
|
581
|
+
createElementVNode("header", _hoisted_1$5, [
|
|
582
582
|
props.icon ? (openBlock(), createBlock(KdsIcon, {
|
|
583
583
|
key: 0,
|
|
584
584
|
name: props.icon,
|
|
585
585
|
size: "medium"
|
|
586
586
|
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
587
|
-
createElementVNode("div", _hoisted_2$
|
|
588
|
-
createVNode(_sfc_main$
|
|
587
|
+
createElementVNode("div", _hoisted_2$3, toDisplayString(props.title), 1),
|
|
588
|
+
createVNode(_sfc_main$a, {
|
|
589
589
|
"leading-icon": "x-close",
|
|
590
590
|
variant: "transparent",
|
|
591
591
|
size: "medium",
|
|
@@ -598,8 +598,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
598
598
|
"data-variant": __props.variant
|
|
599
599
|
}, [
|
|
600
600
|
renderSlot(_ctx.$slots, "body", {}, void 0, true)
|
|
601
|
-
], 8, _hoisted_3$
|
|
602
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4, [
|
|
601
|
+
], 8, _hoisted_3$3),
|
|
602
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4$1, [
|
|
603
603
|
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
604
604
|
])) : createCommentVNode("", true)
|
|
605
605
|
], 64);
|
|
@@ -607,10 +607,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
609
|
|
|
610
|
-
const KdsModalLayout = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
610
|
+
const KdsModalLayout = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c600bf4b"]]);
|
|
611
611
|
|
|
612
|
-
const _hoisted_1$
|
|
613
|
-
const _sfc_main$
|
|
612
|
+
const _hoisted_1$4 = ["closedby"];
|
|
613
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
614
614
|
__name: "KdsModal",
|
|
615
615
|
props: /* @__PURE__ */ mergeDefaults({
|
|
616
616
|
icon: {},
|
|
@@ -702,12 +702,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
702
702
|
_: 3
|
|
703
703
|
}, 8, ["title", "icon", "variant", "overflow"])
|
|
704
704
|
], true)
|
|
705
|
-
], 42, _hoisted_1$
|
|
705
|
+
], 42, _hoisted_1$4)) : createCommentVNode("", true);
|
|
706
706
|
};
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
709
|
|
|
710
|
-
const KdsModal = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
710
|
+
const KdsModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a80b4b47"]]);
|
|
711
711
|
|
|
712
712
|
const createUnwrappedPromise = () => {
|
|
713
713
|
let resolve = () => {
|
|
@@ -800,16 +800,16 @@ const useKdsDynamicModal = () => {
|
|
|
800
800
|
};
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
-
const _hoisted_1$
|
|
803
|
+
const _hoisted_1$3 = {
|
|
804
804
|
key: 1,
|
|
805
805
|
class: "confirmation"
|
|
806
806
|
};
|
|
807
|
-
const _hoisted_2 = { class: "message" };
|
|
808
|
-
const _hoisted_3 = {
|
|
807
|
+
const _hoisted_2$2 = { class: "message" };
|
|
808
|
+
const _hoisted_3$2 = {
|
|
809
809
|
key: 0,
|
|
810
810
|
class: "ask-again"
|
|
811
811
|
};
|
|
812
|
-
const _sfc_main$
|
|
812
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
813
813
|
__name: "KdsDynamicModalProvider",
|
|
814
814
|
setup(__props) {
|
|
815
815
|
const askAgain = ref(false);
|
|
@@ -862,9 +862,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
862
862
|
unref(config)?.type === "confirm" ? {
|
|
863
863
|
name: "body",
|
|
864
864
|
fn: withCtx(() => [
|
|
865
|
-
unref(internal).isTemplateBasedConfirm(unref(config).value) ? (openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
866
|
-
createElementVNode("div", _hoisted_2, toDisplayString(unref(config).value.message), 1),
|
|
867
|
-
unref(config).value.doNotAskAgain ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
865
|
+
unref(internal).isTemplateBasedConfirm(unref(config).value) ? (openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
866
|
+
createElementVNode("div", _hoisted_2$2, toDisplayString(unref(config).value.message), 1),
|
|
867
|
+
unref(config).value.doNotAskAgain ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
|
|
868
868
|
createVNode(KdsCheckbox, {
|
|
869
869
|
modelValue: askAgain.value,
|
|
870
870
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => askAgain.value = $event),
|
|
@@ -881,7 +881,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
881
881
|
name: "footer",
|
|
882
882
|
fn: withCtx(() => [
|
|
883
883
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(config).value.buttons, (button, index) => {
|
|
884
|
-
return openBlock(), createBlock(_sfc_main$
|
|
884
|
+
return openBlock(), createBlock(_sfc_main$a, {
|
|
885
885
|
key: index,
|
|
886
886
|
destructive: button.destructive,
|
|
887
887
|
autofocus: button.autofocus,
|
|
@@ -911,10 +911,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
911
911
|
}
|
|
912
912
|
});
|
|
913
913
|
|
|
914
|
-
const KdsDynamicModalProvider = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
914
|
+
const KdsDynamicModalProvider = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-bd3a851b"]]);
|
|
915
915
|
|
|
916
|
-
const _hoisted_1 = ["data-style"];
|
|
917
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
916
|
+
const _hoisted_1$2 = ["data-style"];
|
|
917
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
918
918
|
__name: "KdsLoadingSpinner",
|
|
919
919
|
props: {
|
|
920
920
|
size: { default: "medium" },
|
|
@@ -939,12 +939,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
939
939
|
cy: "60",
|
|
940
940
|
r: "50"
|
|
941
941
|
}, null, -1)
|
|
942
|
-
])], 10, _hoisted_1);
|
|
942
|
+
])], 10, _hoisted_1$2);
|
|
943
943
|
};
|
|
944
944
|
}
|
|
945
945
|
});
|
|
946
946
|
|
|
947
|
-
const KdsLoadingSpinner = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-13c830ad"]]);
|
|
947
|
+
const KdsLoadingSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-13c830ad"]]);
|
|
948
948
|
|
|
949
949
|
const KDS_DARK_MODE_STORAGE_KEY = "KNIME_DARK_MODE";
|
|
950
950
|
const defaultMode = "light";
|
|
@@ -1025,5 +1025,264 @@ const useKdsLegacyMode = (initialValue = false) => {
|
|
|
1025
1025
|
};
|
|
1026
1026
|
};
|
|
1027
1027
|
|
|
1028
|
-
|
|
1028
|
+
const _hoisted_1$1 = ["aria-checked", "aria-describedby", "aria-invalid", "disabled"];
|
|
1029
|
+
const _hoisted_2$1 = { class: "control" };
|
|
1030
|
+
const _hoisted_3$1 = {
|
|
1031
|
+
key: 0,
|
|
1032
|
+
class: "dot",
|
|
1033
|
+
viewBox: "0 0 2 2",
|
|
1034
|
+
"aria-hidden": "true",
|
|
1035
|
+
focusable: "false"
|
|
1036
|
+
};
|
|
1037
|
+
const _hoisted_4 = { class: "content" };
|
|
1038
|
+
const _hoisted_5 = { class: "label" };
|
|
1039
|
+
const _hoisted_6 = ["id"];
|
|
1040
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1041
|
+
__name: "KdsRadioButton",
|
|
1042
|
+
props: /* @__PURE__ */ mergeModels({
|
|
1043
|
+
text: {},
|
|
1044
|
+
helperText: {},
|
|
1045
|
+
disabled: { type: Boolean, default: false },
|
|
1046
|
+
error: { type: Boolean, default: false }
|
|
1047
|
+
}, {
|
|
1048
|
+
"modelValue": { type: Boolean, ...{ default: false } },
|
|
1049
|
+
"modelModifiers": {}
|
|
1050
|
+
}),
|
|
1051
|
+
emits: ["update:modelValue"],
|
|
1052
|
+
setup(__props) {
|
|
1053
|
+
const props = __props;
|
|
1054
|
+
const modelValue = useModel(__props, "modelValue");
|
|
1055
|
+
const id = useId();
|
|
1056
|
+
const handleClick = () => {
|
|
1057
|
+
if (props.disabled) {
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
if (!modelValue.value) {
|
|
1061
|
+
modelValue.value = true;
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
return (_ctx, _cache) => {
|
|
1065
|
+
return openBlock(), createElementBlock("button", {
|
|
1066
|
+
"aria-checked": modelValue.value,
|
|
1067
|
+
"aria-describedby": props.helperText ? `${unref(id)}-helper` : void 0,
|
|
1068
|
+
"aria-invalid": props.error,
|
|
1069
|
+
class: normalizeClass({
|
|
1070
|
+
radio: true,
|
|
1071
|
+
selected: modelValue.value,
|
|
1072
|
+
disabled: props.disabled,
|
|
1073
|
+
error: props.error
|
|
1074
|
+
}),
|
|
1075
|
+
disabled: props.disabled,
|
|
1076
|
+
role: "radio",
|
|
1077
|
+
type: "button",
|
|
1078
|
+
onClick: handleClick
|
|
1079
|
+
}, [
|
|
1080
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
1081
|
+
modelValue.value ? (openBlock(), createElementBlock("svg", _hoisted_3$1, [..._cache[0] || (_cache[0] = [
|
|
1082
|
+
createElementVNode("circle", {
|
|
1083
|
+
cx: "1",
|
|
1084
|
+
cy: "1",
|
|
1085
|
+
r: "1"
|
|
1086
|
+
}, null, -1)
|
|
1087
|
+
])])) : createCommentVNode("", true)
|
|
1088
|
+
]),
|
|
1089
|
+
createElementVNode("div", _hoisted_4, [
|
|
1090
|
+
createElementVNode("div", _hoisted_5, toDisplayString(props.text), 1),
|
|
1091
|
+
props.helperText ? (openBlock(), createElementBlock("div", {
|
|
1092
|
+
key: 0,
|
|
1093
|
+
id: `${unref(id)}-helper`,
|
|
1094
|
+
class: "helper-text"
|
|
1095
|
+
}, toDisplayString(props.helperText), 9, _hoisted_6)) : createCommentVNode("", true)
|
|
1096
|
+
])
|
|
1097
|
+
], 10, _hoisted_1$1);
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
const KdsRadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f6d4be71"]]);
|
|
1103
|
+
|
|
1104
|
+
const _hoisted_1 = ["id", "aria-labelledby", "aria-describedby"];
|
|
1105
|
+
const _hoisted_2 = ["id"];
|
|
1106
|
+
const _hoisted_3 = ["id"];
|
|
1107
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1108
|
+
__name: "KdsRadioButtonGroup",
|
|
1109
|
+
props: /* @__PURE__ */ mergeModels({
|
|
1110
|
+
possibleValues: {},
|
|
1111
|
+
alignment: { default: "vertical" },
|
|
1112
|
+
disabled: { type: Boolean, default: false },
|
|
1113
|
+
label: {},
|
|
1114
|
+
id: {},
|
|
1115
|
+
subText: {},
|
|
1116
|
+
preserveSubTextSpace: { type: Boolean }
|
|
1117
|
+
}, {
|
|
1118
|
+
"modelValue": {},
|
|
1119
|
+
"modelModifiers": {}
|
|
1120
|
+
}),
|
|
1121
|
+
emits: ["update:modelValue"],
|
|
1122
|
+
setup(__props) {
|
|
1123
|
+
const props = __props;
|
|
1124
|
+
const modelValue = useModel(__props, "modelValue");
|
|
1125
|
+
const possibleValues = computed(
|
|
1126
|
+
() => props.possibleValues.map((o) => {
|
|
1127
|
+
if (typeof o === "string") {
|
|
1128
|
+
return { text: o, id: o };
|
|
1129
|
+
}
|
|
1130
|
+
return o;
|
|
1131
|
+
})
|
|
1132
|
+
);
|
|
1133
|
+
const labelId = useId();
|
|
1134
|
+
const descriptionId = useId();
|
|
1135
|
+
const groupName = useId();
|
|
1136
|
+
const optionContainerEls = ref([]);
|
|
1137
|
+
const isOptionDisabled = (index) => props.disabled || possibleValues.value[index]?.disabled === true;
|
|
1138
|
+
const selectedIndex = computed(
|
|
1139
|
+
() => possibleValues.value.findIndex((option) => option.id === modelValue.value)
|
|
1140
|
+
);
|
|
1141
|
+
const firstEnabledIndex = computed(
|
|
1142
|
+
() => possibleValues.value.findIndex((_, index) => !isOptionDisabled(index))
|
|
1143
|
+
);
|
|
1144
|
+
const isHorizontal = computed(() => props.alignment === "horizontal");
|
|
1145
|
+
const anyOptionHasError = computed(
|
|
1146
|
+
() => possibleValues.value.some((o) => o.error)
|
|
1147
|
+
);
|
|
1148
|
+
const tabIndexForOption = (index) => {
|
|
1149
|
+
if (isOptionDisabled(index)) {
|
|
1150
|
+
return void 0;
|
|
1151
|
+
}
|
|
1152
|
+
if (selectedIndex.value >= 0) {
|
|
1153
|
+
return selectedIndex.value === index ? 0 : -1;
|
|
1154
|
+
}
|
|
1155
|
+
return firstEnabledIndex.value === index ? 0 : -1;
|
|
1156
|
+
};
|
|
1157
|
+
const focusOption = (index) => {
|
|
1158
|
+
const button = optionContainerEls.value[index]?.querySelector(
|
|
1159
|
+
'button[role="radio"]'
|
|
1160
|
+
);
|
|
1161
|
+
button?.focus();
|
|
1162
|
+
};
|
|
1163
|
+
const selectIndex = (index) => {
|
|
1164
|
+
if (isOptionDisabled(index)) {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
modelValue.value = possibleValues.value[index].id;
|
|
1168
|
+
};
|
|
1169
|
+
const nextEnabledIndex = (startIndex, direction) => {
|
|
1170
|
+
if (props.possibleValues.length === 0) {
|
|
1171
|
+
return -1;
|
|
1172
|
+
}
|
|
1173
|
+
let index = startIndex;
|
|
1174
|
+
for (let i = 0; i < props.possibleValues.length; i++) {
|
|
1175
|
+
index = (index + direction + props.possibleValues.length) % props.possibleValues.length;
|
|
1176
|
+
if (!isOptionDisabled(index)) {
|
|
1177
|
+
return index;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
return -1;
|
|
1181
|
+
};
|
|
1182
|
+
const moveSelection = (currentIndex, direction) => {
|
|
1183
|
+
const nextIndex = nextEnabledIndex(currentIndex, direction);
|
|
1184
|
+
if (nextIndex >= 0) {
|
|
1185
|
+
selectIndex(nextIndex);
|
|
1186
|
+
focusOption(nextIndex);
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
const goToFirstEnabled = () => {
|
|
1190
|
+
if (firstEnabledIndex.value >= 0) {
|
|
1191
|
+
selectIndex(firstEnabledIndex.value);
|
|
1192
|
+
focusOption(firstEnabledIndex.value);
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
const goToLastEnabled = () => {
|
|
1196
|
+
for (let i = props.possibleValues.length - 1; i >= 0; i--) {
|
|
1197
|
+
if (!isOptionDisabled(i)) {
|
|
1198
|
+
selectIndex(i);
|
|
1199
|
+
focusOption(i);
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
const handleKeyDown = (event, index) => {
|
|
1205
|
+
if (props.disabled) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
switch (event.key) {
|
|
1209
|
+
case "ArrowDown":
|
|
1210
|
+
case "ArrowRight": {
|
|
1211
|
+
event.preventDefault();
|
|
1212
|
+
moveSelection(index, 1);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
case "ArrowUp":
|
|
1216
|
+
case "ArrowLeft": {
|
|
1217
|
+
event.preventDefault();
|
|
1218
|
+
moveSelection(index, -1);
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
case "Home": {
|
|
1222
|
+
event.preventDefault();
|
|
1223
|
+
goToFirstEnabled();
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
case "End": {
|
|
1227
|
+
event.preventDefault();
|
|
1228
|
+
goToLastEnabled();
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
case " ":
|
|
1232
|
+
case "Enter": {
|
|
1233
|
+
event.preventDefault();
|
|
1234
|
+
selectIndex(index);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
return (_ctx, _cache) => {
|
|
1239
|
+
return openBlock(), createElementBlock("div", {
|
|
1240
|
+
id: props.id,
|
|
1241
|
+
class: "radio-button-group",
|
|
1242
|
+
role: "radiogroup",
|
|
1243
|
+
"aria-labelledby": props.label ? unref(labelId) : void 0,
|
|
1244
|
+
"aria-describedby": props.subText ? unref(descriptionId) : void 0
|
|
1245
|
+
}, [
|
|
1246
|
+
props.label ? (openBlock(), createElementBlock("div", {
|
|
1247
|
+
key: 0,
|
|
1248
|
+
id: unref(labelId),
|
|
1249
|
+
class: "label"
|
|
1250
|
+
}, toDisplayString(props.label), 9, _hoisted_2)) : createCommentVNode("", true),
|
|
1251
|
+
createElementVNode("div", {
|
|
1252
|
+
class: normalizeClass({ options: true, horizontal: isHorizontal.value })
|
|
1253
|
+
}, [
|
|
1254
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(possibleValues.value, (option, index) => {
|
|
1255
|
+
return openBlock(), createElementBlock("div", {
|
|
1256
|
+
key: option.id,
|
|
1257
|
+
ref_for: true,
|
|
1258
|
+
ref: (el) => optionContainerEls.value[index] = el,
|
|
1259
|
+
class: "option"
|
|
1260
|
+
}, [
|
|
1261
|
+
createVNode(KdsRadioButton, {
|
|
1262
|
+
disabled: props.disabled || option.disabled,
|
|
1263
|
+
error: option.error,
|
|
1264
|
+
"helper-text": option.helperText,
|
|
1265
|
+
text: option.text,
|
|
1266
|
+
"model-value": modelValue.value === option.id,
|
|
1267
|
+
tabindex: tabIndexForOption(index),
|
|
1268
|
+
name: unref(groupName),
|
|
1269
|
+
onKeydown: (e) => handleKeyDown(e, index),
|
|
1270
|
+
"onUpdate:modelValue": () => selectIndex(index)
|
|
1271
|
+
}, null, 8, ["disabled", "error", "helper-text", "text", "model-value", "tabindex", "name", "onKeydown", "onUpdate:modelValue"])
|
|
1272
|
+
]);
|
|
1273
|
+
}), 128))
|
|
1274
|
+
], 2),
|
|
1275
|
+
props.subText || props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", {
|
|
1276
|
+
key: 1,
|
|
1277
|
+
id: unref(descriptionId),
|
|
1278
|
+
class: normalizeClass({ subtext: true, error: anyOptionHasError.value })
|
|
1279
|
+
}, toDisplayString(props.subText), 11, _hoisted_3)) : createCommentVNode("", true)
|
|
1280
|
+
], 8, _hoisted_1);
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
const KdsRadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fd7ae250"]]);
|
|
1286
|
+
|
|
1287
|
+
export { _sfc_main$a as KdsButton, KdsCheckbox, KdsDataType, KdsDynamicModalProvider, KdsIcon, _sfc_main$9 as KdsLinkButton, KdsLoadingSpinner, KdsModal, KdsModalLayout, KdsRadioButtonGroup, _sfc_main$8 as KdsToggleButton, useKdsDarkMode, useKdsDynamicModal, useKdsLegacyMode };
|
|
1029
1288
|
//# sourceMappingURL=index.js.map
|