@policystudio/policy-studio-ui-vue 1.0.15 → 1.0.19
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/.eslintrc.js +68 -0
- package/.storybook/main.js +2 -1
- package/dist/css/psui_styles.css +70643 -0
- package/package.json +13 -9
- package/src/assets/images/check-checkbox-button.svg +1 -0
- package/src/assets/images/radio-checked-button.svg +1 -0
- package/src/assets/scss/base.scss +29 -2
- package/src/assets/scss/tailwind.css +2233 -2736
- package/src/components/accordion/PsAccordion.vue +36 -0
- package/src/components/accordion/PsAccordionItem.vue +102 -0
- package/src/components/buttons/PsButton.vue +6 -3
- package/src/components/chips/PsChips.vue +146 -0
- package/src/components/controls/PsCheckbox.vue +3 -3
- package/src/components/controls/PsRadioButton.vue +11 -35
- package/src/components/controls/PsSlider.vue +13 -12
- package/src/components/controls/PsSwitch.vue +20 -19
- package/src/components/datatable/PsDataTable.vue +93 -0
- package/src/components/datatable/PsDataTableItem.vue +57 -0
- package/src/components/forms/PsDropdown.vue +196 -0
- package/src/components/forms/PsInput.vue +10 -6
- package/src/components/tabs/PsTabHeader.vue +20 -21
- package/src/components/ui/PsIcon.vue +65 -0
- package/src/index.js +37 -22
- package/src/stories/Accordion.stories.js +35 -0
- package/src/stories/Checkbox.stories.js +15 -8
- package/src/stories/Chips.stories.js +49 -0
- package/src/stories/Colors.stories.mdx +36 -35
- package/src/stories/Datatable.stories.js +43 -0
- package/src/stories/Dropdown.stories.js +34 -0
- package/src/stories/Input.stories.js +1 -0
- package/src/stories/RadioButton.stories.js +21 -5
- package/src/stories/Swith.stories.js +2 -2
- package/src/stories/Toggle.stories.js +24 -0
- package/src/util/GeneralFunctions.js +23 -0
- package/tailwind.config.js +18 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import PsDataTable, { alignment } from '../components/datatable/PsDataTable.vue';
|
|
2
|
+
import PsDataTableItem from '../components/datatable/PsDataTableItem.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/DataTable',
|
|
6
|
+
component: PsDataTable,
|
|
7
|
+
subcomponents: { PsDataTableItem },
|
|
8
|
+
argTypes: {
|
|
9
|
+
align: { control: { type: 'select', options: alignment } },
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Template = (args, { argTypes }) => ({
|
|
14
|
+
props: Object.keys(argTypes),
|
|
15
|
+
components: {PsDataTable} ,
|
|
16
|
+
template: `<PsDataTable v-bind="$props" />`
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const RichTemplate = (args, { argTypes } ) => ({
|
|
20
|
+
props: Object.keys(argTypes),
|
|
21
|
+
components: {PsDataTable, PsDataTableItem},
|
|
22
|
+
template: `<PsDataTable v-bind="$props">
|
|
23
|
+
<PsDataTableItem v-bind="$props"/>
|
|
24
|
+
</PsDataTable>
|
|
25
|
+
`
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const Simple = Template.bind({});
|
|
30
|
+
Simple.args = {
|
|
31
|
+
header: ['year', 'month', 'sale'],
|
|
32
|
+
data: [{ year: '1992', month: '12', sale: '1000.00' }, { year: '1989', month: '02', sale: '1200.00' }],
|
|
33
|
+
footer: ['Footer 1', 'Footer 2', 'Footer 3'],
|
|
34
|
+
type: 'simple'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Rich = RichTemplate.bind({});
|
|
38
|
+
Rich.args = {
|
|
39
|
+
header: ['header 1', 'header 2', 'header 3'],
|
|
40
|
+
data:[[ [ 20, -3], [ 20, 2], [ 20, 2] ], { header4: { value: 20, delta: 2}, header5: { value: 20, delta: 2}, header6: { value: 20, delta: 2} }],
|
|
41
|
+
footer: ['Footer 1', 'Footer 2', 'Footer 3'],
|
|
42
|
+
type: 'rich'
|
|
43
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import PsDropdown from '../components/forms/PsDropdown.vue';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/Dropdown',
|
|
4
|
+
component: PsDropdown,
|
|
5
|
+
argTypes: {
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
props: Object.keys(argTypes),
|
|
11
|
+
components: { PsDropdown },
|
|
12
|
+
template: `
|
|
13
|
+
<div>
|
|
14
|
+
<PsDropdown
|
|
15
|
+
buttonClasses="psui-p-3 "
|
|
16
|
+
>
|
|
17
|
+
<template v-slot:dropdownTrigger>
|
|
18
|
+
<div>Custom Trigger</div>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-slot:items>
|
|
21
|
+
<ul>
|
|
22
|
+
<li>Small list of the drop down</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</template>
|
|
25
|
+
</PsDropdown>
|
|
26
|
+
</div>
|
|
27
|
+
`
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const CustomTrigger = Template.bind({});
|
|
31
|
+
CustomTrigger.args = {
|
|
32
|
+
title: 'Custom trigger'
|
|
33
|
+
};
|
|
34
|
+
|
|
@@ -9,13 +9,29 @@ export default {
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
10
|
props: Object.keys(argTypes),
|
|
11
11
|
components: { PsRadioButton },
|
|
12
|
+
data: () => {
|
|
13
|
+
return {
|
|
14
|
+
selectedValue: '',
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
changeValue(newValue) {
|
|
19
|
+
this.selectedValue = newValue
|
|
20
|
+
}
|
|
21
|
+
},
|
|
12
22
|
template: `
|
|
13
|
-
<
|
|
23
|
+
<div>
|
|
24
|
+
<div>
|
|
25
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 1" value="1" @change="changeValue" />
|
|
26
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 2" value="2" @change="changeValue" />
|
|
27
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 3" value="3" @change="changeValue" />
|
|
28
|
+
<div class="result">
|
|
29
|
+
Radio button selection: {{selectedValue}}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
14
33
|
`
|
|
15
34
|
});
|
|
16
35
|
|
|
17
36
|
export const Default = Template.bind({});
|
|
18
|
-
Default.args = {
|
|
19
|
-
label: 'Label'
|
|
20
|
-
};
|
|
21
|
-
|
|
37
|
+
Default.args = {};
|
|
@@ -25,14 +25,14 @@ const Template = (args, { argTypes }) => ({
|
|
|
25
25
|
export const Big = Template.bind({});
|
|
26
26
|
Big.args = {
|
|
27
27
|
size: 'big',
|
|
28
|
-
active:
|
|
28
|
+
active: true,
|
|
29
29
|
label: 'Switch Big',
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const Small = Template.bind({});
|
|
33
33
|
Small.args = {
|
|
34
34
|
size: 'small',
|
|
35
|
-
active:
|
|
35
|
+
active: true,
|
|
36
36
|
label: 'Switch Small',
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -20,3 +20,27 @@ Default.args = {
|
|
|
20
20
|
items: items,
|
|
21
21
|
selected: selected
|
|
22
22
|
};
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Hey Luciano!
|
|
27
|
+
* Adicionei este script aqui pois não entendi como criar uma story com script em MDX ou algo que rode geral, saca?
|
|
28
|
+
* Mas é uma função simples para copiar o HEX das cores...
|
|
29
|
+
* Se quiser dar uma melhorada nessa parte, fique a vontade meu chegado! TMJ
|
|
30
|
+
*/
|
|
31
|
+
window.addEventListener('click', (ev) => {
|
|
32
|
+
if(ev.target.classList.contains('click-to-copy')) {
|
|
33
|
+
copyText(ev.target.dataset.toCopy)
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function copyText(textToCopy) {
|
|
38
|
+
var myTemporaryInputElement = document.createElement("input")
|
|
39
|
+
myTemporaryInputElement.type = "text"
|
|
40
|
+
myTemporaryInputElement.value = textToCopy
|
|
41
|
+
document.body.appendChild(myTemporaryInputElement)
|
|
42
|
+
myTemporaryInputElement.select()
|
|
43
|
+
document.execCommand("Copy")
|
|
44
|
+
document.body.removeChild(myTemporaryInputElement)
|
|
45
|
+
alert('Item copied to clipboard!')
|
|
46
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const randomString = (length) => {
|
|
2
|
+
var result = '';
|
|
3
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
4
|
+
var charactersLength = characters.length;
|
|
5
|
+
for ( var i = 0; i < length; i++ ) {
|
|
6
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
7
|
+
}
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const getParentScrollableEl = (node) => {
|
|
12
|
+
|
|
13
|
+
if (node == null) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (node.scrollHeight > node.clientHeight) {
|
|
18
|
+
return node;
|
|
19
|
+
} else {
|
|
20
|
+
return getParentScrollableEl(node.parentNode);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
package/tailwind.config.js
CHANGED
|
@@ -75,14 +75,28 @@ module.exports = {
|
|
|
75
75
|
xl: '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
|
|
76
76
|
inner: '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
|
|
77
77
|
none: 'none',
|
|
78
|
-
},
|
|
79
|
-
|
|
78
|
+
},
|
|
79
|
+
borderColor: theme => ({
|
|
80
|
+
...theme('colors'),
|
|
81
|
+
DEFAULT: theme('colors.blue-70', 'currentColor'),
|
|
82
|
+
}),
|
|
83
|
+
divideColor: theme => ({
|
|
84
|
+
...theme('colors'),
|
|
85
|
+
}),
|
|
86
|
+
extend: {
|
|
87
|
+
divideOpacity: {
|
|
88
|
+
'10': '0.1',
|
|
89
|
+
'20': '0.2',
|
|
90
|
+
'95': '0.95',
|
|
91
|
+
}
|
|
92
|
+
},
|
|
80
93
|
},
|
|
81
94
|
variants: {
|
|
82
95
|
boxShadow: ['active'],
|
|
83
96
|
borderRadius: ['last', 'first'],
|
|
84
|
-
backgroundColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'even', 'first'],
|
|
85
|
-
textColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'first'],
|
|
97
|
+
backgroundColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'even', 'first', 'disabled'],
|
|
98
|
+
textColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'first', 'disabled'],
|
|
99
|
+
borderColor: ['disabled'],
|
|
86
100
|
extend: {
|
|
87
101
|
},
|
|
88
102
|
},
|