@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.
Files changed (38) hide show
  1. package/dist/button/Button.vue.js +12 -7
  2. package/dist/checkbox/Checkbox.vue.d.ts +11 -0
  3. package/dist/checkbox/Checkbox.vue.js +70 -0
  4. package/dist/date-picker/DatePicker.vue.d.ts +67 -0
  5. package/dist/date-picker/DatePicker.vue.js +238 -0
  6. package/dist/date-picker/DatePickerCalendar.vue.js +146 -0
  7. package/dist/date-picker/DatePickerDialog.vue.d.ts +58 -0
  8. package/dist/date-picker/DatePickerDialog.vue.js +199 -0
  9. package/dist/dialog/Dialog.vue.js +13 -4
  10. package/dist/icon-button/IconButton.vue.js +8 -3
  11. package/dist/index.d.ts +24 -11
  12. package/dist/index.js +24 -11
  13. package/dist/locale/LocaleProvider.vue.d.ts +16 -0
  14. package/dist/locale/LocaleProvider.vue.js +14 -0
  15. package/dist/locale/locale.d.ts +16 -0
  16. package/dist/locale/locale.js +27 -0
  17. package/dist/menu/SubMenu.vue.js +10 -2
  18. package/dist/radio/Radio.vue.d.ts +11 -0
  19. package/dist/radio/Radio.vue.js +70 -0
  20. package/dist/radio/RadioGroup.vue.d.ts +29 -0
  21. package/dist/radio/RadioGroup.vue.js +45 -0
  22. package/dist/radio/context.js +3 -0
  23. package/dist/rio/rio.d.ts +37 -0
  24. package/dist/rio/rio.js +44 -0
  25. package/dist/select/Select.vue.d.ts +46 -0
  26. package/dist/select/Select.vue.js +178 -0
  27. package/dist/select/SelectOption.vue.d.ts +30 -0
  28. package/dist/select/SelectOption.vue.js +58 -0
  29. package/dist/select/context.js +3 -0
  30. package/dist/text-field/TextField.vue.d.ts +32 -0
  31. package/dist/text-field/TextField.vue.js +124 -0
  32. package/dist/time-picker/TimeInput.vue.d.ts +25 -0
  33. package/dist/time-picker/TimeInput.vue.js +71 -0
  34. package/dist/time-picker/TimePickerBody.vue.js +46 -0
  35. package/dist/time-picker/TimePickerDialog.vue.d.ts +46 -0
  36. package/dist/time-picker/TimePickerDialog.vue.js +142 -0
  37. package/dist/tooltip/Tooltip.vue.js +22 -9
  38. package/package.json +4 -4
@@ -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 { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, unref, useSlots, withDirectives } from "vue";
4
+ import { createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, unref, useSlots, withCtx, withDirectives } from "vue";
5
5
  import { createButton } from "@rio-m3e/core";
6
6
  import "@rio-m3e/styles/base/focus-ring.css";
7
7
  import "@rio-m3e/styles/base/reduced-motion.css";
@@ -19,6 +19,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
19
19
  disabled: { type: Boolean },
20
20
  softDisabled: { type: Boolean },
21
21
  type: {},
22
+ href: {},
22
23
  value: {}
23
24
  },
24
25
  emits: ["click", "update:selected"],
@@ -34,7 +35,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
34
35
  disabled: __props.disabled,
35
36
  softDisabled: __props.softDisabled,
36
37
  type: __props.type,
37
- value: __props.value
38
+ value: __props.value,
39
+ href: __props.href
38
40
  }), (next) => emit("update:selected", next));
39
41
  const button = createButton({
40
42
  props: item.props,
@@ -43,11 +45,14 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
43
45
  onChange: item.onChange
44
46
  });
