@rio-m3e/vue 0.4.0 → 0.6.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.
Files changed (78) hide show
  1. package/NOTICE +6 -0
  2. package/dist/button/Button.vue.d.ts +3 -2
  3. package/dist/button/Button.vue.js +14 -8
  4. package/dist/checkbox/Checkbox.vue.d.ts +1 -0
  5. package/dist/checkbox/Checkbox.vue.js +8 -11
  6. package/dist/chip/AssistChip.vue.d.ts +25 -0
  7. package/dist/chip/AssistChip.vue.js +50 -0
  8. package/dist/chip/ChipSet.vue.d.ts +23 -0
  9. package/dist/chip/ChipSet.vue.js +53 -0
  10. package/dist/chip/FilterChip.vue.d.ts +33 -0
  11. package/dist/chip/FilterChip.vue.js +68 -0
  12. package/dist/chip/InputChip.vue.d.ts +37 -0
  13. package/dist/chip/InputChip.vue.js +82 -0
  14. package/dist/chip/SuggestionChip.vue.d.ts +24 -0
  15. package/dist/chip/SuggestionChip.vue.js +50 -0
  16. package/dist/chip/context.js +17 -0
  17. package/dist/corner-morph/corner-morph.js +19 -0
  18. package/dist/date-picker/DatePicker.vue.d.ts +67 -0
  19. package/dist/date-picker/DatePicker.vue.js +239 -0
  20. package/dist/date-picker/DatePickerCalendar.vue.js +146 -0
  21. package/dist/date-picker/DatePickerDialog.vue.d.ts +58 -0
  22. package/dist/date-picker/DatePickerDialog.vue.js +191 -0
  23. package/dist/date-picker/DateRangeCalendar.vue.js +89 -0
  24. package/dist/date-picker/DateRangePickerDialog.vue.d.ts +56 -0
  25. package/dist/date-picker/DateRangePickerDialog.vue.js +208 -0
  26. package/dist/dialog/Dialog.vue.js +12 -13
  27. package/dist/icon-button/IconButton.vue.d.ts +3 -2
  28. package/dist/icon-button/IconButton.vue.js +10 -4
  29. package/dist/index.d.ts +41 -17
  30. package/dist/index.js +41 -17
  31. package/dist/list/List.vue.d.ts +23 -0
  32. package/dist/list/List.vue.js +61 -0
  33. package/dist/list/ListItem.vue.d.ts +49 -0
  34. package/dist/list/ListItem.vue.js +106 -0
  35. package/dist/list/context.js +12 -0
  36. package/dist/loading-indicator/LoadingIndicator.vue.d.ts +5 -0
  37. package/dist/loading-indicator/LoadingIndicator.vue.js +45 -0
  38. package/dist/locale/LocaleProvider.vue.d.ts +16 -0
  39. package/dist/locale/LocaleProvider.vue.js +14 -0
  40. package/dist/locale/locale.d.ts +16 -0
  41. package/dist/locale/locale.js +27 -0
  42. package/dist/menu/Menu.vue.js +9 -4
  43. package/dist/menu/SubMenu.vue.js +36 -17
  44. package/dist/overlay/presses.js +9 -0
  45. package/dist/progress/CircularProgress.vue.d.ts +5 -0
  46. package/dist/progress/CircularProgress.vue.js +54 -0
  47. package/dist/progress/LinearProgress.vue.d.ts +4 -0
  48. package/dist/progress/LinearProgress.vue.js +62 -0
  49. package/dist/radio/Radio.vue.d.ts +3 -2
  50. package/dist/radio/Radio.vue.js +17 -16
  51. package/dist/rio/rio.d.ts +32 -0
  52. package/dist/rio/rio.js +32 -0
  53. package/dist/ripple/ripple.js +14 -1
  54. package/dist/scroll-field/ScrollField.vue.d.ts +19 -0
  55. package/dist/scroll-field/ScrollField.vue.js +121 -0
  56. package/dist/select/Select.vue.d.ts +46 -0
  57. package/dist/select/Select.vue.js +179 -0
  58. package/dist/select/SelectOption.vue.d.ts +30 -0
  59. package/dist/select/SelectOption.vue.js +58 -0
  60. package/dist/select/context.js +3 -0
  61. package/dist/slider/RangeSlider.vue.d.ts +17 -0
  62. package/dist/slider/RangeSlider.vue.js +92 -0
  63. package/dist/slider/Slider.vue.d.ts +25 -0
  64. package/dist/slider/Slider.vue.js +102 -0
  65. package/dist/split-button/SplitButton.vue.d.ts +3 -2
  66. package/dist/split-button/SplitButton.vue.js +4 -3
  67. package/dist/switch/Switch.vue.js +33 -8
  68. package/dist/text-field/TextField.vue.js +8 -11
  69. package/dist/time-picker/TimeInput.vue.d.ts +26 -0
  70. package/dist/time-picker/TimeInput.vue.js +73 -0
  71. package/dist/time-picker/TimePickerBody.vue.js +72 -0
  72. package/dist/time-picker/TimePickerDialog.vue.d.ts +51 -0
  73. package/dist/time-picker/TimePickerDialog.vue.js +137 -0
  74. package/dist/time-picker/TimeScroll.vue.d.ts +38 -0
  75. package/dist/time-picker/TimeScroll.vue.js +81 -0
  76. package/dist/tooltip/Tooltip.vue.js +10 -22
  77. package/package.json +4 -4
  78. package/dist/shape-morph/shape-morph.js +0 -18
