@volverjs/ui-vue 0.0.4 → 0.0.5-beta.1
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 +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +266 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +203 -44
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +237 -75
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +636 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +251 -79
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +552 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +651 -340
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1532 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +125 -51
- package/dist/components/VvCombobox/index.d.ts +36 -10
- package/dist/components/VvDialog/VvDialog.es.js +377 -141
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +440 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +113 -41
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +35 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +363 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +275 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +974 -460
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +96 -16
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +64 -11
- package/dist/components/VvProgress/VvProgress.es.js +206 -45
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +489 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +588 -304
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +621 -324
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +664 -353
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTextarea/index.d.ts +2 -2
- package/dist/components/VvTooltip/VvTooltip.es.js +205 -47
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3508 -2231
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.es.js +215 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +212 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +40 -16
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +114 -36
- package/src/Volver.ts +49 -22
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +7 -7
- package/src/components/VvAction/index.ts +1 -1
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +11 -11
- package/src/components/VvButton/index.ts +10 -9
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +39 -23
- package/src/components/VvCombobox/index.ts +1 -1
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +1 -1
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +2 -2
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +8 -8
- package/src/resolvers/unplugin.ts +15 -1
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
import { unref
|
|
2
|
-
import { toReactive
|
|
3
|
-
import { nanoid
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
import { unref, inject, computed, toRef, toRefs, h, defineComponent, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelRadio, renderSlot, createTextVNode, toDisplayString, createVNode } from "vue";
|
|
2
|
+
import { toReactive } from "@vueuse/core";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
5
|
+
Side2["left"] = "left";
|
|
6
|
+
Side2["right"] = "right";
|
|
7
|
+
Side2["top"] = "top";
|
|
8
|
+
Side2["bottom"] = "bottom";
|
|
9
|
+
return Side2;
|
|
10
|
+
})(Side || {});
|
|
11
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
12
|
+
Placement2["topStart"] = "top-start";
|
|
13
|
+
Placement2["topEnd"] = "top-end";
|
|
14
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
15
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
16
|
+
Placement2["leftStart"] = "left-start";
|
|
17
|
+
Placement2["leftEnd"] = "left-end";
|
|
18
|
+
Placement2["rightStart"] = "right-start";
|
|
19
|
+
Placement2["rightEnd"] = "right-end";
|
|
20
|
+
return Placement2;
|
|
21
|
+
})(Placement || {});
|
|
22
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
23
|
+
Position2["before"] = "before";
|
|
24
|
+
Position2["after"] = "after";
|
|
25
|
+
return Position2;
|
|
26
|
+
})(Position || {});
|
|
27
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
28
|
+
ButtonType2["button"] = "button";
|
|
29
|
+
ButtonType2["submit"] = "submit";
|
|
30
|
+
ButtonType2["reset"] = "reset";
|
|
31
|
+
return ButtonType2;
|
|
32
|
+
})(ButtonType || {});
|
|
33
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
34
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
35
|
+
AnchorTarget2["_self"] = "_self";
|
|
36
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
37
|
+
AnchorTarget2["_top"] = "_top";
|
|
38
|
+
return AnchorTarget2;
|
|
39
|
+
})(AnchorTarget || {});
|
|
40
|
+
const INJECTION_KEY_RADIO_GROUP = Symbol.for("radioGroup");
|
|
41
|
+
const LinkProps = {
|
|
6
42
|
/**
|
|
7
43
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
8
44
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -19,7 +55,7 @@ const oe = Symbol.for("radioGroup"), ae = {
|
|
|
19
55
|
*/
|
|
20
56
|
target: {
|
|
21
57
|
type: String,
|
|
22
|
-
validator: (
|
|
58
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
23
59
|
},
|
|
24
60
|
/**
|
|
25
61
|
* Anchor rel
|
|
@@ -28,7 +64,8 @@ const oe = Symbol.for("radioGroup"), ae = {
|
|
|
28
64
|
type: String,
|
|
29
65
|
default: "noopener noreferrer"
|
|
30
66
|
}
|
|
31
|
-
}
|
|
67
|
+
};
|
|
68
|
+
const ValidProps = {
|
|
32
69
|
/**
|
|
33
70
|
* Valid status
|
|
34
71
|
*/
|
|
@@ -37,7 +74,8 @@ const oe = Symbol.for("radioGroup"), ae = {
|
|
|
37
74
|
* Valid label
|
|
38
75
|
*/
|
|
39
76
|
validLabel: [String, Array]
|
|
40
|
-
}
|
|
77
|
+
};
|
|
78
|
+
const InvalidProps = {
|
|
41
79
|
/**
|
|
42
80
|
* Invalid status
|
|
43
81
|
*/
|
|
@@ -46,72 +84,180 @@ const oe = Symbol.for("radioGroup"), ae = {
|
|
|
46
84
|
* Invalid label
|
|
47
85
|
*/
|
|
48
86
|
invalidLabel: [String, Array]
|
|
49
|
-
}
|
|
87
|
+
};
|
|
88
|
+
const DisabledProps = {
|
|
50
89
|
/**
|
|
51
90
|
* Whether the form control is disabled
|
|
52
91
|
*/
|
|
53
92
|
disabled: Boolean
|
|
54
|
-
}
|
|
93
|
+
};
|
|
94
|
+
const ActiveProps = {
|
|
55
95
|
/**
|
|
56
96
|
* Whether the item is active
|
|
57
97
|
*/
|
|
58
98
|
active: Boolean
|
|
59
|
-
}
|
|
99
|
+
};
|
|
100
|
+
const PressedProps = {
|
|
60
101
|
/**
|
|
61
102
|
* Whether the item is pressed
|
|
62
103
|
*/
|
|
63
104
|
pressed: Boolean
|
|
64
|
-
}
|
|
105
|
+
};
|
|
106
|
+
const LabelProps = {
|
|
65
107
|
/**
|
|
66
108
|
* The item label
|
|
67
109
|
*/
|
|
68
110
|
label: [String, Number]
|
|
69
|
-
}
|
|
111
|
+
};
|
|
112
|
+
const ReadonlyProps = {
|
|
70
113
|
/**
|
|
71
114
|
* The value is not editable
|
|
72
115
|
*/
|
|
73
116
|
readonly: Boolean
|
|
74
|
-
}
|
|
117
|
+
};
|
|
118
|
+
const ModifiersProps = {
|
|
75
119
|
/**
|
|
76
120
|
* Component BEM modifiers
|
|
77
121
|
*/
|
|
78
122
|
modifiers: [String, Array]
|
|
79
|
-
}
|
|
123
|
+
};
|
|
124
|
+
const HintProps = {
|
|
80
125
|
hintLabel: { type: String, default: "" }
|
|
81
126
|
};
|
|
82
|
-
|
|
83
|
-
|
|
127
|
+
({
|
|
128
|
+
/**
|
|
129
|
+
* VvIcon name or props
|
|
130
|
+
* @see VVIcon
|
|
131
|
+
*/
|
|
132
|
+
icon: { type: [String, Object] },
|
|
133
|
+
/**
|
|
134
|
+
* VvIcon position
|
|
135
|
+
*/
|
|
136
|
+
iconPosition: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: Position.before,
|
|
139
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const TabindexProps = {
|
|
84
143
|
/**
|
|
85
144
|
* Global attribute tabindex
|
|
86
145
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
87
146
|
*/
|
|
88
147
|
tabindex: { type: [String, Number], default: 0 }
|
|
89
|
-
}
|
|
148
|
+
};
|
|
149
|
+
const IdProps = {
|
|
90
150
|
/**
|
|
91
151
|
* Global attribute id
|
|
92
152
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
93
153
|
*/
|
|
94
154
|
id: [String, Number]
|
|
95
155
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
({
|
|
157
|
+
/**
|
|
158
|
+
* Dropdown placement
|
|
159
|
+
*/
|
|
160
|
+
placement: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: Side.bottom,
|
|
163
|
+
validator: (value) => {
|
|
164
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Dropdown show / hide transition name
|
|
169
|
+
*/
|
|
170
|
+
transitionName: {
|
|
171
|
+
type: String
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* Offset of the dropdown from the trigger
|
|
175
|
+
* @see https://floating-ui.com/docs/offset
|
|
176
|
+
*/
|
|
177
|
+
offset: {
|
|
178
|
+
type: [Number, String, Object],
|
|
179
|
+
default: 0
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* Move dropdown to the side if there is no space in the default position
|
|
183
|
+
* @see https://floating-ui.com/docs/shift
|
|
184
|
+
*/
|
|
185
|
+
shift: {
|
|
186
|
+
type: [Boolean, Object],
|
|
187
|
+
default: false
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* Flip dropdown position if there is no space in the default position
|
|
191
|
+
* @see https://floating-ui.com/docs/flip
|
|
192
|
+
*/
|
|
193
|
+
flip: {
|
|
194
|
+
type: [Boolean, Object],
|
|
195
|
+
default: true
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Size of the dropdown
|
|
199
|
+
* @see https://floating-ui.com/docs/size
|
|
200
|
+
*/
|
|
201
|
+
size: {
|
|
202
|
+
type: [Boolean, Object],
|
|
203
|
+
default: () => ({ padding: 10 })
|
|
204
|
+
},
|
|
205
|
+
/**
|
|
206
|
+
* Automatically change the position of the dropdown
|
|
207
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
208
|
+
*/
|
|
209
|
+
autoPlacement: {
|
|
210
|
+
type: [Boolean, Object],
|
|
211
|
+
default: false
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Add arrow to the dropdown
|
|
215
|
+
* @see https://floating-ui.com/docs/arrow
|
|
216
|
+
*/
|
|
217
|
+
arrow: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: false
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Close dropdown on click outside
|
|
223
|
+
*/
|
|
224
|
+
autoClose: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: true
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* Autofocus first item on dropdown open
|
|
230
|
+
*/
|
|
231
|
+
autofocusFirst: {
|
|
232
|
+
type: Boolean,
|
|
233
|
+
default: true
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Set dropdown width to the same as the trigger
|
|
237
|
+
*/
|
|
238
|
+
triggerWidth: {
|
|
239
|
+
type: Boolean
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
const IdNameProps = {
|
|
243
|
+
...IdProps,
|
|
99
244
|
/**
|
|
100
245
|
* Input / Textarea name
|
|
101
246
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
102
247
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
103
248
|
*/
|
|
104
|
-
name: { type: String, required:
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
...
|
|
108
|
-
...
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
-
...
|
|
112
|
-
...
|
|
113
|
-
...
|
|
114
|
-
...
|
|
249
|
+
name: { type: String, required: true }
|
|
250
|
+
};
|
|
251
|
+
const CheckboxRadioProps = {
|
|
252
|
+
...IdNameProps,
|
|
253
|
+
...TabindexProps,
|
|
254
|
+
...ValidProps,
|
|
255
|
+
...InvalidProps,
|
|
256
|
+
...HintProps,
|
|
257
|
+
...DisabledProps,
|
|
258
|
+
...ReadonlyProps,
|
|
259
|
+
...ModifiersProps,
|
|
260
|
+
...LabelProps,
|
|
115
261
|
/**
|
|
116
262
|
* Input value
|
|
117
263
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -123,166 +269,226 @@ const ye = {
|
|
|
123
269
|
modelValue: [Object, Number, Boolean, String]
|
|
124
270
|
};
|
|
125
271
|
({
|
|
126
|
-
...
|
|
127
|
-
...
|
|
128
|
-
...
|
|
129
|
-
...
|
|
130
|
-
...
|
|
272
|
+
...DisabledProps,
|
|
273
|
+
...LabelProps,
|
|
274
|
+
...PressedProps,
|
|
275
|
+
...ActiveProps,
|
|
276
|
+
...LinkProps,
|
|
131
277
|
/**
|
|
132
278
|
* Button type
|
|
133
279
|
*/
|
|
134
|
-
type:
|
|
280
|
+
type: {
|
|
281
|
+
type: String,
|
|
282
|
+
default: ButtonType.button,
|
|
283
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
284
|
+
}
|
|
135
285
|
});
|
|
136
|
-
function
|
|
137
|
-
|
|
286
|
+
function equals(obj1, obj2, field) {
|
|
287
|
+
if (field)
|
|
288
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
289
|
+
else
|
|
290
|
+
return deepEquals(obj1, obj2);
|
|
138
291
|
}
|
|
139
|
-
function
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
292
|
+
function deepEquals(a, b) {
|
|
293
|
+
if (a === b)
|
|
294
|
+
return true;
|
|
295
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
296
|
+
const arrA = Array.isArray(a);
|
|
297
|
+
const arrB = Array.isArray(b);
|
|
298
|
+
let i, length, key;
|
|
299
|
+
if (arrA && arrB) {
|
|
300
|
+
length = a.length;
|
|
301
|
+
if (length != b.length)
|
|
302
|
+
return false;
|
|
303
|
+
for (i = length; i-- !== 0; )
|
|
304
|
+
if (!deepEquals(a[i], b[i]))
|
|
305
|
+
return false;
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
if (arrA != arrB)
|
|
309
|
+
return false;
|
|
310
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
311
|
+
if (dateA != dateB)
|
|
312
|
+
return false;
|
|
313
|
+
if (dateA && dateB)
|
|
314
|
+
return a.getTime() == b.getTime();
|
|
315
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
316
|
+
if (regexpA != regexpB)
|
|
317
|
+
return false;
|
|
318
|
+
if (regexpA && regexpB)
|
|
319
|
+
return a.toString() == b.toString();
|
|
320
|
+
const keys = Object.keys(a);
|
|
321
|
+
length = keys.length;
|
|
322
|
+
if (length !== Object.keys(b).length)
|
|
323
|
+
return false;
|
|
324
|
+
for (i = length; i-- !== 0; )
|
|
325
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
326
|
+
return false;
|
|
327
|
+
for (i = length; i-- !== 0; ) {
|
|
328
|
+
key = keys[i];
|
|
329
|
+
if (!deepEquals(a[key], b[key]))
|
|
330
|
+
return false;
|
|
152
331
|
}
|
|
153
|
-
|
|
154
|
-
return !1;
|
|
155
|
-
const c = e instanceof Date, l = t instanceof Date;
|
|
156
|
-
if (c != l)
|
|
157
|
-
return !1;
|
|
158
|
-
if (c && l)
|
|
159
|
-
return e.getTime() == t.getTime();
|
|
160
|
-
const f = e instanceof RegExp, d = t instanceof RegExp;
|
|
161
|
-
if (f != d)
|
|
162
|
-
return !1;
|
|
163
|
-
if (f && d)
|
|
164
|
-
return e.toString() == t.toString();
|
|
165
|
-
const u = Object.keys(e);
|
|
166
|
-
if (o = u.length, o !== Object.keys(t).length)
|
|
167
|
-
return !1;
|
|
168
|
-
for (n = o; n-- !== 0; )
|
|
169
|
-
if (!Object.prototype.hasOwnProperty.call(t, u[n]))
|
|
170
|
-
return !1;
|
|
171
|
-
for (n = o; n-- !== 0; )
|
|
172
|
-
if (a = u[n], !I(e[a], t[a]))
|
|
173
|
-
return !1;
|
|
174
|
-
return !0;
|
|
332
|
+
return true;
|
|
175
333
|
}
|
|
176
|
-
return
|
|
334
|
+
return a !== a && b !== b;
|
|
177
335
|
}
|
|
178
|
-
function
|
|
179
|
-
if (
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
{
|
|
183
|
-
const
|
|
184
|
-
let
|
|
185
|
-
for (let
|
|
186
|
-
if (
|
|
336
|
+
function resolveFieldData(data, field) {
|
|
337
|
+
if (data && Object.keys(data).length && field) {
|
|
338
|
+
if (field.indexOf(".") === -1) {
|
|
339
|
+
return data[field];
|
|
340
|
+
} else {
|
|
341
|
+
const fields = field.split(".");
|
|
342
|
+
let value = data;
|
|
343
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
344
|
+
if (data == null) {
|
|
187
345
|
return null;
|
|
188
|
-
|
|
346
|
+
}
|
|
347
|
+
value = value[fields[i]];
|
|
189
348
|
}
|
|
190
|
-
return
|
|
349
|
+
return value;
|
|
191
350
|
}
|
|
192
|
-
} else
|
|
351
|
+
} else {
|
|
193
352
|
return null;
|
|
353
|
+
}
|
|
194
354
|
}
|
|
195
|
-
function
|
|
196
|
-
if (
|
|
197
|
-
for (const
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
355
|
+
function contains(value, list) {
|
|
356
|
+
if (value != null && list && list.length) {
|
|
357
|
+
for (const val of list) {
|
|
358
|
+
if (equals(value, val)) {
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
200
362
|
}
|
|
201
|
-
return
|
|
363
|
+
return false;
|
|
202
364
|
}
|
|
203
|
-
function
|
|
204
|
-
return ((
|
|
365
|
+
function isEmpty(value) {
|
|
366
|
+
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
205
367
|
}
|
|
206
|
-
function
|
|
207
|
-
return typeof
|
|
368
|
+
function isString(value) {
|
|
369
|
+
return typeof value === "string" || value instanceof String;
|
|
208
370
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
371
|
+
function useInjectedGroupState(groupKey) {
|
|
372
|
+
const group = inject(groupKey, void 0);
|
|
373
|
+
const isInGroup = computed(() => !isEmpty(group));
|
|
374
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
375
|
+
if (group == null ? void 0 : group.value) {
|
|
376
|
+
const groupPropValue = unref(group.value)[propName];
|
|
377
|
+
return computed({
|
|
215
378
|
get() {
|
|
216
|
-
return
|
|
379
|
+
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
217
380
|
},
|
|
218
|
-
set(
|
|
219
|
-
|
|
381
|
+
set(value) {
|
|
382
|
+
groupPropValue.value = value;
|
|
220
383
|
}
|
|
221
384
|
});
|
|
222
385
|
}
|
|
223
|
-
const
|
|
224
|
-
return
|
|
386
|
+
const propRef = toRef(props, propName);
|
|
387
|
+
return computed({
|
|
225
388
|
get() {
|
|
226
|
-
return
|
|
389
|
+
return propRef.value;
|
|
227
390
|
},
|
|
228
|
-
set(
|
|
229
|
-
|
|
391
|
+
set(value) {
|
|
392
|
+
if (emit)
|
|
393
|
+
emit(`update:${propName}`, value);
|
|
230
394
|
}
|
|
231
395
|
});
|
|
232
396
|
}
|
|
233
397
|
return {
|
|
234
|
-
group
|
|
235
|
-
isInGroup
|
|
236
|
-
getGroupOrLocalRef
|
|
398
|
+
group,
|
|
399
|
+
isInGroup,
|
|
400
|
+
getGroupOrLocalRef
|
|
237
401
|
};
|
|
238
402
|
}
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
403
|
+
const VvRadioProps = CheckboxRadioProps;
|
|
404
|
+
const VvRadioEvents = ["click", "update:modelValue", "change", "blur"];
|
|
405
|
+
function useGroupProps(props, emit) {
|
|
406
|
+
const { id } = toRefs(props);
|
|
407
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_RADIO_GROUP);
|
|
408
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
409
|
+
const valid = getGroupOrLocalRef("valid", props);
|
|
410
|
+
const invalid = getGroupOrLocalRef("invalid", props);
|
|
411
|
+
const readonly = computed(
|
|
412
|
+
() => {
|
|
413
|
+
var _a;
|
|
414
|
+
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
const disabled = computed(
|
|
418
|
+
() => {
|
|
419
|
+
var _a;
|
|
420
|
+
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
421
|
+
}
|
|
422
|
+
);
|
|
242
423
|
return {
|
|
243
424
|
// local props
|
|
244
|
-
id
|
|
425
|
+
id,
|
|
245
426
|
// global props
|
|
246
|
-
group
|
|
247
|
-
isInGroup
|
|
248
|
-
modelValue
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
427
|
+
group,
|
|
428
|
+
isInGroup,
|
|
429
|
+
modelValue,
|
|
430
|
+
valid,
|
|
431
|
+
invalid,
|
|
432
|
+
readonly,
|
|
433
|
+
disabled
|
|
253
434
|
};
|
|
254
435
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
436
|
+
function joinLines(errors) {
|
|
437
|
+
if (Array.isArray(errors)) {
|
|
438
|
+
return errors.filter((e) => isString(e)).join(" ");
|
|
439
|
+
}
|
|
440
|
+
return errors;
|
|
257
441
|
}
|
|
258
|
-
function
|
|
442
|
+
function HintSlotFactory(parentProps, parentSlots) {
|
|
443
|
+
const {
|
|
444
|
+
invalid: invalidSlot,
|
|
445
|
+
valid: validSlot,
|
|
446
|
+
hint: hintSlot,
|
|
447
|
+
loading: loadingSlot
|
|
448
|
+
} = parentSlots;
|
|
259
449
|
const {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
450
|
+
hintLabel,
|
|
451
|
+
modelValue,
|
|
452
|
+
valid,
|
|
453
|
+
validLabel,
|
|
454
|
+
invalid,
|
|
455
|
+
invalidLabel,
|
|
456
|
+
...otherProps
|
|
457
|
+
} = toRefs(parentProps);
|
|
458
|
+
const loading = resolveFieldData(otherProps, "loading");
|
|
459
|
+
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
460
|
+
const hasInvalid = computed(() => {
|
|
461
|
+
if (!invalid.value) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
if (invalid.value && invalidSlot) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
return false;
|
|
474
|
+
});
|
|
475
|
+
const hasHint = computed(
|
|
476
|
+
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
477
|
+
);
|
|
478
|
+
const hasValid = computed(
|
|
479
|
+
() => !!(validLabel && validLabel.value || validSlot)
|
|
480
|
+
);
|
|
481
|
+
const hasLoading = computed(
|
|
482
|
+
() => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
|
|
483
|
+
);
|
|
484
|
+
const isVisible = computed(
|
|
485
|
+
() => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
|
|
280
486
|
);
|
|
281
487
|
return {
|
|
282
|
-
hasInvalid
|
|
283
|
-
hasHint
|
|
284
|
-
hasValid
|
|
285
|
-
hasLoading
|
|
488
|
+
hasInvalid,
|
|
489
|
+
hasHint,
|
|
490
|
+
hasValid,
|
|
491
|
+
hasLoading,
|
|
286
492
|
HintSlot: {
|
|
287
493
|
name: "HintSlot",
|
|
288
494
|
props: {
|
|
@@ -291,116 +497,161 @@ function _e(e, t) {
|
|
|
291
497
|
default: () => ({})
|
|
292
498
|
}
|
|
293
499
|
},
|
|
294
|
-
setup(
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
hintLabel
|
|
298
|
-
modelValue
|
|
299
|
-
valid
|
|
300
|
-
validLabel
|
|
301
|
-
invalid
|
|
302
|
-
invalidLabel
|
|
303
|
-
loading
|
|
304
|
-
loadingLabel
|
|
305
|
-
...
|
|
500
|
+
setup(props) {
|
|
501
|
+
const hintContent = computed(() => {
|
|
502
|
+
const slotProps = toReactive({
|
|
503
|
+
hintLabel,
|
|
504
|
+
modelValue,
|
|
505
|
+
valid,
|
|
506
|
+
validLabel,
|
|
507
|
+
invalid,
|
|
508
|
+
invalidLabel,
|
|
509
|
+
loading,
|
|
510
|
+
loadingLabel,
|
|
511
|
+
...props.params
|
|
306
512
|
});
|
|
307
|
-
|
|
513
|
+
if (invalid == null ? void 0 : invalid.value) {
|
|
514
|
+
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
515
|
+
}
|
|
516
|
+
if (valid == null ? void 0 : valid.value)
|
|
517
|
+
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
518
|
+
if (loading == null ? void 0 : loading.value)
|
|
519
|
+
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
520
|
+
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
308
521
|
});
|
|
309
522
|
return {
|
|
310
|
-
isVisible
|
|
311
|
-
hasInvalid
|
|
312
|
-
hasValid
|
|
313
|
-
hintContent
|
|
523
|
+
isVisible,
|
|
524
|
+
hasInvalid,
|
|
525
|
+
hasValid,
|
|
526
|
+
hintContent
|
|
314
527
|
};
|
|
315
528
|
},
|
|
316
529
|
render() {
|
|
317
|
-
if (this.isVisible)
|
|
318
|
-
return
|
|
530
|
+
if (this.isVisible) {
|
|
531
|
+
return h(
|
|
319
532
|
"small",
|
|
320
533
|
{
|
|
321
534
|
role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
|
|
322
535
|
},
|
|
323
536
|
this.hintContent
|
|
324
537
|
);
|
|
538
|
+
}
|
|
325
539
|
}
|
|
326
540
|
}
|
|
327
541
|
};
|
|
328
542
|
}
|
|
329
|
-
const
|
|
330
|
-
function
|
|
331
|
-
return
|
|
332
|
-
const
|
|
333
|
-
[
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
543
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
544
|
+
function useModifiers(prefix, modifiers, others) {
|
|
545
|
+
return computed(() => {
|
|
546
|
+
const toReturn = {
|
|
547
|
+
[prefix]: true
|
|
548
|
+
};
|
|
549
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
550
|
+
if (modifiersArray) {
|
|
551
|
+
if (Array.isArray(modifiersArray)) {
|
|
552
|
+
modifiersArray.forEach((modifier) => {
|
|
553
|
+
if (modifier) {
|
|
554
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (others) {
|
|
560
|
+
Object.keys(others.value).forEach((key) => {
|
|
561
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
return toReturn;
|
|
340
565
|
});
|
|
341
566
|
}
|
|
342
|
-
const
|
|
567
|
+
const _hoisted_1 = ["for"];
|
|
568
|
+
const _hoisted_2 = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"];
|
|
569
|
+
const __default__ = {
|
|
343
570
|
name: "VvRadio"
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
571
|
+
};
|
|
572
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
573
|
+
...__default__,
|
|
574
|
+
props: VvRadioProps,
|
|
575
|
+
emits: VvRadioEvents,
|
|
576
|
+
setup(__props, { emit }) {
|
|
577
|
+
const props = __props;
|
|
578
|
+
const slots = useSlots();
|
|
579
|
+
const { id, disabled, readonly, modelValue, valid, invalid } = useGroupProps(props, emit);
|
|
580
|
+
const hasId = useUniqueId(id);
|
|
581
|
+
const tabindex = computed(() => isDisabled.value ? -1 : props.tabindex);
|
|
582
|
+
const input = ref();
|
|
583
|
+
const isDisabled = computed(() => disabled.value || readonly.value);
|
|
584
|
+
const isInvalid = computed(() => {
|
|
585
|
+
if (invalid.value === true) {
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
if (valid.value === true) {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
return void 0;
|
|
592
|
+
});
|
|
593
|
+
const isChecked = computed(
|
|
594
|
+
() => Array.isArray(modelValue.value) ? contains(props.value, modelValue.value) : equals(props.value, modelValue.value)
|
|
595
|
+
);
|
|
596
|
+
const hasValue = computed(
|
|
597
|
+
() => ["string", "number", "boolean"].includes(typeof props.value) ? props.value : true
|
|
598
|
+
);
|
|
599
|
+
const localModelValue = computed({
|
|
359
600
|
get() {
|
|
360
|
-
return
|
|
601
|
+
return isChecked.value ? hasValue.value : null;
|
|
361
602
|
},
|
|
362
|
-
set(
|
|
363
|
-
Array.isArray(
|
|
603
|
+
set(newValue) {
|
|
604
|
+
if (Array.isArray(modelValue.value)) {
|
|
605
|
+
modelValue.value = [props.value];
|
|
606
|
+
} else {
|
|
607
|
+
modelValue.value = props.value;
|
|
608
|
+
}
|
|
609
|
+
emit("change", newValue);
|
|
364
610
|
}
|
|
365
|
-
})
|
|
611
|
+
});
|
|
612
|
+
const { modifiers } = toRefs(props);
|
|
613
|
+
const bemCssClasses = useModifiers(
|
|
366
614
|
"vv-radio",
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
valid:
|
|
370
|
-
invalid:
|
|
371
|
-
disabled:
|
|
372
|
-
readonly:
|
|
615
|
+
modifiers,
|
|
616
|
+
computed(() => ({
|
|
617
|
+
valid: valid.value,
|
|
618
|
+
invalid: invalid.value,
|
|
619
|
+
disabled: disabled.value,
|
|
620
|
+
readonly: readonly.value
|
|
373
621
|
}))
|
|
374
|
-
)
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
622
|
+
);
|
|
623
|
+
const { HintSlot } = HintSlotFactory(props, slots);
|
|
624
|
+
return (_ctx, _cache) => {
|
|
625
|
+
return openBlock(), createElementBlock("label", {
|
|
626
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
627
|
+
for: unref(hasId)
|
|
628
|
+
}, [
|
|
629
|
+
withDirectives(createElementVNode("input", {
|
|
630
|
+
id: unref(hasId),
|
|
631
|
+
ref_key: "input",
|
|
632
|
+
ref: input,
|
|
633
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null),
|
|
634
|
+
type: "radio",
|
|
635
|
+
class: "vv-radio__input",
|
|
636
|
+
name: _ctx.name,
|
|
637
|
+
disabled: unref(isDisabled),
|
|
638
|
+
value: unref(hasValue),
|
|
639
|
+
tabindex: unref(tabindex),
|
|
640
|
+
"aria-invalid": unref(isInvalid)
|
|
641
|
+
}, null, 8, _hoisted_2), [
|
|
642
|
+
[vModelRadio, unref(localModelValue)]
|
|
643
|
+
]),
|
|
644
|
+
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
645
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
646
|
+
]),
|
|
647
|
+
createVNode(unref(HintSlot), {
|
|
648
|
+
class: "vv-radio__hint",
|
|
649
|
+
params: { value: unref(modelValue) }
|
|
650
|
+
}, null, 8, ["params"])
|
|
651
|
+
], 10, _hoisted_1);
|
|
652
|
+
};
|
|
402
653
|
}
|
|
403
654
|
});
|
|
404
655
|
export {
|
|
405
|
-
|
|
656
|
+
_sfc_main as default
|
|
406
657
|
};
|