45
47
  return (_ctx, _cache) => {
46
- return withDirectives((openBlock(), createElementBlock("button", mergeProps(unref(button).parts.root(), { onClick: _cache[0] || (_cache[0] = (...args) => unref(button).handleClick && unref(button).handleClick(...args)) }), [
47
- createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.touch())), null, 16),
48
- unref(button).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(button).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
49
- createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.label())), [renderSlot(_ctx.$slots, "default")], 16)
50
- ], 16)), [[unref(vRipple)], [unref(vShapeMorph)]]);
48
+ return withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(button).isLink() ? "a" : "button"), mergeProps(unref(button).parts.root(), { onClick: unref(button).handleClick }), {
49
+ default: withCtx(() => [
50
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.touch())), null, 16),
51
+ unref(button).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(button).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
52
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(button).parts.label())), [renderSlot(_ctx.$slots, "default")], 16)
53
+ ]),
54
+ _: 3
55
+ }, 16, ["onClick"])), [[unref(vRipple)], [unref(vShapeMorph)]]);
51
56
  };
52
57
  }
53
58
  });
@@ -0,0 +1,11 @@
1
+ import { CheckboxProps } 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/checkbox.css";
5
+ declare const __VLS_export: import("vue").DefineComponent<CheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:selected": (selected: boolean) => any;
7
+ }, string, import("vue").PublicProps, Readonly<CheckboxProps> & Readonly<{
8
+ "onUpdate:selected"?: ((selected: boolean) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export { _default as default };
@@ -0,0 +1,70 @@
1
+ import { createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, unref, useTemplateRef } from "vue";
2
+ import { attachCheckable, attachRipple, createCheckbox, mergePartAttrs } from "@rio-m3e/core";
3
+ import "@rio-m3e/styles/base/reduced-motion.css";
4
+ import "@rio-m3e/styles/base/ripple.css";
5
+ import "@rio-m3e/styles/checkbox.css";
6
+ // src/checkbox/Checkbox.vue
7
+ const _sfc_main = /*@__PURE__*/ defineComponent({
8
+ inheritAttrs: false,
9
+ __name: "Checkbox",
10
+ props: {
11
+ selected: { type: Boolean },
12
+ indeterminate: { type: Boolean },
13
+ error: { type: Boolean },
14
+ disabled: { type: Boolean },
15
+ softDisabled: { type: Boolean }
16
+ },
17
+ emits: ["update:selected"],
18
+ setup(__props, { emit: __emit }) {
19
+ const emit = __emit;
20
+ const checkbox = createCheckbox({ props: () => ({
21
+ selected: __props.selected,
22
+ indeterminate: __props.indeterminate,
23
+ error: __props.error,
24
+ disabled: __props.disabled,
25
+ softDisabled: __props.softDisabled
26
+ }) });
27
+ const input = useTemplateRef("input");
28
+ const state = useTemplateRef("state");
29
+ let checkable;
30
+ let ripple;
31
+ onMounted(() => {
32
+ checkable = attachCheckable(input.value, {
33
+ checked: () => !!__props.selected,
34
+ indeterminate: () => !!__props.indeterminate,
35
+ blocked: checkbox.blocked,
36
+ onChange(checked) {
37
+ emit("update:selected", checkbox.next(checked));
38
+ nextTick(() => checkable?.sync());
39
+ }
40
+ });
41
+ ripple = attachRipple(input.value, { surface: state.value });
42
+ });
43
+ onUpdated(() => checkable?.sync());
44
+ onBeforeUnmount(() => {
45
+ checkable?.detach();
46
+ ripple?.detach();
47
+ });
48
+ return (_ctx, _cache) => {
49
+ return openBlock(), createElementBlock("span", mergeProps(unref(checkbox).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(checkbox).parts.input())), null, 16),
61
+ createElementVNode("span", mergeProps({
62
+ ref_key: "state",
63
+ ref: state
64
+ }, unref(checkbox).parts.state()), null, 16),
65
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(checkbox).parts.container())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(checkbox).parts.icon())), null, 16)], 16)
66
+ ], 16);
67
+ };
68
+ }
69
+ });
70
+ export { _sfc_main as default };
@@ -0,0 +1,67 @@
1
+ import { DatePickerMessages, DatePickerVariant, TextFieldVariant } from "@rio-m3e/core";
2
+ import "@rio-m3e/styles/base/reduced-motion.css";
3
+ import "@rio-m3e/styles/base/anchored-position.css";
4
+ import "@rio-m3e/styles/date-picker.css";
5
+ type __VLS_Props = {
6
+ /** `'docked'` shows the calendar below the field; `'modal'`, in a dialog. Defaults to docked. */
7
+ variant?: DatePickerVariant;
8
+ /** The field's look. Defaults to `'outlined'`, as the docked picker's spec has it. */
9
+ fieldVariant?: TextFieldVariant;
10
+ label?: string;
11
+ /** Text below the field. Defaults to the date format, such as MM/DD/YYYY. */
12
+ supportingText?: string;
13
+ error?: boolean;
14
+ errorText?: string;
15
+ required?: boolean;
16
+ disabled?: boolean;
17
+ /** Submits the date with a form under this name, as `YYYY-MM-DD`. */
18
+ name?: string;
19
+ /** The earliest date that can be chosen, `YYYY-MM-DD` */
20
+ min?: string;
21
+ /** The latest date that can be chosen, `YYYY-MM-DD` */
22
+ max?: string;
23
+ /** Makes dates unavailable, besides those outside `min` and `max`. */
24
+ isDateDisabled?: (date: string) => boolean;
25
+ /** A language tag. Without it, the one provided, or the document's, or the browser's. */
26
+ locale?: string;
27
+ /** Overrides the language's first day of the week: 1 (Monday) to 7 (Sunday). */
28
+ firstDayOfWeek?: number;
29
+ /** Replaces any of the text the picker shows. */
30
+ messages?: Partial<DatePickerMessages>;
31
+ /** A Clear button at the start of Cancel and OK */
32
+ clearable?: boolean;
33
+ /** Modal: what the dialog starts in, the calendar or the text input. */
34
+ initialMode?: 'calendar' | 'input';
35
+ };
36
+ type __VLS_Slots = {
37
+ /** The field's button that opens the calendar, and the dialog's switch back to it */
38
+ 'calendar-icon'?: () => unknown;
39
+ 'previous-icon'?: () => unknown;
40
+ 'next-icon'?: () => unknown;
41
+ /** The month and year buttons' arrow */
42
+ 'dropdown-icon'?: () => unknown;
43
+ /** Modal: the switch to the text input */
44
+ 'edit-icon'?: () => unknown;
45
+ };
46
+ type __VLS_ModelProps = {
47
+ /** The date, `YYYY-MM-DD`, with `v-model`. */
48
+ modelValue?: string | undefined;
49
+ /** Whether the calendar is shown, with `v-model:open`. The picker keeps it when not bound. */
50
+ 'open'?: boolean;
51
+ };
52
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
53
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
54
+ "update:open": (value: boolean) => any;
55
+ "update:modelValue": (value: string | undefined) => any;
56
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
57
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
58
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
59
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
61
+ declare const _default: typeof __VLS_export;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };
67
+ export { _default as default };
@@ -0,0 +1,238 @@
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 _sfc_main$5 from "./DatePickerDialog.vue.js";
7
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, reactive, renderSlot, toDisplayString, unref, useModel, useTemplateRef, watch, withCtx } from "vue";
8
+ import { attachDatePickerMenu, createDatePicker, initialPickerState } from "@rio-m3e/core";
9
+ import "@rio-m3e/styles/base/reduced-motion.css";
10
+ import "@rio-m3e/styles/base/anchored-position.css";
11
+ import "@rio-m3e/styles/date-picker.css";
12
+ // src/date-picker/DatePicker.vue
13
+ const _sfc_main = /*@__PURE__*/ defineComponent({
14
+ inheritAttrs: false,
15
+ __name: "DatePicker",
16
+ props: /*@__PURE__*/ mergeModels({
17
+ variant: {},
18
+ fieldVariant: {},
19
+ label: {},
20
+ supportingText: {},
21
+ error: { type: Boolean },
22
+ errorText: {},
23
+ required: { type: Boolean },
24
+ disabled: { type: Boolean },
25
+ name: {},
26
+ min: {},
27
+ max: {},
28
+ isDateDisabled: { type: Function },
29
+ locale: {},
30
+ firstDayOfWeek: {},
31
+ messages: {},
32
+ clearable: { type: Boolean },
33
+ initialMode: {}
34
+ }, {
35
+ "modelValue": {},
36
+ "modelModifiers": {},
37
+ "open": {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ "openModifiers": {}
42
+ }),
43
+ emits: ["update:modelValue", "update:open"],
44
+ setup(__props) {
45
+ const props = __props;
46
+ /** The date, `YYYY-MM-DD`, with `v-model`. */
47
+ const model = useModel(__props, "modelValue");
48
+ /** Whether the calendar is shown, with `v-model:open`. The picker keeps it when not bound. */
49
+ const open = useModel(__props, "open");
50
+ const locale = useLocale(() => props.locale);
51
+ const messages = useMessages("datePicker", locale, () => props.messages);
52
+ const state = reactive(initialPickerState(model.value, locale.value, props));
53
+ const picker = createDatePicker({
54
+ props: () => ({
55
+ variant: props.variant,
56
+ name: props.name,
57
+ disabled: props.disabled,
58
+ supportingText: props.supportingText,
59
+ error: props.error,
60
+ errorText: props.errorText,
61
+ value: model.value,
62
+ open: open.value,
63
+ min: props.min,
64
+ max: props.max,
65
+ locale: locale.value,
66
+ clearable: props.clearable
67
+ }),
68
+ isDateDisabled: (date) => !!props.isDateDisabled?.(date),
69
+ messages: () => messages.value,
70
+ state: () => state,
71
+ onChange: (next) => model.value = next,
72
+ onOpenChange: (next) => open.value = next,
73
+ onStateChange: (next) => Object.assign(state, next)
74
+ });
75
+ watch([model, locale], () => picker.valueChanged());
76
+ const root = useTemplateRef("root");
77
+ const menu = useTemplateRef("menu");
78
+ let handle;
79
+ onMounted(() => {
80
+ if (!menu.value) return;
81
+ handle = attachDatePickerMenu(root.value, menu.value, {
82
+ anchor: () => root.value?.querySelector(".rio-text-field__frame"),
83
+ field: () => root.value?.querySelector(".rio-text-field__input"),
84
+ focusOnOpen: picker.focusOnOpen,
85
+ onClose: picker.cancel
86
+ });
87
+ handle.sync(open.value);
88
+ });
89
+ watch(open, (next) => {
90
+ if (next) picker.opened();
91
+ });
92
+ watch(open, (next) => handle?.sync(next), { flush: "post" });
93
+ onBeforeUnmount(() => handle?.detach());
94
+ return (_ctx, _cache) => {
95
+ return openBlock(), createElementBlock("div", mergeProps({
96
+ ref_key: "root",
97
+ ref: root
98
+ }, unref(picker).parts.root(), {
99
+ class: _ctx.$attrs.class,
100
+ style: _ctx.$attrs.style
101
+ }), [
102
+ createElementVNode("div", mergeProps(unref(picker).parts.field(), { onClick: _cache[1] || (_cache[1] = (...args) => unref(picker).handleFieldClick && unref(picker).handleFieldClick(...args)) }), [createVNode(_sfc_main$3, mergeProps({
103
+ ..._ctx.$attrs,
104
+ class: void 0,
105
+ style: void 0,
106
+ ...unref(picker).field()
107
+ }, {
108
+ "model-value": state.text,
109
+ variant: __props.fieldVariant ?? "outlined",
110
+ label: __props.label,
111
+ required: __props.required,
112
+ disabled: __props.disabled,
113
+ autocomplete: "off",
114
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (text) => unref(picker).textInput(String(text))),
115
+ onChange: unref(picker).commitText,
116
+ onKeydown: unref(picker).handleFieldKeydown
117
+ }), {
118
+ "trailing-icon": withCtx(() => [createVNode(_sfc_main$2, mergeProps(unref(picker).parts.calendarButton(), {
119
+ variant: "standard",
120
+ label: unref(picker).calendarButtonLabel(),
121
+ disabled: __props.disabled,
122
+ onClick: unref(picker).toggle
123
+ }), {
124
+ default: withCtx(() => [renderSlot(_ctx.$slots, "calendar-icon")]),
125
+ _: 3
126
+ }, 16, [
127
+ "label",
128
+ "disabled",
129
+ "onClick"
130
+ ])]),
131
+ _: 3
132
+ }, 16, [
133
+ "model-value",
134
+ "variant",
135
+ "label",
136
+ "required",
137
+ "disabled",
138
+ "onChange",
139
+ "onKeydown"
140
+ ])], 16),
141
+ unref(picker).submits() ? (openBlock(), createElementBlock("input", normalizeProps(mergeProps({ key: 0 }, unref(picker).parts.formValue())), null, 16)) : createCommentVNode("v-if", true),
142
+ unref(picker).docked() ? (openBlock(), createElementBlock("div", mergeProps({
143
+ key: 1,
144
+ ref_key: "menu",
145
+ ref: menu
146
+ }, unref(picker).parts.menu()), [open.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(_sfc_main$4, {
147
+ month: state.month,
148
+ "onUpdate:month": _cache[2] || (_cache[2] = ($event) => state.month = $event),
149
+ focused: state.focused,
150
+ "onUpdate:focused": _cache[3] || (_cache[3] = ($event) => state.focused = $event),
151
+ view: state.view,
152
+ "onUpdate:view": _cache[4] || (_cache[4] = ($event) => state.view = $event),
153
+ variant: "docked",
154
+ selected: state.draft,
155
+ min: __props.min,
156
+ max: __props.max,
157
+ locale: unref(locale),
158
+ "first-day-of-week": __props.firstDayOfWeek,
159
+ "is-date-disabled": __props.isDateDisabled,
160
+ messages: unref(messages),
161
+ onSelect: unref(picker).select
162
+ }, {
163
+ "previous-icon": withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
164
+ "next-icon": withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
165
+ "dropdown-icon": withCtx(() => [renderSlot(_ctx.$slots, "dropdown-icon")]),
166
+ _: 3
167
+ }, 8, [
168
+ "month",
169
+ "focused",
170
+ "view",
171
+ "selected",
172
+ "min",
173
+ "max",
174
+ "locale",
175
+ "first-day-of-week",
176
+ "is-date-disabled",
177
+ "messages",
178
+ "onSelect"
179
+ ]), state.view === "days" ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(picker).parts.actions())), [
180
+ unref(picker).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
181
+ key: 0,
182
+ variant: "text",
183
+ onClick: unref(picker).clear
184
+ }, {
185
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).clear), 1)]),
186
+ _: 1
187
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true),
188
+ createVNode(_sfc_main$1, {
189
+ variant: "text",
190
+ onClick: unref(picker).cancel
191
+ }, {
192
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).cancel), 1)]),
193
+ _: 1
194
+ }, 8, ["onClick"]),
195
+ createVNode(_sfc_main$1, {
196
+ variant: "text",
197
+ onClick: unref(picker).confirm
198
+ }, {
199
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).ok), 1)]),
200
+ _: 1
201
+ }, 8, ["onClick"])
202
+ ], 16)) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true)], 16)) : (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 2 }, unref(picker).parts.modal())), [createVNode(_sfc_main$5, {
203
+ modelValue: model.value,
204
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => model.value = $event),
205
+ open: open.value,
206
+ "onUpdate:open": _cache[6] || (_cache[6] = ($event) => open.value = $event),
207
+ min: __props.min,
208
+ max: __props.max,
209
+ "is-date-disabled": __props.isDateDisabled,
210
+ locale: unref(locale),
211
+ "first-day-of-week": __props.firstDayOfWeek,
212
+ messages: unref(messages),
213
+ "initial-mode": __props.initialMode,
214
+ clearable: __props.clearable
215
+ }, {
216
+ "previous-icon": withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
217
+ "next-icon": withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
218
+ "dropdown-icon": withCtx(() => [renderSlot(_ctx.$slots, "dropdown-icon")]),
219
+ "edit-icon": withCtx(() => [renderSlot(_ctx.$slots, "edit-icon")]),
220
+ "calendar-icon": withCtx(() => [renderSlot(_ctx.$slots, "calendar-icon")]),
221
+ _: 3
222
+ }, 8, [
223
+ "modelValue",
224
+ "open",
225
+ "min",
226
+ "max",
227
+ "is-date-disabled",
228
+ "locale",
229
+ "first-day-of-week",
230
+ "messages",
231
+ "initial-mode",
232
+ "clearable"
233
+ ])], 16))
234
+ ], 16);
235
+ };
236
+ }
237
+ });
238
+ export { _sfc_main as default };
@@ -0,0 +1,146 @@
1
+ import _sfc_main$1 from "../icon-button/IconButton.vue.js";
2
+ import { vRipple } from "../ripple/ripple.js";
3
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderList, renderSlot, toDisplayString, unref, useModel, useTemplateRef, withCtx, withDirectives } from "vue";
4
+ import { attachCalendar, createCalendar } from "@rio-m3e/core";
5
+ // src/date-picker/DatePickerCalendar.vue
6
+ const _hoisted_1 = { class: "rio-date-picker__menu-group" };
7
+ const _hoisted_2 = { class: "rio-date-picker__menu-group" };
8
+ const _hoisted_3 = { class: "rio-date-picker__menu-group" };
9
+ const _hoisted_4 = ["onClick"];
10
+ const _hoisted_5 = ["onClick"];
11
+ const _hoisted_6 = ["onClick"];
12
+ const _sfc_main = /*@__PURE__*/ defineComponent({
13
+ __name: "DatePickerCalendar",
14
+ props: /*@__PURE__*/ mergeModels({
15
+ variant: {},
16
+ selected: {},
17
+ min: {},
18
+ max: {},
19
+ locale: {},
20
+ firstDayOfWeek: {},
21
+ isDateDisabled: { type: Function },
22
+ messages: {}
23
+ }, {
24
+ "month": { required: true },
25
+ "monthModifiers": {},
26
+ "focused": { required: true },
27
+ "focusedModifiers": {},
28
+ "view": { required: true },
29
+ "viewModifiers": {}
30
+ }),
31
+ emits: /*@__PURE__*/ mergeModels(["select"], [
32
+ "update:month",
33
+ "update:focused",
34
+ "update:view"
35
+ ]),
36
+ setup(__props, { expose: __expose, emit: __emit }) {
37
+ const props = __props;
38
+ const month = useModel(__props, "month");
39
+ const focused = useModel(__props, "focused");
40
+ const view = useModel(__props, "view");
41
+ const emit = __emit;
42
+ const calendar = createCalendar({
43
+ props: () => ({
44
+ selected: props.selected,
45
+ month: month.value,
46
+ focused: focused.value,
47
+ view: view.value,
48
+ min: props.min,
49
+ max: props.max,
50
+ locale: props.locale,
51
+ firstDayOfWeek: props.firstDayOfWeek,
52
+ variant: props.variant
53
+ }),
54
+ messages: () => props.messages,
55
+ isDateDisabled: (date) => !!props.isDateDisabled?.(date),
56
+ onSelect: (date, confirm) => emit("select", date, confirm),
57
+ onMonthChange: (next) => month.value = next,
58
+ onFocusChange: (next) => focused.value = next,
59
+ onViewChange: (next) => view.value = next
60
+ });
61
+ /** An arrow button's label and whether it can be used, from its part */
62
+ const nav = (part) => ({
63
+ label: part["aria-label"],
64
+ disabled: part.disabled !== void 0,
65
+ class: part.class
66
+ });
67
+ const root = useTemplateRef("root");
68
+ let handle;
69
+ onMounted(() => {
70
+ handle = attachCalendar(root.value, {
71
+ calendar: () => calendar,
72
+ focused: () => focused.value,
73
+ onConfirm: (date) => emit("select", date, true)
74
+ });
75
+ });
76
+ onUpdated(() => handle?.sync());
77
+ onBeforeUnmount(() => handle?.detach());
78
+ __expose({
79
+ /** Focuses the date that takes the focus, or the option shown in a list. */
80
+ focus: () => handle?.focus() });
81
+ return (_ctx, _cache) => {
82
+ return openBlock(), createElementBlock("div", mergeProps({
83
+ ref_key: "root",
84
+ ref: root
85
+ }, unref(calendar).parts.root()), [createElementVNode("div", normalizeProps(guardReactiveProps(unref(calendar).parts.header())), [__props.variant === "docked" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1, [
86
+ createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.previousMonth()), {
87
+ variant: "standard",
88
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(calendar).goMonths(-1))
89
+ }), {
90
+ default: withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
91
+ _: 3
92
+ }, 16),
93
+ withDirectives((openBlock(), createElementBlock("button", mergeProps(unref(calendar).parts.monthButton(), { onClick: _cache[1] || (_cache[1] = ($event) => unref(calendar).toggleView("months")) }), [createTextVNode(toDisplayString(unref(calendar).monthText()) + " ", 1), createElementVNode("span", normalizeProps(guardReactiveProps(unref(calendar).parts.dropdownIcon())), [renderSlot(_ctx.$slots, "dropdown-icon")], 16)], 16)), [[unref(vRipple)]]),
94
+ createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.nextMonth()), {
95
+ variant: "standard",
96
+ onClick: _cache[2] || (_cache[2] = ($event) => unref(calendar).goMonths(1))
97
+ }), {
98
+ default: withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
99
+ _: 3
100
+ }, 16)
101
+ ]), createElementVNode("span", _hoisted_2, [
102
+ createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.previousYear()), {
103
+ variant: "standard",
104
+ onClick: _cache[3] || (_cache[3] = ($event) => unref(calendar).goMonths(-12))
105
+ }), {
106
+ default: withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
107
+ _: 3
108
+ }, 16),
109
+ withDirectives((openBlock(), createElementBlock("button", mergeProps(unref(calendar).parts.yearButton(), { onClick: _cache[4] || (_cache[4] = ($event) => unref(calendar).toggleView("years")) }), [createTextVNode(toDisplayString(unref(calendar).yearText()) + " ", 1), createElementVNode("span", normalizeProps(guardReactiveProps(unref(calendar).parts.dropdownIcon())), [renderSlot(_ctx.$slots, "dropdown-icon")], 16)], 16)), [[unref(vRipple)]]),
110
+ createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.nextYear()), {
111
+ variant: "standard",
112
+ onClick: _cache[5] || (_cache[5] = ($event) => unref(calendar).goMonths(12))
113
+ }), {
114
+ default: withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
115
+ _: 3
116
+ }, 16)
117
+ ])], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("button", mergeProps(unref(calendar).parts.yearButton(), { onClick: _cache[6] || (_cache[6] = ($event) => unref(calendar).toggleView("years")) }), [createTextVNode(toDisplayString(unref(calendar).yearText()) + " ", 1), createElementVNode("span", normalizeProps(guardReactiveProps(unref(calendar).parts.dropdownIcon())), [renderSlot(_ctx.$slots, "dropdown-icon")], 16)], 16)), [[unref(vRipple)]]), createElementVNode("span", _hoisted_3, [createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.previousMonth()), {
118
+ variant: "standard",
119
+ onClick: _cache[7] || (_cache[7] = ($event) => unref(calendar).goMonths(-1))
120
+ }), {
121
+ default: withCtx(() => [renderSlot(_ctx.$slots, "previous-icon")]),
122
+ _: 3
123
+ }, 16), createVNode(_sfc_main$1, mergeProps(nav(unref(calendar).parts.nextMonth()), {
124
+ variant: "standard",
125
+ onClick: _cache[8] || (_cache[8] = ($event) => unref(calendar).goMonths(1))
126
+ }), {
127
+ default: withCtx(() => [renderSlot(_ctx.$slots, "next-icon")]),
128
+ _: 3
129
+ }, 16)])], 64))], 16), unref(calendar).view() === "days" ? (openBlock(), createElementBlock("table", normalizeProps(mergeProps({ key: 0 }, unref(calendar).parts.grid())), [createElementVNode("thead", null, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).weekdays(), (day) => {
130
+ return openBlock(), createElementBlock("th", mergeProps({ key: day }, { ref_for: true }, unref(calendar).parts.weekday(day)), toDisplayString(unref(calendar).weekdayText(day)), 17);
131
+ }), 128))])]), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).weeks(), (week) => {
132
+ return openBlock(), createElementBlock("tr", { key: week[0] }, [(openBlock(true), createElementBlock(Fragment, null, renderList(week, (date) => {
133
+ return openBlock(), createElementBlock("td", mergeProps({ key: date }, { ref_for: true }, unref(calendar).parts.cell(date)), [unref(calendar).showsDay(date) ? withDirectives((openBlock(), createElementBlock("button", mergeProps({
134
+ key: 0,
135
+ ref_for: true
136
+ }, unref(calendar).parts.day(date), { onClick: ($event) => unref(calendar).handleDayClick(date) }), [createTextVNode(toDisplayString(unref(calendar).dayText(date)), 1)], 16, _hoisted_4)), [[unref(vRipple)]]) : createCommentVNode("v-if", true)], 16);
137
+ }), 128))]);
138
+ }), 128))])], 16)) : (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(calendar).parts.list())), [unref(calendar).view() === "months" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(calendar).months(), (option) => {
139
+ return withDirectives((openBlock(), createElementBlock("button", mergeProps({ key: option }, { ref_for: true }, unref(calendar).parts.monthOption(option), { onClick: ($event) => unref(calendar).chooseMonth(option) }), [createTextVNode(toDisplayString(unref(calendar).monthName(option)), 1)], 16, _hoisted_5)), [[unref(vRipple)]]);
140
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(calendar).years(), (option) => {
141
+ return withDirectives((openBlock(), createElementBlock("button", mergeProps({ key: option }, { ref_for: true }, unref(calendar).parts.yearOption(option), { onClick: ($event) => unref(calendar).chooseYear(option) }), [createTextVNode(toDisplayString(unref(calendar).yearOptionText(option)), 1)], 16, _hoisted_6)), [[unref(vRipple)]]);
142
+ }), 128))], 16))], 16);
143
+ };
144
+ }
145
+ });
146
+ export { _sfc_main as default };
@@ -0,0 +1,58 @@
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
+ /**
21
+ * What each opening starts in: the calendar, or the text input, for dates far away, such as a
22
+ * date of birth. Defaults to `'calendar'`.
23
+ */
24
+ initialMode?: 'calendar' | 'input';
25
+ /** A Clear button at the start of Cancel and OK */
26
+ clearable?: boolean;
27
+ };
28
+ type __VLS_Slots = {
29
+ 'previous-icon'?: () => unknown;
30
+ 'next-icon'?: () => unknown;
31
+ 'dropdown-icon'?: () => unknown;
32
+ /** The mode button's icon in the calendar, which switches to the text input */
33
+ 'edit-icon'?: () => unknown;
34
+ /** The mode button's icon in the text input, which switches to the calendar */
35
+ 'calendar-icon'?: () => unknown;
36
+ };
37
+ type __VLS_ModelProps = {
38
+ /** The chosen date, `YYYY-MM-DD`, with `v-model`. It changes on OK. */
39
+ modelValue?: string | undefined;
40
+ /** Whether the dialog is shown, with `v-model:open`. */
41
+ 'open'?: boolean;
42
+ };
43
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
44
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
45
+ "update:open": (value: boolean) => any;
46
+ "update:modelValue": (value: string | undefined) => any;
47
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
48
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
49
+ "onUpdate:modelValue"?: ((value: string | undefined) => 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 };