@leaflink/stash 50.14.0 → 50.16.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/RadioGroup.js +173 -143
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.vue.d.ts +17 -0
- package/dist/RadioNew.js +103 -92
- package/dist/RadioNew.js.map +1 -1
- package/dist/Stepper.vue.d.ts +1 -1
- package/dist/components.css +1 -1
- package/dist/useToasts.d.ts +33 -9
- package/dist/useToasts.js +33 -28
- package/dist/useToasts.js.map +1 -1
- package/package.json +1 -1
package/dist/RadioNew.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { R as
|
|
3
|
-
import { _ as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as _, useCssModule as $, inject as B, createElementBlock as h, openBlock as b, normalizeClass as d, unref as a, createElementVNode as n, toDisplayString as y, withDirectives as M, vShow as x, renderSlot as k, computed as c, createBlock as g, resolveDynamicComponent as N, withCtx as D } from "vue";
|
|
2
|
+
import { R as W } from "./RadioGroup.keys-CqfiKkNz.js";
|
|
3
|
+
import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
const E = ["id", "name", "value", "checked", "disabled"], R = ["for"], T = /* @__PURE__ */ _({
|
|
5
5
|
__name: "VariantButton",
|
|
6
6
|
props: {
|
|
7
7
|
disabled: { type: Boolean },
|
|
@@ -13,34 +13,45 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
13
13
|
value: {}
|
|
14
14
|
},
|
|
15
15
|
emits: ["input"],
|
|
16
|
-
setup(
|
|
17
|
-
const e =
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
setup(s, { emit: u }) {
|
|
17
|
+
const e = s, l = $(), t = B(W.key), r = u;
|
|
18
|
+
return (o, i) => {
|
|
19
|
+
var m, v;
|
|
20
|
+
return b(), h("div", {
|
|
21
|
+
"data-variant-button": "",
|
|
22
|
+
class: d([
|
|
23
|
+
a(l).root,
|
|
24
|
+
{
|
|
25
|
+
"tw-w-full": e.fullWidth,
|
|
26
|
+
[a(l)["radio-group-vertical-orientation"]]: ((v = (m = a(t)) == null ? void 0 : m.orientation) == null ? void 0 : v.value) === "vertical"
|
|
27
|
+
}
|
|
28
|
+
])
|
|
29
|
+
}, [
|
|
30
|
+
n("input", {
|
|
31
|
+
id: `${e.name}-${e.id}`,
|
|
32
|
+
class: d(["tw-sr-only", a(l).input]),
|
|
33
|
+
type: "radio",
|
|
34
|
+
name: e.name,
|
|
35
|
+
value: e.value,
|
|
36
|
+
checked: e.modelValue === e.value,
|
|
37
|
+
disabled: e.disabled || e.disabled,
|
|
38
|
+
onInput: i[0] || (i[0] = (V) => r("input", V))
|
|
39
|
+
}, null, 42, E),
|
|
40
|
+
n("label", {
|
|
41
|
+
class: d(a(l).label),
|
|
42
|
+
for: `${e.name}-${e.id}`
|
|
43
|
+
}, y(e.label), 11, R)
|
|
44
|
+
], 2);
|
|
45
|
+
};
|
|
36
46
|
}
|
|
37
|
-
}),
|
|
38
|
-
label:
|
|
39
|
-
root:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
}), q = "_label_6w0bq_2", O = "_root_6w0bq_14", S = "_input_6w0bq_36", z = {
|
|
48
|
+
label: q,
|
|
49
|
+
root: O,
|
|
50
|
+
"radio-group-vertical-orientation": "_radio-group-vertical-orientation_6w0bq_32",
|
|
51
|
+
input: S
|
|
52
|
+
}, A = {
|
|
53
|
+
$style: z
|
|
54
|
+
}, F = /* @__PURE__ */ w(T, [["__cssModules", A]]), J = ["id", "name", "value", "checked", "disabled"], P = ["for"], U = /* @__PURE__ */ _({
|
|
44
55
|
__name: "VariantChip",
|
|
45
56
|
props: {
|
|
46
57
|
disabled: { type: Boolean },
|
|
@@ -52,25 +63,25 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
52
63
|
value: {}
|
|
53
64
|
},
|
|
54
65
|
emits: ["input"],
|
|
55
|
-
setup(
|
|
56
|
-
const e =
|
|
57
|
-
return (
|
|
58
|
-
class: d([
|
|
66
|
+
setup(s, { emit: u }) {
|
|
67
|
+
const e = s, l = $(), t = u;
|
|
68
|
+
return (r, o) => (b(), h("div", {
|
|
69
|
+
class: d([a(l).root, { "tw-w-full": e.fullWidth }])
|
|
59
70
|
}, [
|
|
60
|
-
|
|
71
|
+
n("input", {
|
|
61
72
|
id: `${e.name}-${e.id}`,
|
|
62
|
-
class: d(["tw-sr-only",
|
|
73
|
+
class: d(["tw-sr-only", a(l).input]),
|
|
63
74
|
type: "radio",
|
|
64
75
|
name: e.name,
|
|
65
76
|
value: e.value,
|
|
66
77
|
checked: e.modelValue === e.value,
|
|
67
78
|
disabled: e.disabled || e.disabled,
|
|
68
|
-
onInput: o[0] || (o[0] = (
|
|
69
|
-
}, null, 42,
|
|
70
|
-
|
|
71
|
-
class: d(
|
|
79
|
+
onInput: o[0] || (o[0] = (i) => t("input", i))
|
|
80
|
+
}, null, 42, J),
|
|
81
|
+
n("label", {
|
|
82
|
+
class: d(a(l).label),
|
|
72
83
|
for: `${e.name}-${e.id}`
|
|
73
|
-
},
|
|
84
|
+
}, y(e.label), 11, P)
|
|
74
85
|
], 2));
|
|
75
86
|
}
|
|
76
87
|
}), H = "_label_vdpts_2", K = "_input_vdpts_16", L = {
|
|
@@ -78,7 +89,7 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
78
89
|
input: K
|
|
79
90
|
}, Q = {
|
|
80
91
|
$style: L
|
|
81
|
-
}, X = /* @__PURE__ */
|
|
92
|
+
}, X = /* @__PURE__ */ w(U, [["__cssModules", Q]]), Y = ["id", "name", "value", "checked", "disabled"], Z = ["for"], I = /* @__PURE__ */ _({
|
|
82
93
|
__name: "VariantRadio",
|
|
83
94
|
props: {
|
|
84
95
|
disabled: { type: Boolean },
|
|
@@ -90,26 +101,26 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
90
101
|
value: {}
|
|
91
102
|
},
|
|
92
103
|
emits: ["input"],
|
|
93
|
-
setup(
|
|
94
|
-
const e =
|
|
95
|
-
return (
|
|
96
|
-
class: d(["tw-flex", [
|
|
104
|
+
setup(s, { emit: u }) {
|
|
105
|
+
const e = s, l = $(), t = u;
|
|
106
|
+
return (r, o) => (b(), h("div", {
|
|
107
|
+
class: d(["tw-flex", [a(l).root, { "tw-w-full": e.fullWidth }]])
|
|
97
108
|
}, [
|
|
98
|
-
|
|
109
|
+
n("input", {
|
|
99
110
|
id: `${e.name}-${e.id}`,
|
|
100
|
-
class: d(
|
|
111
|
+
class: d(a(l).input),
|
|
101
112
|
type: "radio",
|
|
102
113
|
name: e.name,
|
|
103
114
|
value: e.value,
|
|
104
115
|
checked: e.modelValue === e.value,
|
|
105
116
|
disabled: e.disabled,
|
|
106
|
-
onInput: o[0] || (o[0] = (
|
|
117
|
+
onInput: o[0] || (o[0] = (i) => t("input", i))
|
|
107
118
|
}, null, 42, Y),
|
|
108
|
-
|
|
109
|
-
class: d([
|
|
119
|
+
M(n("label", {
|
|
120
|
+
class: d([a(l).label, { "tw-text-ice-500": e.disabled }]),
|
|
110
121
|
for: `${e.name}-${e.id}`
|
|
111
|
-
},
|
|
112
|
-
[
|
|
122
|
+
}, y(e.label), 11, Z), [
|
|
123
|
+
[x, e.label]
|
|
113
124
|
])
|
|
114
125
|
], 2));
|
|
115
126
|
}
|
|
@@ -118,7 +129,7 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
118
129
|
input: G
|
|
119
130
|
}, le = {
|
|
120
131
|
$style: ee
|
|
121
|
-
}, te = /* @__PURE__ */
|
|
132
|
+
}, te = /* @__PURE__ */ w(I, [["__cssModules", le]]), ae = ["for"], se = ["id", "aria-labelledby", "name", "value", "checked", "disabled"], de = ["id"], oe = /* @__PURE__ */ _({
|
|
122
133
|
__name: "VariantTile",
|
|
123
134
|
props: {
|
|
124
135
|
disabled: { type: Boolean },
|
|
@@ -130,62 +141,62 @@ const R = ["id", "name", "value", "checked", "disabled"], T = ["for"], g = /* @_
|
|
|
130
141
|
value: {}
|
|
131
142
|
},
|
|
132
143
|
emits: ["input"],
|
|
133
|
-
setup(
|
|
134
|
-
const e =
|
|
135
|
-
return (
|
|
136
|
-
class: d([
|
|
144
|
+
setup(s, { emit: u }) {
|
|
145
|
+
const e = s, l = $(), t = u;
|
|
146
|
+
return (r, o) => (b(), h("label", {
|
|
147
|
+
class: d([a(l).root, { "tw-w-full": e.fullWidth, [a(l)["root--disabled"]]: e.disabled }]),
|
|
137
148
|
for: `${e.name}-${e.id}`
|
|
138
149
|
}, [
|
|
139
|
-
|
|
150
|
+
n("div", {
|
|
140
151
|
class: d(["tw-flex tw-border", [
|
|
141
|
-
|
|
152
|
+
a(l)["tile-header"],
|
|
142
153
|
{
|
|
143
154
|
"tw-border-blue-500 tw-bg-blue-100": e.modelValue === e.value && !e.disabled,
|
|
144
155
|
"tw-border-ice-500 tw-bg-ice-100": e.modelValue !== e.value || e.disabled
|
|
145
156
|
}
|
|
146
157
|
]])
|
|
147
158
|
}, [
|
|
148
|
-
|
|
159
|
+
n("input", {
|
|
149
160
|
id: `${e.name}-${e.id}`,
|
|
150
161
|
"aria-labelledby": `tile-label-${e.name}-${e.id}`,
|
|
151
|
-
class: d(["tw-sr-only",
|
|
162
|
+
class: d(["tw-sr-only", a(l).input]),
|
|
152
163
|
type: "radio",
|
|
153
164
|
name: e.name,
|
|
154
165
|
value: e.value,
|
|
155
166
|
checked: e.modelValue === e.value,
|
|
156
167
|
disabled: e.disabled,
|
|
157
|
-
onInput: o[0] || (o[0] = (
|
|
168
|
+
onInput: o[0] || (o[0] = (i) => t("input", i))
|
|
158
169
|
}, null, 42, se),
|
|
159
|
-
|
|
170
|
+
n("div", {
|
|
160
171
|
id: `tile-label-${e.name}-${e.id}`,
|
|
161
|
-
class: d([
|
|
162
|
-
},
|
|
172
|
+
class: d([a(l).label, { "tw-text-ice-500": e.disabled }])
|
|
173
|
+
}, y(e.label), 11, de)
|
|
163
174
|
], 2),
|
|
164
|
-
|
|
175
|
+
n("div", {
|
|
165
176
|
class: d([
|
|
166
|
-
|
|
177
|
+
a(l)["tile-body"],
|
|
167
178
|
{
|
|
168
179
|
"tw-border-ice-500": e.modelValue !== e.value || e.disabled,
|
|
169
180
|
"tw-border-blue-500": e.modelValue === e.value && !e.disabled
|
|
170
181
|
}
|
|
171
182
|
])
|
|
172
183
|
}, [
|
|
173
|
-
|
|
184
|
+
k(r.$slots, "default")
|
|
174
185
|
], 2)
|
|
175
186
|
], 10, ae));
|
|
176
187
|
}
|
|
177
|
-
}), ie = "_root_583pa_2", ne = "_label_583pa_32", ue = "_input_583pa_39",
|
|
188
|
+
}), ie = "_root_583pa_2", ne = "_label_583pa_32", ue = "_input_583pa_39", re = {
|
|
178
189
|
root: ie,
|
|
179
190
|
"root--disabled": "_root--disabled_583pa_11",
|
|
180
191
|
"tile-header": "_tile-header_583pa_15",
|
|
181
192
|
"tile-body": "_tile-body_583pa_16",
|
|
182
193
|
label: ne,
|
|
183
194
|
input: ue
|
|
184
|
-
},
|
|
185
|
-
$style:
|
|
186
|
-
},
|
|
187
|
-
var
|
|
188
|
-
const fe = /* @__PURE__ */
|
|
195
|
+
}, ce = {
|
|
196
|
+
$style: re
|
|
197
|
+
}, pe = /* @__PURE__ */ w(oe, [["__cssModules", ce]]);
|
|
198
|
+
var p = /* @__PURE__ */ ((s) => (s.Radio = "radio", s.Button = "button", s.Chip = "chip", s.Tile = "tile", s))(p || {});
|
|
199
|
+
const fe = /* @__PURE__ */ _({
|
|
189
200
|
__name: "RadioNew",
|
|
190
201
|
props: {
|
|
191
202
|
name: { default: void 0 },
|
|
@@ -199,40 +210,40 @@ const fe = /* @__PURE__ */ p({
|
|
|
199
210
|
value: {}
|
|
200
211
|
},
|
|
201
212
|
emits: ["update:modelValue"],
|
|
202
|
-
setup(
|
|
213
|
+
setup(s, { emit: u }) {
|
|
203
214
|
const e = {
|
|
204
|
-
[
|
|
205
|
-
[
|
|
206
|
-
[
|
|
207
|
-
[
|
|
208
|
-
}, l =
|
|
209
|
-
function
|
|
215
|
+
[p.Button]: F,
|
|
216
|
+
[p.Chip]: X,
|
|
217
|
+
[p.Radio]: te,
|
|
218
|
+
[p.Tile]: pe
|
|
219
|
+
}, l = B(W.key, null), t = s, r = c(() => t.modelValue || (l == null ? void 0 : l.modelValue.value)), o = c(() => t.name || (l == null ? void 0 : l.name.value)), i = c(() => t.fullWidth || (l == null ? void 0 : l.fullWidth.value)), m = c(() => t.disabled || (l == null ? void 0 : l.disabled.value)), v = c(() => t.variant || (l == null ? void 0 : l.variant.value) || "radio"), V = u;
|
|
220
|
+
function C(f) {
|
|
210
221
|
if (l != null && l.update) {
|
|
211
|
-
l.update(
|
|
222
|
+
l.update(f);
|
|
212
223
|
return;
|
|
213
224
|
}
|
|
214
|
-
|
|
225
|
+
V("update:modelValue", f.target.value);
|
|
215
226
|
}
|
|
216
|
-
return (
|
|
227
|
+
return (f, _e) => (b(), g(N(e[v.value]), {
|
|
217
228
|
id: t.id,
|
|
218
|
-
disabled:
|
|
229
|
+
disabled: m.value,
|
|
219
230
|
"has-error": t.hasError,
|
|
220
|
-
"full-width":
|
|
231
|
+
"full-width": i.value,
|
|
221
232
|
label: t.label,
|
|
222
|
-
"model-value":
|
|
233
|
+
"model-value": r.value,
|
|
223
234
|
name: o.value,
|
|
224
235
|
value: t.value,
|
|
225
|
-
onInput:
|
|
236
|
+
onInput: C
|
|
226
237
|
}, {
|
|
227
238
|
default: D(() => [
|
|
228
|
-
|
|
239
|
+
k(f.$slots, "default")
|
|
229
240
|
]),
|
|
230
241
|
_: 3
|
|
231
242
|
}, 40, ["id", "disabled", "has-error", "full-width", "label", "model-value", "name", "value"]));
|
|
232
243
|
}
|
|
233
244
|
});
|
|
234
245
|
export {
|
|
235
|
-
|
|
246
|
+
p as RadioVariant,
|
|
236
247
|
fe as default
|
|
237
248
|
};
|
|
238
249
|
//# sourceMappingURL=RadioNew.js.map
|
package/dist/RadioNew.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioNew.js","sources":["../src/components/RadioNew/components/VariantButton.vue","../src/components/RadioNew/components/VariantChip.vue","../src/components/RadioNew/components/VariantRadio.vue","../src/components/RadioNew/components/VariantTile.vue","../src/components/RadioNew/Radio.types.ts","../src/components/RadioNew/RadioNew.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div :class=\"[classes.root, { 'tw-w-full': props.fullWidth }]\">\n <input\n :id=\"`${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled || props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label :class=\"classes.label\" :for=\"`${props.name}-${props.id}`\">\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.semibold');\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root:first-of-type .label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root:last-of-type .label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root:not(:first-of-type) .label {\n margin-left: -1px;\n }\n\n .root:not(:last-of-type) .label {\n border-right-color: transparent;\n }\n\n .input:disabled ~ .label {\n background-color: var(--color-ice-100);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .input:not(:checked, :disabled) ~ .label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .input:checked:not(:disabled) ~ .label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div :class=\"[classes.root, { 'tw-w-full': props.fullWidth }]\">\n <input\n :id=\"`${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled || props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label :class=\"classes.label\" :for=\"`${props.name}-${props.id}`\">\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n display: inline-block;\n padding: theme('spacing.1') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\n line-height: 1.375rem;\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .input:disabled ~ .label {\n background-color: var(--color-ice-100);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .input:checked:not(:disabled) ~ .label {\n border-color: var(--color-blue-500);\n color: theme('colors.white');\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .input:not(:checked, :disabled) ~ .label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"[classes.root, { 'tw-w-full': props.fullWidth }]\">\n <input\n :id=\"`${props.name}-${props.id}`\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label\n v-show=\"props.label\"\n :class=\"[classes.label, { 'tw-text-ice-500': props.disabled }]\"\n :for=\"`${props.name}-${props.id}`\"\n >\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .input {\n appearance: none;\n border-radius: 50%;\n min-width: 20px;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n }\n\n .input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .input:disabled {\n background-image: radial-gradient(var(--color-ice-100) 100%, var(--color-ice-100) 100%);\n }\n\n .input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, var(--color-ice-100) 54%);\n }\n\n .input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .input:disabled ~ .label {\n cursor: auto;\n }\n\n .input:hover:not(:disabled) ~ .label {\n color: var(--color-ice-900);\n }\n\n .input:not(:disabled) ~ .label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <label\n :class=\"[classes.root, { 'tw-w-full': props.fullWidth, [classes['root--disabled']]: props.disabled }]\"\n :for=\"`${props.name}-${props.id}`\"\n >\n <div\n class=\"tw-flex tw-border\"\n :class=\"[\n classes['tile-header'],\n {\n 'tw-border-blue-500 tw-bg-blue-100': props.modelValue === props.value && !props.disabled,\n 'tw-border-ice-500 tw-bg-ice-100': props.modelValue !== props.value || props.disabled,\n },\n ]\"\n >\n <input\n :id=\"`${props.name}-${props.id}`\"\n :aria-labelledby=\"`tile-label-${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <div :id=\"`tile-label-${props.name}-${props.id}`\" :class=\"[classes.label, { 'tw-text-ice-500': props.disabled }]\">\n {{ props.label }}\n </div>\n </div>\n <div\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': props.modelValue !== props.value || props.disabled,\n 'tw-border-blue-500': props.modelValue === props.value && !props.disabled,\n },\n ]\"\n >\n <slot></slot>\n </div>\n </label>\n</template>\n\n<style module>\n .root {\n border-radius: theme('borderRadius.DEFAULT');\n cursor: pointer;\n display: flex;\n flex: 1;\n flex-direction: column;\n user-select: none;\n }\n\n .root--disabled {\n cursor: auto;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT') 0 0;\n padding: theme('spacing.3') 0;\n }\n\n .root:hover:not(.root--disabled) .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .input {\n appearance: none;\n background-color: theme('colors.white');\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n margin-left: theme('spacing.3');\n }\n\n .input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, var(--color-ice-100) 54%);\n }\n\n .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n border-width: 0 1px 1px 1px;\n background-color: theme('colors.white');\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root:hover:not(.root--disabled) .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n</style>\n","export enum RadioVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioVariants = `${RadioVariant}`;\n","<script lang=\"ts\">\n export * from './Radio.types';\n\n export interface RadioProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * Whether the entire group should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Adds error styling\n */\n hasError?: boolean;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * the styling for the radio button @defaultValue 'radio'\n */\n variant?: RadioVariants;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup/RadioGroup.keys';\n import VariantButton from './components/VariantButton.vue';\n import VariantChip from './components/VariantChip.vue';\n import VariantRadio from './components/VariantRadio.vue';\n import VariantTile from './components/VariantTile.vue';\n import { RadioVariant, RadioVariants } from './Radio.types';\n\n const variantComponentsMap = {\n [RadioVariant.Button]: VariantButton,\n [RadioVariant.Chip]: VariantChip,\n [RadioVariant.Radio]: VariantRadio,\n [RadioVariant.Tile]: VariantTile,\n };\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key, null);\n\n const props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n fullWidth: false,\n hasError: false,\n id: undefined,\n label: '',\n modelValue: undefined,\n name: undefined,\n variant: undefined,\n });\n\n /**\n * use prop values but fallback to radio group context values if they are provided\n */\n const derivedModelValue = computed(() => props.modelValue || radioGroupInjection?.modelValue.value);\n const derivedName = computed(() => props.name || radioGroupInjection?.name.value);\n const derivedNameFullWidth = computed(() => props.fullWidth || radioGroupInjection?.fullWidth.value);\n const derivedDisabled = computed(() => props.disabled || radioGroupInjection?.disabled.value);\n const derivedVariant = computed<RadioVariants>(() => props.variant || radioGroupInjection?.variant.value || 'radio');\n\n const emit = defineEmits<{\n (e: 'update:modelValue', value: RadioProps['value']): void;\n }>();\n\n function onInput(e: Event) {\n if (radioGroupInjection?.update) {\n radioGroupInjection.update(e);\n\n return;\n }\n\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n</script>\n\n<template>\n <component\n :is=\"variantComponentsMap[derivedVariant]\"\n :id=\"props.id\"\n :disabled=\"derivedDisabled\"\n :has-error=\"props.hasError\"\n :full-width=\"derivedNameFullWidth\"\n :label=\"props.label\"\n :model-value=\"derivedModelValue\"\n :name=\"derivedName\"\n :value=\"props.value\"\n @input=\"onInput\"\n >\n <slot></slot>\n </component>\n</template>\n"],"names":["props","__props","classes","useCssModule","emit","__emit","RadioVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","radioGroupInjection","inject","RADIO_GROUP_INJECTION","derivedModelValue","computed","derivedName","derivedNameFullWidth","derivedDisabled","derivedVariant","onInput","e"],"mappings":";;;;;;;;;;;;;;;;AAyCE,UAAMA,IAAQC,GACRC,IAAUC,EAAa,GAEvBC,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHb,UAAML,IAAQC,GACRC,IAAUC,EAAa,GAEvBC,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHb,UAAML,IAAQC,GACRC,IAAUC,EAAa,GAEvBC,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHb,UAAML,IAAQC,GACRC,IAAUC,EAAa,GAEvBC,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5CH,IAAAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;AC8DV,UAAMC,IAAuB;AAAA,MAC3B,CAACD,EAAa,MAAM,GAAGE;AAAA,MACvB,CAACF,EAAa,IAAI,GAAGG;AAAA,MACrB,CAACH,EAAa,KAAK,GAAGI;AAAA,MACtB,CAACJ,EAAa,IAAI,GAAGK;AAAA,IACvB,GAEMC,IAAsBC,EAAOC,EAAsB,KAAK,IAAI,GAE5Dd,IAAQC,GAcRc,IAAoBC,EAAS,MAAMhB,EAAM,eAAcY,KAAA,gBAAAA,EAAqB,WAAW,MAAK,GAC5FK,IAAcD,EAAS,MAAMhB,EAAM,SAAQY,KAAA,gBAAAA,EAAqB,KAAK,MAAK,GAC1EM,IAAuBF,EAAS,MAAMhB,EAAM,cAAaY,KAAA,gBAAAA,EAAqB,UAAU,MAAK,GAC7FO,IAAkBH,EAAS,MAAMhB,EAAM,aAAYY,KAAA,gBAAAA,EAAqB,SAAS,MAAK,GACtFQ,IAAiBJ,EAAwB,MAAMhB,EAAM,YAAWY,KAAA,gBAAAA,EAAqB,QAAQ,UAAS,OAAO,GAE7GR,IAAOC;AAIb,aAASgB,EAAQC,GAAU;AACzB,UAAIV,KAAA,QAAAA,EAAqB,QAAQ;AAC/B,QAAAA,EAAoB,OAAOU,CAAC;AAE5B;AAAA,MAAA;AAGG,MAAAlB,EAAA,qBAAsBkB,EAAE,OAA4B,KAAK;AAAA,IAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"RadioNew.js","sources":["../src/components/RadioNew/components/VariantButton.vue","../src/components/RadioNew/components/VariantChip.vue","../src/components/RadioNew/components/VariantRadio.vue","../src/components/RadioNew/components/VariantTile.vue","../src/components/RadioNew/Radio.types.ts","../src/components/RadioNew/RadioNew.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../../RadioGroup/RadioGroup.keys';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div\n data-variant-button\n :class=\"[\n classes.root,\n {\n 'tw-w-full': props.fullWidth,\n [classes['radio-group-vertical-orientation']]: radioGroupInjection?.orientation?.value === 'vertical',\n },\n ]\"\n >\n <input\n :id=\"`${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled || props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label :class=\"classes.label\" :for=\"`${props.name}-${props.id}`\">\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.semibold');\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root:first-of-type .label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root:last-of-type .label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root:not(:first-of-type) .label {\n margin-left: -1px;\n }\n\n .root:not(:last-of-type) .label {\n border-right-color: transparent;\n }\n\n .root.radio-group-vertical-orientation .label {\n border-right-color: var(--color-ice-500);\n }\n\n .input:disabled ~ .label {\n background-color: var(--color-ice-100);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root.radio-group-vertical-orientation:first-of-type .label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: 0;\n }\n\n .root.radio-group-vertical-orientation:last-of-type .label {\n border-top-right-radius: 0;\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root.radio-group-vertical-orientation:not(:first-of-type) .label {\n margin-left: 0;\n margin-top: -1px;\n }\n\n .input:not(:checked, :disabled) ~ .label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .input:checked:not(:disabled) ~ .label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div :class=\"[classes.root, { 'tw-w-full': props.fullWidth }]\">\n <input\n :id=\"`${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled || props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label :class=\"classes.label\" :for=\"`${props.name}-${props.id}`\">\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n display: inline-block;\n padding: theme('spacing.1') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\n line-height: 1.375rem;\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .input:disabled ~ .label {\n background-color: var(--color-ice-100);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .input:checked:not(:disabled) ~ .label {\n border-color: var(--color-blue-500);\n color: theme('colors.white');\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .input:not(:checked, :disabled) ~ .label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"[classes.root, { 'tw-w-full': props.fullWidth }]\">\n <input\n :id=\"`${props.name}-${props.id}`\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <label\n v-show=\"props.label\"\n :class=\"[classes.label, { 'tw-text-ice-500': props.disabled }]\"\n :for=\"`${props.name}-${props.id}`\"\n >\n {{ props.label }}\n </label>\n </div>\n</template>\n\n<style module>\n .label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .input {\n appearance: none;\n border-radius: 50%;\n min-width: 20px;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n }\n\n .input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .input:disabled {\n background-image: radial-gradient(var(--color-ice-100) 100%, var(--color-ice-100) 100%);\n }\n\n .input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, var(--color-ice-100) 54%);\n }\n\n .input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .input:disabled ~ .label {\n cursor: auto;\n }\n\n .input:hover:not(:disabled) ~ .label {\n color: var(--color-ice-900);\n }\n\n .input:not(:disabled) ~ .label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n export interface RadioVariantProps {\n /**\n * Whether the input should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n\n const props = defineProps<RadioVariantProps>();\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'input', event: Event): void;\n }>();\n</script>\n\n<template>\n <label\n :class=\"[classes.root, { 'tw-w-full': props.fullWidth, [classes['root--disabled']]: props.disabled }]\"\n :for=\"`${props.name}-${props.id}`\"\n >\n <div\n class=\"tw-flex tw-border\"\n :class=\"[\n classes['tile-header'],\n {\n 'tw-border-blue-500 tw-bg-blue-100': props.modelValue === props.value && !props.disabled,\n 'tw-border-ice-500 tw-bg-ice-100': props.modelValue !== props.value || props.disabled,\n },\n ]\"\n >\n <input\n :id=\"`${props.name}-${props.id}`\"\n :aria-labelledby=\"`tile-label-${props.name}-${props.id}`\"\n class=\"tw-sr-only\"\n :class=\"classes.input\"\n type=\"radio\"\n :name=\"props.name\"\n :value=\"props.value\"\n :checked=\"props.modelValue === props.value\"\n :disabled=\"props.disabled\"\n @input=\"emit('input', $event)\"\n />\n <div :id=\"`tile-label-${props.name}-${props.id}`\" :class=\"[classes.label, { 'tw-text-ice-500': props.disabled }]\">\n {{ props.label }}\n </div>\n </div>\n <div\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': props.modelValue !== props.value || props.disabled,\n 'tw-border-blue-500': props.modelValue === props.value && !props.disabled,\n },\n ]\"\n >\n <slot></slot>\n </div>\n </label>\n</template>\n\n<style module>\n .root {\n border-radius: theme('borderRadius.DEFAULT');\n cursor: pointer;\n display: flex;\n flex: 1;\n flex-direction: column;\n user-select: none;\n }\n\n .root--disabled {\n cursor: auto;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT') 0 0;\n padding: theme('spacing.3') 0;\n }\n\n .root:hover:not(.root--disabled) .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .input {\n appearance: none;\n background-color: theme('colors.white');\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n margin-left: theme('spacing.3');\n }\n\n .input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, var(--color-ice-100) 54%);\n }\n\n .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n border-width: 0 1px 1px 1px;\n background-color: theme('colors.white');\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root:hover:not(.root--disabled) .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n</style>\n","export enum RadioVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioVariants = `${RadioVariant}`;\n","<script lang=\"ts\">\n export * from './Radio.types';\n\n export interface RadioProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` element.\n */\n name?: string;\n\n /**\n * Whether the entire group should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: string | number;\n\n /**\n * value bound to the parent component\n */\n modelValue?: string | undefined;\n\n /**\n * Adds error styling\n */\n hasError?: boolean;\n\n /**\n * The description which appears to the right of the radio button\n */\n label?: string;\n\n /**\n * the styling for the radio button @defaultValue 'radio'\n */\n variant?: RadioVariants;\n\n /**\n * The value for the radio input.\n */\n value: string;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup/RadioGroup.keys';\n import VariantButton from './components/VariantButton.vue';\n import VariantChip from './components/VariantChip.vue';\n import VariantRadio from './components/VariantRadio.vue';\n import VariantTile from './components/VariantTile.vue';\n import { RadioVariant, RadioVariants } from './Radio.types';\n\n const variantComponentsMap = {\n [RadioVariant.Button]: VariantButton,\n [RadioVariant.Chip]: VariantChip,\n [RadioVariant.Radio]: VariantRadio,\n [RadioVariant.Tile]: VariantTile,\n };\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key, null);\n\n const props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n fullWidth: false,\n hasError: false,\n id: undefined,\n label: '',\n modelValue: undefined,\n name: undefined,\n variant: undefined,\n });\n\n /**\n * use prop values but fallback to radio group context values if they are provided\n */\n const derivedModelValue = computed(() => props.modelValue || radioGroupInjection?.modelValue.value);\n const derivedName = computed(() => props.name || radioGroupInjection?.name.value);\n const derivedNameFullWidth = computed(() => props.fullWidth || radioGroupInjection?.fullWidth.value);\n const derivedDisabled = computed(() => props.disabled || radioGroupInjection?.disabled.value);\n const derivedVariant = computed<RadioVariants>(() => props.variant || radioGroupInjection?.variant.value || 'radio');\n\n const emit = defineEmits<{\n (e: 'update:modelValue', value: RadioProps['value']): void;\n }>();\n\n function onInput(e: Event) {\n if (radioGroupInjection?.update) {\n radioGroupInjection.update(e);\n\n return;\n }\n\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n</script>\n\n<template>\n <component\n :is=\"variantComponentsMap[derivedVariant]\"\n :id=\"props.id\"\n :disabled=\"derivedDisabled\"\n :has-error=\"props.hasError\"\n :full-width=\"derivedNameFullWidth\"\n :label=\"props.label\"\n :model-value=\"derivedModelValue\"\n :name=\"derivedName\"\n :value=\"props.value\"\n @input=\"onInput\"\n >\n <slot></slot>\n </component>\n</template>\n"],"names":["props","__props","classes","useCssModule","radioGroupInjection","inject","RADIO_GROUP_INJECTION","emit","__emit","RadioVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","derivedModelValue","computed","derivedName","derivedNameFullWidth","derivedDisabled","derivedVariant","onInput","e"],"mappings":";;;;;;;;;;;;;;;;AA2CE,UAAMA,IAAQC,GACRC,IAAUC,EAAa,GACvBC,IAAsBC,EAAOC,EAAsB,GAAG,GAEtDC,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNb,UAAMR,IAAQC,GACRC,IAAUC,EAAa,GAEvBI,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHb,UAAMR,IAAQC,GACRC,IAAUC,EAAa,GAEvBI,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHb,UAAMR,IAAQC,GACRC,IAAUC,EAAa,GAEvBI,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5CH,IAAAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;AC8DV,UAAMC,IAAuB;AAAA,MAC3B,CAACD,EAAa,MAAM,GAAGE;AAAA,MACvB,CAACF,EAAa,IAAI,GAAGG;AAAA,MACrB,CAACH,EAAa,KAAK,GAAGI;AAAA,MACtB,CAACJ,EAAa,IAAI,GAAGK;AAAA,IACvB,GAEMV,IAAsBC,EAAOC,EAAsB,KAAK,IAAI,GAE5DN,IAAQC,GAcRc,IAAoBC,EAAS,MAAMhB,EAAM,eAAcI,KAAA,gBAAAA,EAAqB,WAAW,MAAK,GAC5Fa,IAAcD,EAAS,MAAMhB,EAAM,SAAQI,KAAA,gBAAAA,EAAqB,KAAK,MAAK,GAC1Ec,IAAuBF,EAAS,MAAMhB,EAAM,cAAaI,KAAA,gBAAAA,EAAqB,UAAU,MAAK,GAC7Fe,IAAkBH,EAAS,MAAMhB,EAAM,aAAYI,KAAA,gBAAAA,EAAqB,SAAS,MAAK,GACtFgB,IAAiBJ,EAAwB,MAAMhB,EAAM,YAAWI,KAAA,gBAAAA,EAAqB,QAAQ,UAAS,OAAO,GAE7GG,IAAOC;AAIb,aAASa,EAAQC,GAAU;AACzB,UAAIlB,KAAA,QAAAA,EAAqB,QAAQ;AAC/B,QAAAA,EAAoB,OAAOkB,CAAC;AAE5B;AAAA,MAAA;AAGG,MAAAf,EAAA,qBAAsBe,EAAE,OAA4B,KAAK;AAAA,IAAA;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Stepper.vue.d.ts
CHANGED
|
@@ -62,9 +62,9 @@ useResponsiveNav: boolean;
|
|
|
62
62
|
}>, {
|
|
63
63
|
step: number;
|
|
64
64
|
theme: StepperTheme;
|
|
65
|
+
orientation: "vertical" | "horizontal";
|
|
65
66
|
substep: number;
|
|
66
67
|
linear: boolean;
|
|
67
|
-
orientation: "vertical" | "horizontal";
|
|
68
68
|
useResponsiveNav: boolean;
|
|
69
69
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
70
70
|
default?(_: {}): any;
|