@policystudio/policy-studio-ui-vue 1.0.1 → 1.0.5
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/README.md +3 -0
- package/package.json +1 -1
- package/src/assets/scss/tailwind.css +13842 -13842
- package/src/components/buttons/PsButton.vue +82 -0
- package/src/components/controls/{Checkbox.vue → PsCheckbox.vue} +1 -1
- package/src/components/controls/{RadioButton.vue → PsRadioButton.vue} +1 -1
- package/src/components/notifications/{Dialog.vue → PsDialog.vue} +5 -5
- package/src/components/notifications/{Toast.vue → PsToast.vue} +5 -5
- package/src/components/tabs/{TabHeader.vue → PsTabHeader.vue} +10 -10
- package/src/index.js +19 -7
- package/src/stories/Button.stories.js +4 -4
- package/src/stories/Checkbox.stories.js +4 -4
- package/src/stories/Colors.stories.mdx +8 -8
- package/src/stories/Dialog.stories.js +4 -4
- package/src/stories/ElevationSystem.stories.mdx +17 -17
- package/src/stories/RadioButton.stories.js +5 -5
- package/src/stories/TabHeader.stories.js +9 -9
- package/src/stories/Toast.stories.js +7 -7
- package/tailwind.config.js +1 -1
- package/src/components/buttons/Button.vue +0 -82
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="psui-font-bold psui-align-middle psui-flex psui-rounded-md"
|
|
4
|
+
:class="classes"
|
|
5
|
+
@click="onClick()"
|
|
6
|
+
>
|
|
7
|
+
<i
|
|
8
|
+
v-if="icon"
|
|
9
|
+
class="psui-my-auto material-icons psui-mr-2"
|
|
10
|
+
:class="{ 'psui-text-sm': size === 'small' }"
|
|
11
|
+
>
|
|
12
|
+
{{ icon }}
|
|
13
|
+
</i>
|
|
14
|
+
<div class="psui-flex-grow psui-text-left">{{ label }}</div>
|
|
15
|
+
<i
|
|
16
|
+
v-if="iconRight" class="psui-my-auto material-icons psui-ml-2"
|
|
17
|
+
:class="{ 'psui-text-sm': size === 'small' }"
|
|
18
|
+
>
|
|
19
|
+
{{ iconRight }}
|
|
20
|
+
</i>
|
|
21
|
+
</button>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
export const sizes = ['big', 'medium', 'small']
|
|
26
|
+
export default {
|
|
27
|
+
props: {
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
outline: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
ghost: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
textOnly: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
icon: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
iconRight: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
size: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'big',
|
|
53
|
+
validator: (value) => sizes.indexOf(value) !== -1
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: [Boolean, String]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
classes() {
|
|
65
|
+
let sizeCss = 'psui-px-4 psui-py-2'
|
|
66
|
+
if (this.size === 'medium') sizeCss = 'psui-px-4 psui-py-1'
|
|
67
|
+
if (this.size === 'small') sizeCss = 'psui-px-2 psui-py-psui-px psui-text-sm'
|
|
68
|
+
if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40' : 'psui-border-blue-60 psui-text-blue-60'}`
|
|
69
|
+
if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
|
|
70
|
+
if (this.textOnly) return `${sizeCss} ${this.disabled ? 'psui-text-gray-40' : 'psui-text-blue-60'}`
|
|
71
|
+
if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40`
|
|
72
|
+
return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner`
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
onClick() {
|
|
77
|
+
if (this.disabled) return false
|
|
78
|
+
this.$emit('click');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="cssClass">
|
|
3
|
-
<div class="material-icons
|
|
4
|
-
<div class="
|
|
5
|
-
<div class="
|
|
3
|
+
<div class="material-icons psui-my-auto">info</div>
|
|
4
|
+
<div class="psui-w-full">{{ message }}</div>
|
|
5
|
+
<div class="psui-cursor-pointer psui-font-bold psui-my-auto psui-pr-4">OK</div>
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
export const typeOptions = ['informative', 'success', 'alert']
|
|
11
11
|
export default {
|
|
12
|
-
name: '
|
|
12
|
+
name: 'PsDialog',
|
|
13
13
|
props: {
|
|
14
14
|
type: {
|
|
15
15
|
type: String,
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
},
|
|
33
33
|
computed: {
|
|
34
34
|
cssClass() {
|
|
35
|
-
return `
|
|
35
|
+
return `psui-flex psui-space-x-4 psui-font-small psui-rounded-md psui-py-2 psui-px-4 psui-align-middle psui-flex psui-bg-${this.colors[this.type].background} psui-text-${this.colors[this.type].color}`
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="cssClass">
|
|
3
|
-
<span class="material-icons
|
|
4
|
-
<div class="
|
|
5
|
-
<div class="
|
|
3
|
+
<span class="material-icons psui-mr-4">{{ icon }}</span>
|
|
4
|
+
<div class="psui-w-full">{{ message }}</div>
|
|
5
|
+
<div class="psui-flex psui-space-x-4">
|
|
6
6
|
<slot></slot>
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export const typeOptions = ['info', 'success', 'warning', 'error']
|
|
13
13
|
export const fillOptions = ['soft', 'intense']
|
|
14
14
|
export default {
|
|
15
|
-
name: '
|
|
15
|
+
name: 'PsToast',
|
|
16
16
|
props: {
|
|
17
17
|
type: {
|
|
18
18
|
type: String,
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
const textColor = this.fill === 'intense' ? 'white': colors[this.type]
|
|
47
47
|
const background = this.fill === 'soft'? `${colors[this.type].split('-', 1)}-10` : colors[this.type]
|
|
48
48
|
|
|
49
|
-
return `
|
|
49
|
+
return `psui-font-bold psui-shadow-md psui-rounded-md psui-p-3 psui-h-12 psui-flex psui-bg-${background} psui-text-${textColor}`
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
@click="selectTab(item)"
|
|
8
8
|
:class="[
|
|
9
9
|
classes,
|
|
10
|
-
{ '
|
|
11
|
-
{ '
|
|
12
|
-
{ '
|
|
10
|
+
{ 'psui-bg-blue-60 psui-text-white': getSelected === item[keyValue] && theme === 'standard' },
|
|
11
|
+
{ 'psui-border-b-2 psui-border-blue-60 psui-text-blue-60 psui-font-bold': getSelected === item[keyValue] && theme === 'underline' },
|
|
12
|
+
{ 'psui-text-blue-60 psui-font-bold psui-bg-white hover:psui-text-blue-60': getSelected === item[keyValue] && theme === 'folder' }
|
|
13
13
|
]"
|
|
14
14
|
>
|
|
15
15
|
{{ item[keyLabel] }}
|
|
@@ -20,25 +20,25 @@
|
|
|
20
20
|
<script>
|
|
21
21
|
export const themeOptions = ['standard', 'underline', 'folder']
|
|
22
22
|
export default {
|
|
23
|
-
name: '
|
|
23
|
+
name: 'PsTabHeader',
|
|
24
24
|
computed: {
|
|
25
25
|
wrapperClasses() {
|
|
26
26
|
if (this.theme === 'underline') {
|
|
27
|
-
return '
|
|
27
|
+
return 'psui-flex psui-space-x-4 psui-border-b psui-border-gray-20'
|
|
28
28
|
}
|
|
29
29
|
if (this.theme === 'folder') {
|
|
30
|
-
return '
|
|
30
|
+
return 'psui-flex psui-space-x-1'
|
|
31
31
|
}
|
|
32
|
-
return '
|
|
32
|
+
return 'psui-inline-flex psui-rounded-md psui-flex psui-gap-x-px'
|
|
33
33
|
},
|
|
34
34
|
classes() {
|
|
35
35
|
if (this.theme === 'underline') {
|
|
36
|
-
return '
|
|
36
|
+
return 'psui-text-gray-60 psui-pb-3 hover:psui-text-blue-60'
|
|
37
37
|
}
|
|
38
38
|
if (this.theme === 'folder') {
|
|
39
|
-
return '
|
|
39
|
+
return 'psui-bg-gray-10 psui-text-gray-50 psui-py-2 psui-px-4 psui-rounded-t-lg hover:psui-text-gray-60 active:psui-text-blue-60'
|
|
40
40
|
}
|
|
41
|
-
return '
|
|
41
|
+
return 'psui-bg-gray-10 psui-px-4 psui-py-2 psui-text-gray-60 hover:psui-text-blue-60 last:psui-rounded-r-lg first:psui-rounded-l-lg active:psui-text-white active:psui-bg-blue-60'
|
|
42
42
|
},
|
|
43
43
|
getIsObject() {
|
|
44
44
|
return typeof this.selected === 'object'
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import PsButton from './components/buttons/PsButton.vue';
|
|
2
|
+
import PsCheckbox from './components/controls/PsCheckbox.vue';
|
|
3
|
+
import PsDialog from './components/notifications/PsDialog.vue';
|
|
4
|
+
import PsToast from './components/notifications/PsToast.vue';
|
|
5
|
+
import PsTabHeader from './components/tabs/PsTabHeader.vue';
|
|
6
|
+
import PsRadioButton from './components/controls/PsRadioButton.vue';
|
|
3
7
|
|
|
4
8
|
export default {
|
|
5
9
|
install(Vue) {
|
|
6
|
-
Vue.component('
|
|
7
|
-
Vue.component('
|
|
8
|
-
|
|
10
|
+
Vue.component('PsButton', PsButton);
|
|
11
|
+
Vue.component('PsCheckbox', PsCheckbox);
|
|
12
|
+
Vue.component('PsDialog', PsDialog);
|
|
13
|
+
Vue.component('PsToast', PsToast);
|
|
14
|
+
Vue.component('PsTabHeader', PsTabHeader);
|
|
15
|
+
Vue.component('PsRadioButton', PsRadioButton);
|
|
16
|
+
}
|
|
9
17
|
};
|
|
10
18
|
|
|
11
19
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
PsButton,
|
|
21
|
+
PsCheckbox,
|
|
22
|
+
PsDialog,
|
|
23
|
+
PsToast,
|
|
24
|
+
PsTabHeader,
|
|
25
|
+
PsRadioButton
|
|
14
26
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsButton, { sizes } from '../components/buttons/PsButton.vue';
|
|
2
2
|
const icons = ['add_circle', 'delete', 'done', 'info', 'send']
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Components/Button',
|
|
5
|
-
component:
|
|
5
|
+
component: PsButton,
|
|
6
6
|
argTypes: {
|
|
7
7
|
size: { control: { type: 'select', options: sizes } },
|
|
8
8
|
disabled: { control: 'boolean' },
|
|
@@ -13,9 +13,9 @@ export default {
|
|
|
13
13
|
|
|
14
14
|
const Template = (args, { argTypes }) => ({
|
|
15
15
|
props: Object.keys(argTypes),
|
|
16
|
-
components: {
|
|
16
|
+
components: { PsButton },
|
|
17
17
|
template: `
|
|
18
|
-
<
|
|
18
|
+
<PsButton v-bind="$props" />
|
|
19
19
|
`
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsCheckbox, { sizes } from '../components/controls/PsCheckbox.vue';
|
|
2
2
|
const icons = ['add_circle', 'delete', 'done', 'info', 'send']
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Components/Checkbox',
|
|
5
|
-
component:
|
|
5
|
+
component: PsCheckbox,
|
|
6
6
|
argTypes: {
|
|
7
7
|
disabled: { control: 'boolean' },
|
|
8
8
|
},
|
|
@@ -10,9 +10,9 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
const Template = (args, { argTypes }) => ({
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
components: {
|
|
13
|
+
components: { PsCheckbox },
|
|
14
14
|
template: `
|
|
15
|
-
<
|
|
15
|
+
<PsCheckbox v-bind="$props" />
|
|
16
16
|
`
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -11,12 +11,12 @@ Out colors are designed to be harmonious, ensure accessible text, and distinguis
|
|
|
11
11
|
|
|
12
12
|
## Blue
|
|
13
13
|
|
|
14
|
-
<div class="
|
|
15
|
-
<div class="
|
|
16
|
-
<div class="
|
|
17
|
-
<div class="
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<div class="
|
|
21
|
-
<div class="
|
|
14
|
+
<div class="psui-grid psui-grid-flow-col">
|
|
15
|
+
<div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-80">Blue 80</div>
|
|
16
|
+
<div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-70">Blue 70</div>
|
|
17
|
+
<div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-60">Blue 60</div>
|
|
18
|
+
<div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-50">Blue 50</div>
|
|
19
|
+
<div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-blue-20">Blue 20</div>
|
|
20
|
+
<div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-blue-10">Blue 10</div>
|
|
21
|
+
<div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-white ">White</div>
|
|
22
22
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsDialog from '../components/notifications/PsDialog.vue';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Components/Dialog',
|
|
5
|
-
component:
|
|
5
|
+
component: PsDialog,
|
|
6
6
|
argTypes: {
|
|
7
7
|
type: { control: { type: 'select', options: ['informative', 'success', 'alert'] } },
|
|
8
8
|
},
|
|
@@ -10,8 +10,8 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
const Template = (args, { argTypes }) => ({
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
components: {
|
|
14
|
-
template: '<
|
|
13
|
+
components: { PsDialog },
|
|
14
|
+
template: '<PsDialog v-bind="$props" />',
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
export const Informative = Template.bind({});
|
|
@@ -14,28 +14,28 @@ Elevation is evidenced by the use of shadows. It's another way to establish a vi
|
|
|
14
14
|
|
|
15
15
|
### 1.1. Shadow and light
|
|
16
16
|
The shadows in our elements are projected by these two light sources: main light and ambient light.
|
|
17
|
-
<div class="
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<p class="
|
|
17
|
+
<div class="psui-grid psui-grid-cols-3 psui-gap-4">
|
|
18
|
+
<div class="psui-bg-gray-20 psui-pt-8">
|
|
19
|
+
<div class="psui-bg-white psui-w-48 psui-h-48 psui-rounded-md psui-shadow mx-auto"></div>
|
|
20
|
+
<p class="psui-text-center">Shadow cast by main light</p>
|
|
21
21
|
</div>
|
|
22
|
-
<div class="
|
|
23
|
-
<div class="
|
|
24
|
-
<p class="
|
|
22
|
+
<div class="psui-bg-gray-20 psui-pt-8">
|
|
23
|
+
<div class="psui-bg-white psui-w-48 psui-h-48 psui-rounded-md psui-shadow-sm mx-auto"></div>
|
|
24
|
+
<p class="psui-text-center">Shadow cast by ambient light</p>
|
|
25
25
|
</div>
|
|
26
|
-
<div class="
|
|
27
|
-
<div class="
|
|
28
|
-
<p class="
|
|
26
|
+
<div class="psui-bg-gray-20 psui-pt-8">
|
|
27
|
+
<div class="psui-bg-white psui-w-48 psui-h-48 psui-rounded-md psui-shadow-md mx-auto"></div>
|
|
28
|
+
<p class="psui-text-center">Combined shadow from main and ambient lights</p>
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
## 2. Elevation system
|
|
33
33
|
Shadows provide cues about depth, direction of movement, and surface edges. A surface’s shadow is determined by its elevation and relationship to other surfaces.
|
|
34
|
-
<div class="
|
|
35
|
-
<div class="
|
|
36
|
-
<div class="
|
|
37
|
-
<div class="
|
|
38
|
-
<div class="
|
|
39
|
-
<div class="
|
|
40
|
-
<div class="
|
|
34
|
+
<div class="psui-grid grid-cols-2 psui-gap-6 psui-p-6 psui-bg-gray-20">
|
|
35
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-shadow-inner">Elevation -5</div>
|
|
36
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-sm">Elevation 5</div>
|
|
37
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow">Elevation 10</div>
|
|
38
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-md">Elevation 20</div>
|
|
39
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-lg">Elevation 30</div>
|
|
40
|
+
<div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-xl">Elevation 40</div>
|
|
41
41
|
</div>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsRadioButton from '../components/controls/PsRadioButton.vue';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
title: 'Components/
|
|
5
|
-
component:
|
|
4
|
+
title: 'Components/Radio Button',
|
|
5
|
+
component: PsRadioButton,
|
|
6
6
|
argTypes: {},
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
10
|
props: Object.keys(argTypes),
|
|
11
|
-
components: {
|
|
11
|
+
components: { PsRadioButton },
|
|
12
12
|
template: `
|
|
13
|
-
<
|
|
13
|
+
<PsRadioButton v-bind="$props" />
|
|
14
14
|
`
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsTabHeader from '../components/tabs/PsTabHeader.vue';
|
|
2
2
|
const items = ['Existing Buildings', 'New Constructions', 'Other tab']
|
|
3
3
|
const item = items[0]
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title: 'Components/
|
|
7
|
-
component:
|
|
6
|
+
title: 'Components/Tab Header',
|
|
7
|
+
component: PsTabHeader,
|
|
8
8
|
argTypes: {}
|
|
9
9
|
};
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
11
|
props: Object.keys(argTypes),
|
|
12
|
-
components: {
|
|
12
|
+
components: { PsTabHeader },
|
|
13
13
|
data: () => {
|
|
14
14
|
return {
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
template: `
|
|
18
|
-
<div class="
|
|
19
|
-
<
|
|
20
|
-
<div v-if="$props['selected'] === 'Existing Buildings'" class="
|
|
18
|
+
<div class="psui-bg-gray-20 psui-p-8">
|
|
19
|
+
<PsTabHeader :selected.sync=selected v-bind="$props"/>
|
|
20
|
+
<div v-if="$props['selected'] === 'Existing Buildings'" class="psui-bg-white psui-p-4" :class="{ 'psui-mt-4' : $props['theme'] === 'standard'}">
|
|
21
21
|
<p v-for="i of 4">Tab Existing Buildings Selected</p>
|
|
22
22
|
</div>
|
|
23
|
-
<div v-if="$props['selected'] === 'New Constructions'" class="
|
|
23
|
+
<div v-if="$props['selected'] === 'New Constructions'" class="psui-bg-white psui-p-4" :class="{ 'psui-mt-4' : $props['theme'] === 'standard'}">
|
|
24
24
|
<p v-for="i of 4">Tab New Constructions Selected</p>
|
|
25
25
|
</div>
|
|
26
|
-
<div v-if="$props['selected'] === 'Other tab'" class="
|
|
26
|
+
<div v-if="$props['selected'] === 'Other tab'" class="psui-bg-white psui-p-4" :class="{ 'psui-mt-4' : $props['theme'] === 'standard'}">
|
|
27
27
|
<p v-for="i of 4">Other tab Selected</p>
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PsToast, { typeOptions, fillOptions } from '../components/notifications/PsToast.vue';
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/Toast',
|
|
4
|
-
component:
|
|
4
|
+
component: PsToast,
|
|
5
5
|
argTypes: {
|
|
6
6
|
type: { control: { type: 'select', options: typeOptions } },
|
|
7
7
|
fill: { control: { type: 'select', options: fillOptions } }
|
|
@@ -10,16 +10,16 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
const Template = (args, { argTypes }) => ({
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
components: {
|
|
13
|
+
components: { PsToast },
|
|
14
14
|
methods: {
|
|
15
15
|
teste(message) {
|
|
16
16
|
alert(message)
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
template: `
|
|
20
|
-
<
|
|
20
|
+
<PsToast v-bind="$props">
|
|
21
21
|
<template v-if="${'default' in args}" v-slot>${args.default}</template>
|
|
22
|
-
</
|
|
22
|
+
</PsToast>
|
|
23
23
|
`
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -52,7 +52,7 @@ Actions.args = {
|
|
|
52
52
|
type: 'info',
|
|
53
53
|
message: 'This is an info alert with actions',
|
|
54
54
|
default: `
|
|
55
|
-
<span class="
|
|
56
|
-
<span class="
|
|
55
|
+
<span class="psui-cursor-pointer" @click="teste('Callback Action 1')">ACTION1</span>
|
|
56
|
+
<span class="psui-cursor-pointer" @click="teste('Callback Action 2')">ACTION2</span>
|
|
57
57
|
`
|
|
58
58
|
};
|
package/tailwind.config.js
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
class="ui-font-bold ui-align-middle ui-flex ui-rounded-md"
|
|
4
|
-
:class="classes"
|
|
5
|
-
@click="onClick()"
|
|
6
|
-
>
|
|
7
|
-
<i
|
|
8
|
-
v-if="icon"
|
|
9
|
-
class="ui-my-auto material-icons ui-mr-2"
|
|
10
|
-
:class="{ 'ui-text-sm': size === 'small' }"
|
|
11
|
-
>
|
|
12
|
-
{{ icon }}
|
|
13
|
-
</i>
|
|
14
|
-
<div class="ui-flex-grow ui-text-left">{{ label }}</div>
|
|
15
|
-
<i
|
|
16
|
-
v-if="iconRight" class="ui-my-auto material-icons ui-ml-2"
|
|
17
|
-
:class="{ 'ui-text-sm': size === 'small' }"
|
|
18
|
-
>
|
|
19
|
-
{{ iconRight }}
|
|
20
|
-
</i>
|
|
21
|
-
</button>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script>
|
|
25
|
-
export const sizes = ['big', 'medium', 'small']
|
|
26
|
-
export default {
|
|
27
|
-
props: {
|
|
28
|
-
label: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
outline: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
},
|
|
36
|
-
ghost: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false
|
|
39
|
-
},
|
|
40
|
-
textOnly: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false
|
|
43
|
-
},
|
|
44
|
-
icon: {
|
|
45
|
-
type: String,
|
|
46
|
-
},
|
|
47
|
-
iconRight: {
|
|
48
|
-
type: String,
|
|
49
|
-
},
|
|
50
|
-
size: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: 'big',
|
|
53
|
-
validator: (value) => sizes.indexOf(value) !== -1
|
|
54
|
-
},
|
|
55
|
-
disabled: {
|
|
56
|
-
type: [Boolean, String]
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
data () {
|
|
60
|
-
return {
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
computed: {
|
|
64
|
-
classes() {
|
|
65
|
-
let sizeCss = 'ui-px-4 ui-py-2'
|
|
66
|
-
if (this.size === 'medium') sizeCss = 'ui-px-4 ui-py-1'
|
|
67
|
-
if (this.size === 'small') sizeCss = 'ui-px-2 ui-py-ui-px ui-text-sm'
|
|
68
|
-
if (this.outline) return `${sizeCss} ui-bg-white ui-border ${this.disabled ? 'ui-border-gray-40 ui-text-gray-40' : 'ui-border-blue-60 ui-text-blue-60'}`
|
|
69
|
-
if (this.ghost) return `${sizeCss} ${this.disabled ? 'ui-bg-gray-20 ui-text-gray-40' : 'ui-bg-blue-20 ui-text-blue-60 active:ui-shadow-inner'}`
|
|
70
|
-
if (this.textOnly) return `${sizeCss} ${this.disabled ? 'ui-text-gray-40' : 'ui-text-blue-60'}`
|
|
71
|
-
if (this.disabled) return `${sizeCss} ui-bg-gray-20 ui-text-gray-40`
|
|
72
|
-
return `${sizeCss} ui-bg-blue-60 hover:ui-bg-blue-50 ui-text-white active:ui-shadow-inner`
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
methods: {
|
|
76
|
-
onClick() {
|
|
77
|
-
if (this.disabled) return false
|
|
78
|
-
this.$emit('click');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
</script>
|