@varlet/ui 3.9.0-alpha.1736270797421 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +7 -3
- package/es/input/props.mjs +1 -0
- package/es/locale/index.mjs +3 -0
- package/es/locale/ja-JP.d.ts +5 -0
- package/es/locale/ja-JP.mjs +108 -0
- package/es/locale/zh-TW.mjs +4 -1
- package/es/pagination/Pagination.mjs +49 -47
- package/es/pagination/pagination.css +1 -1
- package/es/radio/Radio.mjs +77 -65
- package/es/radio-group/RadioGroup.mjs +37 -34
- package/es/radio-group/props.mjs +4 -0
- package/es/select/select.css +1 -1
- package/es/themes/dark/pagination.mjs +3 -2
- package/es/themes/dark/select.mjs +3 -1
- package/es/themes/md3-dark/pagination.mjs +3 -2
- package/es/themes/md3-dark/select.mjs +3 -1
- package/es/themes/md3-light/pagination.mjs +3 -2
- package/es/themes/md3-light/select.mjs +3 -1
- package/es/{style.css → varlet.css} +1 -1
- package/es/varlet.esm.js +5396 -5269
- package/highlight/web-types.en-US.json +19 -1
- package/highlight/web-types.zh-CN.json +19 -1
- package/lib/varlet.cjs.js +377 -234
- package/lib/{style.css → varlet.css} +1 -1
- package/package.json +41 -41
- package/types/input.d.ts +1 -0
- package/types/locale.d.ts +5 -0
- package/types/radioGroup.d.ts +2 -1
- package/types/space.d.ts +1 -1
- package/types/styleVars.d.ts +5 -0
- package/umd/varlet.js +8 -8
package/es/index.bundle.mjs
CHANGED
|
@@ -280,7 +280,7 @@ import './tooltip/style/index.mjs'
|
|
|
280
280
|
import './uploader/style/index.mjs'
|
|
281
281
|
import './watermark/style/index.mjs'
|
|
282
282
|
|
|
283
|
-
const version = '3.9.0
|
|
283
|
+
const version = '3.9.0'
|
|
284
284
|
|
|
285
285
|
function install(app) {
|
|
286
286
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -186,7 +186,7 @@ export * from './tooltip/index.mjs'
|
|
|
186
186
|
export * from './uploader/index.mjs'
|
|
187
187
|
export * from './watermark/index.mjs'
|
|
188
188
|
|
|
189
|
-
const version = '3.9.0
|
|
189
|
+
const version = '3.9.0'
|
|
190
190
|
|
|
191
191
|
function install(app) {
|
|
192
192
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/input/Input.mjs
CHANGED
|
@@ -8,9 +8,9 @@ import { createNamespace, useValidation } from "../utils/components.mjs";
|
|
|
8
8
|
import { props } from "./props.mjs";
|
|
9
9
|
const { name, n, classes } = createNamespace("input");
|
|
10
10
|
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, createBlock as _createBlock } from "vue";
|
|
11
|
-
const _hoisted_1 = ["placeholder", "enterkeyhint"];
|
|
12
|
-
const _hoisted_2 = ["id", "autocomplete", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
|
|
13
|
-
const _hoisted_3 = ["id", "autocomplete", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "enterkeyhint", "inputmode"];
|
|
11
|
+
const _hoisted_1 = ["aria-label", "placeholder", "enterkeyhint"];
|
|
12
|
+
const _hoisted_2 = ["id", "aria-label", "autocomplete", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
|
|
13
|
+
const _hoisted_3 = ["id", "aria-label", "autocomplete", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "enterkeyhint", "inputmode"];
|
|
14
14
|
function __render__(_ctx, _cache) {
|
|
15
15
|
const _component_var_field_decorator = _resolveComponent("var-field-decorator");
|
|
16
16
|
const _component_var_form_details = _resolveComponent("var-form-details");
|
|
@@ -29,6 +29,7 @@ function __render__(_ctx, _cache) {
|
|
|
29
29
|
size: _ctx.size,
|
|
30
30
|
variant: _ctx.variant,
|
|
31
31
|
placeholder: _ctx.placeholder,
|
|
32
|
+
ariaLabel: _ctx.ariaLabel,
|
|
32
33
|
line: _ctx.line,
|
|
33
34
|
hint: _ctx.hint,
|
|
34
35
|
textColor: _ctx.textColor,
|
|
@@ -56,6 +57,7 @@ function __render__(_ctx, _cache) {
|
|
|
56
57
|
_ctx.normalizedType === "password" ? (_openBlock(), _createElementBlock("input", {
|
|
57
58
|
key: 0,
|
|
58
59
|
tabindex: "-1",
|
|
60
|
+
"aria-label": _ctx.ariaLabel,
|
|
59
61
|
class: _normalizeClass(_ctx.n("autocomplete")),
|
|
60
62
|
placeholder: !_ctx.hint ? _ctx.placeholder : void 0,
|
|
61
63
|
style: _normalizeStyle({
|
|
@@ -67,6 +69,7 @@ function __render__(_ctx, _cache) {
|
|
|
67
69
|
key: 1,
|
|
68
70
|
id: _ctx.id,
|
|
69
71
|
ref: "el",
|
|
72
|
+
"aria-label": _ctx.ariaLabel,
|
|
70
73
|
class: _normalizeClass(
|
|
71
74
|
_ctx.classes(
|
|
72
75
|
_ctx.n("input"),
|
|
@@ -102,6 +105,7 @@ function __render__(_ctx, _cache) {
|
|
|
102
105
|
key: 2,
|
|
103
106
|
id: _ctx.id,
|
|
104
107
|
ref: "el",
|
|
108
|
+
"aria-label": _ctx.ariaLabel,
|
|
105
109
|
class: _normalizeClass(
|
|
106
110
|
_ctx.classes(
|
|
107
111
|
_ctx.n("input"),
|
package/es/input/props.mjs
CHANGED
package/es/locale/index.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { ref } from "vue";
|
|
|
18
18
|
import { hasOwn } from "@varlet/shared";
|
|
19
19
|
import enUS from "./en-US.mjs";
|
|
20
20
|
import faIR from "./fa-IR.mjs";
|
|
21
|
+
import jaJP from "./ja-JP.mjs";
|
|
21
22
|
import zhCN from "./zh-CN.mjs";
|
|
22
23
|
import zhHK from "./zh-HK.mjs";
|
|
23
24
|
import zhTW from "./zh-TW.mjs";
|
|
@@ -66,6 +67,7 @@ const _LocaleComponent = {
|
|
|
66
67
|
zhTW,
|
|
67
68
|
zhHK,
|
|
68
69
|
faIR,
|
|
70
|
+
jaJP,
|
|
69
71
|
messages,
|
|
70
72
|
currentMessage,
|
|
71
73
|
add,
|
|
@@ -80,6 +82,7 @@ var stdin_default = {
|
|
|
80
82
|
zhTW,
|
|
81
83
|
zhHK,
|
|
82
84
|
faIR,
|
|
85
|
+
jaJP,
|
|
83
86
|
messages,
|
|
84
87
|
currentMessage,
|
|
85
88
|
add,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var stdin_default = {
|
|
2
|
+
// Dialog
|
|
3
|
+
dialogTitle: "\u78BA\u8A8D",
|
|
4
|
+
dialogConfirmButtonText: "\u78BA\u8A8D",
|
|
5
|
+
dialogCancelButtonText: "\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
6
|
+
// ActionSheet
|
|
7
|
+
actionSheetTitle: "\u3044\u305A\u308C\u304B\u3092\u9078\u629E",
|
|
8
|
+
// List
|
|
9
|
+
listLoadingText: "\u8AAD\u307F\u8FBC\u307F\u4E2D",
|
|
10
|
+
listFinishedText: "\u4EE5\u4E0A\u3067\u3059",
|
|
11
|
+
listErrorText: "\u8AAD\u307F\u8FBC\u307F\u5931\u6557",
|
|
12
|
+
// Picker
|
|
13
|
+
pickerTitle: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
14
|
+
pickerConfirmButtonText: "\u78BA\u8A8D",
|
|
15
|
+
pickerCancelButtonText: "\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
16
|
+
// date-picker
|
|
17
|
+
datePickerMonthDict: {
|
|
18
|
+
"01": {
|
|
19
|
+
name: "1\u6708",
|
|
20
|
+
abbr: "1\u6708"
|
|
21
|
+
},
|
|
22
|
+
"02": {
|
|
23
|
+
name: "2\u6708",
|
|
24
|
+
abbr: "2\u6708"
|
|
25
|
+
},
|
|
26
|
+
"03": {
|
|
27
|
+
name: "3\u6708",
|
|
28
|
+
abbr: "3\u6708"
|
|
29
|
+
},
|
|
30
|
+
"04": {
|
|
31
|
+
name: "4\u6708",
|
|
32
|
+
abbr: "4\u6708"
|
|
33
|
+
},
|
|
34
|
+
"05": {
|
|
35
|
+
name: "5\u6708",
|
|
36
|
+
abbr: "5\u6708"
|
|
37
|
+
},
|
|
38
|
+
"06": {
|
|
39
|
+
name: "6\u6708",
|
|
40
|
+
abbr: "6\u6708"
|
|
41
|
+
},
|
|
42
|
+
"07": {
|
|
43
|
+
name: "7\u6708",
|
|
44
|
+
abbr: "7\u6708"
|
|
45
|
+
},
|
|
46
|
+
"08": {
|
|
47
|
+
name: "8\u6708",
|
|
48
|
+
abbr: "8\u6708"
|
|
49
|
+
},
|
|
50
|
+
"09": {
|
|
51
|
+
name: "9\u6708",
|
|
52
|
+
abbr: "9\u6708"
|
|
53
|
+
},
|
|
54
|
+
"10": {
|
|
55
|
+
name: "10\u6708",
|
|
56
|
+
abbr: "10\u6708"
|
|
57
|
+
},
|
|
58
|
+
"11": {
|
|
59
|
+
name: "11\u6708",
|
|
60
|
+
abbr: "11\u6708"
|
|
61
|
+
},
|
|
62
|
+
"12": {
|
|
63
|
+
name: "12\u6708",
|
|
64
|
+
abbr: "12\u6708"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
datePickerWeekDict: {
|
|
68
|
+
"0": {
|
|
69
|
+
name: "\u65E5\u66DC\u65E5",
|
|
70
|
+
abbr: "\u65E5"
|
|
71
|
+
},
|
|
72
|
+
"1": {
|
|
73
|
+
name: "\u6708\u66DC\u65E5",
|
|
74
|
+
abbr: "\u6708"
|
|
75
|
+
},
|
|
76
|
+
"2": {
|
|
77
|
+
name: "\u706B\u66DC\u65E5",
|
|
78
|
+
abbr: "\u706B"
|
|
79
|
+
},
|
|
80
|
+
"3": {
|
|
81
|
+
name: "\u6C34\u66DC\u65E5",
|
|
82
|
+
abbr: "\u6C34"
|
|
83
|
+
},
|
|
84
|
+
"4": {
|
|
85
|
+
name: "\u6728\u66DC\u65E5",
|
|
86
|
+
abbr: "\u6728"
|
|
87
|
+
},
|
|
88
|
+
"5": {
|
|
89
|
+
name: "\u91D1\u66DC\u65E5",
|
|
90
|
+
abbr: "\u91D1"
|
|
91
|
+
},
|
|
92
|
+
"6": {
|
|
93
|
+
name: "\u571F\u66DC\u65E5",
|
|
94
|
+
abbr: "\u571F"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
datePickerSelected: "\u4EF6\u9078\u629E\u6E08\u307F",
|
|
98
|
+
datePickerHint: "\u65E5\u4ED8\u3092\u9078\u629E",
|
|
99
|
+
// pagination
|
|
100
|
+
paginationItem: "\u4EF6",
|
|
101
|
+
paginationPage: "\u30DA\u30FC\u30B8",
|
|
102
|
+
paginationJump: "\u30B8\u30E3\u30F3\u30D7",
|
|
103
|
+
// time-picker
|
|
104
|
+
timePickerHint: "\u6642\u9593\u3092\u9078\u629E"
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
stdin_default as default
|
|
108
|
+
};
|
package/es/locale/zh-TW.mjs
CHANGED
|
@@ -95,10 +95,13 @@ var stdin_default = {
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
datePickerSelected: "\u500B\u88AB\u9078\u64C7",
|
|
98
|
+
datePickerHint: "\u9078\u64C7\u65E5\u671F",
|
|
98
99
|
// pagination
|
|
99
100
|
paginationItem: "\u689D",
|
|
100
101
|
paginationPage: "\u9801",
|
|
101
|
-
paginationJump: "\u524D\u5F80"
|
|
102
|
+
paginationJump: "\u524D\u5F80",
|
|
103
|
+
// time-picker
|
|
104
|
+
timePickerHint: "\u9078\u64C7\u6642\u9593"
|
|
102
105
|
};
|
|
103
106
|
export {
|
|
104
107
|
stdin_default as default
|
|
@@ -58,6 +58,7 @@ function __render__(_ctx, _cache) {
|
|
|
58
58
|
modelValue: _ctx.simpleCurrentValue,
|
|
59
59
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.simpleCurrentValue = $event),
|
|
60
60
|
"var-pagination-cover": "",
|
|
61
|
+
variant: "standard",
|
|
61
62
|
hint: false,
|
|
62
63
|
disabled: _ctx.disabled,
|
|
63
64
|
onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.setPage("simple", _ctx.simpleCurrentValue, $event)),
|
|
@@ -136,45 +137,45 @@ function __render__(_ctx, _cache) {
|
|
|
136
137
|
)), [
|
|
137
138
|
[_directive_ripple, { disabled: _ctx.current >= _ctx.pageCount || _ctx.disabled }]
|
|
138
139
|
]),
|
|
139
|
-
_ctx.showSizeChanger ? (_openBlock(),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
))
|
|
176
|
-
|
|
177
|
-
|
|
140
|
+
_ctx.showSizeChanger ? (_openBlock(), _createBlock(_component_var_menu_select, {
|
|
141
|
+
key: 2,
|
|
142
|
+
modelValue: _ctx.size,
|
|
143
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.size = $event),
|
|
144
|
+
placement: "cover-top",
|
|
145
|
+
disabled: _ctx.disabled
|
|
146
|
+
}, {
|
|
147
|
+
options: _withCtx(() => [
|
|
148
|
+
(_openBlock(true), _createElementBlock(
|
|
149
|
+
_Fragment,
|
|
150
|
+
null,
|
|
151
|
+
_renderList(_ctx.sizeOption, (option, index) => {
|
|
152
|
+
return _openBlock(), _createBlock(_component_var_menu_option, {
|
|
153
|
+
key: index,
|
|
154
|
+
value: option,
|
|
155
|
+
onClick: _ctx.clickSize
|
|
156
|
+
}, {
|
|
157
|
+
default: _withCtx(() => [
|
|
158
|
+
_createTextVNode(
|
|
159
|
+
_toDisplayString(option) + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationItem")) + " / " + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationPage")),
|
|
160
|
+
1
|
|
161
|
+
/* TEXT */
|
|
162
|
+
)
|
|
163
|
+
]),
|
|
164
|
+
_: 2
|
|
165
|
+
/* DYNAMIC */
|
|
166
|
+
}, 1032, ["value", "onClick"]);
|
|
167
|
+
}),
|
|
168
|
+
128
|
|
169
|
+
/* KEYED_FRAGMENT */
|
|
170
|
+
))
|
|
171
|
+
]),
|
|
172
|
+
default: _withCtx(() => [
|
|
173
|
+
_createElementVNode(
|
|
174
|
+
"li",
|
|
175
|
+
{
|
|
176
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("size"), [_ctx.disabled, _ctx.n("item--disabled")]))
|
|
177
|
+
},
|
|
178
|
+
[
|
|
178
179
|
_createElementVNode(
|
|
179
180
|
"div",
|
|
180
181
|
{
|
|
@@ -197,14 +198,14 @@ function __render__(_ctx, _cache) {
|
|
|
197
198
|
2
|
|
198
199
|
/* CLASS */
|
|
199
200
|
)
|
|
200
|
-
]
|
|
201
|
-
|
|
202
|
-
/*
|
|
203
|
-
|
|
204
|
-
],
|
|
205
|
-
|
|
206
|
-
/*
|
|
207
|
-
)) : _createCommentVNode("v-if", true),
|
|
201
|
+
],
|
|
202
|
+
2
|
|
203
|
+
/* CLASS */
|
|
204
|
+
)
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
/* STABLE */
|
|
208
|
+
}, 8, ["modelValue", "disabled"])) : _createCommentVNode("v-if", true),
|
|
208
209
|
_ctx.showQuickJumper && !_ctx.simple ? (_openBlock(), _createElementBlock(
|
|
209
210
|
"li",
|
|
210
211
|
{
|
|
@@ -222,6 +223,7 @@ function __render__(_ctx, _cache) {
|
|
|
222
223
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.quickJumperValue = $event),
|
|
223
224
|
disabled: _ctx.disabled,
|
|
224
225
|
hint: false,
|
|
226
|
+
variant: "standard",
|
|
225
227
|
"var-pagination-cover": "",
|
|
226
228
|
onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.setPage("quick", _ctx.quickJumperValue, $event)),
|
|
227
229
|
onKeydown: _cache[8] || (_cache[8] = _withKeys(($event) => _ctx.setPage("quick", _ctx.quickJumperValue, $event), ["enter"]))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --pagination-text-color: #555; --pagination-font-size: var(--font-size-md); --pagination-active-color: var(--color-on-primary); --pagination-active-bg-color: var(--color-primary); --pagination-hover-bg-color: rgba(85, 85, 85, 0.15); --pagination-total-margin: 0
|
|
1
|
+
:root { --pagination-text-color: #555; --pagination-font-size: var(--font-size-md); --pagination-active-color: var(--color-on-primary); --pagination-active-bg-color: var(--color-primary); --pagination-hover-bg-color: rgba(85, 85, 85, 0.15); --pagination-total-margin: 0 10px; --pagination-total-line-height: 24px; --pagination-item-width: 32px; --pagination-item-height: 32px; --pagination-item-margin: 0 6px; --pagination-item-background: #fff; --pagination-item-border-radius: 4px; --pagination-item-simple-border-radius: 50%; --pagination-input-width: 32px; --pagination-disabled-color: var(--color-text-disabled); --pagination-bg-disabled-color: var(--color-disabled); --pagination-size-line-height: 24px; --pagination-size-padding: 0 4px; --pagination-quick-jumper-margin: 0 10px;}.var-pagination-flex-nowrap { display: flex; white-space: nowrap; align-items: center;}.var-pagination { display: flex; align-items: center; list-style: none; margin: 0; font-size: var(--pagination-font-size); padding: 0; color: var(--pagination-text-color);}.var-pagination__item { display: inline-flex; min-width: var(--pagination-item-width); align-items: center; justify-content: center; margin: var(--pagination-item-margin); height: var(--pagination-item-height); cursor: pointer; border-radius: var(--pagination-item-border-radius); outline: none; transition: all 0.25s; user-select: none; background-color: var(--pagination-item-background);}.var-pagination__item:hover { background-color: var(--pagination-hover-bg-color);}.var-pagination__item--active { color: var(--pagination-active-color); background-color: var(--pagination-active-bg-color) !important;}.var-pagination__item--hide { display: none;}.var-pagination__item--simple { background: transparent; border-radius: var(--pagination-item-simple-border-radius);}.var-pagination__item--disabled { cursor: not-allowed !important; color: var(--pagination-disabled-color); background-color: unset; box-shadow: none !important;}.var-pagination__item--disabled:hover { background-color: unset;}.var-pagination__item--disabled--active { background-color: var(--pagination-bg-disabled-color);}.var-pagination__item--disabled--active:hover { background-color: var(--pagination-bg-disabled-color);}.var-pagination__prev { margin-left: 0;}.var-pagination__total { display: flex; white-space: nowrap; align-items: center; line-height: var(--pagination-total-line-height); margin: var(--pagination-total-margin);}.var-pagination__size { display: flex; white-space: nowrap; align-items: center; height: var(--pagination-item-height); line-height: var(--pagination-size-line-height); margin: var(--pagination-item-margin); padding: var(--pagination-size-padding); cursor: pointer;}.var-pagination__size--open { display: flex; align-items: center; cursor: pointer;}.var-pagination__size--open--disabled { cursor: inherit;}.var-pagination__quickly,.var-pagination__simple { display: flex; white-space: nowrap; align-items: center;}.var-pagination__quickly [var-pagination-cover],.var-pagination__simple [var-pagination-cover] { width: var(--pagination-input-width);}.var-pagination__quickly [var-pagination-cover] .var-field-decorator__middle,.var-pagination__simple [var-pagination-cover] .var-field-decorator__middle { padding: 0;}.var-pagination__quickly [var-pagination-cover] .var-input__input,.var-pagination__simple [var-pagination-cover] .var-input__input { height: auto; text-align: center; font-weight: normal; font-size: var(--pagination-font-size); padding-top: 1px;}.var-pagination__quickly-line,.var-pagination__simple-line { height: 1px; background: transparent;}.var-pagination__quickly { margin: var(--pagination-quick-jumper-margin);}.var-pagination__quickly [var-pagination-cover] { margin-left: 6px;}.var-pagination__size--open-icon[var-pagination-cover] { font-size: inherit;}
|
package/es/radio/Radio.mjs
CHANGED
|
@@ -12,7 +12,8 @@ import { props } from "./props.mjs";
|
|
|
12
12
|
import { useRadioGroup } from "./provide.mjs";
|
|
13
13
|
const { name, n, classes } = createNamespace("radio");
|
|
14
14
|
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, mergeProps as _mergeProps, createElementVNode as _createElementVNode } from "vue";
|
|
15
|
-
const _hoisted_1 = ["
|
|
15
|
+
const _hoisted_1 = ["aria-checked"];
|
|
16
|
+
const _hoisted_2 = ["tabindex"];
|
|
16
17
|
function __render__(_ctx, _cache) {
|
|
17
18
|
const _component_var_icon = _resolveComponent("var-icon");
|
|
18
19
|
const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
@@ -25,75 +26,71 @@ function __render__(_ctx, _cache) {
|
|
|
25
26
|
class: _normalizeClass(_ctx.n("wrap"))
|
|
26
27
|
},
|
|
27
28
|
[
|
|
28
|
-
_createElementVNode(
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
_createElementVNode("div", _mergeProps({
|
|
30
|
+
role: "radio",
|
|
31
|
+
"aria-checked": _ctx.checked,
|
|
32
|
+
class: _ctx.n()
|
|
33
|
+
}, _ctx.$attrs, {
|
|
34
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
35
|
+
}), [
|
|
36
|
+
_withDirectives((_openBlock(), _createElementBlock("div", {
|
|
37
|
+
ref: "action",
|
|
38
|
+
class: _normalizeClass(
|
|
39
|
+
_ctx.classes(
|
|
40
|
+
_ctx.n("action"),
|
|
41
|
+
[_ctx.checked, _ctx.n("--checked"), _ctx.n("--unchecked")],
|
|
42
|
+
[_ctx.errorMessage || _ctx.radioGroupErrorMessage, _ctx.n("--error")],
|
|
43
|
+
[_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")]
|
|
44
|
+
)
|
|
45
|
+
),
|
|
46
|
+
tabindex: _ctx.tabIndex,
|
|
47
|
+
style: _normalizeStyle({ color: _ctx.checked ? _ctx.checkedColor : _ctx.uncheckedColor }),
|
|
48
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.isFocusing = true),
|
|
49
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.isFocusing = false)
|
|
50
|
+
}, [
|
|
51
|
+
_ctx.checked ? _renderSlot(_ctx.$slots, "checked-icon", { key: 0 }, () => [
|
|
52
|
+
_createVNode(_component_var_icon, {
|
|
53
|
+
class: _normalizeClass(_ctx.n("icon")),
|
|
54
|
+
"var-radio-cover": "",
|
|
55
|
+
name: "radio-marked",
|
|
56
|
+
size: _ctx.iconSize
|
|
57
|
+
}, null, 8, ["class", "size"])
|
|
58
|
+
]) : _renderSlot(_ctx.$slots, "unchecked-icon", { key: 1 }, () => [
|
|
59
|
+
_createVNode(_component_var_icon, {
|
|
60
|
+
class: _normalizeClass(_ctx.n("icon")),
|
|
61
|
+
"var-radio-cover": "",
|
|
62
|
+
name: "radio-blank",
|
|
63
|
+
size: _ctx.iconSize
|
|
64
|
+
}, null, 8, ["class", "size"])
|
|
65
|
+
]),
|
|
66
|
+
_createVNode(_component_var_hover_overlay, {
|
|
67
|
+
hovering: !_ctx.disabled && !_ctx.formDisabled && _ctx.hovering,
|
|
68
|
+
focusing: !_ctx.disabled && !_ctx.formDisabled && _ctx.isFocusing
|
|
69
|
+
}, null, 8, ["hovering", "focusing"])
|
|
70
|
+
], 46, _hoisted_2)), [
|
|
71
|
+
[_directive_ripple, { disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple }],
|
|
72
|
+
[_directive_hover, _ctx.handleHovering, "desktop"]
|
|
73
|
+
]),
|
|
74
|
+
_ctx.$slots.default ? (_openBlock(), _createElementBlock(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
key: 0,
|
|
38
78
|
class: _normalizeClass(
|
|
39
79
|
_ctx.classes(
|
|
40
|
-
_ctx.n("
|
|
41
|
-
[_ctx.checked, _ctx.n("--checked"), _ctx.n("--unchecked")],
|
|
80
|
+
_ctx.n("text"),
|
|
42
81
|
[_ctx.errorMessage || _ctx.radioGroupErrorMessage, _ctx.n("--error")],
|
|
43
82
|
[_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")]
|
|
44
83
|
)
|
|
45
84
|
),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
name: "radio-marked",
|
|
56
|
-
size: _ctx.iconSize
|
|
57
|
-
}, null, 8, ["class", "size"])
|
|
58
|
-
]) : _renderSlot(_ctx.$slots, "unchecked-icon", { key: 1 }, () => [
|
|
59
|
-
_createVNode(_component_var_icon, {
|
|
60
|
-
class: _normalizeClass(_ctx.n("icon")),
|
|
61
|
-
"var-radio-cover": "",
|
|
62
|
-
name: "radio-blank",
|
|
63
|
-
size: _ctx.iconSize
|
|
64
|
-
}, null, 8, ["class", "size"])
|
|
65
|
-
]),
|
|
66
|
-
_createVNode(_component_var_hover_overlay, {
|
|
67
|
-
hovering: !_ctx.disabled && !_ctx.formDisabled && _ctx.hovering,
|
|
68
|
-
focusing: !_ctx.disabled && !_ctx.formDisabled && _ctx.isFocusing
|
|
69
|
-
}, null, 8, ["hovering", "focusing"])
|
|
70
|
-
], 46, _hoisted_1)), [
|
|
71
|
-
[_directive_ripple, { disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple }],
|
|
72
|
-
[_directive_hover, _ctx.handleHovering, "desktop"]
|
|
73
|
-
]),
|
|
74
|
-
_ctx.$slots.default ? (_openBlock(), _createElementBlock(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
key: 0,
|
|
78
|
-
class: _normalizeClass(
|
|
79
|
-
_ctx.classes(
|
|
80
|
-
_ctx.n("text"),
|
|
81
|
-
[_ctx.errorMessage || _ctx.radioGroupErrorMessage, _ctx.n("--error")],
|
|
82
|
-
[_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")]
|
|
83
|
-
)
|
|
84
|
-
),
|
|
85
|
-
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleTextClick && _ctx.handleTextClick(...args))
|
|
86
|
-
},
|
|
87
|
-
[
|
|
88
|
-
_renderSlot(_ctx.$slots, "default", { checked: _ctx.checked })
|
|
89
|
-
],
|
|
90
|
-
2
|
|
91
|
-
/* CLASS */
|
|
92
|
-
)) : _createCommentVNode("v-if", true)
|
|
93
|
-
],
|
|
94
|
-
16
|
|
95
|
-
/* FULL_PROPS */
|
|
96
|
-
),
|
|
85
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleTextClick && _ctx.handleTextClick(...args))
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
_renderSlot(_ctx.$slots, "default", { checked: _ctx.checked })
|
|
89
|
+
],
|
|
90
|
+
2
|
|
91
|
+
/* CLASS */
|
|
92
|
+
)) : _createCommentVNode("v-if", true)
|
|
93
|
+
], 16, _hoisted_1),
|
|
97
94
|
_createVNode(_component_var_form_details, { "error-message": _ctx.errorMessage }, null, 8, ["error-message"])
|
|
98
95
|
],
|
|
99
96
|
2
|
|
@@ -118,6 +115,18 @@ const __sfc__ = defineComponent({
|
|
|
118
115
|
const { radioGroup, bindRadioGroup } = useRadioGroup();
|
|
119
116
|
const { hovering, handleHovering } = useHoverOverlay();
|
|
120
117
|
const { form, bindForm } = useForm();
|
|
118
|
+
const tabIndex = computed(() => {
|
|
119
|
+
const disabled = (form == null ? void 0 : form.disabled.value) || props2.disabled;
|
|
120
|
+
const isChecked = checked.value;
|
|
121
|
+
const hasCheckedInRadioGroup = radioGroup == null ? void 0 : radioGroup.hasChecked.value;
|
|
122
|
+
if (disabled) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (radioGroup && hasCheckedInRadioGroup && !isChecked) {
|
|
126
|
+
return "-1";
|
|
127
|
+
}
|
|
128
|
+
return "0";
|
|
129
|
+
});
|
|
121
130
|
const {
|
|
122
131
|
errorMessage,
|
|
123
132
|
validateWithTrigger: vt,
|
|
@@ -197,7 +206,9 @@ const __sfc__ = defineComponent({
|
|
|
197
206
|
}
|
|
198
207
|
function sync(v2) {
|
|
199
208
|
const { checkedValue, uncheckedValue } = props2;
|
|
200
|
-
|
|
209
|
+
const checked2 = v2 === checkedValue;
|
|
210
|
+
value.value = checked2 ? checkedValue : uncheckedValue;
|
|
211
|
+
return checked2;
|
|
201
212
|
}
|
|
202
213
|
function reset() {
|
|
203
214
|
value.value = props2.uncheckedValue;
|
|
@@ -223,6 +234,7 @@ const __sfc__ = defineComponent({
|
|
|
223
234
|
formDisabled: form == null ? void 0 : form.disabled,
|
|
224
235
|
formReadonly: form == null ? void 0 : form.readonly,
|
|
225
236
|
hovering,
|
|
237
|
+
tabIndex,
|
|
226
238
|
handleHovering,
|
|
227
239
|
n,
|
|
228
240
|
classes,
|