@policystudio/policy-studio-ui-vue 1.0.20 → 1.0.24

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.
Files changed (50) hide show
  1. package/.storybook/main.js +9 -1
  2. package/dist/css/psui_styles.css +15690 -14620
  3. package/package.json +8 -3
  4. package/postcss.config.js +2 -0
  5. package/src/assets/scss/base.scss +10 -3
  6. package/src/assets/scss/components/PsAccordion.scss +63 -0
  7. package/src/assets/scss/components/PsButton.scss +145 -0
  8. package/src/assets/scss/components/PsInput.scss +104 -0
  9. package/src/components/accordion/PsAccordion.vue +30 -29
  10. package/src/components/accordion/PsAccordionItem.vue +29 -67
  11. package/src/components/badges-and-tags/PsCardInfos.vue +38 -0
  12. package/src/components/badges-and-tags/PsChartLegend.vue +43 -0
  13. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +18 -0
  14. package/src/components/badges-and-tags/PsCostEffectBar.vue +114 -0
  15. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +78 -0
  16. package/src/components/badges-and-tags/PsMiniTag.vue +46 -0
  17. package/src/components/badges-and-tags/PsProgressBar.vue +0 -0
  18. package/src/components/buttons/PsButton.vue +42 -94
  19. package/src/components/chips/PsChips.vue +10 -20
  20. package/src/components/controls/PsCheckbox.vue +29 -16
  21. package/src/components/controls/PsDraggable.vue +171 -25
  22. package/src/components/controls/PsRadioButton.vue +25 -19
  23. package/src/components/controls/PsToggle.vue +1 -1
  24. package/src/components/forms/PsInput.vue +122 -102
  25. package/src/components/notifications/PsDialog.vue +37 -18
  26. package/src/components/tabs/PsTabHeader.vue +3 -2
  27. package/src/components/tooltip/PsRichTooltip.vue +6 -0
  28. package/src/components/tooltip/PsTooltip.vue +1 -3
  29. package/src/index.js +15 -9
  30. package/src/stories/Accordion.stories.js +88 -28
  31. package/src/stories/Button.stories.js +83 -35
  32. package/src/stories/CardInfos.stories.js +16 -0
  33. package/src/stories/ChartLegend.stories.js +16 -0
  34. package/src/stories/Chips.stories.js +7 -1
  35. package/src/stories/ClimateZoneBadge.stories.js +24 -0
  36. package/src/stories/Colors.stories.mdx +1 -1
  37. package/src/stories/CostEffectBar.stories.js +23 -0
  38. package/src/stories/Dialog.stories.js +141 -8
  39. package/src/stories/Draggable.stories.js +4 -6
  40. package/src/stories/Dropdown.stories.js +3 -5
  41. package/src/stories/HighlightRippleDot.stories.js +16 -0
  42. package/src/stories/Input.stories.js +61 -9
  43. package/src/stories/MiniTag.stories.js +46 -0
  44. package/src/stories/ProgressBar.stories.js +23 -0
  45. package/src/stories/RadioButton.stories.js +2 -2
  46. package/src/stories/Toggle.stories.js +7 -8
  47. package/src/stories/Tooltip.stories.js +5 -4
  48. package/src/util/GeneralFunctions.js +6 -7
  49. package/src/util/imageLoader.js +1 -1
  50. package/tailwind.config.js +71 -48
@@ -0,0 +1,16 @@
1
+ import PsHighlightRippleDot from '../components/badges-and-tags/PsHighlightRippleDot.vue'
2
+
3
+ export default {
4
+ title: 'Components/HighlightRippleDot',
5
+ component: PsHighlightRippleDot,
6
+ argTypes: {},
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { PsHighlightRippleDot },
12
+ template: '<PsHighlightRippleDot v-bind="$props" />',
13
+ })
14
+
15
+ export const HighlightRippleDot = Template.bind({})
16
+ HighlightRippleDot.args = {}
@@ -19,11 +19,66 @@ const TemplateDefault = (args, { argTypes }) => ({
19
19
  }
20
20
  }
21
21
  },