@@ -0,0 +1,191 @@
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 { keepPresses } from "../overlay/presses.js";
5
+ import _sfc_main$3 from "../text-field/TextField.vue.js";
6
+ import _sfc_main$4 from "./DatePickerCalendar.vue.js";
7
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, openBlock, reactive, ref, renderSlot, toDisplayString, toHandlers, unref, useId, useModel, useTemplateRef, watch, withCtx } from "vue";
8
+ import { attachDialog, createDatePickerDialog, initialDatePickerState } from "@rio-m3e/core";
9
+ import "@rio-m3e/styles/base/focus-ring.css";
10
+ import "@rio-m3e/styles/base/reduced-motion.css";
11
+ import "@rio-m3e/styles/base/state-layer.css";
12
+ import "@rio-m3e/styles/date-picker.css";
13
+ import "@rio-m3e/styles/dialog.css";
14
+ // src/date-picker/DatePickerDialog.vue
15
+ const _sfc_main = /*@__PURE__*/ defineComponent({
16
+ __name: "DatePickerDialog",
17
+ props: /*@__PURE__*/ mergeModels({
18
+ min: {},
19
+ max: {},
20
+ isDateDisabled: { type: Function },
21
+ locale: {},
22
+ firstDayOfWeek: {},
23
+ messages: {},
24
+ initialMode: {},
25
+ clearable: { type: Boolean }
26
+ }, {
27
+ "modelValue": {},
28
+ "modelModifiers": {},
29
+ "open": {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ "openModifiers": {}
34
+ }),
35
+ emits: ["update:modelValue", "update:open"],
36
+ setup(__props) {
37
+ const props = __props;
38
+ /** The chosen date, `YYYY-MM-DD`, with `v-model`. It changes on OK. */
39
+ const model = useModel(__props, "modelValue");
40
+ /** Whether the dialog is shown, with `v-model:open`. */
41
+ const open = useModel(__props, "open");
42
+ const locale = useLocale(() => props.locale);
43
+ const messages = useMessages("datePicker", locale, () => props.messages);
44
+ const state = reactive(initialDatePickerState(model.value, locale.value, props));
45
+ const rendered = ref(open.value);
46
+ const id = useId();
47
+ const dialog = createDatePickerDialog({
48
+ props: () => ({
49
+ value: model.value,
50
+ open: open.value,
51
+ min: props.min,
52
+ max: props.max,
53
+ locale: locale.value,
54
+ clearable: props.clearable,
55
+ initialMode: props.initialMode,
56
+ rendered: rendered.value
57
+ }),
58
+ isDateDisabled: (date) => !!props.isDateDisabled?.(date),
59
+ messages: () => messages.value,
60
+ state: () => state,
61
+ ids: {
62
+ title: `${id}-title`,
63
+ headline: `${id}-headline`
64
+ },
65
+ onChange: (next) => model.value = next,
66
+ onOpenChange: (next) => open.value = next,
67
+ onStateChange: (next) => Object.assign(state, next)
68
+ });
69
+ if (open.value) dialog.opened();
70
+ watch(open, (next) => {
71
+ if (!next) return;
72
+ dialog.opened();
73
+ rendered.value = true;
74
+ });
75
+ const root = useTemplateRef("root");
76
+ const calendar = useTemplateRef("calendar");
77
+ let handle;
78
+ onMounted(() => {
79
+ handle = attachDialog(root.value, {
80
+ onOpenChange: (next) => open.value = next,
81
+ onClosed: () => {
82
+ if (!open.value) rendered.value = false;
83
+ },
84
+ initialFocus: () => root.value?.querySelector(state.mode === "calendar" ? "[data-date][tabindex=\"0\"]" : "input")
85
+ });
86
+ handle.sync(open.value);
87
+ });
88
+ watch(open, (next) => handle?.sync(next), { flush: "post" });
89
+ watch(() => state.mode, async (next) => {
90
+ await nextTick();
91
+ if (!open.value) return;
92
+ if (next === "calendar") calendar.value?.focus();
93
+ else root.value?.querySelector("input")?.focus();
94
+ });
95
+ onBeforeUnmount(() => handle?.detach());
96
+ return (_ctx, _cache) => {
97
+ return openBlock(), createElementBlock("dialog", mergeProps({
98
+ ref_key: "root",
99
+ ref: root
100
+ }, unref(dialog).parts.root(), toHandlers(unref(keepPresses), true)), [rendered.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
101
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.header())), [
102
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.title())), toDisplayString(unref(messages).title), 17),
103
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.headline())), toDisplayString(unref(dialog).headline()), 17),
104
+ createVNode(_sfc_main$2, {
105
+ variant: "standard",
106
+ label: unref(dialog).modeButtonLabel(),
107
+ onClick: unref(dialog).switchMode
108
+ }, {
109
+ 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)]),
110
+ _: 3
111
+ }, 8, ["label", "onClick"])
112
+ ], 16),
113
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.divider())), null, 16),
114
+ unref(dialog).calendarMode() ? (openBlock(), createBlock(_sfc_main$4, {
115
+ key: 0,
116
+ ref_key: "calendar",
117
+ ref: calendar,
118
+ month: state.month,
119
+ "onUpdate:month": _cache[0] || (_cache[0] = ($event) => state.month = $event),
120
+ focused: state.focused,
121
+ "onUpdate:focused": _cache[1] || (_cache[1] = ($event) => state.focused = $event),
122
+ view: state.view,
123
+ "onUpdate:view": _cache[2] || (_cache[2] = ($event) => state.view = $event),
124
+ variant: "modal",
125
+ selected: state.draft,
126
+ min: __props.min,
127
+ max: __props.max,
128
+ locale: unref(locale),
129
+ "first-day-of-week": __props.firstDayOfWeek,
130
+ "is-date-disabled": __props.isDateDisabled,
131
+ messages: unref(messages),
132
+ onSelect: unref(dialog).select
133
+ }, {
134
+ "previous-icon": withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
135
+ "next-icon": withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
136
+ "dropdown-icon": withCtx(() => [renderSlot(_ctx.$slots, "dropdown-icon")]),
137
+ _: 3
138
+ }, 8, [
139
+ "month",
140
+ "focused",
141
+ "view",
142
+ "selected",
143
+ "min",
144
+ "max",
145
+ "locale",
146
+ "first-day-of-week",
147
+ "is-date-disabled",
148
+ "messages",
149
+ "onSelect"
150
+ ])) : createCommentVNode("v-if", true),
151
+ unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps(unref(dialog).field(), {
152
+ "model-value": state.text,
153
+ variant: "outlined",
154
+ label: unref(messages).fieldLabel,
155
+ autocomplete: "off",
156
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = (text) => unref(dialog).textInput(String(text))),
157
+ onKeydown: unref(dialog).handleFieldKeydown
158
+ }), null, 16, [
159
+ "model-value",
160
+ "label",
161
+ "onKeydown"
162
+ ])], 16)) : createCommentVNode("v-if", true),
163
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.actions())), [
164
+ unref(dialog).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
165
+ key: 0,
166
+ variant: "text",
167
+ onClick: unref(dialog).clear
168
+ }, {
169
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).clear), 1)]),
170
+ _: 1
171
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true),
172
+ createVNode(_sfc_main$1, {
173
+ variant: "text",
174
+ onClick: unref(dialog).cancel
175
+ }, {
176
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).cancel), 1)]),
177
+ _: 1
178
+ }, 8, ["onClick"]),
179
+ createVNode(_sfc_main$1, {
180
+ variant: "text",
181
+ onClick: unref(dialog).confirm
182
+ }, {
183
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).ok), 1)]),
184
+ _: 1
185
+ }, 8, ["onClick"])
186
+ ], 16)
187
+ ], 64)) : createCommentVNode("v-if", true)], 16);
188
+ };
189
+ }
190
+ });
191
+ export { _sfc_main as default };
@@ -0,0 +1,89 @@
1
+ import { vRipple } from "../ripple/ripple.js";
2
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderList, toDisplayString, unref, useModel, useTemplateRef, withDirectives } from "vue";
3
+ import { attachRangeCalendar, createRangeCalendar } from "@rio-m3e/core";
4
+ // src/date-picker/DateRangeCalendar.vue
5
+ const _hoisted_1 = ["onClick"];
6
+ const _sfc_main = /*@__PURE__*/ defineComponent({
7
+ __name: "DateRangeCalendar",
8
+ props: /*@__PURE__*/ mergeModels({
9
+ start: {},
10
+ end: {},
11
+ min: {},
12
+ max: {},
13
+ locale: {},
14
+ firstDayOfWeek: {},
15
+ isDateDisabled: { type: Function }
16
+ }, {
17
+ "focused": { required: true },
18
+ "focusedModifiers": {},
19
+ "firstMonth": { required: true },
20
+ "firstMonthModifiers": {},
21
+ "lastMonth": { required: true },
22
+ "lastMonthModifiers": {}
23
+ }),
24
+ emits: /*@__PURE__*/ mergeModels(["select"], [
25
+ "update:focused",
26
+ "update:firstMonth",
27
+ "update:lastMonth"
28
+ ]),
29
+ setup(__props, { expose: __expose, emit: __emit }) {
30
+ const props = __props;
31
+ const focused = useModel(__props, "focused");
32
+ const firstMonth = useModel(__props, "firstMonth");
33
+ const lastMonth = useModel(__props, "lastMonth");
34
+ const emit = __emit;
35
+ const calendar = createRangeCalendar({
36
+ props: () => ({
37
+ start: props.start,
38
+ end: props.end,
39
+ focused: focused.value,
40
+ firstMonth: firstMonth.value,
41
+ lastMonth: lastMonth.value,
42
+ min: props.min,
43
+ max: props.max,
44
+ locale: props.locale,
45
+ firstDayOfWeek: props.firstDayOfWeek
46
+ }),
47
+ isDateDisabled: (date) => !!props.isDateDisabled?.(date),
48
+ onSelect: (date, confirm) => emit("select", date, confirm),
49
+ onFocusChange: (next) => focused.value = next,
50
+ onMonthsChange: (first, last) => {
51
+ firstMonth.value = first;
52
+ lastMonth.value = last;
53
+ }
54
+ });
55
+ const root = useTemplateRef("root");
56
+ let handle;
57
+ onMounted(() => {
58
+ handle = attachRangeCalendar(root.value, {
59
+ calendar: () => calendar,
60
+ focused: () => focused.value,
61
+ onConfirm: (date) => emit("select", date, true),
62
+ onEdge: calendar.extend
63
+ });
64
+ });
65
+ onUpdated(() => handle?.sync());
66
+ onBeforeUnmount(() => handle?.detach());
67
+ __expose({
68
+ /** Focuses the date that takes the focus. */
69
+ focus: () => handle?.focus() });
70
+ return (_ctx, _cache) => {
71
+ return openBlock(), createElementBlock("div", mergeProps({
72
+ ref_key: "root",
73
+ ref: root
74
+ }, unref(calendar).parts.root()), [createElementVNode("div", normalizeProps(guardReactiveProps(unref(calendar).parts.weekdays())), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).weekdays(), (day) => {
75
+ return openBlock(), createElementBlock("span", mergeProps({ key: day }, { ref_for: true }, unref(calendar).parts.weekday(day)), toDisplayString(unref(calendar).weekdayText(day)), 17);
76
+ }), 128))], 16), createElementVNode("div", normalizeProps(guardReactiveProps(unref(calendar).parts.months())), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).months(), (month) => {
77
+ return openBlock(), createElementBlock("div", mergeProps({ key: month }, { ref_for: true }, unref(calendar).parts.month(month)), [createElementVNode("div", mergeProps({ ref_for: true }, unref(calendar).parts.subhead(month)), toDisplayString(unref(calendar).monthText(month)), 17), createElementVNode("table", mergeProps({ ref_for: true }, unref(calendar).parts.grid(month)), [createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).weeks(month), (week) => {
78
+ return openBlock(), createElementBlock("tr", { key: week[0] }, [(openBlock(true), createElementBlock(Fragment, null, renderList(week, (date) => {
79
+ return openBlock(), createElementBlock("td", mergeProps({ key: date }, { ref_for: true }, unref(calendar).parts.cell(date, month)), [unref(calendar).showsDay(date, month) ? withDirectives((openBlock(), createElementBlock("button", mergeProps({
80
+ key: 0,
81
+ ref_for: true
82
+ }, unref(calendar).parts.day(date), { onClick: ($event) => unref(calendar).handleDayClick(date) }), [createTextVNode(toDisplayString(unref(calendar).dayText(date)), 1)], 16, _hoisted_1)), [[unref(vRipple)]]) : createCommentVNode("v-if", true)], 16);
83
+ }), 128))]);
84
+ }), 128))])], 16)], 16);
85
+ }), 128))], 16)], 16);
86
+ };
87
+ }
88
+ });
89
+ export { _sfc_main as default };
@@ -0,0 +1,56 @@
1
+ import { DatePickerMessages } from "@rio-m3e/core";
2
+ import "@rio-m3e/styles/base/focus-ring.css";
3
+ import "@rio-m3e/styles/base/reduced-motion.css";
4
+ import "@rio-m3e/styles/base/state-layer.css";
5
+ import "@rio-m3e/styles/date-picker.css";
6
+ import "@rio-m3e/styles/dialog.css";
7
+ type __VLS_Props = {
8
+ /** The earliest date that can be chosen, `YYYY-MM-DD` */
9
+ min?: string;
10
+ /** The latest date that can be chosen, `YYYY-MM-DD` */
11
+ max?: string;
12
+ /** Makes dates unavailable, besides those outside `min` and `max`. */
13
+ isDateDisabled?: (date: string) => boolean;
14
+ /** A language tag. Without it, the one provided, or the document's, or the browser's. */
15
+ locale?: string;
16
+ /** Overrides the language's first day of the week: 1 (Monday) to 7 (Sunday). */
17
+ firstDayOfWeek?: number;
18
+ /** Replaces any of the text the dialog shows. */
19
+ messages?: Partial<DatePickerMessages>;
20
+ /** What each opening starts in: the calendar, or the text input. Defaults to `'calendar'`. */
21
+ initialMode?: 'calendar' | 'input';
22
+ /** A Clear button at the start of Cancel and OK */
23
+ clearable?: boolean;
24
+ };
25
+ type __VLS_Slots = {
26
+ /** The mode button's icon in the calendar, which switches to the text input */
27
+ 'edit-icon'?: () => unknown;
28
+ /** The mode button's icon in the text input, which switches to the calendar */
29
+ 'calendar-icon'?: () => unknown;
30
+ };
31
+ type __VLS_ModelProps = {
32
+ /** The range's start, `YYYY-MM-DD`, with `v-model:start`. It changes on OK. */
33
+ 'start'?: string | undefined;
34
+ /** The range's end, `YYYY-MM-DD`, with `v-model:end`. It changes on OK. */
35
+ 'end'?: string | undefined;
36
+ /** Whether the dialog is shown, with `v-model:open`. */
37
+ 'open'?: boolean;
38
+ };
39
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
40
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
41
+ "update:open": (value: boolean) => any;
42
+ "update:start": (value: string | undefined) => any;
43
+ "update:end": (value: string | undefined) => any;
44
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
45
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
46
+ "onUpdate:start"?: ((value: string | undefined) => any) | undefined;
47
+ "onUpdate:end"?: ((value: string | undefined) => any) | undefined;
48
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
50
+ declare const _default: typeof __VLS_export;
51
+ type __VLS_WithSlots<T, S> = T & {
52
+ new (): {
53
+ $slots: S;
54
+ };
55
+ };
56
+ export { _default as default };
@@ -0,0 +1,208 @@
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 { keepPresses } from "../overlay/presses.js";
5
+ import _sfc_main$3 from "../text-field/TextField.vue.js";
6
+ import _sfc_main$4 from "./DateRangeCalendar.vue.js";
7
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, openBlock, reactive, ref, renderSlot, toDisplayString, toHandlers, unref, useId, useModel, useTemplateRef, watch, withCtx } from "vue";
8
+ import { attachDialog, createDateRangePickerDialog, initialDateRangePickerState } from "@rio-m3e/core";
9
+ import "@rio-m3e/styles/base/focus-ring.css";
10
+ import "@rio-m3e/styles/base/reduced-motion.css";
11
+ import "@rio-m3e/styles/base/state-layer.css";
12
+ import "@rio-m3e/styles/date-picker.css";
13
+ import "@rio-m3e/styles/dialog.css";
14
+ // src/date-picker/DateRangePickerDialog.vue
15
+ const _sfc_main = /*@__PURE__*/ defineComponent({
16
+ __name: "DateRangePickerDialog",
17
+ props: /*@__PURE__*/ mergeModels({
18
+ min: {},
19
+ max: {},
20
+ isDateDisabled: { type: Function },
21
+ locale: {},
22
+ firstDayOfWeek: {},
23
+ messages: {},
24
+ initialMode: {},
25
+ clearable: { type: Boolean }
26
+ }, {
27
+ "start": {},
28
+ "startModifiers": {},
29
+ "end": {},
30
+ "endModifiers": {},
31
+ "open": {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ "openModifiers": {}
36
+ }),
37
+ emits: [
38
+ "update:start",
39
+ "update:end",
40
+ "update:open"
41
+ ],
42
+ setup(__props) {
43
+ const props = __props;
44
+ /** The range's start, `YYYY-MM-DD`, with `v-model:start`. It changes on OK. */
45
+ const start = useModel(__props, "start");
46
+ /** The range's end, `YYYY-MM-DD`, with `v-model:end`. It changes on OK. */
47
+ const end = useModel(__props, "end");
48
+ /** Whether the dialog is shown, with `v-model:open`. */
49
+ const open = useModel(__props, "open");
50
+ const locale = useLocale(() => props.locale);
51
+ const messages = useMessages("datePicker", locale, () => props.messages);
52
+ const state = reactive(initialDateRangePickerState(start.value, end.value, locale.value, props));
53
+ const rendered = ref(open.value);
54
+ const id = useId();
55
+ const dialog = createDateRangePickerDialog({
56
+ props: () => ({
57
+ start: start.value,
58
+ end: end.value,
59
+ open: open.value,
60
+ min: props.min,
61
+ max: props.max,
62
+ locale: locale.value,
63
+ clearable: props.clearable,
64
+ initialMode: props.initialMode,
65
+ rendered: rendered.value
66
+ }),
67
+ isDateDisabled: (date) => !!props.isDateDisabled?.(date),
68
+ messages: () => messages.value,
69
+ state: () => state,
70
+ ids: {
71
+ title: `${id}-title`,
72
+ headline: `${id}-headline`
73
+ },
74
+ onChange: (nextStart, nextEnd) => {
75
+ start.value = nextStart;
76
+ end.value = nextEnd;
77
+ },
78
+ onOpenChange: (next) => open.value = next,
79
+ onStateChange: (next) => Object.assign(state, next)
80
+ });
81
+ if (open.value) dialog.opened();
82
+ watch(open, (next) => {
83
+ if (!next) return;
84
+ dialog.opened();
85
+ rendered.value = true;
86
+ });
87
+ const root = useTemplateRef("root");
88
+ const calendar = useTemplateRef("calendar");
89
+ let handle;
90
+ onMounted(() => {
91
+ handle = attachDialog(root.value, {
92
+ onOpenChange: (next) => open.value = next,
93
+ onClosed: () => {
94
+ if (!open.value) rendered.value = false;
95
+ },
96
+ initialFocus: () => root.value?.querySelector(state.mode === "calendar" ? "[data-date][tabindex=\"0\"]" : "input")
97
+ });
98
+ handle.sync(open.value);
99
+ });
100
+ watch(open, (next) => handle?.sync(next), { flush: "post" });
101
+ watch(() => state.mode, async (next) => {
102
+ await nextTick();
103
+ if (!open.value) return;
104
+ if (next === "calendar") calendar.value?.focus();
105
+ else root.value?.querySelector("input")?.focus();
106
+ });
107
+ onBeforeUnmount(() => handle?.detach());
108
+ return (_ctx, _cache) => {
109
+ return openBlock(), createElementBlock("dialog", mergeProps({
110
+ ref_key: "root",
111
+ ref: root
112
+ }, unref(dialog).parts.root(), toHandlers(unref(keepPresses), true)), [rendered.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
113
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.header())), [
114
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.title())), toDisplayString(unref(messages).rangeTitle), 17),
115
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(dialog).parts.headline())), toDisplayString(unref(dialog).headline()), 17),
116
+ createVNode(_sfc_main$2, {
117
+ variant: "standard",
118
+ label: unref(dialog).modeButtonLabel(),
119
+ onClick: unref(dialog).switchMode
120
+ }, {
121
+ 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)]),
122
+ _: 3
123
+ }, 8, ["label", "onClick"])
124
+ ], 16),
125
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.divider())), null, 16),
126
+ unref(dialog).calendarMode() ? (openBlock(), createBlock(_sfc_main$4, {
127
+ key: 0,
128
+ ref_key: "calendar",
129
+ ref: calendar,
130
+ focused: state.focused,
131
+ "onUpdate:focused": _cache[0] || (_cache[0] = ($event) => state.focused = $event),
132
+ "first-month": state.firstMonth,
133
+ "onUpdate:firstMonth": _cache[1] || (_cache[1] = ($event) => state.firstMonth = $event),
134
+ "last-month": state.lastMonth,
135
+ "onUpdate:lastMonth": _cache[2] || (_cache[2] = ($event) => state.lastMonth = $event),
136
+ start: state.start,
137
+ end: state.end,
138
+ min: __props.min,
139
+ max: __props.max,
140
+ locale: unref(locale),
141
+ "first-day-of-week": __props.firstDayOfWeek,
142
+ "is-date-disabled": __props.isDateDisabled,
143
+ onSelect: unref(dialog).select
144
+ }, null, 8, [
145
+ "focused",
146
+ "first-month",
147
+ "last-month",
148
+ "start",
149
+ "end",
150
+ "min",
151
+ "max",
152
+ "locale",
153
+ "first-day-of-week",
154
+ "is-date-disabled",
155
+ "onSelect"
156
+ ])) : createCommentVNode("v-if", true),
157
+ unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps(unref(dialog).startField(), {
158
+ "model-value": state.startText,
159
+ variant: "outlined",
160
+ label: unref(messages).startDate,
161
+ autocomplete: "off",
162
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = (text) => unref(dialog).startInput(String(text))),
163
+ onKeydown: unref(dialog).handleFieldKeydown
164
+ }), null, 16, [
165
+ "model-value",
166
+ "label",
167
+ "onKeydown"
168
+ ]), createVNode(_sfc_main$3, mergeProps(unref(dialog).endField(), {
169
+ "model-value": state.endText,
170
+ variant: "outlined",
171
+ label: unref(messages).endDate,
172
+ autocomplete: "off",
173
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = (text) => unref(dialog).endInput(String(text))),
174
+ onKeydown: unref(dialog).handleFieldKeydown
175
+ }), null, 16, [
176
+ "model-value",
177
+ "label",
178
+ "onKeydown"
179
+ ])], 16)) : createCommentVNode("v-if", true),
180
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.actions())), [
181
+ unref(dialog).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
182
+ key: 0,
183
+ variant: "text",
184
+ onClick: unref(dialog).clear
185
+ }, {
186
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).clear), 1)]),
187
+ _: 1
188
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true),
189
+ createVNode(_sfc_main$1, {
190
+ variant: "text",
191
+ onClick: unref(dialog).cancel
192
+ }, {
193
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).cancel), 1)]),
194
+ _: 1
195
+ }, 8, ["onClick"]),
196
+ createVNode(_sfc_main$1, {
197
+ variant: "text",
198
+ onClick: unref(dialog).confirm
199
+ }, {
200
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).ok), 1)]),
201
+ _: 1
202
+ }, 8, ["onClick"])
203
+ ], 16)
204
+ ], 64)) : createCommentVNode("v-if", true)], 16);
205
+ };
206
+ }
207
+ });
208
+ export { _sfc_main as default };
@@ -1,4 +1,5 @@
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";
1
+ import { keepPresses } from "../overlay/presses.js";
2
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, toHandlers, unref, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
2
3
  import { attachDialog, createDialog } from "@rio-m3e/core";
