@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,91 @@
|
|
|
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 _sfc_main$2 from "../tooltip/Tooltip.vue.js";
|
|
5
|
+
import { tabsKey } from "./context.js";
|
|
6
|
+
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, h, inject, mergeProps, normalizeProps, onBeforeUnmount, openBlock, renderSlot, toDisplayString, unref, useSlots, useTemplateRef, withCtx, withDirectives } from "vue";
|
|
7
|
+
import { createTab, mergePartAttrs } from "@rio-m3e/core";
|
|
8
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
9
|
+
import "@rio-m3e/styles/base/density.css";
|
|
10
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
11
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
12
|
+
import "@rio-m3e/styles/base/state-layer.css";
|
|
13
|
+
import "@rio-m3e/styles/base/touch-target.css";
|
|
14
|
+
import "@rio-m3e/styles/tabs.css";
|
|
15
|
+
// src/tabs/Tab.vue
|
|
16
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
__name: "Tab",
|
|
19
|
+
props: {
|
|
20
|
+
value: {},
|
|
21
|
+
label: {},
|
|
22
|
+
badge: { type: [
|
|
23
|
+
Boolean,
|
|
24
|
+
Number,
|
|
25
|
+
String
|
|
26
|
+
] },
|
|
27
|
+
disabled: { type: Boolean },
|
|
28
|
+
softDisabled: { type: Boolean }
|
|
29
|
+
},
|
|
30
|
+
emits: ["click"],
|
|
31
|
+
setup(__props, { emit: __emit }) {
|
|
32
|
+
const props = __props;
|
|
33
|
+
const emit = __emit;
|
|
34
|
+
const slots = useSlots();
|
|
35
|
+
const tabs = inject(tabsKey, void 0);
|
|
36
|
+
const locale = tabs?.locale ?? useLocale(() => void 0);
|
|
37
|
+
const messages = tabs?.messages ?? useMessages("tabs", locale, () => void 0);
|
|
38
|
+
const tab = createTab({
|
|
39
|
+
props: () => ({
|
|
40
|
+
value: props.value,
|
|
41
|
+
label: props.label,
|
|
42
|
+
badge: props.badge,
|
|
43
|
+
locale: locale.value,
|
|
44
|
+
disabled: props.disabled,
|
|
45
|
+
softDisabled: props.softDisabled
|
|
46
|
+
}),
|
|
47
|
+
tabs: () => tabs,
|
|
48
|
+
content: () => ({ icon: !!slots.default }),
|
|
49
|
+
messages: () => messages.value,
|
|
50
|
+
onClick: (event) => emit("click", event)
|
|
51
|
+
});
|
|
52
|
+
/** Wraps the tab in a plain tooltip of its label while it shows its icon alone. */
|
|
53
|
+
const WithTooltip = (_, { slots }) => tab.showsTooltip() ? h(_sfc_main$2, { text: props.label }, slots) : slots.default?.();
|
|
54
|
+
const root = useTemplateRef("root");
|
|
55
|
+
const unregister = tabs?.register(() => props.value, () => root.value, () => !!props.disabled);
|
|
56
|
+
onBeforeUnmount(() => unregister?.());
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return openBlock(), createBlock(WithTooltip, null, {
|
|
59
|
+
default: withCtx(() => [withDirectives((openBlock(), createElementBlock("button", mergeProps({
|
|
60
|
+
ref_key: "root",
|
|
61
|
+
ref: root
|
|
62
|
+
}, unref(mergePartAttrs)({
|
|
63
|
+
..._ctx.$attrs,
|
|
64
|
+
class: void 0,
|
|
65
|
+
style: void 0
|
|
66
|
+
}, unref(tab).parts.root()), {
|
|
67
|
+
class: _ctx.$attrs.class,
|
|
68
|
+
style: _ctx.$attrs.style,
|
|
69
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(tab).handleClick && unref(tab).handleClick(...args))
|
|
70
|
+
}), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.touch())), null, 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.content())), [
|
|
71
|
+
unref(tab).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(tab).parts.icon())), [unref(tab).badgeOnIcon() ? (openBlock(), createBlock(_sfc_main$1, {
|
|
72
|
+
key: 0,
|
|
73
|
+
value: unref(tab).badgeValue(),
|
|
74
|
+
locale: unref(locale)
|
|
75
|
+
}, {
|
|
76
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
77
|
+
_: 3
|
|
78
|
+
}, 8, ["value", "locale"])) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 16)) : createCommentVNode("v-if", true),
|
|
79
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.label())), toDisplayString(__props.label), 17),
|
|
80
|
+
unref(tab).showsInlineBadge() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(tab).parts.badge())), [createVNode(_sfc_main$1, {
|
|
81
|
+
value: unref(tab).badgeValue(),
|
|
82
|
+
locale: unref(locale)
|
|
83
|
+
}, null, 8, ["value", "locale"])], 16)) : createCommentVNode("v-if", true),
|
|
84
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(tab).parts.indicator())), null, 16)
|
|
85
|
+
], 16)], 16)), [[unref(vRipple)]])]),
|
|
86
|
+
_: 3
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
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,34 @@
|
|
|
1
|
+
import { TabValue, TabsMessages, TabsProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
3
|
+
import "@rio-m3e/styles/base/density.css";
|
|
4
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
5
|
+
import "@rio-m3e/styles/tabs.css";
|
|
6
|
+
interface Props extends Omit<TabsProps, 'selected'> {
|
|
7
|
+
/** A language tag, for badges' counts. Without it, the one provided, or the page's. */
|
|
8
|
+
locale?: string;
|
|
9
|
+
/** Replaces what a small badge says. */
|
|
10
|
+
messages?: Partial<TabsMessages>;
|
|
11
|
+
}
|
|
12
|
+
type __VLS_Props = Props;
|
|
13
|
+
type __VLS_Slots = {
|
|
14
|
+
/** The tabs (`RioTab`) */
|
|
15
|
+
default?: () => unknown;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_ModelProps = {
|
|
18
|
+
/** The selected tab's value, with `v-model`, for a tab list outside a `RioTabGroup` */
|
|
19
|
+
modelValue?: TabValue | undefined;
|
|
20
|
+
};
|
|
21
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
|
+
"update:modelValue": (value: TabValue | undefined) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
25
|
+
"onUpdate:modelValue"?: ((value: TabValue | undefined) => any) | undefined;
|
|
26
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
30
|
+
new (): {
|
|
31
|
+
$slots: S;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export { _default as default };
|
|
@@ -0,0 +1,109 @@
|
|
|
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/accent.css";
|
|
6
|
+
import "@rio-m3e/styles/base/density.css";
|
|
7
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
8
|
+
import "@rio-m3e/styles/tabs.css";
|
|
9
|
+
// src/tabs/Tabs.vue
|
|
10
|
+
/** The tabs, as they register */
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
__name: "Tabs",
|
|
14
|
+
props: /*@__PURE__*/ mergeModels({
|
|
15
|
+
locale: {},
|
|
16
|
+
messages: {},
|
|
17
|
+
variant: {},
|
|
18
|
+
scrollable: { type: Boolean },
|
|
19
|
+
align: {},
|
|
20
|
+
iconOnly: { type: Boolean },
|
|
21
|
+
tooltips: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: () => void 0
|
|
24
|
+
},
|
|
25
|
+
label: {},
|
|
26
|
+
color: {},
|
|
27
|
+
density: {}
|
|
28
|
+
}, {
|
|
29
|
+
"modelValue": {},
|
|
30
|
+
"modelModifiers": {}
|
|
31
|
+
}),
|
|
32
|
+
emits: ["update:modelValue"],
|
|
33
|
+
setup(__props) {
|
|
34
|
+
/** The selected tab's value, with `v-model`, for a tab list outside a `RioTabGroup` */
|
|
35
|
+
const model = useModel(__props, "modelValue");
|
|
36
|
+
const group = inject(tabGroupKey, void 0);
|
|
37
|
+
const registered = shallowRef([]);
|
|
38
|
+
/**
|
|
39
|
+
* The tabs' values, in the page's order, once each has its element; until then, as they
|
|
40
|
+
* registered, as on a server
|
|
41
|
+
*/
|
|
42
|
+
const values = () => inDocumentOrder(registered.value, (tab) => tab.element()).map((tab) => tab.value());
|
|
43
|
+
const tabs = createTabs({
|
|
44
|
+
props: () => ({
|
|
45
|
+
selected: model.value,
|
|
46
|
+
variant: __props.variant,
|
|
47
|
+
scrollable: __props.scrollable,
|
|
48
|
+
align: __props.align,
|
|
49
|
+
iconOnly: __props.iconOnly,
|
|
50
|
+
tooltips: __props.tooltips,
|
|
51
|
+
label: __props.label,
|
|
52
|
+
color: __props.color,
|
|
53
|
+
density: __props.density
|
|
54
|
+
}),
|
|
55
|
+
onChange: (next) => model.value = next,
|
|
56
|
+
group: () => group,
|
|
57
|
+
values,
|
|
58
|
+
disabled: (value) => registered.value.some((tab) => tab.value() === value && tab.disabled())
|
|
59
|
+
});
|
|
60
|
+
const resolvedLocale = useLocale(() => __props.locale);
|
|
61
|
+
const text = useMessages("tabs", resolvedLocale, () => __props.messages);
|
|
62
|
+
provide(tabsKey, {
|
|
63
|
+
isSelected: tabs.isSelected,
|
|
64
|
+
choose: tabs.choose,
|
|
65
|
+
tabStop: tabs.tabStop,
|
|
66
|
+
ids: tabs.ids,
|
|
67
|
+
variant: tabs.variant,
|
|
68
|
+
iconOnly: tabs.iconOnly,
|
|
69
|
+
tooltips: tabs.tooltips,
|
|
70
|
+
locale: resolvedLocale,
|
|
71
|
+
messages: text,
|
|
72
|
+
register(value, element, disabled) {
|
|
73
|
+
const tab = {
|
|
74
|
+
value,
|
|
75
|
+
element,
|
|
76
|
+
disabled
|
|
77
|
+
};
|
|
78
|
+
registered.value = [...registered.value, tab];
|
|
79
|
+
return () => registered.value = registered.value.filter((other) => other !== tab);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const root = useTemplateRef("root");
|
|
83
|
+
const list = useTemplateRef("list");
|
|
84
|
+
let handle;
|
|
85
|
+
onMounted(() => {
|
|
86
|
+
handle = attachTabs(root.value, list.value, { scrollable: tabs.scrollable });
|
|
87
|
+
});
|
|
88
|
+
watch(tabs.selected, () => handle?.sync(), { flush: "post" });
|
|
89
|
+
onUpdated(() => handle?.sync());
|
|
90
|
+
onBeforeUnmount(() => handle?.detach());
|
|
91
|
+
return (_ctx, _cache) => {
|
|
92
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
93
|
+
ref_key: "root",
|
|
94
|
+
ref: root
|
|
95
|
+
}, unref(tabs).parts.root(), {
|
|
96
|
+
class: _ctx.$attrs.class,
|
|
97
|
+
style: _ctx.$attrs.style
|
|
98
|
+
}), [createElementVNode("div", mergeProps({
|
|
99
|
+
ref_key: "list",
|
|
100
|
+
ref: list
|
|
101
|
+
}, unref(mergePartAttrs)({
|
|
102
|
+
..._ctx.$attrs,
|
|
103
|
+
class: void 0,
|
|
104
|
+
style: void 0
|
|
105
|
+
}, unref(tabs).parts.list())), [renderSlot(_ctx.$slots, "default")], 16)], 16);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
export { _sfc_main as default };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { TextFieldProps } from "@rio-m3e/core";
|
|
1
|
+
import { TextFieldMessages, TextFieldProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
3
|
+
import "@rio-m3e/styles/base/density.css";
|
|
2
4
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
3
5
|
import "@rio-m3e/styles/text-field.css";
|
|
4
|
-
|
|
6
|
+
interface Props extends Omit<TextFieldProps, 'value'> {
|
|
7
|
+
/** A language tag for what the field says to assistive technology, as the counter's label */
|
|
8
|
+
locale?: string;
|
|
9
|
+
/** Replaces any of what the field says to assistive technology. */
|
|
10
|
+
messages?: Partial<TextFieldMessages>;
|
|
11
|
+
}
|
|
5
12
|
type __VLS_Props = Props;
|
|
6
13
|
type __VLS_Slots = {
|
|
7
14
|
/** An icon before the text, such as a search icon */
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useComposingInput } from "../ime/composing.js";
|
|
2
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
3
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelText, withDirectives } from "vue";
|
|
2
4
|
import { attachTextField, createTextField, mergePartAttrs } from "@rio-m3e/core";
|
|
5
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
6
|
+
import "@rio-m3e/styles/base/density.css";
|
|
3
7
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
4
8
|
import "@rio-m3e/styles/text-field.css";
|
|
5
9
|
// src/text-field/TextField.vue
|
|
@@ -7,19 +11,29 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
7
11
|
inheritAttrs: false,
|
|
8
12
|
__name: "TextField",
|
|
9
13
|
props: /*@__PURE__*/ mergeModels({
|
|
14
|
+
locale: {},
|
|
15
|
+
messages: {},
|
|
10
16
|
variant: {},
|
|
11
17
|
label: {},
|
|
12
18
|
multiline: { type: Boolean },
|
|
13
19
|
rows: {},
|
|
20
|
+
grow: { type: Boolean },
|
|
21
|
+
maxRows: {},
|
|
14
22
|
prefix: {},
|
|
15
23
|
suffix: {},
|
|
16
24
|
supportingText: {},
|
|
17
25
|
error: { type: Boolean },
|
|
18
26
|
errorText: {},
|
|
27
|
+
color: {},
|
|
28
|
+
density: {},
|
|
19
29
|
maxlength: {},
|
|
20
30
|
required: { type: Boolean },
|
|
21
31
|
disabled: { type: Boolean },
|
|
22
|
-
readonly: { type: Boolean }
|
|
32
|
+
readonly: { type: Boolean },
|
|
33
|
+
validationMessages: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: () => void 0
|
|
36
|
+
}
|
|
23
37
|
}, {
|
|
24
38
|
"modelValue": { default: "" },
|
|
25
39
|
"modelModifiers": {}
|
|
@@ -34,6 +48,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
34
48
|
const slots = useSlots();
|
|
35
49
|
const id = useId();
|
|
36
50
|
const attrs = useAttrs();
|
|
51
|
+
const text = useMessages("textField", useLocale(() => __props.locale), () => __props.messages);
|
|
52
|
+
/** A growing field's text area, fitted to its text, as `attachTextField` reports it */
|
|
53
|
+
const fit = shallowRef();
|
|
54
|
+
/** The browser's validation message, as `attachTextField` reports it */
|
|
55
|
+
const validation = shallowRef();
|
|
37
56
|
const field = createTextField({
|
|
38
57
|
props: () => ({
|
|
39
58
|
variant: __props.variant,
|
|
@@ -41,15 +60,20 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
41
60
|
value: String(model.value),
|
|
42
61
|
multiline: __props.multiline,
|
|
43
62
|
rows: __props.rows,
|
|
63
|
+
grow: __props.grow,
|
|
64
|
+
maxRows: __props.maxRows,
|
|
44
65
|
prefix: __props.prefix,
|
|
45
66
|
suffix: __props.suffix,
|
|
46
67
|
supportingText: __props.supportingText,
|
|
47
68
|
error: __props.error,
|
|
48
69
|
errorText: __props.errorText,
|
|
70
|
+
color: __props.color,
|
|
71
|
+
density: __props.density,
|
|
49
72
|
maxlength: __props.maxlength,
|
|
50
73
|
required: __props.required,
|
|
51
74
|
disabled: __props.disabled,
|
|
52
|
-
readonly: __props.readonly
|
|
75
|
+
readonly: __props.readonly,
|
|
76
|
+
validationMessages: __props.validationMessages
|
|
53
77
|
}),
|
|
54
78
|
content: () => ({
|
|
55
79
|
leadingIcon: !!slots["leading-icon"],
|
|
@@ -63,60 +87,83 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
63
87
|
suffix: `${id}-suffix`,
|
|
64
88
|
supportingText: `${id}-supporting`,
|
|
65
89
|
counter: `${id}-counter`
|
|
66
|
-
}
|
|
90
|
+
},
|
|
91
|
+
fit: () => fit.value,
|
|
92
|
+
validation: () => validation.value,
|
|
93
|
+
messages: () => text.value
|
|
67
94
|
});
|
|
95
|
+
const { onComposition, onInput } = useComposingInput((next) => model.value = next);
|
|
68
96
|
const container = useTemplateRef("container");
|
|
69
97
|
const input = useTemplateRef("input");
|
|
70
98
|
let handle;
|
|
71
|
-
onMounted(() =>
|
|
99
|
+
onMounted(() => {
|
|
100
|
+
handle = attachTextField(container.value, () => input.value, {
|
|
101
|
+
growth: field.growth,
|
|
102
|
+
onFitChange: (next) => fit.value = next,
|
|
103
|
+
validates: field.validates,
|
|
104
|
+
onValidationChange: (next) => validation.value = next
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
onUpdated(() => handle?.update());
|
|
72
108
|
onBeforeUnmount(() => handle?.detach());
|
|
73
109
|
return (_ctx, _cache) => {
|
|
74
110
|
return openBlock(), createElementBlock("div", mergeProps(unref(field).parts.root(), {
|
|
75
111
|
class: _ctx.$attrs.class,
|
|
76
112
|
style: _ctx.$attrs.style
|
|
77
|
-
}), [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
113
|
+
}), [
|
|
114
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(field).parts.frame())), [
|
|
115
|
+
unref(field).showsOutline() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.outline())), [
|
|
116
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(field).parts.outlineStart())), null, 16),
|
|
117
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(field).parts.outlineNotch())), toDisplayString(unref(field).labelText()), 17),
|
|
118
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(field).parts.outlineEnd())), null, 16)
|
|
119
|
+
], 16)) : createCommentVNode("v-if", true),
|
|
120
|
+
unref(field).showsLabel() ? (openBlock(), createElementBlock("label", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.label())), toDisplayString(unref(field).labelText()), 17)) : createCommentVNode("v-if", true),
|
|
121
|
+
createElementVNode("div", mergeProps({
|
|
122
|
+
ref_key: "container",
|
|
123
|
+
ref: container
|
|
124
|
+
}, unref(field).parts.container()), [
|
|
125
|
+
unref(field).showsLeadingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.leadingIcon())), [renderSlot(_ctx.$slots, "leading-icon")], 16)) : createCommentVNode("v-if", true),
|
|
126
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(field).parts.content())), [
|
|
127
|
+
unref(field).showsPrefix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.prefix())), toDisplayString(__props.prefix), 17)) : createCommentVNode("v-if", true),
|
|
128
|
+
createCommentVNode(" v-model, which keeps the input as it is while an IME composes, and onInput "),
|
|
129
|
+
unref(field).singleLine() ? withDirectives((openBlock(), createElementBlock("input", mergeProps({
|
|
130
|
+
key: 1,
|
|
131
|
+
ref_key: "input",
|
|
132
|
+
ref: input,
|
|
133
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
134
|
+
onCompositionstart: _cache[1] || (_cache[1] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
135
|
+
onCompositionend: _cache[2] || (_cache[2] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
136
|
+
onInput: _cache[3] || (_cache[3] = (...args) => unref(onInput) && unref(onInput)(...args))
|
|
137
|
+
}, unref(mergePartAttrs)({
|
|
138
|
+
..._ctx.$attrs,
|
|
139
|
+
class: void 0,
|
|
140
|
+
style: void 0
|
|
141
|
+
}, unref(field).parts.input())), null, 16)), [[vModelDynamic, model.value]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
|
|
142
|
+
key: 2,
|
|
143
|
+
ref_key: "input",
|
|
144
|
+
ref: input,
|
|
145
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => model.value = $event),
|
|
146
|
+
onCompositionstart: _cache[5] || (_cache[5] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
147
|
+
onCompositionend: _cache[6] || (_cache[6] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
148
|
+
onInput: _cache[7] || (_cache[7] = (...args) => unref(onInput) && unref(onInput)(...args))
|
|
149
|
+
}, unref(mergePartAttrs)({
|
|
150
|
+
..._ctx.$attrs,
|
|
151
|
+
class: void 0,
|
|
152
|
+
style: void 0
|
|
153
|
+
}, unref(field).parts.textarea())), null, 16)), [[vModelText, model.value]]),
|
|
154
|
+
unref(field).showsSuffix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 3 }, unref(field).parts.suffix())), toDisplayString(__props.suffix), 17)) : createCommentVNode("v-if", true)
|
|
155
|
+
], 16),
|
|
156
|
+
unref(field).showsTrailingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.trailingIcon())), [renderSlot(_ctx.$slots, "trailing-icon")], 16)) : createCommentVNode("v-if", true)
|
|
157
|
+
], 16)
|
|
158
|
+
], 16),
|
|
159
|
+
unref(field).showsSupporting() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.supporting())), [
|
|
160
|
+
createCommentVNode(" A new element for the error text, so it arrives with its alert role. "),
|
|
161
|
+
unref(field).showsSupportingText() ? (openBlock(), createElementBlock("span", mergeProps({ key: unref(field).showsErrorText() ? "error" : "supporting" }, unref(field).parts.supportingText()), toDisplayString(unref(field).supportingTextNow()), 17)) : createCommentVNode("v-if", true),
|
|
162
|
+
unref(field).showsCounter() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.counter())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(field).parts.counterText())), toDisplayString(unref(field).counterText()), 17), createElementVNode("span", normalizeProps(guardReactiveProps(unref(field).parts.counterLabel())), toDisplayString(unref(field).counterLabel()), 17)], 16)) : createCommentVNode("v-if", true)
|
|
82
163
|
], 16)) : createCommentVNode("v-if", true),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
ref: container
|
|
87
|
-
}, unref(field).parts.container()), [
|
|
88
|
-
unref(field).showsLeadingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.leadingIcon())), [renderSlot(_ctx.$slots, "leading-icon")], 16)) : createCommentVNode("v-if", true),
|
|
89
|
-
createElementVNode("div", normalizeProps(guardReactiveProps(unref(field).parts.content())), [
|
|
90
|
-
unref(field).showsPrefix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.prefix())), toDisplayString(__props.prefix), 17)) : createCommentVNode("v-if", true),
|
|
91
|
-
createCommentVNode(" v-model, not :value and @input: it waits for an IME to finish composing. "),
|
|
92
|
-
unref(field).singleLine() ? withDirectives((openBlock(), createElementBlock("input", mergeProps({
|
|
93
|
-
key: 1,
|
|
94
|
-
ref_key: "input",
|
|
95
|
-
ref: input,
|
|
96
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
|
|
97
|
-
}, unref(mergePartAttrs)({
|
|
98
|
-
..._ctx.$attrs,
|
|
99
|
-
class: void 0,
|
|
100
|
-
style: void 0
|
|
101
|
-
}, unref(field).parts.input())), null, 16)), [[vModelDynamic, model.value]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
|
|
102
|
-
key: 2,
|
|
103
|
-
ref_key: "input",
|
|
104
|
-
ref: input,
|
|
105
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event)
|
|
106
|
-
}, unref(mergePartAttrs)({
|
|
107
|
-
..._ctx.$attrs,
|
|
108
|
-
class: void 0,
|
|
109
|
-
style: void 0
|
|
110
|
-
}, unref(field).parts.textarea())), null, 16)), [[vModelText, model.value]]),
|
|
111
|
-
unref(field).showsSuffix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 3 }, unref(field).parts.suffix())), toDisplayString(__props.suffix), 17)) : createCommentVNode("v-if", true)
|
|
112
|
-
], 16),
|
|
113
|
-
unref(field).showsTrailingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.trailingIcon())), [renderSlot(_ctx.$slots, "trailing-icon")], 16)) : createCommentVNode("v-if", true)
|
|
114
|
-
], 16)
|
|
115
|
-
], 16), unref(field).showsSupporting() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(field).parts.supporting())), [
|
|
116
|
-
createCommentVNode(" A new element for the error text, so it arrives with its alert role. "),
|
|
117
|
-
unref(field).showsSupportingText() ? (openBlock(), createElementBlock("span", mergeProps({ key: unref(field).showsErrorText() ? "error" : "supporting" }, unref(field).parts.supportingText()), toDisplayString(unref(field).supportingTextNow()), 17)) : createCommentVNode("v-if", true),
|
|
118
|
-
unref(field).showsCounter() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.counter())), toDisplayString(unref(field).counterText()), 17)) : createCommentVNode("v-if", true)
|
|
119
|
-
], 16)) : createCommentVNode("v-if", true)], 16);
|
|
164
|
+
createCommentVNode(" A new element for each announcement, so it arrives as an alert. "),
|
|
165
|
+
unref(field).announces() ? (openBlock(), createElementBlock("span", mergeProps({ key: unref(field).announcementKey() }, unref(field).parts.announcer()), toDisplayString(unref(field).announcementText()), 17)) : createCommentVNode("v-if", true)
|
|
166
|
+
], 16);
|
|
120
167
|
};
|
|
121
168
|
}
|
|
122
169
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RioThemeOptions } from "../rio/rio.js";
|
|
2
|
+
import "@rio-m3e/styles/theme-provider.css";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The theme for what is inside, over the one around it: what it leaves out, or gives as
|
|
6
|
+
* `undefined`, as the shapes or the typefaces, stays the outer theme's. Its `colorScheme` makes
|
|
7
|
+
* the part light or dark; without one, the part follows the page's.
|
|
8
|
+
*/
|
|
9
|
+
theme?: Partial<RioThemeOptions>;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_Slots = {
|
|
12
|
+
default?: () => unknown;
|
|
13
|
+
};
|
|
14
|
+
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>;
|
|
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,26 @@
|
|
|
1
|
+
import { localeKey } from "../locale/locale.js";
|
|
2
|
+
import { themeKey } from "./context.js";
|
|
3
|
+
import { computed, createElementBlock, defineComponent, guardReactiveProps, inject, normalizeProps, openBlock, provide, renderSlot, unref } from "vue";
|
|
4
|
+
import { createThemeProvider, resolveLocale } from "@rio-m3e/core";
|
|
5
|
+
import { createThemeStyle, languageHeightOf, nestThemeOptions } from "@rio-m3e/tokens";
|
|
6
|
+
import "@rio-m3e/styles/theme-provider.css";
|
|
7
|
+
// src/theme/ThemeProvider.vue
|
|
8
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
|
+
__name: "ThemeProvider",
|
|
10
|
+
props: { theme: {} },
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const outer = inject(themeKey, void 0);
|
|
13
|
+
const locale = inject(localeKey, void 0);
|
|
14
|
+
/** The options, nested over the outer theme's, which a provider inside nests its own over */
|
|
15
|
+
const nested = computed(() => nestThemeOptions(outer?.value, __props.theme));
|
|
16
|
+
provide(themeKey, nested);
|
|
17
|
+
const provider = createThemeProvider({ style: () => createThemeStyle({
|
|
18
|
+
...nested.value,
|
|
19
|
+
languageHeight: nested.value.languageHeight ?? languageHeightOf(resolveLocale(locale?.value))
|
|
20
|
+
}) });
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(provider).parts.root())), [renderSlot(_ctx.$slots, "default")], 16);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RioThemeOptions } from "../rio/rio.js";
|
|
2
|
+
import { ComputedRef, InjectionKey } from "vue";
|
|
3
|
+
/**
|
|
4
|
+
* What `createRio` and each `RioThemeProvider` give what is inside them: the theme's options,
|
|
5
|
+
* which a provider inside nests its own over
|
|
6
|
+
*/
|
|
7
|
+
export declare const themeKey: InjectionKey<ComputedRef<Partial<RioThemeOptions> | undefined>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HourCycle, TimePickerMessages } from "@rio-m3e/core";
|
|
1
|
+
import { AccentColor, HourCycle, TimePickerMessages } 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";
|
|
@@ -12,6 +13,11 @@ type __VLS_Props = {
|
|
|
12
13
|
hourCycle?: HourCycle;
|
|
13
14
|
/** Replaces any of the text the picker shows. */
|
|
14
15
|
messages?: Partial<TimePickerMessages>;
|
|
16
|
+
/**
|
|
17
|
+
* The theme color it takes in place of the spec's accents: `'secondary'`, `'tertiary'`,
|
|
18
|
+
* `'error'`, or a static color of the theme. Its buttons take it too.
|
|
19
|
+
*/
|
|
20
|
+
color?: AccentColor;
|
|
15
21
|
};
|
|
16
22
|
type __VLS_ModelProps = {
|
|
17
23
|
/** The time, `HH:MM` on a 24-hour clock, with `v-model`. */
|