@rio-m3e/vue 0.7.0 → 0.8.1

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 (62) hide show
  1. package/dist/app-bar/AppBar.vue.js +3 -1
  2. package/dist/app-bar/context.js +3 -0
  3. package/dist/browser/rio-vue.css +366 -78
  4. package/dist/browser/rio-vue.global.js +21 -21
  5. package/dist/browser/rio-vue.js +21 -21
  6. package/dist/button-group/ButtonGroup.vue.d.ts +30 -20
  7. package/dist/button-group/ButtonGroup.vue.js +2 -1
  8. package/dist/checkbox/Checkbox.vue.d.ts +1 -0
  9. package/dist/checkbox/Checkbox.vue.js +3 -0
  10. package/dist/chip/AssistChip.vue.d.ts +1 -0
  11. package/dist/chip/AssistChip.vue.js +3 -0
  12. package/dist/chip/ChipSet.vue.d.ts +27 -16
  13. package/dist/chip/ChipSet.vue.js +6 -2
  14. package/dist/chip/FilterChip.vue.d.ts +19 -3
  15. package/dist/chip/FilterChip.vue.js +54 -8
  16. package/dist/chip/InputChip.vue.d.ts +1 -0
  17. package/dist/chip/InputChip.vue.js +3 -0
  18. package/dist/chip/SuggestionChip.vue.d.ts +1 -0
  19. package/dist/chip/SuggestionChip.vue.js +3 -0
  20. package/dist/date-picker/DatePicker.vue.js +14 -11
  21. package/dist/date-picker/DatePickerDialog.vue.js +13 -9
  22. package/dist/date-picker/DateRangePickerDialog.vue.js +19 -17
  23. package/dist/icon-button/IconButton.vue.d.ts +1 -0
  24. package/dist/icon-button/IconButton.vue.js +3 -0
  25. package/dist/index.d.ts +8 -6
  26. package/dist/index.js +8 -6
  27. package/dist/list/List.vue.d.ts +26 -16
  28. package/dist/list/List.vue.js +2 -1
  29. package/dist/list/ListItem.vue.d.ts +7 -1
  30. package/dist/list/ListItem.vue.js +12 -3
  31. package/dist/model/model.d.ts +8 -0
  32. package/dist/model/model.js +15 -0
  33. package/dist/navigation-bar/NavigationBar.vue.d.ts +21 -16
  34. package/dist/navigation-bar/NavigationBar.vue.js +1 -0
  35. package/dist/navigation-rail/NavigationRail.vue.d.ts +33 -32
  36. package/dist/navigation-rail/NavigationRail.vue.js +1 -0
  37. package/dist/overflow/OverflowMenu.vue.js +10 -12
  38. package/dist/radio/Radio.vue.d.ts +1 -0
  39. package/dist/radio/Radio.vue.js +3 -0
  40. package/dist/radio/RadioGroup.vue.d.ts +23 -21
  41. package/dist/radio/RadioGroup.vue.js +10 -8
  42. package/dist/rio/rio.js +2 -0
  43. package/dist/scroll-field/ScrollField.vue.d.ts +28 -12
  44. package/dist/scroll-field/ScrollField.vue.js +6 -4
  45. package/dist/select/Select.vue.d.ts +42 -39
  46. package/dist/select/Select.vue.js +8 -5
  47. package/dist/switch/Switch.vue.d.ts +1 -0
  48. package/dist/switch/Switch.vue.js +3 -0
  49. package/dist/tabs/Tab.vue.d.ts +8 -1
  50. package/dist/tabs/Tab.vue.js +51 -26
  51. package/dist/tabs/TabGroup.vue.d.ts +22 -18
  52. package/dist/tabs/TabGroup.vue.js +5 -5
  53. package/dist/tabs/Tabs.vue.d.ts +24 -21
  54. package/dist/tabs/Tabs.vue.js +28 -15
  55. package/dist/text-field/TextField.vue.d.ts +28 -26
  56. package/dist/text-field/TextField.vue.js +15 -16
  57. package/dist/theme/ThemeProvider.vue.d.ts +22 -0
  58. package/dist/theme/ThemeProvider.vue.js +26 -0
  59. package/dist/theme/context.d.ts +7 -0
  60. package/dist/theme/context.js +7 -0
  61. package/dist/tooltip/Tooltip.vue.js +10 -3
  62. package/package.json +6 -5
