@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/RadioGroup.js
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { R as
|
|
4
|
-
import { _ as
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as x, inject as g, useCssModule as V, createElementBlock as c, openBlock as n, normalizeClass as v, unref as e, Fragment as R, renderList as I, createElementVNode as u, toDisplayString as $, provide as S, computed as m, ref as C, useTemplateRef as j, onMounted as D, onUnmounted as q, watchEffect as A, createBlock as M, mergeProps as N, withCtx as P, renderSlot as W, resolveDynamicComponent as L } from "vue";
|
|
2
|
+
import U from "lodash-es/uniqueId";
|
|
3
|
+
import { R as k } from "./RadioGroup.keys-CqfiKkNz.js";
|
|
4
|
+
import { _ as B } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
import { _ as F } from "./Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js";
|
|
6
|
+
const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @__PURE__ */ x({
|
|
7
7
|
__name: "VariantButton",
|
|
8
|
-
setup(
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
8
|
+
setup(p) {
|
|
9
|
+
const i = g(k.key);
|
|
10
|
+
if (!i)
|
|
11
11
|
throw new Error("VariantButton must be used with a RadioGroup instance.");
|
|
12
|
-
const { name:
|
|
13
|
-
return (
|
|
14
|
-
class:
|
|
12
|
+
const { name: o, disabled: a, fullWidth: w, modelValue: d, options: f, update: s } = i, _ = V();
|
|
13
|
+
return (h, l) => (n(), c("div", {
|
|
14
|
+
class: v(["tw-flex", e(_).root])
|
|
15
15
|
}, [
|
|
16
|
-
(
|
|
17
|
-
key: `${e(
|
|
18
|
-
class:
|
|
16
|
+
(n(!0), c(R, null, I(e(f), (t) => (n(), c("div", {
|
|
17
|
+
key: `${e(o)}-${t.id}`,
|
|
18
|
+
class: v([{ "tw-w-full": e(w) }])
|
|
19
19
|
}, [
|
|
20
|
-
|
|
21
|
-
id: `${e(
|
|
20
|
+
u("input", {
|
|
21
|
+
id: `${e(o)}-${t.id}`,
|
|
22
22
|
class: "tw-sr-only",
|
|
23
23
|
type: "radio",
|
|
24
|
-
name: e(
|
|
24
|
+
name: e(o),
|
|
25
25
|
value: t.value,
|
|
26
26
|
checked: e(d) === t.value,
|
|
27
27
|
disabled: e(a) || t.disabled,
|
|
28
|
-
onInput:
|
|
29
|
-
(...b) => e(
|
|
30
|
-
}, null, 40,
|
|
31
|
-
|
|
32
|
-
for: `${e(
|
|
33
|
-
}, $(t.text), 9,
|
|
28
|
+
onInput: l[0] || (l[0] = //@ts-ignore
|
|
29
|
+
(...b) => e(s) && e(s)(...b))
|
|
30
|
+
}, null, 40, J),
|
|
31
|
+
u("label", {
|
|
32
|
+
for: `${e(o)}-${t.id}`
|
|
33
|
+
}, $(t.text), 9, H)
|
|
34
34
|
], 2))), 128))
|
|
35
35
|
], 2));
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
38
|
-
root:
|
|
39
|
-
},
|
|
40
|
-
$style:
|
|
41
|
-
},
|
|
37
|
+
}), Q = "_root_1bamn_2", X = {
|
|
38
|
+
root: Q
|
|
39
|
+
}, Y = {
|
|
40
|
+
$style: X
|
|
41
|
+
}, Z = /* @__PURE__ */ B(K, [["__cssModules", Y]]), ee = ["id", "name", "value", "checked", "disabled"], te = ["for"], ae = /* @__PURE__ */ x({
|
|
42
42
|
__name: "VariantChip",
|
|
43
|
-
setup(
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
43
|
+
setup(p) {
|
|
44
|
+
const i = g(k.key);
|
|
45
|
+
if (!i)
|
|
46
46
|
throw new Error("VariantChip must be used with a RadioGroup instance.");
|
|
47
|
-
const { name:
|
|
48
|
-
return (
|
|
49
|
-
class:
|
|
47
|
+
const { name: o, disabled: a, fullWidth: w, modelValue: d, options: f, update: s } = i, _ = V();
|
|
48
|
+
return (h, l) => (n(), c("div", {
|
|
49
|
+
class: v(["tw-my-1.5 tw-flex tw-flex-wrap", e(_).root])
|
|
50
50
|
}, [
|
|
51
|
-
(
|
|
52
|
-
key: `${e(
|
|
53
|
-
class:
|
|
51
|
+
(n(!0), c(R, null, I(e(f), (t) => (n(), c("div", {
|
|
52
|
+
key: `${e(o)}-${t.id}`,
|
|
53
|
+
class: v([{ "tw-w-full": e(w) }])
|
|
54
54
|
}, [
|
|
55
|
-
|
|
56
|
-
id: `${e(
|
|
55
|
+
u("input", {
|
|
56
|
+
id: `${e(o)}-${t.id}`,
|
|
57
57
|
class: "tw-sr-only",
|
|
58
58
|
type: "radio",
|
|
59
|
-
name: e(
|
|
59
|
+
name: e(o),
|
|
60
60
|
value: t.value,
|
|
61
61
|
checked: e(d) === t.value,
|
|
62
62
|
disabled: e(a) || t.disabled,
|
|
63
|
-
onInput:
|
|
64
|
-
(...b) => e(
|
|
65
|
-
}, null, 40,
|
|
66
|
-
|
|
67
|
-
for: `${e(
|
|
68
|
-
}, $(t.text), 9,
|
|
63
|
+
onInput: l[0] || (l[0] = //@ts-ignore
|
|
64
|
+
(...b) => e(s) && e(s)(...b))
|
|
65
|
+
}, null, 40, ee),
|
|
66
|
+
u("label", {
|
|
67
|
+
for: `${e(o)}-${t.id}`
|
|
68
|
+
}, $(t.text), 9, te)
|
|
69
69
|
], 2))), 128))
|
|
70
70
|
], 2));
|
|
71
71
|
}
|
|
72
|
-
}),
|
|
73
|
-
root:
|
|
74
|
-
},
|
|
75
|
-
$style:
|
|
76
|
-
},
|
|
72
|
+
}), oe = "_root_kagur_2", re = {
|
|
73
|
+
root: oe
|
|
74
|
+
}, se = {
|
|
75
|
+
$style: re
|
|
76
|
+
}, le = /* @__PURE__ */ B(ae, [["__cssModules", se]]), ne = ["id", "name", "value", "checked", "disabled"], ie = ["for"], de = /* @__PURE__ */ x({
|
|
77
77
|
__name: "VariantRadio",
|
|
78
|
-
setup(
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
78
|
+
setup(p) {
|
|
79
|
+
const i = g(k.key);
|
|
80
|
+
if (!i)
|
|
81
81
|
throw new Error("VariantRadio must be used with a RadioGroup instance.");
|
|
82
|
-
const { name:
|
|
83
|
-
return (
|
|
84
|
-
class:
|
|
82
|
+
const { name: o, disabled: a, fullWidth: w, modelValue: d, options: f, update: s } = i, _ = V();
|
|
83
|
+
return (h, l) => (n(), c("div", {
|
|
84
|
+
class: v(["tw-flex tw-flex-wrap", e(_).root])
|
|
85
85
|
}, [
|
|
86
|
-
(
|
|
87
|
-
key: `${e(
|
|
88
|
-
class:
|
|
86
|
+
(n(!0), c(R, null, I(e(f), (t) => (n(), c("div", {
|
|
87
|
+
key: `${e(o)}-${t.id}`,
|
|
88
|
+
class: v([{ "tw-w-full": e(w) }])
|
|
89
89
|
}, [
|
|
90
|
-
|
|
91
|
-
id: `${e(
|
|
90
|
+
u("input", {
|
|
91
|
+
id: `${e(o)}-${t.id}`,
|
|
92
92
|
type: "radio",
|
|
93
|
-
name: e(
|
|
93
|
+
name: e(o),
|
|
94
94
|
value: t.value,
|
|
95
95
|
checked: e(d) === t.value,
|
|
96
96
|
disabled: e(a) || t.disabled,
|
|
97
|
-
onInput:
|
|
98
|
-
(...b) => e(
|
|
99
|
-
}, null, 40,
|
|
100
|
-
|
|
101
|
-
for: `${e(
|
|
102
|
-
}, $(t.text), 9,
|
|
97
|
+
onInput: l[0] || (l[0] = //@ts-ignore
|
|
98
|
+
(...b) => e(s) && e(s)(...b))
|
|
99
|
+
}, null, 40, ne),
|
|
100
|
+
u("label", {
|
|
101
|
+
for: `${e(o)}-${t.id}`
|
|
102
|
+
}, $(t.text), 9, ie)
|
|
103
103
|
], 2))), 128))
|
|
104
104
|
], 2));
|
|
105
105
|
}
|
|
106
|
-
}),
|
|
107
|
-
root:
|
|
108
|
-
},
|
|
109
|
-
$style:
|
|
110
|
-
},
|
|
106
|
+
}), ue = "_root_11y1n_2", ce = {
|
|
107
|
+
root: ue
|
|
108
|
+
}, _e = {
|
|
109
|
+
$style: ce
|
|
110
|
+
}, pe = /* @__PURE__ */ B(de, [["__cssModules", _e]]), ve = ["for"], fe = ["id", "name", "value", "checked", "disabled"], me = { class: "tw-m-0 tw-text-ice-900" }, we = { class: "tw-m-0 tw-text-ice-700" }, be = /* @__PURE__ */ x({
|
|
111
111
|
__name: "VariantTile",
|
|
112
|
-
setup(
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
112
|
+
setup(p) {
|
|
113
|
+
const i = g(k.key);
|
|
114
|
+
if (!i)
|
|
115
115
|
throw new Error("VariantTile must be used with a RadioGroup instance.");
|
|
116
|
-
const { name:
|
|
117
|
-
return (
|
|
118
|
-
class:
|
|
116
|
+
const { name: o, disabled: a, fullWidth: w, modelValue: d, options: f, update: s } = i, _ = V();
|
|
117
|
+
return (h, l) => (n(), c("div", {
|
|
118
|
+
class: v(["tw-flex tw-flex-wrap", e(_).root])
|
|
119
119
|
}, [
|
|
120
|
-
(
|
|
121
|
-
key: `${e(
|
|
122
|
-
class:
|
|
123
|
-
for: `${e(
|
|
120
|
+
(n(!0), c(R, null, I(e(f), (t) => (n(), c("label", {
|
|
121
|
+
key: `${e(o)}-${t.id}`,
|
|
122
|
+
class: v([e(_)["tile-container"], { "tw-w-full": e(w) }]),
|
|
123
|
+
for: `${e(o)}-${t.id}`
|
|
124
124
|
}, [
|
|
125
|
-
|
|
126
|
-
class:
|
|
127
|
-
e(
|
|
125
|
+
u("div", {
|
|
126
|
+
class: v(["tw-flex tw-border", [
|
|
127
|
+
e(_)["tile-header"],
|
|
128
128
|
{
|
|
129
129
|
"tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900": e(d) === t.value,
|
|
130
130
|
"tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700": e(d) !== t.value
|
|
131
131
|
}
|
|
132
132
|
]])
|
|
133
133
|
}, [
|
|
134
|
-
|
|
135
|
-
id: `${e(
|
|
134
|
+
u("input", {
|
|
135
|
+
id: `${e(o)}-${t.id}`,
|
|
136
136
|
class: "tw-sr-only",
|
|
137
137
|
type: "radio",
|
|
138
|
-
name: e(
|
|
138
|
+
name: e(o),
|
|
139
139
|
value: t.value,
|
|
140
140
|
checked: e(d) === t.value,
|
|
141
141
|
disabled: e(a) || t.disabled,
|
|
142
|
-
onInput:
|
|
143
|
-
(...b) => e(
|
|
144
|
-
}, null, 40,
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
onInput: l[0] || (l[0] = //@ts-ignore
|
|
143
|
+
(...b) => e(s) && e(s)(...b))
|
|
144
|
+
}, null, 40, fe),
|
|
145
|
+
u("div", null, [
|
|
146
|
+
u("span", null, $(t.text), 1)
|
|
147
147
|
])
|
|
148
148
|
], 2),
|
|
149
|
-
|
|
150
|
-
class:
|
|
151
|
-
e(
|
|
149
|
+
u("div", {
|
|
150
|
+
class: v(["tw-border-x tw-border-b", [
|
|
151
|
+
e(_)["tile-body"],
|
|
152
152
|
{
|
|
153
153
|
"tw-border-ice-500": e(d) !== t.value,
|
|
154
154
|
"tw-border-blue-500": e(d) === t.value
|
|
155
155
|
}
|
|
156
156
|
]])
|
|
157
157
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
u("p", me, $(t.subTitle), 1),
|
|
159
|
+
u("p", we, $(t.subText), 1)
|
|
160
160
|
], 2)
|
|
161
|
-
], 10,
|
|
161
|
+
], 10, ve))), 128))
|
|
162
162
|
], 2));
|
|
163
163
|
}
|
|
164
|
-
}),
|
|
165
|
-
root:
|
|
164
|
+
}), he = "_root_1sppn_2", $e = {
|
|
165
|
+
root: he,
|
|
166
166
|
"tile-container": "_tile-container_1sppn_23",
|
|
167
167
|
"tile-header": "_tile-header_1sppn_30",
|
|
168
168
|
"tile-body": "_tile-body_1sppn_31"
|
|
169
|
-
},
|
|
170
|
-
$style:
|
|
171
|
-
},
|
|
172
|
-
var
|
|
173
|
-
const
|
|
169
|
+
}, ye = {
|
|
170
|
+
$style: $e
|
|
171
|
+
}, xe = /* @__PURE__ */ B(be, [["__cssModules", ye]]);
|
|
172
|
+
var y = /* @__PURE__ */ ((p) => (p.Radio = "radio", p.Button = "button", p.Chip = "chip", p.Tile = "tile", p))(y || {});
|
|
173
|
+
const ke = /* @__PURE__ */ x({
|
|
174
174
|
__name: "RadioGroup",
|
|
175
175
|
props: {
|
|
176
176
|
name: { default: void 0 },
|
|
@@ -178,6 +178,7 @@ const _e = /* @__PURE__ */ h({
|
|
|
178
178
|
modelValue: { default: void 0 },
|
|
179
179
|
variant: { default: "radio" },
|
|
180
180
|
fullWidth: { type: Boolean, default: !1 },
|
|
181
|
+
orientation: { default: "horizontal" },
|
|
181
182
|
addBottomSpace: { type: Boolean },
|
|
182
183
|
errorText: {},
|
|
183
184
|
hintText: {},
|
|
@@ -192,55 +193,84 @@ const _e = /* @__PURE__ */ h({
|
|
|
192
193
|
disabled: { type: Boolean }
|
|
193
194
|
},
|
|
194
195
|
emits: ["update:modelValue"],
|
|
195
|
-
setup(
|
|
196
|
-
const
|
|
197
|
-
[
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
}, a =
|
|
202
|
-
function d(
|
|
203
|
-
|
|
196
|
+
setup(p, { emit: i }) {
|
|
197
|
+
const o = {
|
|
198
|
+
[y.Button]: Z,
|
|
199
|
+
[y.Chip]: le,
|
|
200
|
+
[y.Radio]: pe,
|
|
201
|
+
[y.Tile]: xe
|
|
202
|
+
}, a = p, w = i;
|
|
203
|
+
function d(r) {
|
|
204
|
+
w("update:modelValue", r.target.value);
|
|
204
205
|
}
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
name:
|
|
208
|
-
disabled:
|
|
209
|
-
fullWidth:
|
|
210
|
-
modelValue:
|
|
211
|
-
options:
|
|
212
|
-
variant:
|
|
206
|
+
const f = U("radio-group-field-error-");
|
|
207
|
+
S(k.key, {
|
|
208
|
+
name: m(() => a.name),
|
|
209
|
+
disabled: m(() => a.isDisabled || a.disabled),
|
|
210
|
+
fullWidth: m(() => a.fullWidth),
|
|
211
|
+
modelValue: m(() => a.modelValue),
|
|
212
|
+
options: m(() => a.options),
|
|
213
|
+
variant: m(() => a.variant),
|
|
214
|
+
orientation: m(() => s.value),
|
|
213
215
|
update: d
|
|
214
|
-
})
|
|
216
|
+
});
|
|
217
|
+
const s = C(a.orientation), _ = m(() => ({
|
|
218
|
+
"tw-flex-wrap": a.variant !== "button",
|
|
219
|
+
"tw-gap-x-1.5 tw-gap-y-3": a.variant === "chip" && s.value === "horizontal",
|
|
220
|
+
"tw-gap-6": a.variant === "radio" || a.variant === "tile" || a.variant === "chip" && s.value === "vertical",
|
|
221
|
+
"tw-flex-col": s.value === "vertical"
|
|
222
|
+
})), h = C(null), l = j("radioGroup"), t = m(() => {
|
|
223
|
+
var r;
|
|
224
|
+
return (r = l.value) == null ? void 0 : r.$el.parentElement;
|
|
225
|
+
}), b = m(() => {
|
|
226
|
+
var r;
|
|
227
|
+
return a.variant !== "button" ? [] : Array.from((r = l.value) == null ? void 0 : r.$el.querySelectorAll("[data-variant-button]")) || [];
|
|
228
|
+
});
|
|
229
|
+
function E() {
|
|
230
|
+
return b.value.reduce((r, T) => {
|
|
231
|
+
const O = T.getBoundingClientRect().width;
|
|
232
|
+
return r + O;
|
|
233
|
+
}, 0);
|
|
234
|
+
}
|
|
235
|
+
const G = C(0), z = (r) => {
|
|
236
|
+
s.value = G.value > r.contentBoxSize[0].inlineSize ? "vertical" : a.orientation;
|
|
237
|
+
};
|
|
238
|
+
return D(() => {
|
|
239
|
+
a.variant === "button" && !a.fullWidth && (G.value = E(), h.value = new ResizeObserver((r) => z(r[0])), h.value.observe(t.value));
|
|
240
|
+
}), q(() => {
|
|
241
|
+
var r;
|
|
242
|
+
a.variant === "button" && h.value && ((r = h.value) == null || r.disconnect());
|
|
243
|
+
}), A(() => {
|
|
244
|
+
s.value = a.orientation;
|
|
245
|
+
}), (r, T) => (n(), M(F, N(a, {
|
|
246
|
+
ref_key: "radioGroup",
|
|
247
|
+
ref: l,
|
|
215
248
|
class: "stash-radio-group",
|
|
216
249
|
"data-test": "stash-radio-group",
|
|
217
|
-
"aria-errormessage": e(
|
|
218
|
-
"error-id": e(
|
|
250
|
+
"aria-errormessage": e(f),
|
|
251
|
+
"error-id": e(f),
|
|
219
252
|
"aria-invalid": !!a.errorText,
|
|
220
253
|
role: "radiogroup",
|
|
221
254
|
fieldset: ""
|
|
222
255
|
}), {
|
|
223
|
-
default:
|
|
224
|
-
a.options ?
|
|
225
|
-
(
|
|
226
|
-
], !0) : (
|
|
256
|
+
default: P(() => [
|
|
257
|
+
a.options ? W(r.$slots, "default", { key: 0 }, () => [
|
|
258
|
+
(n(), M(L(o[a.variant])))
|
|
259
|
+
], !0) : (n(), c("div", {
|
|
227
260
|
key: 1,
|
|
228
|
-
class:
|
|
229
|
-
|
|
230
|
-
"tw-gap-x-1.5 tw-gap-y-3": a.variant === e(w).Chip,
|
|
231
|
-
"tw-gap-6": a.variant === e(w).Radio || a.variant === e(w).Tile
|
|
232
|
-
}])
|
|
261
|
+
class: v(["tw-flex", _.value]),
|
|
262
|
+
"data-test": "stash-radio-group|default-slot"
|
|
233
263
|
}, [
|
|
234
|
-
|
|
264
|
+
W(r.$slots, "default", {}, void 0, !0)
|
|
235
265
|
], 2))
|
|
236
266
|
]),
|
|
237
267
|
_: 3
|
|
238
268
|
}, 16, ["aria-errormessage", "error-id", "aria-invalid"]));
|
|
239
269
|
}
|
|
240
|
-
}),
|
|
270
|
+
}), Ce = /* @__PURE__ */ B(ke, [["__scopeId", "data-v-0412e997"]]);
|
|
241
271
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
272
|
+
k as RADIO_GROUP_INJECTION,
|
|
273
|
+
y as RadioGroupVariant,
|
|
274
|
+
Ce as default
|
|
245
275
|
};
|
|
246
276
|
//# sourceMappingURL=RadioGroup.js.map
|
package/dist/RadioGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root 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 > div:first-child label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:last-child label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root 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 .root 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 { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-my-1.5 tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n padding: theme('spacing[1.5]') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\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 .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input {\n appearance: none;\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: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'tw-w-full': fullWidth }]\"\n :for=\"`${name}-${option.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 tw-text-ice-900': modelValue === option.value,\n 'tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"tw-border-x tw-border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': modelValue !== option.value,\n 'tw-border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"tw-m-0 tw-text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"tw-m-0 tw-text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: theme('borderRadius.DEFAULT');\n display: flex;\n flex: 1;\n flex-direction: column;\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 label.tile-container:hover .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 .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n background-color: var(--color-white);\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-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 }\n\n .root input ~ div {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: theme('spacing.3');\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n}\n","<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps extends FieldProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` elements within the RadioGroup.\n */\n name?: string;\n\n /**\n * Deprecated - Compose your radio group with the `Radio` component instead\n * @deprecated\n */\n options?: RadioGroupOption[];\n\n /**\n * The value of the selected radio option. Use this prop with the `update:modelValue` event to create a controlled component.\n */\n modelValue?: RadioGroupOption['value'];\n\n /**\n * @defaultValue 'radio'\n */\n variant?: RadioGroupVariants;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, provide } from 'vue';\n\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 { RADIO_GROUP_INJECTION } from './RadioGroup.keys';\n\n const variantComponentsMap = {\n [RadioGroupVariant.Button]: VariantButton,\n [RadioGroupVariant.Chip]: VariantChip,\n [RadioGroupVariant.Radio]: VariantRadio,\n [RadioGroupVariant.Tile]: VariantTile,\n };\n\n const props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: 'radio',\n fullWidth: false,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.isDisabled || props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n update,\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n class=\"stash-radio-group\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :error-id=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div\n v-else\n class=\"tw-flex\"\n :class=\"{\n 'tw-flex-wrap': props.variant !== RadioGroupVariant.Button,\n 'tw-gap-x-1.5 tw-gap-y-3': props.variant === RadioGroupVariant.Chip,\n 'tw-gap-6': props.variant === RadioGroupVariant.Radio || props.variant === RadioGroupVariant.Tile,\n }\"\n >\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style scoped>\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed"],"mappings":";;;;;;;;AAKQ,UAAAA,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,wDAAwD;AAG1E,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPvB,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPvB,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,uDAAuD;AAGzE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPvB,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVnB,IAAAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AC6CV,UAAMC,IAAuB;AAAA,MAC3B,CAACD,EAAkB,MAAM,GAAGE;AAAA,MAC5B,CAACF,EAAkB,IAAI,GAAGG;AAAA,MAC1B,CAACH,EAAkB,KAAK,GAAGI;AAAA,MAC3B,CAACJ,EAAkB,IAAI,GAAGK;AAAA,IAC5B,GAEMC,IAAQC,GAQRC,IAAOC;AAOb,aAASZ,EAAOa,GAAU;AACnB,MAAAF,EAAA,qBAAsBE,EAAE,OAA4B,KAAK;AAAA,IAAA;AAG1D,UAAAC,IAAUC,EAAS,0BAA0B;AAEnD,WAAAC,EAAQtB,EAAsB,KAAK;AAAA,MACjC,MAAMuB,EAAS,MAAMR,EAAM,IAAI;AAAA,MAC/B,UAAUQ,EAAS,MAAMR,EAAM,cAAcA,EAAM,QAAQ;AAAA,MAC3D,WAAWQ,EAAS,MAAMR,EAAM,SAAS;AAAA,MACzC,YAAYQ,EAAS,MAAMR,EAAM,UAAU;AAAA,MAC3C,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,QAAAT;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root 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 > div:first-child label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:last-child label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root 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 .root 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 { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-my-1.5 tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n padding: theme('spacing[1.5]') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\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 .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input {\n appearance: none;\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: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'tw-w-full': fullWidth }]\"\n :for=\"`${name}-${option.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 tw-text-ice-900': modelValue === option.value,\n 'tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"tw-border-x tw-border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': modelValue !== option.value,\n 'tw-border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"tw-m-0 tw-text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"tw-m-0 tw-text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: theme('borderRadius.DEFAULT');\n display: flex;\n flex: 1;\n flex-direction: column;\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 label.tile-container:hover .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 .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n background-color: var(--color-white);\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-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 }\n\n .root input ~ div {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: theme('spacing.3');\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n */\n orientation?: ComputedRef<'horizontal' | 'vertical'>;\n}\n","<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps extends FieldProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` elements within the RadioGroup.\n */\n name?: string;\n\n /**\n * Deprecated - Compose your radio group with the `Radio` component instead\n * @deprecated\n */\n options?: RadioGroupOption[];\n\n /**\n * The value of the selected radio option. Use this prop with the `update:modelValue` event to create a controlled component.\n */\n modelValue?: RadioGroupOption['value'];\n\n /**\n * @defaultValue 'radio'\n */\n variant?: RadioGroupVariants;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, onMounted, onUnmounted, provide, ref, useTemplateRef, watchEffect } from 'vue';\n\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 { RADIO_GROUP_INJECTION } from './RadioGroup.keys';\n\n const variantComponentsMap = {\n [RadioGroupVariant.Button]: VariantButton,\n [RadioGroupVariant.Chip]: VariantChip,\n [RadioGroupVariant.Radio]: VariantRadio,\n [RadioGroupVariant.Tile]: VariantTile,\n };\n\n const props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: 'radio',\n fullWidth: false,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n orientation: 'horizontal',\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.isDisabled || props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n orientation: computed(() => internalOrientation.value),\n update,\n });\n\n const internalOrientation = ref(props.orientation);\n\n const classes = computed(() => {\n return {\n 'tw-flex-wrap': props.variant !== 'button',\n 'tw-gap-x-1.5 tw-gap-y-3': props.variant === 'chip' && internalOrientation.value === 'horizontal',\n 'tw-gap-6':\n props.variant === 'radio' ||\n props.variant === 'tile' ||\n (props.variant === 'chip' && internalOrientation.value === 'vertical'),\n 'tw-flex-col': internalOrientation.value === 'vertical',\n };\n });\n\n const resizeObserver = ref<ResizeObserver | null>(null);\n const radioGroup = useTemplateRef('radioGroup');\n const radioGroupParent = computed(() => radioGroup.value?.$el.parentElement);\n const radioGroupButtons = computed(() => {\n if (props.variant !== 'button') {\n return [];\n }\n\n return Array.from<HTMLElement>(radioGroup.value?.$el.querySelectorAll('[data-variant-button]')) || [];\n });\n\n function getButtonsWidth() {\n return radioGroupButtons.value.reduce((acc, button) => {\n const buttonWidth = button.getBoundingClientRect().width;\n return acc + buttonWidth;\n }, 0);\n }\n\n const initialTotalButtonsWidth = ref(0);\n\n const handleResize = (entry: ResizeObserverEntry) => {\n internalOrientation.value =\n initialTotalButtonsWidth.value > entry.contentBoxSize[0].inlineSize ? 'vertical' : props.orientation;\n };\n\n onMounted(() => {\n // If the width of the buttons is greater than the parent element,\n // set orientation to vertical\n if (props.variant === 'button' && !props.fullWidth) {\n initialTotalButtonsWidth.value = getButtonsWidth();\n resizeObserver.value = new ResizeObserver((entries) => handleResize(entries[0]));\n\n resizeObserver.value.observe(radioGroupParent.value);\n }\n });\n\n onUnmounted(() => {\n if (props.variant === 'button' && resizeObserver.value) {\n resizeObserver.value?.disconnect();\n }\n });\n\n watchEffect(() => {\n internalOrientation.value = props.orientation;\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n ref=\"radioGroup\"\n class=\"stash-radio-group\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :error-id=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div v-else class=\"tw-flex\" data-test=\"stash-radio-group|default-slot\" :class=\"classes\">\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style scoped>\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed","internalOrientation","ref","resizeObserver","radioGroup","useTemplateRef","radioGroupParent","_a","radioGroupButtons","getButtonsWidth","acc","button","buttonWidth","initialTotalButtonsWidth","handleResize","entry","onMounted","entries","onUnmounted","watchEffect"],"mappings":"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"}
|
package/dist/RadioGroup.vue.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ fullWidth: boolean;
|
|
|
40
40
|
modelValue: undefined;
|
|
41
41
|
name: undefined;
|
|
42
42
|
options: undefined;
|
|
43
|
+
orientation: string;
|
|
43
44
|
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
44
45
|
"update:modelValue": (value: string) => void;
|
|
45
46
|
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<RadioGroupProps>, {
|
|
@@ -48,6 +49,7 @@ fullWidth: boolean;
|
|
|
48
49
|
modelValue: undefined;
|
|
49
50
|
name: undefined;
|
|
50
51
|
options: undefined;
|
|
52
|
+
orientation: string;
|
|
51
53
|
}>>> & Readonly<{
|
|
52
54
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
53
55
|
}>, {
|
|
@@ -56,6 +58,7 @@ options: RadioGroupOption[];
|
|
|
56
58
|
modelValue: string;
|
|
57
59
|
variant: "button" | "radio" | "tile" | "chip";
|
|
58
60
|
fullWidth: boolean;
|
|
61
|
+
orientation: "vertical" | "horizontal";
|
|
59
62
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
60
63
|
default?(_: {}): any;
|
|
61
64
|
}>;
|
|
@@ -151,6 +154,12 @@ export declare interface RadioGroupInjection {
|
|
|
151
154
|
* @default 'radio'
|
|
152
155
|
*/
|
|
153
156
|
variant: ComputedRef<RadioGroupVariants | undefined>;
|
|
157
|
+
/**
|
|
158
|
+
* Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.
|
|
159
|
+
*
|
|
160
|
+
* Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.
|
|
161
|
+
*/
|
|
162
|
+
orientation?: ComputedRef<'horizontal' | 'vertical'>;
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
/**
|
|
@@ -205,6 +214,14 @@ export declare interface RadioGroupProps extends FieldProps {
|
|
|
205
214
|
* Whether the group should expand to the parent's width
|
|
206
215
|
*/
|
|
207
216
|
fullWidth?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.
|
|
219
|
+
*
|
|
220
|
+
* Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.
|
|
221
|
+
*
|
|
222
|
+
* @defaultValue 'horizontal'
|
|
223
|
+
*/
|
|
224
|
+
orientation?: 'horizontal' | 'vertical';
|
|
208
225
|
}
|
|
209
226
|
|
|
210
227
|
export declare enum RadioGroupVariant {
|