@rio-m3e/vue 0.6.3 → 0.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.
- package/README.md +99 -4
- package/dist/app-bar/AppBar.vue.d.ts +42 -0
- package/dist/app-bar/AppBar.vue.js +93 -0
- package/dist/app-bar/context.js +3 -0
- package/dist/badge/Badge.vue.d.ts +15 -0
- package/dist/badge/Badge.vue.js +28 -0
- package/dist/bottom-sheet/BottomSheet.vue.d.ts +34 -0
- package/dist/bottom-sheet/BottomSheet.vue.js +82 -0
- package/dist/browser/rio-vue.css +9418 -0
- package/dist/browser/rio-vue.global.js +600 -0
- package/dist/browser/rio-vue.js +600 -0
- package/dist/button/Button.vue.d.ts +1 -0
- package/dist/button/Button.vue.js +23 -2
- package/dist/button-group/ButtonGroup.vue.d.ts +6 -1
- package/dist/button-group/ButtonGroup.vue.js +27 -4
- package/dist/button-group/context.js +4 -2
- package/dist/card/Card.vue.d.ts +24 -0
- package/dist/card/Card.vue.js +44 -0
- package/dist/card/CardActions.vue.d.ts +14 -0
- package/dist/card/CardActions.vue.js +14 -0
- package/dist/card/CardContent.vue.d.ts +14 -0
- package/dist/card/CardContent.vue.js +14 -0
- package/dist/card/CardHeader.vue.d.ts +27 -0
- package/dist/card/CardHeader.vue.js +34 -0
- package/dist/card/CardMedia.vue.d.ts +14 -0
- package/dist/card/CardMedia.vue.js +14 -0
- package/dist/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/checkbox/Checkbox.vue.js +6 -0
- package/dist/chip/AssistChip.vue.d.ts +2 -0
- package/dist/chip/AssistChip.vue.js +6 -0
- package/dist/chip/ChipSet.vue.d.ts +2 -0
- package/dist/chip/ChipSet.vue.js +7 -1
- package/dist/chip/FilterChip.vue.d.ts +22 -5
- package/dist/chip/FilterChip.vue.js +57 -8
- package/dist/chip/InputChip.vue.d.ts +2 -0
- package/dist/chip/InputChip.vue.js +6 -0
- package/dist/chip/SuggestionChip.vue.d.ts +2 -0
- package/dist/chip/SuggestionChip.vue.js +6 -0
- package/dist/date-picker/DatePicker.vue.d.ts +16 -3
- package/dist/date-picker/DatePicker.vue.js +13 -4
- package/dist/date-picker/DatePickerCalendar.vue.js +1 -4
- package/dist/date-picker/DatePickerDialog.vue.d.ts +17 -3
- package/dist/date-picker/DatePickerDialog.vue.js +66 -22
- package/dist/date-picker/DateRangeCalendar.vue.js +17 -8
- package/dist/date-picker/DateRangePickerDialog.vue.d.ts +17 -3
- package/dist/date-picker/DateRangePickerDialog.vue.js +29 -16
- package/dist/dialog/Dialog.vue.d.ts +11 -2
- package/dist/dialog/Dialog.vue.js +35 -5
- package/dist/divider/Divider.vue.d.ts +5 -0
- package/dist/divider/Divider.vue.js +21 -0
- package/dist/fab/Fab.vue.d.ts +27 -0
- package/dist/fab/Fab.vue.js +70 -0
- package/dist/fab-menu/FabMenu.vue.d.ts +34 -0
- package/dist/fab-menu/FabMenu.vue.js +76 -0
- package/dist/fab-menu/FabMenuItem.vue.d.ts +22 -0
- package/dist/fab-menu/FabMenuItem.vue.js +29 -0
- package/dist/fab-menu/context.js +4 -0
- package/dist/icon-button/IconButton.vue.d.ts +2 -0
- package/dist/icon-button/IconButton.vue.js +26 -2
- package/dist/ime/composing.js +24 -0
- package/dist/index.d.ts +70 -40
- package/dist/index.js +70 -40
- package/dist/list/List.vue.d.ts +1 -0
- package/dist/list/List.vue.js +4 -1
- package/dist/list/ListItem.vue.d.ts +13 -1
- package/dist/list/ListItem.vue.js +15 -3
- package/dist/loading-indicator/LoadingIndicator.vue.d.ts +1 -0
- package/dist/loading-indicator/LoadingIndicator.vue.js +4 -1
- package/dist/menu/Menu.vue.d.ts +2 -2
- package/dist/menu/Menu.vue.js +11 -2
- package/dist/navigation-bar/NavigationBar.vue.d.ts +31 -0
- package/dist/navigation-bar/NavigationBar.vue.js +63 -0
- package/dist/navigation-bar/NavigationBarItem.vue.d.ts +40 -0
- package/dist/navigation-bar/NavigationBarItem.vue.js +84 -0
- package/dist/navigation-bar/context.js +3 -0
- package/dist/navigation-rail/NavigationRail.vue.d.ts +46 -0
- package/dist/navigation-rail/NavigationRail.vue.js +112 -0
- package/dist/navigation-rail/NavigationRailItem.vue.d.ts +41 -0
- package/dist/navigation-rail/NavigationRailItem.vue.js +85 -0
- package/dist/navigation-rail/NavigationRailSection.vue.d.ts +17 -0
- package/dist/navigation-rail/NavigationRailSection.vue.js +20 -0
- package/dist/navigation-rail/context.js +3 -0
- package/dist/overflow/OverflowItem.vue.d.ts +16 -0
- package/dist/overflow/OverflowItem.vue.js +24 -0
- package/dist/overflow/OverflowMenu.vue.js +94 -0
- package/dist/overflow/overflow.js +79 -0
- package/dist/progress/CircularProgress.vue.d.ts +1 -0
- package/dist/progress/CircularProgress.vue.js +5 -2
- package/dist/progress/LinearProgress.vue.d.ts +1 -0
- package/dist/progress/LinearProgress.vue.js +5 -2
- package/dist/radio/Radio.vue.d.ts +2 -0
- package/dist/radio/Radio.vue.js +7 -1
- package/dist/radio/RadioGroup.vue.d.ts +2 -0
- package/dist/radio/RadioGroup.vue.js +13 -2
- package/dist/rio/rio.js +2 -0
- package/dist/scroll-field/ScrollField.vue.d.ts +1 -0
- package/dist/scroll-field/ScrollField.vue.js +3 -0
- package/dist/search/Search.vue.d.ts +58 -0
- package/dist/search/Search.vue.js +161 -0
- package/dist/select/AfterOptions.vue.js +11 -0
- package/dist/select/Select.vue.d.ts +6 -4
- package/dist/select/Select.vue.js +44 -31
- package/dist/select/SelectOption.vue.d.ts +4 -1
- package/dist/select/SelectOption.vue.js +8 -5
- package/dist/side-sheet/SideSheet.vue.d.ts +43 -0
- package/dist/side-sheet/SideSheet.vue.js +103 -0
- package/dist/slider/RangeSlider.vue.d.ts +1 -0
- package/dist/slider/RangeSlider.vue.js +3 -0
- package/dist/slider/Slider.vue.d.ts +1 -0
- package/dist/slider/Slider.vue.js +3 -0
- package/dist/snackbar/Snackbar.vue.d.ts +31 -0
- package/dist/snackbar/Snackbar.vue.js +48 -0
- package/dist/snackbar/SnackbarHost.vue.d.ts +40 -0
- package/dist/snackbar/SnackbarHost.vue.js +110 -0
- package/dist/snackbar/snackbar.d.ts +16 -0
- package/dist/snackbar/snackbar.js +11 -0
- package/dist/split-button/SplitButton.vue.d.ts +3 -2
- package/dist/split-button/SplitButton.vue.js +3 -0
- package/dist/switch/Switch.vue.d.ts +2 -0
- package/dist/switch/Switch.vue.js +6 -0
- package/dist/tabs/Tab.vue.d.ts +26 -0
- package/dist/tabs/Tab.vue.js +91 -0
- package/dist/tabs/TabGroup.vue.d.ts +22 -0
- package/dist/tabs/TabGroup.vue.js +25 -0
- package/dist/tabs/TabPanel.vue.d.ts +15 -0
- package/dist/tabs/TabPanel.vue.js +20 -0
- package/dist/tabs/Tabs.vue.d.ts +34 -0
- package/dist/tabs/Tabs.vue.js +109 -0
- package/dist/tabs/context.js +5 -0
- package/dist/text-field/TextField.vue.d.ts +9 -2
- package/dist/text-field/TextField.vue.js +94 -47
- package/dist/theme/ThemeProvider.vue.d.ts +22 -0
- package/dist/theme/ThemeProvider.vue.js +26 -0
- package/dist/theme/context.d.ts +7 -0
- package/dist/theme/context.js +7 -0
- package/dist/time-picker/TimeInput.vue.d.ts +7 -1
- package/dist/time-picker/TimeInput.vue.js +5 -2
- package/dist/time-picker/TimePickerDialog.vue.d.ts +9 -3
- package/dist/time-picker/TimePickerDialog.vue.js +5 -2
- package/dist/time-picker/TimeScroll.vue.d.ts +7 -1
- package/dist/time-picker/TimeScroll.vue.js +5 -2
- package/dist/toolbar/FabPlace.vue.js +14 -0
- package/dist/toolbar/Toolbar.vue.d.ts +34 -0
- package/dist/toolbar/Toolbar.vue.js +115 -0
- package/dist/toolbar/context.js +3 -0
- package/dist/tooltip/Tooltip.vue.js +10 -3
- package/package.json +6 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _sfc_main$1 from "../badge/Badge.vue.js";
|
|
2
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
3
|
+
import { useRipple } from "../ripple/ripple.js";
|
|
4
|
+
import { navigationBarKey } from "./context.js";
|
|
5
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, useAttrs, useSlots, useTemplateRef, withCtx } from "vue";
|
|
6
|
+
import { createNavigationBarItem } from "@rio-m3e/core";
|
|
7
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
8
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
9
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
10
|
+
import "@rio-m3e/styles/navigation-bar.css";
|
|
11
|
+
// src/navigation-bar/NavigationBarItem.vue
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
__name: "NavigationBarItem",
|
|
15
|
+
props: {
|
|
16
|
+
value: {},
|
|
17
|
+
label: {},
|
|
18
|
+
href: {},
|
|
19
|
+
badge: { type: [
|
|
20
|
+
Boolean,
|
|
21
|
+
Number,
|
|
22
|
+
String
|
|
23
|
+
] },
|
|
24
|
+
color: {},
|
|
25
|
+
onClick: { type: Function }
|
|
26
|
+
},
|
|
27
|
+
setup(__props) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
const slots = useSlots();
|
|
30
|
+
const attrs = useAttrs();
|
|
31
|
+
const rest = computed(() => {
|
|
32
|
+
const { class: _class, style: _style, ...others } = attrs;
|
|
33
|
+
return others;
|
|
34
|
+
});
|
|
35
|
+
const bar = inject(navigationBarKey, void 0);
|
|
36
|
+
const locale = bar?.locale ?? useLocale(() => void 0);
|
|
37
|
+
const messages = bar?.messages ?? useMessages("navigationBar", locale, () => void 0);
|
|
38
|
+
const item = createNavigationBarItem({
|
|
39
|
+
props: () => ({
|
|
40
|
+
value: props.value,
|
|
41
|
+
label: props.label,
|
|
42
|
+
href: props.href,
|
|
43
|
+
badge: props.badge,
|
|
44
|
+
locale: locale.value,
|
|
45
|
+
color: props.color
|
|
46
|
+
}),
|
|
47
|
+
bar: () => bar ?? {
|
|
48
|
+
isActive: () => false,
|
|
49
|
+
choose: () => {}
|
|
50
|
+
},
|
|
51
|
+
content: () => ({ activeIcon: !!slots["active-icon"] }),
|
|
52
|
+
messages: () => messages.value
|
|
53
|
+
});
|
|
54
|
+
const onClick = (event) => {
|
|
55
|
+
if (item.handleClick(event)) props.onClick?.(event);
|
|
56
|
+
};
|
|
57
|
+
useRipple(useTemplateRef("action"), useTemplateRef("state"));
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return openBlock(), createElementBlock("li", mergeProps(unref(item).parts.root(), {
|
|
60
|
+
class: unref(attrs).class,
|
|
61
|
+
style: unref(attrs).style
|
|
62
|
+
}), [(openBlock(), createBlock(resolveDynamicComponent(unref(item).isLink() ? "a" : "button"), mergeProps({ ref: "action" }, {
|
|
63
|
+
...unref(item).parts.action(),
|
|
64
|
+
...rest.value
|
|
65
|
+
}, { onClick }), {
|
|
66
|
+
default: withCtx(() => [createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.content())), [
|
|
67
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.indicator())), null, 16),
|
|
68
|
+
createElementVNode("span", mergeProps({ ref: "state" }, unref(item).parts.state()), null, 16),
|
|
69
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.icon())), [unref(item).showsBadge() ? (openBlock(), createBlock(_sfc_main$1, {
|
|
70
|
+
key: 0,
|
|
71
|
+
value: unref(item).badgeValue(),
|
|
72
|
+
locale: unref(locale)
|
|
73
|
+
}, {
|
|
74
|
+
default: withCtx(() => [unref(item).showsActiveIcon() ? renderSlot(_ctx.$slots, "active-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)]),
|
|
75
|
+
_: 3
|
|
76
|
+
}, 8, ["value", "locale"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(item).showsActiveIcon() ? renderSlot(_ctx.$slots, "active-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 64))], 16),
|
|
77
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.label())), toDisplayString(__props.label), 17)
|
|
78
|
+
], 16)]),
|
|
79
|
+
_: 3
|
|
80
|
+
}, 16))], 16);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NavigationRailMessages, NavigationRailProps, NavigationRailValue } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
3
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
4
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
5
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
6
|
+
interface Props extends Omit<NavigationRailProps, 'active' | 'expanded'> {
|
|
7
|
+
/** The value of the active destination's item, with `v-model`. */
|
|
8
|
+
modelValue?: NavigationRailValue;
|
|
9
|
+
/** A language tag, for the menu button's name and badges' counts. Without it, the one provided, or the page's. */
|
|
10
|
+
locale?: string;
|
|
11
|
+
/** Replaces the menu button's name, the modal's, and what a small badge says. */
|
|
12
|
+
messages?: Partial<NavigationRailMessages>;
|
|
13
|
+
}
|
|
14
|
+
type __VLS_Props = Props;
|
|
15
|
+
type __VLS_Slots = {
|
|
16
|
+
/** The destinations (`RioNavigationRailItem`) and sections (`RioNavigationRailSection`) */
|
|
17
|
+
default?: () => unknown;
|
|
18
|
+
/** A FAB above the destinations: bind `expanded` to its `extended`, so it extends with the rail. */
|
|
19
|
+
fab?: (props: {
|
|
20
|
+
expanded: boolean;
|
|
21
|
+
}) => unknown;
|
|
22
|
+
/** The menu button's icon while the rail is collapsed, in place of the one the app registered (`expand-rail`) */
|
|
23
|
+
'expand-icon'?: () => unknown;
|
|
24
|
+
/** The menu button's icon while the rail is expanded, in place of the one the app registered (`collapse-rail`) */
|
|
25
|
+
'collapse-icon'?: () => unknown;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_ModelProps = {
|
|
28
|
+
/** Whether the rail is expanded, with `v-model:expanded`. */
|
|
29
|
+
'expanded'?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
32
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
"update:modelValue": (value: NavigationRailValue) => any;
|
|
34
|
+
"update:expanded": (value: boolean) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
36
|
+
"onUpdate:modelValue"?: ((value: NavigationRailValue) => any) | undefined;
|
|
37
|
+
"onUpdate:expanded"?: ((value: boolean) => any) | undefined;
|
|
38
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export { _default as default };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon-button/IconButton.vue.js";
|
|
2
|
+
import _sfc_main$2 from "../icon/Icon.vue.js";
|
|
3
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
4
|
+
import { keepPresses } from "../overlay/presses.js";
|
|
5
|
+
import { navigationRailKey } from "./context.js";
|
|
6
|
+
import { Teleport, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, openBlock, provide, ref, renderSlot, toHandlers, unref, useModel, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
7
|
+
import { attachNavigationRail, createNavigationRail } from "@rio-m3e/core";
|
|
8
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
9
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
10
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
11
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
12
|
+
// src/navigation-rail/NavigationRail.vue
|
|
13
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
14
|
+
__name: "NavigationRail",
|
|
15
|
+
props: /*@__PURE__*/ mergeModels({
|
|
16
|
+
modelValue: {},
|
|
17
|
+
locale: {},
|
|
18
|
+
messages: {},
|
|
19
|
+
modal: { type: Boolean },
|
|
20
|
+
hideWhenCollapsed: { type: Boolean },
|
|
21
|
+
align: {},
|
|
22
|
+
menu: { type: Boolean },
|
|
23
|
+
label: {},
|
|
24
|
+
color: {}
|
|
25
|
+
}, {
|
|
26
|
+
"expanded": {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
"expandedModifiers": {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /*@__PURE__*/ mergeModels(["update:modelValue"], ["update:expanded"]),
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
/** Whether the rail is expanded, with `v-model:expanded`. */
|
|
35
|
+
const expanded = useModel(__props, "expanded");
|
|
36
|
+
const emit = __emit;
|
|
37
|
+
const slots = useSlots();
|
|
38
|
+
const resolvedLocale = useLocale(() => __props.locale);
|
|
39
|
+
const text = useMessages("navigationRail", resolvedLocale, () => __props.messages);
|
|
40
|
+
/** Whether the modal still shows: from expanding until its closing motion ends */
|
|
41
|
+
const modalShown = ref(false);
|
|
42
|
+
const rail = createNavigationRail({
|
|
43
|
+
props: () => ({
|
|
44
|
+
active: __props.modelValue,
|
|
45
|
+
expanded: expanded.value,
|
|
46
|
+
modal: __props.modal,
|
|
47
|
+
hideWhenCollapsed: __props.hideWhenCollapsed,
|
|
48
|
+
align: __props.align,
|
|
49
|
+
menu: __props.menu,
|
|
50
|
+
label: __props.label,
|
|
51
|
+
color: __props.color
|
|
52
|
+
}),
|
|
53
|
+
content: () => ({ fab: !!slots.fab }),
|
|
54
|
+
modalShown: () => modalShown.value,
|
|
55
|
+
messages: () => text.value,
|
|
56
|
+
onChange: (value) => emit("update:modelValue", value),
|
|
57
|
+
onExpandedChange: (next) => expanded.value = next
|
|
58
|
+
});
|
|
59
|
+
watch(rail.modalOpen, (open) => {
|
|
60
|
+
if (open) modalShown.value = true;
|
|
61
|
+
});
|
|
62
|
+
provide(navigationRailKey, {
|
|
63
|
+
isActive: rail.isActive,
|
|
64
|
+
choose: rail.choose,
|
|
65
|
+
locale: resolvedLocale,
|
|
66
|
+
messages: text
|
|
67
|
+
});
|
|
68
|
+
const root = useTemplateRef("root");
|
|
69
|
+
const modalElement = useTemplateRef("modal");
|
|
70
|
+
let handle;
|
|
71
|
+
onMounted(async () => {
|
|
72
|
+
handle = attachNavigationRail(root.value, {
|
|
73
|
+
onExpandedChange: (next) => expanded.value = next,
|
|
74
|
+
onModalClosed: () => {
|
|
75
|
+
if (!rail.modalOpen()) modalShown.value = false;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
await nextTick();
|
|
79
|
+
handle?.sync(rail.modalOpen());
|
|
80
|
+
});
|
|
81
|
+
watch(rail.modalOpen, (open) => handle?.sync(open), { flush: "post" });
|
|
82
|
+
onBeforeUpdate(() => handle?.capture(rail.parts.panel()["data-expanded"] !== void 0));
|
|
83
|
+
onUpdated(() => handle?.update());
|
|
84
|
+
onBeforeUnmount(() => {
|
|
85
|
+
handle?.detach();
|
|
86
|
+
handle = void 0;
|
|
87
|
+
});
|
|
88
|
+
return (_ctx, _cache) => {
|
|
89
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
90
|
+
ref_key: "root",
|
|
91
|
+
ref: root
|
|
92
|
+
}, unref(rail).parts.root()), [
|
|
93
|
+
unref(rail).showsModal() ? (openBlock(), createElementBlock("dialog", mergeProps({
|
|
94
|
+
key: 0,
|
|
95
|
+
ref: "modal"
|
|
96
|
+
}, unref(rail).parts.modal(), toHandlers(unref(keepPresses), true)), null, 16)) : createCommentVNode("v-if", true),
|
|
97
|
+
createCommentVNode(" Moves into the modal and back, so the destinations stay mounted, with their state. The\n modal is there from the first render on. "),
|
|
98
|
+
(openBlock(), createBlock(Teleport, {
|
|
99
|
+
to: modalElement.value,
|
|
100
|
+
disabled: !unref(rail).inModal() || !modalElement.value
|
|
101
|
+
}, [createElementVNode("nav", normalizeProps(guardReactiveProps(unref(rail).parts.panel())), [unref(rail).showsHeader() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(rail).parts.header())), [unref(rail).showsMenu() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(rail).parts.menu())), [createVNode(_sfc_main$1, mergeProps({
|
|
102
|
+
label: unref(text).menu,
|
|
103
|
+
variant: "standard"
|
|
104
|
+
}, unref(rail).menuButton(), { onClick: _cache[0] || (_cache[0] = ($event) => unref(rail).toggle()) }), {
|
|
105
|
+
default: withCtx(() => [unref(rail).expanded() ? renderSlot(_ctx.$slots, "collapse-icon", {}, () => [createVNode(_sfc_main$2, { alias: unref(rail).menuIcon() }, null, 8, ["alias"])], void 0, 0) : renderSlot(_ctx.$slots, "expand-icon", {}, () => [createVNode(_sfc_main$2, { alias: unref(rail).menuIcon() }, null, 8, ["alias"])], void 0, 1)]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 16, ["label"])], 16)) : createCommentVNode("v-if", true), unref(rail).showsFab() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(rail).parts.fab())), [renderSlot(_ctx.$slots, "fab", { expanded: unref(rail).expanded() })], 16)) : createCommentVNode("v-if", true)], 16)) : createCommentVNode("v-if", true), createElementVNode("ul", normalizeProps(guardReactiveProps(unref(rail).parts.items())), [renderSlot(_ctx.$slots, "default")], 16)], 16)], 8, ["to", "disabled"]))
|
|
108
|
+
], 16);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AccentColor, NavigationRailValue } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
3
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
4
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
5
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
6
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
/** Identifies the destination: the active one's is the rail's `v-model`. */
|
|
9
|
+
value?: NavigationRailValue;
|
|
10
|
+
/** The destination's name, under the icon or beside it */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Makes the item a link to this address. */
|
|
13
|
+
href?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A badge on the icon: `true` for a small one, a dot, or a count or a short label for a large
|
|
16
|
+
* one. Its text is read after the destination's name.
|
|
17
|
+
*/
|
|
18
|
+
badge?: boolean | number | string;
|
|
19
|
+
/**
|
|
20
|
+
* The theme color it takes while active: `'primary'`, `'tertiary'`, `'error'`, or a static color
|
|
21
|
+
* of the theme. Without it, the spec's, or the rail's color.
|
|
22
|
+
*/
|
|
23
|
+
color?: AccentColor;
|
|
24
|
+
/** The app's own click, after the item has chosen its destination */
|
|
25
|
+
onClick?: (event: MouseEvent) => void;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_Slots = {
|
|
28
|
+
/** The icon, outlined, for an inactive destination */
|
|
29
|
+
default?: () => unknown;
|
|
30
|
+
/** The icon while the destination is active, filled, in place of the default one */
|
|
31
|
+
'active-icon'?: () => unknown;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
37
|
+
new (): {
|
|
38
|
+
$slots: S;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export { _default as default };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _sfc_main$1 from "../badge/Badge.vue.js";
|
|
2
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
3
|
+
import { useRipple } from "../ripple/ripple.js";
|
|
4
|
+
import { navigationRailKey } from "./context.js";
|
|
5
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, useAttrs, useSlots, useTemplateRef, withCtx } from "vue";
|
|
6
|
+
import { createNavigationRailItem } from "@rio-m3e/core";
|
|
7
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
8
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
9
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
10
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
11
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
12
|
+
// src/navigation-rail/NavigationRailItem.vue
|
|
13
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
__name: "NavigationRailItem",
|
|
16
|
+
props: {
|
|
17
|
+
value: {},
|
|
18
|
+
label: {},
|
|
19
|
+
href: {},
|
|
20
|
+
badge: { type: [
|
|
21
|
+
Boolean,
|
|
22
|
+
Number,
|
|
23
|
+
String
|
|
24
|
+
] },
|
|
25
|
+
color: {},
|
|
26
|
+
onClick: { type: Function }
|
|
27
|
+
},
|
|
28
|
+
setup(__props) {
|
|
29
|
+
const props = __props;
|
|
30
|
+
const slots = useSlots();
|
|
31
|
+
const attrs = useAttrs();
|
|
32
|
+
const rest = computed(() => {
|
|
33
|
+
const { class: _class, style: _style, ...others } = attrs;
|
|
34
|
+
return others;
|
|
35
|
+
});
|
|
36
|
+
const rail = inject(navigationRailKey, void 0);
|
|
37
|
+
const locale = rail?.locale ?? useLocale(() => void 0);
|
|
38
|
+
const messages = rail?.messages ?? useMessages("navigationRail", locale, () => void 0);
|
|
39
|
+
const item = createNavigationRailItem({
|
|
40
|
+
props: () => ({
|
|
41
|
+
value: props.value,
|
|
42
|
+
label: props.label,
|
|
43
|
+
href: props.href,
|
|
44
|
+
badge: props.badge,
|
|
45
|
+
locale: locale.value,
|
|
46
|
+
color: props.color
|
|
47
|
+
}),
|
|
48
|
+
rail: () => rail ?? {
|
|
49
|
+
isActive: () => false,
|
|
50
|
+
choose: () => {}
|
|
51
|
+
},
|
|
52
|
+
content: () => ({ activeIcon: !!slots["active-icon"] }),
|
|
53
|
+
messages: () => messages.value
|
|
54
|
+
});
|
|
55
|
+
const onClick = (event) => {
|
|
56
|
+
if (item.handleClick(event)) props.onClick?.(event);
|
|
57
|
+
};
|
|
58
|
+
useRipple(useTemplateRef("action"), useTemplateRef("state"));
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return openBlock(), createElementBlock("li", mergeProps(unref(item).parts.root(), {
|
|
61
|
+
class: unref(attrs).class,
|
|
62
|
+
style: unref(attrs).style
|
|
63
|
+
}), [(openBlock(), createBlock(resolveDynamicComponent(unref(item).isLink() ? "a" : "button"), mergeProps({ ref: "action" }, {
|
|
64
|
+
...unref(item).parts.action(),
|
|
65
|
+
...rest.value
|
|
66
|
+
}, { onClick }), {
|
|
67
|
+
default: withCtx(() => [createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.content())), [
|
|
68
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.indicator())), null, 16),
|
|
69
|
+
createElementVNode("span", mergeProps({ ref: "state" }, unref(item).parts.state()), null, 16),
|
|
70
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.icon())), [unref(item).showsBadge() ? (openBlock(), createBlock(_sfc_main$1, {
|
|
71
|
+
key: 0,
|
|
72
|
+
value: unref(item).badgeValue(),
|
|
73
|
+
locale: unref(locale)
|
|
74
|
+
}, {
|
|
75
|
+
default: withCtx(() => [unref(item).showsActiveIcon() ? renderSlot(_ctx.$slots, "active-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)]),
|
|
76
|
+
_: 3
|
|
77
|
+
}, 8, ["value", "locale"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(item).showsActiveIcon() ? renderSlot(_ctx.$slots, "active-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 64))], 16),
|
|
78
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.label())), toDisplayString(__props.label), 17)
|
|
79
|
+
], 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.underLabel())), toDisplayString(__props.label), 17)]),
|
|
80
|
+
_: 3
|
|
81
|
+
}, 16))], 16);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigationRailSectionProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
3
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
4
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
5
|
+
type __VLS_Slots = {
|
|
6
|
+
/** The section's destinations (`RioNavigationRailItem`), which only an expanded rail shows */
|
|
7
|
+
default?: () => unknown;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<NavigationRailSectionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NavigationRailSectionProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export { _default as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toDisplayString, unref, useId } from "vue";
|
|
2
|
+
import { createNavigationRailSection } from "@rio-m3e/core";
|
|
3
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
4
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
5
|
+
import "@rio-m3e/styles/navigation-rail.css";
|
|
6
|
+
// src/navigation-rail/NavigationRailSection.vue
|
|
7
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
+
__name: "NavigationRailSection",
|
|
9
|
+
props: { label: {} },
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const section = createNavigationRailSection({
|
|
12
|
+
props: () => ({ label: __props.label }),
|
|
13
|
+
ids: { label: `${useId()}-label` }
|
|
14
|
+
});
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
return openBlock(), createElementBlock("li", normalizeProps(guardReactiveProps(unref(section).parts.root())), [unref(section).showsLabel() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(section).parts.label())), toDisplayString(__props.label), 17)) : createCommentVNode("v-if", true), createElementVNode("ul", normalizeProps(guardReactiveProps(unref(section).parts.items())), [renderSlot(_ctx.$slots, "default")], 16)], 16);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "@rio-m3e/styles/base/overflow.css";
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** The item in the row */
|
|
4
|
+
default?: () => unknown;
|
|
5
|
+
/** What the menu holds in its place, such as a `RioMenuItem` */
|
|
6
|
+
menu?: () => unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { _default as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { overflowKey, useOverflowItem } from "./overflow.js";
|
|
2
|
+
import { createElementBlock, defineComponent, openBlock, provide, renderSlot, useSlots, useTemplateRef } from "vue";
|
|
3
|
+
import "@rio-m3e/styles/base/overflow.css";
|
|
4
|
+
// src/overflow/OverflowItem.vue
|
|
5
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
|
+
__name: "OverflowItem",
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const slots = useSlots();
|
|
9
|
+
const root = useTemplateRef("root");
|
|
10
|
+
useOverflowItem({
|
|
11
|
+
element: () => root.value,
|
|
12
|
+
menu: () => slots.menu?.()
|
|
13
|
+
});
|
|
14
|
+
provide(overflowKey, null);
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
return openBlock(), createElementBlock("div", {
|
|
17
|
+
ref_key: "root",
|
|
18
|
+
ref: root,
|
|
19
|
+
class: "rio-overflow-item"
|
|
20
|
+
}, [renderSlot(_ctx.$slots, "default")], 512);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon-button/IconButton.vue.js";
|
|
2
|
+
import _sfc_main$2 from "../icon/Icon.vue.js";
|
|
3
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
4
|
+
import _sfc_main$3 from "../menu/Menu.vue.js";
|
|
5
|
+
import _sfc_main$4 from "../menu/MenuItem.vue.js";
|
|
6
|
+
import _sfc_main$5 from "../tooltip/Tooltip.vue.js";
|
|
7
|
+
import { overflowKey } from "./overflow.js";
|
|
8
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, openBlock, provide, ref, renderList, renderSlot, unref, useTemplateRef, watchEffect, withCtx } from "vue";
|
|
9
|
+
import "@rio-m3e/styles/base/overflow.css";
|
|
10
|
+
// src/overflow/OverflowMenu.vue
|
|
11
|
+
const _hoisted_1 = { class: "rio-overflow" };
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
__name: "OverflowMenu",
|
|
14
|
+
props: { host: {} },
|
|
15
|
+
setup(__props) {
|
|
16
|
+
provide(overflowKey, null);
|
|
17
|
+
const text = useMessages("overflow", useLocale(() => void 0), () => void 0);
|
|
18
|
+
const open = ref(false);
|
|
19
|
+
const indicator = useTemplateRef("indicator");
|
|
20
|
+
watchEffect(() => __props.host.indicator.value = indicator.value?.$el ?? null);
|
|
21
|
+
/** Renders what an entry gives: text, or a slot of the button it stands for */
|
|
22
|
+
const Render = (props) => props.content();
|
|
23
|
+
const toggles = computed(() => __props.host.overflowed.value.filter((each) => each.selected?.() !== void 0));
|
|
24
|
+
const selected = computed(() => toggles.value.filter((each) => each.selected()).map((each) => each.id));
|
|
25
|
+
const choose = (record) => record.element()?.click();
|
|
26
|
+
/** A toggle chosen in the menu: the one whose state the new selection turns */
|
|
27
|
+
const onSelect = (next) => {
|
|
28
|
+
const values = new Set(Array.isArray(next) ? next : next === void 0 ? [] : [next]);
|
|
29
|
+
for (const each of toggles.value) if (values.has(each.id) !== !!each.selected()) choose(each);
|
|
30
|
+
};
|
|
31
|
+
return (_ctx, _cache) => {
|
|
32
|
+
return openBlock(), createElementBlock("span", _hoisted_1, [createVNode(_sfc_main$5, { text: unref(text).more }, {
|
|
33
|
+
default: withCtx(() => [createVNode(_sfc_main$1, {
|
|
34
|
+
ref_key: "indicator",
|
|
35
|
+
ref: indicator,
|
|
36
|
+
label: unref(text).more,
|
|
37
|
+
variant: __props.host.indicatorVariant(),
|
|
38
|
+
"aria-haspopup": "menu",
|
|
39
|
+
"aria-expanded": open.value,
|
|
40
|
+
onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
|
|
41
|
+
}, {
|
|
42
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$2, { alias: "more" })])]),
|
|
43
|
+
_: 3
|
|
44
|
+
}, 8, [
|
|
45
|
+
"label",
|
|
46
|
+
"variant",
|
|
47
|
+
"aria-expanded"
|
|
48
|
+
])]),
|
|
49
|
+
_: 3
|
|
50
|
+
}, 8, ["text"]), createVNode(_sfc_main$3, {
|
|
51
|
+
open: open.value,
|
|
52
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event),
|
|
53
|
+
anchor: __props.host.indicator.value,
|
|
54
|
+
label: unref(text).more,
|
|
55
|
+
selection: "multiple",
|
|
56
|
+
"model-value": selected.value,
|
|
57
|
+
"onUpdate:modelValue": onSelect
|
|
58
|
+
}, {
|
|
59
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.host.overflowed.value, (record) => {
|
|
60
|
+
return openBlock(), createElementBlock(Fragment, { key: record.id }, [record.menu ? (openBlock(), createBlock(Render, {
|
|
61
|
+
key: 0,
|
|
62
|
+
content: record.menu
|
|
63
|
+
}, null, 8, ["content"])) : (openBlock(), createBlock(_sfc_main$4, {
|
|
64
|
+
key: 1,
|
|
65
|
+
value: record.selected?.() === void 0 ? void 0 : record.id,
|
|
66
|
+
disabled: record.disabled?.(),
|
|
67
|
+
onClick: ($event) => record.selected?.() === void 0 && choose(record)
|
|
68
|
+
}, createSlots({
|
|
69
|
+
default: withCtx(() => [record.label ? (openBlock(), createBlock(Render, {
|
|
70
|
+
key: 0,
|
|
71
|
+
content: record.label
|
|
72
|
+
}, null, 8, ["content"])) : createCommentVNode("v-if", true)]),
|
|
73
|
+
_: 2
|
|
74
|
+
}, [record.icon ? {
|
|
75
|
+
name: "icon",
|
|
76
|
+
fn: withCtx(() => [createVNode(Render, { content: record.icon }, null, 8, ["content"])]),
|
|
77
|
+
key: "0"
|
|
78
|
+
} : void 0]), 1032, [
|
|
79
|
+
"value",
|
|
80
|
+
"disabled",
|
|
81
|
+
"onClick"
|
|
82
|
+
]))], 64);
|
|
83
|
+
}), 128))]),
|
|
84
|
+
_: 1
|
|
85
|
+
}, 8, [
|
|
86
|
+
"open",
|
|
87
|
+
"anchor",
|
|
88
|
+
"label",
|
|
89
|
+
"model-value"
|
|
90
|
+
])]);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { computed, inject, onBeforeUnmount, onMounted, onUpdated, provide, ref, shallowRef, watch } from "vue";
|
|
2
|
+
import { attachOverflow } from "@rio-m3e/core";
|
|
3
|
+
// src/overflow/overflow.ts
|
|
4
|
+
/** What a host provides. `null` inside the menu itself, so its button doesn't register. */
|
|
5
|
+
const overflowKey = Symbol("RioOverflow");
|
|
6
|
+
let ids = 0;
|
|
7
|
+
/** For an item: registers with the host around it, if there is one, while mounted. */
|
|
8
|
+
function useOverflowItem(entry) {
|
|
9
|
+
const host = inject(overflowKey, null);
|
|
10
|
+
if (!host) return;
|
|
11
|
+
let unregister;
|
|
12
|
+
onMounted(() => unregister = host.register(entry));
|
|
13
|
+
onBeforeUnmount(() => unregister?.());
|
|
14
|
+
}
|
|
15
|
+
/** For a host: provides the context, and measures its items while `overflow` is on. */
|
|
16
|
+
function useOverflowHost(options) {
|
|
17
|
+
const records = shallowRef([]);
|
|
18
|
+
/** The elements in the menu, as `attachOverflow` reports them */
|
|
19
|
+
const gone = shallowRef([]);
|
|
20
|
+
const indicator = ref(null);
|
|
21
|
+
const enabled = () => options.overflow().enabled;
|
|
22
|
+
provide(overflowKey, { register(entry) {
|
|
23
|
+
const record = {
|
|
24
|
+
...entry,
|
|
25
|
+
id: ++ids
|
|
26
|
+
};
|
|
27
|
+
records.value = [...records.value, record];
|
|
28
|
+
return () => records.value = records.value.filter((each) => each !== record);
|
|
29
|
+
} });
|
|
30
|
+
const items = () => records.value.map((record) => record.element()).filter((element) => !!element);
|
|
31
|
+
const overflowed = computed(() => {
|
|
32
|
+
if (!enabled()) return [];
|
|
33
|
+
const byElement = new Map(records.value.map((record) => [record.element(), record]));
|
|
34
|
+
return gone.value.map((element) => byElement.get(element)).filter((record) => !!record);
|
|
35
|
+
});
|
|
36
|
+
let handle;
|
|
37
|
+
/** The container the primitive measures, which a host may replace, as a toolbar a FAB comes to */
|
|
38
|
+
let attached = null;
|
|
39
|
+
const release = () => {
|
|
40
|
+
handle?.detach();
|
|
41
|
+
handle = void 0;
|
|
42
|
+
attached = null;
|
|
43
|
+
gone.value = [];
|
|
44
|
+
};
|
|
45
|
+
const sync = () => {
|
|
46
|
+
const container = options.container.value;
|
|
47
|
+
if (!enabled() || !container) {
|
|
48
|
+
release();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (handle && attached === container) {
|
|
52
|
+
handle.update();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
release();
|
|
56
|
+
attached = container;
|
|
57
|
+
handle = attachOverflow(container, {
|
|
58
|
+
items,
|
|
59
|
+
indicator: () => indicator.value,
|
|
60
|
+
maxItems: () => options.overflow().maxItems,
|
|
61
|
+
axis: options.axis,
|
|
62
|
+
room: options.room,
|
|
63
|
+
held: () => !!options.overflow().held,
|
|
64
|
+
onOverflowedChange: (next) => gone.value = next
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
onMounted(sync);
|
|
68
|
+
onUpdated(sync);
|
|
69
|
+
watch([records, options.container], sync, { flush: "post" });
|
|
70
|
+
onBeforeUnmount(release);
|
|
71
|
+
return {
|
|
72
|
+
overflowed,
|
|
73
|
+
indicator,
|
|
74
|
+
enabled,
|
|
75
|
+
overflowing: () => enabled() && overflowed.value.length > 0,
|
|
76
|
+
indicatorVariant: () => options.overflow().indicatorVariant
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export { overflowKey, useOverflowHost, useOverflowItem };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CircularProgressProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
2
3
|
import "@rio-m3e/styles/base/direction.css";
|
|
3
4
|
import "@rio-m3e/styles/progress.css";
|
|
4
5
|
declare const __VLS_export: import("vue").DefineComponent<CircularProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CircularProgressProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|