@@ -1,38 +1,40 @@
1
+ import { ModelModifiers } from "../model/model.js";
1
2
  import { TextFieldMessages, TextFieldProps } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/accent.css";
4
+ import "@rio-m3e/styles/base/density.css";
3
5
  import "@rio-m3e/styles/base/reduced-motion.css";
4
6
  import "@rio-m3e/styles/text-field.css";
5
- interface Props extends Omit<TextFieldProps, 'value'> {
7
+ export interface Props<T extends string | number> extends Omit<TextFieldProps, 'value'> {
8
+ /**
9
+ * The text in the field, with `v-model`. With `type="number"` it is a number, as Vue's `v-model`
10
+ * on an input makes it, or `''` once the field is emptied. Without one, the field starts empty.
11
+ */
12
+ modelValue?: T;
6
13
  /** A language tag for what the field says to assistive technology, as the counter's label */
7
14
  locale?: string;
8
15
  /** Replaces any of what the field says to assistive technology. */
9
16
  messages?: Partial<TextFieldMessages>;
17
+ /** The modifiers given to `v-model`, as `.trim` */
18
+ modelModifiers?: ModelModifiers;
10
19
  }
11
- type __VLS_Props = Props;
12
- type __VLS_Slots = {
13
- /** An icon before the text, such as a search icon */
14
- 'leading-icon'?: () => unknown;
15
- /** An icon or an icon button after the text, such as a clear button or an error icon */
16
- 'trailing-icon'?: () => unknown;
17
- };
18
- type __VLS_ModelProps = {
19
- /**
20
- * The text in the field, with `v-model`. With `type="number"` it is a number, as Vue's `v-model`
21
- * on an input makes it.
22
- */
23
- modelValue?: string | number;
24
- };
25
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
26
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
27
- "update:modelValue": (value: string | number) => any;
28
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
29
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
30
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
- declare const _default: typeof __VLS_export;
33
- type __VLS_WithSlots<T, S> = T & {
34
- new (): {
35
- $slots: S;
20
+ declare const __VLS_export: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
21
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T> & {
22
+ "onUpdate:modelValue"?: ((value: T) => any) | undefined;
23
+ }> & (typeof globalThis extends {
24
+ __VLS_PROPS_FALLBACK: infer P;
25
+ } ? P : {});
26
+ expose: (exposed: {}) => void;
27
+ attrs: any;
28
+ slots: {
29
+ /** An icon before the text, such as a search icon */
30
+ 'leading-icon'?: () => unknown;
31
+ /** An icon or an icon button after the text, such as a clear button or an error icon */
32
+ 'trailing-icon'?: () => unknown;
36
33
  };
34
+ emit: (evt: "update:modelValue", value: T) => void;
35
+ }>) => import("vue").VNode & {
36
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
37
37
  };
38
+ declare const _default: typeof __VLS_export;
39
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
38
40
  export { _default as default };
@@ -1,17 +1,21 @@
1
1
  import { useComposingInput } from "../ime/composing.js";
2
2
  import { useLocale, useMessages } from "../locale/locale.js";
3
- import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelText, withDirectives } from "vue";
3
+ import { useValueModel } from "../model/model.js";
4
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, isRef, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, shallowRef, toDisplayString, unref, useAttrs, useId, useSlots, useTemplateRef, vModelDynamic, vModelText, withDirectives } from "vue";
4
5
  import { attachTextField, createTextField, mergePartAttrs } from "@rio-m3e/core";
5
6
  import "@rio-m3e/styles/base/accent.css";
7
+ import "@rio-m3e/styles/base/density.css";
6
8
  import "@rio-m3e/styles/base/reduced-motion.css";
7
9
  import "@rio-m3e/styles/text-field.css";
8
10
  // src/text-field/TextField.vue
