@rio-m3e/vue 0.4.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.
@@ -0,0 +1,178 @@
1
+ import { selectKey } from "./context.js";
2
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, renderList, renderSlot, shallowReactive, toDisplayString, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
3
+ import { attachSelect, createSelect, mergePartAttrs } from "@rio-m3e/core";
4
+ import "@rio-m3e/styles/base/reduced-motion.css";
5
+ import "@rio-m3e/styles/base/anchored-position.css";
6
+ import "@rio-m3e/styles/text-field.css";
7
+ import "@rio-m3e/styles/menu.css";
8
+ import "@rio-m3e/styles/select.css";
9
+ // src/select/Select.vue
10
+ const _hoisted_1 = {
11
+ key: 0,
12
+ value: ""
13
+ };
14
+ const _hoisted_2 = ["value"];
15
+ const _sfc_main = /*@__PURE__*/ defineComponent({
16
+ inheritAttrs: false,
17
+ __name: "Select",
18
+ props: /*@__PURE__*/ mergeModels({
19
+ variant: {},
20
+ label: {},
21
+ multiple: { type: Boolean },
22
+ supportingText: {},
23
+ error: { type: Boolean },
24
+ errorText: {},
25
+ required: { type: Boolean },
26
+ disabled: { type: Boolean },
27
+ name: {},
28
+ autocomplete: {},
29
+ menuVariant: {},
30
+ instant: { type: Boolean }
31
+ }, {
32
+ "modelValue": {},
33
+ "modelModifiers": {},
34
+ "open": {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ "openModifiers": {}
39
+ }),
40
+ emits: ["update:modelValue", "update:open"],
41
+ setup(__props) {
42
+ /** The selected value, or with `multiple`, the selected values, with `v-model`. */
43
+ const model = useModel(__props, "modelValue");
44
+ /** Whether the list is open, with `v-model:open`. The select keeps it when it isn't bound. */
45
+ const open = useModel(__props, "open");
46
+ const slots = useSlots();
47
+ const entries = shallowReactive([]);
48
+ /** The options, in the order they appear once rendered */
49
+ const options = () => {
50
+ const sorted = [...entries];
51
+ if (sorted.every((entry) => entry.element())) sorted.sort((a, b) => a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
52
+ return sorted.map((entry) => ({
53
+ value: entry.value(),
54
+ label: entry.label()
55
+ }));
56
+ };
57
+ const id = useId();
58
+ const attrs = useAttrs();
59
+ const select = createSelect({
60
+ props: () => ({
61
+ variant: __props.variant,
62
+ label: __props.label,
63
+ multiple: __props.multiple,
64
+ selected: model.value,
65
+ open: open.value,
66
+ supportingText: __props.supportingText,
67
+ error: __props.error,
68
+ errorText: __props.errorText,
69
+ required: __props.required,
70
+ disabled: __props.disabled,
71
+ name: __props.name,
72
+ autocomplete: __props.autocomplete,
73
+ menuVariant: __props.menuVariant,
74
+ instant: __props.instant
75
+ }),
76
+ options,
77
+ content: () => ({ leadingIcon: !!slots["leading-icon"] }),
78
+ ids: {
79
+ get field() {
80
+ return typeof attrs.id === "string" && attrs.id ? attrs.id : `${id}-field`;
81
+ },
82
+ label: `${id}-label`,
83
+ listbox: `${id}-listbox`,
84
+ supportingText: `${id}-supporting`
85
+ },
86
+ appName: () => ({
87
+ label: typeof attrs["aria-label"] === "string" ? attrs["aria-label"] : void 0,
88
+ labelledBy: typeof attrs["aria-labelledby"] === "string" ? attrs["aria-labelledby"] : void 0
89
+ }),
90
+ onChange: (next) => model.value = next,
91
+ onOpenChange: (next) => open.value = next
92
+ });
93
+ provide(selectKey, {
94
+ isSelected: select.isSelected,
95
+ choose: select.choose,
96
+ register(entry) {
97
+ entries.push(entry);
98
+ return () => {
99
+ const index = entries.indexOf(entry);
100
+ if (index >= 0) entries.splice(index, 1);
101
+ };
102
+ }
103
+ });
104
+ const container = useTemplateRef("container");
105
+ const field = useTemplateRef("field");
106
+ const listbox = useTemplateRef("listbox");
107
+ const native = useTemplateRef("native");
108
+ let handle;
109
+ onMounted(() => {
110
+ handle = attachSelect({
111
+ container: container.value,
112
+ field: field.value,
113
+ listbox: listbox.value,
114
+ native: native.value
115
+ }, {
116
+ disabled: () => !!__props.disabled,
117
+ selected: () => select.selectedValues().map(select.nativeValue),
118
+ onOpenChange: select.setOpen,
119
+ onNativeChange: select.nativeChanged
120
+ });
121
+ handle.sync(open.value);
122
+ });
123
+ watch(() => open.value, (next) => handle?.sync(next), { flush: "post" });
124
+ watch(() => __props.disabled, (next) => next && select.setOpen(false));
125
+ onUpdated(() => handle?.update());
126
+ onBeforeUnmount(() => handle?.detach());
127
+ return (_ctx, _cache) => {
128
+ return openBlock(), createElementBlock("div", mergeProps(unref(select).parts.root(), {
129
+ class: _ctx.$attrs.class,
130
+ style: _ctx.$attrs.style
131
+ }), [
132
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(select).parts.frame())), [
133
+ unref(select).showsOutline() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.outline())), [
134
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.outlineStart())), null, 16),
135
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.outlineNotch())), toDisplayString(unref(select).labelText()), 17),
136
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.outlineEnd())), null, 16)
137
+ ], 16)) : createCommentVNode("v-if", true),
138
+ unref(select).showsLabel() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(select).parts.label())), toDisplayString(unref(select).labelText()), 17)) : createCommentVNode("v-if", true),
139
+ createElementVNode("div", mergeProps({
140
+ ref_key: "container",
141
+ ref: container
142
+ }, unref(select).parts.container()), [
143
+ unref(select).showsLeadingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.leadingIcon())), [renderSlot(_ctx.$slots, "leading-icon")], 16)) : createCommentVNode("v-if", true),
144
+ createElementVNode("div", normalizeProps(guardReactiveProps(unref(select).parts.content())), [createElementVNode("div", mergeProps({
145
+ ref_key: "field",
146
+ ref: field
147
+ }, unref(mergePartAttrs)({
148
+ ..._ctx.$attrs,
149
+ class: void 0,
150
+ style: void 0
151
+ }, unref(select).parts.field())), [createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.value())), [renderSlot(_ctx.$slots, "value", {
152
+ selected: unref(select).selectedValues(),
153
+ labels: unref(select).selectedLabels()
154
+ }, () => [createTextVNode(toDisplayString(unref(select).valueText()), 1)])], 16), createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.sizer())), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(select).sizerTexts(), (text, index) => {
155
+ return openBlock(), createElementBlock("span", { key: index }, toDisplayString(text), 1);
156
+ }), 128))], 16)], 16)], 16),
157
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(select).parts.arrow())), [renderSlot(_ctx.$slots, "dropdown-icon")], 16),
158
+ createElementVNode("select", mergeProps({
159
+ ref_key: "native",
160
+ ref: native
161
+ }, unref(select).parts.native()), [!unref(select).multiple() ? (openBlock(), createElementBlock("option", _hoisted_1)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(options(), (option) => {
162
+ return openBlock(), createElementBlock("option", {
163
+ key: unref(select).nativeValue(option.value),
164
+ value: unref(select).nativeValue(option.value)
165
+ }, toDisplayString(option.label), 9, _hoisted_2);
166
+ }), 128))], 16)
167
+ ], 16)
168
+ ], 16),
169
+ unref(select).showsSupporting() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(select).parts.supporting())), [createCommentVNode(" A new element for the error text, so it arrives with its alert role. "), (openBlock(), createElementBlock("span", mergeProps({ key: unref(select).showsErrorText() ? "error" : "supporting" }, unref(select).parts.supportingText()), toDisplayString(unref(select).supportingTextNow()), 17))], 16)) : createCommentVNode("v-if", true),
170
+ createElementVNode("div", mergeProps({
171
+ ref_key: "listbox",
172
+ ref: listbox
173
+ }, unref(select).parts.listbox()), [renderSlot(_ctx.$slots, "default")], 16)
174
+ ], 16);
175
+ };
176
+ }
177
+ });
178
+ export { _sfc_main as default };
@@ -0,0 +1,30 @@
1
+ import { SelectOptionProps } from "@rio-m3e/core";
2
+ import "@rio-m3e/styles/base/focus-ring.css";
3
+ import "@rio-m3e/styles/base/state-layer.css";
4
+ import "@rio-m3e/styles/menu.css";
5
+ type __VLS_Slots = {
6
+ /** The label, which the field shows while the option is selected */
7
+ default?: () => unknown;
8
+ /**
9
+ * A leading icon, hidden from assistive technology. `selected` lets it show a check mark next to
10
+ * the color and shape.
11
+ */
12
+ icon?: (props: {
13
+ selected: boolean;
14
+ }) => unknown;
15
+ /** Supporting text under the label */
16
+ 'supporting-text'?: () => unknown;
17
+ /** Trailing text */
18
+ 'trailing-text'?: () => unknown;
19
+ /** A trailing icon, hidden from assistive technology */
20
+ 'trailing-icon'?: () => unknown;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<SelectOptionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectOptionProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
24
+ declare const _default: typeof __VLS_export;
25
+ type __VLS_WithSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
30
+ export { _default as default };
@@ -0,0 +1,58 @@
1
+ import { vRipple } from "../ripple/ripple.js";
2
+ import { selectKey } from "./context.js";
3
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, unref, useSlots, useTemplateRef, withDirectives } from "vue";
4
+ import { createSelectOption } from "@rio-m3e/core";
5
+ import "@rio-m3e/styles/base/focus-ring.css";
6
+ import "@rio-m3e/styles/base/state-layer.css";
7
+ import "@rio-m3e/styles/menu.css";
8
+ // src/select/SelectOption.vue
9
+ const _sfc_main = /*@__PURE__*/ defineComponent({
10
+ __name: "SelectOption",
11
+ props: {
12
+ value: {},
13
+ disabled: { type: Boolean }
14
+ },
15
+ setup(__props) {
16
+ const slots = useSlots();
17
+ const select = inject(selectKey, void 0);
18
+ if (!select) throw new Error("RioSelectOption has to be inside a RioSelect.");
19
+ const option = createSelectOption({
20
+ props: () => ({
21
+ value: __props.value,
22
+ disabled: __props.disabled
23
+ }),
24
+ content: () => ({
25
+ icon: !!slots.icon,
26
+ supportingText: !!slots["supporting-text"],
27
+ trailingText: !!slots["trailing-text"],
28
+ trailingIcon: !!slots["trailing-icon"]
29
+ }),
30
+ select: () => select
31
+ });
32
+ const root = useTemplateRef("root");
33
+ const labelElement = useTemplateRef("label");
34
+ const text = ref("");
35
+ const read = () => text.value = labelElement.value?.textContent?.trim() ?? "";
36
+ const unregister = select.register({
37
+ value: () => __props.value,
38
+ label: () => text.value,
39
+ element: () => root.value
40
+ });
41
+ onMounted(read);
42
+ onUpdated(read);
43
+ onBeforeUnmount(unregister);
44
+ return (_ctx, _cache) => {
45
+ return withDirectives((openBlock(), createElementBlock("button", mergeProps({
46
+ ref_key: "root",
47
+ ref: root
48
+ }, unref(option).parts.root(), { onClick: _cache[0] || (_cache[0] = (...args) => unref(option).handleClick && unref(option).handleClick(...args)) }), [
49
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(option).parts.touch())), null, 16),
50
+ unref(option).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(option).parts.icon())), [renderSlot(_ctx.$slots, "icon", { selected: unref(option).selected() })], 16)) : createCommentVNode("v-if", true),
51
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(option).parts.text())), [createElementVNode("span", mergeProps({ ref: "label" }, unref(option).parts.label()), [renderSlot(_ctx.$slots, "default")], 16), unref(option).showsSupportingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(option).parts.supportingText())), [renderSlot(_ctx.$slots, "supporting-text")], 16)) : createCommentVNode("v-if", true)], 16),
52
+ unref(option).showsTrailingText() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(option).parts.trailingText())), [renderSlot(_ctx.$slots, "trailing-text")], 16)) : createCommentVNode("v-if", true),
53
+ unref(option).showsTrailingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 2 }, unref(option).parts.trailingIcon())), [renderSlot(_ctx.$slots, "trailing-icon")], 16)) : createCommentVNode("v-if", true)
54
+ ], 16)), [[unref(vRipple)]]);
55
+ };
56
+ }
57
+ });
58
+ export { _sfc_main as default };
@@ -0,0 +1,3 @@
1
+ // src/select/context.ts
2
+ const selectKey = Symbol("RioSelect");
3
+ export { selectKey };
@@ -19,11 +19,11 @@ declare const __VLS_base: import("vue").DefineComponent<SplitButtonProps, {
19
19
  leading: Readonly<import("vue").ShallowRef<HTMLButtonElement | null>>;
20
20
  trailing: Readonly<import("vue").ShallowRef<HTMLButtonElement | null>>;
21
21
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
- click: (event: MouseEvent) => any;
23
22
  "update:open": (open: boolean) => any;
23
+ click: (event: MouseEvent) => any;
24
24
  }, string, import("vue").PublicProps, Readonly<SplitButtonProps> & Readonly<{
25
- onClick?: ((event: MouseEvent) => any) | undefined;
26
25
  "onUpdate:open"?: ((open: boolean) => any) | undefined;
26
+ onClick?: ((event: MouseEvent) => any) | undefined;
27
27
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
29
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,5 @@
1
1
  import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, toDisplayString, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelText, withDirectives } from "vue";
