@rio-m3e/vue 0.5.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 (71) hide show
  1. package/NOTICE +6 -0
  2. package/dist/button/Button.vue.d.ts +3 -2
  3. package/dist/button/Button.vue.js +3 -2
  4. package/dist/checkbox/Checkbox.vue.d.ts +1 -0
  5. package/dist/checkbox/Checkbox.vue.js +5 -7
  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 +2 -2
  19. package/dist/date-picker/DatePicker.vue.js +5 -4
  20. package/dist/date-picker/DatePickerDialog.vue.d.ts +2 -2
  21. package/dist/date-picker/DatePickerDialog.vue.js +7 -15
  22. package/dist/date-picker/DateRangeCalendar.vue.js +89 -0
  23. package/dist/date-picker/DateRangePickerDialog.vue.d.ts +56 -0
  24. package/dist/date-picker/DateRangePickerDialog.vue.js +208 -0
  25. package/dist/dialog/Dialog.vue.js +12 -13
  26. package/dist/icon-button/IconButton.vue.d.ts +3 -2
  27. package/dist/icon-button/IconButton.vue.js +3 -2
  28. package/dist/index.d.ts +39 -24
  29. package/dist/index.js +39 -24
  30. package/dist/list/List.vue.d.ts +23 -0
  31. package/dist/list/List.vue.js +61 -0
  32. package/dist/list/ListItem.vue.d.ts +49 -0
  33. package/dist/list/ListItem.vue.js +106 -0
  34. package/dist/list/context.js +12 -0
  35. package/dist/loading-indicator/LoadingIndicator.vue.d.ts +5 -0
  36. package/dist/loading-indicator/LoadingIndicator.vue.js +45 -0
  37. package/dist/menu/Menu.vue.d.ts +2 -2
  38. package/dist/menu/Menu.vue.js +9 -4
  39. package/dist/menu/SubMenu.vue.js +35 -24
  40. package/dist/overlay/presses.js +9 -0
  41. package/dist/progress/CircularProgress.vue.d.ts +5 -0
  42. package/dist/progress/CircularProgress.vue.js +54 -0
  43. package/dist/progress/LinearProgress.vue.d.ts +4 -0
  44. package/dist/progress/LinearProgress.vue.js +62 -0
  45. package/dist/radio/Radio.vue.d.ts +3 -2
  46. package/dist/radio/Radio.vue.js +14 -12
  47. package/dist/rio/rio.d.ts +3 -8
  48. package/dist/rio/rio.js +4 -16
  49. package/dist/ripple/ripple.js +14 -1
  50. package/dist/scroll-field/ScrollField.vue.d.ts +19 -0
  51. package/dist/scroll-field/ScrollField.vue.js +121 -0
  52. package/dist/select/Select.vue.d.ts +2 -2
  53. package/dist/select/Select.vue.js +3 -2
  54. package/dist/slider/RangeSlider.vue.d.ts +17 -0
  55. package/dist/slider/RangeSlider.vue.js +92 -0
  56. package/dist/slider/Slider.vue.d.ts +25 -0
  57. package/dist/slider/Slider.vue.js +102 -0
  58. package/dist/split-button/SplitButton.vue.d.ts +1 -0
  59. package/dist/split-button/SplitButton.vue.js +4 -3
  60. package/dist/switch/Switch.vue.js +33 -8
  61. package/dist/text-field/TextField.vue.js +1 -2
  62. package/dist/time-picker/TimeInput.vue.d.ts +1 -0
  63. package/dist/time-picker/TimeInput.vue.js +5 -3
  64. package/dist/time-picker/TimePickerBody.vue.js +33 -7
  65. package/dist/time-picker/TimePickerDialog.vue.d.ts +11 -6
  66. package/dist/time-picker/TimePickerDialog.vue.js +16 -21
  67. package/dist/time-picker/TimeScroll.vue.d.ts +38 -0
  68. package/dist/time-picker/TimeScroll.vue.js +81 -0
  69. package/dist/tooltip/Tooltip.vue.js +10 -22
  70. package/package.json +4 -4
  71. package/dist/shape-morph/shape-morph.js +0 -18
