@m3ui-vue/m3ui-vue 0.8.5 → 0.8.7

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 (80) hide show
  1. package/README.md +5 -1
  2. package/dist/{MMenuItem-BXIxwIdM.js → MMenuItem-DmrsQrK7.js} +2 -2
  3. package/dist/{MMenuItem-BXIxwIdM.js.map → MMenuItem-DmrsQrK7.js.map} +1 -1
  4. package/dist/chart.js +5 -1
  5. package/dist/chart.js.map +1 -1
  6. package/dist/code-editor.js +1 -1
  7. package/dist/components/MBottomSheet.vue.d.ts +3 -3
  8. package/dist/components/MChatBubble.vue.d.ts +4 -2
  9. package/dist/components/MCheckbox.vue.d.ts +2 -0
  10. package/dist/components/MDragDropList.vue.d.ts +19 -6
  11. package/dist/components/MFileUpload.vue.d.ts +16 -4
  12. package/dist/components/MKanban.vue.d.ts +15 -6
  13. package/dist/components/MListDetail.vue.d.ts +31 -0
  14. package/dist/components/MNavigationRail.vue.d.ts +6 -3
  15. package/dist/components/MNavigationSuite.vue.d.ts +46 -0
  16. package/dist/components/MShortNavigationBar.vue.d.ts +6 -1
  17. package/dist/components/MSideSheet.vue.d.ts +4 -4
  18. package/dist/components/MSupportingPane.vue.d.ts +34 -0
  19. package/dist/components/MTransferList.vue.d.ts +57 -30
  20. package/dist/components/MWindow.vue.d.ts +39 -1
  21. package/dist/components/_MTransferPane.vue.d.ts +46 -0
  22. package/dist/composables/_useItemLink.d.ts +30 -0
  23. package/dist/composables/_useSheetMotion.d.ts +7 -0
  24. package/dist/composables/useLocale.d.ts +27 -0
  25. package/dist/composables/useWindowSizeClass.d.ts +19 -0
  26. package/dist/index.d.ts +6 -0
  27. package/dist/locales/index.js +196 -7
  28. package/dist/locales/index.js.map +1 -1
  29. package/dist/m3ui-vue.css +1 -1
  30. package/dist/m3ui.js +4331 -2945
  31. package/dist/m3ui.js.map +1 -1
  32. package/dist/rich-text-editor.js +2 -2
  33. package/dist/styles.css +1 -1
  34. package/dist/{useLocale-DbREg9Zn.js → useLocale-Bircp823.js} +29 -2
  35. package/dist/useLocale-Bircp823.js.map +1 -0
  36. package/package.json +1 -1
  37. package/src/__tests__/MChart.test.ts +28 -0
  38. package/src/__tests__/MChatBubble.test.ts +33 -0
  39. package/src/__tests__/MDragDropList.test.ts +194 -0
  40. package/src/__tests__/MFileUpload.test.ts +78 -0
  41. package/src/__tests__/MKanban.test.ts +150 -0
  42. package/src/__tests__/MPullToRefresh.test.ts +67 -0
  43. package/src/__tests__/MRating.test.ts +72 -0
  44. package/src/__tests__/MShortNavigationBar.test.ts +25 -0
  45. package/src/__tests__/MTransferList.test.ts +149 -0
  46. package/src/__tests__/MWindow.test.ts +258 -0
  47. package/src/__tests__/adaptiveLayouts.test.ts +191 -0
  48. package/src/__tests__/sheets.test.ts +76 -0
  49. package/src/components/MBottomSheet.vue +11 -57
  50. package/src/components/MChart.vue +2 -1
  51. package/src/components/MChatBubble.vue +107 -20
  52. package/src/components/MCheckbox.vue +3 -0
  53. package/src/components/MDragDropList.vue +485 -56
  54. package/src/components/MFileUpload.vue +56 -20
  55. package/src/components/MKanban.vue +720 -78
  56. package/src/components/MListDetail.vue +103 -0
  57. package/src/components/MNavigationRail.vue +48 -31
  58. package/src/components/MNavigationSuite.vue +89 -0
  59. package/src/components/MPullToRefresh.vue +101 -35
  60. package/src/components/MRating.vue +163 -67
  61. package/src/components/MResult.vue +19 -9
  62. package/src/components/MShortNavigationBar.vue +37 -17
  63. package/src/components/MSideSheet.vue +11 -56
  64. package/src/components/MSupportingPane.vue +70 -0
  65. package/src/components/MTransferList.vue +174 -137
  66. package/src/components/MWindow.vue +507 -108
  67. package/src/components/_MTransferPane.vue +260 -0
  68. package/src/composables/_useItemLink.ts +19 -0
  69. package/src/composables/_useSheetMotion.ts +181 -0
  70. package/src/composables/useLocale.ts +75 -0
  71. package/src/composables/useWindowSizeClass.ts +93 -0
  72. package/src/index.ts +6 -0
  73. package/src/locales/de.ts +37 -0
  74. package/src/locales/es.ts +37 -0
  75. package/src/locales/fr.ts +37 -0
  76. package/src/locales/ja.ts +37 -0
  77. package/src/locales/ko.ts +37 -0
  78. package/src/locales/pt.ts +37 -0
  79. package/src/locales/zh.ts +37 -0
  80. package/dist/useLocale-DbREg9Zn.js.map +0 -1