9
11
  const _sfc_main = /*@__PURE__*/ defineComponent({
10
12
  inheritAttrs: false,
11
13
  __name: "TextField",
12
- props: /*@__PURE__*/ mergeModels({
14
+ props: {
15
+ modelValue: {},
13
16
  locale: {},
14
17
  messages: {},
18
+ modelModifiers: {},
15
19
  variant: {},
16
20
  label: {},
17
21
  multiline: { type: Boolean },
@@ -24,6 +28,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
24
28
  error: { type: Boolean },
25
29
  errorText: {},
26
30
  color: {},
31
+ density: {},
27
32
  maxlength: {},
28
33
  required: { type: Boolean },
29
34
  disabled: { type: Boolean },
@@ -32,17 +37,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
32
37
  type: Boolean,
33
38
  default: () => void 0
34
39
  }
35
- }, {
36
- "modelValue": { default: "" },
37
- "modelModifiers": {}
38
- }),
40
+ },
39
41
  emits: ["update:modelValue"],
40
42
  setup(__props) {
41
- /**
42
- * The text in the field, with `v-model`. With `type="number"` it is a number, as Vue's `v-model`
43
- * on an input makes it.
44
- */
45
- const model = useModel(__props, "modelValue");
43
+ const model = useValueModel(() => __props.modelValue);
46
44
  const slots = useSlots();
47
45
  const id = useId();
48
46
  const attrs = useAttrs();
@@ -55,7 +53,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
55
53
  props: () => ({
56
54
  variant: __props.variant,
57
55
  label: __props.label,
58
- value: String(model.value),
56
+ value: String(model.value ?? ""),
59
57
  multiline: __props.multiline,
60
58
  rows: __props.rows,
61
59
  grow: __props.grow,
@@ -66,6 +64,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
66
64
  error: __props.error,
67
65
  errorText: __props.errorText,
68
66
  color: __props.color,
67
+ density: __props.density,
69
68
  maxlength: __props.maxlength,
70
69
  required: __props.required,
71
70
  disabled: __props.disabled,
@@ -127,7 +126,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
127
126
  key: 1,
128
127
  ref_key: "input",
129
128
  ref: input,
130
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
129
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
131
130
  onCompositionstart: _cache[1] || (_cache[1] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
132
131
  onCompositionend: _cache[2] || (_cache[2] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
133
132
  onInput: _cache[3] || (_cache[3] = (...args) => unref(onInput) && unref(onInput)(...args))
@@ -135,11 +134,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
135
134
  ..._ctx.$attrs,
136
135
  class: void 0,
137
136
  style: void 0
138
- }, unref(field).parts.input())), null, 16)), [[vModelDynamic, model.value]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
137
+ }, unref(field).parts.input())), null, 16)), [[vModelDynamic, unref(model)]]) : withDirectives((openBlock(), createElementBlock("textarea", mergeProps({
139
138
  key: 2,
140
139
  ref_key: "input",
141
140
  ref: input,
142
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => model.value = $event),
141
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(model) ? model.value = $event : null),
143
142
  onCompositionstart: _cache[5] || (_cache[5] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
144
143
  onCompositionend: _cache[6] || (_cache[6] = (...args) => unref(onComposition) && unref(onComposition)(...args)),
145
144
  onInput: _cache[7] || (_cache[7] = (...args) => unref(onInput) && unref(onInput)(...args))
@@ -147,7 +146,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
147
146
  ..._ctx.$attrs,
148
147
  class: void 0,
149
148
  style: void 0
150
- }, unref(field).parts.textarea())), null, 16)), [[vModelText, model.value]]),
149
+ }, unref(field).parts.textarea())), null, 16)), [[vModelText, unref(model)]]),
151
150
  unref(field).showsSuffix() ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 3 }, unref(field).parts.suffix())), toDisplayString(__props.suffix), 17)) : createCommentVNode("v-if", true)
152
151
  ], 16),
153
152
  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,22 @@
