@rio-m3e/vue 0.6.3 → 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 +3 -2
- package/dist/chip/FilterChip.vue.js +3 -0
- package/dist/chip/InputChip.vue.d.ts +1 -0
- package/dist/chip/InputChip.vue.js +3 -0
- 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 +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 +1 -0
- package/dist/icon-button/IconButton.vue.js +23 -2
- package/dist/ime/composing.js +24 -0
- package/dist/index.d.ts +68 -40
- package/dist/index.js +68 -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 +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 +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 +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/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 +5 -4
- package/dist/select/Select.vue.js +41 -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 +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 +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/package.json +6 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useLocale } from "../locale/locale.js";
|
|
2
2
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, isMemoSame, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderList, toDisplayString, unref, useId, useModel, useTemplateRef } from "vue";
|
|
3
3
|
import { attachScrollField, createScrollField } 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/scroll-field.css";
|
|
@@ -20,6 +21,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
20
21
|
invalid: { type: Boolean },
|
|
21
22
|
locale: {},
|
|
22
23
|
name: {},
|
|
24
|
+
color: {},
|
|
23
25
|
disabled: { type: Boolean },
|
|
24
26
|
softDisabled: { type: Boolean },
|
|
25
27
|
modelValue: {}
|
|
@@ -53,6 +55,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
53
55
|
invalid: invalid.value,
|
|
54
56
|
locale: locale.value,
|
|
55
57
|
name: props.name,
|
|
58
|
+
color: props.color,
|
|
56
59
|
disabled: props.disabled,
|
|
57
60
|
softDisabled: props.softDisabled
|
|
58
61
|
}),
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SearchMessages, SearchProps } 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/search.css";
|
|
5
|
+
interface Props extends Omit<SearchProps, 'open' | 'value'> {
|
|
6
|
+
/**
|
|
7
|
+
* A language tag, for the hinted text and the buttons. Without it, the one provided, or the
|
|
8
|
+
* page's.
|
|
9
|
+
*/
|
|
10
|
+
locale?: string;
|
|
11
|
+
/** Replaces the hinted text's default, the buttons' names, and what the status announces. */
|
|
12
|
+
messages?: Partial<SearchMessages>;
|
|
13
|
+
}
|
|
14
|
+
type __VLS_Props = Props;
|
|
15
|
+
type __VLS_Slots = {
|
|
16
|
+
/** The suggestions or results, as a `RioList`, shown in the view */
|
|
17
|
+
default?: () => unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Before the hinted text in the bar: a search icon by default (`search`), or an icon button,
|
|
20
|
+
* such as a menu button. The view shows a back button there.
|
|
21
|
+
*/
|
|
22
|
+
leading?: () => unknown;
|
|
23
|
+
/**
|
|
24
|
+
* Up to two icon buttons, or one and an avatar, after the text, in the bar and in the view.
|
|
25
|
+
* `open` tells which.
|
|
26
|
+
*/
|
|
27
|
+
trailing?: (props: {
|
|
28
|
+
open: boolean;
|
|
29
|
+
}) => unknown;
|
|
30
|
+
/** The view's back button's icon, in place of the one the app registered (`back`) */
|
|
31
|
+
'back-icon'?: () => unknown;
|
|
32
|
+
/** The view's clear button's icon, in place of the one the app registered (`close`) */
|
|
33
|
+
'clear-icon'?: () => unknown;
|
|
34
|
+
};
|
|
35
|
+
type __VLS_ModelProps = {
|
|
36
|
+
/** The query, with `v-model` */
|
|
37
|
+
modelValue?: string;
|
|
38
|
+
/** Whether the search view is open, with `v-model:open` */
|
|
39
|
+
'open'?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
42
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
"update:open": (value: boolean) => any;
|
|
44
|
+
"update:modelValue": (value: string) => any;
|
|
45
|
+
search: (value: string) => any;
|
|
46
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
47
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
48
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
49
|
+
onSearch?: ((value: string) => any) | undefined;
|
|
50
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
51
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
52
|
+
declare const _default: typeof __VLS_export;
|
|
53
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export { _default as default };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon-button/IconButton.vue.js";
|
|
2
|
+
import { useComposingInput } from "../ime/composing.js";
|
|
3
|
+
import _sfc_main$2 from "../icon/Icon.vue.js";
|
|
4
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
5
|
+
import { keepPresses } from "../overlay/presses.js";
|
|
6
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, shallowRef, toDisplayString, toHandlers, unref, useId, useModel, useSlots, useTemplateRef, vModelDynamic, watch, withCtx, withDirectives } from "vue";
|
|
7
|
+
import { attachSearch, createSearch, mergePartAttrs } from "@rio-m3e/core";
|
|
8
|
+
import "@rio-m3e/styles/base/focus-ring.css";
|
|
9
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
10
|
+
import "@rio-m3e/styles/search.css";
|
|
11
|
+
// src/search/Search.vue
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
__name: "Search",
|
|
15
|
+
props: /*@__PURE__*/ mergeModels({
|
|
16
|
+
locale: {},
|
|
17
|
+
messages: {},
|
|
18
|
+
placeholder: {},
|
|
19
|
+
layout: {},
|
|
20
|
+
disabled: { type: Boolean }
|
|
21
|
+
}, {
|
|
22
|
+
"modelValue": { default: "" },
|
|
23
|
+
"modelModifiers": {},
|
|
24
|
+
"open": {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
"openModifiers": {}
|
|
29
|
+
}),
|
|
30
|
+
emits: /*@__PURE__*/ mergeModels(["search"], ["update:modelValue", "update:open"]),
|
|
31
|
+
setup(__props, { emit: __emit }) {
|
|
32
|
+
/** The query, with `v-model` */
|
|
33
|
+
const model = useModel(__props, "modelValue");
|
|
34
|
+
/** Whether the search view is open, with `v-model:open` */
|
|
35
|
+
const open = useModel(__props, "open");
|
|
36
|
+
const emit = __emit;
|
|
37
|
+
const slots = useSlots();
|
|
38
|
+
const text = useMessages("search", useLocale(() => __props.locale), () => __props.messages);
|
|
39
|
+
const id = useId();
|
|
40
|
+
const compact = ref(false);
|
|
41
|
+
const results = ref(false);
|
|
42
|
+
const announcing = ref(false);
|
|
43
|
+
/** Where a docked view goes, as `attachSearch` reports it */
|
|
44
|
+
const place = shallowRef();
|
|
45
|
+
const search = createSearch({
|
|
46
|
+
props: () => ({
|
|
47
|
+
open: open.value,
|
|
48
|
+
value: model.value,
|
|
49
|
+
placeholder: __props.placeholder,
|
|
50
|
+
layout: __props.layout,
|
|
51
|
+
disabled: __props.disabled
|
|
52
|
+
}),
|
|
53
|
+
content: () => ({
|
|
54
|
+
leading: !!slots.leading,
|
|
55
|
+
trailing: !!slots.trailing
|
|
56
|
+
}),
|
|
57
|
+
messages: () => text.value,
|
|
58
|
+
ids: {
|
|
59
|
+
view: `${id}-view`,
|
|
60
|
+
text: `${id}-text`
|
|
61
|
+
},
|
|
62
|
+
compact: () => compact.value,
|
|
63
|
+
results: () => results.value,
|
|
64
|
+
announcing: () => announcing.value,
|
|
65
|
+
place: () => place.value,
|
|
66
|
+
onOpenChange: (next) => open.value = next,
|
|
67
|
+
onChange: (next) => model.value = next,
|
|
68
|
+
onSearch: (value) => emit("search", value)
|
|
69
|
+
});
|
|
70
|
+
const { onComposition, onInput } = useComposingInput((next) => model.value = String(next));
|
|
71
|
+
const bar = useTemplateRef("bar");
|
|
72
|
+
const field = useTemplateRef("field");
|
|
73
|
+
const view = useTemplateRef("view");
|
|
74
|
+
const input = useTemplateRef("input");
|
|
75
|
+
const list = useTemplateRef("results");
|
|
76
|
+
let handle;
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
handle = attachSearch({
|
|
79
|
+
bar: bar.value,
|
|
80
|
+
field: field.value,
|
|
81
|
+
view: view.value,
|
|
82
|
+
input: input.value,
|
|
83
|
+
results: list.value
|
|
84
|
+
}, {
|
|
85
|
+
onOpenChange: (next) => open.value = next,
|
|
86
|
+
onResultsChange: (next) => results.value = next,
|
|
87
|
+
onAnnounceChange: (next) => announcing.value = next,
|
|
88
|
+
onCompactChange: (next) => compact.value = next,
|
|
89
|
+
onPlaceChange: (next) => place.value = next
|
|
90
|
+
});
|
|
91
|
+
handle.sync(open.value);
|
|
92
|
+
});
|
|
93
|
+
watch(open, (next) => handle?.sync(next), { flush: "post" });
|
|
94
|
+
onUpdated(() => handle?.update());
|
|
95
|
+
onBeforeUnmount(() => handle?.detach());
|
|
96
|
+
const clear = () => {
|
|
97
|
+
search.clear();
|
|
98
|
+
handle?.focusInput();
|
|
99
|
+
};
|
|
100
|
+
return (_ctx, _cache) => {
|
|
101
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(search).parts.root(), {
|
|
102
|
+
class: _ctx.$attrs.class,
|
|
103
|
+
style: _ctx.$attrs.style
|
|
104
|
+
}), [createElementVNode("div", mergeProps({
|
|
105
|
+
ref_key: "bar",
|
|
106
|
+
ref: bar
|
|
107
|
+
}, unref(search).parts.bar()), [
|
|
108
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(search).parts.leading())), [renderSlot(_ctx.$slots, "leading", {}, () => [createVNode(_sfc_main$2, { alias: "search" })])], 16),
|
|
109
|
+
createElementVNode("button", mergeProps({
|
|
110
|
+
ref_key: "field",
|
|
111
|
+
ref: field
|
|
112
|
+
}, unref(search).parts.field(), {
|
|
113
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(search).handleFieldClick && unref(search).handleFieldClick(...args)),
|
|
114
|
+
onKeydown: _cache[1] || (_cache[1] = (...args) => unref(search).handleFieldKeydown && unref(search).handleFieldKeydown(...args))
|
|
115
|
+
}), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(search).parts.text())), toDisplayString(unref(search).fieldText()), 17)], 16),
|
|
116
|
+
unref(search).showsTrailing() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(search).parts.trailing())), [renderSlot(_ctx.$slots, "trailing", { open: false })], 16)) : createCommentVNode("v-if", true)
|
|
117
|
+
], 16), createElementVNode("dialog", mergeProps({
|
|
118
|
+
ref_key: "view",
|
|
119
|
+
ref: view
|
|
120
|
+
}, unref(search).parts.view(), toHandlers(unref(keepPresses), true)), [
|
|
121
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(search).parts.header())), [
|
|
122
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(search).parts.back())), [createVNode(_sfc_main$1, {
|
|
123
|
+
label: unref(text).back,
|
|
124
|
+
variant: "standard",
|
|
125
|
+
onClick: unref(search).close
|
|
126
|
+
}, {
|
|
127
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "back-icon", {}, () => [createVNode(_sfc_main$2, { alias: "back" })])]),
|
|
128
|
+
_: 3
|
|
129
|
+
}, 8, ["label", "onClick"])], 16),
|
|
130
|
+
createElementVNode("form", mergeProps(unref(search).parts.form(), { onSubmit: _cache[6] || (_cache[6] = (...args) => unref(search).handleSubmit && unref(search).handleSubmit(...args)) }), [createCommentVNode(" v-model, which keeps the input as it is while an IME composes, and onInput "), withDirectives(createElementVNode("input", mergeProps({
|
|
131
|
+
ref_key: "input",
|
|
132
|
+
ref: input,
|
|
133
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
|
|
134
|
+
onCompositionstart: _cache[3] || (_cache[3] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
135
|
+
onCompositionend: _cache[4] || (_cache[4] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
|
|
136
|
+
onInput: _cache[5] || (_cache[5] = (...args) => unref(onInput) && unref(onInput)(...args))
|
|
137
|
+
}, unref(mergePartAttrs)({
|
|
138
|
+
..._ctx.$attrs,
|
|
139
|
+
class: void 0,
|
|
140
|
+
style: void 0
|
|
141
|
+
}, unref(search).parts.input())), null, 16), [[vModelDynamic, model.value]])], 16),
|
|
142
|
+
unref(search).showsClear() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(search).parts.clear())), [createVNode(_sfc_main$1, {
|
|
143
|
+
label: unref(text).clear,
|
|
144
|
+
variant: "standard",
|
|
145
|
+
onClick: clear
|
|
146
|
+
}, {
|
|
147
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "clear-icon", {}, () => [createVNode(_sfc_main$2, { alias: "close" })])]),
|
|
148
|
+
_: 3
|
|
149
|
+
}, 8, ["label"])], 16)) : createCommentVNode("v-if", true),
|
|
150
|
+
unref(search).showsTrailing() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(search).parts.viewTrailing())), [renderSlot(_ctx.$slots, "trailing", { open: true })], 16)) : createCommentVNode("v-if", true)
|
|
151
|
+
], 16),
|
|
152
|
+
createElementVNode("div", mergeProps({
|
|
153
|
+
ref_key: "results",
|
|
154
|
+
ref: results
|
|
155
|
+
}, unref(search).parts.results()), [renderSlot(_ctx.$slots, "default")], 16),
|
|
156
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(search).parts.status())), toDisplayString(unref(search).statusText()), 17)
|
|
157
|
+
], 16)], 16);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineComponent, renderSlot } from "vue";
|
|
2
|
+
// src/select/AfterOptions.vue
|
|
3
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
4
|
+
__name: "AfterOptions",
|
|
5
|
+
setup(__props) {
|
|
6
|
+
return (_ctx, _cache) => {
|
|
7
|
+
return renderSlot(_ctx.$slots, "default");
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { _sfc_main as default };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { SelectProps, SelectSelected, SelectValue } 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/base/direction.css";
|
|
4
5
|
import "@rio-m3e/styles/base/anchored-position.css";
|
|
5
|
-
import "@rio-m3e/styles/text-field.css";
|
|
6
6
|
import "@rio-m3e/styles/menu.css";
|
|
7
|
+
import "@rio-m3e/styles/text-field.css";
|
|
7
8
|
import "@rio-m3e/styles/select.css";
|
|
8
9
|
type Props = Omit<SelectProps, 'selected' | 'open'>;
|
|
9
10
|
type __VLS_Props = Props;
|
|
10
11
|
type __VLS_Slots = {
|
|
11
|
-
/** `RioSelectOption`s */
|
|
12
|
+
/** `RioSelectOption`s. Give each its `label` for the field to show it in a server render. */
|
|
12
13
|
default?: () => unknown;
|
|
13
14
|
/** An icon before the selection */
|
|
14
15
|
'leading-icon'?: () => unknown;
|
|
@@ -34,11 +35,11 @@ type __VLS_ModelProps = {
|
|
|
34
35
|
};
|
|
35
36
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
36
37
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
-
"update:modelValue": (value: SelectSelected) => any;
|
|
38
38
|
"update:open": (value: boolean) => any;
|
|
39
|
+
"update:modelValue": (value: SelectSelected) => any;
|
|
39
40
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
40
|
-
"onUpdate:modelValue"?: ((value: SelectSelected) => any) | undefined;
|
|
41
41
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
42
|
+
"onUpdate:modelValue"?: ((value: SelectSelected) => any) | undefined;
|
|
42
43
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
44
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
44
45
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { keepPresses } from "../overlay/presses.js";
|
|
2
|
+
import _sfc_main$1 from "./AfterOptions.vue.js";
|
|
2
3
|
import { selectKey } from "./context.js";
|
|
3
|
-
import _sfc_main$
|
|
4
|
-
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, renderList, renderSlot, shallowReactive, toDisplayString, toHandlers, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
|
|
5
|
-
import { attachSelect, createSelect, mergePartAttrs } from "@rio-m3e/core";
|
|
4
|
+
import _sfc_main$2 from "../icon/Icon.vue.js";
|
|
5
|
+
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, renderList, renderSlot, shallowReactive, toDisplayString, toHandlers, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
6
|
+
import { attachSelect, createSelect, inDocumentOrder, mergePartAttrs } from "@rio-m3e/core";
|
|
7
|
+
import "@rio-m3e/styles/base/accent.css";
|
|
6
8
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
7
9
|
import "@rio-m3e/styles/base/direction.css";
|
|
8
10
|
import "@rio-m3e/styles/base/anchored-position.css";
|
|
9
|
-
import "@rio-m3e/styles/text-field.css";
|
|
10
11
|
import "@rio-m3e/styles/menu.css";
|
|
12
|
+
import "@rio-m3e/styles/text-field.css";
|
|
11
13
|
import "@rio-m3e/styles/select.css";
|
|
12
14
|
// src/select/Select.vue
|
|
13
15
|
const _hoisted_1 = {
|
|
14
16
|
key: 0,
|
|
15
17
|
value: ""
|
|
16
18
|
};
|
|
17
|
-
const _hoisted_2 = ["value"];
|
|
19
|
+
const _hoisted_2 = ["value", "selected"];
|
|
18
20
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
19
21
|
inheritAttrs: false,
|
|
20
22
|
__name: "Select",
|
|
@@ -25,6 +27,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
25
27
|
supportingText: {},
|
|
26
28
|
error: { type: Boolean },
|
|
27
29
|
errorText: {},
|
|
30
|
+
color: {},
|
|
28
31
|
required: { type: Boolean },
|
|
29
32
|
disabled: { type: Boolean },
|
|
30
33
|
name: {},
|
|
@@ -49,14 +52,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
49
52
|
const slots = useSlots();
|
|
50
53
|
const entries = shallowReactive([]);
|
|
51
54
|
/** The options, in the order they appear once rendered */
|
|
52
|
-
const options = () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
value: entry.value(),
|
|
57
|
-
label: entry.label()
|
|
58
|
-
}));
|
|
59
|
-
};
|
|
55
|
+
const options = () => inDocumentOrder(entries, (entry) => entry.element()).map((entry) => ({
|
|
56
|
+
value: entry.value(),
|
|
57
|
+
label: entry.label()
|
|
58
|
+
}));
|
|
60
59
|
const id = useId();
|
|
61
60
|
const attrs = useAttrs();
|
|
62
61
|
const select = createSelect({
|
|
@@ -69,6 +68,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
69
68
|
supportingText: __props.supportingText,
|
|
70
69
|
error: __props.error,
|
|
71
70
|
errorText: __props.errorText,
|
|
71
|
+
color: __props.color,
|
|
72
72
|
required: __props.required,
|
|
73
73
|
disabled: __props.disabled,
|
|
74
74
|
name: __props.name,
|
|
@@ -132,6 +132,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
132
132
|
class: _ctx.$attrs.class,
|
|
133
133
|
style: _ctx.$attrs.style
|
|
134
134
|
}), [
|
|
135
|
+
createElementVNode("div", mergeProps({
|
|
136
|
+
ref_key: "listbox",
|
|
137
|
+
ref: listbox
|
|
138
|
+
}, unref(select).parts.listbox(), toHandlers(unref(keepPresses), true)), [renderSlot(_ctx.$slots, "default")], 16),
|
|
135
139
|
createElementVNode("div", normalizeProps(guardReactiveProps(unref(select).parts.frame())), [
|
|
136
140
|
unref(select).showsOutline() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.outline())), [
|
|
137
141
|
createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.outlineStart())), null, 16),
|
|
@@ -151,29 +155,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
151
155
|
..._ctx.$attrs,
|
|
152
156
|
class: void 0,
|
|
153
157
|
style: void 0
|
|
154
|
-
}, unref(select).parts.field())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.value())), [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.
|
|
158
|
+
}, unref(select).parts.field())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.value())), [createVNode(_sfc_main$1, null, {
|
|
159
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "value", {
|
|
160
|
+
selected: unref(select).selectedValues(),
|
|
161
|
+
labels: unref(select).selectedLabels()
|
|
162
|
+
}, () => [createTextVNode(toDisplayString(unref(select).valueText()), 1)])]),
|
|
163
|
+
_: 3
|
|
164
|
+
})], 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.sizer())), [createVNode(_sfc_main$1, null, {
|
|
165
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(select).sizerTexts(), (text, index) => {
|
|
166
|
+
return openBlock(), createElementBlock("span", { key: index }, toDisplayString(text), 1);
|
|
167
|
+
}), 128))]),
|
|
168
|
+
_: 1
|
|
169
|
+
})], 16)], 16)], 16),
|
|
170
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.arrow())), [renderSlot(_ctx.$slots, "dropdown-icon", {}, () => [createVNode(_sfc_main$2, { alias: "dropdown" })])], 16),
|
|
161
171
|
createElementVNode("select", mergeProps({
|
|
162
172
|
ref_key: "native",
|
|
163
173
|
ref: native
|
|
164
|
-
}, unref(select).parts.native()), [!unref(select).multiple() ? (openBlock(), createElementBlock("option", _hoisted_1)) : createCommentVNode("v-if", true), (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
}, unref(select).parts.native()), [!unref(select).multiple() ? (openBlock(), createElementBlock("option", _hoisted_1)) : createCommentVNode("v-if", true), createVNode(_sfc_main$1, null, {
|
|
175
|
+
default: withCtx(() => [createCommentVNode(" `selected`, which a server render writes as the attribute, so it submits the\n selection before the page runs "), (openBlock(true), createElementBlock(Fragment, null, renderList(options(), (option) => {
|
|
176
|
+
return openBlock(), createElementBlock("option", {
|
|
177
|
+
key: unref(select).nativeValue(option.value),
|
|
178
|
+
value: unref(select).nativeValue(option.value),
|
|
179
|
+
selected: unref(select).isSelected(option.value)
|
|
180
|
+
}, toDisplayString(option.label), 9, _hoisted_2);
|
|
181
|
+
}), 128))]),
|
|
182
|
+
_: 1
|
|
183
|
+
})], 16)
|
|
170
184
|
], 16)
|
|
171
185
|
], 16),
|
|
172
|
-
unref(select).showsSupporting() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.supporting())), [createCommentVNode(" A new element for the error text, so it arrives with its alert role. "), (openBlock(), createElementBlock("span", mergeProps({ key: unref(select).showsErrorText() ? "error" : "supporting" }, unref(select).parts.supportingText()), toDisplayString(unref(select).supportingTextNow()), 17))], 16)) : createCommentVNode("v-if", true)
|
|
173
|
-
createElementVNode("div", mergeProps({
|
|
174
|
-
ref_key: "listbox",
|
|
175
|
-
ref: listbox
|
|
176
|
-
}, unref(select).parts.listbox(), toHandlers(unref(keepPresses), true)), [renderSlot(_ctx.$slots, "default")], 16)
|
|
186
|
+
unref(select).showsSupporting() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.supporting())), [createCommentVNode(" A new element for the error text, so it arrives with its alert role. "), (openBlock(), createElementBlock("span", mergeProps({ key: unref(select).showsErrorText() ? "error" : "supporting" }, unref(select).parts.supportingText()), toDisplayString(unref(select).supportingTextNow()), 17))], 16)) : createCommentVNode("v-if", true)
|
|
177
187
|
], 16);
|
|
178
188
|
};
|
|
179
189
|
}
|
|
@@ -4,7 +4,10 @@ import "@rio-m3e/styles/base/state-layer.css";
|
|
|
4
4
|
import "@rio-m3e/styles/base/direction.css";
|
|
5
5
|
import "@rio-m3e/styles/menu.css";
|
|
6
6
|
type __VLS_Slots = {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The label as the option shows it. Without it, the `label` prop. The field shows the `label`
|
|
9
|
+
* prop while the option is selected, or else this text.
|
|
10
|
+
*/
|
|
8
11
|
default?: () => unknown;
|
|
9
12
|
/**
|
|
10
13
|
* A leading icon, hidden from assistive technology. `selected` lets it show a check mark next to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vRipple } from "../ripple/ripple.js";
|
|
2
2
|
import { selectKey } from "./context.js";
|
|
3
|
-
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, unref, useSlots, useTemplateRef, withDirectives } from "vue";
|
|
3
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, unref, useSlots, useTemplateRef, withDirectives } from "vue";
|
|
4
4
|
import { createSelectOption } from "@rio-m3e/core";
|
|
5
5
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
6
6
|
import "@rio-m3e/styles/base/state-layer.css";
|
|
@@ -11,15 +11,18 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
11
11
|
__name: "SelectOption",
|
|
12
12
|
props: {
|
|
13
13
|
value: {},
|
|
14
|
+
label: {},
|
|
14
15
|
disabled: { type: Boolean }
|
|
15
16
|
},
|
|
16
17
|
setup(__props) {
|
|
17
18
|
const slots = useSlots();
|
|
18
19
|
const select = inject(selectKey, void 0);
|
|
19
20
|
if (!select) throw new Error("RioSelectOption has to be inside a RioSelect.");
|
|
21
|
+
const text = ref("");
|
|
20
22
|
const option = createSelectOption({
|
|
21
23
|
props: () => ({
|
|
22
24
|
value: __props.value,
|
|
25
|
+
label: __props.label,
|
|
23
26
|
disabled: __props.disabled
|
|
24
27
|
}),
|
|
25
28
|
content: () => ({
|
|
@@ -28,15 +31,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
28
31
|
trailingText: !!slots["trailing-text"],
|
|
29
32
|
trailingIcon: !!slots["trailing-icon"]
|
|
30
33
|
}),
|
|
31
|
-
select: () => select
|
|
34
|
+
select: () => select,
|
|
35
|
+
text: () => text.value
|
|
32
36
|
});
|
|
33
37
|
const root = useTemplateRef("root");
|
|
34
38
|
const labelElement = useTemplateRef("label");
|
|
35
|
-
const text = ref("");
|
|
36
39
|
const read = () => text.value = labelElement.value?.textContent?.trim() ?? "";
|
|
37
40
|
const unregister = select.register({
|
|
38
41
|
value: () => __props.value,
|
|
39
|
-
label:
|
|
42
|
+
label: option.labelText,
|
|
40
43
|
element: () => root.value
|
|
41
44
|
});
|
|
42
45
|
onMounted(read);
|
|
@@ -49,7 +52,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
49
52
|
}, unref(option).parts.root(), { onClick: _cache[0] || (_cache[0] = (...args) => unref(option).handleClick && unref(option).handleClick(...args)) }), [
|
|
50
53
|
createElementVNode("span", normalizeProps(guardReactiveProps(unref(option).parts.touch())), null, 16),
|
|
51
54
|
unref(option).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(option).parts.icon())), [renderSlot(_ctx.$slots, "icon", { selected: unref(option).selected() })], 16)) : createCommentVNode("v-if", true),
|
|
52
|
-
createElementVNode("span", normalizeProps(guardReactiveProps(unref(option).parts.text())), [createElementVNode("span", mergeProps({ ref: "label" }, unref(option).parts.label()), [renderSlot(_ctx.$slots, "default")], 16), unref(option).showsSupportingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(option).parts.supportingText())), [renderSlot(_ctx.$slots, "supporting-text")], 16)) : createCommentVNode("v-if", true)], 16),
|
|
55
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(option).parts.text())), [createElementVNode("span", mergeProps({ ref: "label" }, unref(option).parts.label()), [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(unref(option).labelText()), 1)])], 16), unref(option).showsSupportingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(option).parts.supportingText())), [renderSlot(_ctx.$slots, "supporting-text")], 16)) : createCommentVNode("v-if", true)], 16),
|
|
53
56
|
unref(option).showsTrailingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(option).parts.trailingText())), [renderSlot(_ctx.$slots, "trailing-text")], 16)) : createCommentVNode("v-if", true),
|
|
54
57
|
unref(option).showsTrailingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 2 }, unref(option).parts.trailingIcon())), [renderSlot(_ctx.$slots, "trailing-icon")], 16)) : createCommentVNode("v-if", true)
|
|
55
58
|
], 16)), [[unref(vRipple)]]);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SheetMessages, SideSheetProps } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
3
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
4
|
+
import "@rio-m3e/styles/sheet.css";
|
|
5
|
+
interface Props extends Omit<SideSheetProps, 'open'> {
|
|
6
|
+
/** Names the sheet. Without it, give the sheet an `aria-label`. */
|
|
7
|
+
headline?: string;
|
|
8
|
+
/** A language tag, for the buttons' names. Without it, the one provided, or the page's. */
|
|
9
|
+
locale?: string;
|
|
10
|
+
/** Replaces the sheet's own words: its name, and the buttons'. */
|
|
11
|
+
messages?: Partial<SheetMessages>;
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = Props;
|
|
14
|
+
type __VLS_Slots = {
|
|
15
|
+
/** The content, which scrolls when it doesn't fit */
|
|
16
|
+
default?: () => unknown;
|
|
17
|
+
/** Buttons below the content, as Save and Cancel */
|
|
18
|
+
actions?: () => unknown;
|
|
19
|
+
/** The back button's icon, in place of the one the app registered (`back`) */
|
|
20
|
+
'back-icon'?: () => unknown;
|
|
21
|
+
/** The close button's icon, in place of the one the app registered (`close`) */
|
|
22
|
+
'close-icon'?: () => unknown;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_ModelProps = {
|
|
25
|
+
/** Whether the sheet is shown, with `v-model:open`. */
|
|
26
|
+
'open'?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
29
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
back: (event: MouseEvent) => any;
|
|
32
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
33
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
34
|
+
onBack?: ((event: MouseEvent) => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export { _default as default };
|
|
@@ -0,0 +1,103 @@
|
|
|
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 { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, toHandlers, unref, useId, useModel, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
6
|
+
import { attachSideSheet, createSideSheet } from "@rio-m3e/core";
|
|
7
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
8
|
+
import "@rio-m3e/styles/base/direction.css";
|
|
9
|
+
import "@rio-m3e/styles/sheet.css";
|
|
10
|
+
// src/side-sheet/SideSheet.vue
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
__name: "SideSheet",
|
|
13
|
+
props: /*@__PURE__*/ mergeModels({
|
|
14
|
+
headline: {},
|
|
15
|
+
locale: {},
|
|
16
|
+
messages: {},
|
|
17
|
+
modal: { type: Boolean },
|
|
18
|
+
backButton: { type: Boolean }
|
|
19
|
+
}, {
|
|
20
|
+
"open": {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
"openModifiers": {}
|
|
25
|
+
}),
|
|
26
|
+
emits: /*@__PURE__*/ mergeModels(["back"], ["update:open"]),
|
|
27
|
+
setup(__props, { emit: __emit }) {
|
|
28
|
+
/** Whether the sheet is shown, with `v-model:open`. */
|
|
29
|
+
const open = useModel(__props, "open");
|
|
30
|
+
const emit = __emit;
|
|
31
|
+
const slots = useSlots();
|
|
32
|
+
const text = useMessages("sheet", useLocale(() => __props.locale), () => __props.messages);
|
|
33
|
+
const id = useId();
|
|
34
|
+
const sheet = createSideSheet({
|
|
35
|
+
props: () => ({
|
|
36
|
+
open: open.value,
|
|
37
|
+
modal: __props.modal,
|
|
38
|
+
backButton: __props.backButton
|
|
39
|
+
}),
|
|
40
|
+
content: () => ({
|
|
41
|
+
headline: !!__props.headline,
|
|
42
|
+
actions: !!slots.actions
|
|
43
|
+
}),
|
|
44
|
+
messages: () => text.value,
|
|
45
|
+
ids: { headline: `${id}-headline` },
|
|
46
|
+
onOpenChange: (next) => open.value = next
|
|
47
|
+
});
|
|
48
|
+
const shown = ref(open.value);
|
|
49
|
+
watch(open, (next) => {
|
|
50
|
+
if (next) shown.value = true;
|
|
51
|
+
else if (!sheet.modal()) shown.value = false;
|
|
52
|
+
});
|
|
53
|
+
const rendered = computed(() => !sheet.modal() || shown.value);
|
|
54
|
+
const root = useTemplateRef("root");
|
|
55
|
+
let handle;
|
|
56
|
+
watch(root, (element) => {
|
|
57
|
+
const before = handle;
|
|
58
|
+
handle = element ? attachSideSheet(element, {
|
|
59
|
+
onOpenChange: (next) => open.value = next,
|
|
60
|
+
onClosed: () => {
|
|
61
|
+
if (!open.value) shown.value = false;
|
|
62
|
+
},
|
|
63
|
+
from: before
|
|
64
|
+
}) : void 0;
|
|
65
|
+
before?.detach();
|
|
66
|
+
handle?.sync(open.value);
|
|
67
|
+
}, { flush: "post" });
|
|
68
|
+
watch(open, (next) => handle?.sync(next), { flush: "post" });
|
|
69
|
+
onBeforeUnmount(() => handle?.detach());
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(sheet).modal() ? "dialog" : "div"), mergeProps({
|
|
72
|
+
ref_key: "root",
|
|
73
|
+
ref: root
|
|
74
|
+
}, unref(sheet).parts.root(), toHandlers(unref(sheet).modal() ? unref(keepPresses) : {})), {
|
|
75
|
+
default: withCtx(() => [rendered.value ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(sheet).parts.panel())), [
|
|
76
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(sheet).parts.header())), [
|
|
77
|
+
unref(sheet).showsBack() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(sheet).parts.back())), [createVNode(_sfc_main$1, {
|
|
78
|
+
label: unref(text).back,
|
|
79
|
+
variant: "standard",
|
|
80
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("back", $event))
|
|
81
|
+
}, {
|
|
82
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "back-icon", {}, () => [createVNode(_sfc_main$2, { alias: "back" })])]),
|
|
83
|
+
_: 3
|
|
84
|
+
}, 8, ["label"])], 16)) : createCommentVNode("v-if", true),
|
|
85
|
+
unref(sheet).showsHeadline() ? (openBlock(), createElementBlock("h2", normalizeProps(mergeProps({ key: 1 }, unref(sheet).parts.headline())), toDisplayString(__props.headline), 17)) : createCommentVNode("v-if", true),
|
|
86
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(sheet).parts.close())), [createVNode(_sfc_main$1, {
|
|
87
|
+
label: unref(text).close,
|
|
88
|
+
variant: "standard",
|
|
89
|
+
onClick: unref(sheet).handleClose
|
|
90
|
+
}, {
|
|
91
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "close-icon", {}, () => [createVNode(_sfc_main$2, { alias: "close" })])]),
|
|
92
|
+
_: 3
|
|
93
|
+
}, 8, ["label", "onClick"])], 16)
|
|
94
|
+
], 16),
|
|
95
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(sheet).parts.content())), [renderSlot(_ctx.$slots, "default")], 16),
|
|
96
|
+
unref(sheet).showsActions() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(sheet).parts.actions())), [renderSlot(_ctx.$slots, "actions")], 16)) : createCommentVNode("v-if", true)
|
|
97
|
+
], 16)) : createCommentVNode("v-if", true)]),
|
|
98
|
+
_: 3
|
|
99
|
+
}, 16);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export { _sfc_main as default };
|