@@ -2,6 +2,7 @@
2
2
  import { computed } from 'vue'
3
3
  import MAvatar from './MAvatar.vue'
4
4
  import MIcon from './MIcon.vue'
5
+ import { useLocale } from '../composables/useLocale'
5
6
 
6
7
  const props = withDefaults(
7
8
  defineProps<{
@@ -15,10 +16,14 @@ const props = withDefaults(
15
16
  tail?: boolean
16
17
  size?: 'small' | 'medium' | 'large'
17
18
  maxWidth?: string
19
+ /** Shows a live indicator instead of the content: bouncing dots while the other person types, or a mic with a moving waveform while they record audio. */
20
+ typing?: 'text' | 'audio'
18
21
  }>(),
19
22
  { side: 'left', color: 'primary', tail: true, size: 'medium', maxWidth: '320px' },
20
23
  )
21
24
 
25
+ const t = useLocale()
26
+
22
27
  const isRight = computed(() => props.side === 'right')
23
28
 
24
29
  const sizeClass = computed(() => {
@@ -27,10 +32,27 @@ const sizeClass = computed(() => {
27
32
  return 'text-body-medium'
28
33
  })
29
34
 
30
- const colorMap: Record<string, { bg: string; text: string; timeCls: string }> = {
31
- primary: { bg: 'bg-primary', text: 'text-on-primary', timeCls: 'text-on-primary/60' },
32
- secondary: { bg: 'bg-secondary', text: 'text-on-secondary', timeCls: 'text-on-secondary/60' },
33
- tertiary: { bg: 'bg-tertiary', text: 'text-on-tertiary', timeCls: 'text-on-tertiary/60' },
35
+ const colorMap: Record<string, { bg: string; text: string; timeCls: string; status: Record<'sent' | 'delivered' | 'read', string> }> = {
36
+ primary: {
37
+ bg: 'bg-primary', text: 'text-on-primary', timeCls: 'text-on-primary/60',
38
+ status: { sent: 'text-on-primary/40', delivered: 'text-on-primary/60', read: 'text-on-primary' },
39
+ },
40
+ secondary: {
41
+ bg: 'bg-secondary', text: 'text-on-secondary', timeCls: 'text-on-secondary/60',
42
+ status: { sent: 'text-on-secondary/40', delivered: 'text-on-secondary/60', read: 'text-on-secondary' },
43
+ },
44
+ tertiary: {
45
+ bg: 'bg-tertiary', text: 'text-on-tertiary', timeCls: 'text-on-tertiary/60',
46
+ status: { sent: 'text-on-tertiary/40', delivered: 'text-on-tertiary/60', read: 'text-on-tertiary' },
47
+ },
48
+ }
49
+
50
+ // Accent for the typing indicator's mic on the neutral (left) bubble; on the right
51
+ // bubble everything already uses the bubble's on-color.
52
+ const accentMap: Record<string, string> = {
53
+ primary: 'text-primary',
54
+ secondary: 'text-secondary',
55
+ tertiary: 'text-tertiary',
34
56
  }
35
57
 
36
58
  const bubbleClasses = computed(() => {
@@ -57,12 +79,12 @@ const statusIcon = computed(() => {
57
79
  return props.status === 'sent' ? 'check' : 'done_all'
58
80
  })
59
81
 
60
- const statusClasses = computed(() => {
61
- if (props.status === 'sent') return 'text-on-primary/40'
62
- if (props.status === 'delivered') return 'text-on-primary/60'
63
- if (props.status === 'read') return 'text-on-primary'
64
- return ''
65
- })
82
+ // Was hardcoded to on-primary, so the checks didn't match a secondary/tertiary bubble.
83
+ const statusClasses = computed(() => (props.status ? colorMap[props.color]!.status[props.status] : ''))
84
+
85
+ const micClass = computed(() => (isRight.value ? '' : accentMap[props.color]))
86
+
87
+ const typingLabel = computed(() => (props.typing === 'audio' ? t.chatRecordingAudio : t.chatTyping))
66
88
  </script>
67
89
 
68
90
  <template>
@@ -80,18 +102,83 @@ const statusClasses = computed(() => {
80
102
  </p>
81
103
 
82
104
  <div :class="bubbleClasses">
83
- <p :class="sizeClass"><slot>{{ text }}</slot></p>
84
-
85
- <div v-if="time || (status && isRight)" class="flex items-center justify-end gap-1 mt-0.5">
86
- <span v-if="time" class="text-label-small" :class="timeClasses">{{ time }}</span>
87
- <MIcon
88
- v-if="status && isRight"
89
- :name="statusIcon!"
90
- :size="14"
91
- :class="statusClasses"
92
- />
105
+ <!-- Typing / recording indicator -->
106
+ <div
107
+ v-if="typing"
108
+ role="status"
109
+ :aria-label="sender ? `${sender}: ${typingLabel}` : typingLabel"
110
+ class="flex h-5 items-center"
111
+ :class="typing === 'audio' ? 'gap-2' : 'gap-1 px-1'"
112
+ >
113
+ <template v-if="typing === 'text'">
114
+ <span v-for="i in 3" :key="i" class="m3-typing-dot h-2 w-2 rounded-full bg-current opacity-60" :style="{ animationDelay: `${(i - 1) * 160}ms` }" />
115
+ </template>
116
+ <template v-else>
117
+ <MIcon name="mic" :size="18" class="m3-typing-mic" :class="micClass" style="font-variation-settings: 'FILL' 1" />
118
+ <span class="flex h-4 items-center gap-[3px]" aria-hidden="true">
119
+ <span
120
+ v-for="i in 7"
121
+ :key="i"
122
+ class="m3-typing-bar h-full w-[3px] rounded-full bg-current opacity-70"
123
+ :style="{ animationDelay: `${[0, 320, 120, 480, 220, 400, 60][i - 1]}ms` }"
124
+ />
125
+ </span>
126
+ </template>
93
127
  </div>
128
+
129
+ <template v-else>
130
+ <!-- div, not p: the slot often holds block content (images, buttons, cards) -->
131
+ <div :class="sizeClass"><slot>{{ text }}</slot></div>
132
+
133
+ <div v-if="time || (status && isRight)" class="flex items-center justify-end gap-1 mt-0.5">
134
+ <span v-if="time" class="text-label-small" :class="timeClasses">{{ time }}</span>
135
+ <MIcon
136
+ v-if="status && isRight"
137
+ :name="statusIcon!"
138
+ :size="14"
139
+ :class="statusClasses"
140
+ />
141
+ </div>
142
+ </template>
94
143
  </div>
95
144
  </div>
96
145
  </div>
97
146
  </template>
147
+
148
+ <style scoped>
149
+ .m3-typing-dot {
150
+ animation: m3-typing-dot 1.2s ease-in-out infinite;
151
+ }
152
+ @keyframes m3-typing-dot {
153
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
154
+ 30% { transform: translateY(-4px); opacity: 1; }
155
+ }
156
+
157
+ .m3-typing-mic {
158
+ animation: m3-typing-mic 1.4s ease-in-out infinite;
159
+ }
160
+ @keyframes m3-typing-mic {
161
+ 0%, 100% { opacity: 1; transform: scale(1); }
162
+ 50% { opacity: 0.55; transform: scale(0.9); }
163
+ }
164
+
165
+ .m3-typing-bar {
166
+ transform-origin: center;
167
+ animation: m3-typing-bar 0.9s ease-in-out infinite;
168
+ }
169
+ @keyframes m3-typing-bar {
170
+ 0%, 100% { transform: scaleY(0.25); }
171
+ 50% { transform: scaleY(1); }
172
+ }
173
+
174
+ @media (prefers-reduced-motion: reduce) {
175
+ .m3-typing-dot,
176
+ .m3-typing-mic,
177
+ .m3-typing-bar {
178
+ animation: none;
179
+ }
180
+ .m3-typing-bar {
181
+ transform: scaleY(0.6);
182
+ }
183
+ }
184
+ </style>
@@ -8,6 +8,8 @@ withDefaults(
8
8
  disabled?: boolean;
9
9
  label?: string;
10
10
  color?: "primary" | "secondary" | "tertiary" | "error";
11
+ /** Accessible name for the input when there's no visible label (e.g. a list row's checkbox). */
12
+ ariaLabel?: string;
11
13
  }>(),
12
14
  { indeterminate: false, disabled: false, color: "primary" },
13
15
  );
@@ -60,6 +62,7 @@ const checkedBgClasses: Record<string, string> = {
60
62
  class="peer sr-only"
61
63
  :checked="modelValue"
62
64
  :disabled="disabled"
65
+ :aria-label="ariaLabel"
63
66
  @change="emit('update:modelValue', !modelValue)"
64
67
  />
65
68
  <!--