@code-coaching/vuetiful 0.12.0 → 0.12.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/style.css +1 -1
- package/dist/styles/all.css +693 -52
- package/dist/types/components/atoms/VRadioGroup.vue.d.ts +32 -0
- package/dist/types/components/atoms/VRadioItem.vue.d.ts +12 -0
- package/dist/types/components/atoms/index.d.ts +3 -1
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/molecules/VDrawer.vue.d.ts +1 -1
- package/dist/types/utils/code-block/VCodeBlock.vue.d.ts +1 -1
- package/dist/vuetiful.es.mjs +198 -14
- package/dist/vuetiful.umd.js +10 -10
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
name: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
labelledby: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
name: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
labelledby: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
}>> & {
|
|
28
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
labelledby: string;
|
|
31
|
+
}>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
value: {
|
|
3
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
value: {
|
|
8
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
}>>, {}>;
|
|
12
|
+
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import VBadge from "./VBadge.vue";
|
|
2
2
|
import VButton from "./VButton.vue";
|
|
3
3
|
import VChip from "./VChip.vue";
|
|
4
|
-
|
|
4
|
+
import VRadioGroup from "./VRadioGroup.vue";
|
|
5
|
+
import VRadioItem from "./VRadioItem.vue";
|
|
6
|
+
export { VButton, VBadge, VChip, VRadioGroup, VRadioItem };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { VBadge, VButton, VChip } from "./atoms";
|
|
1
|
+
import { VBadge, VButton, VChip, VRadioGroup, VRadioItem } from "./atoms";
|
|
2
2
|
import { VDrawer, VRail, VRailTile, VShell } from "./molecules";
|
|
3
|
-
export { VButton, VRail, VRailTile, VShell, VDrawer, VBadge, VChip };
|
|
3
|
+
export { VButton, VRail, VRailTile, VShell, VDrawer, VBadge, VChip, VRadioGroup, VRadioItem };
|
package/dist/vuetiful.es.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { openBlock, createElementBlock, renderSlot, normalizeClass, defineComponent, createBlock, resolveDynamicComponent, withCtx, ref,
|
|
1
|
+
import { openBlock, createElementBlock, renderSlot, normalizeClass, defineComponent, createBlock, resolveDynamicComponent, withCtx, ref, provide, watch, inject, computed, createElementVNode, unref, withDirectives, isRef, vModelRadio, reactive, readonly, toRefs, onMounted, Fragment, createVNode, Transition, createCommentVNode, useAttrs, mergeProps, toDisplayString, createTextVNode, resolveComponent, renderList, pushScopeId, popScopeId } from "vue";
|
|
2
2
|
var _export_sfc = (sfc, props) => {
|
|
3
3
|
const target = sfc.__vccOpts || sfc;
|
|
4
4
|
for (const [key, val] of props) {
|
|
@@ -6,17 +6,17 @@ var _export_sfc = (sfc, props) => {
|
|
|
6
6
|
}
|
|
7
7
|
return target;
|
|
8
8
|
};
|
|
9
|
-
const _sfc_main$
|
|
10
|
-
const _hoisted_1$
|
|
9
|
+
const _sfc_main$b = {};
|
|
10
|
+
const _hoisted_1$8 = {
|
|
11
11
|
class: /* @__PURE__ */ normalizeClass(`vuetiful-badge badge`)
|
|
12
12
|
};
|
|
13
13
|
function _sfc_render$3(_ctx, _cache) {
|
|
14
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
14
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
15
15
|
renderSlot(_ctx.$slots, "default")
|
|
16
16
|
]);
|
|
17
17
|
}
|
|
18
|
-
var VBadge = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
19
|
-
const _sfc_main$
|
|
18
|
+
var VBadge = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$3]]);
|
|
19
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
20
20
|
__name: "VButton",
|
|
21
21
|
props: {
|
|
22
22
|
icon: {
|
|
@@ -66,16 +66,198 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
const _sfc_main$
|
|
70
|
-
const _hoisted_1$
|
|
69
|
+
const _sfc_main$9 = {};
|
|
70
|
+
const _hoisted_1$7 = {
|
|
71
71
|
class: /* @__PURE__ */ normalizeClass(`vuetiful-chip chip`)
|
|
72
72
|
};
|
|
73
73
|
function _sfc_render$2(_ctx, _cache) {
|
|
74
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
74
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
75
75
|
renderSlot(_ctx.$slots, "default")
|
|
76
76
|
]);
|
|
77
77
|
}
|
|
78
|
-
var VChip = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
78
|
+
var VChip = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$2]]);
|
|
79
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
80
|
+
__name: "VRadioGroup",
|
|
81
|
+
props: {
|
|
82
|
+
name: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
86
|
+
modelValue: {
|
|
87
|
+
type: [String, Number],
|
|
88
|
+
required: true
|
|
89
|
+
},
|
|
90
|
+
labelledby: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: ""
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
emits: ["update:modelValue"],
|
|
96
|
+
setup(__props, { emit: emits }) {
|
|
97
|
+
const props = __props;
|
|
98
|
+
const radioGroupRef = ref();
|
|
99
|
+
const selectedOption = ref(props.modelValue);
|
|
100
|
+
provide("selectedOption", selectedOption);
|
|
101
|
+
provide("name", props.name);
|
|
102
|
+
provide("radioGroup", radioGroupRef);
|
|
103
|
+
watch(selectedOption, (newVal) => {
|
|
104
|
+
emits("update:modelValue", newVal);
|
|
105
|
+
});
|
|
106
|
+
return (_ctx, _cache) => {
|
|
107
|
+
return openBlock(), createElementBlock("div", {
|
|
108
|
+
ref_key: "radioGroupRef",
|
|
109
|
+
ref: radioGroupRef,
|
|
110
|
+
role: "radiogroup",
|
|
111
|
+
class: "radio-group inline-flex space-x-1 p-1 bg-surface-200-700-token border-token border-surface-400-500-token rounded-token",
|
|
112
|
+
tabindex: "-1"
|
|
113
|
+
}, [
|
|
114
|
+
renderSlot(_ctx.$slots, "default")
|
|
115
|
+
], 512);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const _hoisted_1$6 = ["aria-checked", "tabindex", "name"];
|
|
120
|
+
const _hoisted_2$4 = { class: "h-0 w-0 overflow-hidden" };
|
|
121
|
+
const _hoisted_3$2 = ["name", "value"];
|
|
122
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
123
|
+
__name: "VRadioItem",
|
|
124
|
+
props: {
|
|
125
|
+
value: {
|
|
126
|
+
type: [String, Number],
|
|
127
|
+
required: true
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
setup(__props) {
|
|
131
|
+
const props = __props;
|
|
132
|
+
const radioGroup = inject("radioGroup");
|
|
133
|
+
const selectedOption = inject("selectedOption");
|
|
134
|
+
const name = inject("name");
|
|
135
|
+
const id = `radio-${Math.random().toString(36).substring(2, 9)}`;
|
|
136
|
+
const isFirst = computed(() => {
|
|
137
|
+
var _a, _b;
|
|
138
|
+
const idOfFirstChild = (_b = (_a = radioGroup.value) == null ? void 0 : _a.children[0].querySelector("input")) == null ? void 0 : _b.id;
|
|
139
|
+
return idOfFirstChild === id;
|
|
140
|
+
});
|
|
141
|
+
const checked = computed(() => {
|
|
142
|
+
return selectedOption.value === props.value;
|
|
143
|
+
});
|
|
144
|
+
const tabbable = computed(() => {
|
|
145
|
+
if (!selectedOption.value)
|
|
146
|
+
return isFirst.value ? 0 : -1;
|
|
147
|
+
return selectedOption.value === props.value ? 0 : -1;
|
|
148
|
+
});
|
|
149
|
+
const setChecked = (target) => {
|
|
150
|
+
const input = target.querySelector("input");
|
|
151
|
+
input == null ? void 0 : input.click();
|
|
152
|
+
input == null ? void 0 : input.focus();
|
|
153
|
+
};
|
|
154
|
+
const setCheckedToNextItem = (target) => {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
const activeId = (_a = target.querySelector("input")) == null ? void 0 : _a.id;
|
|
157
|
+
const children = (_b = radioGroup.value) == null ? void 0 : _b.children;
|
|
158
|
+
const activeChild = Array.from(children).find((child) => {
|
|
159
|
+
const input2 = child.querySelector("input");
|
|
160
|
+
return (input2 == null ? void 0 : input2.id) === activeId;
|
|
161
|
+
});
|
|
162
|
+
const firstchild = children[0];
|
|
163
|
+
const isLast = activeChild === children[children.length - 1];
|
|
164
|
+
if (isLast) {
|
|
165
|
+
const input2 = firstchild.querySelector("input");
|
|
166
|
+
if (input2) {
|
|
167
|
+
input2.click();
|
|
168
|
+
input2.focus();
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const nextChild = activeChild == null ? void 0 : activeChild.nextElementSibling;
|
|
173
|
+
const input = nextChild == null ? void 0 : nextChild.querySelector("input");
|
|
174
|
+
if (input) {
|
|
175
|
+
input.click();
|
|
176
|
+
input.focus();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const setCheckedToPreviousItem = (target) => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
const activeId = (_a = target.querySelector("input")) == null ? void 0 : _a.id;
|
|
182
|
+
const children = (_b = radioGroup.value) == null ? void 0 : _b.children;
|
|
183
|
+
const activeChild = Array.from(children).find((child) => {
|
|
184
|
+
const input2 = child.querySelector("input");
|
|
185
|
+
return (input2 == null ? void 0 : input2.id) === activeId;
|
|
186
|
+
});
|
|
187
|
+
const lastchild = children[children.length - 1];
|
|
188
|
+
const isFirst2 = activeChild === children[0];
|
|
189
|
+
if (isFirst2) {
|
|
190
|
+
const input2 = lastchild.querySelector("input");
|
|
191
|
+
if (input2) {
|
|
192
|
+
input2.click();
|
|
193
|
+
input2.focus();
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const previousChild = activeChild == null ? void 0 : activeChild.previousElementSibling;
|
|
198
|
+
const input = previousChild == null ? void 0 : previousChild.querySelector("input");
|
|
199
|
+
if (input) {
|
|
200
|
+
input.click();
|
|
201
|
+
input.focus();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const handleKeydown = (event) => {
|
|
205
|
+
const target = event.currentTarget;
|
|
206
|
+
let flag = false;
|
|
207
|
+
switch (event.key) {
|
|
208
|
+
case " ":
|
|
209
|
+
case "Enter":
|
|
210
|
+
setChecked(target);
|
|
211
|
+
flag = true;
|
|
212
|
+
break;
|
|
213
|
+
case "Up":
|
|
214
|
+
case "ArrowUp":
|
|
215
|
+
case "Left":
|
|
216
|
+
case "ArrowLeft":
|
|
217
|
+
setCheckedToPreviousItem(target);
|
|
218
|
+
flag = true;
|
|
219
|
+
break;
|
|
220
|
+
case "Down":
|
|
221
|
+
case "ArrowDown":
|
|
222
|
+
case "Right":
|
|
223
|
+
case "ArrowRight":
|
|
224
|
+
setCheckedToNextItem(target);
|
|
225
|
+
flag = true;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (flag) {
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
return (_ctx, _cache) => {
|
|
234
|
+
return openBlock(), createElementBlock("label", { for: id }, [
|
|
235
|
+
createElementVNode("div", {
|
|
236
|
+
class: normalizeClass(`radio-item cursor-pointer px-4 py-1 text-center text-base rounded-token ${unref(checked) ? "variant-filled" : "hover:variant-soft"} `),
|
|
237
|
+
role: "radio",
|
|
238
|
+
"aria-checked": unref(checked),
|
|
239
|
+
tabindex: unref(tabbable),
|
|
240
|
+
name: unref(name),
|
|
241
|
+
onKeydown: handleKeydown
|
|
242
|
+
}, [
|
|
243
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
244
|
+
withDirectives(createElementVNode("input", {
|
|
245
|
+
tabindex: "-1",
|
|
246
|
+
type: "radio",
|
|
247
|
+
id,
|
|
248
|
+
name: unref(name),
|
|
249
|
+
value: __props.value,
|
|
250
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null)
|
|
251
|
+
}, null, 8, _hoisted_3$2), [
|
|
252
|
+
[vModelRadio, unref(selectedOption)]
|
|
253
|
+
])
|
|
254
|
+
]),
|
|
255
|
+
renderSlot(_ctx.$slots, "default")
|
|
256
|
+
], 42, _hoisted_1$6)
|
|
257
|
+
]);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
});
|
|
79
261
|
const selectedRailTile = ref("");
|
|
80
262
|
const useRail = () => {
|
|
81
263
|
return {
|
|
@@ -396,13 +578,15 @@ const _sfc_main$3 = defineComponent({
|
|
|
396
578
|
var components = /* @__PURE__ */ Object.freeze({
|
|
397
579
|
__proto__: null,
|
|
398
580
|
[Symbol.toStringTag]: "Module",
|
|
399
|
-
VButton: _sfc_main$
|
|
581
|
+
VButton: _sfc_main$a,
|
|
400
582
|
VRail: _sfc_main$5,
|
|
401
583
|
VRailTile: _sfc_main$4,
|
|
402
584
|
VShell: _sfc_main$3,
|
|
403
585
|
VDrawer: _sfc_main$6,
|
|
404
586
|
VBadge,
|
|
405
|
-
VChip
|
|
587
|
+
VChip,
|
|
588
|
+
VRadioGroup: _sfc_main$8,
|
|
589
|
+
VRadioItem: _sfc_main$7
|
|
406
590
|
});
|
|
407
591
|
var main = "";
|
|
408
592
|
var tailwind = "";
|
|
@@ -47048,7 +47232,7 @@ var themeSwitcher_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
|
47048
47232
|
const _sfc_main = defineComponent({
|
|
47049
47233
|
components: {
|
|
47050
47234
|
DarkModeSwitch,
|
|
47051
|
-
VButton: _sfc_main$
|
|
47235
|
+
VButton: _sfc_main$a
|
|
47052
47236
|
},
|
|
47053
47237
|
props: {
|
|
47054
47238
|
bgLight: {
|
|
@@ -47291,4 +47475,4 @@ function install(app) {
|
|
|
47291
47475
|
}
|
|
47292
47476
|
}
|
|
47293
47477
|
var index = { install };
|
|
47294
|
-
export { DarkModeSwitch, themeSwitcher as ThemeSwitcher, VBadge, _sfc_main$
|
|
47478
|
+
export { DarkModeSwitch, themeSwitcher as ThemeSwitcher, VBadge, _sfc_main$a as VButton, VChip, _sfc_main$2 as VCodeBlock, _sfc_main$6 as VDrawer, _sfc_main$8 as VRadioGroup, _sfc_main$7 as VRadioItem, _sfc_main$5 as VRail, _sfc_main$4 as VRailTile, _sfc_main$3 as VShell, index as default, useDarkMode, useDrawer, useRail, useTheme, clipboard as vClipboard };
|