@varlet/ui 3.7.4 → 3.8.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.
Files changed (41) hide show
  1. package/es/action-sheet/style/index.mjs +1 -1
  2. package/es/checkbox/Checkbox.mjs +11 -13
  3. package/es/checkbox/checkbox.css +1 -1
  4. package/es/checkbox-group/CheckboxGroup.mjs +0 -5
  5. package/es/index.bundle.mjs +1 -1
  6. package/es/index.mjs +1 -1
  7. package/es/menu/Menu.mjs +5 -0
  8. package/es/menu/menu.css +1 -1
  9. package/es/menu/props.mjs +4 -1
  10. package/es/menu/usePopover.mjs +11 -0
  11. package/es/menu-option/MenuOption.mjs +104 -21
  12. package/es/menu-option/menuOption.css +1 -1
  13. package/es/menu-option/props.mjs +7 -2
  14. package/es/menu-option/style/index.mjs +1 -0
  15. package/es/menu-select/MenuChildren.mjs +237 -0
  16. package/es/menu-select/MenuSelect.mjs +200 -20
  17. package/es/menu-select/menuSelect.css +1 -1
  18. package/es/menu-select/props.mjs +6 -1
  19. package/es/option/Option.mjs +9 -5
  20. package/es/option/props.mjs +4 -0
  21. package/es/radio/Radio.mjs +2 -5
  22. package/es/radio/radio.css +1 -1
  23. package/es/select/Select.mjs +3 -2
  24. package/es/select/useSelectController.mjs +12 -5
  25. package/es/snackbar/style/index.mjs +1 -1
  26. package/es/style.css +1 -1
  27. package/es/uploader/Uploader.mjs +17 -11
  28. package/es/utils/elements.mjs +14 -1
  29. package/es/varlet.esm.js +7264 -6858
  30. package/highlight/web-types.en-US.json +27 -1
  31. package/highlight/web-types.zh-CN.json +27 -1
  32. package/lib/style.css +1 -1
  33. package/lib/varlet.cjs.js +1149 -610
  34. package/package.json +7 -7
  35. package/types/checkbox.d.ts +1 -1
  36. package/types/checkboxGroup.d.ts +2 -2
  37. package/types/menuSelect.d.ts +9 -1
  38. package/types/radioGroup.d.ts +2 -2
  39. package/types/select.d.ts +1 -1
  40. package/types/uploader.d.ts +1 -0
  41. package/umd/varlet.js +8 -8
