@policystudio/policy-studio-ui-vue 1.0.25 → 1.0.29

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 (71) hide show
  1. package/dist/css/psui_styles.css +5030 -573
  2. package/package.json +1 -1
  3. package/src/assets/scss/base.scss +39 -3
  4. package/src/assets/scss/components/PsButton.scss +114 -120
  5. package/src/assets/scss/components/PsCardInfos.scss +26 -0
  6. package/src/assets/scss/components/PsChartLegend.scss +25 -0
  7. package/src/assets/scss/components/PsCheckbox.scss +96 -0
  8. package/src/assets/scss/components/PsChips.scss +155 -0
  9. package/src/assets/scss/components/PsClimateZoneBadge.scss +26 -0
  10. package/src/assets/scss/components/PsCostEffectBar.scss +31 -0
  11. package/src/assets/scss/components/PsDataTable.scss +50 -0
  12. package/src/assets/scss/components/PsDialog.scss +10 -1
  13. package/src/assets/scss/components/PsDropdown.scss +44 -0
  14. package/src/assets/scss/components/PsHighlightRippleDot.scss +48 -0
  15. package/src/assets/scss/components/PsInlineSelector.scss +81 -0
  16. package/src/assets/scss/components/PsInputSelect.scss +104 -0
  17. package/src/assets/scss/components/PsInputTextArea.scss +49 -0
  18. package/src/assets/scss/components/PsMiniTag.scss +36 -0
  19. package/src/assets/scss/components/PsProgressBar.scss +24 -0
  20. package/src/assets/scss/components/PsRadioButton.scss +78 -0
  21. package/src/assets/scss/components/PsSlider.scss +11 -0
  22. package/src/assets/scss/components/PsSwitch.scss +66 -0
  23. package/src/assets/scss/components/PsTabHeader.scss +10 -3
  24. package/src/assets/scss/components/PsToast.scss +52 -0
  25. package/src/assets/scss/components/PsToggle.scss +23 -0
  26. package/src/assets/scss/components/PsTooltip.scss +118 -0
  27. package/src/components/badges-and-tags/PsCardInfos.vue +14 -7
  28. package/src/components/badges-and-tags/PsChartLegend.vue +7 -13
  29. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +15 -6
  30. package/src/components/badges-and-tags/PsCostEffectBar.vue +32 -70
  31. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -69
  32. package/src/components/badges-and-tags/PsMiniTag.vue +15 -24
  33. package/src/components/badges-and-tags/PsProgressBar.vue +42 -0
  34. package/src/components/buttons/PsButton.vue +74 -78
  35. package/src/components/chips/PsChips.vue +46 -87
  36. package/src/components/controls/PsCheckbox.vue +58 -134
  37. package/src/components/controls/PsInlineSelector.vue +135 -0
  38. package/src/components/controls/PsRadioButton.vue +33 -88
  39. package/src/components/controls/PsSlider.vue +4 -5
  40. package/src/components/controls/PsSwitch.vue +29 -81
  41. package/src/components/controls/PsToggle.vue +45 -39
  42. package/src/components/datatable/PsDataTable.vue +3 -15
  43. package/src/components/forms/PsDropdown.vue +27 -11
  44. package/src/components/forms/PsDropdownCopy.vue +212 -0
  45. package/src/components/forms/PsInputSelect.vue +88 -0
  46. package/src/components/forms/PsInputTextArea.vue +80 -0
  47. package/src/components/notifications/PsDialog.vue +3 -0
  48. package/src/components/notifications/PsToast.vue +16 -28
  49. package/src/components/tabs/PsTabHeader.vue +30 -12
  50. package/src/components/tooltip/PsDialogTooltip.vue +6 -31
  51. package/src/components/tooltip/PsRichTooltip.vue +37 -44
  52. package/src/components/tooltip/PsTooltip.vue +18 -28
  53. package/src/components/ui/PsIcon.vue +9 -9
  54. package/src/index.js +9 -0
  55. package/src/stories/Button.stories.js +102 -112
  56. package/src/stories/Checkbox.stories.js +34 -37
  57. package/src/stories/Chips.stories.js +43 -54
  58. package/src/stories/ClimateZoneBadge.stories.js +0 -7
  59. package/src/stories/Dialog.stories.js +1 -1
  60. package/src/stories/InlineSelector.stories.js +18 -0
  61. package/src/stories/InputSelect.stories.js +30 -0
  62. package/src/stories/InputTextArea.stories.js +25 -0
  63. package/src/stories/MiniTag.stories.js +12 -6
  64. package/src/stories/RadioButton.stories.js +32 -29
  65. package/src/stories/Switch.stories.js +33 -0
  66. package/src/stories/Toast.stories.js +40 -46
  67. package/src/stories/Tooltip.stories.js +86 -86
  68. package/tailwind.config.js +7 -1
  69. package/src/assets/images/check-checkbox-button.svg +0 -1
  70. package/src/assets/images/radio-checked-button.svg +0 -1
  71. package/src/stories/Swith.stories.js +0 -38