3
4
  import "@rio-m3e/styles/base/focus-ring.css";
4
5
  import "@rio-m3e/styles/base/reduced-motion.css";
@@ -23,6 +24,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
23
24
  const emit = __emit;
24
25
  const slots = useSlots();
25
26
  const id = useId();
27
+ const overflow = ref({
28
+ top: false,
29
+ bottom: false,
30
+ focusable: false
31
+ });
26
32
  const dialog = createDialog({
27
33
  props: () => ({
28
34
  open: open.value,
@@ -33,6 +39,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
33
39
  headline: !!__props.headline,
34
40
  actions: !!slots.actions
35
41
  }),
42
+ overflow: () => overflow.value,
36
43
  ids: {
37
44
  headline: `${id}-headline`,
38
45
  content: `${id}-content`
@@ -48,6 +55,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
48
55
  handle = attachDialog(root.value, {
49
56
  onCancel: (event) => emit("cancel", event),
50
57
  onOpenChange: (next) => open.value = next,
58
+ onOverflowChange: (next) => overflow.value = next,
51
59
  onClosed: () => {
52
60
  if (!open.value) rendered.value = false;
53
61
  }
@@ -58,24 +66,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
58
66
  onUpdated(() => handle?.update());
59
67
  onBeforeUnmount(() => handle?.detach());
60
68
  return (_ctx, _cache) => {
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({
69
+ return openBlock(), createElementBlock("dialog", mergeProps({
62
70
  ref_key: "root",
63
71
  ref: 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 }, [
72
+ }, unref(dialog).parts.root(), toHandlers(unref(keepPresses), true)), [rendered.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
74
73
  unref(dialog).showsIcon() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(dialog).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
75
74
  unref(dialog).showsHeadline() ? (openBlock(), createElementBlock("h2", normalizeProps(mergeProps({ key: 1 }, unref(dialog).parts.headline())), toDisplayString(__props.headline), 17)) : createCommentVNode("v-if", true),
76
75
  createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.content())), [renderSlot(_ctx.$slots, "default")], 16),
77
76
  unref(dialog).showsActions() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 2 }, unref(dialog).parts.actions())), [renderSlot(_ctx.$slots, "actions")], 16)) : createCommentVNode("v-if", true)
78
- ], 64)) : createCommentVNode("v-if", true)], 16)], 2112);
77
+ ], 64)) : createCommentVNode("v-if", true)], 16);
79
78
  };
