@m3ui-vue/m3ui-vue 1.2.0 → 1.2.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.
- package/dist/API.md +1 -1
- package/dist/api.json +1 -1
- package/dist/m3ui.js +1 -1
- package/dist/m3ui.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/MSegmentedButton.test.ts +10 -0
- package/src/components/MSegmentedButton.vue +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import MSegmentedButton from '../components/MSegmentedButton.vue'
|
|
4
|
+
|
|
5
|
+
describe('MSegmentedButton', () => {
|
|
6
|
+
it('lets the segments share the width when the group is stretched (a flex column, w-full)', () => {
|
|
7
|
+
const w = mount(MSegmentedButton, { props: { modelValue: 'a', options: [{ value: 'a', label: 'A' }, { value: 'b', label: 'B' }] } })
|
|
8
|
+
for (const b of w.findAll('button')) expect(b.classes()).toContain('grow')
|
|
9
|
+
})
|
|
10
|
+
})
|
|
@@ -57,7 +57,7 @@ function toggle(opt: SegmentedOption<V>, modelValue: M, multi: boolean) {
|
|
|
57
57
|
v-for="(opt, i) in options"
|
|
58
58
|
:key="opt.value"
|
|
59
59
|
type="button"
|
|
60
|
-
class="relative inline-flex items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]"
|
|
60
|
+
class="relative inline-flex grow items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]"
|
|
61
61
|
:class="[
|
|
62
62
|
density === 'compact' ? 'h-8 px-3' : density === 'comfortable' ? 'h-10 px-4' : 'h-10 px-6',
|
|
63
63
|
i > 0 ? (opt.disabled ? 'border-l border-outline/12' : 'border-l border-outline') : '',
|