@rio-m3e/vue 0.3.0 → 0.5.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/dist/button/Button.vue.js +12 -7
- package/dist/checkbox/Checkbox.vue.d.ts +11 -0
- package/dist/checkbox/Checkbox.vue.js +70 -0
- package/dist/date-picker/DatePicker.vue.d.ts +67 -0
- package/dist/date-picker/DatePicker.vue.js +238 -0
- package/dist/date-picker/DatePickerCalendar.vue.js +146 -0
- package/dist/date-picker/DatePickerDialog.vue.d.ts +58 -0
- package/dist/date-picker/DatePickerDialog.vue.js +199 -0
- package/dist/dialog/Dialog.vue.js +13 -4
- package/dist/icon-button/IconButton.vue.js +8 -3
- package/dist/index.d.ts +24 -11
- package/dist/index.js +24 -11
- package/dist/locale/LocaleProvider.vue.d.ts +16 -0
- package/dist/locale/LocaleProvider.vue.js +14 -0
- package/dist/locale/locale.d.ts +16 -0
- package/dist/locale/locale.js +27 -0
- package/dist/menu/SubMenu.vue.js +10 -2
- package/dist/radio/Radio.vue.d.ts +11 -0
- package/dist/radio/Radio.vue.js +70 -0
- package/dist/radio/RadioGroup.vue.d.ts +29 -0
- package/dist/radio/RadioGroup.vue.js +45 -0
- package/dist/radio/context.js +3 -0
- package/dist/rio/rio.d.ts +37 -0
- package/dist/rio/rio.js +44 -0
- package/dist/select/Select.vue.d.ts +46 -0
- package/dist/select/Select.vue.js +178 -0
- package/dist/select/SelectOption.vue.d.ts +30 -0
- package/dist/select/SelectOption.vue.js +58 -0
- package/dist/select/context.js +3 -0
- package/dist/text-field/TextField.vue.d.ts +32 -0
- package/dist/text-field/TextField.vue.js +124 -0
- package/dist/time-picker/TimeInput.vue.d.ts +25 -0
- package/dist/time-picker/TimeInput.vue.js +71 -0
- package/dist/time-picker/TimePickerBody.vue.js +46 -0
- package/dist/time-picker/TimePickerDialog.vue.d.ts +46 -0
- package/dist/time-picker/TimePickerDialog.vue.js +142 -0
- package/dist/tooltip/Tooltip.vue.js +22 -9
- package/package.json +4 -4
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import _sfc_main$1 from "../button/Button.vue.js";
|
|
2
|
+
import _sfc_main$2 from "../icon-button/IconButton.vue.js";
|
|
3
|
+
import { useLocale, useMessages } from "../locale/locale.js";
|
|
4
|
+
import _sfc_main$3 from "../text-field/TextField.vue.js";
|
|
5
|
+
import _sfc_main$4 from "./DatePickerCalendar.vue.js";
|
|
6
|
+
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, openBlock, reactive, ref, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
7
|
+
import { attachDialog, createDatePickerDialog, initialPickerState } 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/base/state-layer.css";
|
|
11
|
+
import "@rio-m3e/styles/date-picker.css";
|
|
12
|
+
import "@rio-m3e/styles/dialog.css";
|
|
13
|
+
// src/date-picker/DatePickerDialog.vue
|
|
14
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
15
|
+
__name: "DatePickerDialog",
|
|
16
|
+
props: /*@__PURE__*/ mergeModels({
|
|
17
|
+
min: {},
|
|
18
|
+
max: {},
|
|
19
|
+
isDateDisabled: { type: Function },
|
|
20
|
+
locale: {},
|
|
21
|
+
firstDayOfWeek: {},
|
|
22
|
+
messages: {},
|
|
23
|
+
initialMode: {},
|
|
24
|
+
clearable: { type: Boolean }
|
|
25
|
+
}, {
|
|
26
|
+
"modelValue": {},
|
|
27
|
+
"modelModifiers": {},
|
|
28
|
+
"open": {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
"openModifiers": {}
|
|
33
|
+
}),
|
|
34
|
+
emits: ["update:modelValue", "update:open"],
|
|
35
|
+
setup(__props) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
/** The chosen date, `YYYY-MM-DD`, with `v-model`. It changes on OK. */
|
|
38
|
+
const model = useModel(__props, "modelValue");
|
|
39
|
+
/** Whether the dialog is shown, with `v-model:open`. */
|
|
40
|
+
const open = useModel(__props, "open");
|
|
41
|
+
const locale = useLocale(() => props.locale);
|
|
42
|
+
const messages = useMessages("datePicker", locale, () => props.messages);
|
|
43
|
+
const state = reactive(initialPickerState(model.value, locale.value, props));
|
|
44
|
+
const rendered = ref(open.value);
|
|
45
|
+
const id = useId();
|
|
46
|
+
const dialog = createDatePickerDialog({
|
|
47
|
+
props: () => ({
|
|
48
|
+
value: model.value,
|
|
49
|
+
open: open.value,
|
|
50
|
+
min: props.min,
|
|
51
|
+
max: props.max,
|
|
52
|
+
locale: locale.value,
|
|
53
|
+
clearable: props.clearable,
|
|
54
|
+
initialMode: props.initialMode,
|
|
55
|
+
rendered: rendered.value
|
|
56
|
+
}),
|
|
57
|
+
isDateDisabled: (date) => !!props.isDateDisabled?.(date),
|
|
58
|
+
messages: () => messages.value,
|
|
59
|
+
state: () => state,
|
|
60
|
+
ids: {
|
|
61
|
+
title: `${id}-title`,
|
|
62
|
+
headline: `${id}-headline`
|
|
63
|
+
},
|
|
64
|
+
onChange: (next) => model.value = next,
|
|
65
|
+
onOpenChange: (next) => open.value = next,
|
|
66
|
+
onStateChange: (next) => Object.assign(state, next)
|
|
67
|
+
});
|
|
68
|
+
if (open.value) dialog.opened();
|
|
69
|
+
watch(open, (next) => {
|
|
70
|
+
if (!next) return;
|
|
71
|
+
dialog.opened();
|
|
72
|
+
rendered.value = true;
|
|
73
|
+
});
|
|
74
|
+
const root = useTemplateRef("root");
|
|
75
|
+
const calendar = useTemplateRef("calendar");
|
|
76
|
+
let handle;
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
handle = attachDialog(root.value, {
|
|
79
|
+
onOpenChange: (next) => open.value = next,
|
|
80
|
+
onClosed: () => {
|
|
81
|
+
if (!open.value) rendered.value = false;
|
|
82
|
+
},
|
|
83
|
+
initialFocus: () => root.value?.querySelector(state.mode === "calendar" ? "[data-date][tabindex=\"0\"]" : "input")
|
|
84
|
+
});
|
|
85
|
+
handle.sync(open.value);
|
|
86
|
+
});
|
|
87
|
+
watch(open, (next) => handle?.sync(next), { flush: "post" });
|
|
88
|
+
watch(() => state.mode, async (next) => {
|
|
89
|
+
await nextTick();
|
|
90
|
+
if (!open.value) return;
|
|
91
|
+
if (next === "calendar") calendar.value?.focus();
|
|
92
|
+
else root.value?.querySelector("input")?.focus();
|
|
93
|
+
});
|
|
94
|
+
onBeforeUnmount(() => handle?.detach());
|
|
95
|
+
return (_ctx, _cache) => {
|
|
96
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" Clicks and presses stay in the dialog, as in RioDialog. "), createElementVNode("dialog", mergeProps({
|
|
97
|
+
ref_key: "root",
|
|
98
|
+
ref: root
|
|
99
|
+
}, unref(dialog).parts.root(), {
|
|
100
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"])),
|
|
101
|
+
onAuxclick: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"])),
|
|
102
|
+
onDblclick: _cache[6] || (_cache[6] = withModifiers(() => {}, ["stop"])),
|
|
103
|
+
onPointerdown: _cache[7] || (_cache[7] = withModifiers(() => {}, ["stop"])),
|
|
104
|
+
onPointerup: _cache[8] || (_cache[8] = withModifiers(() => {}, ["stop"])),
|
|
105
|
+
onMousedown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["stop"])),
|
|
106
|
+
onMouseup: _cache[10] || (_cache[10] = withModifiers(() => {}, ["stop"])),
|
|
107
|
+
onContextmenu: _cache[11] || (_cache[11] = withModifiers(() => {}, ["stop"]))
|
|
108
|
+
}), [rendered.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
109
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.header())), [
|
|
110
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.title())), toDisplayString(unref(messages).title), 17),
|
|
111
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.headline())), toDisplayString(unref(dialog).headline()), 17),
|
|
112
|
+
createVNode(_sfc_main$2, {
|
|
113
|
+
variant: "standard",
|
|
114
|
+
label: unref(dialog).modeButtonLabel(),
|
|
115
|
+
onClick: unref(dialog).switchMode
|
|
116
|
+
}, {
|
|
117
|
+
default: withCtx(() => [state.mode === "calendar" ? renderSlot(_ctx.$slots, "edit-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "calendar-icon", {}, void 0, void 0, 1)]),
|
|
118
|
+
_: 3
|
|
119
|
+
}, 8, ["label", "onClick"])
|
|
120
|
+
], 16),
|
|
121
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.divider())), null, 16),
|
|
122
|
+
unref(dialog).calendarMode() ? (openBlock(), createBlock(_sfc_main$4, {
|
|
123
|
+
key: 0,
|
|
124
|
+
ref_key: "calendar",
|
|
125
|
+
ref: calendar,
|
|
126
|
+
month: state.month,
|
|
127
|
+
"onUpdate:month": _cache[0] || (_cache[0] = ($event) => state.month = $event),
|
|
128
|
+
focused: state.focused,
|
|
129
|
+
"onUpdate:focused": _cache[1] || (_cache[1] = ($event) => state.focused = $event),
|
|
130
|
+
view: state.view,
|
|
131
|
+
"onUpdate:view": _cache[2] || (_cache[2] = ($event) => state.view = $event),
|
|
132
|
+
variant: "modal",
|
|
133
|
+
selected: state.draft,
|
|
134
|
+
min: __props.min,
|
|
135
|
+
max: __props.max,
|
|
136
|
+
locale: unref(locale),
|
|
137
|
+
"first-day-of-week": __props.firstDayOfWeek,
|
|
138
|
+
"is-date-disabled": __props.isDateDisabled,
|
|
139
|
+
messages: unref(messages),
|
|
140
|
+
onSelect: unref(dialog).select
|
|
141
|
+
}, {
|
|
142
|
+
"previous-icon": withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
|
|
143
|
+
"next-icon": withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
|
|
144
|
+
"dropdown-icon": withCtx(() => [renderSlot(_ctx.$slots, "dropdown-icon")]),
|
|
145
|
+
_: 3
|
|
146
|
+
}, 8, [
|
|
147
|
+
"month",
|
|
148
|
+
"focused",
|
|
149
|
+
"view",
|
|
150
|
+
"selected",
|
|
151
|
+
"min",
|
|
152
|
+
"max",
|
|
153
|
+
"locale",
|
|
154
|
+
"first-day-of-week",
|
|
155
|
+
"is-date-disabled",
|
|
156
|
+
"messages",
|
|
157
|
+
"onSelect"
|
|
158
|
+
])) : createCommentVNode("v-if", true),
|
|
159
|
+
unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps(unref(dialog).field(), {
|
|
160
|
+
"model-value": state.text,
|
|
161
|
+
variant: "outlined",
|
|
162
|
+
label: unref(messages).fieldLabel,
|
|
163
|
+
autocomplete: "off",
|
|
164
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = (text) => unref(dialog).textInput(String(text))),
|
|
165
|
+
onKeydown: unref(dialog).handleFieldKeydown
|
|
166
|
+
}), null, 16, [
|
|
167
|
+
"model-value",
|
|
168
|
+
"label",
|
|
169
|
+
"onKeydown"
|
|
170
|
+
])], 16)) : createCommentVNode("v-if", true),
|
|
171
|
+
createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.actions())), [
|
|
172
|
+
unref(dialog).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
|
|
173
|
+
key: 0,
|
|
174
|
+
variant: "text",
|
|
175
|
+
onClick: unref(dialog).clear
|
|
176
|
+
}, {
|
|
177
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).clear), 1)]),
|
|
178
|
+
_: 1
|
|
179
|
+
}, 8, ["onClick"])) : createCommentVNode("v-if", true),
|
|
180
|
+
createVNode(_sfc_main$1, {
|
|
181
|
+
variant: "text",
|
|
182
|
+
onClick: unref(dialog).cancel
|
|
183
|
+
}, {
|
|
184
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).cancel), 1)]),
|
|
185
|
+
_: 1
|
|
186
|
+
}, 8, ["onClick"]),
|
|
187
|
+
createVNode(_sfc_main$1, {
|
|
188
|
+
variant: "text",
|
|
189
|
+
onClick: unref(dialog).confirm
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).ok), 1)]),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 8, ["onClick"])
|
|
194
|
+
], 16)
|
|
195
|
+
], 64)) : createCommentVNode("v-if", true)], 16)], 2112);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
export { _sfc_main as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
|
|
1
|
+
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef, watch, withModifiers } from "vue";
|
|
2
2
|
import { attachDialog, createDialog } from "@rio-m3e/core";
|
|
3
3
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
4
4
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
@@ -58,15 +58,24 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
58
58
|
onUpdated(() => handle?.update());
|
|
59
59
|
onBeforeUnmount(() => handle?.detach());
|
|
60
60
|
return (_ctx, _cache) => {
|
|
61
|
-
return openBlock(), createElementBlock("dialog", mergeProps({
|
|
61
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" Clicks and presses stay in the dialog, so a card or a row around it doesn't take them. Keys go\n on, for Escape. "), createElementVNode("dialog", mergeProps({
|
|
62
62
|
ref_key: "root",
|
|
63
63
|
ref: root
|
|
64
|
-
}, unref(dialog).parts.root()
|
|
64
|
+
}, unref(dialog).parts.root(), {
|
|
65
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
|
|
66
|
+
onAuxclick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
|
|
67
|
+
onDblclick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"])),
|
|
68
|
+
onPointerdown: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"])),
|
|
69
|
+
onPointerup: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"])),
|
|
70
|
+
onMousedown: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"])),
|
|
71
|
+
onMouseup: _cache[6] || (_cache[6] = withModifiers(() => {}, ["stop"])),
|
|
72
|
+
onContextmenu: _cache[7] || (_cache[7] = withModifiers(() => {}, ["stop"]))
|
|
73
|
+
}), [rendered.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
65
74
|
unref(dialog).showsIcon() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(dialog).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
|
|
66
75
|
unref(dialog).showsHeadline() ? (openBlock(), createElementBlock("h2", normalizeProps(mergeProps({ key: 1 }, unref(dialog).parts.headline())), toDisplayString(__props.headline), 17)) : createCommentVNode("v-if", true),
|
|
67
76
|
createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.content())), [renderSlot(_ctx.$slots, "default")], 16),
|
|
68
77
|
unref(dialog).showsActions() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 2 }, unref(dialog).parts.actions())), [renderSlot(_ctx.$slots, "actions")], 16)) : createCommentVNode("v-if", true)
|
|
69
|
-
], 64)) : createCommentVNode("v-if", true)], 16);
|
|
78
|
+
], 64)) : createCommentVNode("v-if", true)], 16)], 2112);
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
81
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useButtonGroupItem } from "../button-group/context.js";
|
|
2
2
|
import { vRipple } from "../ripple/ripple.js";
|
|
3
3
|
import { vShapeMorph } from "../shape-morph/shape-morph.js";
|
|
4
|
-
import {
|
|
4
|
+
import { createBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, unref, useSlots, withCtx, withDirectives } from "vue";
|
|
5
5
|
import { createIconButton } from "@rio-m3e/core";
|
|
6
6
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
7
7
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
@@ -22,6 +22,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
22
22
|
disabled: { type: Boolean },
|
|
23
23
|
softDisabled: { type: Boolean },
|
|
24
24
|
type: {},
|
|
25
|
+
href: {},
|
|
25
26
|
value: {}
|
|
26
27
|
},
|
|
27
28
|
emits: ["click", "update:selected"],
|
|
@@ -39,7 +40,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
39
40
|
disabled: __props.disabled,
|
|
40
41
|
softDisabled: __props.softDisabled,
|
|
41
42
|
type: __props.type,
|
|
42
|
-
value: __props.value
|
|
43
|
+
value: __props.value,
|
|
44
|
+
href: __props.href
|
|
43
45
|
}), (next) => emit("update:selected", next));
|
|
44
46
|
const button = createIconButton({
|
|
45
47
|
props: item.props,
|
|
@@ -48,7 +50,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
48
50
|
onChange: item.onChange
|
|
49
51
|
});
|
|
50
52
|
return (_ctx, _cache) => {
|
|
51
|
-
return withDirectives((openBlock(),
|
|
53
|
+
return withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(button).isLink() ? "a" : "button"), mergeProps(unref(button).parts.root(), { onClick: unref(button).handleClick }), {
|
|
54
|
+
default: withCtx(() => [createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.touch())), null, 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.icon())), [unref(button).showsSelectedIcon() ? renderSlot(_ctx.$slots, "selected-icon", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 16)]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 16, ["onClick"])), [[unref(vRipple)], [unref(vShapeMorph)]]);
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
59
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import _default from "./button/Button.vue.js";
|
|
2
2
|
import _default$1 from "./button-group/ButtonGroup.vue.js";
|
|
3
|
-
import _default$2 from "./
|
|
4
|
-
import _default$3 from "./
|
|
5
|
-
import _default$4 from "./
|
|
6
|
-
import _default$5 from "./
|
|
7
|
-
import _default$6 from "./
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import _default$2 from "./checkbox/Checkbox.vue.js";
|
|
4
|
+
import _default$3 from "./date-picker/DatePicker.vue.js";
|
|
5
|
+
import _default$4 from "./date-picker/DatePickerDialog.vue.js";
|
|
6
|
+
import _default$5 from "./dialog/Dialog.vue.js";
|
|
7
|
+
import _default$6 from "./icon-button/IconButton.vue.js";
|
|
8
|
+
import { localeKey, messagesKey, useLocale, useMessages } from "./locale/locale.js";
|
|
9
|
+
import { RioOptions, RioPlugin, RioThemeOptions, createRio } from "./rio/rio.js";
|
|
10
|
+
import _default$7 from "./locale/LocaleProvider.vue.js";
|
|
11
|
+
import _default$8 from "./menu/Menu.vue.js";
|
|
12
|
+
import _default$9 from "./menu/MenuDivider.vue.js";
|
|
13
|
+
import _default$10 from "./menu/MenuGroup.vue.js";
|
|
14
|
+
import _default$11 from "./menu/MenuItem.vue.js";
|
|
15
|
+
import _default$17 from "./menu/SubMenu.vue.js";
|
|
16
|
+
import _default$12 from "./radio/Radio.vue.js";
|
|
17
|
+
import _default$13 from "./radio/RadioGroup.vue.js";
|
|
10
18
|
import { vRipple } from "./ripple/ripple.js";
|
|
11
|
-
import _default$
|
|
12
|
-
import _default$
|
|
13
|
-
import _default$
|
|
14
|
-
|
|
19
|
+
import _default$14 from "./select/Select.vue.js";
|
|
20
|
+
import _default$15 from "./select/SelectOption.vue.js";
|
|
21
|
+
import _default$16 from "./split-button/SplitButton.vue.js";
|
|
22
|
+
import _default$18 from "./switch/Switch.vue.js";
|
|
23
|
+
import _default$19 from "./text-field/TextField.vue.js";
|
|
24
|
+
import _default$20 from "./time-picker/TimeInput.vue.js";
|
|
25
|
+
import _default$21 from "./time-picker/TimePickerDialog.vue.js";
|
|
26
|
+
import _default$22 from "./tooltip/Tooltip.vue.js";
|
|
27
|
+
export { _default as RioButton, _default$1 as RioButtonGroup, _default$2 as RioCheckbox, _default$3 as RioDatePicker, _default$4 as RioDatePickerDialog, _default$5 as RioDialog, _default$6 as RioIconButton, _default$7 as RioLocaleProvider, _default$8 as RioMenu, _default$9 as RioMenuDivider, _default$10 as RioMenuGroup, _default$11 as RioMenuItem, type RioOptions, type RioPlugin, _default$12 as RioRadio, _default$13 as RioRadioGroup, _default$14 as RioSelect, _default$15 as RioSelectOption, _default$16 as RioSplitButton, _default$17 as RioSubMenu, _default$18 as RioSwitch, _default$19 as RioTextField, type RioThemeOptions, _default$20 as RioTimeInput, _default$21 as RioTimePickerDialog, _default$22 as RioTooltip, createRio, localeKey, messagesKey, useLocale, useMessages, vRipple };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import _sfc_main from "./button/Button.vue.js";
|
|
2
2
|
import _sfc_main$1 from "./button-group/ButtonGroup.vue.js";
|
|
3
|
-
import _sfc_main$2 from "./
|
|
4
|
-
import _sfc_main$3 from "./
|
|
5
|
-
import _sfc_main$4 from "./
|
|
6
|
-
import _sfc_main$5 from "./
|
|
7
|
-
import _sfc_main$6 from "./
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import _sfc_main$2 from "./checkbox/Checkbox.vue.js";
|
|
4
|
+
import _sfc_main$3 from "./date-picker/DatePicker.vue.js";
|
|
5
|
+
import _sfc_main$4 from "./date-picker/DatePickerDialog.vue.js";
|
|
6
|
+
import _sfc_main$5 from "./dialog/Dialog.vue.js";
|
|
7
|
+
import _sfc_main$6 from "./icon-button/IconButton.vue.js";
|
|
8
|
+
import { localeKey, messagesKey, useLocale, useMessages } from "./locale/locale.js";
|
|
9
|
+
import { createRio } from "./rio/rio.js";
|
|
10
|
+
import _sfc_main$7 from "./locale/LocaleProvider.vue.js";
|
|
11
|
+
import _sfc_main$8 from "./menu/Menu.vue.js";
|
|
12
|
+
import _sfc_main$9 from "./menu/MenuDivider.vue.js";
|
|
13
|
+
import _sfc_main$10 from "./menu/MenuGroup.vue.js";
|
|
14
|
+
import _sfc_main$11 from "./menu/MenuItem.vue.js";
|
|
15
|
+
import _sfc_main$17 from "./menu/SubMenu.vue.js";
|
|
16
|
+
import _sfc_main$12 from "./radio/Radio.vue.js";
|
|
17
|
+
import _sfc_main$13 from "./radio/RadioGroup.vue.js";
|
|
10
18
|
import { vRipple } from "./ripple/ripple.js";
|
|
11
|
-
import _sfc_main$
|
|
12
|
-
import _sfc_main$
|
|
13
|
-
import _sfc_main$
|
|
14
|
-
|
|
19
|
+
import _sfc_main$14 from "./select/Select.vue.js";
|
|
20
|
+
import _sfc_main$15 from "./select/SelectOption.vue.js";
|
|
21
|
+
import _sfc_main$16 from "./split-button/SplitButton.vue.js";
|
|
22
|
+
import _sfc_main$18 from "./switch/Switch.vue.js";
|
|
23
|
+
import _sfc_main$19 from "./text-field/TextField.vue.js";
|
|
24
|
+
import _sfc_main$20 from "./time-picker/TimeInput.vue.js";
|
|
25
|
+
import _sfc_main$21 from "./time-picker/TimePickerDialog.vue.js";
|
|
26
|
+
import _sfc_main$22 from "./tooltip/Tooltip.vue.js";
|
|
27
|
+
export { _sfc_main as RioButton, _sfc_main$1 as RioButtonGroup, _sfc_main$2 as RioCheckbox, _sfc_main$3 as RioDatePicker, _sfc_main$4 as RioDatePickerDialog, _sfc_main$5 as RioDialog, _sfc_main$6 as RioIconButton, _sfc_main$7 as RioLocaleProvider, _sfc_main$8 as RioMenu, _sfc_main$9 as RioMenuDivider, _sfc_main$10 as RioMenuGroup, _sfc_main$11 as RioMenuItem, _sfc_main$12 as RioRadio, _sfc_main$13 as RioRadioGroup, _sfc_main$14 as RioSelect, _sfc_main$15 as RioSelectOption, _sfc_main$16 as RioSplitButton, _sfc_main$17 as RioSubMenu, _sfc_main$18 as RioSwitch, _sfc_main$19 as RioTextField, _sfc_main$20 as RioTimeInput, _sfc_main$21 as RioTimePickerDialog, _sfc_main$22 as RioTooltip, createRio, localeKey, messagesKey, useLocale, useMessages, vRipple };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** A language tag, such as `ko` or `en-GB`, for Rio's components inside */
|
|
3
|
+
locale?: string;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_Slots = {
|
|
6
|
+
default?: () => unknown;
|
|
7
|
+
};
|
|
8
|
+
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>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { _default as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { localeKey } from "./locale.js";
|
|
2
|
+
import { defineComponent, provide, renderSlot, toRef } from "vue";
|
|
3
|
+
// src/locale/LocaleProvider.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
__name: "LocaleProvider",
|
|
6
|
+
props: { locale: {} },
|
|
7
|
+
setup(__props) {
|
|
8
|
+
provide(localeKey, toRef(() => __props.locale));
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return renderSlot(_ctx.$slots, "default");
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey, Ref } from "vue";
|
|
2
|
+
import { MessageOptions, RioMessages } from "@rio-m3e/core";
|
|
3
|
+
/** The language a `RioLocaleProvider` or `createRio` gives the components inside */
|
|
4
|
+
export declare const localeKey: InjectionKey<Ref<string | undefined>>;
|
|
5
|
+
/** The app's message tables and fallback language, from `createRio` */
|
|
6
|
+
export declare const messagesKey: InjectionKey<Ref<MessageOptions>>;
|
|
7
|
+
/**
|
|
8
|
+
* The language a component uses: its own `locale`, or the nearest one provided, or the document's,
|
|
9
|
+
* the browser's, or English (`resolveLocale`). Call it in `setup`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useLocale(own: () => string | undefined): ComputedRef<string>;
|
|
12
|
+
/**
|
|
13
|
+
* A component's messages in its language: Rio's tables and the app's (`createRio`), with the
|
|
14
|
+
* component's own `messages` over them. Call it in `setup`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useMessages<Group extends keyof RioMessages>(group: Group, locale: Ref<string>, own: () => Partial<RioMessages[Group]> | undefined): ComputedRef<RioMessages[Group]>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { computed, inject } from "vue";
|
|
2
|
+
import { messagesFor, resolveLocale } from "@rio-m3e/core";
|
|
3
|
+
// src/locale/locale.ts
|
|
4
|
+
/** The language a `RioLocaleProvider` or `createRio` gives the components inside */
|
|
5
|
+
const localeKey = Symbol("RioLocale");
|
|
6
|
+
/** The app's message tables and fallback language, from `createRio` */
|
|
7
|
+
const messagesKey = Symbol("RioMessages");
|
|
8
|
+
/**
|
|
9
|
+
* The language a component uses: its own `locale`, or the nearest one provided, or the document's,
|
|
10
|
+
* the browser's, or English (`resolveLocale`). Call it in `setup`.
|
|
11
|
+
*/
|
|
12
|
+
function useLocale(own) {
|
|
13
|
+
const provided = inject(localeKey, void 0);
|
|
14
|
+
return computed(() => resolveLocale(own() ?? provided?.value));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A component's messages in its language: Rio's tables and the app's (`createRio`), with the
|
|
18
|
+
* component's own `messages` over them. Call it in `setup`.
|
|
19
|
+
*/
|
|
20
|
+
function useMessages(group, locale, own) {
|
|
21
|
+
const options = inject(messagesKey, void 0);
|
|
22
|
+
return computed(() => ({
|
|
23
|
+
...messagesFor(locale.value, options?.value)[group],
|
|
24
|
+
...own()
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
export { localeKey, messagesKey, useLocale, useMessages };
|
package/dist/menu/SubMenu.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vRipple } from "../ripple/ripple.js";
|
|
2
2
|
import { menuContextOf, menuKey } from "./context.js";
|
|
3
3
|
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot, toDisplayString, unref, useSlots, useTemplateRef, watch, withDirectives } from "vue";
|
|
4
|
-
import { attachSubMenu, createSubMenu } from "@rio-m3e/core";
|
|
4
|
+
import { attachSubMenu, createSubMenu, mergePartAttrs } from "@rio-m3e/core";
|
|
5
5
|
import "@rio-m3e/styles/base/focus-ring.css";
|
|
6
6
|
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
7
7
|
import "@rio-m3e/styles/base/state-layer.css";
|
|
@@ -56,7 +56,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
56
56
|
return openBlock(), createElementBlock(Fragment, null, [withDirectives((openBlock(), createElementBlock("button", mergeProps({
|
|
57
57
|
ref_key: "itemElement",
|
|
58
58
|
ref: itemElement
|
|
59
|
-
},
|
|
59
|
+
}, unref(mergePartAttrs)({
|
|
60
|
+
..._ctx.$attrs,
|
|
61
|
+
class: void 0,
|
|
62
|
+
style: void 0
|
|
63
|
+
}, unref(item).parts.root()), {
|
|
64
|
+
class: _ctx.$attrs.class,
|
|
65
|
+
style: _ctx.$attrs.style,
|
|
66
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(item).handleClick && unref(item).handleClick(...args))
|
|
67
|
+
}), [
|
|
60
68
|
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.touch())), null, 16),
|
|
61
69
|
unref(item).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(item).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
|
|
62
70
|
createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.text())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(item).parts.label())), toDisplayString(__props.label), 17), unref(item).showsSupportingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(item).parts.supportingText())), [renderSlot(_ctx.$slots, "supporting-text")], 16)) : createCommentVNode("v-if", true)], 16),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RadioProps, RadioValue } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
3
|
+
import "@rio-m3e/styles/base/ripple.css";
|
|
4
|
+
import "@rio-m3e/styles/radio.css";
|
|
5
|
+
interface Props extends Omit<RadioProps, 'selected'> {
|
|
6
|
+
/** The group's `v-model` takes this value when the radio button is selected. */
|
|
7
|
+
value: RadioValue;
|
|
8
|
+
}
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export { _default as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { radioGroupKey } from "./context.js";
|
|
2
|
+
import { createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, unref, useTemplateRef } from "vue";
|
|
3
|
+
import { attachCheckable, attachRipple, createRadio, mergePartAttrs } from "@rio-m3e/core";
|
|
4
|
+
import "@rio-m3e/styles/base/reduced-motion.css";
|
|
5
|
+
import "@rio-m3e/styles/base/ripple.css";
|
|
6
|
+
import "@rio-m3e/styles/radio.css";
|
|
7
|
+
// src/radio/Radio.vue
|
|
8
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
__name: "Radio",
|
|
11
|
+
props: {
|
|
12
|
+
value: {},
|
|
13
|
+
disabled: { type: Boolean },
|
|
14
|
+
softDisabled: { type: Boolean }
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const group = inject(radioGroupKey);
|
|
18
|
+
if (!group) throw new Error("RioRadio has to be inside a RioRadioGroup.");
|
|
19
|
+
const radio = createRadio({
|
|
20
|
+
props: () => ({
|
|
21
|
+
selected: group.isSelected(__props.value),
|
|
22
|
+
disabled: __props.disabled,
|
|
23
|
+
softDisabled: __props.softDisabled
|
|
24
|
+
}),
|
|
25
|
+
name: group.name,
|
|
26
|
+
value: () => String(__props.value)
|
|
27
|
+
});
|
|
28
|
+
const input = useTemplateRef("input");
|
|
29
|
+
const state = useTemplateRef("state");
|
|
30
|
+
let checkable;
|
|
31
|
+
let ripple;
|
|
32
|
+
let unregister;
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
checkable = attachCheckable(input.value, {
|
|
35
|
+
checked: () => group.isSelected(__props.value),
|
|
36
|
+
blocked: radio.blocked,
|
|
37
|
+
onChange: (checked) => checked && group.select(__props.value)
|
|
38
|
+
});
|
|
39
|
+
unregister = group.register(checkable);
|
|
40
|
+
ripple = attachRipple(input.value, { surface: state.value });
|
|
41
|
+
});
|
|
42
|
+
onUpdated(() => checkable?.sync());
|
|
43
|
+
onBeforeUnmount(() => {
|
|
44
|
+
unregister?.();
|
|
45
|
+
checkable?.detach();
|
|
46
|
+
ripple?.detach();
|
|
47
|
+
});
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return openBlock(), createElementBlock("span", mergeProps(unref(radio).parts.root(), {
|
|
50
|
+
class: _ctx.$attrs.class,
|
|
51
|
+
style: _ctx.$attrs.style
|
|
52
|
+
}), [
|
|
53
|
+
createElementVNode("input", mergeProps({
|
|
54
|
+
ref_key: "input",
|
|
55
|
+
ref: input
|
|
56
|
+
}, unref(mergePartAttrs)({
|
|
57
|
+
..._ctx.$attrs,
|
|
58
|
+
class: void 0,
|
|
59
|
+
style: void 0
|
|
60
|
+
}, unref(radio).parts.input())), null, 16),
|
|
61
|
+
createElementVNode("span", mergeProps({
|
|
62
|
+
ref_key: "state",
|
|
63
|
+
ref: state
|
|
64
|
+
}, unref(radio).parts.state()), null, 16),
|
|
65
|
+
createElementVNode("span", normalizeProps(guardReactiveProps(unref(radio).parts.icon())), null, 16)
|
|
66
|
+
], 16);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RadioGroupProps, RadioValue } from "@rio-m3e/core";
|
|
2
|
+
import "@rio-m3e/styles/radio.css";
|
|
3
|
+
interface Props extends RadioGroupProps {
|
|
4
|
+
/** The `name` the radio buttons submit their value under. Defaults to a unique one. */
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
type __VLS_Props = Props;
|
|
8
|
+
type __VLS_Slots = {
|
|
9
|
+
/** `RioRadio`s, each in a `<label>` with its text */
|
|
10
|
+
default?: () => unknown;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
/** The selected radio button's value, with `v-model`. */
|
|
14
|
+
modelValue?: RadioValue | undefined;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:modelValue": (value: RadioValue | undefined) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
20
|
+
"onUpdate:modelValue"?: ((value: RadioValue | undefined) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export { _default as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { radioGroupKey } from "./context.js";
|
|
2
|
+
import { createElementBlock, defineComponent, mergeModels, mergeProps, nextTick, onBeforeUnmount, onMounted, openBlock, provide, renderSlot, unref, useId, useModel, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { attachRadioGroup, createRadioGroup } from "@rio-m3e/core";
|
|
4
|
+
import "@rio-m3e/styles/radio.css";
|
|
5
|
+
// src/radio/RadioGroup.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "RadioGroup",
|
|
8
|
+
props: /*@__PURE__*/ mergeModels({
|
|
9
|
+
name: {},
|
|
10
|
+
label: {}
|
|
11
|
+
}, {
|
|
12
|
+
"modelValue": {},
|
|
13
|
+
"modelModifiers": {}
|
|
14
|
+
}),
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(__props) {
|
|
17
|
+
/** The selected radio button's value, with `v-model`. */
|
|
18
|
+
const model = useModel(__props, "modelValue");
|
|
19
|
+
const group = createRadioGroup({ props: () => ({ label: __props.label }) });
|
|
20
|
+
const id = useId();
|
|
21
|
+
const inputs = /* @__PURE__ */ new Set();
|
|
22
|
+
const resync = () => void nextTick(() => inputs.forEach((input) => input.sync()));
|
|
23
|
+
watch(model, resync);
|
|
24
|
+
provide(radioGroupKey, {
|
|
25
|
+
name: () => __props.name ?? `${id}-radio`,
|
|
26
|
+
isSelected: (value) => model.value === value,
|
|
27
|
+
select: (value) => model.value = value,
|
|
28
|
+
register(input) {
|
|
29
|
+
inputs.add(input);
|
|
30
|
+
return () => inputs.delete(input);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const root = useTemplateRef("root");
|
|
34
|
+
let handle;
|
|
35
|
+
onMounted(() => handle = attachRadioGroup(root.value));
|
|
36
|
+
onBeforeUnmount(() => handle?.detach());
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
39
|
+
ref_key: "root",
|
|
40
|
+
ref: root
|
|
41
|
+
}, unref(group).parts.root(), { onChange: resync }), [renderSlot(_ctx.$slots, "default")], 16);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export { _sfc_main as default };
|