@@ -0,0 +1,62 @@
1
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, unref, useTemplateRef } from "vue";
2
+ import { attachLinearProgress, createLinearProgress } from "@rio-m3e/core";
3
+ import "@rio-m3e/styles/progress.css";
4
+ // src/progress/LinearProgress.vue
5
+ const _sfc_main = /*@__PURE__*/ defineComponent({
6
+ __name: "LinearProgress",
7
+ props: {
8
+ value: {},
9
+ max: {},
10
+ wavy: { type: Boolean },
11
+ thickness: {}
12
+ },
13
+ setup(__props) {
14
+ const progress = createLinearProgress({ props: () => ({
15
+ value: __props.value,
16
+ max: __props.max,
17
+ wavy: __props.wavy,
18
+ thickness: __props.thickness
19
+ }) });
20
+ const root = useTemplateRef("root");
21
+ const indicator = useTemplateRef("indicator");
22
+ const indicatorLower = useTemplateRef("indicatorLower");
23
+ const wave = useTemplateRef("wave");
24
+ const waveLower = useTemplateRef("waveLower");
25
+ let handle;
26
+ onMounted(() => {
27
+ handle = attachLinearProgress(root.value, {
28
+ wavy: progress.showsWave,
29
+ indicators: () => [indicator.value, indicatorLower.value],
30
+ waves: () => [wave.value, waveLower.value]
31
+ });
32
+ });
33
+ onUpdated(() => handle?.sync());
34
+ onBeforeUnmount(() => handle?.detach());
35
+ return (_ctx, _cache) => {
36
+ return openBlock(), createElementBlock("div", mergeProps({
37
+ ref_key: "root",
38
+ ref: root
39
+ }, unref(progress).parts.root()), [
40
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(progress).parts.trackLower())), null, 16),
41
+ createElementVNode("span", mergeProps({
42
+ ref_key: "indicatorLower",
43
+ ref: indicatorLower
44
+ }, unref(progress).parts.indicatorLower()), null, 16),
45
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(progress).parts.trackMiddle())), null, 16),
46
+ createElementVNode("span", mergeProps({
47
+ ref_key: "indicator",
48
+ ref: indicator
49
+ }, unref(progress).parts.indicator()), null, 16),
50
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(progress).parts.trackUpper())), null, 16),
51
+ unref(progress).showsWave() ? (openBlock(), createElementBlock("svg", normalizeProps(mergeProps({ key: 0 }, unref(progress).parts.wave())), [createElementVNode("path", mergeProps({
52
+ ref_key: "waveLower",
53
+ ref: waveLower
54
+ }, unref(progress).parts.indicatorLowerWave()), null, 16), createElementVNode("path", mergeProps({
55
+ ref_key: "wave",
56
+ ref: wave
57
+ }, unref(progress).parts.indicatorWave()), null, 16)], 16)) : createCommentVNode("v-if", true)
58
+ ], 16);
59
+ };
60
+ }
61
+ });
62
+ export { _sfc_main as default };
@@ -1,10 +1,11 @@
1
1
  import { RadioProps, RadioValue } from "@rio-m3e/core";
2
+ import "@rio-m3e/styles/base/focus-ring.css";
2
3
  import "@rio-m3e/styles/base/reduced-motion.css";
3
4
  import "@rio-m3e/styles/base/ripple.css";
4
5
  import "@rio-m3e/styles/radio.css";
