wave-ui 4.2.5 → 4.3.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/types/types/components/WButton.d.ts +7 -0
- package/dist/types/types/components/WButtons.d.ts +223 -0
- package/dist/types/types/components/WButtons.js +2 -0
- package/dist/types/types/components/WList.d.ts +7 -1
- package/dist/types/types/components/WSelect.d.ts +7 -1
- package/dist/types/types/components/index.d.ts +1 -0
- package/dist/wave-ui.cjs.js +3 -3
- package/dist/wave-ui.css +1 -1
- package/dist/{wave-ui.esm.js → wave-ui.es.js} +685 -568
- package/dist/wave-ui.umd.js +3 -3
- package/package.json +33 -31
- package/src/wave-ui/components/index.js +1 -0
- package/src/wave-ui/components/w-button/button.vue +9 -1
- package/src/wave-ui/components/w-button/index.vue +33 -3
- package/src/wave-ui/components/w-buttons.vue +265 -0
- package/src/wave-ui/components/w-list.vue +4 -4
- package/src/wave-ui/components/w-select.vue +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "A UI framework for Vue.js 3 (and 2) with only the bright side. :sunny:",
|
|
5
5
|
"author": "Antoni Andre <antoniandre.web@gmail.com>",
|
|
6
6
|
"homepage": "https://antoniandre.github.io/wave-ui",
|
|
@@ -48,31 +48,42 @@
|
|
|
48
48
|
"vue framework",
|
|
49
49
|
"ui"
|
|
50
50
|
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"dev": "vite",
|
|
53
|
+
"build": "vite build --base /wave-ui/",
|
|
54
|
+
"build-types": "tsc -p ./tsconfig.json",
|
|
55
|
+
"build-bundle": "BUNDLE=true vite build && npm run build-types",
|
|
56
|
+
"preview": "vite preview --base /wave-ui/",
|
|
57
|
+
"lint": "biome check .",
|
|
58
|
+
"lint:fix": "biome check --apply .",
|
|
59
|
+
"format": "biome format .",
|
|
60
|
+
"format:fix": "biome format --write .",
|
|
61
|
+
"publish-doc": "npm run build && npm run build-bundle && git add . && git commit -m 'Publish documentation on Github.' && git push && git push --tag"
|
|
62
|
+
},
|
|
51
63
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@faker-js/faker": "^10.4.0",
|
|
64
|
+
"@biomejs/biome": "^2.6.7",
|
|
65
|
+
"@faker-js/faker": "^10.6.0",
|
|
55
66
|
"@mdi/font": "^7.4.47",
|
|
56
|
-
"@tsconfig/recommended": "^1.0.
|
|
57
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
58
|
-
"autoprefixer": "^10.
|
|
59
|
-
"axios": "^1.
|
|
67
|
+
"@tsconfig/recommended": "^1.0.14",
|
|
68
|
+
"@vitejs/plugin-vue": "^6.0.11",
|
|
69
|
+
"autoprefixer": "^10.6.2",
|
|
70
|
+
"axios": "^1.21.1",
|
|
60
71
|
"font-awesome": "^4.7.0",
|
|
61
|
-
"globals": "^17.
|
|
62
|
-
"gsap": "^3.15.
|
|
72
|
+
"globals": "^17.14.0",
|
|
73
|
+
"gsap": "^3.15.1",
|
|
63
74
|
"ionicons": "^4.6.3",
|
|
64
75
|
"material-design-icons": "^3.0.1",
|
|
65
|
-
"postcss": "^8.5.
|
|
76
|
+
"postcss": "^8.5.32",
|
|
66
77
|
"pug": "^3.0.4",
|
|
67
78
|
"rollup-plugin-delete": "^3.0.2",
|
|
68
|
-
"sass": "^1.
|
|
69
|
-
"simple-syntax-highlighter": "^3.
|
|
70
|
-
"splitpanes": "^4.
|
|
71
|
-
"typescript": "^
|
|
72
|
-
"vite": "^8.
|
|
73
|
-
"vite-svg-loader": "^5.1.
|
|
74
|
-
"vue": "^3.5.
|
|
75
|
-
"vue-router": "^5.0
|
|
79
|
+
"sass": "^1.108.2",
|
|
80
|
+
"simple-syntax-highlighter": "^3.2.0",
|
|
81
|
+
"splitpanes": "^4.1.2",
|
|
82
|
+
"typescript": "^7.0.2",
|
|
83
|
+
"vite": "^8.3.8",
|
|
84
|
+
"vite-svg-loader": "^5.1.3",
|
|
85
|
+
"vue": "^3.5.45",
|
|
86
|
+
"vue-router": "^5.5.0",
|
|
76
87
|
"vueperslides": "^3.6.0",
|
|
77
88
|
"vuex": "^4.1.0"
|
|
78
89
|
},
|
|
@@ -83,16 +94,7 @@
|
|
|
83
94
|
"node": ">=16.0.0",
|
|
84
95
|
"pnpm": ">=8.0.0"
|
|
85
96
|
},
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"build": "vite build --base /wave-ui/",
|
|
89
|
-
"build-types": "tsc -p ./tsconfig.json",
|
|
90
|
-
"build-bundle": "BUNDLE=true vite build && npm run build-types",
|
|
91
|
-
"preview": "vite preview --base /wave-ui/",
|
|
92
|
-
"lint": "biome check .",
|
|
93
|
-
"lint:fix": "biome check --apply .",
|
|
94
|
-
"format": "biome format .",
|
|
95
|
-
"format:fix": "biome format --write .",
|
|
96
|
-
"publish-doc": "npm run build && npm run build-bundle && git add . && git commit -m 'Publish documentation on Github.' && git push && git push --tag"
|
|
97
|
+
"pnpm": {
|
|
98
|
+
"strictPeerDependencies": false
|
|
97
99
|
}
|
|
98
|
-
}
|
|
100
|
+
}
|
|
@@ -5,6 +5,7 @@ export { default as WAutocomplete } from './w-autocomplete.vue'
|
|
|
5
5
|
export { default as WBadge } from './w-badge.vue'
|
|
6
6
|
export { default as WBreadcrumbs } from './w-breadcrumbs.vue'
|
|
7
7
|
export { default as WButton } from './w-button/index.vue'
|
|
8
|
+
export { default as WButtons } from './w-buttons.vue'
|
|
8
9
|
export { default as WCard } from './w-card.vue'
|
|
9
10
|
export { default as WCheckbox } from './w-checkbox.vue'
|
|
10
11
|
export { default as WCheckboxes } from './w-checkboxes.vue'
|
|
@@ -67,7 +67,8 @@ export default {
|
|
|
67
67
|
sm: { type: Boolean },
|
|
68
68
|
md: { type: Boolean },
|
|
69
69
|
lg: { type: Boolean },
|
|
70
|
-
xl: { type: Boolean }
|
|
70
|
+
xl: { type: Boolean },
|
|
71
|
+
active: { type: Boolean } // Marks the button as selected (e.g. inside w-buttons).
|
|
71
72
|
},
|
|
72
73
|
|
|
73
74
|
emits: [],
|
|
@@ -141,6 +142,7 @@ export default {
|
|
|
141
142
|
'w-button--loading': this.loading,
|
|
142
143
|
'w-button--icon': this.icon,
|
|
143
144
|
[`size--${this.size}`]: true,
|
|
145
|
+
'w-button--active': this.active,
|
|
144
146
|
'w-button--absolute': this.absolute,
|
|
145
147
|
'w-button--fixed': this.fixed,
|
|
146
148
|
[`w-button--${this.position.join(' w-button--')}`]: this.absolute || this.fixed
|
|
@@ -306,6 +308,12 @@ $spinner-size: 40;
|
|
|
306
308
|
}
|
|
307
309
|
&--dark:active:before, &.primary--bg:active:before {opacity: 0.35;}
|
|
308
310
|
|
|
311
|
+
// Selected/active state (e.g. inside w-buttons group).
|
|
312
|
+
&--active:before {opacity: 0.25;}
|
|
313
|
+
&--dark.w-button--active:before, &.primary--bg.w-button--active:before,
|
|
314
|
+
&.success--bg.w-button--active:before, &.error--bg.w-button--active:before,
|
|
315
|
+
&.warning--bg.w-button--active:before, &.info--bg.w-button--active:before {opacity: 0.35;}
|
|
316
|
+
|
|
309
317
|
// Disable visual feedback on loading and disabled buttons.
|
|
310
318
|
&--loading:hover:before,
|
|
311
319
|
&--loading:focus-visible:before,
|
|
@@ -58,17 +58,39 @@ export default {
|
|
|
58
58
|
md: { type: Boolean },
|
|
59
59
|
lg: { type: Boolean },
|
|
60
60
|
xl: { type: Boolean },
|
|
61
|
-
noRipple: { type: Boolean, default: undefined }
|
|
61
|
+
noRipple: { type: Boolean, default: undefined },
|
|
62
|
+
active: { type: Boolean } // Marks the button as selected (e.g. inside w-buttons).
|
|
62
63
|
},
|
|
63
64
|
|
|
64
65
|
components: { ButtonPartial },
|
|
65
66
|
|
|
67
|
+
inject: {
|
|
68
|
+
buttonsGroup: { from: 'wButtons', default: null }
|
|
69
|
+
},
|
|
70
|
+
|
|
66
71
|
emits: [],
|
|
67
72
|
|
|
68
73
|
computed: {
|
|
74
|
+
// Slot mode inside w-buttons: the group owns the active state.
|
|
75
|
+
inSlotGroup () {
|
|
76
|
+
return !!(this.buttonsGroup && !this.buttonsGroup.items)
|
|
77
|
+
},
|
|
78
|
+
resolvedActive () {
|
|
79
|
+
return this.inSlotGroup ? this.buttonsGroup.isSlotActive(this) : this.active
|
|
80
|
+
},
|
|
69
81
|
buttonProps () {
|
|
70
|
-
const { tooltip, tooltipProps = {}, ...props } = this.$props
|
|
71
|
-
return {
|
|
82
|
+
const { tooltip, tooltipProps = {}, active, disabled, ...props } = this.$props
|
|
83
|
+
return {
|
|
84
|
+
...props,
|
|
85
|
+
...this.$attrs,
|
|
86
|
+
disabled: this.inSlotGroup ? (disabled || this.buttonsGroup.disabled) : disabled,
|
|
87
|
+
active: this.resolvedActive,
|
|
88
|
+
'aria-pressed': this.inSlotGroup ? (this.resolvedActive ? 'true' : 'false') : this.$attrs['aria-pressed'],
|
|
89
|
+
class: [
|
|
90
|
+
this.$attrs.class,
|
|
91
|
+
this.inSlotGroup && { 'w-buttons__btn--active': this.resolvedActive }
|
|
92
|
+
]
|
|
93
|
+
}
|
|
72
94
|
}
|
|
73
95
|
},
|
|
74
96
|
|
|
@@ -77,6 +99,14 @@ export default {
|
|
|
77
99
|
if (this.disabled) return
|
|
78
100
|
focusElement(this.$refs.button?.$el)
|
|
79
101
|
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
mounted () {
|
|
105
|
+
if (this.inSlotGroup) this.buttonsGroup.register(this)
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
beforeUnmount () {
|
|
109
|
+
if (this.inSlotGroup) this.buttonsGroup.unregister(this)
|
|
80
110
|
}
|
|
81
111
|
}
|
|
82
112
|
</script>
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.w-buttons(
|
|
3
|
+
:class="wrapperClasses"
|
|
4
|
+
:style="wrapperStyle"
|
|
5
|
+
role="group"
|
|
6
|
+
@click="onGroupClick")
|
|
7
|
+
template(v-if="items")
|
|
8
|
+
w-button(
|
|
9
|
+
v-for="(item, i) in buttonItems"
|
|
10
|
+
:key="i"
|
|
11
|
+
v-bind="btnProps(item)"
|
|
12
|
+
@click="onItemClick(item, $event)")
|
|
13
|
+
slot(:item="item" :index="i" :active="item._active") {{ item.label }}
|
|
14
|
+
slot(v-else)
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: 'w-buttons',
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
// Items-driven mode.
|
|
24
|
+
items: { type: Array },
|
|
25
|
+
// Active state: index (or id/value) when single, array when multiple.
|
|
26
|
+
modelValue: { type: [Number, String, Array] },
|
|
27
|
+
// Key used to resolve the v-model value from each item.
|
|
28
|
+
// Auto-detected if omitted: 'id' > 'value' > index.
|
|
29
|
+
itemValueKey: { type: String },
|
|
30
|
+
multiple: { type: Boolean },
|
|
31
|
+
mandatory: { type: Boolean }, // Keep at least one active at all times.
|
|
32
|
+
disabled: { type: Boolean },
|
|
33
|
+
// Gap between buttons. 0 (default) = stuck together.
|
|
34
|
+
gap: { type: [Number, String], default: 0 },
|
|
35
|
+
// Class applied to every button.
|
|
36
|
+
buttonClass: { type: [String, Object, Array] },
|
|
37
|
+
// Colors.
|
|
38
|
+
color: { type: String },
|
|
39
|
+
bgColor: { type: String },
|
|
40
|
+
activeColor: { type: String },
|
|
41
|
+
activeBgColor: { type: String },
|
|
42
|
+
// Style variants — forwarded to buttons and also applied globally on the wrapper in stuck mode.
|
|
43
|
+
dark: { type: Boolean },
|
|
44
|
+
light: { type: Boolean },
|
|
45
|
+
outline: { type: Boolean },
|
|
46
|
+
text: { type: Boolean },
|
|
47
|
+
round: { type: Boolean },
|
|
48
|
+
shadow: { type: Boolean },
|
|
49
|
+
tile: { type: Boolean },
|
|
50
|
+
// Forwarded to every button.
|
|
51
|
+
type: { type: String },
|
|
52
|
+
noRipple: { type: Boolean, default: undefined },
|
|
53
|
+
// Sizes (forwarded).
|
|
54
|
+
xs: { type: Boolean },
|
|
55
|
+
sm: { type: Boolean },
|
|
56
|
+
md: { type: Boolean },
|
|
57
|
+
lg: { type: Boolean },
|
|
58
|
+
xl: { type: Boolean },
|
|
59
|
+
width: { type: [Number, String] },
|
|
60
|
+
height: { type: [Number, String] }
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
emits: ['update:modelValue', 'click'],
|
|
64
|
+
|
|
65
|
+
// Slot mode: child w-button instances register here to receive the active state.
|
|
66
|
+
provide () {
|
|
67
|
+
return { wButtons: this }
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
created () {
|
|
71
|
+
// Plain array on purpose: registering children must not retrigger a parent render
|
|
72
|
+
// mid-mount (that corrupts the DOM patch and throws parentNode of null).
|
|
73
|
+
this.childButtons = []
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
computed: {
|
|
77
|
+
hasGap () {
|
|
78
|
+
return !!~~this.gap
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// Key used to build v-model values from items.
|
|
82
|
+
resolvedValueKey () {
|
|
83
|
+
if (this.itemValueKey) return this.itemValueKey
|
|
84
|
+
if (this.items?.length && this.items.every(i => i.id !== undefined)) return 'id'
|
|
85
|
+
if (this.items?.length && this.items.every(i => i.value !== undefined)) return 'value'
|
|
86
|
+
return null // → 0-based index mode
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// Build internal item list with _active flag and _val for v-model.
|
|
90
|
+
buttonItems () {
|
|
91
|
+
return (this.items || []).map((item, i) => {
|
|
92
|
+
const val = this.resolvedValueKey ? item[this.resolvedValueKey] : i
|
|
93
|
+
const active = this.modelValue !== undefined && this.modelValue !== null
|
|
94
|
+
? (this.multiple
|
|
95
|
+
? (Array.isArray(this.modelValue) && this.modelValue.includes(val))
|
|
96
|
+
: this.modelValue === val)
|
|
97
|
+
: !!item.active
|
|
98
|
+
return { ...item, _index: i, _val: val, _active: active }
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
wrapperClasses () {
|
|
103
|
+
return [
|
|
104
|
+
'w-buttons',
|
|
105
|
+
this.hasGap && 'w-buttons--gap',
|
|
106
|
+
this.round && 'w-buttons--round',
|
|
107
|
+
this.shadow && !this.hasGap && 'w-buttons--shadow',
|
|
108
|
+
this.tile && 'w-buttons--tile'
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
wrapperStyle () {
|
|
113
|
+
if (!this.hasGap) return null
|
|
114
|
+
return { gap: `calc(var(--w-base-increment) * ${~~this.gap})` }
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
// Shared size/style props forwarded to every button.
|
|
118
|
+
sharedProps () {
|
|
119
|
+
return {
|
|
120
|
+
type: this.type,
|
|
121
|
+
dark: this.dark || null,
|
|
122
|
+
light: this.light || null,
|
|
123
|
+
tile: this.tile || null,
|
|
124
|
+
noRipple: this.noRipple,
|
|
125
|
+
xs: this.xs || null,
|
|
126
|
+
sm: this.sm || null,
|
|
127
|
+
md: this.md || null,
|
|
128
|
+
lg: this.lg || null,
|
|
129
|
+
xl: this.xl || null,
|
|
130
|
+
width: this.width,
|
|
131
|
+
height: this.height
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
methods: {
|
|
137
|
+
isActive (val) {
|
|
138
|
+
if (this.modelValue === undefined || this.modelValue === null) return false
|
|
139
|
+
return this.multiple
|
|
140
|
+
? (Array.isArray(this.modelValue) && this.modelValue.includes(val))
|
|
141
|
+
: this.modelValue === val
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
btnProps (item) {
|
|
145
|
+
const active = item._active
|
|
146
|
+
return {
|
|
147
|
+
...this.sharedProps,
|
|
148
|
+
color: active ? (this.activeColor || item.color || this.color) : (item.color || this.color || null),
|
|
149
|
+
bgColor: active ? (this.activeBgColor || item.bgColor || null) : null,
|
|
150
|
+
outline: !active && this.outline || null,
|
|
151
|
+
text: !active && !this.outline || null,
|
|
152
|
+
shadow: this.hasGap && this.shadow || null,
|
|
153
|
+
round: this.hasGap && this.round || null,
|
|
154
|
+
icon: this.$slots.default ? null : (item.icon || null),
|
|
155
|
+
iconProps: item.iconProps,
|
|
156
|
+
disabled: this.disabled || item.disabled || null,
|
|
157
|
+
active,
|
|
158
|
+
'aria-pressed': active ? 'true' : 'false',
|
|
159
|
+
class: [this.buttonClass, item.class, { 'w-buttons__btn--active': active }]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
onItemClick (item, e) {
|
|
164
|
+
if (this.disabled || item.disabled) return
|
|
165
|
+
this.toggle(item._val, item._index)
|
|
166
|
+
this.$emit('click', item, item._index, e)
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
// Slot mode only. Items mode handles clicks on each button.
|
|
170
|
+
onGroupClick (e) {
|
|
171
|
+
if (this.items || this.disabled) return
|
|
172
|
+
const btn = this.childButtons.find(c => c.$el === e.target || c.$el?.contains?.(e.target))
|
|
173
|
+
if (!btn || btn.disabled || btn.loading) return
|
|
174
|
+
const i = this.childButtons.indexOf(btn)
|
|
175
|
+
this.toggle(i, i)
|
|
176
|
+
this.$emit('click', null, i, e)
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
register (btn) {
|
|
180
|
+
if (!this.childButtons.includes(btn)) this.childButtons.push(btn)
|
|
181
|
+
btn.$forceUpdate?.()
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
unregister (btn) {
|
|
185
|
+
const i = this.childButtons.indexOf(btn)
|
|
186
|
+
if (i >= 0) this.childButtons.splice(i, 1)
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
isSlotActive (btn) {
|
|
190
|
+
return this.isActive(this.childButtons.indexOf(btn))
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
toggle (val, index) {
|
|
194
|
+
let next
|
|
195
|
+
if (this.multiple) {
|
|
196
|
+
const current = Array.isArray(this.modelValue) ? [...this.modelValue] : []
|
|
197
|
+
const idx = current.indexOf(val)
|
|
198
|
+
if (idx === -1) {
|
|
199
|
+
next = [...current, val]
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
if (this.mandatory && current.length === 1) return // keep at least one
|
|
203
|
+
next = current.filter(v => v !== val)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
if (this.modelValue === val) {
|
|
208
|
+
if (this.mandatory) return // keep at least one
|
|
209
|
+
next = null
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
next = val
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this.$emit('update:modelValue', next)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
</script>
|
|
220
|
+
|
|
221
|
+
<style lang="scss">
|
|
222
|
+
.w-buttons {
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
vertical-align: middle;
|
|
225
|
+
|
|
226
|
+
// --- Stuck mode (default, gap = 0) ---
|
|
227
|
+
&:not(.w-buttons--gap) {
|
|
228
|
+
.w-button {
|
|
229
|
+
border-radius: 0;
|
|
230
|
+
box-shadow: none;
|
|
231
|
+
}
|
|
232
|
+
.w-button:not(:first-child) { margin-left: -1px; }
|
|
233
|
+
.w-button:hover, .w-button:focus-visible,
|
|
234
|
+
.w-button.w-buttons__btn--active { z-index: 1; }
|
|
235
|
+
|
|
236
|
+
.w-button:first-child { border-radius: var(--w-border-radius) 0 0 var(--w-border-radius); }
|
|
237
|
+
.w-button:last-child { border-radius: 0 var(--w-border-radius) var(--w-border-radius) 0; }
|
|
238
|
+
|
|
239
|
+
// Single button in the group gets full radius.
|
|
240
|
+
.w-button:only-child { border-radius: var(--w-border-radius); }
|
|
241
|
+
|
|
242
|
+
&.w-buttons--round {
|
|
243
|
+
.w-button:first-child {
|
|
244
|
+
border-radius: 99em 0 0 99em;
|
|
245
|
+
padding-left: calc(var(--w-base-increment) * 3);
|
|
246
|
+
}
|
|
247
|
+
.w-button:last-child {
|
|
248
|
+
border-radius: 0 99em 99em 0;
|
|
249
|
+
padding-right: calc(var(--w-base-increment) * 3);
|
|
250
|
+
}
|
|
251
|
+
.w-button:only-child {
|
|
252
|
+
border-radius: 99em;
|
|
253
|
+
padding-left: calc(var(--w-base-increment) * 3);
|
|
254
|
+
padding-right: calc(var(--w-base-increment) * 3);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
&.w-buttons--tile .w-button { border-radius: 0; }
|
|
258
|
+
&.w-buttons--shadow { box-shadow: var(--w-box-shadow); }
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// --- Gap mode ---
|
|
262
|
+
// Gap is applied via inline style.
|
|
263
|
+
// round / shadow / tile are forwarded per-button via btnProps().
|
|
264
|
+
}
|
|
265
|
+
</style>
|
|
@@ -82,8 +82,8 @@ export default {
|
|
|
82
82
|
itemClass: { type: String },
|
|
83
83
|
depth: { type: Number, default: 0 }, // For recursive call.
|
|
84
84
|
returnObject: { type: Boolean },
|
|
85
|
-
|
|
86
|
-
//
|
|
85
|
+
mandatory: { type: Boolean }, // Keep at least one item selected at all times.
|
|
86
|
+
// @deprecated Use `mandatory` instead.
|
|
87
87
|
noUnselect: { type: Boolean },
|
|
88
88
|
arrowsNavigation: { type: Boolean }
|
|
89
89
|
},
|
|
@@ -160,8 +160,8 @@ export default {
|
|
|
160
160
|
|
|
161
161
|
// Action of selecting 1 item.
|
|
162
162
|
selectItem (item, forcedValue) {
|
|
163
|
-
// Prevent unselecting a selected item if
|
|
164
|
-
if (item._selected && !this.multiple && this.noUnselect) return
|
|
163
|
+
// Prevent unselecting a selected item if mandatory (or deprecated noUnselect) in single selection list.
|
|
164
|
+
if (item._selected && !this.multiple && (this.mandatory || this.noUnselect)) return
|
|
165
165
|
|
|
166
166
|
// Select or unselect the item.
|
|
167
167
|
item._selected = forcedValue !== undefined ? forcedValue : !item._selected
|
|
@@ -73,14 +73,14 @@ component(
|
|
|
73
73
|
@item-click="$emit('item-click', $event)"
|
|
74
74
|
@item-select="onListItemSelect"
|
|
75
75
|
@keydown="onWListKeydown"
|
|
76
|
-
@keydown:enter="noUnselect && !multiple && closeMenu()"
|
|
76
|
+
@keydown:enter="(mandatory || noUnselect) && !multiple && closeMenu()"
|
|
77
77
|
@keydown:escape="showMenu && (showMenu = false) /* Will call closeMenu() from w-menu(@close). */"
|
|
78
78
|
:items="selectItems"
|
|
79
79
|
:multiple="multiple"
|
|
80
80
|
arrows-navigation
|
|
81
81
|
return-object
|
|
82
82
|
:add-ids="selectListId"
|
|
83
|
-
:
|
|
83
|
+
:mandatory="mandatory || noUnselect"
|
|
84
84
|
:selection-color="selectionColor"
|
|
85
85
|
:item-color-key="itemColorKey"
|
|
86
86
|
role="listbox"
|
|
@@ -157,8 +157,8 @@ export default {
|
|
|
157
157
|
lg: { type: Boolean },
|
|
158
158
|
xl: { type: Boolean },
|
|
159
159
|
returnObject: { type: Boolean },
|
|
160
|
-
|
|
161
|
-
//
|
|
160
|
+
mandatory: { type: Boolean }, // Keep at least one item selected at all times.
|
|
161
|
+
// @deprecated Use `mandatory` instead.
|
|
162
162
|
noUnselect: { type: Boolean },
|
|
163
163
|
menuProps: { type: Object }, // Allow passing down an object of props to the w-menu component.
|
|
164
164
|
dark: { type: Boolean },
|