@leaflink/stash 52.0.2 → 52.0.3
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/Carousel.js +69 -74
- package/dist/Carousel.js.map +1 -1
- package/dist/RadioGroup.js +161 -157
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SelectStatus.js +12 -13
- package/dist/SelectStatus.js.map +1 -1
- package/dist/components.css +1 -1
- package/package.json +1 -1
package/dist/RadioGroup.js
CHANGED
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
import { defineComponent as x, inject as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as x, inject as V, useCssModule as g, createElementBlock as _, openBlock as n, normalizeClass as f, unref as e, Fragment as R, renderList as I, createElementVNode as c, toDisplayString as h, provide as j, computed as v, ref as C, useTemplateRef as D, onMounted as q, onUnmounted as A, watchEffect as L, createBlock as T, mergeProps as N, withCtx as P, renderSlot as W, resolveDynamicComponent as U } from "vue";
|
|
2
|
+
import F from "lodash-es/uniqueId";
|
|
3
3
|
import { R as k } from "./RadioGroup.keys-CqfiKkNz.js";
|
|
4
4
|
import { _ as B } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
5
|
+
import { _ as J } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
|
|
6
|
+
const H = ["id", "name", "value", "checked", "disabled"], K = ["for"], Q = /* @__PURE__ */ x({
|
|
7
7
|
__name: "VariantButton",
|
|
8
8
|
setup(p) {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
9
|
+
const d = V(k.key);
|
|
10
|
+
if (!d)
|
|
11
11
|
throw new Error("VariantButton must be used with a RadioGroup instance.");
|
|
12
|
-
const { name:
|
|
13
|
-
return (
|
|
14
|
-
class:
|
|
12
|
+
const { name: s, disabled: a, fullWidth: m, modelValue: u, options: w, update: i } = d, l = g();
|
|
13
|
+
return ($, r) => (n(), _("div", {
|
|
14
|
+
class: f(["tw-flex", e(l).root])
|
|
15
15
|
}, [
|
|
16
|
-
(
|
|
17
|
-
key: `${e(
|
|
18
|
-
class:
|
|
16
|
+
(n(!0), _(R, null, I(e(w), (t) => (n(), _("div", {
|
|
17
|
+
key: `${e(s)}-${t.id}`,
|
|
18
|
+
class: f([{ "tw-w-full": e(m) }])
|
|
19
19
|
}, [
|
|
20
|
-
|
|
21
|
-
id: `${e(
|
|
20
|
+
c("input", {
|
|
21
|
+
id: `${e(s)}-${t.id}`,
|
|
22
22
|
class: "tw-sr-only",
|
|
23
23
|
type: "radio",
|
|
24
|
-
name: e(
|
|
24
|
+
name: e(s),
|
|
25
25
|
value: t.value,
|
|
26
|
-
checked: e(
|
|
26
|
+
checked: e(u) === t.value,
|
|
27
27
|
disabled: e(a) || t.disabled,
|
|
28
|
-
onInput:
|
|
29
|
-
(...
|
|
30
|
-
}, null, 40,
|
|
31
|
-
|
|
32
|
-
for: `${e(
|
|
33
|
-
},
|
|
28
|
+
onInput: r[0] || (r[0] = //@ts-ignore
|
|
29
|
+
(...b) => e(i) && e(i)(...b))
|
|
30
|
+
}, null, 40, H),
|
|
31
|
+
c("label", {
|
|
32
|
+
for: `${e(s)}-${t.id}`
|
|
33
|
+
}, h(t.text), 9, K)
|
|
34
34
|
], 2))), 128))
|
|
35
35
|
], 2));
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
38
|
-
root:
|
|
39
|
-
},
|
|
40
|
-
$style:
|
|
41
|
-
},
|
|
37
|
+
}), X = "_root_1bamn_2", Y = {
|
|
38
|
+
root: X
|
|
39
|
+
}, Z = {
|
|
40
|
+
$style: Y
|
|
41
|
+
}, ee = /* @__PURE__ */ B(Q, [["__cssModules", Z]]), te = ["id", "name", "value", "checked", "disabled"], ae = ["for"], se = /* @__PURE__ */ x({
|
|
42
42
|
__name: "VariantChip",
|
|
43
43
|
setup(p) {
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
44
|
+
const d = V(k.key);
|
|
45
|
+
if (!d)
|
|
46
46
|
throw new Error("VariantChip must be used with a RadioGroup instance.");
|
|
47
|
-
const { name:
|
|
48
|
-
return (
|
|
49
|
-
class:
|
|
47
|
+
const { name: s, disabled: a, fullWidth: m, modelValue: u, options: w, update: i } = d, l = g();
|
|
48
|
+
return ($, r) => (n(), _("div", {
|
|
49
|
+
class: f(["tw-my-1.5 tw-flex tw-flex-wrap", e(l).root])
|
|
50
50
|
}, [
|
|
51
|
-
(
|
|
52
|
-
key: `${e(
|
|
53
|
-
class:
|
|
51
|
+
(n(!0), _(R, null, I(e(w), (t) => (n(), _("div", {
|
|
52
|
+
key: `${e(s)}-${t.id}`,
|
|
53
|
+
class: f([{ "tw-w-full": e(m) }])
|
|
54
54
|
}, [
|
|
55
|
-
|
|
56
|
-
id: `${e(
|
|
55
|
+
c("input", {
|
|
56
|
+
id: `${e(s)}-${t.id}`,
|
|
57
57
|
class: "tw-sr-only",
|
|
58
58
|
type: "radio",
|
|
59
|
-
name: e(
|
|
59
|
+
name: e(s),
|
|
60
60
|
value: t.value,
|
|
61
|
-
checked: e(
|
|
61
|
+
checked: e(u) === t.value,
|
|
62
62
|
disabled: e(a) || t.disabled,
|
|
63
|
-
onInput:
|
|
64
|
-
(...
|
|
65
|
-
}, null, 40,
|
|
66
|
-
|
|
67
|
-
for: `${e(
|
|
68
|
-
},
|
|
63
|
+
onInput: r[0] || (r[0] = //@ts-ignore
|
|
64
|
+
(...b) => e(i) && e(i)(...b))
|
|
65
|
+
}, null, 40, te),
|
|
66
|
+
c("label", {
|
|
67
|
+
for: `${e(s)}-${t.id}`
|
|
68
|
+
}, h(t.text), 9, ae)
|
|
69
69
|
], 2))), 128))
|
|
70
70
|
], 2));
|
|
71
71
|
}
|
|
72
|
-
}), oe = "_root_kagur_2",
|
|
72
|
+
}), oe = "_root_kagur_2", le = {
|
|
73
73
|
root: oe
|
|
74
|
-
},
|
|
75
|
-
$style:
|
|
76
|
-
},
|
|
74
|
+
}, re = {
|
|
75
|
+
$style: le
|
|
76
|
+
}, ne = /* @__PURE__ */ B(se, [["__cssModules", re]]), ie = ["id", "name", "value", "checked", "disabled"], de = ["for"], ue = /* @__PURE__ */ x({
|
|
77
77
|
__name: "VariantRadio",
|
|
78
78
|
setup(p) {
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
79
|
+
const d = V(k.key);
|
|
80
|
+
if (!d)
|
|
81
81
|
throw new Error("VariantRadio must be used with a RadioGroup instance.");
|
|
82
|
-
const { name:
|
|
83
|
-
return (
|
|
84
|
-
class:
|
|
82
|
+
const { name: s, disabled: a, fullWidth: m, modelValue: u, options: w, update: i } = d, l = g();
|
|
83
|
+
return ($, r) => (n(), _("div", {
|
|
84
|
+
class: f(["tw-flex tw-flex-wrap", e(l).root])
|
|
85
85
|
}, [
|
|
86
|
-
(
|
|
87
|
-
key: `${e(
|
|
88
|
-
class:
|
|
86
|
+
(n(!0), _(R, null, I(e(w), (t) => (n(), _("div", {
|
|
87
|
+
key: `${e(s)}-${t.id}`,
|
|
88
|
+
class: f([{ "tw-w-full": e(m) }])
|
|
89
89
|
}, [
|
|
90
|
-
|
|
91
|
-
id: `${e(
|
|
90
|
+
c("input", {
|
|
91
|
+
id: `${e(s)}-${t.id}`,
|
|
92
92
|
type: "radio",
|
|
93
|
-
name: e(
|
|
93
|
+
name: e(s),
|
|
94
94
|
value: t.value,
|
|
95
|
-
checked: e(
|
|
95
|
+
checked: e(u) === t.value,
|
|
96
96
|
disabled: e(a) || t.disabled,
|
|
97
|
-
onInput:
|
|
98
|
-
(...
|
|
99
|
-
}, null, 40,
|
|
100
|
-
|
|
101
|
-
for: `${e(
|
|
102
|
-
},
|
|
97
|
+
onInput: r[0] || (r[0] = //@ts-ignore
|
|
98
|
+
(...b) => e(i) && e(i)(...b))
|
|
99
|
+
}, null, 40, ie),
|
|
100
|
+
c("label", {
|
|
101
|
+
for: `${e(s)}-${t.id}`
|
|
102
|
+
}, h(t.text), 9, de)
|
|
103
103
|
], 2))), 128))
|
|
104
104
|
], 2));
|
|
105
105
|
}
|
|
106
|
-
}),
|
|
107
|
-
root:
|
|
108
|
-
},
|
|
109
|
-
$style:
|
|
110
|
-
},
|
|
106
|
+
}), ce = "_root_11y1n_2", _e = {
|
|
107
|
+
root: ce
|
|
108
|
+
}, pe = {
|
|
109
|
+
$style: _e
|
|
110
|
+
}, fe = /* @__PURE__ */ B(ue, [["__cssModules", pe]]), ve = ["for"], me = ["id", "name", "value", "checked", "disabled"], we = { class: "tw-m-0 tw-text-ice-900" }, be = { class: "tw-m-0 tw-text-ice-700" }, he = /* @__PURE__ */ x({
|
|
111
111
|
__name: "VariantTile",
|
|
112
112
|
setup(p) {
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
113
|
+
const d = V(k.key);
|
|
114
|
+
if (!d)
|
|
115
115
|
throw new Error("VariantTile must be used with a RadioGroup instance.");
|
|
116
|
-
const { name:
|
|
117
|
-
return (
|
|
118
|
-
class:
|
|
116
|
+
const { name: s, disabled: a, fullWidth: m, modelValue: u, options: w, update: i } = d, l = g();
|
|
117
|
+
return ($, r) => (n(), _("div", {
|
|
118
|
+
class: f(["tw-flex tw-flex-wrap", e(l).root])
|
|
119
119
|
}, [
|
|
120
|
-
(
|
|
121
|
-
key: `${e(
|
|
122
|
-
class:
|
|
123
|
-
for: `${e(
|
|
120
|
+
(n(!0), _(R, null, I(e(w), (t) => (n(), _("label", {
|
|
121
|
+
key: `${e(s)}-${t.id}`,
|
|
122
|
+
class: f([e(l)["tile-container"], { "tw-w-full": e(m) }]),
|
|
123
|
+
for: `${e(s)}-${t.id}`
|
|
124
124
|
}, [
|
|
125
|
-
|
|
126
|
-
class:
|
|
127
|
-
e(
|
|
125
|
+
c("div", {
|
|
126
|
+
class: f(["tw-flex tw-border", [
|
|
127
|
+
e(l)["tile-header"],
|
|
128
128
|
{
|
|
129
|
-
"tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900": e(
|
|
130
|
-
"tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700": e(
|
|
129
|
+
"tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900": e(u) === t.value,
|
|
130
|
+
"tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700": e(u) !== t.value
|
|
131
131
|
}
|
|
132
132
|
]])
|
|
133
133
|
}, [
|
|
134
|
-
|
|
135
|
-
id: `${e(
|
|
134
|
+
c("input", {
|
|
135
|
+
id: `${e(s)}-${t.id}`,
|
|
136
136
|
class: "tw-sr-only",
|
|
137
137
|
type: "radio",
|
|
138
|
-
name: e(
|
|
138
|
+
name: e(s),
|
|
139
139
|
value: t.value,
|
|
140
|
-
checked: e(
|
|
140
|
+
checked: e(u) === t.value,
|
|
141
141
|
disabled: e(a) || t.disabled,
|
|
142
|
-
onInput:
|
|
143
|
-
(...
|
|
144
|
-
}, null, 40,
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
onInput: r[0] || (r[0] = //@ts-ignore
|
|
143
|
+
(...b) => e(i) && e(i)(...b))
|
|
144
|
+
}, null, 40, me),
|
|
145
|
+
c("div", null, [
|
|
146
|
+
c("span", null, h(t.text), 1)
|
|
147
147
|
])
|
|
148
148
|
], 2),
|
|
149
|
-
|
|
150
|
-
class:
|
|
151
|
-
e(
|
|
149
|
+
c("div", {
|
|
150
|
+
class: f(["tw-border-x tw-border-b", [
|
|
151
|
+
e(l)["tile-body"],
|
|
152
152
|
{
|
|
153
|
-
"tw-border-ice-500": e(
|
|
154
|
-
"tw-border-blue-500": e(
|
|
153
|
+
"tw-border-ice-500": e(u) !== t.value,
|
|
154
|
+
"tw-border-blue-500": e(u) === t.value
|
|
155
155
|
}
|
|
156
156
|
]])
|
|
157
157
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
c("p", we, h(t.subTitle), 1),
|
|
159
|
+
c("p", be, h(t.subText), 1)
|
|
160
160
|
], 2)
|
|
161
161
|
], 10, ve))), 128))
|
|
162
162
|
], 2));
|
|
163
163
|
}
|
|
164
|
-
}),
|
|
165
|
-
root:
|
|
164
|
+
}), $e = "_root_1sppn_2", ye = {
|
|
165
|
+
root: $e,
|
|
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
|
-
},
|
|
169
|
+
}, xe = {
|
|
170
|
+
$style: ye
|
|
171
|
+
}, ge = /* @__PURE__ */ B(he, [["__cssModules", xe]]);
|
|
172
172
|
var y = /* @__PURE__ */ ((p) => (p.Radio = "radio", p.Button = "button", p.Chip = "chip", p.Tile = "tile", p))(y || {});
|
|
173
173
|
const ke = /* @__PURE__ */ x({
|
|
174
174
|
__name: "RadioGroup",
|
|
@@ -194,83 +194,87 @@ const ke = /* @__PURE__ */ x({
|
|
|
194
194
|
disabled: { type: Boolean }
|
|
195
195
|
},
|
|
196
196
|
emits: ["update:modelValue"],
|
|
197
|
-
setup(p, { emit:
|
|
198
|
-
const
|
|
199
|
-
[y.Button]:
|
|
200
|
-
[y.Chip]:
|
|
201
|
-
[y.Radio]:
|
|
202
|
-
[y.Tile]:
|
|
203
|
-
}, a = p,
|
|
204
|
-
function
|
|
205
|
-
|
|
197
|
+
setup(p, { emit: d }) {
|
|
198
|
+
const s = {
|
|
199
|
+
[y.Button]: ee,
|
|
200
|
+
[y.Chip]: ne,
|
|
201
|
+
[y.Radio]: fe,
|
|
202
|
+
[y.Tile]: ge
|
|
203
|
+
}, a = p, m = d, u = g();
|
|
204
|
+
function w(o) {
|
|
205
|
+
m("update:modelValue", o.target.value);
|
|
206
206
|
}
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
name:
|
|
210
|
-
disabled:
|
|
211
|
-
fullWidth:
|
|
212
|
-
modelValue:
|
|
213
|
-
options:
|
|
214
|
-
variant:
|
|
215
|
-
orientation:
|
|
216
|
-
update:
|
|
207
|
+
const i = F("radio-group-field-error-");
|
|
208
|
+
j(k.key, {
|
|
209
|
+
name: v(() => a.name),
|
|
210
|
+
disabled: v(() => a.isDisabled || a.disabled),
|
|
211
|
+
fullWidth: v(() => a.fullWidth),
|
|
212
|
+
modelValue: v(() => a.modelValue),
|
|
213
|
+
options: v(() => a.options),
|
|
214
|
+
variant: v(() => a.variant),
|
|
215
|
+
orientation: v(() => l.value),
|
|
216
|
+
update: w
|
|
217
217
|
});
|
|
218
|
-
const l = C(a.orientation),
|
|
218
|
+
const l = C(a.orientation), $ = v(() => ({
|
|
219
219
|
"tw-flex-wrap": a.variant !== "button",
|
|
220
220
|
"tw-gap-x-1.5 tw-gap-y-3": a.variant === "chip" && l.value === "horizontal",
|
|
221
221
|
"tw-gap-6": a.variant === "radio" || a.variant === "tile" || a.variant === "chip" && l.value === "vertical",
|
|
222
222
|
"tw-flex-col": l.value === "vertical"
|
|
223
|
-
})),
|
|
224
|
-
var
|
|
225
|
-
return (
|
|
226
|
-
}),
|
|
227
|
-
var
|
|
228
|
-
return a.variant !== "button" ? [] : Array.from((
|
|
223
|
+
})), r = C(null), t = D("radioGroup"), b = v(() => {
|
|
224
|
+
var o;
|
|
225
|
+
return (o = t.value) == null ? void 0 : o.$el.parentElement;
|
|
226
|
+
}), E = v(() => {
|
|
227
|
+
var o;
|
|
228
|
+
return a.variant !== "button" ? [] : Array.from((o = t.value) == null ? void 0 : o.$el.querySelectorAll("[data-variant-button]")) || [];
|
|
229
229
|
});
|
|
230
|
-
function
|
|
231
|
-
return
|
|
232
|
-
const
|
|
233
|
-
return
|
|
230
|
+
function O() {
|
|
231
|
+
return E.value.reduce((o, M) => {
|
|
232
|
+
const S = M.getBoundingClientRect().width;
|
|
233
|
+
return o + S;
|
|
234
234
|
}, 0);
|
|
235
235
|
}
|
|
236
|
-
const G = C(0),
|
|
237
|
-
l.value = G.value >
|
|
236
|
+
const G = C(0), z = (o) => {
|
|
237
|
+
l.value = G.value > o.contentBoxSize[0].inlineSize ? "vertical" : a.orientation;
|
|
238
238
|
};
|
|
239
|
-
return
|
|
240
|
-
a.variant === "button" && !a.fullWidth && (G.value =
|
|
241
|
-
}), q(() => {
|
|
242
|
-
var r;
|
|
243
|
-
a.variant === "button" && h.value && ((r = h.value) == null || r.disconnect());
|
|
239
|
+
return q(() => {
|
|
240
|
+
a.variant === "button" && !a.fullWidth && (G.value = O(), r.value = new ResizeObserver((o) => z(o[0])), r.value.observe(b.value));
|
|
244
241
|
}), A(() => {
|
|
242
|
+
var o;
|
|
243
|
+
a.variant === "button" && r.value && ((o = r.value) == null || o.disconnect());
|
|
244
|
+
}), L(() => {
|
|
245
245
|
l.value = a.orientation;
|
|
246
|
-
}), (
|
|
246
|
+
}), (o, M) => (n(), T(J, N(a, {
|
|
247
247
|
ref: "radioGroup",
|
|
248
|
-
class: "stash-radio-group",
|
|
248
|
+
class: ["stash-radio-group", e(u)["stash-radio-group"]],
|
|
249
249
|
"data-test": "stash-radio-group",
|
|
250
|
-
"aria-errormessage": e(
|
|
251
|
-
"error-id": e(
|
|
250
|
+
"aria-errormessage": e(i),
|
|
251
|
+
"error-id": e(i),
|
|
252
252
|
"aria-invalid": !!a.errorText,
|
|
253
253
|
role: "radiogroup",
|
|
254
254
|
fieldset: ""
|
|
255
255
|
}), {
|
|
256
|
-
default:
|
|
257
|
-
a.options ? W(
|
|
258
|
-
(
|
|
259
|
-
]
|
|
256
|
+
default: P(() => [
|
|
257
|
+
a.options ? W(o.$slots, "default", { key: 0 }, () => [
|
|
258
|
+
(n(), T(U(s[a.variant])))
|
|
259
|
+
]) : (n(), _("div", {
|
|
260
260
|
key: 1,
|
|
261
|
-
class:
|
|
261
|
+
class: f(["tw-flex", $.value]),
|
|
262
262
|
"data-test": "stash-radio-group|default-slot"
|
|
263
263
|
}, [
|
|
264
|
-
W(
|
|
264
|
+
W(o.$slots, "default")
|
|
265
265
|
], 2))
|
|
266
266
|
]),
|
|
267
267
|
_: 3
|
|
268
|
-
}, 16, ["aria-errormessage", "error-id", "aria-invalid"]));
|
|
268
|
+
}, 16, ["class", "aria-errormessage", "error-id", "aria-invalid"]));
|
|
269
269
|
}
|
|
270
|
-
}),
|
|
270
|
+
}), Be = {
|
|
271
|
+
"stash-radio-group": "_stash-radio-group_1yi2h_2"
|
|
272
|
+
}, Ve = {
|
|
273
|
+
$style: Be
|
|
274
|
+
}, Te = /* @__PURE__ */ B(ke, [["__cssModules", Ve]]);
|
|
271
275
|
export {
|
|
272
276
|
k as RADIO_GROUP_INJECTION,
|
|
273
277
|
y as RadioGroupVariant,
|
|
274
|
-
|
|
278
|
+
Te as default
|
|
275
279
|
};
|
|
276
280
|
//# 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 /**\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 radioGroupRef = useTemplateRef('radioGroup');\n const radioGroupParent = computed(() => radioGroupRef.value?.$el.parentElement);\n const radioGroupButtons = computed(() => {\n if (props.variant !== 'button') {\n return [];\n }\n\n return Array.from<HTMLElement>(radioGroupRef.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","radioGroupRef","useTemplateRef","radioGroupParent","_a","radioGroupButtons","getButtonsWidth","acc","button","buttonWidth","initialTotalButtonsWidth","handleResize","entry","onMounted","entries","onUnmounted","watchEffect"],"mappings":";;;;;;;;AAKE,UAAMA,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACH,YAAM,IAAI,MAAM,wDAAwD;AAG1E,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPhB,UAAMV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACH,YAAM,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,G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aAAa,aAAavB,EAAM;AAAA,IAC7F;AAEA,WAAAwB,EAAU,MAAM;AAGd,MAAIxB,EAAM,YAAY,YAAY,CAACA,EAAM,cACvCqB,EAAyB,QAAQJ,EAAA,GACjCN,EAAe,QAAQ,IAAI,eAAe,CAACc,MAAYH,EAAaG,EAAQ,CAAC,CAAC,CAAC,GAE/Ed,EAAe,MAAM,QAAQG,EAAiB,KAAK;AAAA,IAEvD,CAAC,GAEDY,EAAY,MAAM;;AAChB,MAAI1B,EAAM,YAAY,YAAYW,EAAe,WAC/CI,IAAAJ,EAAe,UAAf,QAAAI,EAAsB;AAAA,IAE1B,CAAC,GAEDY,EAAY,MAAM;AAChB,MAAAlB,EAAoB,QAAQT,EAAM;AAAA,IACpC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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, useCssModule, 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 const classes = useCssModule();\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 defaultSlotClasses = 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 radioGroupRef = useTemplateRef('radioGroup');\n const radioGroupParent = computed(() => radioGroupRef.value?.$el.parentElement);\n const radioGroupButtons = computed(() => {\n if (props.variant !== 'button') {\n return [];\n }\n\n return Array.from<HTMLElement>(radioGroupRef.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 :class=\"classes['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=\"defaultSlotClasses\">\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style module>\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","defaultSlotClasses","resizeObserver","radioGroupRef","useTemplateRef","radioGroupParent","_a","radioGroupButtons","getButtonsWidth","acc","button","buttonWidth","initialTotalButtonsWidth","handleResize","entry","onMounted","entries","onUnmounted","watchEffect"],"mappings":";;;;;;;;AAKE,UAAMA,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACH,YAAM,IAAI,MAAM,wDAAwD;AAG1E,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,MAAWR,GAC7DS,IAAUC,EAAA;;;;;;;;;;;;;;;;;;;;;;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wB;AACnD,eAAOD,IAAME;AAAA,MACf,GAAG,CAAC;AAAA,IACN;AAEA,UAAMC,IAA2BZ,EAAI,CAAC,GAEhCa,IAAe,CAACC,MAA+B;AACnD,MAAAf,EAAoB,QAClBa,EAAyB,QAAQE,EAAM,eAAe,CAAC,EAAE,aAAa,aAAaxB,EAAM;AAAA,IAC7F;AAEA,WAAAyB,EAAU,MAAM;AAGd,MAAIzB,EAAM,YAAY,YAAY,CAACA,EAAM,cACvCsB,EAAyB,QAAQJ,EAAA,GACjCN,EAAe,QAAQ,IAAI,eAAe,CAACc,MAAYH,EAAaG,EAAQ,CAAC,CAAC,CAAC,GAE/Ed,EAAe,MAAM,QAAQG,EAAiB,KAAK;AAAA,IAEvD,CAAC,GAEDY,EAAY,MAAM;;AAChB,MAAI3B,EAAM,YAAY,YAAYY,EAAe,WAC/CI,IAAAJ,EAAe,UAAf,QAAAI,EAAsB;AAAA,IAE1B,CAAC,GAEDY,EAAY,MAAM;AAChB,MAAAnB,EAAoB,QAAQT,EAAM;AAAA,IACpC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/SelectStatus.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as S, useAttrs as g, useCssModule as C, computed as u, createBlock as O, openBlock as c, normalizeClass as l, unref as V, withCtx as r, createElementVNode as a, createVNode as i, normalizeStyle as m, toDisplayString as n, createElementBlock as f } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import y from "./Icon.js";
|
|
3
3
|
import $ from "./Select.js";
|
|
4
4
|
import { _ as E } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
5
|
const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
@@ -22,15 +22,15 @@ const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
|
22
22
|
label: { default: void 0 }
|
|
23
23
|
},
|
|
24
24
|
emits: ["update:model-value"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
25
|
+
setup(p, { emit: w }) {
|
|
26
|
+
const h = ["green", "teal", "ice", "yellow", "seafoam", "seafoam-700"], _ = g(), v = C(), t = p;
|
|
27
27
|
if (t.value)
|
|
28
28
|
throw new Error("ll-select-status: use :model-value or v-model instead of :value.");
|
|
29
|
-
if (
|
|
29
|
+
if (_.onInput)
|
|
30
30
|
throw new Error("ll-select-status: use the @update:model-value event instead of @input");
|
|
31
31
|
const x = w, o = u(() => t.statusOptions.find((e) => e[t.trackBy] === t.modelValue)), B = u(() => {
|
|
32
32
|
const { color: e = "" } = o.value || {};
|
|
33
|
-
return
|
|
33
|
+
return h.includes(e);
|
|
34
34
|
});
|
|
35
35
|
function b(e) {
|
|
36
36
|
return e != null && e.includes("-") ? `tw-bg-${e}` : `tw-bg-${e}-500`;
|
|
@@ -41,7 +41,7 @@ const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
|
41
41
|
function k(e) {
|
|
42
42
|
x("update:model-value", (e == null ? void 0 : e[t.trackBy]) ?? "");
|
|
43
43
|
}
|
|
44
|
-
return (e,
|
|
44
|
+
return (e, A) => (c(), O($, {
|
|
45
45
|
ref: "select",
|
|
46
46
|
"hide-search": "",
|
|
47
47
|
single: "",
|
|
@@ -70,7 +70,7 @@ const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
|
70
70
|
}, [
|
|
71
71
|
a("span", N, n(s[t.displayBy]), 1)
|
|
72
72
|
], 2)) : (c(), f("div", z, [
|
|
73
|
-
i(
|
|
73
|
+
i(y, {
|
|
74
74
|
"data-test": "select-status|value-icon",
|
|
75
75
|
name: s.icon || "circle-status",
|
|
76
76
|
class: l([
|
|
@@ -84,7 +84,7 @@ const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
|
84
84
|
]),
|
|
85
85
|
option: r(({ option: s }) => [
|
|
86
86
|
a("div", I, [
|
|
87
|
-
i(
|
|
87
|
+
i(y, {
|
|
88
88
|
"data-test": "svg|status-color",
|
|
89
89
|
name: s.icon || "circle-status",
|
|
90
90
|
class: l([[
|
|
@@ -102,12 +102,11 @@ const N = { class: "tw-mr-6 tw-truncate" }, z = {
|
|
|
102
102
|
_: 1
|
|
103
103
|
}, 8, ["class", "disabled", "icon", "options", "placeholder", "track-by", "model-value", "label"]));
|
|
104
104
|
}
|
|
105
|
-
}), M = "
|
|
106
|
-
select: M
|
|
107
|
-
|
|
108
|
-
}, A = {
|
|
105
|
+
}), M = "_select_jljdg_27", T = {
|
|
106
|
+
select: M
|
|
107
|
+
}, j = {
|
|
109
108
|
$style: T
|
|
110
|
-
}, q = /* @__PURE__ */ E(L, [["__cssModules",
|
|
109
|
+
}, q = /* @__PURE__ */ E(L, [["__cssModules", j]]);
|
|
111
110
|
export {
|
|
112
111
|
q as default
|
|
113
112
|
};
|