2
- import { attachTextField, createTextField } from "@rio-m3e/core";
2
+ import { attachTextField, createTextField, mergePartAttrs } from "@rio-m3e/core";
3
3
  import "@rio-m3e/styles/base/reduced-motion.css";
4
4
  import "@rio-m3e/styles/text-field.css";
5
5
  // src/text-field/TextField.vue
@@ -95,22 +95,20 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
95
95
  ref_key: "input",
96
96
  ref: input,
97
97
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
98
- }, {
98
+ }, unref(mergePartAttrs)({
99
99
  ..._ctx.$attrs,
100
100
  class: void 0,
101
- style: void 0,
102
- ...unref(field).parts.input()
103
- }), null, 16)), [[vModelDynamic, model.value]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
101
+ style: void 0
102
+ }, unref(field).parts.input())), null, 16)), [[vModelDynamic, model.value]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
104
103
  key: 2,
105
104
  ref_key: "input",
106
105
  ref: input,
107
106
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event)
108
- }, {
107
+ }, unref(mergePartAttrs)({
109
108
  ..._ctx.$attrs,
110
109
  class: void 0,
111
- style: void 0,
112
- ...unref(field).parts.textarea()
113
- }), null, 16)), [[vModelText, model.value]]),
110
+ style: void 0
111
+ }, unref(field).parts.textarea())), null, 16)), [[vModelText, model.value]]),
114
112
  unref(field).showsSuffix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 3 }, unref(field).parts.suffix())), toDisplayString(__props.suffix), 17)) : createCommentVNode("v-if", true)