80
79
  }
81
80
  });
@@ -2,6 +2,7 @@ import { IconButtonProps } from "@rio-m3e/core";
2
2
  import "@rio-m3e/styles/base/focus-ring.css";
3
3
  import "@rio-m3e/styles/base/reduced-motion.css";
4
4
  import "@rio-m3e/styles/base/state-layer.css";
5
+ import "@rio-m3e/styles/base/touch-target.css";
5
6
  import "@rio-m3e/styles/button.css";
6
7
  import "@rio-m3e/styles/icon-button.css";
7
8
  type __VLS_Slots = {
@@ -14,11 +15,11 @@ type __VLS_Slots = {
14
15
  'selected-icon'?: () => unknown;
15
16
  };
16
17
  declare const __VLS_base: import("vue").DefineComponent<IconButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- click: (event: MouseEvent) => any;
18
18
  "update:selected": (selected: boolean) => any;
19
+ click: (event: MouseEvent) => any;
19
20
  }, string, import("vue").PublicProps, Readonly<IconButtonProps> & Readonly<{
20
- onClick?: ((event: MouseEvent) => any) | undefined;
21
21
  "onUpdate:selected"?: ((selected: boolean) => any) | undefined;
22
+ onClick?: ((event: MouseEvent) => any) | undefined;
22
23
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
24
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
24
25
  declare const _default: typeof __VLS_export;