@rio-m3e/vue 0.6.2 → 0.7.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 +91 -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 +9130 -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 +1 -0
- package/dist/checkbox/Checkbox.vue.js +3 -0
- package/dist/chip/AssistChip.vue.d.ts +1 -0
- package/dist/chip/AssistChip.vue.js +3 -0
- package/dist/chip/ChipSet.vue.d.ts +1 -0
- package/dist/chip/ChipSet.vue.js +4 -1
- package/dist/chip/FilterChip.vue.d.ts +9 -2
- package/dist/chip/FilterChip.vue.js +12 -5
- package/dist/chip/InputChip.vue.d.ts +5 -1
- package/dist/chip/InputChip.vue.js +6 -2
- package/dist/chip/SuggestionChip.vue.d.ts +1 -0
- package/dist/chip/SuggestionChip.vue.js +3 -0
- package/dist/date-picker/DatePicker.vue.d.ts +27 -4
- package/dist/date-picker/DatePicker.vue.js +15 -5
- package/dist/date-picker/DatePickerCalendar.vue.js +11 -13
- package/dist/date-picker/DatePickerDialog.vue.d.ts +26 -3
- package/dist/date-picker/DatePickerDialog.vue.js +66 -21
- package/dist/date-picker/DateRangeCalendar.vue.js +17 -8
- package/dist/date-picker/DateRangePickerDialog.vue.d.ts +23 -3
- package/dist/date-picker/DateRangePickerDialog.vue.js +31 -17
- 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/Icon.vue.d.ts +13 -0
- package/dist/icon/Icon.vue.js +30 -0
- package/dist/icon/icons.d.ts +12 -0
- package/dist/icon/icons.js +12 -0
- package/dist/icon-button/IconButton.vue.d.ts +1 -0
- package/dist/icon-button/IconButton.vue.js +23 -2
- package/dist/ime/composing.js +24 -0
- package/dist/index.d.ts +69 -39
- package/dist/index.js +69 -39
- package/dist/list/List.vue.d.ts +1 -0
- package/dist/list/List.vue.js +4 -1
- package/dist/list/ListItem.vue.d.ts +7 -1
- package/dist/list/ListItem.vue.js +4 -1
- 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 +1 -0
- package/dist/menu/Menu.vue.js +12 -2
- package/dist/menu/MenuDivider.vue.d.ts +1 -0
- package/dist/menu/MenuDivider.vue.js +1 -0
- package/dist/menu/MenuGroup.vue.d.ts +1 -0
- package/dist/menu/MenuGroup.vue.js +1 -0
- package/dist/menu/MenuItem.vue.d.ts +1 -0
- package/dist/menu/MenuItem.vue.js +1 -0
- package/dist/menu/SubMenu.vue.d.ts +2 -1
- package/dist/menu/SubMenu.vue.js +7 -3
- 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 +2 -0
- package/dist/progress/CircularProgress.vue.js +6 -2
- package/dist/progress/LinearProgress.vue.d.ts +2 -0
- package/dist/progress/LinearProgress.vue.js +6 -2
- package/dist/radio/Radio.vue.d.ts +1 -0
- package/dist/radio/Radio.vue.js +4 -1
- package/dist/radio/RadioGroup.vue.d.ts +1 -0
- package/dist/radio/RadioGroup.vue.js +10 -2
- package/dist/rio/rio.d.ts +9 -1
- package/dist/rio/rio.js +11 -3
- 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 +8 -3
- package/dist/select/Select.vue.js +42 -30
- package/dist/select/SelectOption.vue.d.ts +5 -1
- package/dist/select/SelectOption.vue.js +9 -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 +2 -0
- package/dist/slider/RangeSlider.vue.js +4 -0
- package/dist/slider/Slider.vue.d.ts +2 -0
- package/dist/slider/Slider.vue.js +4 -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 +4 -1
- package/dist/split-button/SplitButton.vue.js +7 -2
- package/dist/switch/Switch.vue.d.ts +1 -0
- package/dist/switch/Switch.vue.js +3 -0
- package/dist/tabs/Tab.vue.d.ts +19 -0
- package/dist/tabs/Tab.vue.js +66 -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 +32 -0
- package/dist/tabs/Tabs.vue.js +95 -0
- package/dist/tabs/context.js +5 -0
- package/dist/text-field/TextField.vue.d.ts +8 -2
- package/dist/text-field/TextField.vue.js +91 -47
- package/dist/time-picker/TimeInput.vue.d.ts +8 -1
- package/dist/time-picker/TimeInput.vue.js +6 -2
- package/dist/time-picker/TimePickerDialog.vue.d.ts +20 -4
- package/dist/time-picker/TimePickerDialog.vue.js +8 -3
- package/dist/time-picker/TimeScroll.vue.d.ts +16 -3
- package/dist/time-picker/TimeScroll.vue.js +8 -3
- 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/package.json +6 -4
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { keepPresses } from "../overlay/presses.js";
|
|
2
|
+
import _sfc_main$1 from "./Snackbar.vue.js";
|
|
3
|
+
import { snackbarKey } from "./snackbar.js";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, ref, renderSlot, toDisplayString, toHandlers, unref, useTemplateRef, watch } from "vue";
|
|
5
|
+
import { attachSnackbarHost, createSnackbarHost, createSnackbarQueue, mergePartAttrs } from "@rio-m3e/core";
|
|
6
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
7
|
+
import "@rio-m3e/styles/snackbar.css";
|
|
8
|
+
// src/snackbar/SnackbarHost.vue
|
|
9
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
__name: "SnackbarHost",
|
|
12
|
+
props: {
|
|
13
|
+
anchor: {},
|
|
14
|
+
locale: {},
|
|
15
|
+
messages: {},
|
|
16
|
+
align: {},
|
|
17
|
+
offset: {},
|
|
18
|
+
shortcut: {}
|
|
19
|
+
},
|
|
20
|
+
setup(__props, { expose: __expose }) {
|
|
21
|
+
/** How far the snackbar is moved to clear what stays put on the screen, as core reports it */
|
|
22
|
+
const clearance = ref({
|
|
23
|
+
lift: 0,
|
|
24
|
+
start: 0,
|
|
25
|
+
end: 0
|
|
26
|
+
});
|
|
27
|
+
/** What the status region holds, as core gives it */
|
|
28
|
+
const announcement = ref("");
|
|
29
|
+
const host = createSnackbarHost({
|
|
30
|
+
props: () => ({
|
|
31
|
+
align: __props.align,
|
|
32
|
+
offset: __props.offset,
|
|
33
|
+
anchor: __props.anchor && typeof __props.anchor === "object" && "$el" in __props.anchor ? __props.anchor.$el : __props.anchor,
|
|
34
|
+
shortcut: __props.shortcut
|
|
35
|
+
}),
|
|
36
|
+
clearance: () => clearance.value
|
|
37
|
+
});
|
|
38
|
+
const changes = ref(0);
|
|
39
|
+
const queue = createSnackbarQueue({ onChange: () => changes.value++ });
|
|
40
|
+
const current = computed(() => {
|
|
41
|
+
changes.value;
|
|
42
|
+
return queue.current();
|
|
43
|
+
});
|
|
44
|
+
const action = () => queue.end("action");
|
|
45
|
+
const dismiss = () => queue.end("dismissed");
|
|
46
|
+
const controller = {
|
|
47
|
+
show: queue.show,
|
|
48
|
+
dismiss
|
|
49
|
+
};
|
|
50
|
+
provide(snackbarKey, controller);
|
|
51
|
+
__expose(controller);
|
|
52
|
+
const root = useTemplateRef("root");
|
|
53
|
+
let handle;
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
handle = attachSnackbarHost(root.value, {
|
|
56
|
+
queue,
|
|
57
|
+
placement: host.placement,
|
|
58
|
+
onClearanceChange: (next) => clearance.value = next,
|
|
59
|
+
onAnnounce: (message) => announcement.value = message,
|
|
60
|
+
shortcut: () => __props.shortcut
|
|
61
|
+
});
|
|
62
|
+
handle.sync();
|
|
63
|
+
});
|
|
64
|
+
watch(changes, () => handle?.sync(), { flush: "post" });
|
|
65
|
+
onUpdated(() => handle?.update());
|
|
66
|
+
onBeforeUnmount(() => {
|
|
67
|
+
handle?.detach();
|
|
68
|
+
queue.clear();
|
|
69
|
+
});
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
72
|
+
renderSlot(_ctx.$slots, "default"),
|
|
73
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(host).parts.live())), toDisplayString(announcement.value), 17),
|
|
74
|
+
createElementVNode("div", mergeProps({
|
|
75
|
+
ref_key: "root",
|
|
76
|
+
ref: root
|
|
77
|
+
}, unref(mergePartAttrs)({
|
|
78
|
+
..._ctx.$attrs,
|
|
79
|
+
class: void 0,
|
|
80
|
+
style: void 0
|
|
81
|
+
}, unref(host).parts.root()), {
|
|
82
|
+
class: _ctx.$attrs.class,
|
|
83
|
+
style: _ctx.$attrs.style
|
|
84
|
+
}, toHandlers(unref(keepPresses), true)), [current.value ? renderSlot(_ctx.$slots, "snackbar", {
|
|
85
|
+
snackbar: current.value,
|
|
86
|
+
action,
|
|
87
|
+
dismiss
|
|
88
|
+
}, () => [(openBlock(), createBlock(_sfc_main$1, {
|
|
89
|
+
key: current.value.id,
|
|
90
|
+
message: current.value.message,
|
|
91
|
+
action: current.value.action,
|
|
92
|
+
dismissible: current.value.dismissible,
|
|
93
|
+
"action-on-new-line": current.value.actionOnNewLine,
|
|
94
|
+
locale: __props.locale,
|
|
95
|
+
messages: __props.messages,
|
|
96
|
+
onAction: action,
|
|
97
|
+
onDismiss: dismiss
|
|
98
|
+
}, null, 8, [
|
|
99
|
+
"message",
|
|
100
|
+
"action",
|
|
101
|
+
"dismissible",
|
|
102
|
+
"action-on-new-line",
|
|
103
|
+
"locale",
|
|
104
|
+
"messages"
|
|
105
|
+
]))], void 0, 0) : createCommentVNode("v-if", true)], 16)
|
|
106
|
+
], 64);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
import { SnackbarRequest, SnackbarResult } from "@rio-m3e/core";
|
|
3
|
+
/** Shows snackbars in the nearest `RioSnackbarHost` around the component. */
|
|
4
|
+
export interface SnackbarController {
|
|
5
|
+
/**
|
|
6
|
+
* Queues a snackbar: the host shows one at a time, in the order asked. The promise settles as it
|
|
7
|
+
* ends: `'action'` when its action was pressed, `'dismissed'` otherwise.
|
|
8
|
+
*/
|
|
9
|
+
show(request: SnackbarRequest): Promise<SnackbarResult>;
|
|
10
|
+
/** Dismisses the snackbar on the screen, or the one about to show. */
|
|
11
|
+
dismiss(): void;
|
|
12
|
+
}
|
|
13
|
+
/** What `RioSnackbarHost` provides to the components inside it */
|
|
14
|
+
export declare const snackbarKey: InjectionKey<SnackbarController>;
|
|
15
|
+
/** The nearest `RioSnackbarHost`'s snackbars. Call it in `setup`, inside a host. */
|
|
16
|
+
export declare function useSnackbar(): SnackbarController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
// src/snackbar/snackbar.ts
|
|
3
|
+
/** What `RioSnackbarHost` provides to the components inside it */
|
|
4
|
+
const snackbarKey = Symbol("RioSnackbar");
|
|
5
|
+
/** The nearest `RioSnackbarHost`'s snackbars. Call it in `setup`, inside a host. */
|
|
6
|
+
function useSnackbar() {
|
|
7
|
+
const controller = inject(snackbarKey, void 0);
|
|
8
|
+
if (!controller) throw new Error("useSnackbar() needs a RioSnackbarHost around the component.");
|
|
9
|
+
return controller;
|
|
10
|
+
}
|
|
11
|
+
export { snackbarKey, useSnackbar };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SplitButtonProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
2
3
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
3
4
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
4
5
|
import "@rio-m3e/styles/base/state-layer.css";
|
|
5
6
|
import "@rio-m3e/styles/base/touch-target.css";
|
|
6
7
|
import "@rio-m3e/styles/button.css";
|
|
8
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
7
9
|
import "@rio-m3e/styles/split-button.css";
|
|
8
10
|
type __VLS_Slots = {
|
|
9
11
|
/** The leading button's label. Without it, give the split button a `label`. */
|
|
@@ -12,7 +14,8 @@ type __VLS_Slots = {
|
|
|
12
14
|
icon?: () => unknown;
|
|
13
15
|
/**
|
|
14
16
|
* The trailing button's icon: an expand icon pointing down, which turns when the menu opens.
|
|
15
|
-
*
|
|
17
|
+
* Hidden from assistive technology; `menuLabel` names the button. Without one, the `menu` icon
|
|
18
|
+
* registered with `createRio`.
|
|
16
19
|
*/
|
|
17
20
|
'menu-icon'?: () => unknown;
|
|
18
21
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { vRipple } from "../ripple/ripple.js";
|
|
2
2
|
import { vCornerMorph } from "../corner-morph/corner-morph.js";
|
|
3
|
-
import
|
|
3
|
+
import _sfc_main$1 from "../icon/Icon.vue.js";
|
|
4
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, renderSlot, unref, useSlots, useTemplateRef, withDirectives } from "vue";
|
|
4
5
|
import { attachSplitButtonMenuIcon, createSplitButton } from "@rio-m3e/core";
|
|
6
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
5
7
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
6
8
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
7
9
|
import "@rio-m3e/styles/base/state-layer.css";
|
|
8
10
|
import "@rio-m3e/styles/base/touch-target.css";
|
|
9
11
|
import "@rio-m3e/styles/button.css";
|
|
12
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
10
13
|
import "@rio-m3e/styles/split-button.css";
|
|
11
14
|
// src/split-button/SplitButton.vue
|
|
12
15
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
@@ -16,6 +19,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
16
19
|
label: {},
|
|
17
20
|
variant: {},
|
|
18
21
|
size: {},
|
|
22
|
+
color: {},
|
|
19
23
|
open: { type: Boolean },
|
|
20
24
|
popup: {},
|
|
21
25
|
disabled: { type: Boolean },
|
|
@@ -32,6 +36,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
32
36
|
label: __props.label,
|
|
33
37
|
variant: __props.variant,
|
|
34
38
|
size: __props.size,
|
|
39
|
+
color: __props.color,
|
|
35
40
|
open: __props.open,
|
|
36
41
|
popup: __props.popup,
|
|
37
42
|
disabled: __props.disabled,
|
|
@@ -67,7 +72,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
67
72
|
], 16)), [[unref(vRipple)], [unref(vCornerMorph)]]), withDirectives((openBlock(), createElementBlock("button", mergeProps({
|
|
68
73
|
ref_key: "trailing",
|
|
69
74
|
ref: trailing
|
|
70
|
-
}, unref(sb).parts.trailing(), { onClick: _cache[1] || (_cache[1] = (...args) => unref(sb).handleTrailingClick && unref(sb).handleTrailingClick(...args)) }), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(sb).parts.touch())), null, 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(sb).parts.menuIcon())), [renderSlot(_ctx.$slots, "menu-icon")], 16)], 16)), [[unref(vRipple)], [unref(vCornerMorph)]])], 16);
|
|
75
|
+
}, unref(sb).parts.trailing(), { onClick: _cache[1] || (_cache[1] = (...args) => unref(sb).handleTrailingClick && unref(sb).handleTrailingClick(...args)) }), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(sb).parts.touch())), null, 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(sb).parts.menuIcon())), [renderSlot(_ctx.$slots, "menu-icon", {}, () => [createVNode(_sfc_main$1, { alias: "menu" })])], 16)], 16)), [[unref(vRipple)], [unref(vCornerMorph)]])], 16);
|
|
71
76
|
};
|
|
72
77
|
}
|
|
73
78
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRipple } from "../ripple/ripple.js";
|
|
2
2
|
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, unref, useSlots, useTemplateRef } from "vue";
|
|
3
3
|
import { attachCheckable, attachSwitchHandle, createSwitch, mergePartAttrs } from "@rio-m3e/core";
|
|
4
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
4
5
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
5
6
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
6
7
|
import "@rio-m3e/styles/base/ripple.css";
|
|
@@ -11,6 +12,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
11
12
|
__name: "Switch",
|
|
12
13
|
props: {
|
|
13
14
|
selected: { type: Boolean },
|
|
15
|
+
color: {},
|
|
14
16
|
disabled: { type: Boolean },
|
|
15
17
|
softDisabled: { type: Boolean }
|
|
16
18
|
},
|
|
@@ -25,6 +27,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
25
27
|
const sw = createSwitch({
|
|
26
28
|
props: () => ({
|
|
27
29
|
selected: __props.selected,
|
|
30
|
+
color: __props.color,
|
|
28
31
|
disabled: __props.disabled,
|
|
29
32
|
softDisabled: __props.softDisabled
|
|
30
33
|
}),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TabProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
3
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
4
|
+
import "@rio-m3e/styles/base/state-layer.css";
|
|
5
|
+
import "@rio-m3e/styles/tabs.css";
|
|
6
|
+
type __VLS_Props = Omit<TabProps, 'locale'>;
|
|
7
|
+
type __VLS_Slots = {
|
|
8
|
+
/** The icon: over the label in primary tabs, beside it in secondary ones, or alone */
|
|
9
|
+
default?: () => unknown;
|
|
10
|
+
};
|
|
11
|
+
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>;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export { _default as default };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _sfc_main$1 from "../badge/Badge.vue.js";
|
|
2
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
3
|
+
import { vRipple } from "../ripple/ripple.js";
|
|
4
|
+
import { tabsKey } from "./context.js";
|
|
5
|
+
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, openBlock, renderSlot, toDisplayString, unref, useSlots, useTemplateRef, withCtx, withDirectives } from "vue";
|
|
6
|
+
import { createTab } from "@rio-m3e/core";
|
|
7
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
8
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
9
|
+
import "@rio-m3e/styles/base/state-layer.css";
|
|
10
|
+
import "@rio-m3e/styles/tabs.css";
|
|
11
|
+
// src/tabs/Tab.vue
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
__name: "Tab",
|
|
14
|
+
props: {
|
|
15
|
+
value: {},
|
|
16
|
+
label: {},
|
|
17
|
+
badge: { type: [
|
|
18
|
+
Boolean,
|
|
19
|
+
Number,
|
|
20
|
+
String
|
|
21
|
+
] }
|
|
22
|
+
},
|
|
23
|
+
setup(__props) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
const slots = useSlots();
|
|
26
|
+
const tabs = inject(tabsKey, void 0);
|
|
27
|
+
const locale = tabs?.locale ?? useLocale(() => void 0);
|
|
28
|
+
const messages = tabs?.messages ?? useMessages("tabs", locale, () => void 0);
|
|
29
|
+
const tab = createTab({
|
|
30
|
+
props: () => ({
|
|
31
|
+
value: props.value,
|
|
32
|
+
label: props.label,
|
|
33
|
+
badge: props.badge,
|
|
34
|
+
locale: locale.value
|
|
35
|
+
}),
|
|
36
|
+
tabs: () => tabs,
|
|
37
|
+
content: () => ({ icon: !!slots.default }),
|
|
38
|
+
messages: () => messages.value
|
|
39
|
+
});
|
|
40
|
+
const root = useTemplateRef("root");
|
|
41
|
+
const unregister = tabs?.register(() => props.value, () => root.value);
|
|
42
|
+
onBeforeUnmount(() => unregister?.());
|
|
43
|
+
return (_ctx, _cache) => {
|
|
44
|
+
return withDirectives((openBlock(), createElementBlock("button", mergeProps({
|
|
45
|
+
ref_key: "root",
|
|
46
|
+
ref: root
|
|
47
|
+
}, unref(tab).parts.root(), { onClick: _cache[0] || (_cache[0] = (...args) => unref(tab).handleClick && unref(tab).handleClick(...args)) }), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.content())), [
|
|
48
|
+
unref(tab).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(tab).parts.icon())), [unref(tab).badgeOnIcon() ? (openBlock(), createBlock(_sfc_main$1, {
|
|
49
|
+
key: 0,
|
|
50
|
+
value: unref(tab).badgeValue(),
|
|
51
|
+
locale: unref(locale)
|
|
52
|
+
}, {
|
|
53
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
54
|
+
_: 3
|
|
55
|
+
}, 8, ["value", "locale"])) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 16)) : createCommentVNode("v-if", true),
|
|
56
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.label())), toDisplayString(__props.label), 17),
|
|
57
|
+
unref(tab).showsInlineBadge() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(tab).parts.badge())), [createVNode(_sfc_main$1, {
|
|
58
|
+
value: unref(tab).badgeValue(),
|
|
59
|
+
locale: unref(locale)
|
|
60
|
+
}, null, 8, ["value", "locale"])], 16)) : createCommentVNode("v-if", true),
|
|
61
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.indicator())), null, 16)
|
|
62
|
+
], 16)], 16)), [[unref(vRipple)]]);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TabValue } from "@rio-m3e/core";
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** A `RioTabs` and its `RioTabPanel`s, wherever they sit inside */
|
|
4
|
+
default?: () => unknown;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
/** The selected tab's value, with `v-model`, for the tab list and the panels inside the group */
|
|
8
|
+
modelValue?: TabValue | undefined;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: TabValue | undefined) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: TabValue | undefined) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export { _default as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tabGroupKey } from "./context.js";
|
|
2
|
+
import { defineComponent, provide, renderSlot, useId, useModel } from "vue";
|
|
3
|
+
import { createTabGroup } from "@rio-m3e/core";
|
|
4
|
+
// src/tabs/TabGroup.vue
|
|
5
|
+
/** The selected tab's value, with `v-model`, for the tab list and the panels inside the group */
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "TabGroup",
|
|
8
|
+
props: {
|
|
9
|
+
"modelValue": {},
|
|
10
|
+
"modelModifiers": {}
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue"],
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const model = useModel(__props, "modelValue");
|
|
15
|
+
provide(tabGroupKey, createTabGroup({
|
|
16
|
+
props: () => ({ selected: model.value }),
|
|
17
|
+
onChange: (next) => model.value = next,
|
|
18
|
+
id: useId()
|
|
19
|
+
}));
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return renderSlot(_ctx.$slots, "default");
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TabPanelProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
/** The content, shown while its tab is selected */
|
|
5
|
+
default?: () => unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<TabPanelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TabPanelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export { _default as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { tabGroupKey } from "./context.js";
|
|
2
|
+
import { createElementBlock, defineComponent, guardReactiveProps, inject, normalizeProps, openBlock, renderSlot, unref } from "vue";
|
|
3
|
+
import { createTabPanel } from "@rio-m3e/core";
|
|
4
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
5
|
+
// src/tabs/TabPanel.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "TabPanel",
|
|
8
|
+
props: { value: {} },
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const group = inject(tabGroupKey, void 0);
|
|
11
|
+
const panel = createTabPanel({
|
|
12
|
+
props: () => ({ value: __props.value }),
|
|
13
|
+
group: () => group
|
|
14
|
+
});
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(panel).parts.root())), [renderSlot(_ctx.$slots, "default")], 16);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TabValue, TabsMessages, TabsProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
3
|
+
import "@rio-m3e/styles/tabs.css";
|
|
4
|
+
interface Props extends Omit<TabsProps, 'selected'> {
|
|
5
|
+
/** A language tag, for badges' counts. Without it, the one provided, or the page's. */
|
|
6
|
+
locale?: string;
|
|
7
|
+
/** Replaces what a small badge says. */
|
|
8
|
+
messages?: Partial<TabsMessages>;
|
|
9
|
+
}
|
|
10
|
+
type __VLS_Props = Props;
|
|
11
|
+
type __VLS_Slots = {
|
|
12
|
+
/** The tabs (`RioTab`) */
|
|
13
|
+
default?: () => unknown;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_ModelProps = {
|
|
16
|
+
/** The selected tab's value, with `v-model`, for a tab list outside a `RioTabGroup` */
|
|
17
|
+
modelValue?: TabValue | undefined;
|
|
18
|
+
};
|
|
19
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (value: TabValue | undefined) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: TabValue | undefined) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export { _default as default };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
2
|
+
import { tabGroupKey, tabsKey } from "./context.js";
|
|
3
|
+
import { createElementBlock, createElementVNode, defineComponent, inject, mergeModels, mergeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, renderSlot, shallowRef, unref, useModel, useTemplateRef, watch } from "vue";
|
|
4
|
+
import { attachTabs, createTabs, inDocumentOrder, mergePartAttrs } from "@rio-m3e/core";
|
|
5
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
6
|
+
import "@rio-m3e/styles/tabs.css";
|
|
7
|
+
// src/tabs/Tabs.vue
|
|
8
|
+
/** The tabs, as they register */
|
|
9
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
__name: "Tabs",
|
|
12
|
+
props: /*@__PURE__*/ mergeModels({
|
|
13
|
+
locale: {},
|
|
14
|
+
messages: {},
|
|
15
|
+
variant: {},
|
|
16
|
+
scrollable: { type: Boolean },
|
|
17
|
+
align: {},
|
|
18
|
+
iconOnly: { type: Boolean },
|
|
19
|
+
label: {}
|
|
20
|
+
}, {
|
|
21
|
+
"modelValue": {},
|
|
22
|
+
"modelModifiers": {}
|
|
23
|
+
}),
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(__props) {
|
|
26
|
+
/** The selected tab's value, with `v-model`, for a tab list outside a `RioTabGroup` */
|
|
27
|
+
const model = useModel(__props, "modelValue");
|
|
28
|
+
const group = inject(tabGroupKey, void 0);
|
|
29
|
+
const registered = shallowRef([]);
|
|
30
|
+
/**
|
|
31
|
+
* The tabs' values in the page's order, once each has its element; until then, as they registered,
|
|
32
|
+
* as on a server
|
|
33
|
+
*/
|
|
34
|
+
const values = () => inDocumentOrder(registered.value, (tab) => tab.element()).map((tab) => tab.value());
|
|
35
|
+
const tabs = createTabs({
|
|
36
|
+
props: () => ({
|
|
37
|
+
selected: model.value,
|
|
38
|
+
variant: __props.variant,
|
|
39
|
+
scrollable: __props.scrollable,
|
|
40
|
+
align: __props.align,
|
|
41
|
+
iconOnly: __props.iconOnly,
|
|
42
|
+
label: __props.label
|
|
43
|
+
}),
|
|
44
|
+
onChange: (next) => model.value = next,
|
|
45
|
+
group: () => group,
|
|
46
|
+
values
|
|
47
|
+
});
|
|
48
|
+
const resolvedLocale = useLocale(() => __props.locale);
|
|
49
|
+
const text = useMessages("tabs", resolvedLocale, () => __props.messages);
|
|
50
|
+
provide(tabsKey, {
|
|
51
|
+
isSelected: tabs.isSelected,
|
|
52
|
+
choose: tabs.choose,
|
|
53
|
+
tabStop: tabs.tabStop,
|
|
54
|
+
ids: tabs.ids,
|
|
55
|
+
variant: tabs.variant,
|
|
56
|
+
iconOnly: tabs.iconOnly,
|
|
57
|
+
locale: resolvedLocale,
|
|
58
|
+
messages: text,
|
|
59
|
+
register(value, element) {
|
|
60
|
+
const tab = {
|
|
61
|
+
value,
|
|
62
|
+
element
|
|
63
|
+
};
|
|
64
|
+
registered.value = [...registered.value, tab];
|
|
65
|
+
return () => registered.value = registered.value.filter((other) => other !== tab);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const root = useTemplateRef("root");
|
|
69
|
+
const list = useTemplateRef("list");
|
|
70
|
+
let handle;
|
|
71
|
+
onMounted(() => {
|
|
72
|
+
handle = attachTabs(root.value, list.value, { scrollable: tabs.scrollable });
|
|
73
|
+
});
|
|
74
|
+
watch(tabs.selected, () => handle?.sync(), { flush: "post" });
|
|
75
|
+
onUpdated(() => handle?.sync());
|
|
76
|
+
onBeforeUnmount(() => handle?.detach());
|
|
77
|
+
return (_ctx, _cache) => {
|
|
78
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
79
|
+
ref_key: "root",
|
|
80
|
+
ref: root
|
|
81
|
+
}, unref(tabs).parts.root(), {
|
|
82
|
+
class: _ctx.$attrs.class,
|
|
83
|
+
style: _ctx.$attrs.style
|
|
84
|
+
}), [createElementVNode("div", mergeProps({
|
|
85
|
+
ref_key: "list",
|
|
86
|
+
ref: list
|
|
87
|
+
}, unref(mergePartAttrs)({
|
|
88
|
+
..._ctx.$attrs,
|
|
89
|
+
class: void 0,
|
|
90
|
+
style: void 0
|
|
91
|
+
}, unref(tabs).parts.list())), [renderSlot(_ctx.$slots, "default")], 16)], 16);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
export { _sfc_main as default };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { TextFieldProps } from "@rio-m3e/core";
|
|
1
|
+
import { TextFieldMessages, TextFieldProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
2
3
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
3
4
|
import "@rio-m3e/styles/text-field.css";
|
|
4
|
-
|
|
5
|
+
interface Props extends Omit<TextFieldProps, 'value'> {
|
|
6
|
+
/** A language tag for what the field says to assistive technology, as the counter's label */
|
|
7
|
+
locale?: string;
|
|
8
|
+
/** Replaces any of what the field says to assistive technology. */
|
|
9
|
+
messages?: Partial<TextFieldMessages>;
|
|
10
|
+
}
|
|
5
11
|
type __VLS_Props = Props;
|
|
6
12
|
type __VLS_Slots = {
|
|
7
13
|
/** An icon before the text, such as a search icon */
|