@leaflink/stash 44.0.0-beta.6 → 44.0.0-beta.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.
- package/README.md +107 -39
- package/dist/ActionsDropdown.js +2 -2
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js +2 -2
- package/dist/AppNavigationItem.js +1 -1
- package/dist/AppSidebar.js +13 -13
- package/dist/AppSidebar.js.map +1 -1
- package/dist/Badge.vue.d.ts +1 -1
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js +17 -0
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js.map +1 -0
- package/dist/ButtonGroup.js +19 -19
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/Carousel.js +258 -246
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +57 -46
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +2 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js +9 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js.map +1 -0
- package/dist/ChevronToggle.js +1 -1
- package/dist/Copy.js +1 -1
- package/dist/CurrencyInput.js +2 -2
- package/dist/DataView.js +1 -1
- package/dist/DataViewFilters.js +4 -4
- package/dist/DataViewSortButton.js +47 -38
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +2 -2
- package/dist/DatePicker.js +9 -9
- package/dist/DatePicker.js.map +1 -1
- package/dist/DescriptionListTerm.js +1 -1
- package/dist/DescriptionListTerm.js.map +1 -1
- package/dist/Dialog.js +33 -33
- package/dist/Dialog.js.map +1 -1
- package/dist/Divider.js +4 -4
- package/dist/Divider.js.map +1 -1
- package/dist/Expand.js +1 -1
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-5fe03d51.js → Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js} +14 -15
- package/dist/Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js.map +1 -0
- package/dist/Field.js +2 -2
- package/dist/Field.vue.d.ts +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-4483019d.js → Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js} +2 -2
- package/dist/Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js.map +1 -0
- package/dist/FileUpload.js +7 -7
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +30 -30
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDropdown.js +2 -2
- package/dist/FilterSelect.js +27 -27
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +39 -39
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +6 -6
- package/dist/IconLabel.js +6 -6
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +1 -1
- package/dist/Illustration.js +10 -60
- package/dist/Illustration.js.map +1 -1
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js +56 -0
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js.map +1 -0
- package/dist/Image.js +67 -72
- package/dist/Image.js.map +1 -1
- package/dist/InlineEdit.js +2 -2
- package/dist/Input.js +53 -53
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +2 -2
- package/dist/Label.js +1 -1
- package/dist/Label.vue.d.ts +13 -2
- package/dist/{Label.vue_vue_type_script_setup_true_lang-2de35913.js → Label.vue_vue_type_script_setup_true_lang-4b02087f.js} +12 -11
- package/dist/Label.vue_vue_type_script_setup_true_lang-4b02087f.js.map +1 -0
- package/dist/ListItem.js +11 -11
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItemCell.js +9 -9
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListView.js +55 -52
- package/dist/ListView.js.map +1 -1
- package/dist/Loading.js +17 -10
- package/dist/Loading.js.map +1 -1
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js +8 -0
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js.map +1 -0
- package/dist/MenuItem.js +20 -14
- package/dist/MenuItem.js.map +1 -1
- package/dist/Modal.js +2 -2
- package/dist/Modal.js.map +1 -1
- package/dist/ObfuscateText.js +30 -32
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +1 -1
- package/dist/PageContent.js +9 -9
- package/dist/PageContent.js.map +1 -1
- package/dist/PageHeader.js +22 -22
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageNavigation.js +3 -3
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Paginate.js +1 -1
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js +11 -0
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js.map +1 -0
- package/dist/QuickAction.js +22 -19
- package/dist/QuickAction.js.map +1 -1
- package/dist/Radio.js +30 -15
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +135 -106
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioNew.js +118 -91
- package/dist/RadioNew.js.map +1 -1
- package/dist/SearchBar.js +32 -32
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +7 -7
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +2 -2
- package/dist/Switch.js +41 -34
- package/dist/Switch.js.map +1 -1
- package/dist/Tab.js +2 -2
- package/dist/{Tab.vue_vue_type_script_setup_true_lang-4a40f015.js → Tab.vue_vue_type_script_setup_true_lang-69d1b046.js} +2 -2
- package/dist/{Tab.vue_vue_type_script_setup_true_lang-4a40f015.js.map → Tab.vue_vue_type_script_setup_true_lang-69d1b046.js.map} +1 -1
- package/dist/Table.js +6 -6
- package/dist/Table.keys-cf93df19.js +27 -0
- package/dist/{Table.keys-1ebe4ecb.js.map → Table.keys-cf93df19.js.map} +1 -1
- package/dist/TableCell.js +5 -5
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +32 -32
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderRow.js +10 -10
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +42 -41
- package/dist/TableRow.js.map +1 -1
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js → Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js} +25 -25
- package/dist/Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js.map +1 -0
- package/dist/Textarea.js +49 -41
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +23 -23
- package/dist/Toast.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/constants.d.ts +26 -19
- package/dist/constants.js +41 -26
- package/dist/constants.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tailwind-base.d.ts +16 -16
- package/dist/tailwind-base.js +16 -6
- package/dist/tailwind-base.js.map +1 -1
- package/package.json +2 -2
- package/styles/backwards-compat.css +41 -104
- package/styles/base.css +258 -112
- package/tailwind-base.ts +6 -1
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js +0 -17
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js.map +0 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js +0 -2
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js.map +0 -1
- package/dist/Expand.vue_vue_type_script_setup_true_lang-5fe03d51.js.map +0 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-4483019d.js.map +0 -1
- package/dist/Label.vue_vue_type_script_setup_true_lang-2de35913.js.map +0 -1
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js +0 -2
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js.map +0 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js +0 -11
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js.map +0 -1
- package/dist/Table.keys-1ebe4ecb.js +0 -27
- package/dist/Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js.map +0 -1
- package/styles/_base.scss +0 -493
- package/styles/elements/_links.scss +0 -32
- package/styles/elements/_lists.scss +0 -31
- package/styles/elements/_misc.scss +0 -16
- package/styles/main.scss +0 -38
package/dist/Radio.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { useCssModule as d, openBlock as i, createElementBlock as u, normalizeClass as a, withDirectives as c, createElementVNode as s, mergeProps as _, vModelRadio as m, toDisplayString as h } from "vue";
|
|
2
|
+
import { _ as f } from "./_plugin-vue_export-helper-dad06003.js";
|
|
3
|
+
const p = "_root_ul6uq_2", b = "_label_ul6uq_7", k = "_error_ul6uq_40", y = "_input_ul6uq_45", g = {
|
|
4
|
+
root: p,
|
|
5
|
+
label: b,
|
|
6
|
+
error: k,
|
|
7
|
+
input: y
|
|
8
|
+
}, v = {
|
|
4
9
|
name: "ll-radio",
|
|
5
10
|
props: {
|
|
6
11
|
/**
|
|
@@ -43,6 +48,11 @@ const f = {
|
|
|
43
48
|
}
|
|
44
49
|
},
|
|
45
50
|
emits: ["update:checked"],
|
|
51
|
+
setup() {
|
|
52
|
+
return {
|
|
53
|
+
classes: d()
|
|
54
|
+
};
|
|
55
|
+
},
|
|
46
56
|
computed: {
|
|
47
57
|
internalValue: {
|
|
48
58
|
get() {
|
|
@@ -57,25 +67,30 @@ const f = {
|
|
|
57
67
|
if (this.$attrs.onChange)
|
|
58
68
|
throw new Error("ll-radio: use the @update:checked event instead of @input");
|
|
59
69
|
}
|
|
60
|
-
},
|
|
61
|
-
function
|
|
62
|
-
return
|
|
63
|
-
class:
|
|
70
|
+
}, w = ["id"], E = ["for"];
|
|
71
|
+
function V(e, l, t, r, S, o) {
|
|
72
|
+
return i(), u("div", {
|
|
73
|
+
class: a(["stash-radio", [r.classes.root, { error: t.hasError }]]),
|
|
64
74
|
"data-test": "ll-radio"
|
|
65
75
|
}, [
|
|
66
|
-
s(
|
|
76
|
+
c(s("input", _({
|
|
67
77
|
id: t.id,
|
|
68
|
-
"onUpdate:modelValue":
|
|
69
|
-
class: "sr-only",
|
|
78
|
+
"onUpdate:modelValue": l[0] || (l[0] = (n) => o.internalValue = n),
|
|
79
|
+
class: ["tw-sr-only", r.classes.input],
|
|
70
80
|
type: "radio"
|
|
71
|
-
}, e.$attrs), null, 16,
|
|
72
|
-
[
|
|
81
|
+
}, e.$attrs), null, 16, w), [
|
|
82
|
+
[m, o.internalValue]
|
|
73
83
|
]),
|
|
74
|
-
|
|
84
|
+
s("label", {
|
|
85
|
+
for: t.id,
|
|
86
|
+
class: a(r.classes.label)
|
|
87
|
+
}, h(t.label), 11, E)
|
|
75
88
|
], 2);
|
|
76
89
|
}
|
|
77
|
-
const
|
|
90
|
+
const q = {
|
|
91
|
+
$style: g
|
|
92
|
+
}, C = /* @__PURE__ */ f(v, [["render", V], ["__cssModules", q]]);
|
|
78
93
|
export {
|
|
79
|
-
|
|
94
|
+
C as default
|
|
80
95
|
};
|
|
81
96
|
//# sourceMappingURL=Radio.js.map
|
package/dist/Radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../src/components/Radio/Radio.vue"],"sourcesContent":["<script>\n /**\n * @deprecated use components/RadioNew/Radio instead.\n * if you need multiple Radio components considering using RadioGroup instead.\n */\n export default {\n name: 'll-radio',\n\n props: {\n /**\n * The checked/selected state of the radio button\n */\n checked: {\n type: [String, Number],\n default: undefined,\n },\n\n /**\n * Use :checked or v-model:checked instead of :model-value and v-model.\n */\n modelValue: {\n type: [String, Number, null],\n default: null,\n validator(value) {\n if (value !== null) {\n throw new Error('ll-radio: use :checked or v-model:checked instead of :model-value and v-model.');\n }\n\n return true;\n },\n },\n\n /**\n * Adds error styling\n */\n hasError: Boolean,\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: {\n type: String,\n required: true,\n },\n\n /**\n * The description which appears to the right of the radio button\n */\n label: {\n type: String,\n default: '',\n },\n },\n\n emits: ['update:checked'],\n\n computed: {\n internalValue: {\n get() {\n return this.checked;\n },\n set(value) {\n this.$emit('update:checked', value);\n },\n },\n },\n\n created() {\n if (this.$attrs.onChange) {\n throw new Error('ll-radio: use the @update:checked event instead of @input');\n }\n },\n };\n</script>\n\n<template>\n <div class=\"
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../src/components/Radio/Radio.vue"],"sourcesContent":["<script>\n import { useCssModule } from 'vue';\n\n /**\n * @deprecated use components/RadioNew/Radio instead.\n * if you need multiple Radio components considering using RadioGroup instead.\n */\n export default {\n name: 'll-radio',\n\n props: {\n /**\n * The checked/selected state of the radio button\n */\n checked: {\n type: [String, Number],\n default: undefined,\n },\n\n /**\n * Use :checked or v-model:checked instead of :model-value and v-model.\n */\n modelValue: {\n type: [String, Number, null],\n default: null,\n validator(value) {\n if (value !== null) {\n throw new Error('ll-radio: use :checked or v-model:checked instead of :model-value and v-model.');\n }\n\n return true;\n },\n },\n\n /**\n * Adds error styling\n */\n hasError: Boolean,\n\n /**\n * A unique string to distinguish one Radio instance from another\n * and to link the label to the input; required for accessibility\n */\n id: {\n type: String,\n required: true,\n },\n\n /**\n * The description which appears to the right of the radio button\n */\n label: {\n type: String,\n default: '',\n },\n },\n\n emits: ['update:checked'],\n\n setup() {\n return {\n classes: useCssModule(),\n };\n },\n\n computed: {\n internalValue: {\n get() {\n return this.checked;\n },\n set(value) {\n this.$emit('update:checked', value);\n },\n },\n },\n\n created() {\n if (this.$attrs.onChange) {\n throw new Error('ll-radio: use the @update:checked event instead of @input');\n }\n },\n };\n</script>\n\n<template>\n <div class=\"stash-radio\" data-test=\"ll-radio\" :class=\"[classes.root, { error: hasError }]\">\n <input :id=\"id\" v-model=\"internalValue\" class=\"tw-sr-only\" :class=\"classes.input\" type=\"radio\" v-bind=\"$attrs\" />\n\n <label :for=\"id\" :class=\"classes.label\">\n {{ label }}\n </label>\n </div>\n</template>\n\n<style module>\n .root {\n position: relative;\n margin: theme('spacing[1.5]') 0;\n }\n\n .label {\n color: var(--color-ice-700);\n cursor: pointer;\n display: inline-block;\n font-size: theme('fontSize.sm');\n font-weight: theme('fontWeight.normal');\n line-height: theme('spacing.6');\n min-height: theme('spacing.9');\n overflow: visible;\n padding: theme('spacing[1.5]') 0 theme('spacing[1.5]') calc(20px + theme('spacing.3'));\n position: relative;\n vertical-align: top;\n }\n\n .label::before {\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n content: '';\n display: inline-block;\n vertical-align: top;\n }\n\n .label::before,\n .label::after {\n height: 20px;\n left: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 20px;\n border-radius: 50%;\n }\n\n .error .label {\n color: var(--color-red-500);\n }\n\n .error .label::before,\n .error .input {\n border-color: var(--color-red-500);\n }\n\n .input:checked + .label::after {\n background: var(--color-blue-500);\n content: '';\n height: 14px;\n left: 3px;\n width: 14px;\n }\n\n .input:checked:disabled + .label::after {\n background: var(--color-ice-500);\n }\n\n .input:not(:disabled, :checked) + .label:hover::before {\n border-color: var(--color-blue-500);\n }\n\n @media screen('lg') {\n .root input {\n margin: 0;\n }\n }\n</style>\n"],"names":["_sfc_main","value","useCssModule","_createElementBlock","$setup","$props","_withDirectives","_createElementVNode","_mergeProps","$options","$event","_ctx","_hoisted_1","_normalizeClass","_hoisted_2"],"mappings":";;;;;;;GAOOA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,SAAS;AAAA,MACP,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,QAAQ,IAAI;AAAA,MAC3B,SAAS;AAAA,MACT,UAAUC,GAAO;AACf,YAAIA,MAAU;AACZ,gBAAM,IAAI,MAAM,gFAAgF;AAGlG,eAAO;AAAA,MACR;AAAA,IACF;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,IAMV,IAAI;AAAA,MACF,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAKD,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACF;AAAA,EAED,OAAO,CAAC,gBAAgB;AAAA,EAExB,QAAQ;AACN,WAAO;AAAA,MACL,SAASC,EAAc;AAAA;EAE1B;AAAA,EAED,UAAU;AAAA,IACR,eAAe;AAAA,MACb,MAAM;AACJ,eAAO,KAAK;AAAA,MACb;AAAA,MACD,IAAID,GAAO;AACT,aAAK,MAAM,kBAAkBA,CAAK;AAAA,MACnC;AAAA,IACF;AAAA,EACF;AAAA,EAED,UAAU;AACR,QAAI,KAAK,OAAO;AACd,YAAM,IAAI,MAAM,2DAA2D;AAAA,EAE9E;;;cAKHE,EAMM,OAAA;AAAA,IAND,UAAM,eAAa,CAA+BC,UAAQ,eAAeC,EAAQ,SAAA,CAAA,CAAA,CAAA;AAAA,IAA7D,aAAU;AAAA;IACjCC,EAAAC,EAAiH,SAAjHC,EAAiH;AAAA,MAAzG,IAAIH,EAAE;AAAA,oDAAWI,EAAa,gBAAAC;AAAA,MAAE,OAAM,CAAA,cAAqBN,EAAA,QAAQ,KAAK;AAAA,MAAE,MAAK;AAAA,OAAgBO,EAAM,MAAA,GAAA,MAAA,IAAAC,CAAA,GAAA;AAAA,UAApFH,EAAa,aAAA;AAAA;IAEtCF,EAEQ,SAAA;AAAA,MAFA,KAAKF,EAAE;AAAA,MAAG,OAAKQ,EAAET,EAAO,QAAC,KAAK;AAAA,SACjCC,EAAK,KAAA,GAAA,IAAAS,CAAA;AAAA;;;;;"}
|
package/dist/RadioGroup.js
CHANGED
|
@@ -1,150 +1,179 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { _ as
|
|
1
|
+
import { defineComponent as $, inject as x, useCssModule as k, openBlock as l, createElementBlock as n, normalizeClass as _, unref as e, Fragment as V, renderList as B, createElementVNode as r, toDisplayString as h, provide as g, computed as v, createBlock as C, withCtx as M, renderSlot as T, resolveDynamicComponent as E } from "vue";
|
|
2
|
+
import G from "lodash-es/uniqueId";
|
|
3
|
+
import { _ as O } from "./Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js";
|
|
4
4
|
import { R as y } from "./RadioGroup.keys-974818d6.js";
|
|
5
|
-
import { _ as
|
|
6
|
-
import "./Label.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
import { _ as R } from "./_plugin-vue_export-helper-dad06003.js";
|
|
6
|
+
import "./Label.vue_vue_type_script_setup_true_lang-4b02087f.js";
|
|
7
7
|
import "./locale.js";
|
|
8
8
|
import "lodash-es/get";
|
|
9
|
-
const
|
|
9
|
+
const W = ["id", "name", "value", "checked", "disabled"], j = ["for"], q = /* @__PURE__ */ $({
|
|
10
10
|
__name: "VariantButton",
|
|
11
11
|
setup(u) {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
12
|
+
const o = x(y.key);
|
|
13
|
+
if (!o)
|
|
14
14
|
throw new Error("VariantButton must be used with a RadioGroup instance.");
|
|
15
|
-
const { name: t, disabled:
|
|
16
|
-
return (I, c) => (l(), n("div",
|
|
17
|
-
|
|
15
|
+
const { name: t, disabled: f, fullWidth: w, modelValue: s, options: i, update: d } = o, p = k();
|
|
16
|
+
return (I, c) => (l(), n("div", {
|
|
17
|
+
class: _(["tw-flex", e(p).root])
|
|
18
|
+
}, [
|
|
19
|
+
(l(!0), n(V, null, B(e(i), (a) => (l(), n("div", {
|
|
18
20
|
key: `${e(t)}-${a.id}`,
|
|
19
|
-
class:
|
|
21
|
+
class: _([{ "tw-w-full": e(w) }])
|
|
20
22
|
}, [
|
|
21
23
|
r("input", {
|
|
22
24
|
id: `${e(t)}-${a.id}`,
|
|
23
|
-
class: "sr-only",
|
|
25
|
+
class: "tw-sr-only",
|
|
24
26
|
type: "radio",
|
|
25
27
|
name: e(t),
|
|
26
28
|
value: a.value,
|
|
27
|
-
checked: e(
|
|
28
|
-
disabled: e(
|
|
29
|
+
checked: e(s) === a.value,
|
|
30
|
+
disabled: e(f) || a.disabled,
|
|
29
31
|
onInput: c[0] || (c[0] = //@ts-ignore
|
|
30
|
-
(...
|
|
32
|
+
(...b) => e(d) && e(d)(...b))
|
|
31
33
|
}, null, 40, W),
|
|
32
34
|
r("label", {
|
|
33
35
|
for: `${e(t)}-${a.id}`
|
|
34
|
-
},
|
|
36
|
+
}, h(a.text), 9, j)
|
|
35
37
|
], 2))), 128))
|
|
36
|
-
]));
|
|
38
|
+
], 2));
|
|
37
39
|
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
+
}), S = "_root_1bamn_2", D = {
|
|
41
|
+
root: S
|
|
42
|
+
}, L = {
|
|
43
|
+
$style: D
|
|
44
|
+
}, N = /* @__PURE__ */ R(q, [["__cssModules", L]]), z = ["id", "name", "value", "checked", "disabled"], A = ["for"], F = /* @__PURE__ */ $({
|
|
40
45
|
__name: "VariantChip",
|
|
41
46
|
setup(u) {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
47
|
+
const o = x(y.key);
|
|
48
|
+
if (!o)
|
|
44
49
|
throw new Error("VariantChip must be used with a RadioGroup instance.");
|
|
45
|
-
const { name: t, disabled:
|
|
46
|
-
return (I, c) => (l(), n("div",
|
|
47
|
-
|
|
50
|
+
const { name: t, disabled: f, fullWidth: w, modelValue: s, options: i, update: d } = o, p = k();
|
|
51
|
+
return (I, c) => (l(), n("div", {
|
|
52
|
+
class: _(["tw-my-1.5 tw-flex tw-flex-wrap", e(p).root])
|
|
53
|
+
}, [
|
|
54
|
+
(l(!0), n(V, null, B(e(i), (a) => (l(), n("div", {
|
|
48
55
|
key: `${e(t)}-${a.id}`,
|
|
49
|
-
class:
|
|
56
|
+
class: _([{ "tw-w-full": e(w) }])
|
|
50
57
|
}, [
|
|
51
58
|
r("input", {
|
|
52
59
|
id: `${e(t)}-${a.id}`,
|
|
53
|
-
class: "sr-only",
|
|
60
|
+
class: "tw-sr-only",
|
|
54
61
|
type: "radio",
|
|
55
62
|
name: e(t),
|
|
56
63
|
value: a.value,
|
|
57
|
-
checked: e(
|
|
58
|
-
disabled: e(
|
|
64
|
+
checked: e(s) === a.value,
|
|
65
|
+
disabled: e(f) || a.disabled,
|
|
59
66
|
onInput: c[0] || (c[0] = //@ts-ignore
|
|
60
|
-
(...
|
|
61
|
-
}, null, 40,
|
|
67
|
+
(...b) => e(d) && e(d)(...b))
|
|
68
|
+
}, null, 40, z),
|
|
62
69
|
r("label", {
|
|
63
70
|
for: `${e(t)}-${a.id}`
|
|
64
|
-
},
|
|
71
|
+
}, h(a.text), 9, A)
|
|
65
72
|
], 2))), 128))
|
|
66
|
-
]));
|
|
73
|
+
], 2));
|
|
67
74
|
}
|
|
68
|
-
})
|
|
69
|
-
|
|
75
|
+
}), J = "_root_kagur_2", P = {
|
|
76
|
+
root: J
|
|
77
|
+
}, U = {
|
|
78
|
+
$style: P
|
|
79
|
+
}, H = /* @__PURE__ */ R(F, [["__cssModules", U]]), K = ["id", "name", "value", "checked", "disabled"], Q = ["for"], X = /* @__PURE__ */ $({
|
|
70
80
|
__name: "VariantRadio",
|
|
71
81
|
setup(u) {
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
82
|
+
const o = x(y.key);
|
|
83
|
+
if (!o)
|
|
74
84
|
throw new Error("VariantRadio must be used with a RadioGroup instance.");
|
|
75
|
-
const { name: t, disabled:
|
|
76
|
-
return (I, c) => (l(), n("div",
|
|
77
|
-
|
|
85
|
+
const { name: t, disabled: f, fullWidth: w, modelValue: s, options: i, update: d } = o, p = k();
|
|
86
|
+
return (I, c) => (l(), n("div", {
|
|
87
|
+
class: _(["tw-flex tw-flex-wrap", e(p).root])
|
|
88
|
+
}, [
|
|
89
|
+
(l(!0), n(V, null, B(e(i), (a) => (l(), n("div", {
|
|
78
90
|
key: `${e(t)}-${a.id}`,
|
|
79
|
-
class:
|
|
91
|
+
class: _([{ "tw-w-full": e(w) }])
|
|
80
92
|
}, [
|
|
81
93
|
r("input", {
|
|
82
94
|
id: `${e(t)}-${a.id}`,
|
|
83
95
|
type: "radio",
|
|
84
96
|
name: e(t),
|
|
85
97
|
value: a.value,
|
|
86
|
-
checked: e(
|
|
87
|
-
disabled: e(
|
|
98
|
+
checked: e(s) === a.value,
|
|
99
|
+
disabled: e(f) || a.disabled,
|
|
88
100
|
onInput: c[0] || (c[0] = //@ts-ignore
|
|
89
|
-
(...
|
|
90
|
-
}, null, 40,
|
|
101
|
+
(...b) => e(d) && e(d)(...b))
|
|
102
|
+
}, null, 40, K),
|
|
91
103
|
r("label", {
|
|
92
104
|
for: `${e(t)}-${a.id}`
|
|
93
|
-
},
|
|
105
|
+
}, h(a.text), 9, Q)
|
|
94
106
|
], 2))), 128))
|
|
95
|
-
]));
|
|
107
|
+
], 2));
|
|
96
108
|
}
|
|
97
|
-
})
|
|
98
|
-
|
|
109
|
+
}), Y = "_root_11y1n_2", Z = {
|
|
110
|
+
root: Y
|
|
111
|
+
}, ee = {
|
|
112
|
+
$style: Z
|
|
113
|
+
}, te = /* @__PURE__ */ R(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__ */ $({
|
|
99
114
|
__name: "VariantTile",
|
|
100
115
|
setup(u) {
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
116
|
+
const o = x(y.key);
|
|
117
|
+
if (!o)
|
|
103
118
|
throw new Error("VariantTile must be used with a RadioGroup instance.");
|
|
104
|
-
const { name: t, disabled:
|
|
105
|
-
return (I, c) => (l(), n("div",
|
|
106
|
-
|
|
119
|
+
const { name: t, disabled: f, fullWidth: w, modelValue: s, options: i, update: d } = o, p = k();
|
|
120
|
+
return (I, c) => (l(), n("div", {
|
|
121
|
+
class: _(["tw-flex tw-flex-wrap", e(p).root])
|
|
122
|
+
}, [
|
|
123
|
+
(l(!0), n(V, null, B(e(i), (a) => (l(), n("label", {
|
|
107
124
|
key: `${e(t)}-${a.id}`,
|
|
108
|
-
class:
|
|
125
|
+
class: _([e(p)["tile-container"], { "tw-w-full": e(w) }]),
|
|
109
126
|
for: `${e(t)}-${a.id}`
|
|
110
127
|
}, [
|
|
111
128
|
r("div", {
|
|
112
|
-
class:
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
129
|
+
class: _(["tw-flex tw-border", [
|
|
130
|
+
e(p)["tile-header"],
|
|
131
|
+
{
|
|
132
|
+
"tw-border-blue-500 tw-bg-blue-100 tw-text-ice-900": e(s) === a.value,
|
|
133
|
+
"tw-border-ice-500 tw-bg-ice-100 tw-text-ice-700": e(s) !== a.value
|
|
134
|
+
}
|
|
135
|
+
]])
|
|
116
136
|
}, [
|
|
117
137
|
r("input", {
|
|
118
138
|
id: `${e(t)}-${a.id}`,
|
|
119
|
-
class: "sr-only",
|
|
139
|
+
class: "tw-sr-only",
|
|
120
140
|
type: "radio",
|
|
121
141
|
name: e(t),
|
|
122
142
|
value: a.value,
|
|
123
|
-
checked: e(
|
|
124
|
-
disabled: e(
|
|
143
|
+
checked: e(s) === a.value,
|
|
144
|
+
disabled: e(f) || a.disabled,
|
|
125
145
|
onInput: c[0] || (c[0] = //@ts-ignore
|
|
126
|
-
(...
|
|
127
|
-
}, null, 40,
|
|
146
|
+
(...b) => e(d) && e(d)(...b))
|
|
147
|
+
}, null, 40, se),
|
|
128
148
|
r("div", null, [
|
|
129
|
-
r("span", null,
|
|
149
|
+
r("span", null, h(a.text), 1)
|
|
130
150
|
])
|
|
131
151
|
], 2),
|
|
132
152
|
r("div", {
|
|
133
|
-
class:
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
153
|
+
class: _(["tw-border-x tw-border-b", [
|
|
154
|
+
e(p)["tile-body"],
|
|
155
|
+
{
|
|
156
|
+
"tw-border-ice-500": e(s) !== a.value,
|
|
157
|
+
"tw-border-blue-500": e(s) === a.value
|
|
158
|
+
}
|
|
159
|
+
]])
|
|
137
160
|
}, [
|
|
138
|
-
r("p",
|
|
139
|
-
r("p",
|
|
161
|
+
r("p", le, h(a.subTitle), 1),
|
|
162
|
+
r("p", oe, h(a.subText), 1)
|
|
140
163
|
], 2)
|
|
141
|
-
], 10,
|
|
142
|
-
]));
|
|
164
|
+
], 10, ae))), 128))
|
|
165
|
+
], 2));
|
|
143
166
|
}
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
}), ie = "_root_1sppn_2", de = {
|
|
168
|
+
root: ie,
|
|
169
|
+
"tile-container": "_tile-container_1sppn_23",
|
|
170
|
+
"tile-header": "_tile-header_1sppn_30",
|
|
171
|
+
"tile-body": "_tile-body_1sppn_31"
|
|
172
|
+
}, ne = {
|
|
173
|
+
$style: de
|
|
174
|
+
}, ue = /* @__PURE__ */ R(re, [["__cssModules", ne]]);
|
|
175
|
+
var m = /* @__PURE__ */ ((u) => (u.Radio = "radio", u.Button = "button", u.Chip = "chip", u.Tile = "tile", u))(m || {});
|
|
176
|
+
const he = /* @__PURE__ */ $({
|
|
148
177
|
__name: "RadioGroup",
|
|
149
178
|
props: {
|
|
150
179
|
name: { default: void 0 },
|
|
@@ -162,51 +191,51 @@ const ne = /* @__PURE__ */ h({
|
|
|
162
191
|
showOptionalInLabel: { type: Boolean }
|
|
163
192
|
},
|
|
164
193
|
emits: ["update:modelValue"],
|
|
165
|
-
setup(u, { emit:
|
|
166
|
-
const t = u,
|
|
167
|
-
[
|
|
168
|
-
[
|
|
169
|
-
[
|
|
170
|
-
[
|
|
194
|
+
setup(u, { emit: o }) {
|
|
195
|
+
const t = u, f = {
|
|
196
|
+
[m.Button]: N,
|
|
197
|
+
[m.Chip]: H,
|
|
198
|
+
[m.Radio]: te,
|
|
199
|
+
[m.Tile]: ue
|
|
171
200
|
};
|
|
172
|
-
function
|
|
173
|
-
|
|
201
|
+
function w(i) {
|
|
202
|
+
o("update:modelValue", i.target.value);
|
|
174
203
|
}
|
|
175
|
-
const
|
|
204
|
+
const s = G("radio-group-field-error-");
|
|
176
205
|
return g(y.key, {
|
|
177
|
-
name:
|
|
178
|
-
disabled:
|
|
179
|
-
fullWidth:
|
|
180
|
-
modelValue:
|
|
181
|
-
options:
|
|
182
|
-
variant:
|
|
183
|
-
update:
|
|
184
|
-
}), (
|
|
185
|
-
class:
|
|
206
|
+
name: v(() => t.name),
|
|
207
|
+
disabled: v(() => t.disabled),
|
|
208
|
+
fullWidth: v(() => t.fullWidth),
|
|
209
|
+
modelValue: v(() => t.modelValue),
|
|
210
|
+
options: v(() => t.options),
|
|
211
|
+
variant: v(() => t.variant),
|
|
212
|
+
update: w
|
|
213
|
+
}), (i, d) => (l(), C(O, {
|
|
214
|
+
class: _([
|
|
186
215
|
{
|
|
187
216
|
"tw-flex": !t.options,
|
|
188
|
-
"tw-flex-wrap": !t.options && (t.variant === e(
|
|
189
|
-
"tw-gap-x-1.5 tw-gap-y-3": !t.options && t.variant === e(
|
|
190
|
-
"tw-gap-6": !t.options && (t.variant === e(
|
|
217
|
+
"tw-flex-wrap": !t.options && (t.variant === e(m).Chip || t.variant === e(m).Radio),
|
|
218
|
+
"tw-gap-x-1.5 tw-gap-y-3": !t.options && t.variant === e(m).Chip,
|
|
219
|
+
"tw-gap-6": !t.options && (t.variant === e(m).Radio || t.variant === e(m).Tile)
|
|
191
220
|
}
|
|
192
221
|
]),
|
|
193
|
-
"aria-errormessage": e(
|
|
222
|
+
"aria-errormessage": e(s),
|
|
194
223
|
"aria-invalid": !!t.errorText,
|
|
195
224
|
role: "radiogroup",
|
|
196
225
|
fieldset: "",
|
|
197
226
|
label: t.label,
|
|
198
227
|
"add-bottom-space": t.addBottomSpace,
|
|
199
|
-
"error-id": e(
|
|
228
|
+
"error-id": e(s),
|
|
200
229
|
"error-text": t.errorText,
|
|
201
230
|
"hint-text": t.hintText,
|
|
202
231
|
"show-optional-in-label": t.showOptionalInLabel,
|
|
203
232
|
"is-required": t.isRequired,
|
|
204
233
|
"is-read-only": t.isReadOnly
|
|
205
234
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
t.options ?
|
|
208
|
-
(l(),
|
|
209
|
-
]) :
|
|
235
|
+
default: M(() => [
|
|
236
|
+
t.options ? T(i.$slots, "default", { key: 0 }, () => [
|
|
237
|
+
(l(), C(E(f[t.variant])))
|
|
238
|
+
]) : T(i.$slots, "default", { key: 1 })
|
|
210
239
|
]),
|
|
211
240
|
_: 3
|
|
212
241
|
}, 8, ["class", "aria-errormessage", "aria-invalid", "label", "add-bottom-space", "error-id", "error-text", "hint-text", "show-optional-in-label", "is-required", "is-read-only"]));
|
|
@@ -214,7 +243,7 @@ const ne = /* @__PURE__ */ h({
|
|
|
214
243
|
});
|
|
215
244
|
export {
|
|
216
245
|
y as RADIO_GROUP_INJECTION,
|
|
217
|
-
|
|
218
|
-
|
|
246
|
+
m as RadioGroupVariant,
|
|
247
|
+
he as default
|
|
219
248
|
};
|
|
220
249
|
//# sourceMappingURL=RadioGroup.js.map
|
package/dist/RadioGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject } 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</script>\n\n<template>\n <div class=\"root tw-flex\">\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=\"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 scoped>\n .root label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-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: var(--border-radius);\n border-bottom-left-radius: var(--border-radius);\n }\n\n .root > div:last-child label {\n border-top-right-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\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 } 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</script>\n\n<template>\n <div class=\"root tw-my-1.5 tw-flex tw-flex-wrap\">\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=\"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 scoped>\n .root {\n gap: var(--ll-space-3);\n }\n\n .root label {\n padding: var(--ll-space-1) var(--ll-space-2);\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-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: var(--font-weight-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 } 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</script>\n\n<template>\n <div class=\"root tw-flex tw-flex-wrap\">\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 scoped>\n .root {\n gap: var(--ll-space-3);\n }\n\n .root label {\n font-weight: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 var(--ll-space-2);\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 } 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</script>\n\n<template>\n <div class=\"root tw-flex tw-flex-wrap\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n class=\"tile-container\"\n :class=\"{ 'tw-w-full': fullWidth }\"\n :for=\"`${name}-${option.id}`\"\n >\n <div\n class=\"tile-header tw-flex tw-border\"\n :class=\"{\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 <input\n :id=\"`${name}-${option.id}`\"\n class=\"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=\"tile-body tw-border-x tw-border-b\"\n :class=\"{\n 'tw-border-ice-500': modelValue !== option.value,\n 'tw-border-blue-500': modelValue === option.value,\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 scoped>\n .root {\n gap: var(--ll-space-3);\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: var(--border-radius);\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: var(--border-radius) var(--border-radius) 0 0;\n padding: var(--ll-space-2) 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 var(--border-radius) var(--border-radius);\n background-color: var(--color-white);\n padding: var(--ll-space-3);\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: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 var(--ll-space-2);\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: var(--ll-space-2);\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: 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 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 or not 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 =\n 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=\"[\n {\n 'tw-flex': !props.options,\n 'tw-flex-wrap':\n !props.options && (props.variant === RadioGroupVariant.Chip || props.variant === RadioGroupVariant.Radio),\n 'tw-gap-x-1.5 tw-gap-y-3': !props.options && props.variant === RadioGroupVariant.Chip,\n 'tw-gap-6':\n !props.options && (props.variant === RadioGroupVariant.Radio || props.variant === RadioGroupVariant.Tile),\n },\n ]\"\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 <slot v-else></slot>\n </Field>\n</template>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","e","emit","errorId","uniqueId","provide","computed","props"],"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;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN7D,UAAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN7D,UAAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;ACN7D,UAAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACTzD,IAAAS,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,OAAO,QAJGA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;iBCiFJC,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;AAuB5B,aAASN,EAAOO,GAAU;AACnB,MAAAC,EAAA,qBAAsBD,EAAE,OAA4B,KAAK;AAAA,IAChE;AAEM,UAAAE,IAAUC,EAAS,0BAA0B;AAEnD,WAAAC,EAAQjB,EAAsB,KAAK;AAAA,MACjC,MAAMkB,EAAS,MAAMC,EAAM,IAAI;AAAA,MAC/B,UAAUD,EAAS,MAAMC,EAAM,QAAQ;AAAA,MACvC,WAAWD,EAAS,MAAMC,EAAM,SAAS;AAAA,MACzC,YAAYD,EAAS,MAAMC,EAAM,UAAU;AAAA,MAC3C,SAASD,EAAS,MAAMC,EAAM,OAAO;AAAA,MACrC,SAASD,EAAS,MAAMC,EAAM,OAAO;AAAA,MACrC,QAAAb;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: 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 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 or not 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 =\n 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=\"[\n {\n 'tw-flex': !props.options,\n 'tw-flex-wrap':\n !props.options && (props.variant === RadioGroupVariant.Chip || props.variant === RadioGroupVariant.Radio),\n 'tw-gap-x-1.5 tw-gap-y-3': !props.options && props.variant === RadioGroupVariant.Chip,\n 'tw-gap-6':\n !props.options && (props.variant === RadioGroupVariant.Radio || props.variant === RadioGroupVariant.Tile),\n },\n ]\"\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 <slot v-else></slot>\n </Field>\n</template>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","e","emit","errorId","uniqueId","provide","computed","props"],"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;;;;;;;;;;;;;;;;;;;;iBCiFJC,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;AAuB5B,aAASR,EAAOS,GAAU;AACnB,MAAAC,EAAA,qBAAsBD,EAAE,OAA4B,KAAK;AAAA,IAChE;AAEM,UAAAE,IAAUC,EAAS,0BAA0B;AAEnD,WAAAC,EAAQnB,EAAsB,KAAK;AAAA,MACjC,MAAMoB,EAAS,MAAMC,EAAM,IAAI;AAAA,MAC/B,UAAUD,EAAS,MAAMC,EAAM,QAAQ;AAAA,MACvC,WAAWD,EAAS,MAAMC,EAAM,SAAS;AAAA,MACzC,YAAYD,EAAS,MAAMC,EAAM,UAAU;AAAA,MAC3C,SAASD,EAAS,MAAMC,EAAM,OAAO;AAAA,MACrC,SAASD,EAAS,MAAMC,EAAM,OAAO;AAAA,MACrC,QAAAf;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|