5
- interface Props extends Omit<RadioProps, 'selected'> {
6
+ interface Props extends RadioProps {
6
7
  /** The group's `v-model` takes this value when the radio button is selected. */
7
- value: RadioValue;
8
+ value?: RadioValue;
8
9
  }
9
10
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
11
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,8 @@
1
+ import { useRipple } from "../ripple/ripple.js";
1
2
  import { radioGroupKey } from "./context.js";
2
3
  import { createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, unref, useTemplateRef } from "vue";
3
- import { attachCheckable, attachRipple, createRadio, mergePartAttrs } from "@rio-m3e/core";
4
+ import { attachCheckable, createRadio, mergePartAttrs } from "@rio-m3e/core";
5
+ import "@rio-m3e/styles/base/focus-ring.css";
4
6
  import "@rio-m3e/styles/base/reduced-motion.css";
5
7
  import "@rio-m3e/styles/base/ripple.css";
6
8
  import "@rio-m3e/styles/radio.css";
@@ -10,40 +12,40 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
10
12
  __name: "Radio",
11
13
  props: {
12
14
  value: {},
15
+ selected: { type: Boolean },
13
16
  disabled: { type: Boolean },
14
17
  softDisabled: { type: Boolean }
15
18
  },
16
19
  setup(__props) {
17
- const group = inject(radioGroupKey);
18
- if (!group) throw new Error("RioRadio has to be inside a RioRadioGroup.");
20
+ const group = inject(radioGroupKey, null);
21
+ if (group && __props.value === void 0) throw new Error("RioRadio in a RioRadioGroup needs a value.");
22
+ const isSelected = () => group ? group.isSelected(__props.value) : !!__props.selected;
19
23
  const radio = createRadio({
20
24
  props: () => ({
21
- selected: group.isSelected(__props.value),
25
+ selected: isSelected(),
22
26
  disabled: __props.disabled,
23
27
  softDisabled: __props.softDisabled
24
28
  }),
25
- name: group.name,
26
- value: () => String(__props.value)
29
+ name: () => group?.name() ?? "",
30
+ value: () => String(__props.value ?? "")
27
31
  });
28
32
  const input = useTemplateRef("input");
29
33
  const state = useTemplateRef("state");
34
+ useRipple(input, state);
30
35
  let checkable;
31
- let ripple;
32
36
  let unregister;
33
37
  onMounted(() => {
34
38
  checkable = attachCheckable(input.value, {
35
- checked: () => group.isSelected(__props.value),
39
+ checked: isSelected,
36
40
  blocked: radio.blocked,
37
- onChange: (checked) => checked && group.select(__props.value)
41
+ onChange: (checked) => group ? checked && group.select(__props.value) : checkable?.sync()
38
42
  });
39
- unregister = group.register(checkable);
40
- ripple = attachRipple(input.value, { surface: state.value });
43
+ unregister = group?.register(checkable);
41
44
  });
42
45
  onUpdated(() => checkable?.sync());
43
46
  onBeforeUnmount(() => {
44
47
  unregister?.();
45
48
  checkable?.detach();
46
- ripple?.detach();
47
49
  });
48
50
  return (_ctx, _cache) => {
49
51
  return openBlock(), createElementBlock("span", mergeProps(unref(radio).parts.root(), {
package/dist/rio/rio.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import { App, MaybeRefOrGetter } from "vue";
2
2
  import { PartialMessages } from "@rio-m3e/core";
3
- import { ThemeColorScheme, ThemeOptions } from "@rio-m3e/tokens";
4
- export interface RioThemeOptions extends ThemeOptions {
5
- /**
6
- * The root's `color-scheme`, which picks each color's light or dark value. `false` leaves it to
7
- * the app. Defaults to `'light dark'`, which follows the system.
8
- */
9
- colorScheme?: ThemeColorScheme;
10
- }
3
+ import { ThemeOptions } from "@rio-m3e/tokens";
4
+ /** The theme: `@rio-m3e/tokens`' options, with the `color-scheme` written with it */
5
+ export type RioThemeOptions = ThemeOptions;
11
6
  export interface RioOptions {
12
7
  /**
13
8
  * The theme, written as `--rio-*` variables on the document's root as the app installs Rio,
package/dist/rio/rio.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { localeKey, messagesKey } from "../locale/locale.js";
2
2
  import { computed, effectScope, toRef, toValue, watchEffect } from "vue";
3
- import { createThemeCss, createThemeVariables } from "@rio-m3e/tokens";
3
+ import { attachTheme, createThemeCss } from "@rio-m3e/tokens";
4
4
  // src/rio/rio.ts
5
5
  /**
6
6
  * Rio for a whole app: `app.use(createRio({ theme: { sourceColor: '#6750a4' }, locale: 'ko' }))`.
@@ -19,24 +19,12 @@ function createRio(options = {}) {
19
19
  fallbackLocale: toValue(options.fallbackLocale)
20
20
  })));
21
21
  if (options.theme === void 0 || typeof document === "undefined") return;
22
- const root = document.documentElement;
23
- let written = /* @__PURE__ */ new Set();
22
+ const theme = attachTheme(document.documentElement);
24
23
  const scope = effectScope(true);
25
- scope.run(() => watchEffect(() => {
26
- const theme = toValue(options.theme);
27
- const next = /* @__PURE__ */ new Map();
28
- if (theme) {
29
- const { colorScheme = "light dark", ...rest } = theme;
30
- for (const [name, value] of Object.entries(createThemeVariables(rest))) next.set(name, value);
31
- if (colorScheme) next.set("color-scheme", colorScheme);
32
- }
33
- for (const name of written) if (!next.has(name)) root.style.removeProperty(name);
34
- for (const [name, value] of next) root.style.setProperty(name, value);
35
- written = new Set(next.keys());
36
- }));
24
+ scope.run(() => watchEffect(() => theme.update(toValue(options.theme))));
37
25
  app.onUnmount(() => {
38
26
  scope.stop();
39
- for (const name of written) root.style.removeProperty(name);
27
+ theme.detach();
40
28
  });
41
29
  }
42
30
  };
@@ -1,3 +1,4 @@
1
+ import { watch } from "vue";
1
2
  import { attachRipple } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/ripple.css";
3
4
  // src/ripple/ripple.ts
@@ -29,4 +30,16 @@ const vRipple = {
29
30
  sync(el, false);
30
31
  }
31
32
  };
32
- export { vRipple };
33
+ /**
34
+ * For a component whose presses ripple on one of its parts: presses on `element` ripple on
35
+ * `surface`, as on a checkbox's input and its state part. Attaches again when either element is
36
+ * replaced, as when a chip turns into a link, and detaches as the component unmounts.
37
+ */
38
+ function useRipple(element, surface) {
39
+ watch([element, surface], ([el, state], _, onCleanup) => {
40
+ if (!el || !state) return;
41
+ const ripple = attachRipple(el, { surface: state });
42
+ onCleanup(() => ripple.detach());
43
+ }, { flush: "post" });
44
+ }
45
+ export { useRipple, vRipple };
@@ -0,0 +1,19 @@
1
+ import { ScrollFieldProps, ScrollFieldValue } 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/scroll-field.css";
5
+ type __VLS_Props = Omit<ScrollFieldProps, 'value'> & {
6
+ /** The value in the middle, with `v-model`. */
7
+ modelValue?: ScrollFieldValue;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:modelValue": (value: ScrollFieldValue) => any;
11
+ "update:editing": (editing: boolean) => any;
12
+ "update:invalid": (invalid: boolean) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ "onUpdate:modelValue"?: ((value: ScrollFieldValue) => any) | undefined;
15
+ "onUpdate:editing"?: ((editing: boolean) => any) | undefined;
16
+ "onUpdate:invalid"?: ((invalid: boolean) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export { _default as default };
@@ -0,0 +1,121 @@
1
+ import { useLocale } from "../locale/locale.js";
2
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, isMemoSame, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderList, toDisplayString, unref, useId, useModel, useTemplateRef } from "vue";
3
+ import { attachScrollField, createScrollField } from "@rio-m3e/core";
4
+ import "@rio-m3e/styles/base/focus-ring.css";
5
+ import "@rio-m3e/styles/base/reduced-motion.css";
6
+ import "@rio-m3e/styles/scroll-field.css";
7
+ // src/scroll-field/ScrollField.vue
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ __name: "ScrollField",
10
+ props: {
11
+ min: {},
12
+ max: {},
13
+ step: {},
14
+ options: {},
15
+ format: { type: Function },
16
+ label: {},
17
+ loop: { type: Boolean },
18
+ size: {},
19
+ editing: { type: Boolean },
20
+ invalid: { type: Boolean },
21
+ locale: {},
22
+ name: {},
23
+ disabled: { type: Boolean },
24
+ softDisabled: { type: Boolean },
25
+ modelValue: {}
26
+ },
27
+ emits: [
28
+ "update:modelValue",
29
+ "update:editing",
30
+ "update:invalid"
31
+ ],
32
+ setup(__props) {
33
+ const props = __props;
34
+ const model = useModel(props, "modelValue");
35
+ const editing = useModel(props, "editing");
36
+ const invalid = useModel(props, "invalid");
37
+ const locale = useLocale(() => props.locale);
38
+ const center = ref();
39
+ const id = useId();
40
+ const field = createScrollField({
41
+ props: () => ({
42
+ value: model.value,
43
+ min: props.min,
44
+ max: props.max,
45
+ step: props.step,
46
+ options: props.options,
47
+ format: props.format,
48
+ label: props.label,
49
+ loop: props.loop,
50
+ size: props.size,
51
+ editing: editing.value,
52
+ invalid: invalid.value,
53
+ locale: locale.value,
54
+ name: props.name,
55
+ disabled: props.disabled,
56
+ softDisabled: props.softDisabled
57
+ }),
58
+ ids: { options: `${id}-option` },
59
+ center: () => center.value,
60
+ onChange: (next) => model.value = next,
61
+ onEditingChange: (next) => editing.value = next
62
+ });
63
+ const centerItem = computed(() => field.centerIndex());
64
+ const valueItem = computed(() => field.targetIndex());
65
+ const itemCount = computed(() => field.items().length);
66
+ const root = useTemplateRef("root");
67
+ const viewport = useTemplateRef("viewport");
68
+ const input = useTemplateRef("input");
69
+ let handle;
70
+ onMounted(() => {
71
+ handle = attachScrollField(root.value, {
72
+ viewport: () => viewport.value,
73
+ input: () => input.value,
74
+ targetIndex: field.targetIndex,
75
+ readText: field.readText,
76
+ completeText: field.completeText,
77
+ onCenterChange(index, byPerson) {
78
+ center.value = index;
79
+ if (byPerson) field.selectItem(index);
80
+ },
81
+ onChange: (next) => model.value = next,
82
+ value: field.value,
83
+ valueText: field.valueText,
84
+ onEditingChange: (next) => editing.value = next,
85
+ onInvalidChange: (next) => invalid.value = next,
86
+ onStep: field.step
87
+ });
88
+ });
89
+ onUpdated(() => handle?.sync());
90
+ onBeforeUnmount(() => handle?.detach());
91
+ return (_ctx, _cache) => {
92
+ return openBlock(), createElementBlock("div", mergeProps({
93
+ ref_key: "root",
94
+ ref: root
95
+ }, unref(field).parts.root(), { onKeydown: _cache[2] || (_cache[2] = (...args) => unref(field).handleKeydown && unref(field).handleKeydown(...args)) }), [
96
+ createElementVNode("div", mergeProps({
97
+ ref_key: "viewport",
98
+ ref: viewport
99
+ }, unref(field).parts.viewport()), [createCommentVNode(" An item renders again only when its text changes, whether it is in the middle, whether it\n is the value's option, or the number of items. "), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(field).items(), (item, __, ___, _cached) => {
100
+ const _memo = [
101
+ unref(field).itemText(item),
102
+ item === centerItem.value,
103
+ item === valueItem.value,
104
+ itemCount.value
105
+ ];
106
+ if (_cached && _cached.el && _cached.key === item && isMemoSame(_cached, _memo)) return _cached;
107
+ const _item = (openBlock(), createElementBlock("div", mergeProps({ key: item }, { ref_for: true }, unref(field).parts.item(item), { onClick: ($event) => unref(field).selectItem(item) }), [createTextVNode(toDisplayString(unref(field).itemText(item)), 1)], 16, ["onClick"]));
108
+ _item.memo = _memo;
109
+ return _item;
110
+ }, _cache, 0), 128))], 16),
111
+ unref(field).showsInput() ? (openBlock(), createElementBlock("input", mergeProps({
112
+ key: 0,
113
+ ref_key: "input",
114
+ ref: input
115
+ }, unref(field).parts.input()), null, 16)) : createCommentVNode("v-if", true),
116
+ unref(field).showsHiddenInput() ? (openBlock(), createElementBlock("input", normalizeProps(mergeProps({ key: 1 }, unref(field).parts.hiddenInput())), null, 16)) : createCommentVNode("v-if", true)
117
+ ], 16);
118
+ };
119
+ }
120
+ });
121
+ export { _sfc_main as default };
@@ -30,11 +30,11 @@ type __VLS_ModelProps = {
30
30
  };