22
- template: `
23
- <div class="psui-p-8 psui-bg-gray-10">
24
- <PsInput v-bind="$props" />
25
- <PsInput v-bind="$props" class="psui-mt-8" :validator="validator" />
26
- </div>
22
+ template: `
23
+ <div class="psui-p-8 psui-bg-gray-10 psui-grid psui-grid-cols-3 psui-gap-6">
24
+
25
+ <div class="psui-col-span-3 psui-mt-8">
26
+ <h1 class="psui-font-bold psui-border-b psui-border-gray-30">PSInput Layout Default</h1>
27
+ </div>
28
+
29
+ <PsInput v-bind="{...$props, label: 'Resting with hint', placeholder: '', value: '' }" />
30
+ <PsInput label="Resting without hint" />
31
+ <PsInput label="Resting with Placeholder" placeholder="This is a placeholder" />
32
+
33
+ <PsInput v-bind="{...$props, label: 'Focus'}" />
34
+ <PsInput label="Typing" placeholder="Type to see the effect..." />
35
+ <PsInput v-bind="{...$props, label: 'Active', active: true }" />
36
+
37
+ <PsInput v-bind="{...$props, label: 'Error', hasError: true }" />
38
+ <PsInput v-bind="{...$props, label: 'Error with custom message', hasError: 'Format invalid' }" />
39
+ <PsInput v-bind="{...$props, label: 'Prepend / Append ' }" >
40
+ <template v-slot:append>
41
+ Append
42
+ </template>
43
+ <template v-slot:prepend>
44
+ Prepend
45
+ </template>
46
+ </PsInput>
47
+
48
+ <PsInput label="Disabled" :disabled="true" value="100,000" />
49
+ <PsInput v-bind="{...$props, label: 'Disabled without value', disabled: true, value: '', hint: false }" />
50
+ <PsInput v-bind="{...$props, label: 'Active/Disabled', disabled: true, active: true }" />
51
+
52
+
53
+
54
+ <div class="psui-col-span-3 psui-mt-8">
55
+ <h1 class="psui-font-bold psui-border-b psui-border-gray-30">PSInput Layout Mini</h1>
56
+ </div>
57
+
58
+ <PsInput layout="mini" label="Resting with hint" hint="This is a hint" value="1,653" />
59
+ <PsInput layout="mini" label="Resting without hint" />
60
+ <PsInput layout="mini" label="Resting with Placeholder" placeholder="This is a placeholder" />
61
+
62
+ <PsInput layout="mini" v-bind="{...$props, label: 'Focus'}" />
63
+ <PsInput layout="mini" label="Typing" placeholder="Type to see the effect..." />
64
+ <PsInput layout="mini" v-bind="{...$props, label: 'Active', active: true }" />
65
+
66
+ <PsInput layout="mini" v-bind="{...$props, label: 'Error', hasError: true }" />
67
+ <PsInput layout="mini" v-bind="{...$props, label: 'Error with custom message', hasError: 'Format invalid' }" />
68
+ <PsInput layout="mini" v-bind="{...$props, label: 'Prepend / Append ' }" >
69
+ <template v-slot:append>
70
+ Append
71
+ </template>
72
+ <template v-slot:prepend>
73
+ Prepend
74
+ </template>
75
+ </PsInput>
76
+
77
+ <PsInput layout="mini" label="Disabled" :disabled="true" value="100,000" />
78
+ <PsInput layout="mini" v-bind="{...$props, label: 'Disabled without value', disabled: true, value: '', hint: false }" />
79
+ <PsInput layout="mini" v-bind="{...$props, label: 'Active/Disabled', disabled: true, active: true }" />
80
+
81
+ </div>
27
82
  `
28
83
  })
29
84
 
@@ -56,12 +111,11 @@ const TemplateSlots = (args, { argTypes }) => ({
56
111
 
57
112
  export const InputText = TemplateDefault.bind({})
58
113
  InputText.args = {
59
- label: 'Label',
114
+ label: 'Input Text',
60
115
  placeholder: 'Placeholder',
61
116
  hint: 'Optional Assistive text',
62
117
  disabled: false,
63
118
  required: false,
64
- mini: false,
65
119
  value: 10,
66
120
  }
67
121
 
@@ -72,7 +126,6 @@ InputPassword.args = {
72
126
  hint: 'Optional Assistive text',
73
127
  disabled: false,
74
128
  required: false,
75
- mini: false,
76
129
  }
77
130
 
78
131
  export const InputSlots = TemplateSlots.bind({})
@@ -82,5 +135,4 @@ InputSlots.args = {
82
135
  hint: 'Optional Assistive text',
83
136
  disabled: false,
84
137
  required: false,
85
- mini: false,
86
138
  }
@@ -0,0 +1,46 @@
1
+ import PsMiniTag, {
2
+ typeOptions,
3
+ } from '../components/badges-and-tags/PsMiniTag.vue'
4
+
5
+ export default {
6
+ title: 'Components/MiniTag',
7
+ component: PsMiniTag,
8
+ argTypes: {
9
+ type: {
10
+ control: {
11
+ type: 'select',
12
+ options: typeOptions,
13
+ },
14
+ },
15
+ },
16
+ }
17
+
18
+ const Template = (args, { argTypes }) => ({
19
+ props: Object.keys(argTypes),
20
+ components: { PsMiniTag },
21
+ template: '<PsMiniTag v-bind="$props" />',
22
+ })
23
+
24
+ export const Informative = Template.bind({})
25
+ Informative.args = {
26
+ type: 'informative',
27
+ message: 'This is an info alert',
28
+ }
29
+
30
+ export const Success = Template.bind({})
31
+ Success.args = {
32
+ type: 'success',
33
+ message: 'This is a success alert',
34
+ }
35
+
36
+ export const Warning = Template.bind({})
37
+ Warning.args = {
38
+ type: 'warning',
39
+ message: 'This is a warning alert',
40
+ }
41
+
42
+ export const Error = Template.bind({})
43
+ Error.args = {
44
+ type: 'error',
45
+ message: 'This is an error alert',
46
+ }
@@ -0,0 +1,23 @@
1
+ import PsProgressBar from '../components/badges-and-tags/PsProgressBar.vue'
2
+
3
+ export default {
4
+ title: 'Components/ProgressBar',
5
+ component: PsProgressBar,
6
+ argTypes: {
7
+ value: {
8
+ control: { type: 'number', min: 0, max: 100 },
9
+ },
10
+ breakEven: {
11
+ control: { type: 'number', min: 0, max: 100 },
12
+ },
13
+ },
14
+ }
15
+
16
+ const Template = (args, { argTypes }) => ({
17
+ props: Object.keys(argTypes),
18
+ components: { PsProgressBar },
19
+ template: '<PsProgressBar v-bind="$props" />',
20
+ })
21
+
22
+ export const ProgressBar = Template.bind({})
23
+ ProgressBar.args = {}
@@ -25,7 +25,7 @@ const Template = (args, { argTypes }) => ({
25
25
  </div>
26
26
  </div>
27
27
  </div>
28
- `
28
+ `,
29
29
  })
30
30
 
31
31
  export const Default = Template.bind({})
@@ -33,5 +33,5 @@ Default.args = {}
33
33
 
34
34
  export const Small = Template.bind({})
35
35
  Small.args = {
36
- small: true
36
+ small: true,
37
37
  }
@@ -12,16 +12,15 @@ const Template = (args, { argTypes }) => ({
12
12
  components: { PsToggle },
13
13
  template: `
