@leaflink/stash 51.2.0 → 51.3.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/CurrencyInput.js +1 -0
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +4 -0
- package/dist/DataViewFilters.js +1 -1
- package/dist/Field.js +1 -1
- package/dist/Field.vue.d.ts +7 -0
- package/dist/{Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js → Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js} +21 -19
- package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -0
- package/dist/FilterSelect.js +16 -15
- package/dist/FilterSelect.js.map +1 -1
- package/dist/FilterSelect.vue.d.ts +4 -0
- package/dist/Filters.vue.d.ts +27 -0
- package/dist/Input.js +16 -15
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +4 -0
- package/dist/InputOptions.js +20 -19
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +4 -0
- package/dist/Label.js +1 -1
- package/dist/Label.vue.d.ts +7 -0
- package/dist/{Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js → Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js} +13 -11
- package/dist/Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map +1 -0
- package/dist/ListView.vue.d.ts +36 -0
- package/dist/RadioGroup.js +48 -47
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.vue.d.ts +4 -0
- package/dist/Select.js +2 -1
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +4 -0
- package/dist/TextEditor.js +2 -1
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +4 -0
- package/dist/Textarea.js +24 -23
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +4 -0
- package/package.json +1 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js.map +0 -1
- package/dist/Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js.map +0 -1
package/dist/RadioGroup.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as x, inject as g, useCssModule as V, createElementBlock as c, openBlock as
|
|
1
|
+
import { defineComponent as x, inject as g, useCssModule as V, createElementBlock as c, openBlock as s, 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 L, withCtx as N, renderSlot as W, resolveDynamicComponent as P } from "vue";
|
|
2
2
|
import U 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 F } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
import { _ as F } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
|
|
6
6
|
const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @__PURE__ */ x({
|
|
7
7
|
__name: "VariantButton",
|
|
8
8
|
setup(p) {
|
|
9
9
|
const i = g(k.key);
|
|
10
10
|
if (!i)
|
|
11
11
|
throw new Error("VariantButton must be used with a RadioGroup instance.");
|
|
12
|
-
const { name: o, disabled: a, fullWidth:
|
|
13
|
-
return (h, n) => (
|
|
12
|
+
const { name: o, disabled: a, fullWidth: b, modelValue: d, options: f, update: l } = i, _ = V();
|
|
13
|
+
return (h, n) => (s(), c("div", {
|
|
14
14
|
class: v(["tw-flex", e(_).root])
|
|
15
15
|
}, [
|
|
16
|
-
(
|
|
16
|
+
(s(!0), c(R, null, I(e(f), (t) => (s(), c("div", {
|
|
17
17
|
key: `${e(o)}-${t.id}`,
|
|
18
|
-
class: v([{ "tw-w-full": e(
|
|
18
|
+
class: v([{ "tw-w-full": e(b) }])
|
|
19
19
|
}, [
|
|
20
20
|
u("input", {
|
|
21
21
|
id: `${e(o)}-${t.id}`,
|
|
@@ -26,7 +26,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
26
26
|
checked: e(d) === t.value,
|
|
27
27
|
disabled: e(a) || t.disabled,
|
|
28
28
|
onInput: n[0] || (n[0] = //@ts-ignore
|
|
29
|
-
(...
|
|
29
|
+
(...w) => e(l) && e(l)(...w))
|
|
30
30
|
}, null, 40, J),
|
|
31
31
|
u("label", {
|
|
32
32
|
for: `${e(o)}-${t.id}`
|
|
@@ -44,13 +44,13 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
44
44
|
const i = g(k.key);
|
|
45
45
|
if (!i)
|
|
46
46
|
throw new Error("VariantChip must be used with a RadioGroup instance.");
|
|
47
|
-
const { name: o, disabled: a, fullWidth:
|
|
48
|
-
return (h, n) => (
|
|
47
|
+
const { name: o, disabled: a, fullWidth: b, modelValue: d, options: f, update: l } = i, _ = V();
|
|
48
|
+
return (h, n) => (s(), c("div", {
|
|
49
49
|
class: v(["tw-my-1.5 tw-flex tw-flex-wrap", e(_).root])
|
|
50
50
|
}, [
|
|
51
|
-
(
|
|
51
|
+
(s(!0), c(R, null, I(e(f), (t) => (s(), c("div", {
|
|
52
52
|
key: `${e(o)}-${t.id}`,
|
|
53
|
-
class: v([{ "tw-w-full": e(
|
|
53
|
+
class: v([{ "tw-w-full": e(b) }])
|
|
54
54
|
}, [
|
|
55
55
|
u("input", {
|
|
56
56
|
id: `${e(o)}-${t.id}`,
|
|
@@ -61,7 +61,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
61
61
|
checked: e(d) === t.value,
|
|
62
62
|
disabled: e(a) || t.disabled,
|
|
63
63
|
onInput: n[0] || (n[0] = //@ts-ignore
|
|
64
|
-
(...
|
|
64
|
+
(...w) => e(l) && e(l)(...w))
|
|
65
65
|
}, null, 40, ee),
|
|
66
66
|
u("label", {
|
|
67
67
|
for: `${e(o)}-${t.id}`
|
|
@@ -71,21 +71,21 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
71
71
|
}
|
|
72
72
|
}), oe = "_root_kagur_2", re = {
|
|
73
73
|
root: oe
|
|
74
|
-
},
|
|
74
|
+
}, le = {
|
|
75
75
|
$style: re
|
|
76
|
-
},
|
|
76
|
+
}, se = /* @__PURE__ */ B(ae, [["__cssModules", le]]), ne = ["id", "name", "value", "checked", "disabled"], ie = ["for"], de = /* @__PURE__ */ x({
|
|
77
77
|
__name: "VariantRadio",
|
|
78
78
|
setup(p) {
|
|
79
79
|
const i = g(k.key);
|
|
80
80
|
if (!i)
|
|
81
81
|
throw new Error("VariantRadio must be used with a RadioGroup instance.");
|
|
82
|
-
const { name: o, disabled: a, fullWidth:
|
|
83
|
-
return (h, n) => (
|
|
82
|
+
const { name: o, disabled: a, fullWidth: b, modelValue: d, options: f, update: l } = i, _ = V();
|
|
83
|
+
return (h, n) => (s(), c("div", {
|
|
84
84
|
class: v(["tw-flex tw-flex-wrap", e(_).root])
|
|
85
85
|
}, [
|
|
86
|
-
(
|
|
86
|
+
(s(!0), c(R, null, I(e(f), (t) => (s(), c("div", {
|
|
87
87
|
key: `${e(o)}-${t.id}`,
|
|
88
|
-
class: v([{ "tw-w-full": e(
|
|
88
|
+
class: v([{ "tw-w-full": e(b) }])
|
|
89
89
|
}, [
|
|
90
90
|
u("input", {
|
|
91
91
|
id: `${e(o)}-${t.id}`,
|
|
@@ -95,7 +95,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
95
95
|
checked: e(d) === t.value,
|
|
96
96
|
disabled: e(a) || t.disabled,
|
|
97
97
|
onInput: n[0] || (n[0] = //@ts-ignore
|
|
98
|
-
(...
|
|
98
|
+
(...w) => e(l) && e(l)(...w))
|
|
99
99
|
}, null, 40, ne),
|
|
100
100
|
u("label", {
|
|
101
101
|
for: `${e(o)}-${t.id}`
|
|
@@ -107,19 +107,19 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
107
107
|
root: ue
|
|
108
108
|
}, _e = {
|
|
109
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" },
|
|
110
|
+
}, pe = /* @__PURE__ */ B(de, [["__cssModules", _e]]), ve = ["for"], fe = ["id", "name", "value", "checked", "disabled"], me = { class: "tw-m-0 tw-text-ice-900" }, be = { class: "tw-m-0 tw-text-ice-700" }, we = /* @__PURE__ */ x({
|
|
111
111
|
__name: "VariantTile",
|
|
112
112
|
setup(p) {
|
|
113
113
|
const i = g(k.key);
|
|
114
114
|
if (!i)
|
|
115
115
|
throw new Error("VariantTile must be used with a RadioGroup instance.");
|
|
116
|
-
const { name: o, disabled: a, fullWidth:
|
|
117
|
-
return (h, n) => (
|
|
116
|
+
const { name: o, disabled: a, fullWidth: b, modelValue: d, options: f, update: l } = i, _ = V();
|
|
117
|
+
return (h, n) => (s(), c("div", {
|
|
118
118
|
class: v(["tw-flex tw-flex-wrap", e(_).root])
|
|
119
119
|
}, [
|
|
120
|
-
(
|
|
120
|
+
(s(!0), c(R, null, I(e(f), (t) => (s(), c("label", {
|
|
121
121
|
key: `${e(o)}-${t.id}`,
|
|
122
|
-
class: v([e(_)["tile-container"], { "tw-w-full": e(
|
|
122
|
+
class: v([e(_)["tile-container"], { "tw-w-full": e(b) }]),
|
|
123
123
|
for: `${e(o)}-${t.id}`
|
|
124
124
|
}, [
|
|
125
125
|
u("div", {
|
|
@@ -140,7 +140,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
140
140
|
checked: e(d) === t.value,
|
|
141
141
|
disabled: e(a) || t.disabled,
|
|
142
142
|
onInput: n[0] || (n[0] = //@ts-ignore
|
|
143
|
-
(...
|
|
143
|
+
(...w) => e(l) && e(l)(...w))
|
|
144
144
|
}, null, 40, fe),
|
|
145
145
|
u("div", null, [
|
|
146
146
|
u("span", null, $(t.text), 1)
|
|
@@ -156,7 +156,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
156
156
|
]])
|
|
157
157
|
}, [
|
|
158
158
|
u("p", me, $(t.subTitle), 1),
|
|
159
|
-
u("p",
|
|
159
|
+
u("p", be, $(t.subText), 1)
|
|
160
160
|
], 2)
|
|
161
161
|
], 10, ve))), 128))
|
|
162
162
|
], 2));
|
|
@@ -168,7 +168,7 @@ const J = ["id", "name", "value", "checked", "disabled"], H = ["for"], K = /* @_
|
|
|
168
168
|
"tile-body": "_tile-body_1sppn_31"
|
|
169
169
|
}, ye = {
|
|
170
170
|
$style: $e
|
|
171
|
-
}, xe = /* @__PURE__ */ B(
|
|
171
|
+
}, xe = /* @__PURE__ */ B(we, [["__cssModules", ye]]);
|
|
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",
|
|
@@ -188,6 +188,7 @@ const ke = /* @__PURE__ */ x({
|
|
|
188
188
|
isRequired: { type: Boolean },
|
|
189
189
|
label: {},
|
|
190
190
|
showOptionalInLabel: { type: Boolean },
|
|
191
|
+
isLabelSrOnly: { type: Boolean },
|
|
191
192
|
fieldset: { type: Boolean },
|
|
192
193
|
isDisabled: { type: Boolean },
|
|
193
194
|
disabled: { type: Boolean }
|
|
@@ -196,12 +197,12 @@ const ke = /* @__PURE__ */ x({
|
|
|
196
197
|
setup(p, { emit: i }) {
|
|
197
198
|
const o = {
|
|
198
199
|
[y.Button]: Z,
|
|
199
|
-
[y.Chip]:
|
|
200
|
+
[y.Chip]: se,
|
|
200
201
|
[y.Radio]: pe,
|
|
201
202
|
[y.Tile]: xe
|
|
202
|
-
}, a = p,
|
|
203
|
+
}, a = p, b = i;
|
|
203
204
|
function d(r) {
|
|
204
|
-
|
|
205
|
+
b("update:modelValue", r.target.value);
|
|
205
206
|
}
|
|
206
207
|
const f = U("radio-group-field-error-");
|
|
207
208
|
S(k.key, {
|
|
@@ -211,38 +212,38 @@ const ke = /* @__PURE__ */ x({
|
|
|
211
212
|
modelValue: m(() => a.modelValue),
|
|
212
213
|
options: m(() => a.options),
|
|
213
214
|
variant: m(() => a.variant),
|
|
214
|
-
orientation: m(() =>
|
|
215
|
+
orientation: m(() => l.value),
|
|
215
216
|
update: d
|
|
216
217
|
});
|
|
217
|
-
const
|
|
218
|
+
const l = C(a.orientation), _ = m(() => ({
|
|
218
219
|
"tw-flex-wrap": a.variant !== "button",
|
|
219
|
-
"tw-gap-x-1.5 tw-gap-y-3": a.variant === "chip" &&
|
|
220
|
-
"tw-gap-6": a.variant === "radio" || a.variant === "tile" || a.variant === "chip" &&
|
|
221
|
-
"tw-flex-col":
|
|
220
|
+
"tw-gap-x-1.5 tw-gap-y-3": a.variant === "chip" && l.value === "horizontal",
|
|
221
|
+
"tw-gap-6": a.variant === "radio" || a.variant === "tile" || a.variant === "chip" && l.value === "vertical",
|
|
222
|
+
"tw-flex-col": l.value === "vertical"
|
|
222
223
|
})), h = C(null), n = j("radioGroup"), t = m(() => {
|
|
223
224
|
var r;
|
|
224
225
|
return (r = n.value) == null ? void 0 : r.$el.parentElement;
|
|
225
|
-
}),
|
|
226
|
+
}), w = m(() => {
|
|
226
227
|
var r;
|
|
227
228
|
return a.variant !== "button" ? [] : Array.from((r = n.value) == null ? void 0 : r.$el.querySelectorAll("[data-variant-button]")) || [];
|
|
228
229
|
});
|
|
229
230
|
function E() {
|
|
230
|
-
return
|
|
231
|
-
const
|
|
232
|
-
return r +
|
|
231
|
+
return w.value.reduce((r, T) => {
|
|
232
|
+
const z = T.getBoundingClientRect().width;
|
|
233
|
+
return r + z;
|
|
233
234
|
}, 0);
|
|
234
235
|
}
|
|
235
|
-
const G = C(0),
|
|
236
|
-
|
|
236
|
+
const G = C(0), O = (r) => {
|
|
237
|
+
l.value = G.value > r.contentBoxSize[0].inlineSize ? "vertical" : a.orientation;
|
|
237
238
|
};
|
|
238
239
|
return D(() => {
|
|
239
|
-
a.variant === "button" && !a.fullWidth && (G.value = E(), h.value = new ResizeObserver((r) =>
|
|
240
|
+
a.variant === "button" && !a.fullWidth && (G.value = E(), h.value = new ResizeObserver((r) => O(r[0])), h.value.observe(t.value));
|
|
240
241
|
}), q(() => {
|
|
241
242
|
var r;
|
|
242
243
|
a.variant === "button" && h.value && ((r = h.value) == null || r.disconnect());
|
|
243
244
|
}), A(() => {
|
|
244
|
-
|
|
245
|
-
}), (r, T) => (
|
|
245
|
+
l.value = a.orientation;
|
|
246
|
+
}), (r, T) => (s(), M(F, L(a, {
|
|
246
247
|
ref: "radioGroup",
|
|
247
248
|
class: "stash-radio-group",
|
|
248
249
|
"data-test": "stash-radio-group",
|
|
@@ -252,10 +253,10 @@ const ke = /* @__PURE__ */ x({
|
|
|
252
253
|
role: "radiogroup",
|
|
253
254
|
fieldset: ""
|
|
254
255
|
}), {
|
|
255
|
-
default:
|
|
256
|
+
default: N(() => [
|
|
256
257
|
a.options ? W(r.$slots, "default", { key: 0 }, () => [
|
|
257
|
-
(
|
|
258
|
-
], !0) : (
|
|
258
|
+
(s(), M(P(o[a.variant])))
|
|
259
|
+
], !0) : (s(), c("div", {
|
|
259
260
|
key: 1,
|
|
260
261
|
class: v(["tw-flex", _.value]),
|
|
261
262
|
"data-test": "stash-radio-group|default-slot"
|
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":"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"}
|
|
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":"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"}
|
package/dist/RadioGroup.vue.d.ts
CHANGED
|
@@ -101,6 +101,10 @@ declare interface FieldProps {
|
|
|
101
101
|
* Show "(optional)" to the right of the label text
|
|
102
102
|
*/
|
|
103
103
|
showOptionalInLabel?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Indicates whether the label should be visually hidden (screen reader only).
|
|
106
|
+
*/
|
|
107
|
+
isLabelSrOnly?: boolean;
|
|
104
108
|
/**
|
|
105
109
|
* Indicates wheter the field is a fieldset or not
|
|
106
110
|
*/
|
package/dist/Select.js
CHANGED
|
@@ -12,7 +12,7 @@ import Qe from "./directives/clickoutside.js";
|
|
|
12
12
|
import { D as Ze } from "./MenusPlugin-Bk6UW6o9.js";
|
|
13
13
|
import ce from "./Chip.js";
|
|
14
14
|
import z from "./Icon.js";
|
|
15
|
-
import { _ as et } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
15
|
+
import { _ as et } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
|
|
16
16
|
import { _ as tt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
17
17
|
const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, at = ["id", "aria-labelledby"], st = ["id", "aria-errormessage", "aria-invalid", "disabled", "multiple", "name"], nt = ["selected", "value", "disabled"], ot = ["aria-controls", "aria-expanded", "aria-label", "aria-disabled"], rt = ["id"], it = ["onKeypress", "onMousedown"], ct = {
|
|
18
18
|
key: 0,
|
|
@@ -66,6 +66,7 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, at = ["id
|
|
|
66
66
|
isRequired: { type: Boolean },
|
|
67
67
|
label: {},
|
|
68
68
|
showOptionalInLabel: { type: Boolean },
|
|
69
|
+
isLabelSrOnly: { type: Boolean },
|
|
69
70
|
fieldset: { type: Boolean },
|
|
70
71
|
isDisabled: { type: Boolean },
|
|
71
72
|
disabled: { type: Boolean }
|