1
+ import { RioThemeOptions } from "../rio/rio.js";
2
+ import "@rio-m3e/styles/theme-provider.css";
3
+ type __VLS_Props = {
4
+ /**
5
+ * The theme for what is inside, over the one around it: what it leaves out, or gives as
6
+ * `undefined`, as the shapes or the typefaces, stays the outer theme's. Its `colorScheme` makes
7
+ * the part light or dark; without one, the part follows the page's.
8
+ */
9
+ theme?: Partial<RioThemeOptions>;
10
+ };
11
+ type __VLS_Slots = {
12
+ default?: () => unknown;
13
+ };
14
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+ declare const _default: typeof __VLS_export;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
22
+ export { _default as default };
@@ -0,0 +1,26 @@
1
+ import { localeKey } from "../locale/locale.js";
2
+ import { themeKey } from "./context.js";
3
+ import { computed, createElementBlock, defineComponent, guardReactiveProps, inject, normalizeProps, openBlock, provide, renderSlot, unref } from "vue";
4
+ import { createThemeProvider, resolveLocale } from "@rio-m3e/core";
5
+ import { createThemeStyle, languageHeightOf, nestThemeOptions } from "@rio-m3e/tokens";
6
+ import "@rio-m3e/styles/theme-provider.css";
7
+ // src/theme/ThemeProvider.vue
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ __name: "ThemeProvider",
10
+ props: { theme: {} },
11
+ setup(__props) {
12
+ const outer = inject(themeKey, void 0);
13
+ const locale = inject(localeKey, void 0);
14
+ /** The options, nested over the outer theme's, which a provider inside nests its own over */
15
+ const nested = computed(() => nestThemeOptions(outer?.value, __props.theme));
16
+ provide(themeKey, nested);
17
+ const provider = createThemeProvider({ style: () => createThemeStyle({
18
+ ...nested.value,
19
+ languageHeight: nested.value.languageHeight ?? languageHeightOf(resolveLocale(locale?.value))
20
+ }) });
21
+ return (_ctx, _cache) => {
22
+ return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(provider).parts.root())), [renderSlot(_ctx.$slots, "default")], 16);
23
+ };
24
+ }
25
+ });
26
+ export { _sfc_main as default };
@@ -0,0 +1,7 @@
1
+ import { RioThemeOptions } from "../rio/rio.js";
2
+ import { ComputedRef, InjectionKey } from "vue";
3
+ /**
4
+ * What `createRio` and each `RioThemeProvider` give what is inside them: the theme's options,
5
+ * which a provider inside nests its own over
6
+ */
7
+ export declare const themeKey: InjectionKey<ComputedRef<Partial<RioThemeOptions> | undefined>>;
@@ -0,0 +1,7 @@
1
+ // src/theme/context.ts
2
+ /**
3
+ * What `createRio` and each `RioThemeProvider` give what is inside them: the theme's options,
4
+ * which a provider inside nests its own over
5
+ */
6
+ const themeKey = Symbol("RioTheme");
7
+ export { themeKey };
@@ -1,5 +1,6 @@
1
+ import { appBarKey } from "../app-bar/context.js";
1
2
  import { keepPresses } from "../overlay/presses.js";
2
- import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, renderSlot, toDisplayString, toHandlers, unref, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
3
+ import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, inject, mergeModels, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, toDisplayString, toHandlers, unref, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
3
4
  import { attachTooltip, createTooltip } from "@rio-m3e/core";
4
5
  import "@rio-m3e/styles/base/reduced-motion.css";
5
6
  import "@rio-m3e/styles/base/anchored-position.css";
@@ -31,6 +32,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
31
32
  const open = useModel(__props, "open");
32
33
  const slots = useSlots();
33
34
  const id = useId();
35
+ const appBar = inject(appBarKey, null);
36
+ /** Whether the element's name already holds the text, as `attachTooltip` finds */
37
+ const repeatsName = ref(false);
34
38
  const tooltip = createTooltip({
35
39
  props: () => ({
36
40
  variant: __props.variant,
@@ -48,7 +52,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
48
52
  root: `${id}-tooltip`,
49
53
  subhead: `${id}-subhead`,
50
54
  supportingText: `${id}-text`
51
- }
55
+ },
56
+ inAppBar: () => !!appBar,
57
+ repeatsName: () => repeatsName.value
52
58
  });
53
59
  const trigger = useTemplateRef("trigger");
54
60
  const root = useTemplateRef("root");
@@ -58,7 +64,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
58
64
  placement: tooltip.placement,
59
65
  persistent: tooltip.persistent,
60
66
  interactive: tooltip.interactive,
61
- onOpenChange: (next) => open.value = next
67
+ onOpenChange: (next) => open.value = next,
68
+ onRepeatsNameChange: (next) => repeatsName.value = next
62
69
  });
63
70
  handle.sync(open.value);
64
71
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio-m3e/vue",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Vue components for Rio, a Material 3 Expressive implementation",
5
5
  "license": "Apache-2.0",
6
6
  "author": "LegenLee",
@@ -29,9 +29,9 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@rio-m3e/core": "^0.7.0",
33
- "@rio-m3e/styles": "^0.7.0",
34
- "@rio-m3e/tokens": "^0.7.0"
32
+ "@rio-m3e/core": "^0.8.1",
33
+ "@rio-m3e/styles": "^0.8.1",
34
+ "@rio-m3e/tokens": "^0.8.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@fontsource/roboto": "^5.3.0",
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsdown",
51
- "typecheck": "vue-tsc -p ."
51
+ "typecheck": "vue-tsc -p . && vue-tsc -p type-tests",
52
+ "typecheck:dist": "vue-tsc -p type-tests/tsconfig.dist.json"
52
53
  }
53
54
  }