14
14
  <PsToggle v-bind="$props" :selected.sync="selected" />
15
- `
15
+ `,
16
16
  })
17
17
 
18
18
  export const Default = Template.bind({})
19
19
  Default.args = {
20
20
  items: items,
21
- selected: selected
21
+ selected: selected,
22
22
  }
23
23
 
24
-
25
24
  /**
26
25
  * Hey Luciano!
27
26
  * Adicionei este script aqui pois não entendi como criar uma story com script em MDX ou algo que rode geral, saca?
@@ -29,18 +28,18 @@ Default.args = {
29
28
  * Se quiser dar uma melhorada nessa parte, fique a vontade meu chegado! TMJ
30
29
  */
31
30
  window.addEventListener('click', (ev) => {
32
- if(ev.target.classList.contains('click-to-copy')) {
31
+ if (ev.target.classList.contains('click-to-copy')) {
33
32
  copyText(ev.target.dataset.toCopy)
34
33
  }
35
34
  })
36
35
 
37
- function copyText(textToCopy) {
38
- var myTemporaryInputElement = document.createElement("input")
39
- myTemporaryInputElement.type = "text"
36
+ function copyText(textToCopy) {
37
+ var myTemporaryInputElement = document.createElement('input')
38
+ myTemporaryInputElement.type = 'text'
40
39
  myTemporaryInputElement.value = textToCopy
41
40
  document.body.appendChild(myTemporaryInputElement)
42
41
  myTemporaryInputElement.select()
43
- document.execCommand("Copy")
42
+ document.execCommand('Copy')
44
43
  document.body.removeChild(myTemporaryInputElement)
45
44
  alert('Item copied to clipboard!')
46
45
  }
@@ -13,8 +13,8 @@ const TemplateDialog = (args, {argTypes}) => ({
13
13
  components: {PsDialogTooltip},
14
14
  template: `
15
15
  <div style='display: flex; justify-content: flex-end;'>
16
- <PsDialogTooltip v-bind='$props'>
17
- <p>Trigger</p>
16
+ <PsDialogTooltip v-bind='$props'>
17
+ <p>Trigger</p>
18
18
  </PsDialogTooltip>
19
19
  <div>
20
20
  `,
@@ -29,7 +29,7 @@ const TemplateRich = (args,{argTypes})=>({
29
29
  template: `
30
30
  <div style='display: flex; justify-content: flex-end;'>
31
31
  <PsRichTooltip v-bind='$props'>
32
- <p>Trigger</p>
32
+ <p>Trigger</p>
33
33
  </PsRichTooltip>
34
34
  </div>
35
35
  `
@@ -89,8 +89,9 @@ Dialog.args = {
89
89
 
90
90
  export const Rich = TemplateRich.bind({})
91
91
  Rich.args = {
92
- type: 'red',
92
+ type: 'blue',
93
93
  title: 'This is a test!!',
94
+ text: 'Here goes your text',
94
95
  cssClass: 'psui-w-32'
95
96
  }
96
97
 
@@ -1,15 +1,15 @@
1
1
  export const randomString = (length) => {
2
- var result = ''
3
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
2
+ var result = ''
3
+ var characters =
4
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
4
5
  var charactersLength = characters.length
5
- for ( var i = 0; i < length; i++ ) {
6
- result += characters.charAt(Math.floor(Math.random() * charactersLength))
6
+ for (var i = 0; i < length; i++) {
7
+ result += characters.charAt(Math.floor(Math.random() * charactersLength))
7
8
  }
8
9
  return result
9
10
  }
10
11
 
11
12
  export const getParentScrollableEl = (node) => {
12
-
13
13
  if (node == null) {
14
14
  return null
15
15
  }
@@ -19,5 +19,4 @@ export const getParentScrollableEl = (node) => {
19
19
  } else {
20
20
  return getParentScrollableEl(node.parentNode)
21
21
  }
22
-
23
- }
22
+ }
@@ -34,7 +34,7 @@ export default ({ imageUrl, onProgress = null, returnsBase64 = true }) => {
34
34
  var headers = xhr.getAllResponseHeaders()
35
35
  var mime = headers.match(/^Content-Type\\:\s*(.*?)$/mi)
36
36
  if (mime && mime[1]) options.type = mime[1]
37
- var blob = new Blob([this.response], options)
37
+ var blob = new Blob([xhr.response], options)
38
38
  resolve(window.URL.createObjectURL(blob))
39
39
  }
40
40
  }
@@ -15,41 +15,42 @@ module.exports = {
15
15
  'gray-80': '#28323B',
16
16
 
17
17
  'blue': '#5094D3',
18
- 'blue-10':'#ECF7FB',
19
- 'blue-20':'#E0EFF6',
20
- 'blue-50':'#64B5CE',
21
- 'blue-60':'#318FAC',
22
- 'blue-70':'#00465F',
23
- 'blue-80':'#002A3A',
18
+ 'blue-10': '#ECF7FB',
19
+ 'blue-20': '#E0EFF6',
20
+ 'blue-50': '#64B5CE',
21
+ 'blue-60': '#318FAC',
22
+ 'blue-70': '#00465F',
23
+ 'blue-80': '#002A3A',
24
24
 
25
- 'green-10':'#DEF8E8',
26
- 'green-20':'#5DB883',
27
- 'green-70':'#44A06A',
28
- 'green-80':'#286943',
25
+ 'green-10': '#DEF8E8',
26
+ 'green-20': '#5DB883',
27
+ 'green-70': '#44A06A',
28
+ 'green-80': '#286943',
29
29
 
30
- 'yellow-10':'#FDF3E3',
31
- 'yellow-20':'#EDAB3E',
32
- 'yellow-70':'#B87305',
33
- 'yellow-80':'#834C0D',
30
+ 'yellow-10': '#FDF3E3',
31
+ 'yellow-20': '#EDAB3E',
32
+ 'yellow-70': '#B87305',
33
+ 'yellow-80': '#834C0D',
34
34
 
35
- 'red-10':'#FCEBEB',
36
- 'red-20':'#D65C5A',
37
- 'red-70':'#AA3937',
38
- 'red-80':'#832F2E',
39
-
40
- 'sky': '#518BE2',
41
- 'teal': '#57C0BA',
42
- 'emerald': '#8CCA82',
43
- 'mustard': '#E9CF74',
44
- 'orange': '#FF906D',
45
- 'pink': '#FF77B8',
46
- 'purple': '#9278C9'
35
+ 'red-10': '#FCEBEB',
36
+ 'red-20': '#D65C5A',
37
+ 'red-70': '#AA3937',
38
+ 'red-80': '#832F2E',
39
+
40
+ sky: '#518BE2',
41
+ teal: '#57C0BA',
42
+ emerald: '#8CCA82',
43
+ mustard: '#E9CF74',
44
+ orange: '#FF906D',
45
+ pink: '#FF77B8',
46
+ purple: '#9278C9',
47
+ transparent: 'transparent',
47
48
  },
48
49
  fontFamily: {
49
- 'sans': ['Lato'],
50
+ sans: ['Lato'],
50
51
  },
51
52
  fontSize: {
52
- big:['16px','130%'],
53
+ big: ['16px', '130%'],
53
54
  small: ['14px', '130%'],
54
55
  xsmall: ['12px', '130%'],
55
56
  accent: ['14px', '130%', { letterSpacing: '0.6px' }],
@@ -61,46 +62,68 @@ module.exports = {
61
62
  h4: ['20px', '120%'],
62
63
  h5: ['18px', '120%'],
63
64
  h6: ['17px', '120%'],
64
- },
65
+ },
65
66
  boxShadow: {
66
- 'elevation--5': '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
67
- 'elevation-5': '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
68
- 'elevation-10': '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
69
- 'elevation-20': '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
70
- 'elevation-30': '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
71
- 'elevation-40': '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
67
+ 'elevation--5':
68
+ '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
69
+ 'elevation-5':
70
+ '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
71
+ 'elevation-10':
72
+ '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
73
+ 'elevation-20':
74
+ '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
75
+ 'elevation-30':
76
+ '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
77
+ 'elevation-40':
78
+ '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
72
79
  sm: '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
73
- default: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
80
+ default:
81
+ '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
74
82
  md: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
75
83
  lg: '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
76
84
  xl: '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
77
85
  inner: '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
78
86
  none: 'none',
79
87
  },
80
- borderColor: theme => ({
88
+ borderColor: (theme) => ({
81
89
  ...theme('colors'),
82
90
  DEFAULT: theme('colors.blue-70', 'currentColor'),
83
91
  }),
84
- divideColor: theme => ({
92
+ divideColor: (theme) => ({
85
93
  ...theme('colors'),
86
94
  }),
87
95
  extend: {
88
96
  divideOpacity: {
89
- '10': '0.1',
90
- '20': '0.2',
91
- '95': '0.95',
92
- }
97
+ 10: '0.1',
98
+ 20: '0.2',
99
+ 95: '0.95',
100
+ },
93
101
  },
94
102
  },
95
103
  variants: {
96
104
  boxShadow: ['active'],
97
105
  borderRadius: ['last', 'first'],
98
- backgroundColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'even', 'first', 'disabled'],
99
- textColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'first', 'disabled'],
106
+ backgroundColor: [
107
+ 'responsive',
108
+ 'hover',
109
+ 'active',
110
+ 'focus',
111
+ 'group-hover',
112
+ 'even',
113
+ 'first',
114
+ 'disabled',
115
+ ],
116
+ textColor: [
117
+ 'responsive',
118
+ 'hover',
119
+ 'active',
120
+ 'focus',
121
+ 'group-hover',
122
+ 'first',
123
+ 'disabled',
124
+ ],
100
125
  borderColor: ['disabled'],
101
- extend: {
102
- },
126
+ extend: {},
103
127
  },
104
- plugins: [
105
- ],
128
+ plugins: [],
106
129
  }