@@ -1,78 +1,74 @@
1
- <template>
2
- <button
3
- @click="onClick()"
4
- @mouseenter="onMouseEnter"
5
- @mouseleave="onMouseLeave"
6
- class='psui-el-button'
7
- :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled}]"
8
- >
9
- <i v-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
10
- <span v-if="label">{{ label }}</span>
11
- </button>
12
- </template>
13
-
14
- <script>
15
- export default {
16
- props: {
17
- label: {
18
- type: String,
19
- },
20
- layout: {
21
- type: String,
22
- default: 'solid',
23
- validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
24
- },
25
- icon: {
26
- type: String,
27
- },
28
- iconPosition:{
29
- type: String,
30
- default: 'left',
31
- validator: (value) => ['left','right'].includes(value)
32
- },
33
- size: {
34
- type: String,
35
- default: 'big',
36
- validator: (value) => ['small','medium','big','custom'].includes(value)
37
- },
38
- disabled: {
39
- type: Boolean,
40
- default: false
41
- },
42
- iconClass:{
43
- type: String
44
- }
45
- },
46
- data(){
47
- return {
48
- isHover: false,
49
- }
50
- },
51
- computed: {
52
- getComponentClass(){
53
- if (this.size != 'custom') {
54
- return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
55
- } else {
56
- return `layout-${this.layout} icon-${this.iconPosition}`
57
- }
58
- }
59
- },
60
- methods: {
61
- onClick() {
62
- if (this.disabled) return
63
- this.$emit('click')
64
- },
65
- onMouseEnter(){
66
- if(!this.disabled){
67
- this.isHover = true
68
- }
69
- },
70
- onMouseLeave(){
71
- if(!this.disabled){
72
- this.isHover = false
73
- }
74
- }
75
- }
76
- }
77
- </script>
78
-
1
+ <template>
2
+ <button
3
+ @click="onClick()"
4
+ @mouseenter="onMouseEnter"
5
+ @mouseleave="onMouseLeave"
6
+ class='psui-el-button'
7
+ :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled}]"
8
+ >
9
+ <i v-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
10
+ <span v-if="label">{{ label }}</span>
11
+ </button>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ props: {
17
+ label: {
18
+ type: String,
19
+ },
20
+ layout: {
21
+ type: String,
22
+ default: 'solid',
23
+ validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
24
+ },
25
+ icon: {
26
+ type: String,
27
+ },
28
+ iconPosition:{
29
+ type: String,
30
+ default: 'left',
31
+ validator: (value) => ['left','right'].includes(value)
32
+ },
33
+ size: {
34
+ type: String,
35
+ default: 'big',
36
+ validator: (value) => ['small','medium','big'].includes(value)
37
+ },
38
+ disabled: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ iconClass:{
43
+ type: String
44
+ }
45
+ },
46
+ data(){
47
+ return {
48
+ isHover: false,
49
+ }
50
+ },
51
+ computed: {
52
+ getComponentClass(){
53
+ return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
54
+ }
55
+ },
56
+ methods: {
57
+ onClick() {
58
+ if (this.disabled) return
59
+ this.$emit('click')
60
+ },
61
+ onMouseEnter(){
62
+ if(!this.disabled){
63
+ this.isHover = true
64
+ }
65
+ },
66
+ onMouseLeave(){
67
+ if(!this.disabled){
68
+ this.isHover = false
69
+ }
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+
@@ -1,58 +1,68 @@
1
1
  <template>
2
- <label
3
- @click="onClick"
4
- :for="title"
5
- :class="getCssClass"
6
- class="
7
- psui-flex
8
- psui-gap-2
9
- psui-bg-gray-10
10
- psui-text-gray-50
11
- psui-px-2
12
- psui-py-1
13
- psui-rounded-md
14
- psui-items-center
15
- "
2
+ <div
3
+ class="psui-el-chips"
4
+ :class="[getComponentClass, `layout-${layout}`, `type-${type}`]"
16
5
  >
17
6
  <input
18
7
  @change="onChange"
19
- v-if="type !== 'text'"
8
+ v-if="type != 'button'"
20
9
  :type="type"
21
- :id="title"
10
+ :id="label"
22
11
  :checked="checked"
23
12
  />
24
- <i v-if="icon" class="material-icons">{{ icon }}</i>
25
- {{ title }}
26
- <button @click="onClose" v-if="rich" class="psui-flex psui-items-center">
27
- <i class="material-icons">close</i>
28
- </button>
29
- </label>
13
+ <label
14
+ @click="onClick"
15
+ :for="label"
16
+ :class="getCssClass"
17
+ >
18
+ <i v-if="icon" class="psui-el-chips-icon psui-el-chips-icon-prepend">{{ icon }}</i>
19
+ {{ label }}
20
+ {{ layout }}
21
+ <button
22
+ @click="onClose"
23
+ v-if="layout === 'rich'"
24
+ class="psui-el-chips-close"
25
+ >
26
+ <span class="psui-el-chips-icon">close</span>
27
+ </button>
28
+ </label>
29
+ </div>
30
30
  </template>
31
31
 
32
32
  <script>
33
- export const type = ["text", "radio", "checkbox", "button"]
33
+ export const type = ["radio", "checkbox", "button"]
34
34
 
35
35
  export default {
36
36
  name: "PsChips",
37
37
  props: {
38
- title: {
38
+ label: {
39
39
  type: String,
40
40
  default: "",
41
41
  },
42
42
  type: {
43
43
  type: String,
44
44
  required: true,
45
- validator: (type) => ["text", "radio", "checkbox", "button"].includes(type)
45
+ default: 'button',
46
+ validator: (type) => ["radio", "checkbox", "button"].includes(type)
47
+ },
48
+ layout: {
49
+ type: String,
50
+ default: 'simple',
51
+ validator: (value) => ['simple', 'with-icon', 'rich'].includes(value)
46
52
  },
47
53
  icon: {
48
54
  type: String,
49
55
  default: "",
50
56
  },
51
- rich: {
57
+ checked: {
52
58
  type: Boolean,
53
- default: false,
59
+ default: false
54
60
  },
55
- checked: {
61
+ disabled: {
62
+ type: Boolean,
63
+ default: false
64
+ },
65
+ active: {
56
66
  type: Boolean,
57
67
  default: false
58
68
  },
@@ -64,6 +74,13 @@ export default {
64
74
  }
65
75
  },
66
76
  computed: {
77
+ getComponentClass() {
78
+ if (this.disabled) {
79
+ return 'status-disabled'
80
+ } else {
81
+ return 'status-resting'
82
+ }
83
+ },
67
84
  getCssClass() {
68
85
  let cssClass = ''
69
86
 
@@ -93,62 +110,4 @@ export default {
93
110
  }
94
111
  </script>
95
112
 
96
- <style scoped>
97
- input[type="radio"] {
98
- -webkit-appearance: none;
99
- -moz-appearance: none;
100
- appearance: none;
101
-
102
- display: inline-block;
103
- width: 16px;
104
- height: 16px;
105
- border-radius: 50%;
106
- border: 1px solid #d6dde5;
107
- cursor: pointer;
108
- }
109
-
110
- input[type="checkbox"] {
111
- -webkit-appearance: none;
112
- -moz-appearance: none;
113
- appearance: none;
114
-
115
- display: inline-block;
116
- width: 16px;
117
- height: 16px;
118
- border-radius: 25%;
119
- border: 1px solid #d6dde5;
120
- cursor: pointer;
121
- }
122
-
123
- input[type="radio"]:hover,
124
- input[type="checkbox"]:hover {
125
- border-color: #64b5ce;
126
- }
127
-
128
- input[type="radio"]:checked {
129
- border-color: #64b5ce;
130
- background: url("../../assets/images/radio-checked-button.svg") #ffffff
131
- no-repeat center;
132
- }
133
-
134
- input[type="checkbox"]:checked {
135
- border-color: #64b5ce;
136
- background: url("../../assets/images/check-checkbox-button.svg") #64b5ce
137
- no-repeat center;
138
- }
139
-
140
- label {
141
- width: fit-content;
142
- cursor: pointer;
143
- }
144
-
145
- label:hover {
146
- color: #64b5ce;
147
- background: #ffffff;
148
- }
149
-
150
- button {
151
- outline: none;
152
- }
153
- </style>
154
-
113
+ <style> /* Please, use the file src/assets/scss/components/PsChips.scss */</style>
@@ -1,134 +1,58 @@
1
- <template>
2
- <label
3
- class="container psui-pl-6"
4
- :class="[
5
- { 'psui-text-gray-40': disabled },
6
- { 'psui-text-gray-50': !disabled },
7
- labelClasses,
8
- ]"
9
- >
10
- {{ label }}
11
- <input
12
- type="checkbox"
13
- v-model="model"
14
- :disabled="disabled"
15
- :value="inputValue"
16
- />
17
- <span
18
- class="checkmark psui-border-2"
19
- :class="classes"
20
- :style="getSize"
21
- ></span>
22
- </label>
23
- </template>
24
-
25
- <script>
26
- export default {
27
- name: 'PsCheckbox',
28
- props: {
29
- value: {
30
- required: true,
31
- },
32
- inputValue: String,
33
- label: {
34
- type: String,
35
- default: '',
36
- },
37
- checkboxClasses: {
38
- type: String,
39
- default: '',
40
- },
41
- labelClasses: {
42
- type: String,
43
- default: '',
44
- },
45
- disabled: {
46
- type: Boolean,
47
- default: false,
48
- },
49
- size: {
50
- default: 18,
51
- },
52
- },
53
- computed: {
54
- model: {
55
- get() {
56
- return this.value
57
- },
58
- set(newValue) {
59
- this.$emit('input', newValue)
60
- this.$emit('change', newValue)
61
- },
62
- },
63
- classes() {
64
- return `${
65
- this.disabled ? 'psui-border-gray-40' : 'psui-border-gray-50'
66
- } ${this.checkboxClasses}`
67
- },
68
- getSize() {
69
- return {
70
- width: `${this.size}px`,
71
- height: `${this.size}px`,
72
- }
73
- },
74
- },
75
- }
76
- </script>
77
-
78
- <style scoped>
79
- .container {
80
- display: block;
81
- position: relative;
82
- cursor: pointer;
83
- -webkit-user-select: none;
84
- -moz-user-select: none;
85
- -ms-user-select: none;
86
- user-select: none;
87
- }
88
-
89
- .container input {
90
- position: absolute;
91
- opacity: 0;
92
- cursor: pointer;
93
- height: 0;
94
- width: 0;
95
- }
96
-
97
- .checkmark {
98
- position: absolute;
99
- top: 0;
100
- left: 0;
101
- height: 18px;
102
- width: 18px;
103
- background-color: #fff;
104
- border-radius: 2px;
105
- }
106
-
107
- .container input:checked ~ .checkmark {
108
- background-color: #64b5ce;
109
- border: none;
110
- }
111
-
112
- .checkmark:after {
113
- content: '';
114
- position: absolute;
115
- display: none;
116
- }
117
-
118
- .container input:checked ~ .checkmark:after {
119
- display: block;
120
- }
121
-
122
- .container .checkmark:after {
123
- left: 35%;
124
- top: 8%;
125
- width: 35%;
126
- height: 65%;
127
- border: solid white;
128
- border-radius: 1px;
129
- border-width: 0 2px 2px 0;
130
- -webkit-transform: rotate(45deg);
131
- -ms-transform: rotate(45deg);
132
- transform: rotate(45deg);
133
- }
134
- </style>
1
+ <template>
2
+ <div class='psui-el-checkbox' :class="[getComponentClass, {'disabled':disabled}]" >
3
+ <input
4
+ :id="label"
5
+ type="checkbox"
6
+ :value="label"
7
+ @change="onChange"
8
+ :checked="checked"
9
+ :disabled='disabled'
10
+ />
11
+ <label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
17
+
18
+ export default {
19
+ name: 'PsCheckbox',
20
+ props: {
21
+ label: {
22
+ type: String,
23
+ default: '',
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ size: {
30
+ type: String,
31
+ default: 'big',
32
+ validator: (value)=> ['big', 'small'].includes(value)
33
+ },
34
+ checked:{
35
+ type: Boolean,
36
+ },
37
+ layout:{
38
+ type: String,
39
+ default: 'default',
40
+ validator: (value)=> ['default','mixed'].includes(value)
41
+ }
42
+ },
43
+ emits:['@update:checked', 'value'],
44
+ computed:{
45
+ getComponentClass(){
46
+ return `size-${this.size} layout-${this.layout}`
47
+ }
48
+ },
49
+ methods:{
50
+ onChange(event){
51
+ if(!this.disabled){
52
+ this.$emit('value', event.target.value)
53
+ this.$emit('update:checked', event.target.checked)
54
+ }
55
+ }
56
+ },
57
+ }
58
+ </script>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div
3
+ class="psui-el-inline-selector"
4
+ @keydown.up="$emit('keydown-up', $event)"
5
+ @keydown.down="$emit('keydown-down', $event)"
6
+ @keydown.enter="$emit('keydown-enter', $event)"
7
+ @keydown.tab="$emit('keydown-tab',$event)"
8
+ @keydown.esc="$emit('keydown-esc',$event)"
9
+ @mouseleave="$emit('mouse-leave',$event)"
10
+ >
11
+
12
+ <div class='psui-el-inline-selector-input-wrapper'>
13
+ <span> {{ search ? search : placeholder }} </span>
14
+ <input
15
+ ref="input"
16
+ v-model="search"
17
+ :label="label"
18
+ :placeholder="placeholder"
19
+ @input="$emit('input', $event)"
20
+ @focus="$emit('focus', $event)"
21
+ @blur="$emit('blur', $event)"
22
+ autocomplete="chrome-off"
23
+ autocorrect="off"
24
+ autocapitalize="off"
25
+ spellcheck="false"
26
+ />
27
+ </div>
28
+ <transition
29
+ enter-active-class="transition ease-out duration-100 transform"
30
+ enter-class="opacity-0 scale-95"
31
+ enter-to-class="opacity-100 scale-100"
32
+ leave-active-class="transition ease-in duration-100 transform"
33
+ leave-class="opacity-100 scale-100"
34
+ leave-to-class="opacity-0 scale-95"
35
+ >
36
+ <div
37
+ v-if="search"
38
+ role="menu"
39
+ aria-orientation="vertical"
40
+ class="psui-el-inline-selector-dropdown-wrapper"
41
+ >
42
+ <slot name='loader'></slot>
43
+ <div>
44
+ <div v-if="requestFetched && !jurisdictions.length">
45
+ <h3>Hmmmm</h3>
46
+ <p>Please check the spelling and try again</p>
47
+ </div>
48
+ <ul v-else>
49
+ <li
50
+ tabindex="0"
51
+ v-for="(jurisdiction, index) in jurisdictions"
52
+ :key="`dropdown-jurisdiction-${jurisdiction.id}`"
53
+ :id="`jurisdiction-list-item-${index}`"
54
+ @click="$emit('click', $event)"
55
+ @mouseover="('mouse-over', $event)"
56
+ >
57
+ <span >
58
+ <h3>{{jurisdiction.title}}</h3>
59
+ <h3 >{{jurisdiction.type}}</h3>
60
+ </span>
61
+ </li>
62
+ </ul>
63
+ </div>
64
+ </div>
65
+ </transition>
66
+ </div>
67
+ </template>
68
+
69
+ <script>
70
+ export default {
71
+ name: 'PsInlineSelector',
72
+ props: {
73
+ width: {
74
+ default: 244
75
+ },
76
+ focusOnMount: {
77
+ default: false
78
+ },
79
+ shouldScroll: {
80
+ default: false
81
+ },
82
+ inputClass: {
83
+ default: 'text-gray02'
84
+ },
85
+ label: {
86
+ type: String,
87
+ default: 'Type a City or County'
88
+ },
89
+ selectOnlyFirstClimateZone: {
90
+ type: Boolean,
91
+ default: false
92
+ },
93
+ jurisdictionSelected: {
94
+ type: [ Object, Boolean ]
95
+ },
96
+ search: {
97
+ type: String,
98
+ default: '',
99
+ required: true
100
+ },
101
+ jurisdictions: {
102
+ type: Array,
103
+ default: () => [],
104
+ required: true
105
+ },
106
+ requestFetched: {
107
+ type: Boolean,
108
+ },
109
+ showDropDown:{
110
+ type: Boolean,
111
+ default: true,
112
+ },
113
+ currentSelected:{
114
+ type: Number,
115
+ default: 0,
116
+ },
117
+ isFocused:{
118
+ type: Boolean,
119
+ default: false,
120
+ }
121
+ },
122
+ computed:{
123
+ placeholder(){
124
+ return this.jurisdictionsAsText && !this.isFocused ? this.jurisdictionsAsText : this.label
125
+ },
126
+ jurisdictionsAsText(){
127
+ return this.jurisdictionSelected?.title_type ?? false
128
+ }
129
+ },
130
+ mounted(){
131
+ if(this.focusOnMount) this.$refs.input.focus()
132
+ },
133
+ }
134
+ </script>
135
+