@livestorm/ui-vue 1.1.0 → 1.1.2
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/.env +1 -0
- package/.eslintignore +4 -0
- package/.eslintrc.js +47 -0
- package/.pkg +11 -0
- package/babel.config.js +5 -0
- package/build/Dockerfile +31 -0
- package/ci/ci.yml +54 -0
- package/components-vite.js +29 -0
- package/components-webpack.js +29 -0
- package/components.d.ts +4 -0
- package/index.d.ts +3 -0
- package/index.js +24 -0
- package/package.json +12 -16
- package/plugins.js +17 -0
- package/postcss.config.js +1 -0
- package/src/components/BaseAutocomplete/BaseAutocomplete.spec.js +506 -0
- package/src/components/BaseAutocomplete/BaseAutocomplete.stories.js +184 -0
- package/src/components/BaseAutocomplete/BaseAutocomplete.vue +431 -0
- package/src/components/BaseBanner/BaseBanner.spec.js +32 -0
- package/src/components/BaseBanner/BaseBanner.stories.js +133 -0
- package/src/components/BaseBanner/BaseBanner.vue +229 -0
- package/src/components/BaseButton/BaseButton.spec.js +98 -0
- package/src/components/BaseButton/BaseButton.stories.js +291 -0
- package/src/components/BaseButton/BaseButton.vue +193 -0
- package/src/components/BaseButton/__snapshots__/BaseButton.spec.js.snap +37 -0
- package/src/components/BaseButton/__snapshots__/BaseButton.spec.js.snap.old +31 -0
- package/src/components/BaseCheckbox/BaseCheckbox.stories.js +82 -0
- package/src/components/BaseCheckbox/BaseCheckbox.vue +161 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenu.stories.js +84 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenu.vue +251 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenuButton.vue +26 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenuDivider.vue +10 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenuItem.vue +206 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenuSearch.vue +49 -0
- package/src/components/BaseDropdownMenu/BaseDropdownMenuTitle.vue +26 -0
- package/src/components/BaseModal/BaseModal.stories.js +143 -0
- package/src/components/BaseModal/BaseModal.vue +187 -0
- package/src/components/BaseModal/BaseModalContent.vue +164 -0
- package/src/components/BaseModal/BaseModalContentOld.vue +242 -0
- package/src/components/BaseRating/BaseRating.spec.js +46 -0
- package/src/components/BaseRating/BaseRating.stories.js +46 -0
- package/src/components/BaseRating/BaseRating.vue +119 -0
- package/src/components/BaseSelect/BaseSelect.stories.js +177 -0
- package/src/components/BaseSelect/BaseSelect.vue +443 -0
- package/src/components/BaseSelect/BaseSelectGroup.vue +34 -0
- package/src/components/BaseSelect/BaseSelectOption.vue +219 -0
- package/src/components/BaseSwitch/BaseSwitch.stories.js +44 -0
- package/src/components/BaseSwitch/BaseSwitch.vue +114 -0
- package/src/components/BaseTag/BaseTag.stories.js +123 -0
- package/src/components/BaseTag/BaseTag.vue +244 -0
- package/src/css/body.postcss +29 -0
- package/src/css/button.postcss +354 -0
- package/src/css/checkbox-radio.postcss +152 -0
- package/src/css/icon.postcss +9 -0
- package/src/css/loader.postcss +120 -0
- package/src/css/popper.postcss +143 -0
- package/src/css/tailwind-utilities.postcss +1 -0
- package/src/css/tailwind.postcss +2 -0
- package/src/css/transitions.postcss +66 -0
- package/src/mixins/DynamicAction.js +59 -0
- package/src/utils/breakpoints.js +8 -0
- package/src/utils/bus.js +3 -0
- package/src/utils/clipboard.js +38 -0
- package/src/utils/devices.js +134 -0
- package/src/utils/elements.js +25 -0
- package/src/utils/index.js +8 -0
- package/src/utils/responsive.js +61 -0
- package/src/utils/router.js +94 -0
- package/src/utils/slot.js +27 -0
- package/src/utils/stack-view.js +116 -0
- package/src/utils/uid.js +5 -0
- package/style-postcss.d.ts +3 -0
- package/style-postcss.js +2 -0
- package/style.js +12 -0
- package/tailwind.config.base.cjs +88 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.check.json +13 -0
- package/tsconfig.json +66 -0
- package/vite.config.js +43 -0
- package/vitest.setup.js +26 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="!isClosed"
|
|
4
|
+
class="base-banner flex justify-between text-grey-700 text-14-regular px-6 py-4"
|
|
5
|
+
:class="[
|
|
6
|
+
{
|
|
7
|
+
'rounded-8': borderRounded && !bannerMode,
|
|
8
|
+
'items-center': !isDisplayBlock,
|
|
9
|
+
'fixed z-[10000] w-full left-0': bannerMode,
|
|
10
|
+
'bottom-0 md:bottom-auto md:top-0': bannerMode && bannerBottomOnSmallScreen,
|
|
11
|
+
'top-0': bannerMode && !bannerBottomOnSmallScreen,
|
|
12
|
+
},
|
|
13
|
+
`type-${type}`,
|
|
14
|
+
bgColor,
|
|
15
|
+
]"
|
|
16
|
+
data-testid="base-banner"
|
|
17
|
+
:data-type="type"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="flex w-full"
|
|
21
|
+
:class="isDisplayBlock ? 'flex-col items-center' : 'justify-between items-center'"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
class="flex items-center"
|
|
25
|
+
:class="{
|
|
26
|
+
'flex-col': isDisplayBlock
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="shrink-0 w-6 h-6 flex justify-center items-center"
|
|
31
|
+
:class="icon"
|
|
32
|
+
/>
|
|
33
|
+
<div
|
|
34
|
+
:class="{
|
|
35
|
+
'text-center mt-4': isDisplayBlock,
|
|
36
|
+
'mr-3': !isDisplayBlock && (buttonLabel || buttonsSlot),
|
|
37
|
+
'ml-3': !isDisplayBlock,
|
|
38
|
+
}"
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
v-if="defaultSlot"
|
|
42
|
+
:class="{ 'text-14-semibold': descriptionSlot }"
|
|
43
|
+
>
|
|
44
|
+
<RenderSlot :vnodes="defaultSlot" />
|
|
45
|
+
</div>
|
|
46
|
+
<RenderSlot :vnodes="descriptionSlot" />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
v-if="buttonsSlot"
|
|
51
|
+
:class="{ 'mt-4': isDisplayBlock }"
|
|
52
|
+
>
|
|
53
|
+
<RenderSlot :vnodes="buttonsSlot" />
|
|
54
|
+
</div>
|
|
55
|
+
<template v-if="!buttonsSlot">
|
|
56
|
+
<BaseButton
|
|
57
|
+
v-if="buttonLabel"
|
|
58
|
+
type="button"
|
|
59
|
+
:class="[
|
|
60
|
+
{ 'mt-4': isDisplayBlock },
|
|
61
|
+
buttonClass,
|
|
62
|
+
]"
|
|
63
|
+
:icon="buttonIcon"
|
|
64
|
+
:href="buttonHref"
|
|
65
|
+
:disabled="disabledButton"
|
|
66
|
+
:target="buttonHref ? '_blank' : null"
|
|
67
|
+
data-testid="warning-message-button"
|
|
68
|
+
@click="$emit('handleClick')"
|
|
69
|
+
>
|
|
70
|
+
{{ buttonLabel }}
|
|
71
|
+
</BaseButton>
|
|
72
|
+
</template>
|
|
73
|
+
</div>
|
|
74
|
+
<div
|
|
75
|
+
v-if="closable"
|
|
76
|
+
class="i-ls-x shrink-0 w-5 h-5 text-grey-600 cursor-pointer hover:text-livestorm-800"
|
|
77
|
+
:class="{ 'ml-2': !isDisplayBlock }"
|
|
78
|
+
@click="close"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<script>
|
|
84
|
+
import { computed } from 'vue'
|
|
85
|
+
import { useSlotsAsComponents } from '../../utils/slot'
|
|
86
|
+
import BaseButton from '../BaseButton/BaseButton.vue'
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
components: {
|
|
90
|
+
BaseButton,
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
props: {
|
|
94
|
+
type: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'alert',
|
|
97
|
+
validator (value) {
|
|
98
|
+
return ['info', 'success', 'warning', 'alert'].includes(value)
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
display: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: 'inline',
|
|
104
|
+
validator (value) {
|
|
105
|
+
return ['inline', 'block'].includes(value)
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
buttonLabel: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '',
|
|
111
|
+
},
|
|
112
|
+
buttonHref: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: null,
|
|
115
|
+
},
|
|
116
|
+
buttonIcon: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: null,
|
|
119
|
+
},
|
|
120
|
+
closable: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false,
|
|
123
|
+
},
|
|
124
|
+
bannerMode: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: false,
|
|
127
|
+
},
|
|
128
|
+
borderRounded: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: true,
|
|
131
|
+
},
|
|
132
|
+
bannerBottomOnSmallScreen: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: true,
|
|
135
|
+
},
|
|
136
|
+
forceInlineDisplayOnSmallScreen: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: true,
|
|
139
|
+
},
|
|
140
|
+
disabledButton: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
emits: ['handleClick', 'close'],
|
|
147
|
+
|
|
148
|
+
setup () {
|
|
149
|
+
const slots = useSlotsAsComponents()
|
|
150
|
+
const defaultSlot = computed(() => slots.default())
|
|
151
|
+
const descriptionSlot = computed(() => slots.description())
|
|
152
|
+
const buttonsSlot = computed(() => slots.buttons())
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
descriptionSlot,
|
|
156
|
+
buttonsSlot,
|
|
157
|
+
defaultSlot,
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
data () {
|
|
162
|
+
return {
|
|
163
|
+
isClosed: false,
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
computed: {
|
|
168
|
+
icon () {
|
|
169
|
+
switch (this.type) {
|
|
170
|
+
case 'alert':
|
|
171
|
+
return 'i-ls-alert-circle text-red-600'
|
|
172
|
+
case 'warning':
|
|
173
|
+
return 'i-ls-alert-triangle text-orange-600'
|
|
174
|
+
case 'info':
|
|
175
|
+
return 'i-ls-info text-livestorm-600'
|
|
176
|
+
case 'success':
|
|
177
|
+
return 'i-ls-check-circle text-green-600'
|
|
178
|
+
default:
|
|
179
|
+
return 'i-ls-alert-circle text-livestorm-600'
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
bgColor () {
|
|
184
|
+
switch (this.type) {
|
|
185
|
+
case 'alert':
|
|
186
|
+
return 'bg-red-100'
|
|
187
|
+
case 'warning':
|
|
188
|
+
return 'bg-orange-100'
|
|
189
|
+
case 'success':
|
|
190
|
+
return 'bg-green-100'
|
|
191
|
+
case 'info':
|
|
192
|
+
default:
|
|
193
|
+
return 'bg-livestorm-100'
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
buttonClass () {
|
|
198
|
+
switch (this.type) {
|
|
199
|
+
case 'alert':
|
|
200
|
+
return 'base-button-red-secondary'
|
|
201
|
+
case 'warning':
|
|
202
|
+
return 'base-button-orange-secondary'
|
|
203
|
+
case 'success':
|
|
204
|
+
return 'base-button-green-secondary'
|
|
205
|
+
case 'info':
|
|
206
|
+
default:
|
|
207
|
+
return 'base-button-secondary'
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
isDisplayBlock () {
|
|
212
|
+
return this.display === 'block' || (this.display === 'inline' && this.$responsive.mobile && this.forceInlineDisplayOnSmallScreen)
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
methods: {
|
|
217
|
+
close () {
|
|
218
|
+
this.isClosed = true
|
|
219
|
+
this.$emit('close')
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
224
|
+
|
|
225
|
+
<style lang="postcss" scoped>
|
|
226
|
+
.base-banner :deep(a:not(.base-button)) {
|
|
227
|
+
@apply text-grey-700 hover:text-grey-900 underline;
|
|
228
|
+
}
|
|
229
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import BaseButton from './BaseButton.vue'
|
|
3
|
+
|
|
4
|
+
describe('BaseButton', () => {
|
|
5
|
+
test('snapshot: button', () => {
|
|
6
|
+
const wrapper = mount(BaseButton, {
|
|
7
|
+
props: {
|
|
8
|
+
type: 'submit',
|
|
9
|
+
},
|
|
10
|
+
slots: {
|
|
11
|
+
default: '<span>Hello</span>',
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('snapshot: router-link', () => {
|
|
18
|
+
const wrapper = mount(BaseButton, {
|
|
19
|
+
props: {
|
|
20
|
+
to: { name: 'foo' },
|
|
21
|
+
},
|
|
22
|
+
slots: {
|
|
23
|
+
default: '<span>My Page</span>',
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('snapshot: a', () => {
|
|
30
|
+
const wrapper = mount(BaseButton, {
|
|
31
|
+
props: {
|
|
32
|
+
href: 'https://google.com/',
|
|
33
|
+
},
|
|
34
|
+
slots: {
|
|
35
|
+
default: '<span>Google</span>',
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('event: click', async () => {
|
|
42
|
+
const wrapper = mount(BaseButton)
|
|
43
|
+
await wrapper.trigger('click')
|
|
44
|
+
expect(wrapper.emitted().click).toBeTruthy()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('icon left', () => {
|
|
48
|
+
const wrapper = mount(BaseButton, {
|
|
49
|
+
props: {
|
|
50
|
+
icon: 'foo',
|
|
51
|
+
},
|
|
52
|
+
slots: {
|
|
53
|
+
default: '<span>My Page</span>',
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
const selector = '.left-icon'
|
|
57
|
+
expect(wrapper.get(selector))
|
|
58
|
+
const icon = wrapper.find(selector)
|
|
59
|
+
expect(icon.classes()).toContain('foo')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('icon right', () => {
|
|
63
|
+
const wrapper = mount(BaseButton, {
|
|
64
|
+
props: {
|
|
65
|
+
iconRight: 'foo',
|
|
66
|
+
},
|
|
67
|
+
slots: {
|
|
68
|
+
default: '<span>My Page</span>',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
const selector = '.right-icon'
|
|
72
|
+
expect(wrapper.get(selector))
|
|
73
|
+
const icon = wrapper.find(selector)
|
|
74
|
+
expect(icon.classes()).toContain('foo')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test('loading state', () => {
|
|
78
|
+
const wrapper = mount(BaseButton, {
|
|
79
|
+
props: {
|
|
80
|
+
loading: true,
|
|
81
|
+
},
|
|
82
|
+
slots: {
|
|
83
|
+
default: '<span class="foo">Send message</span>',
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
expect(wrapper.get('.loader'))
|
|
87
|
+
expect(wrapper.get('.foo'))
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('disabled', () => {
|
|
91
|
+
const wrapper = mount(BaseButton, {
|
|
92
|
+
props: {
|
|
93
|
+
disabled: true,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
expect(wrapper.attributes().disabled).toBe('')
|
|
97
|
+
})
|
|
98
|
+
})
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import BaseButton from './BaseButton.vue'
|
|
2
|
+
import { icons } from '@/../../frontend/.storybook/icons'
|
|
3
|
+
import { action } from '@storybook/addon-actions'
|
|
4
|
+
import { withDesign } from 'storybook-addon-designs'
|
|
5
|
+
|
|
6
|
+
const actions = {
|
|
7
|
+
onClick: action('clicked'),
|
|
8
|
+
onClose: action('closed'),
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'common/vue/components/BaseButton',
|
|
13
|
+
component: BaseButton,
|
|
14
|
+
argTypes: {
|
|
15
|
+
icon: {
|
|
16
|
+
control: {
|
|
17
|
+
type: 'select',
|
|
18
|
+
},
|
|
19
|
+
options: icons,
|
|
20
|
+
},
|
|
21
|
+
class: {
|
|
22
|
+
control: {
|
|
23
|
+
type: 'select',
|
|
24
|
+
},
|
|
25
|
+
options: [
|
|
26
|
+
'base-button-extra-small',
|
|
27
|
+
'base-button-small',
|
|
28
|
+
'base-button-medium',
|
|
29
|
+
'base-button-large',
|
|
30
|
+
'base-button-extra-large',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
args: {
|
|
35
|
+
class: 'base-button-medium',
|
|
36
|
+
},
|
|
37
|
+
decorators: [withDesign],
|
|
38
|
+
parameters: {
|
|
39
|
+
design: {
|
|
40
|
+
type: 'figma',
|
|
41
|
+
url: 'https://www.figma.com/file/JY03TRyhauKw0jjoHFFtmMHV/0.-Design-system---Fondation?node-id=7760%3A2',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Colors */
|
|
47
|
+
|
|
48
|
+
const PrimaryTemplate = (args) => ({
|
|
49
|
+
setup: () => ({ args, ...actions }),
|
|
50
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Primary</BaseButton>',
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const SecondaryTemplate = (args) => ({
|
|
54
|
+
setup: () => ({ args, ...actions }),
|
|
55
|
+
template: '<BaseButton v-bind="args" class="base-button-secondary" @click="onClick">Secondary</BaseButton>',
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const RedPrimaryTemplate = (args) => {
|
|
59
|
+
return {
|
|
60
|
+
setup: () => ({ args, ...actions }),
|
|
61
|
+
methods: actions,
|
|
62
|
+
template: '<BaseButton v-bind="args" class="base-button-red-primary" @click="onClick">Red Primary</BaseButton>',
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const RedSecondaryTemplate = (args) => {
|
|
67
|
+
return {
|
|
68
|
+
setup: () => ({ args, ...actions }),
|
|
69
|
+
methods: actions,
|
|
70
|
+
template: '<BaseButton v-bind="args" class="base-button-red-secondary" @click="onClick">Red Secondary</BaseButton>',
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const GreenPrimaryTemplate = (args) => {
|
|
75
|
+
return {
|
|
76
|
+
setup: () => ({ args, ...actions }),
|
|
77
|
+
methods: actions,
|
|
78
|
+
template: '<BaseButton v-bind="args" class="base-button-green-primary" @click="onClick">Green Primary</BaseButton>',
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const GreenSecondaryTemplate = (args) => {
|
|
83
|
+
return {
|
|
84
|
+
setup: () => ({ args, ...actions }),
|
|
85
|
+
methods: actions,
|
|
86
|
+
template: '<BaseButton v-bind="args" class="base-button-green-secondary" @click="onClick">Green Secondary</BaseButton>',
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const OrangePrimaryTemplate = (args) => {
|
|
91
|
+
return {
|
|
92
|
+
setup: () => ({ args, ...actions }),
|
|
93
|
+
methods: actions,
|
|
94
|
+
template: '<BaseButton v-bind="args" class="base-button-orange-primary" @click="onClick">Orange Primary</BaseButton>',
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const OrangeSecondaryTemplate = (args) => {
|
|
99
|
+
return {
|
|
100
|
+
setup: () => ({ args, ...actions }),
|
|
101
|
+
methods: actions,
|
|
102
|
+
template: '<BaseButton v-bind="args" class="base-button-orange-secondary" @click="onClick">Orange Secondary</BaseButton>',
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const AntiPrimaryTemplate = (args) => {
|
|
107
|
+
return {
|
|
108
|
+
setup: () => ({ args, ...actions }),
|
|
109
|
+
methods: actions,
|
|
110
|
+
template: '<BaseButton v-bind="args" class="base-button-anti-primary" @click="onClick">Anti Primary</BaseButton>',
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const TertiaryTemplate = (args) => {
|
|
115
|
+
return {
|
|
116
|
+
setup: () => ({ args, ...actions }),
|
|
117
|
+
methods: actions,
|
|
118
|
+
template: '<BaseButton v-bind="args" class="base-button-tertiary" @click="onClick">Tertiary</BaseButton>',
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const QuaternaryTemplate = (args) => {
|
|
123
|
+
return {
|
|
124
|
+
setup: () => ({ args, ...actions }),
|
|
125
|
+
methods: actions,
|
|
126
|
+
template: '<BaseButton v-bind="args" class="base-button-quaternary" @click="onClick">Quaternary</BaseButton>',
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const QuaternaryBgTemplate = (args) => {
|
|
131
|
+
return {
|
|
132
|
+
setup: () => ({ args, ...actions }),
|
|
133
|
+
methods: actions,
|
|
134
|
+
template: '<BaseButton v-bind="args" class="base-button-quaternary-bg" @click="onClick"></BaseButton>',
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const AlphaWhiteTemplate = (args) => {
|
|
139
|
+
return {
|
|
140
|
+
setup: () => ({ args, ...actions }),
|
|
141
|
+
methods: actions,
|
|
142
|
+
template: '<BaseButton v-bind="args" class="base-button-alpha-white" @click="onClick">Alpha White</BaseButton>',
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const AlphaWhiteBgTemplate = (args) => {
|
|
147
|
+
return {
|
|
148
|
+
setup: () => ({ args, ...actions }),
|
|
149
|
+
methods: actions,
|
|
150
|
+
template: '<BaseButton v-bind="args" class="base-button-alpha-white-bg" @click="onClick">Alpha White Bg</BaseButton>',
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Size */
|
|
155
|
+
|
|
156
|
+
const ExtraSmallTemplate = (args) => ({
|
|
157
|
+
setup: () => ({ args, ...actions }),
|
|
158
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Extra small</BaseButton>',
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
const SmallTemplate = (args) => ({
|
|
162
|
+
setup: () => ({ args, ...actions }),
|
|
163
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Small</BaseButton>',
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const MediumTemplate = (args) => ({
|
|
167
|
+
setup: () => ({ args, ...actions }),
|
|
168
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Medium</BaseButton>',
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const LargeTemplate = (args) => ({
|
|
172
|
+
setup: () => ({ args, ...actions }),
|
|
173
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Large</BaseButton>',
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
const ExtraLargeTemplate = (args) => ({
|
|
177
|
+
setup: () => ({ args, ...actions }),
|
|
178
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick">Extra large</BaseButton>',
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
/** Layout */
|
|
182
|
+
|
|
183
|
+
const IconOnlyTemplate = (args) => ({
|
|
184
|
+
setup: () => ({ args, ...actions }),
|
|
185
|
+
template: '<BaseButton v-bind="args" class="base-button-primary base-button-square" @click="onClick"/>',
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
const AlignCenterTemplate = (args) => ({
|
|
189
|
+
setup: () => ({ args, ...actions }),
|
|
190
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick" style="width: 200px">Align content</BaseButton>',
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const ClosableTemplate = (args) => ({
|
|
194
|
+
setup: () => ({ args, ...actions }),
|
|
195
|
+
template: '<BaseButton v-bind="args" class="base-button-primary" @click="onClick" @close="onClose">Closable</BaseButton>',
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
const FullWidthTemplate = (args) => ({
|
|
199
|
+
setup: () => ({ args, ...actions }),
|
|
200
|
+
template: '<BaseButton v-bind="args" class="base-button-primary w-full" @click="onClick">Full Width</BaseButton>',
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
const ClosableFullWidthTemplate = (args) => ({
|
|
204
|
+
setup: () => ({ args, ...actions }),
|
|
205
|
+
template: '<BaseButton v-bind="args" class="base-button-primary w-full" @click="onClick" @close="onClose">Closable</BaseButton>',
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
/** Colors */
|
|
209
|
+
export const Primary = PrimaryTemplate.bind({})
|
|
210
|
+
export const Secondary = SecondaryTemplate.bind({})
|
|
211
|
+
export const RedPrimary = RedPrimaryTemplate.bind({})
|
|
212
|
+
export const RedSecondary = RedSecondaryTemplate.bind({})
|
|
213
|
+
export const GreenPrimary = GreenPrimaryTemplate.bind({})
|
|
214
|
+
export const GreenSecondary = GreenSecondaryTemplate.bind({})
|
|
215
|
+
export const OrangePrimary = OrangePrimaryTemplate.bind({})
|
|
216
|
+
export const OrangeSecondary = OrangeSecondaryTemplate.bind({})
|
|
217
|
+
export const AntiPrimary = AntiPrimaryTemplate.bind({})
|
|
218
|
+
export const Tertiary = TertiaryTemplate.bind({})
|
|
219
|
+
export const Quaternary = QuaternaryTemplate.bind({})
|
|
220
|
+
export const QuaternaryBg = QuaternaryBgTemplate.bind({})
|
|
221
|
+
export const AlphaWhite = AlphaWhiteTemplate.bind({})
|
|
222
|
+
export const AlphaWhiteBg = AlphaWhiteBgTemplate.bind({})
|
|
223
|
+
|
|
224
|
+
/** Size */
|
|
225
|
+
export const ExtraSmall = ExtraSmallTemplate.bind({})
|
|
226
|
+
export const Small = SmallTemplate.bind({})
|
|
227
|
+
export const Medium = MediumTemplate.bind({})
|
|
228
|
+
export const Large = LargeTemplate.bind({})
|
|
229
|
+
export const ExtraLarge = ExtraLargeTemplate.bind({})
|
|
230
|
+
|
|
231
|
+
/** Layout */
|
|
232
|
+
export const IconOnly = IconOnlyTemplate.bind({})
|
|
233
|
+
export const AlignCenter = AlignCenterTemplate.bind({})
|
|
234
|
+
export const Closable = ClosableTemplate.bind({})
|
|
235
|
+
export const FullWidth = FullWidthTemplate.bind({})
|
|
236
|
+
export const ClosableFullWidth = ClosableFullWidthTemplate.bind({})
|
|
237
|
+
|
|
238
|
+
QuaternaryBg.args = {
|
|
239
|
+
icon: 'i-ls-chevron-left',
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
AlphaWhite.args = {
|
|
243
|
+
icon: 'i-ls-download-cloud',
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
AlphaWhite.parameters = {
|
|
247
|
+
backgrounds: {
|
|
248
|
+
default: 'grey-dark',
|
|
249
|
+
},
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
AlphaWhiteBg.parameters = {
|
|
253
|
+
backgrounds: { default: 'grey-dark' },
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
ExtraSmall.args = {
|
|
257
|
+
class: 'base-button-extra-small',
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
Small.args = {
|
|
261
|
+
class: 'base-button-small',
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
Medium.args = {
|
|
265
|
+
class: 'base-button-medium',
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
Large.args = {
|
|
269
|
+
class: 'base-button-large',
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
ExtraLarge.args = {
|
|
273
|
+
class: 'base-button-extra-large',
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
IconOnly.args = {
|
|
277
|
+
icon: 'i-ls-mail',
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
AlignCenter.args = {
|
|
281
|
+
icon: 'i-ls-zap',
|
|
282
|
+
alignCenter: true,
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
Closable.args = {
|
|
286
|
+
closable: true,
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
ClosableFullWidth.args = {
|
|
290
|
+
closable: true,
|
|
291
|
+
}
|