115
113
  ], 16),
116
114
  unref(field).showsTrailingIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.trailingIcon())), [renderSlot(_ctx.$slots, "trailing-icon")], 16)) : createCommentVNode("v-if", true)
@@ -0,0 +1,25 @@
1
+ import { HourCycle, TimePickerMessages } 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/time-picker.css";
6
+ type __VLS_Props = {
7
+ /** A language tag. Without it, the one provided, or the document's, or the browser's. */
8
+ locale?: string;
9
+ /** Overrides the language's clock: 12 hours with AM and PM, or 24. */
10
+ hourCycle?: HourCycle;
11
+ /** Replaces any of the text the picker shows. */
12
+ messages?: Partial<TimePickerMessages>;
13
+ };
14
+ type __VLS_ModelProps = {
15
+ /** The time, `HH:MM` on a 24-hour clock, with `v-model`. */
16
+ modelValue?: string | undefined;
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string | undefined) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export { _default as default };
@@ -0,0 +1,71 @@
1
+ import { useLocale, useMessages } from "../locale/locale.js";
2
+ import _sfc_main$1 from "./TimePickerBody.vue.js";
3
+ import { createCommentVNode, createElementBlock, createVNode, defineComponent, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, reactive, toDisplayString, unref, useId, useModel, useTemplateRef, watch } from "vue";
4
+ import { attachTimePicker, createTimePicker, initialTimeState } from "@rio-m3e/core";
5
+ import "@rio-m3e/styles/base/focus-ring.css";
6
+ import "@rio-m3e/styles/base/reduced-motion.css";
7
+ import "@rio-m3e/styles/base/state-layer.css";
8
+ import "@rio-m3e/styles/time-picker.css";
9
+ // src/time-picker/TimeInput.vue
10
+ const _sfc_main = /*@__PURE__*/ defineComponent({
11
+ __name: "TimeInput",
12
+ props: /*@__PURE__*/ mergeModels({
13
+ locale: {},
14
+ hourCycle: {},
15
+ messages: {}
16
+ }, {
17
+ "modelValue": {},
18
+ "modelModifiers": {}
19
+ }),
20
+ emits: ["update:modelValue"],
21
+ setup(__props) {
22
+ const props = __props;
23
+ /** The time, `HH:MM` on a 24-hour clock, with `v-model`. */
24
+ const model = useModel(__props, "modelValue");
25
+ const locale = useLocale(() => props.locale);
26
+ const messages = useMessages("timePicker", locale, () => props.messages);
27
+ const state = reactive({
28
+ ...initialTimeState(model.value),
29
+ mode: "input"
30
+ });
31
+ const id = useId();
32
+ const picker = createTimePicker({
33
+ variant: "inline",
34
+ props: () => ({
35
+ value: model.value,
36
+ locale: locale.value,
37
+ hourCycle: props.hourCycle
38
+ }),
39
+ messages: () => messages.value,
40
+ state: () => state,
41
+ ids: { error: `${id}-error` },
42
+ onChange: (next) => model.value = next,
43
+ onStateChange: (next) => Object.assign(state, next)
44
+ });
45
+ picker.valueChanged();
46
+ watch([
47
+ model,
48
+ locale,
49
+ () => props.hourCycle
50
+ ], () => picker.valueChanged());
51
+ const root = useTemplateRef("root");
52
+ let handle;
53
+ onMounted(() => {
54
+ handle = attachTimePicker(root.value, {
55
+ selection: () => state.selection,
56
+ hourCycle: picker.hourCycle,
57
+ onPick: picker.dialPick,
58
+ onPeriod: picker.selectPeriod
59
+ });
60
+ });
61
+ watch(state, () => handle?.sync(), { flush: "post" });
62
+ onBeforeUnmount(() => handle?.detach());
63
+ return (_ctx, _cache) => {
64
+ return openBlock(), createElementBlock("div", mergeProps({
65
+ ref_key: "root",
66
+ ref: root
67
+ }, unref(picker).parts.root()), [createVNode(_sfc_main$1, { picker: unref(picker) }, null, 8, ["picker"]), unref(picker).showsError() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, unref(picker).parts.error())), toDisplayString(unref(picker).error()), 17)) : createCommentVNode("v-if", true)], 16);
68
+ };
69
+ }
70
+ });
71
+ export { _sfc_main as default };
@@ -0,0 +1,46 @@
1
+ import { vRipple } from "../ripple/ripple.js";
2
+ import { vShapeMorph } from "../shape-morph/shape-morph.js";
3
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderList, toDisplayString, unref, withDirectives, withKeys } from "vue";
4
+ // src/time-picker/TimePickerBody.vue
5
+ const _hoisted_1 = ["value"];
6
+ const _hoisted_2 = ["value"];
7
+ const _hoisted_3 = ["onClick"];
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ __name: "TimePickerBody",
10
+ props: { picker: {} },
11
+ setup(__props) {
12
+ return (_ctx, _cache) => {
13
+ return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(__props.picker.parts.body())), [
14
+ createElementVNode("div", normalizeProps(guardReactiveProps(__props.picker.parts.fields())), [__props.picker.textInput() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
15
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.unit())), [createElementVNode("input", mergeProps(__props.picker.parts.hourField(), {
16
+ value: __props.picker.hourText(),
17
+ onInput: _cache[0] || (_cache[0] = ($event) => __props.picker.hourInput($event.target.value)),
18
+ onChange: _cache[1] || (_cache[1] = (...args) => __props.picker.commitText && __props.picker.commitText(...args)),
19
+ onKeydown: _cache[2] || (_cache[2] = withKeys((...args) => __props.picker.commitText && __props.picker.commitText(...args), ["enter"]))
20
+ }), null, 16, _hoisted_1), createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.hourLabel())), toDisplayString(__props.picker.fieldNames()[0]), 17)], 16),
21
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.separator())), ":", 16),
22
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.unit())), [createElementVNode("input", mergeProps(__props.picker.parts.minuteField(), {
23
+ value: __props.picker.minuteText(),
24
+ onInput: _cache[3] || (_cache[3] = ($event) => __props.picker.minuteInput($event.target.value)),
25
+ onChange: _cache[4] || (_cache[4] = (...args) => __props.picker.commitText && __props.picker.commitText(...args)),
26
+ onKeydown: _cache[5] || (_cache[5] = withKeys((...args) => __props.picker.commitText && __props.picker.commitText(...args), ["enter"]))
27
+ }), null, 16, _hoisted_2), createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.minuteLabel())), toDisplayString(__props.picker.fieldNames()[1]), 17)], 16)
28
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
29
+ withDirectives((openBlock(), createElementBlock("button", mergeProps(__props.picker.parts.hourField(), { onClick: _cache[6] || (_cache[6] = ($event) => __props.picker.selectField("hour")) }), [createTextVNode(toDisplayString(__props.picker.hourText()), 1)], 16)), [[unref(vRipple)]]),
30
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.separator())), ":", 16),
31
+ withDirectives((openBlock(), createElementBlock("button", mergeProps(__props.picker.parts.minuteField(), { onClick: _cache[7] || (_cache[7] = ($event) => __props.picker.selectField("minute")) }), [createTextVNode(toDisplayString(__props.picker.minuteText()), 1)], 16)), [[unref(vRipple)]])
32
+ ], 64))], 16),
33
+ __props.picker.showsPeriod() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, __props.picker.parts.period())), [withDirectives((openBlock(), createElementBlock("button", mergeProps(__props.picker.parts.am(), { onClick: _cache[8] || (_cache[8] = ($event) => __props.picker.selectPeriod(false)) }), [createTextVNode(toDisplayString(__props.picker.periodNames()[0]) + " ", 1), createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.periodTouch())), null, 16)], 16)), [[unref(vRipple)], [unref(vShapeMorph)]]), withDirectives((openBlock(), createElementBlock("button", mergeProps(__props.picker.parts.pm(), { onClick: _cache[9] || (_cache[9] = ($event) => __props.picker.selectPeriod(true)) }), [createTextVNode(toDisplayString(__props.picker.periodNames()[1]) + " ", 1), createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.periodTouch())), null, 16)], 16)), [[unref(vRipple)], [unref(vShapeMorph)]])], 16)) : createCommentVNode("v-if", true),
34
+ __props.picker.showsDial() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, __props.picker.parts.dial())), [
35
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.dialTrack())), null, 16),
36
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.dialHandle())), null, 16),
37
+ createElementVNode("span", normalizeProps(guardReactiveProps(__props.picker.parts.dialCenter())), null, 16),
38
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.picker.dialItems(), (item) => {
39
+ return openBlock(), createElementBlock("button", mergeProps({ key: `${item.value}` }, { ref_for: true }, __props.picker.parts.dialItem(item), { onClick: ($event) => __props.picker.handleNumberClick($event, item.value) }), toDisplayString(item.label), 17, _hoisted_3);
40
+ }), 128))
41
+ ], 16)) : createCommentVNode("v-if", true)
42
+ ], 16);
43
+ };
44
+ }
45
+ });
46
+ export { _sfc_main as default };
@@ -0,0 +1,46 @@
1
+ import { HourCycle, TimePickerLayout, TimePickerMessages, TimePickerMode } 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/dialog.css";
6
+ import "@rio-m3e/styles/time-picker.css";
7
+ type __VLS_Props = {
8
+ /** A language tag. Without it, the one provided, or the document's, or the browser's. */
9
+ locale?: string;
10
+ /** Overrides the language's clock: 12 hours with AM and PM, or 24. */
11
+ hourCycle?: HourCycle;
12
+ /** The dial beside the fields, or below them. Defaults to `'auto'`, from the window's height. */
13
+ layout?: TimePickerLayout;
14
+ /** What each opening starts in: the dial, or the text input. Defaults to `'dial'`. */
15
+ initialMode?: TimePickerMode;
16
+ /** Replaces any of the text the dialog shows. */
17
+ messages?: Partial<TimePickerMessages>;
18
+ };
19
+ type __VLS_Slots = {
20
+ /** The mode button's icon on the dial, which switches to the text input */
21
+ 'keyboard-icon'?: () => unknown;
22
+ /** The mode button's icon in the text input, which switches to the dial */
23
+ 'clock-icon'?: () => unknown;
24
+ };
25
+ type __VLS_ModelProps = {
26
+ /** The time, `HH:MM` on a 24-hour clock, with `v-model`. It changes on OK. */
27
+ modelValue?: string | undefined;
28
+ /** Whether the dialog is shown, with `v-model:open`. */
29
+ 'open'?: boolean;
30
+ };
31
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
32
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
+ "update:open": (value: boolean) => any;
34
+ "update:modelValue": (value: string | undefined) => any;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
36
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
37
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
38
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
+ declare const _default: typeof __VLS_export;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
46
+ export { _default as default };