@@ -0,0 +1,237 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __async = (__this, __arguments, generator) => {
18
+ return new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
+ try {
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ };
26
+ var rejected = (value) => {
27
+ try {
28
+ step(generator.throw(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
+ step((generator = generator.apply(__this, __arguments)).next());
35
+ });
36
+ };
37
+ import VarMenu from "../menu/Menu.mjs";
38
+ import VarMenuOption from "../menu-option/MenuOption.mjs";
39
+ import { defineComponent, ref, watch } from "vue";
40
+ import { createNamespace, defineListenerProp, pickProps } from "../utils/components.mjs";
41
+ import { props as menuSelectProps } from "./props.mjs";
42
+ import { focusChildElementByKey } from "../utils/elements.mjs";
43
+ import { call, raf } from "@varlet/shared";
44
+ const { name, n } = createNamespace("menu-children");
45
+ import { resolveComponent as _resolveComponent, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, withCtx as _withCtx, createSlots as _createSlots } from "vue";
46
+ const _hoisted_1 = { ref: "menuOptions" };
47
+ function __render__(_ctx, _cache) {
48
+ const _component_var_menu_option = _resolveComponent("var-menu-option");
49
+ const _component_var_menu_children = _resolveComponent("var-menu-children");
50
+ const _component_var_menu = _resolveComponent("var-menu");
51
+ return _openBlock(), _createBlock(_component_var_menu, {
52
+ ref: "menu",
53
+ trigger: "hover",
54
+ placement: "right-start",
55
+ "cascade-optimization": "",
56
+ "var-menu-children-cover": "",
57
+ class: _normalizeClass(_ctx.n()),
58
+ disabled: _ctx.disabled,
59
+ teleport: false,
60
+ "close-on-click-reference": false,
61
+ show: _ctx.show,
62
+ "onUpdate:show": _cache[1] || (_cache[1] = ($event) => _ctx.show = $event)
63
+ }, _createSlots({
64
+ default: _withCtx(() => [
65
+ _createVNode(_component_var_menu_option, {
66
+ ref: "trigger",
67
+ "children-trigger": "",
68
+ label: _ctx.option[_ctx.labelKey],
69
+ value: _ctx.option[_ctx.valueKey],
70
+ option: _ctx.option,
71
+ ripple: _ctx.option.ripple,
72
+ disabled: _ctx.option.disabled,
73
+ highlight: _ctx.highlightOptions.some((_option) => _option.value === _ctx.option.value),
74
+ onKeyArrowX: _ctx.handleArrowRight,
75
+ onMouseenter: _ctx.handleMouseenter
76
+ }, null, 8, ["label", "value", "option", "ripple", "disabled", "highlight", "onKeyArrowX", "onMouseenter"])
77
+ ]),
78
+ _: 2
79
+ /* DYNAMIC */
80
+ }, [
81
+ _ctx.options.length ? {
82
+ name: "menu",
83
+ fn: _withCtx(() => [
84
+ _createElementVNode(
85
+ "div",
86
+ _hoisted_1,
87
+ [
88
+ (_openBlock(true), _createElementBlock(
89
+ _Fragment,
90
+ null,
91
+ _renderList(_ctx.options, (option) => {
92
+ return _openBlock(), _createElementBlock(
93
+ _Fragment,
94
+ {
95
+ key: option[_ctx.valueKey]
96
+ },
97
+ [
98
+ option[_ctx.childrenKey] ? (_openBlock(), _createBlock(_component_var_menu_children, {
99
+ key: 0,
100
+ ref_for: true,
101
+ ref: "menuChildren",
102
+ "parent-show": _ctx.show,
103
+ option,
104
+ options: option[_ctx.childrenKey],
105
+ "highlight-options": _ctx.highlightOptions,
106
+ disabled: option.disabled,
107
+ onKeyArrowX: _ctx.handleArrowLeft,
108
+ onKeyArrowRightOpen: ($event) => _ctx.allowChildrenClose(option),
109
+ onMouseenter: ($event) => _ctx.allowChildrenClose(option)
110
+ }, null, 8, ["parent-show", "option", "options", "highlight-options", "disabled", "onKeyArrowX", "onKeyArrowRightOpen", "onMouseenter"])) : (_openBlock(), _createBlock(_component_var_menu_option, {
111
+ key: 1,
112
+ label: option[_ctx.labelKey],
113
+ value: option[_ctx.valueKey],
114
+ option,
115
+ ripple: option.ripple,
116
+ disabled: option.disabled,
117
+ onKeyArrowX: _ctx.handleArrowLeft,
118
+ onMouseenter: _cache[0] || (_cache[0] = ($event) => _ctx.allowChildrenClose())
119
+ }, null, 8, ["label", "value", "option", "ripple", "disabled", "onKeyArrowX"]))
120
+ ],
121
+ 64
122
+ /* STABLE_FRAGMENT */
123
+ );
124
+ }),
125
+ 128
126
+ /* KEYED_FRAGMENT */
127
+ ))
128
+ ],
129
+ 512
130
+ /* NEED_PATCH */
131
+ )
132
+ ]),
133
+ key: "0"
134
+ } : void 0
135
+ ]), 1032, ["class", "disabled", "show"]);
136
+ }
137
+ const __sfc__ = defineComponent({
138
+ name,
139
+ components: {
140
+ VarMenu,
141
+ VarMenuOption
142
+ },
143
+ props: __spreadValues({
144
+ parentShow: Boolean,
145
+ disabled: Boolean,
146
+ option: {
147
+ type: Object,
148
+ required: true
149
+ },
150
+ highlightOptions: pickProps(menuSelectProps, "options"),
151
+ onKeyArrowX: defineListenerProp(),
152
+ onKeyArrowRightOpen: defineListenerProp(),
153
+ onMouseenter: defineListenerProp()
154
+ }, pickProps(menuSelectProps, ["options", "valueKey", "labelKey", "childrenKey"])),
155
+ setup(props) {
156
+ const show = ref(false);
157
+ const menu = ref();
158
+ const trigger = ref();
159
+ const menuOptions = ref();
160
+ const menuChildren = ref();
161
+ watch(
162
+ () => props.parentShow,
163
+ (value) => {
164
+ if (!value) {
165
+ show.value = false;
166
+ }
167
+ },
168
+ { immediate: true }
169
+ );
170
+ function handleArrowRight(key) {
171
+ return __async(this, null, function* () {
172
+ var _a;
173
+ call(props.onKeyArrowX, key);
174
+ if (key !== "ArrowRight") {
175
+ return;
176
+ }
177
+ call(props.onKeyArrowRightOpen);
178
+ (_a = menu.value) == null ? void 0 : _a.open();
179
+ yield raf();
180
+ focusChildElementByKey(menu.value.$el, menuOptions.value, "ArrowDown");
181
+ });
182
+ }
183
+ function handleArrowLeft(key) {
184
+ var _a;
185
+ if (key !== "ArrowLeft") {
186
+ return;
187
+ }
188
+ allowClose();
189
+ close();
190
+ (_a = trigger.value) == null ? void 0 : _a.$el.focus();
191
+ }
192
+ function close() {
193
+ var _a;
194
+ (_a = menu.value) == null ? void 0 : _a.close();
195
+ }
196
+ function allowClose() {
197
+ var _a;
198
+ (_a = menu.value) == null ? void 0 : _a.allowClose();
199
+ }
200
+ function allowChildrenClose(option) {
201
+ var _a;
202
+ (_a = menuChildren.value) == null ? void 0 : _a.forEach((child) => {
203
+ child.allowClose();
204
+ if (option == null) {
205
+ child.close();
206
+ return;
207
+ }
208
+ if (child.option.value === option.value) {
209
+ return;
210
+ }
211
+ child.close();
212
+ });
213
+ }
214
+ function handleMouseenter() {
215
+ call(props.onMouseenter);
216
+ }
217
+ return {
218
+ show,
219
+ menu,
220
+ trigger,
221
+ menuOptions,
222
+ menuChildren,
223
+ n,
224
+ close,
225
+ handleArrowLeft,
226
+ handleArrowRight,
227
+ handleMouseenter,
228
+ allowClose,
229
+ allowChildrenClose
230
+ };
231
+ }
232
+ });
233
+ __sfc__.render = __render__;
234
+ var stdin_default = __sfc__;
235
+ export {
236
+ stdin_default as default
237
+ };
@@ -1,5 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
20
  import VarMenu from "../menu/index.mjs";
2
21
  import VarMenuOption from "../menu-option/index.mjs";
22
+ import VarMenuChildren from "./MenuChildren.mjs";
3
23
  import { defineComponent, computed, ref } from "vue";
4
24
  import { props } from "./props.mjs";
5
25
  import { createNamespace, formatElevation } from "../utils/components.mjs";
@@ -9,8 +29,9 @@ import { call, preventDefault } from "@varlet/shared";
9
29
  import { useEventListener, useVModel } from "@varlet/use";
10
30
  import { focusChildElementByKey } from "../utils/elements.mjs";
11
31
  const { name, n, classes } = createNamespace("menu-select");
12
- import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, withCtx as _withCtx } from "vue";
32
+ import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, withCtx as _withCtx } from "vue";
13
33
  function __render__(_ctx, _cache) {
34
+ const _component_var_menu_children = _resolveComponent("var-menu-children");
14
35
  const _component_var_menu_option = _resolveComponent("var-menu-option");
15
36
  const _component_var_menu = _resolveComponent("var-menu");
16
37
  return _openBlock(), _createBlock(_component_var_menu, {
@@ -32,7 +53,7 @@ function __render__(_ctx, _cache) {
32
53
  "close-on-click-reference": _ctx.closeOnClickReference,
33
54
  "close-on-key-escape": false,
34
55
  show: _ctx.show,
35
- "onUpdate:show": _cache[0] || (_cache[0] = ($event) => _ctx.show = $event),
56
+ "onUpdate:show": _cache[1] || (_cache[1] = ($event) => _ctx.show = $event),
36
57
  onOpen: _ctx.onOpen,
37
58
  onOpened: _ctx.onOpened,
38
59
  onClose: _ctx.onClose,
@@ -47,22 +68,44 @@ function __render__(_ctx, _cache) {
47
68
  class: _normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.formatElevation(_ctx.elevation, 3), [_ctx.scrollable, _ctx.n("--scrollable")]))
48
69
  },
49
70
  [
50
- _ctx.options.length ? (_openBlock(true), _createElementBlock(
71
+ (_openBlock(true), _createElementBlock(
51
72
  _Fragment,
52
- { key: 0 },
73
+ null,
53
74
  _renderList(_ctx.options, (option) => {
54
- return _openBlock(), _createBlock(_component_var_menu_option, {
55
- key: option[_ctx.valueKey],
56
- label: option[_ctx.labelKey],
57
- value: option[_ctx.valueKey],
58
- option,
59
- ripple: option.ripple,
60
- disabled: option.disabled
61
- }, null, 8, ["label", "value", "option", "ripple", "disabled"]);
75
+ return _openBlock(), _createElementBlock(
76
+ _Fragment,
77
+ {
78
+ key: option[_ctx.valueKey]
79
+ },
80
+ [
81
+ option[_ctx.childrenKey] ? (_openBlock(), _createBlock(_component_var_menu_children, {
82
+ key: 0,
83
+ ref_for: true,
84
+ ref: "menuChildren",
85
+ "parent-show": _ctx.show,
86
+ option,
87
+ options: option[_ctx.childrenKey],
88
+ "highlight-options": _ctx.highlightOptions,
89
+ disabled: option.disabled,
90
+ onKeyArrowRightOpen: ($event) => _ctx.allowChildrenClose(option),
91
+ onMouseenter: ($event) => _ctx.allowChildrenClose(option)
92
+ }, null, 8, ["parent-show", "option", "options", "highlight-options", "disabled", "onKeyArrowRightOpen", "onMouseenter"])) : (_openBlock(), _createBlock(_component_var_menu_option, {
93
+ key: 1,
94
+ label: option[_ctx.labelKey],
95
+ value: option[_ctx.valueKey],
96
+ option,
97
+ ripple: option.ripple,
98
+ disabled: option.disabled,
99
+ onMouseenter: _cache[0] || (_cache[0] = ($event) => _ctx.allowChildrenClose())
100
+ }, null, 8, ["label", "value", "option", "ripple", "disabled"]))
101
+ ],
102
+ 64
103
+ /* STABLE_FRAGMENT */
104
+ );
62
105
  }),
63
106
  128
64
107
  /* KEYED_FRAGMENT */
65
- )) : _createCommentVNode("v-if", true),
108
+ )),
66
109
  _renderSlot(_ctx.$slots, "options")
67
110
  ],
68
111
  2
@@ -78,18 +121,44 @@ function __render__(_ctx, _cache) {
78
121
  }
79
122
  const __sfc__ = defineComponent({
80
123
  name,
81
- components: { VarMenu, VarMenuOption },
124
+ components: { VarMenu, VarMenuOption, VarMenuChildren },
82
125
  props,
83
126
  setup(props2) {
84
- const menu = ref(null);
85
- const menuOptionsRef = ref(null);
86
127
  const show = useVModel(props2, "show");
128
+ const menu = ref();
129
+ const menuOptionsRef = ref();
130
+ const menuChildren = ref();
131
+ const enhancedOptions = computed(() => enhance(props2.options));
87
132
  const { menuOptions, length, bindMenuOptions } = useMenuOptions();
88
- const { computeLabel, getSelectedValue } = useSelectController({
133
+ const { computeLabel, getSelectedValue, getOptionProviderKey } = useSelectController({
89
134
  modelValue: () => props2.modelValue,
90
135
  multiple: () => props2.multiple,
91
136
  optionProviders: () => menuOptions,
92
- optionProvidersLength: () => length.value
137
+ optionProvidersLength: () => length.value,
138
+ optionIsIndeterminate(optionProvider) {
139
+ var _a;
140
+ const enhancedOption = getEnhancedOption(optionProvider.value.value);
141
+ if (!enhancedOption) {
142
+ return false;
143
+ }
144
+ const children = ((_a = enhancedOption._children) != null ? _a : []).filter((option) => !option.disabled);
145
+ const selectedChildren = children.filter((option) => props2.modelValue.includes(option.value));
146
+ return selectedChildren.length > 0 && selectedChildren.length < children.length;
147
+ }
148
+ });
149
+ const highlightOptions = computed(() => {
150
+ const { multiple, modelValue } = props2;
151
+ if (multiple) {
152
+ return [];
153
+ }
154
+ const selectedOption = enhancedOptions.value.find((option) => option.value === modelValue);
155
+ const highlightOptions2 = [];
156
+ let parent = selectedOption == null ? void 0 : selectedOption._parent;
157
+ while (parent) {
158
+ highlightOptions2.push(parent);
159
+ parent = parent._parent;
160
+ }
161
+ return highlightOptions2;
93
162
  });
94
163
  const menuSelectProvider = {
95
164
  size: computed(() => props2.size),
@@ -99,14 +168,108 @@ const __sfc__ = defineComponent({
99
168
  };
100
169
  bindMenuOptions(menuSelectProvider);
101
170
  useEventListener(() => window, "keydown", handleKeydown);
102
- function onSelect(option) {
171
+ function getEnhancedOption(value) {
172
+ return enhancedOptions.value.find((option) => option.value === value);
173
+ }
174
+ function getOptionProvider(value) {
175
+ return menuOptions.find((optionProvider) => optionProvider.value.value === value);
176
+ }
177
+ function getOptionChildren(option) {
178
+ return option[props2.childrenKey];
179
+ }
180
+ function flatten(options) {
181
+ const flattenOptions = [];
182
+ baseFlatten(options);
183
+ function baseFlatten(options2) {
184
+ options2.forEach((option) => {
185
+ flattenOptions.push(option);
186
+ const children = getOptionChildren(option);
187
+ if (children) {
188
+ baseFlatten(children);
189
+ }
190
+ });
191
+ }
192
+ return flattenOptions;
193
+ }
194
+ function enhance(options) {
195
+ function baseEnhance(options2, parent) {
196
+ return options2.map((option) => {
197
+ option = __spreadProps(__spreadValues({}, option), { _rawOption: option });
198
+ if (parent) {
199
+ option._parent = parent;
200
+ }
201
+ const children = getOptionChildren(option);
202
+ if (children) {
203
+ const enhancedChildren = baseEnhance(children, option);
204
+ option[props2.childrenKey] = enhancedChildren;
205
+ option._children = flatten(enhancedChildren);
206
+ }
207
+ return option;
208
+ });
209
+ }
210
+ return flatten(baseEnhance(options));
211
+ }
212
+ function onSelect(optionProvider) {
213
+ var _a, _b;
103
214
  const { multiple, closeOnSelect } = props2;
104
- call(props2["onUpdate:modelValue"], getSelectedValue(option));
215
+ const { value, label, selected, disabled, ripple } = optionProvider;
216
+ const enhancedOption = getEnhancedOption(value.value);
217
+ if (enhancedOption) {
218
+ const childrenValues = ((_a = enhancedOption._children) != null ? _a : []).filter((option) => !option.disabled).map((option) => option.value);
219
+ if (multiple && selected.value) {
220
+ menuOptions.forEach((optionProvider2) => {
221
+ if (childrenValues.includes(optionProvider2.value.value)) {
222
+ optionProvider2.sync(true, false);
223
+ }
224
+ });
225
+ broadcastParentOption(enhancedOption);
226
+ }
227
+ if (multiple && !selected.value) {
228
+ menuOptions.forEach((optionProvider2) => {
229
+ if (childrenValues.includes(optionProvider2.value.value)) {
230
+ optionProvider2.sync(false, false);
231
+ }
232
+ });
233
+ broadcastParentOption(enhancedOption);
234
+ }
235
+ }
236
+ const selectedValue = getSelectedValue(optionProvider);
237
+ const selectedOption = (_b = enhancedOption == null ? void 0 : enhancedOption._rawOption) != null ? _b : {
238
+ value: value.value,
239
+ label: label.value,
240
+ disabled: disabled.value,
241
+ ripple: ripple.value
242
+ };
243
+ call(props2.onSelect, getOptionProviderKey(optionProvider), selectedOption);
244
+ call(props2["onUpdate:modelValue"], selectedValue);
105
245
  if (!multiple && closeOnSelect) {
106
246
  menu.value.$el.focus();
107
247
  close();
108
248
  }
109
249
  }
250
+ function broadcastParentOption(enhancedOption) {
251
+ let parentOption = enhancedOption._parent;
252
+ while (parentOption) {
253
+ const parentOptionProvider = getOptionProvider(parentOption.value);
254
+ const parentOptionChildren = getOptionChildren(parentOption).filter((option) => !option.disabled);
255
+ const isAllChildrenUnselected = parentOptionChildren.every((option) => {
256
+ const optionProvider = getOptionProvider(option.value);
257
+ return !optionProvider.selected.value;
258
+ });
259
+ const isAllChildrenSelected = parentOptionChildren.every((option) => {
260
+ const optionProvider = getOptionProvider(option.value);
261
+ return optionProvider.selected.value;
262
+ });
263
+ if (isAllChildrenUnselected) {
264
+ parentOptionProvider.sync(false, false);
265
+ } else if (isAllChildrenSelected) {
266
+ parentOptionProvider.sync(true, false);
267
+ } else {
268
+ parentOptionProvider.sync(false, true);
269
+ }
270
+ parentOption = parentOption._parent;
271
+ }
272
+ }
110
273
  function handleKeydown(event) {
111
274
  if (props2.disabled || !show.value) {
112
275
  return;
@@ -125,6 +288,20 @@ const __sfc__ = defineComponent({
125
288
  focusChildElementByKey(menu.value.$el, menuOptionsRef.value, key);
126
289
  }
127
290
  }
291
+ function allowChildrenClose(option) {
292
+ var _a;
293
+ (_a = menuChildren.value) == null ? void 0 : _a.forEach((child) => {
294
+ child.allowClose();
295
+ if (option == null) {
296
+ child.close();
297
+ return;
298
+ }
299
+ if (child.option.value === option.value) {
300
+ return;
301
+ }
302
+ child.close();
303
+ });
304
+ }
128
305
  function open() {
129
306
  var _a;
130
307
  (_a = menu.value) == null ? void 0 : _a.open();
@@ -145,8 +322,11 @@ const __sfc__ = defineComponent({
145
322
  show,
146
323
  menu,
147
324
  menuOptionsRef,
325
+ menuChildren,
326
+ highlightOptions,
148
327
  n,
149
328
  classes,
329
+ allowChildrenClose,
150
330
  formatElevation,
151
331
  open,
152
332
  close,
@@ -1 +1 @@
1
- :root { --menu-select-menu-max-height: 278px; --menu-select-menu-padding: 0; --menu-select-menu-border-radius: 2px; --menu-select-menu-background-color: var(--color-surface-container-high);}.var-menu-select__menu { padding: var(--menu-select-menu-padding); border-radius: var(--menu-select-menu-border-radius); background-color: var(--menu-select-menu-background-color);}.var-menu-select--scrollable { overflow-y: auto; max-height: var(--menu-select-menu-max-height);}
1
+ :root { --menu-select-menu-max-height: 278px; --menu-select-menu-padding: 0; --menu-select-menu-border-radius: 2px; --menu-select-menu-background-color: var(--color-surface-container-high);}.var-menu-select__menu { padding: var(--menu-select-menu-padding); border-radius: var(--menu-select-menu-border-radius); background-color: var(--menu-select-menu-background-color);}.var-menu-select--scrollable { overflow-y: auto; max-height: var(--menu-select-menu-max-height);}.var-menu-children[var-menu-children-cover] { width: 100%; display: block;}
@@ -36,6 +36,10 @@ const props = __spreadProps(__spreadValues({
36
36
  type: String,
37
37
  default: "value"
38
38
  },
39
+ childrenKey: {
40
+ type: String,
41
+ default: "children"
42
+ },
39
43
  size: {
40
44
  type: String,
41
45
  default: "normal"
@@ -46,7 +50,8 @@ const props = __spreadProps(__spreadValues({
46
50
  type: Boolean,
47
51
  default: true
48
52
  },
49
- "onUpdate:modelValue": defineListenerProp()
53
+ "onUpdate:modelValue": defineListenerProp(),
54
+ onSelect: defineListenerProp()
50
55
  }, pickProps(menuProps, [
51
56
  "show",
52
57
  "disabled",
@@ -69,7 +69,7 @@ function __render__(_ctx, _cache) {
69
69
  focusing: _ctx.isFocusing && !_ctx.disabled
70
70
  }, null, 8, ["hovering", "focusing"])
71
71
  ], 46, _hoisted_1)), [
72
- [_directive_ripple, { disabled: _ctx.disabled }],
72
+ [_directive_ripple, { disabled: _ctx.disabled || !_ctx.ripple }],
73
73
  [_directive_hover, _ctx.handleHovering, "desktop"]
74
74
  ]);
75
75
  }
@@ -87,6 +87,12 @@ const __sfc__ = defineComponent({
87
87
  const isFocusing = ref(false);
88
88
  const optionSelected = ref(false);
89
89
  const selected = computed(() => optionSelected.value);
90
+ const value = computed(() => props2.value);
91
+ const disabled = computed(() => props2.disabled);
92
+ const ripple = computed(() => props2.ripple);
93
+ const { select, bindSelect } = useSelect();
94
+ const { multiple, focusColor, onSelect, computeLabel } = select;
95
+ const { hovering, handleHovering } = useHoverOverlay();
90
96
  const labelVNode = computed(
91
97
  () => {
92
98
  var _a;
@@ -100,13 +106,11 @@ const __sfc__ = defineComponent({
100
106
  ) : props2.label;
101
107
  }
102
108
  );
103
- const value = computed(() => props2.value);
104
- const { select, bindSelect } = useSelect();
105
- const { multiple, focusColor, onSelect, computeLabel } = select;
106
- const { hovering, handleHovering } = useHoverOverlay();
107
109
  const optionProvider = {
108
110
  label: labelVNode,
109
111
  value,
112
+ disabled,
113
+ ripple,
110
114
  selected,
111
115
  sync
112
116
  };
@@ -2,6 +2,10 @@ const props = {
2
2
  label: {},
3
3
  value: {},
4
4
  disabled: Boolean,
5
+ ripple: {
6
+ type: Boolean,
7
+ default: true
8
+ },
5
9
  // internal
6
10
  option: Object
7
11
  };
@@ -49,14 +49,14 @@ function __render__(_ctx, _cache) {
49
49
  }, [
50
50
  _ctx.checked ? _renderSlot(_ctx.$slots, "checked-icon", { key: 0 }, () => [
51
51
  _createVNode(_component_var_icon, {
52
- class: _normalizeClass(_ctx.classes(_ctx.n("icon"), [_ctx.withAnimation, _ctx.n("--with-animation")])),
52
+ class: _normalizeClass(_ctx.n("icon")),
53
53
  "var-radio-cover": "",
54
54
  name: "radio-marked",
55
55
  size: _ctx.iconSize
56
56
  }, null, 8, ["class", "size"])
57
57
  ]) : _renderSlot(_ctx.$slots, "unchecked-icon", { key: 1 }, () => [
58
58
  _createVNode(_component_var_icon, {
59
- class: _normalizeClass(_ctx.classes(_ctx.n("icon"), [_ctx.withAnimation, _ctx.n("--with-animation")])),
59
+ class: _normalizeClass(_ctx.n("icon")),
60
60
  "var-radio-cover": "",
61
61
  name: "radio-blank",
62
62
  size: _ctx.iconSize
@@ -114,7 +114,6 @@ const __sfc__ = defineComponent({
114
114
  const isFocusing = ref(false);
115
115
  const value = useVModel(props2, "modelValue");
116
116
  const checked = computed(() => value.value === props2.checkedValue);
117
- const withAnimation = ref(false);
118
117
  const { radioGroup, bindRadioGroup } = useRadioGroup();
119
118
  const { hovering, handleHovering } = useHoverOverlay();
120
119
  const { form, bindForm } = useForm();
@@ -190,7 +189,6 @@ const __sfc__ = defineComponent({
190
189
  if ((form == null ? void 0 : form.readonly.value) || readonly) {
191
190
  return;
192
191
  }
193
- withAnimation.value = true;
194
192
  change(checked.value ? uncheckedValue : checkedValue);
195
193
  }
196
194
  function handleTextClick() {
@@ -218,7 +216,6 @@ const __sfc__ = defineComponent({
218
216
  return {
219
217
  action,
220
218
  isFocusing,
221
- withAnimation,
222
219
  checked,
223
220
  errorMessage,
224
221
  radioGroupErrorMessage: radioGroup == null ? void 0 : radioGroup.errorMessage,
@@ -1 +1 @@
1
- :root { --radio-checked-color: var(--color-primary); --radio-unchecked-color: #555; --radio-disabled-color: var(--color-text-disabled); --radio-error-color: var(--color-danger); --radio-icon-size: 24px; --radio-action-padding: 6px; --radio-text-color: #555;}@keyframes var-vibrate-animation { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); }}.var-radio { display: flex; align-items: center; transform: translateX(calc(-1 * var(--radio-action-padding))); cursor: pointer; -webkit-tap-highlight-color: transparent;}.var-radio__wrap { display: inline-flex; flex-direction: column;}.var-radio__action { position: relative; display: flex; justify-content: center; align-items: center; flex-shrink: 0; padding: var(--radio-action-padding); border-radius: 50%; outline: none; transition: background-color 0.25s, color 0.25s;}.var-radio__icon[var-radio-cover] { display: block; font-size: var(--radio-icon-size);}.var-radio__text { color: var(--radio-text-color);}.var-radio--with-animation[var-radio-cover] { animation: var-vibrate-animation 0.25s;}.var-radio--checked { color: var(--radio-checked-color);}.var-radio--unchecked { color: var(--radio-unchecked-color);}.var-radio--disabled { color: var(--radio-disabled-color); cursor: not-allowed;}.var-radio--error { color: var(--radio-error-color);}
1
+ :root { --radio-checked-color: var(--color-primary); --radio-unchecked-color: #555; --radio-disabled-color: var(--color-text-disabled); --radio-error-color: var(--color-danger); --radio-icon-size: 24px; --radio-action-padding: 6px; --radio-text-color: #555;}.var-radio { display: flex; align-items: center; transform: translateX(calc(-1 * var(--radio-action-padding))); cursor: pointer; -webkit-tap-highlight-color: transparent;}.var-radio__wrap { display: inline-flex; flex-direction: column;}.var-radio__action { position: relative; display: flex; justify-content: center; align-items: center; flex-shrink: 0; padding: var(--radio-action-padding); border-radius: 50%; outline: none; transition: background-color 0.25s, color 0.25s;}.var-radio__icon[var-radio-cover] { display: block; font-size: var(--radio-icon-size);}.var-radio__text { color: var(--radio-text-color);}.var-radio--checked { color: var(--radio-checked-color);}.var-radio--unchecked { color: var(--radio-unchecked-color);}.var-radio--disabled { color: var(--radio-disabled-color); cursor: not-allowed;}.var-radio--error { color: var(--radio-error-color);}
@@ -63,8 +63,9 @@ function __render__(_ctx, _cache) {
63
63
  label: option[_ctx.labelKey],
64
64
  value: option[_ctx.valueKey],
65
65
  option,
66
- disabled: option.disabled
67
- }, null, 8, ["label", "value", "option", "disabled"]);
66
+ disabled: option.disabled,
67
+ ripple: option.ripple
68
+ }, null, 8, ["label", "value", "option", "disabled", "ripple"]);
68
69
  }),
69
70
  128
70
71
  /* KEYED_FRAGMENT */