@leaflink/stash 50.0.6 → 50.0.8

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.
@@ -1,19 +1,19 @@
1
- import { defineComponent as $, inject as k, useCssModule as V, openBlock as o, createElementBlock as n, normalizeClass as p, unref as e, Fragment as B, renderList as I, createElementVNode as i, toDisplayString as h, provide as C, computed as v, createBlock as g, withCtx as M, renderSlot as T, resolveDynamicComponent as G } from "vue";
2
- import E from "lodash-es/uniqueId";
3
- import { _ as O } from "./Field.vue_vue_type_script_setup_true_lang--tBfZB2K.js";
1
+ import { defineComponent as h, inject as k, useCssModule as V, openBlock as o, createElementBlock as n, normalizeClass as p, unref as e, Fragment as B, renderList as g, createElementVNode as i, toDisplayString as $, provide as T, computed as v, createBlock as R, mergeProps as M, withCtx as G, renderSlot as C, resolveDynamicComponent as E } from "vue";
2
+ import W from "lodash-es/uniqueId";
4
3
  import { R as y } from "./RadioGroup.keys-CqfiKkNz.js";
5
4
  import { _ as x } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
- const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @__PURE__ */ $({
5
+ import { _ as j } from "./Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js";
6
+ const D = ["id", "name", "value", "checked", "disabled"], O = ["for"], N = /* @__PURE__ */ h({
7
7
  __name: "VariantButton",
8
8
  setup(u) {
9
9
  const r = k(y.key);
10
10
  if (!r)
11
11
  throw new Error("VariantButton must be used with a RadioGroup instance.");
12
12
  const { name: s, disabled: a, fullWidth: f, modelValue: d, options: m, update: l } = r, c = V();
13
- return (R, _) => (o(), n("div", {
13
+ return (I, _) => (o(), n("div", {
14
14
  class: p(["tw-flex", e(c).root])
15
15
  }, [
16
- (o(!0), n(B, null, I(e(m), (t) => (o(), n("div", {
16
+ (o(!0), n(B, null, g(e(m), (t) => (o(), n("div", {
17
17
  key: `${e(s)}-${t.id}`,
18
18
  class: p([{ "tw-w-full": e(f) }])
19
19
  }, [
@@ -27,28 +27,28 @@ const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @_
27
27
  disabled: e(a) || t.disabled,
28
28
  onInput: _[0] || (_[0] = //@ts-ignore
29
29
  (...b) => e(l) && e(l)(...b))
30
- }, null, 40, W),
30
+ }, null, 40, D),
31
31
  i("label", {
32
32
  for: `${e(s)}-${t.id}`
33
- }, h(t.text), 9, j)
33
+ }, $(t.text), 9, O)
34
34
  ], 2))), 128))
35
35
  ], 2));
36
36
  }
37
- }), S = "_root_1bamn_2", D = {
37
+ }), S = "_root_1bamn_2", q = {
38
38
  root: S
39
39
  }, L = {
40
- $style: D
41
- }, N = /* @__PURE__ */ x(q, [["__cssModules", L]]), z = ["id", "name", "value", "checked", "disabled"], A = ["for"], F = /* @__PURE__ */ $({
40
+ $style: q
41
+ }, P = /* @__PURE__ */ x(N, [["__cssModules", L]]), z = ["id", "name", "value", "checked", "disabled"], A = ["for"], F = /* @__PURE__ */ h({
42
42
  __name: "VariantChip",
43
43
  setup(u) {
44
44
  const r = k(y.key);
45
45
  if (!r)
46
46
  throw new Error("VariantChip must be used with a RadioGroup instance.");
47
47
  const { name: s, disabled: a, fullWidth: f, modelValue: d, options: m, update: l } = r, c = V();
48
- return (R, _) => (o(), n("div", {
48
+ return (I, _) => (o(), n("div", {
49
49
  class: p(["tw-my-1.5 tw-flex tw-flex-wrap", e(c).root])
50
50
  }, [
51
- (o(!0), n(B, null, I(e(m), (t) => (o(), n("div", {
51
+ (o(!0), n(B, null, g(e(m), (t) => (o(), n("div", {
52
52
  key: `${e(s)}-${t.id}`,
53
53
  class: p([{ "tw-w-full": e(f) }])
54
54
  }, [
@@ -65,25 +65,25 @@ const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @_
65
65
  }, null, 40, z),
66
66
  i("label", {
67
67
  for: `${e(s)}-${t.id}`
68
- }, h(t.text), 9, A)
68
+ }, $(t.text), 9, A)
69
69
  ], 2))), 128))
70
70
  ], 2));
71
71
  }
72
- }), J = "_root_kagur_2", P = {
72
+ }), J = "_root_kagur_2", U = {
73
73
  root: J
74
- }, U = {
75
- $style: P
76
- }, H = /* @__PURE__ */ x(F, [["__cssModules", U]]), K = ["id", "name", "value", "checked", "disabled"], Q = ["for"], X = /* @__PURE__ */ $({
74
+ }, H = {
75
+ $style: U
76
+ }, K = /* @__PURE__ */ x(F, [["__cssModules", H]]), Q = ["id", "name", "value", "checked", "disabled"], X = ["for"], Y = /* @__PURE__ */ h({
77
77
  __name: "VariantRadio",
78
78
  setup(u) {
79
79
  const r = k(y.key);
80
80
  if (!r)
81
81
  throw new Error("VariantRadio must be used with a RadioGroup instance.");
82
82
  const { name: s, disabled: a, fullWidth: f, modelValue: d, options: m, update: l } = r, c = V();
83
- return (R, _) => (o(), n("div", {
83
+ return (I, _) => (o(), n("div", {
84
84
  class: p(["tw-flex tw-flex-wrap", e(c).root])
85
85
  }, [
86
- (o(!0), n(B, null, I(e(m), (t) => (o(), n("div", {
86
+ (o(!0), n(B, null, g(e(m), (t) => (o(), n("div", {
87
87
  key: `${e(s)}-${t.id}`,
88
88
  class: p([{ "tw-w-full": e(f) }])
89
89
  }, [
@@ -96,28 +96,28 @@ const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @_
96
96
  disabled: e(a) || t.disabled,
97
97
  onInput: _[0] || (_[0] = //@ts-ignore
98
98
  (...b) => e(l) && e(l)(...b))
99
- }, null, 40, K),
99
+ }, null, 40, Q),
100
100
  i("label", {
101
101
  for: `${e(s)}-${t.id}`
102
- }, h(t.text), 9, Q)
102
+ }, $(t.text), 9, X)
103
103
  ], 2))), 128))
104
104
  ], 2));
105
105
  }
106
- }), Y = "_root_11y1n_2", Z = {
107
- root: Y
108
- }, ee = {
109
- $style: Z
110
- }, te = /* @__PURE__ */ x(X, [["__cssModules", ee]]), ae = ["for"], se = ["id", "name", "value", "checked", "disabled"], le = { class: "tw-m-0 tw-text-ice-900" }, oe = { class: "tw-m-0 tw-text-ice-700" }, re = /* @__PURE__ */ $({
106
+ }), Z = "_root_11y1n_2", ee = {
107
+ root: Z
108
+ }, te = {
109
+ $style: ee
110
+ }, ae = /* @__PURE__ */ x(Y, [["__cssModules", te]]), se = ["for"], le = ["id", "name", "value", "checked", "disabled"], oe = { class: "tw-m-0 tw-text-ice-900" }, re = { class: "tw-m-0 tw-text-ice-700" }, de = /* @__PURE__ */ h({
111
111
  __name: "VariantTile",
112
112
  setup(u) {
113
113
  const r = k(y.key);
114
114
  if (!r)
115
115
  throw new Error("VariantTile must be used with a RadioGroup instance.");
116
116
  const { name: s, disabled: a, fullWidth: f, modelValue: d, options: m, update: l } = r, c = V();
117
- return (R, _) => (o(), n("div", {
117
+ return (I, _) => (o(), n("div", {
118
118
  class: p(["tw-flex tw-flex-wrap", e(c).root])
119
119
  }, [
120
- (o(!0), n(B, null, I(e(m), (t) => (o(), n("label", {
120
+ (o(!0), n(B, null, g(e(m), (t) => (o(), n("label", {
121
121
  key: `${e(s)}-${t.id}`,
122
122
  class: p([e(c)["tile-container"], { "tw-w-full": e(f) }]),
123
123
  for: `${e(s)}-${t.id}`
@@ -141,9 +141,9 @@ const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @_
141
141
  disabled: e(a) || t.disabled,
142
142
  onInput: _[0] || (_[0] = //@ts-ignore
143
143
  (...b) => e(l) && e(l)(...b))
144
- }, null, 40, se),
144
+ }, null, 40, le),
145
145
  i("div", null, [
146
- i("span", null, h(t.text), 1)
146
+ i("span", null, $(t.text), 1)
147
147
  ])
148
148
  ], 2),
149
149
  i("div", {
@@ -155,77 +155,74 @@ const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @_
155
155
  }
156
156
  ]])
157
157
  }, [
158
- i("p", le, h(t.subTitle), 1),
159
- i("p", oe, h(t.subText), 1)
158
+ i("p", oe, $(t.subTitle), 1),
159
+ i("p", re, $(t.subText), 1)
160
160
  ], 2)
161
- ], 10, ae))), 128))
161
+ ], 10, se))), 128))
162
162
  ], 2));
163
163
  }
164
- }), de = "_root_1sppn_2", ie = {
165
- root: de,
164
+ }), ie = "_root_1sppn_2", ne = {
165
+ root: ie,
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
- }, ne = {
170
- $style: ie
171
- }, ue = /* @__PURE__ */ x(re, [["__cssModules", ne]]);
169
+ }, ue = {
170
+ $style: ne
171
+ }, ce = /* @__PURE__ */ x(de, [["__cssModules", ue]]);
172
172
  var w = /* @__PURE__ */ ((u) => (u.Radio = "radio", u.Button = "button", u.Chip = "chip", u.Tile = "tile", u))(w || {});
173
- const ce = /* @__PURE__ */ $({
173
+ const _e = /* @__PURE__ */ h({
174
174
  __name: "RadioGroup",
175
175
  props: {
176
176
  name: { default: void 0 },
177
177
  options: { default: void 0 },
178
178
  modelValue: { default: void 0 },
179
179
  variant: { default: "radio" },
180
- disabled: { type: Boolean, default: !1 },
181
180
  fullWidth: { type: Boolean, default: !1 },
182
181
  addBottomSpace: { type: Boolean },
183
- errorText: { default: void 0 },
184
- hintText: { default: void 0 },
182
+ errorText: {},
183
+ hintText: {},
184
+ id: {},
185
+ errorId: {},
185
186
  isReadOnly: { type: Boolean },
186
187
  isRequired: { type: Boolean },
187
- label: { default: void 0 },
188
- showOptionalInLabel: { type: Boolean }
188
+ label: {},
189
+ showOptionalInLabel: { type: Boolean },
190
+ fieldset: { type: Boolean },
191
+ isDisabled: { type: Boolean },
192
+ disabled: { type: Boolean }
189
193
  },
190
194
  emits: ["update:modelValue"],
191
195
  setup(u, { emit: r }) {
192
196
  const s = {
193
- [w.Button]: N,
194
- [w.Chip]: H,
195
- [w.Radio]: te,
196
- [w.Tile]: ue
197
+ [w.Button]: P,
198
+ [w.Chip]: K,
199
+ [w.Radio]: ae,
200
+ [w.Tile]: ce
197
201
  }, a = u, f = r;
198
202
  function d(l) {
199
203
  f("update:modelValue", l.target.value);
200
204
  }
201
- const m = E("radio-group-field-error-");
202
- return C(y.key, {
205
+ const m = W("radio-group-field-error-");
206
+ return T(y.key, {
203
207
  name: v(() => a.name),
204
- disabled: v(() => a.disabled),
208
+ disabled: v(() => a.isDisabled || a.disabled),
205
209
  fullWidth: v(() => a.fullWidth),
206
210
  modelValue: v(() => a.modelValue),
207
211
  options: v(() => a.options),
208
212
  variant: v(() => a.variant),
209
213
  update: d
210
- }), (l, c) => (o(), g(O, {
214
+ }), (l, c) => (o(), R(j, M(a, {
211
215
  class: "stash-radio-group",
212
216
  "data-test": "stash-radio-group",
213
217
  "aria-errormessage": e(m),
218
+ "error-id": e(m),
214
219
  "aria-invalid": !!a.errorText,
215
220
  role: "radiogroup",
216
- fieldset: "",
217
- label: a.label,
218
- "add-bottom-space": a.addBottomSpace,
219
- "error-id": e(m),
220
- "error-text": a.errorText,
221
- "hint-text": a.hintText,
222
- "show-optional-in-label": a.showOptionalInLabel,
223
- "is-required": a.isRequired,
224
- "is-read-only": a.isReadOnly
225
- }, {
226
- default: M(() => [
227
- a.options ? T(l.$slots, "default", { key: 0 }, () => [
228
- (o(), g(G(s[a.variant])))
221
+ fieldset: ""
222
+ }), {
223
+ default: G(() => [
224
+ a.options ? C(l.$slots, "default", { key: 0 }, () => [
225
+ (o(), R(E(s[a.variant])))
229
226
  ], !0) : (o(), n("div", {
230
227
  key: 1,
231
228
  class: p(["tw-flex", {
@@ -234,16 +231,16 @@ const ce = /* @__PURE__ */ $({
234
231
  "tw-gap-6": a.variant === e(w).Radio || a.variant === e(w).Tile
235
232
  }])
236
233
  }, [
237
- T(l.$slots, "default", {}, void 0, !0)
234
+ C(l.$slots, "default", {}, void 0, !0)
238
235
  ], 2))
239
236
  ]),
240
237
  _: 3
241
- }, 8, ["aria-errormessage", "aria-invalid", "label", "add-bottom-space", "error-id", "error-text", "hint-text", "show-optional-in-label", "is-required", "is-read-only"]));
238
+ }, 16, ["aria-errormessage", "error-id", "aria-invalid"]));
242
239
  }
243
- }), be = /* @__PURE__ */ x(ce, [["__scopeId", "data-v-b73c0b83"]]);
240
+ }), ve = /* @__PURE__ */ x(_e, [["__scopeId", "data-v-3e1d9e30"]]);
244
241
  export {
245
242
  y as RADIO_GROUP_INJECTION,
246
243
  w as RadioGroupVariant,
247
- be as default
244
+ ve as default
248
245
  };
249
246
  //# sourceMappingURL=RadioGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.semibold');\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root > div:first-child label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:last-child label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-my-1.5 tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n padding: theme('spacing[1.5]') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input {\n appearance: none;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'tw-w-full': fullWidth }]\"\n :for=\"`${name}-${option.id}`\"\n >\n <div\n class=\"tw-flex tw-border\"\n :class=\"[\n classes['tile-header'],\n {\n 'tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900': modelValue === option.value,\n 'tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"tw-border-x tw-border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': modelValue !== option.value,\n 'tw-border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"tw-m-0 tw-text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"tw-m-0 tw-text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: theme('borderRadius.DEFAULT');\n display: flex;\n flex: 1;\n flex-direction: column;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT') 0 0;\n padding: theme('spacing.3') 0;\n }\n\n .root label.tile-container:hover .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n background-color: var(--color-white);\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-white);\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n }\n\n .root input ~ div {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: theme('spacing.3');\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n}\n","<script lang=\"ts\">\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps {\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 entire group should be disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * Adds spacing under the field that is consistent whether hint/error text is displayed.\n */\n addBottomSpace?: boolean;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * Whether it's a readonly field.\n */\n isReadOnly?: boolean;\n\n /**\n * Whether the field is required.\n */\n isRequired?: boolean;\n\n /**\n * Label to render above the input.\n */\n label?: string;\n\n /**\n * Show \"(optional)\" to the right of the label text\n */\n showOptionalInLabel?: boolean;\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, provide } from 'vue';\n\n import Field from '../Field/Field.vue';\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 disabled: false,\n fullWidth: false,\n errorText: undefined,\n hintText: undefined,\n label: undefined,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n update,\n });\n</script>\n\n<template>\n <Field\n class=\"stash-radio-group\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n :label=\"props.label\"\n :add-bottom-space=\"props.addBottomSpace\"\n :error-id=\"errorId\"\n :error-text=\"props.errorText\"\n :hint-text=\"props.hintText\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n :is-required=\"props.isRequired\"\n :is-read-only=\"props.isReadOnly\"\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div\n v-else\n class=\"tw-flex\"\n :class=\"{\n 'tw-flex-wrap': props.variant !== RadioGroupVariant.Button,\n 'tw-gap-x-1.5 tw-gap-y-3': props.variant === RadioGroupVariant.Chip,\n 'tw-gap-6': props.variant === RadioGroupVariant.Radio || props.variant === RadioGroupVariant.Tile,\n }\"\n >\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style scoped>\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed"],"mappings":";;;;;;;;AAKQ,UAAAA,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,wDAAwD;AAG1E,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,uDAAuD;AAGzE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVN,IAAAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;ACoFV,UAAMC,IAAuB;AAAA,MAC3B,CAACD,EAAkB,MAAM,GAAGE;AAAA,MAC5B,CAACF,EAAkB,IAAI,GAAGG;AAAA,MAC1B,CAACH,EAAkB,KAAK,GAAGI;AAAA,MAC3B,CAACJ,EAAkB,IAAI,GAAGK;AAAA,IAAA,GAGtBC,IAAQC,GAYRC,IAAOC;AAOb,aAASZ,EAAOa,GAAU;AACnB,MAAAF,EAAA,qBAAsBE,EAAE,OAA4B,KAAK;AAAA,IAChE;AAEM,UAAAC,IAAUC,EAAS,0BAA0B;AAEnD,WAAAC,EAAQtB,EAAsB,KAAK;AAAA,MACjC,MAAMuB,EAAS,MAAMR,EAAM,IAAI;AAAA,MAC/B,UAAUQ,EAAS,MAAMR,EAAM,QAAQ;AAAA,MACvC,WAAWQ,EAAS,MAAMR,EAAM,SAAS;AAAA,MACzC,YAAYQ,EAAS,MAAMR,EAAM,UAAU;AAAA,MAC3C,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,QAAAT;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.semibold');\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root > div:first-child label {\n border-top-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:last-child label {\n border-top-right-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-my-1.5 tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n padding: theme('spacing[1.5]') theme('spacing.3');\n border: 1px solid var(--color-ice-500);\n font-weight: theme('fontWeight.normal');\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: theme('fontWeight.bold');\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'tw-w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input {\n appearance: none;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"tw-flex tw-flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'tw-w-full': fullWidth }]\"\n :for=\"`${name}-${option.id}`\"\n >\n <div\n class=\"tw-flex tw-border\"\n :class=\"[\n classes['tile-header'],\n {\n 'tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900': modelValue === option.value,\n 'tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"tw-sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"tw-border-x tw-border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'tw-border-ice-500': modelValue !== option.value,\n 'tw-border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"tw-m-0 tw-text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"tw-m-0 tw-text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n .root {\n gap: theme('spacing.6');\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: theme('borderRadius.DEFAULT');\n display: flex;\n flex: 1;\n flex-direction: column;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT') 0 0;\n padding: theme('spacing.3') 0;\n }\n\n .root label.tile-container:hover .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .tile-body {\n border-radius: 0 0 theme('borderRadius.DEFAULT') theme('borderRadius.DEFAULT');\n background-color: var(--color-white);\n padding: theme('spacing.6');\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-white);\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n }\n\n .root input ~ div {\n font-weight: theme('fontWeight.medium');\n user-select: none;\n cursor: pointer;\n padding: 0 theme('spacing.3');\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: theme('spacing.3');\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n}\n","<script lang=\"ts\">\n import Field, { type FieldProps } from '../Field/Field.vue';\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps extends FieldProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` elements within the RadioGroup.\n */\n name?: string;\n\n /**\n * Deprecated - Compose your radio group with the `Radio` component instead\n * @deprecated\n */\n options?: RadioGroupOption[];\n\n /**\n * The value of the selected radio option. Use this prop with the `update:modelValue` event to create a controlled component.\n */\n modelValue?: RadioGroupOption['value'];\n\n /**\n * @defaultValue 'radio'\n */\n variant?: RadioGroupVariants;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, provide } from 'vue';\n\n import VariantButton from './components/VariantButton.vue';\n import VariantChip from './components/VariantChip.vue';\n import VariantRadio from './components/VariantRadio.vue';\n import VariantTile from './components/VariantTile.vue';\n import { RADIO_GROUP_INJECTION } from './RadioGroup.keys';\n\n const variantComponentsMap = {\n [RadioGroupVariant.Button]: VariantButton,\n [RadioGroupVariant.Chip]: VariantChip,\n [RadioGroupVariant.Radio]: VariantRadio,\n [RadioGroupVariant.Tile]: VariantTile,\n };\n\n const props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: 'radio',\n fullWidth: false,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.isDisabled || props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n update,\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n class=\"stash-radio-group\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :error-id=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div\n v-else\n class=\"tw-flex\"\n :class=\"{\n 'tw-flex-wrap': props.variant !== RadioGroupVariant.Button,\n 'tw-gap-x-1.5 tw-gap-y-3': props.variant === RadioGroupVariant.Chip,\n 'tw-gap-6': props.variant === RadioGroupVariant.Radio || props.variant === RadioGroupVariant.Tile,\n }\"\n >\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style scoped>\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed"],"mappings":";;;;;;;;AAKQ,UAAAA,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,wDAAwD;AAG1E,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,uDAAuD;AAGzE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPV,UAAAV,IAAsBC,EAAOC,EAAsB,GAAG;AAE5D,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,MAAAG,GAAM,UAAAC,GAAU,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,QAAAC,EAAW,IAAAR,GAC7DS,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVN,IAAAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AC4CV,UAAMC,IAAuB;AAAA,MAC3B,CAACD,EAAkB,MAAM,GAAGE;AAAA,MAC5B,CAACF,EAAkB,IAAI,GAAGG;AAAA,MAC1B,CAACH,EAAkB,KAAK,GAAGI;AAAA,MAC3B,CAACJ,EAAkB,IAAI,GAAGK;AAAA,IAAA,GAGtBC,IAAQC,GAQRC,IAAOC;AAOb,aAASZ,EAAOa,GAAU;AACnB,MAAAF,EAAA,qBAAsBE,EAAE,OAA4B,KAAK;AAAA,IAChE;AAEM,UAAAC,IAAUC,EAAS,0BAA0B;AAEnD,WAAAC,EAAQtB,EAAsB,KAAK;AAAA,MACjC,MAAMuB,EAAS,MAAMR,EAAM,IAAI;AAAA,MAC/B,UAAUQ,EAAS,MAAMR,EAAM,cAAcA,EAAM,QAAQ;AAAA,MAC3D,WAAWQ,EAAS,MAAMR,EAAM,SAAS;AAAA,MACzC,YAAYQ,EAAS,MAAMR,EAAM,UAAU;AAAA,MAC3C,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,SAASQ,EAAS,MAAMR,EAAM,OAAO;AAAA,MACrC,QAAAT;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -36,11 +36,7 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
36
36
 
37
37
  declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<RadioGroupProps>, {
38
38
  variant: string;
39
- disabled: boolean;
40
39
  fullWidth: boolean;
41
- errorText: undefined;
42
- hintText: undefined;
43
- label: undefined;
44
40
  modelValue: undefined;
45
41
  name: undefined;
46
42
  options: undefined;
@@ -48,11 +44,7 @@ options: undefined;
48
44
  "update:modelValue": (value: string) => void;
49
45
  }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<RadioGroupProps>, {
50
46
  variant: string;
51
- disabled: boolean;
52
47
  fullWidth: boolean;
53
- errorText: undefined;
54
- hintText: undefined;
55
- label: undefined;
56
48
  modelValue: undefined;
57
49
  name: undefined;
58
50
  options: undefined;
@@ -60,10 +52,6 @@ options: undefined;
60
52
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
61
53
  }>, {
62
54
  name: string;
63
- disabled: boolean;
64
- label: string;
65
- errorText: string;
66
- hintText: string;
67
55
  options: RadioGroupOption[];
68
56
  modelValue: string;
69
57
  variant: "button" | "radio" | "tile" | "chip";
@@ -73,6 +61,59 @@ fullWidth: boolean;
73
61
  }>;
74
62
  export default _default;
75
63
 
64
+ declare interface FieldProps {
65
+ /**
66
+ * Adds spacing under the field that is consistent whether hint/error text is displayed.
67
+ */
68
+ addBottomSpace?: boolean;
69
+ /**
70
+ * Error text to display. Replaces `hintText` (if provided) & adds error styling.
71
+ */
72
+ errorText?: string;
73
+ /**
74
+ * Displays text below the input; hidden when the isReadOnly prop is truthy.
75
+ */
76
+ hintText?: string;
77
+ /**
78
+ * ID for the Label and Input; must be unique
79
+ */
80
+ id?: string;
81
+ /**
82
+ * ID for the error text element; useful for aria-errormessage
83
+ */
84
+ errorId?: string;
85
+ /**
86
+ * Whether it's a readonly field.
87
+ */
88
+ isReadOnly?: boolean;
89
+ /**
90
+ * Whether the field is required.
91
+ */
92
+ isRequired?: boolean;
93
+ /**
94
+ * Label to render above the input.
95
+ */
96
+ label?: string;
97
+ /**
98
+ * Show "(optional)" to the right of the label text
99
+ */
100
+ showOptionalInLabel?: boolean;
101
+ /**
102
+ * Indicates wheter the field is a fieldset or not
103
+ */
104
+ fieldset?: boolean;
105
+ /**
106
+ * Indicates whether the field is disabled.
107
+ */
108
+ isDisabled?: boolean;
109
+ /**
110
+ * Indicates whether the field is disabled.
111
+ *
112
+ * @deprecated Use `isDisabled` instead.
113
+ */
114
+ disabled?: boolean;
115
+ }
116
+
76
117
  export declare const RADIO_GROUP_INJECTION: {
77
118
  key: InjectionKey<RadioGroupInjection>;
78
119
  };
@@ -142,7 +183,7 @@ export declare interface RadioGroupOption {
142
183
  subText?: string;
143
184
  }
144
185
 
145
- export declare interface RadioGroupProps {
186
+ export declare interface RadioGroupProps extends FieldProps {
146
187
  /**
147
188
  * Passed to the "name" attribute of the `<input>` elements within the RadioGroup.
148
189
  */
@@ -160,42 +201,10 @@ export declare interface RadioGroupProps {
160
201
  * @defaultValue 'radio'
161
202
  */
162
203
  variant?: RadioGroupVariants;
163
- /**
164
- * Whether the entire group should be disabled
165
- */
166
- disabled?: boolean;
167
204
  /**
168
205
  * Whether the group should expand to the parent's width
169
206
  */
170
207
  fullWidth?: boolean;
171
- /**
172
- * Adds spacing under the field that is consistent whether hint/error text is displayed.
173
- */
174
- addBottomSpace?: boolean;
175
- /**
176
- * Error text to display. Replaces `hintText` (if provided) & adds error styling.
177
- */
178
- errorText?: string;
179
- /**
180
- * Displays text below the input; hidden when the isReadOnly prop is truthy.
181
- */
182
- hintText?: string;
183
- /**
184
- * Whether it's a readonly field.
185
- */
186
- isReadOnly?: boolean;
187
- /**
188
- * Whether the field is required.
189
- */
190
- isRequired?: boolean;
191
- /**
192
- * Label to render above the input.
193
- */
194
- label?: string;
195
- /**
196
- * Show "(optional)" to the right of the label text
197
- */
198
- showOptionalInLabel?: boolean;
199
208
  }
200
209
 
201
210
  export declare enum RadioGroupVariant {