31
31
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
32
32
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
- "update:open": (value: boolean) => any;
34
33
  "update:modelValue": (value: SelectSelected) => any;
34
+ "update:open": (value: boolean) => any;
35
35
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
36
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
37
36
  "onUpdate:modelValue"?: ((value: SelectSelected) => any) | undefined;
37
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
38
38
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
39
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
40
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,6 @@
1
+ import { keepPresses } from "../overlay/presses.js";
1
2
  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 { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, renderList, renderSlot, shallowReactive, toDisplayString, toHandlers, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
3
4
  import { attachSelect, createSelect, mergePartAttrs } from "@rio-m3e/core";
4
5
  import "@rio-m3e/styles/base/reduced-motion.css";
5
6
  import "@rio-m3e/styles/base/anchored-position.css";
@@ -170,7 +171,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
170
171
  createElementVNode("div", mergeProps({
171
172
  ref_key: "listbox",
172
173
  ref: listbox
173
- }, unref(select).parts.listbox()), [renderSlot(_ctx.$slots, "default")], 16)
174
+ }, unref(select).parts.listbox(), toHandlers(unref(keepPresses), true)), [renderSlot(_ctx.$slots, "default")], 16)
174
175
  ], 16);
175
176
  };
176
177
  }
@@ -0,0 +1,17 @@
1
+ import { RangeSliderProps, SliderMessages } 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/slider.css";
5
+ type __VLS_Props = Omit<RangeSliderProps, 'value'> & {
6
+ /** The start and the end of the range, with `v-model`. */
7
+ modelValue?: [number, number];
8
+ /** Replaces the inputs' names for assistive technology. */
9
+ messages?: Partial<SliderMessages>;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: [number, number]) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ "onUpdate:modelValue"?: ((value: [number, number]) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export { _default as default };
@@ -0,0 +1,92 @@
1
+ import { useLocale, useMessages } from "../locale/locale.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, toDisplayString, unref, useModel, useTemplateRef } from "vue";
3
+ import { attachSlider, createRangeSlider } from "@rio-m3e/core";
4
+ import "@rio-m3e/styles/base/focus-ring.css";
5
+ import "@rio-m3e/styles/base/reduced-motion.css";
6
+ import "@rio-m3e/styles/slider.css";
7
+ // src/slider/RangeSlider.vue
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ __name: "RangeSlider",
10
+ props: {
11
+ name: {},
12
+ min: {},
13
+ max: {},
14
+ step: {},
15
+ stops: { type: Boolean },
16
+ size: {},
17
+ vertical: { type: Boolean },
18
+ valueIndicator: { type: Boolean },
19
+ format: { type: Function },
20
+ locale: {},
21
+ disabled: { type: Boolean },
22
+ softDisabled: { type: Boolean },
23
+ modelValue: {},
24
+ messages: {}
25
+ },
26
+ emits: ["update:modelValue"],
27
+ setup(__props) {
28
+ const props = __props;
29
+ const model = useModel(props, "modelValue");
30
+ const locale = useLocale(() => props.locale);
31
+ const messages = useMessages("slider", locale, () => props.messages);
32
+ const slider = createRangeSlider({
33
+ props: () => ({
34
+ value: model.value,
35
+ min: props.min,
36
+ max: props.max,
37
+ step: props.step,
38
+ stops: props.stops,
39
+ size: props.size,
40
+ vertical: props.vertical,
41
+ valueIndicator: props.valueIndicator,
42
+ format: props.format,
43
+ locale: locale.value,
44
+ disabled: props.disabled,
45
+ softDisabled: props.softDisabled,
46
+ name: props.name
47
+ }),
48
+ messages: () => messages.value,
49
+ onChange(next) {
50
+ model.value = next;
51
+ nextTick(() => handle?.sync());
52
+ }
53
+ });
54
+ const root = useTemplateRef("root");
55
+ const start = useTemplateRef("start");
56
+ const end = useTemplateRef("end");
57
+ let handle;
58
+ onMounted(() => {
59
+ handle = attachSlider(root.value, {
60
+ inputs: [start.value, end.value],
61
+ values: slider.value,
62
+ range: slider.range,
63
+ vertical: slider.vertical,
64
+ blocked: slider.blocked,
65
+ onMove: slider.moveHandle
66
+ });
67
+ });
68
+ onUpdated(() => handle?.sync());
69
+ onBeforeUnmount(() => handle?.detach());
70
+ return (_ctx, _cache) => {
71
+ return openBlock(), createElementBlock("span", mergeProps({
72
+ ref_key: "root",
73
+ ref: root
74
+ }, unref(slider).parts.root()), [
75
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.trackLower())), null, 16),
76
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.trackActive())), null, 16),
77
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.trackUpper())), null, 16),
78
+ createElementVNode("input", mergeProps({
79
+ ref_key: "start",
80
+ ref: start
81
+ }, unref(slider).parts.startInput()), null, 16),
82
+ createElementVNode("input", mergeProps({
83
+ ref_key: "end",
84
+ ref: end
85
+ }, unref(slider).parts.endInput()), null, 16),
86
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.startHandle())), [unref(slider).showsValueIndicator() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(slider).parts.startValueIndicator())), toDisplayString(unref(slider).valueText(0)), 17)) : createCommentVNode("v-if", true)], 16),
87
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.endHandle())), [unref(slider).showsValueIndicator() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(slider).parts.endValueIndicator())), toDisplayString(unref(slider).valueText(1)), 17)) : createCommentVNode("v-if", true)], 16)
88
+ ], 16);
89
+ };
90
+ }
91
+ });
92
+ export { _sfc_main as default };
@@ -0,0 +1,25 @@
1
+ import { SliderProps } 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/slider.css";
5
+ type __VLS_Props = Omit<SliderProps, 'value'> & {
6
+ /** The value, with `v-model`. */
7
+ modelValue?: number;
8
+ };
9
+ type __VLS_Slots = {
10
+ /** An icon inside the track, at its start. Hidden from assistive technology. */
11
+ icon?: () => unknown;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:modelValue": (value: number) => any;
15
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
16
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
25
+ export { _default as default };
@@ -0,0 +1,102 @@
1
+ import { useLocale } from "../locale/locale.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, nextTick, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, unref, useModel, useSlots, useTemplateRef } from "vue";
3
+ import { attachSlider, createSlider, mergePartAttrs } from "@rio-m3e/core";
4
+ import "@rio-m3e/styles/base/focus-ring.css";
5
+ import "@rio-m3e/styles/base/reduced-motion.css";
6
+ import "@rio-m3e/styles/slider.css";
7
+ // src/slider/Slider.vue
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ inheritAttrs: false,
10
+ __name: "Slider",
11
+ props: {
12
+ centered: { type: Boolean },
13
+ min: {},
14
+ max: {},
15
+ step: {},
16
+ stops: { type: Boolean },
17
+ size: {},
18
+ vertical: { type: Boolean },
19
+ valueIndicator: { type: Boolean },
20
+ format: { type: Function },
21
+ locale: {},
22
+ disabled: { type: Boolean },
23
+ softDisabled: { type: Boolean },
24
+ modelValue: {}
25
+ },
26
+ emits: ["update:modelValue"],
27
+ setup(__props) {
28
+ const props = __props;
29
+ const model = useModel(props, "modelValue");
30
+ const slots = useSlots();
31
+ const locale = useLocale(() => props.locale);
32
+ const iconInactive = ref(false);
33
+ const slider = createSlider({
34
+ props: () => ({
35
+ value: model.value,
36
+ min: props.min,
37
+ max: props.max,
38
+ step: props.step,
39
+ stops: props.stops,
40
+ size: props.size,
41
+ vertical: props.vertical,
42
+ valueIndicator: props.valueIndicator,
43
+ format: props.format,
44
+ locale: locale.value,
45
+ disabled: props.disabled,
46
+ softDisabled: props.softDisabled,
47
+ centered: props.centered
48
+ }),
49
+ content: () => ({ icon: !!slots.icon }),
50
+ iconInactive: () => iconInactive.value,
51
+ onChange(next) {
52
+ model.value = next;
53
+ nextTick(() => handle?.sync());
54
+ }
55
+ });
56
+ const root = useTemplateRef("root");
57
+ const input = useTemplateRef("input");
58
+ const active = useTemplateRef("active");
59
+ let handle;
60
+ onMounted(() => {
61
+ handle = attachSlider(root.value, {
62
+ inputs: [input.value],
63
+ values: () => [slider.value()],
64
+ range: slider.range,
65
+ vertical: slider.vertical,
66
+ blocked: slider.blocked,
67
+ onMove: slider.moveHandle,
68
+ activeTrack: () => slider.showsIcon() ? active.value : void 0,
69
+ onIconInactiveChange: (next) => iconInactive.value = next
70
+ });
71
+ });
72
+ onUpdated(() => handle?.sync());
73
+ onBeforeUnmount(() => handle?.detach());
74
+ return (_ctx, _cache) => {
75
+ return openBlock(), createElementBlock("span", mergeProps({
76
+ ref_key: "root",
77
+ ref: root
78
+ }, unref(slider).parts.root(), {
79
+ class: _ctx.$attrs.class,
80
+ style: _ctx.$attrs.style
81
+ }), [
82
+ unref(slider).showsLowerTrack() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(slider).parts.trackLower())), null, 16)) : createCommentVNode("v-if", true),
83
+ createElementVNode("span", mergeProps({
84
+ ref_key: "active",
85
+ ref: active
86
+ }, unref(slider).parts.trackActive()), null, 16),
87
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.trackUpper())), null, 16),
88
+ unref(slider).showsIcon() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 1 }, unref(slider).parts.icon())), [renderSlot(_ctx.$slots, "icon")], 16)) : createCommentVNode("v-if", true),
89
+ createElementVNode("input", mergeProps({
90
+ ref_key: "input",
91
+ ref: input
92
+ }, unref(mergePartAttrs)({
93
+ ..._ctx.$attrs,
94
+ class: void 0,
95
+ style: void 0
96
+ }, unref(slider).parts.input())), null, 16),
97
+ createElementVNode("span", normalizeProps(guardReactiveProps(unref(slider).parts.handle())), [unref(slider).showsValueIndicator() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 0 }, unref(slider).parts.valueIndicator())), toDisplayString(unref(slider).valueText()), 17)) : createCommentVNode("v-if", true)], 16)
98
+ ], 16);
99
+ };
100
+ }
101
+ });
102
+ export { _sfc_main as default };
@@ -2,6 +2,7 @@ import { SplitButtonProps } 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/split-button.css";
7
8
  type __VLS_Slots = {