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

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 (51) hide show
  1. package/.eslintrc.js +67 -0
  2. package/.storybook/main.js +2 -1
  3. package/.storybook/preview.js +1 -1
  4. package/README.md +8 -0
  5. package/babel.config.js +3 -0
  6. package/backup-package-lock.json +37194 -0
  7. package/{src/assets/scss/tailwind.css → dist/css/psui_styles.css} +2213 -2735
  8. package/package.json +29 -19
  9. package/src/assets/images/check-checkbox-button.svg +1 -0
  10. package/src/assets/images/radio-checked-button.svg +1 -0
  11. package/src/assets/scss/base.scss +1 -1
  12. package/src/components/accordion/PsAccordion.vue +44 -0
  13. package/src/components/accordion/PsAccordionItem.vue +102 -0
  14. package/src/components/buttons/PsButton.vue +36 -13
  15. package/src/components/chips/PsChips.vue +164 -0
  16. package/src/components/controls/PsCheckbox.vue +3 -3
  17. package/src/components/controls/PsDraggable.vue +27 -2
  18. package/src/components/controls/PsRadioButton.vue +58 -57
  19. package/src/components/controls/PsSlider.vue +13 -12
  20. package/src/components/controls/PsSwitch.vue +76 -76
  21. package/src/components/datatable/PsDataTable.vue +89 -0
  22. package/src/components/datatable/PsDataTableItem.vue +57 -0
  23. package/src/components/forms/PsDropdown.vue +196 -0
  24. package/src/components/forms/PsInput.vue +9 -6
  25. package/src/components/tabs/PsTabHeader.vue +20 -21
  26. package/src/components/tooltip/PsDialogTooltip.vue +79 -0
  27. package/src/components/tooltip/PsRichTooltip.vue +38 -0
  28. package/src/components/tooltip/PsTooltip.vue +120 -0
  29. package/src/components/ui/PsIcon.vue +128 -0
  30. package/src/index.js +51 -22
  31. package/src/stories/Accordion.stories.js +35 -0
  32. package/src/stories/Button.stories.js +11 -11
  33. package/src/stories/Checkbox.stories.js +21 -14
  34. package/src/stories/Chips.stories.js +49 -0
  35. package/src/stories/Colors.stories.mdx +36 -35
  36. package/src/stories/Datatable.stories.js +50 -0
  37. package/src/stories/Dialog.stories.js +9 -9
  38. package/src/stories/Draggable.stories.js +24 -0
  39. package/src/stories/Dropdown.stories.js +34 -0
  40. package/src/stories/Input.stories.js +10 -10
  41. package/src/stories/RadioButton.stories.js +24 -8
  42. package/src/stories/Slider.stories.js +9 -9
  43. package/src/stories/Swith.stories.js +10 -10
  44. package/src/stories/TabHeader.stories.js +9 -9
  45. package/src/stories/Toast.stories.js +13 -13
  46. package/src/stories/Toggle.stories.js +29 -5
  47. package/src/stories/Tooltip.stories.js +113 -0
  48. package/src/util/GeneralFunctions.js +23 -0
  49. package/src/util/imageLoader.js +50 -0
  50. package/tailwind.config.js +19 -4
  51. package/src/assets/scss/tailwind.scss +0 -61088
package/package.json CHANGED
@@ -1,36 +1,46 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.0.16",
3
+ "version": "1.0.20",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
7
7
  "url": "https://bitbucket.org/policy-studio/policy-studio-ui-vue",
8
- "scripts": {
9
- "storybook": "start-storybook -p 6006",
10
- "build-storybook": "build-storybook",
11
- "build:tailwind": "postcss src/assets/scss/base.scss -o src/assets/scss/tailwind.css",
12
- "publish": "npm run build:tailwind && npm publish"
13
- },
8
+ "license": "MIT",
14
9
  "keywords": [
15
10
  "vue",
16
11
  "ui"
17
12
  ],
18
- "license": "MIT",
13
+ "scripts": {
14
+ "lint": "vue-cli-service lint",
15
+ "storybook": "start-storybook -p 6006",
16
+ "build-storybook": "build-storybook",
17
+ "build-tailwind": "postcss src/assets/scss/base.scss -o dist/css/psui_styles.css",
18
+ "publish": "npm run lint && npm run build-tailwind && npm publish"
19
+ },
20
+ "dependencies": {
21
+ "core-js": "^3.6.5",
22
+ "vue": "^2.6.11"
23
+ },
19
24
  "devDependencies": {
20
- "@babel/core": "^7.16.0",
21
- "@storybook/addon-actions": "^6.3.12",
22
- "@storybook/addon-essentials": "^6.3.12",
23
- "@storybook/addon-links": "^6.3.12",
24
- "@storybook/vue": "^6.3.12",
25
- "autoprefixer": "^10.4.0",
25
+ "@babel/core": "^7.16.7",
26
+ "@storybook/addon-actions": "^6.4.13",
27
+ "@storybook/addon-essentials": "^6.4.13",
28
+ "@storybook/addon-links": "^6.4.13",
29
+ "@storybook/vue": "^6.4.13",
30
+ "@vue/cli-plugin-babel": "~4.5.0",
31
+ "@vue/cli-plugin-eslint": "~4.5.0",
32
+ "@vue/cli-service": "~4.5.0",
33
+ "@vue/eslint-config-prettier": "^6.0.0",
34
+ "babel-eslint": "^10.1.0",
26
35
  "babel-loader": "^8.2.3",
36
+ "eslint": "^6.7.2",
37
+ "eslint-plugin-prettier": "^3.3.1",
38
+ "eslint-plugin-vue": "^6.2.2",
27
39
  "postcss": "^8.3.11",
28
40
  "postcss-cli": "^9.0.2",
41
+ "prettier": "^2.2.1",
29
42
  "tailwindcss": "^1.9.6",
30
- "vue": "^2.6.14",
31
43
  "vue-loader": "^15.9.8",
32
- "vue-router": "^3.5.3",
33
- "vue-template-compiler": "^2.6.14"
34
- },
35
- "dependencies": {}
44
+ "vue-template-compiler": "^2.6.11"
45
+ }
36
46
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 24 24" width="16px" fill="#ffffff"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#64b5ce"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><circle cx="12" cy="12" r="5"/></svg>
@@ -1,7 +1,7 @@
1
1
  @tailwind base;
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
- @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
4
+ @import url('https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round');
5
5
 
6
6
  *:focus {
7
7
  outline: none;
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div :class="classes" class='accordion' >
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export const sizes = ['big', 'medium']
9
+
10
+ export default {
11
+ name:"PsAccordion",
12
+ props: {
13
+ size:{
14
+ type: String,
15
+ default: 'medium',
16
+ required: true
17
+ }
18
+ },
19
+ computed:{
20
+ classes(){
21
+ if( this.size === 'big') return 'big'
22
+ return 'medium'
23
+ }
24
+ }
25
+
26
+ }
27
+ </script>
28
+ <style scoped>
29
+ .medium {
30
+ width: 390px;
31
+ }
32
+
33
+ .big {
34
+ width: 580px;
35
+ }
36
+
37
+ .accordion {
38
+ display: flex;
39
+ flex-direction: column;
40
+ border-right:1px solid #e6ecf2;
41
+ border-left:1px solid #e6ecf2;
42
+ border-top:1px solid #e6ecf2;
43
+ }
44
+ </style>
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="container">
3
+ <div
4
+ @click="toggleTitle"
5
+ :class="cssClass"
6
+ class="
7
+ psui-flex psui-cursor-pointer psui-transition-all psui-justify-between
8
+ "
9
+ >
10
+ <div
11
+ v-if="title"
12
+ :class="display ? 'selected' : ''"
13
+ class="psui-font-bold psui-gray04"
14
+ >
15
+ {{ title }}
16
+ </div>
17
+ <span v-if="!display" class="material-icons">{{ iconClass.closed }}</span>
18
+ <span v-else :class="display ? 'selected' : ''" class="material-icons">{{
19
+ iconClass.open
20
+ }}</span>
21
+ </div>
22
+ <div v-if="display" class="psui-transition-all psui-duration-300">
23
+ <slot></slot>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ export const iconTypes = ["mathsign", "chevron"]
30
+ export const fontCss = ["medium", "big"]
31
+
32
+ export default {
33
+ name: "PsAccordionItem",
34
+ props: {
35
+ title: {
36
+ type: String,
37
+ required: true,
38
+ },
39
+ iconType: {
40
+ type: String,
41
+ required: true,
42
+ default: "chevron",
43
+ },
44
+ fontCss: {
45
+ type: String,
46
+ default: "medium",
47
+ },
48
+ },
49
+ data() {
50
+ return {
51
+ display: false,
52
+ }
53
+ },
54
+ computed: {
55
+ iconClass() {
56
+ if (this.iconType === "chevron") {
57
+ return { closed: "expand_more", open: "expand_less" }
58
+ } else if (this.iconType === "mathsign") {
59
+ return { closed: "add", open: "remove" }
60
+ }
61
+ return ''
62
+ },
63
+ cssClass() {
64
+ if (this.fontCss === "big") return "big"
65
+ return "medium"
66
+ },
67
+ },
68
+ methods: {
69
+ toggleTitle() {
70
+ this.display = !this.display
71
+ },
72
+ },
73
+ }
74
+ </script>
75
+
76
+ <style scoped>
77
+ .container {
78
+ border-bottom: 1px solid #e6ecf2;
79
+ padding: 16px;
80
+ }
81
+
82
+ span {
83
+ font-weight: 700;
84
+ color: #e6ecf2;
85
+ }
86
+
87
+ .selected {
88
+ color: #318fac;
89
+ transition: color 300ms;
90
+ }
91
+
92
+ .big {
93
+ font-size: 18px;
94
+ line-height: 130%;
95
+ }
96
+
97
+ .medium {
98
+ font-size: 16px;
99
+ line-height: 130%;
100
+ }
101
+ </style>
102
+
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <button
3
- class="psui-font-bold psui-align-middle psui-flex psui-rounded-md"
3
+ class="psui-font-bold psui-items-center psui-flex psui-rounded-md"
4
4
  :class="classes"
5
5
  @click="onClick()"
6
6
  >
@@ -10,7 +10,11 @@
10
10
  >
11
11
  {{ icon }}
12
12
  </i>
13
- <div class="psui-flex-grow psui-text-left">{{ label }}</div>
13
+ <span
14
+ v-if="label"
15
+ class="psui-flex-grow psui-text-left"
16
+ >{{ label }}
17
+ </span>
14
18
  <i
15
19
  v-if="iconRight"
16
20
  :class="['psui-ml-2', iconClasses]"
@@ -26,7 +30,6 @@ export default {
26
30
  props: {
27
31
  label: {
28
32
  type: String,
29
- required: true
30
33
  },
31
34
  outline: {
32
35
  type: Boolean,
@@ -69,38 +72,58 @@ export default {
69
72
  },
70
73
  computed: {
71
74
  iconClasses() {
72
- const size = this.sizes === 'small' ? 'psui-text-sm' : ''
75
+ const size = this.size === 'small' ? 'psui-text-small' : this.size === 'medium' ? 'psui-text-small' : 'psui-text-big'
73
76
  const color = this.iconColor.length > 0 ? `psui-text-${this.iconColor}` : ''
74
77
  return `psui-my-auto material-icons ${size} ${color}`
75
78
  },
76
79
  classes() {
77
- let sizeCss = 'psui-px-4 psui-py-2'
78
- if (this.size === 'medium') sizeCss = 'psui-px-4 psui-py-1'
79
- if (this.size === 'small') sizeCss = 'psui-px-2 psui-py-psui-px psui-text-sm'
80
- 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'}`
81
- 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'}`
80
+ let sizeCss = ''
81
+
82
+ if (this.size === 'medium') sizeCss = 'medium'
83
+ if (this.size === 'small') sizeCss = 'small'
84
+ if (this.size === 'big') sizeCss = 'big'
85
+
86
+ if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40 psui-cursor-default' : 'psui-border-blue-60 psui-text-blue-60'}`
87
+ if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40 psui-cursor-default' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
82
88
  if (this.textOnly) {
83
89
  const hasTextColor = this.textColor.length > 0
84
90
  const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
85
91
  const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
86
92
 
87
93
  let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
88
- if (this.disabled) textCss = 'psui-text-gray-40'
94
+ if (this.disabled) textCss = 'psui-text-gray-40 psui-cursor-default'
89
95
 
90
96
  if (hasTextColor) textCss = `psui-text-${color}`
91
97
  if (hover) textCss += `hover:psui-text-${hover}`
92
98
 
93
99
  return `${sizeCss} ${textCss}`
94
100
  }
95
- if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40`
96
- return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner`
101
+ if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40 psui-cursor-default`
102
+ return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner psui-cursor-pointer`
97
103
  }
98
104
  },
99
105
  methods: {
100
106
  onClick() {
101
107
  if (this.disabled) return false
102
- this.$emit('click');
108
+ this.$emit('click')
103
109
  }
104
110
  }
105
111
  }
106
112
  </script>
113
+
114
+ <style scoped>
115
+ .small {
116
+ padding: 4px 8px 4px 8px;
117
+ font-size: 14px;
118
+ }
119
+
120
+ .medium{
121
+ padding: 7px 16px 7px 16px;
122
+ font-size: 14px;
123
+ }
124
+
125
+ .big{
126
+ padding: 9.5px 16px 9.5px 16px;
127
+ font-size: 16px;
128
+ }
129
+ </style>
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <label
3
+ @click="onClick"
4
+ :for="title"
5
+ :class="cssClass"
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
+ "
16
+ >
17
+ <input
18
+ @change="onChange"
19
+ v-if="type !== 'text'"
20
+ :type="type"
21
+ :id="title"
22
+ :checked="checked"
23
+ />
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>
30
+ </template>
31
+
32
+ <script>
33
+ export const type = ["text", "radio", "checkbox", "button"]
34
+
35
+ export default {
36
+ name: "PsChips",
37
+ props: {
38
+ title: {
39
+ type: String,
40
+ default: "",
41
+ },
42
+ type: {
43
+ type: String,
44
+ required: true,
45
+ },
46
+ icon: {
47
+ type: String,
48
+ default: "",
49
+ },
50
+ rich: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ checked: {
55
+ type: Boolean,
56
+ },
57
+ },
58
+ emits: ["click", "change"],
59
+ data() {
60
+ return {
61
+ isChecked: false,
62
+ value: null,
63
+ }
64
+ },
65
+ computed: {
66
+ cssClass() {
67
+ let cssClass = ''
68
+
69
+ if (this.isChecked === true && this.type === "radio") {
70
+ cssClass = "psui-text-blue-50 psui-bg-blue-20"
71
+ }
72
+
73
+ if (this.isChecked === true && this.type === "checkbox") {
74
+ cssClass = "psui-text-blue-50 psui-bg-blue-20"
75
+ }
76
+
77
+ if (this.isChecked === true) {
78
+ cssClass = "psui-text-blue-50 psui-bg-blue-20"
79
+ }
80
+
81
+ return cssClass
82
+ },
83
+ },
84
+ methods: {
85
+ onClick() {
86
+ if (this.disabled) return false
87
+
88
+ if (this.type !== "checkbox" || this.type !== "radio") {
89
+ this.isChecked = !this.isChecked
90
+ }
91
+
92
+ this.$emit("click")
93
+ },
94
+ onChange(event) {
95
+ this.isChecked = event.target.checked
96
+ this.checked = event.target.checked
97
+ this.$emit("change", event.target.checked)
98
+ },
99
+ onClose() {
100
+ this.$emit("close")
101
+ },
102
+ },
103
+ }
104
+ </script>
105
+
106
+ <style scoped>
107
+ input[type="radio"] {
108
+ -webkit-appearance: none;
109
+ -moz-appearance: none;
110
+ appearance: none;
111
+
112
+ display: inline-block;
113
+ width: 16px;
114
+ height: 16px;
115
+ border-radius: 50%;
116
+ border: 1px solid #d6dde5;
117
+ cursor: pointer;
118
+ }
119
+
120
+ input[type="checkbox"] {
121
+ -webkit-appearance: none;
122
+ -moz-appearance: none;
123
+ appearance: none;
124
+
125
+ display: inline-block;
126
+ width: 16px;
127
+ height: 16px;
128
+ border-radius: 25%;
129
+ border: 1px solid #d6dde5;
130
+ cursor: pointer;
131
+ }
132
+
133
+ input[type="radio"]:hover,
134
+ input[type="checkbox"]:hover {
135
+ border-color: #64b5ce;
136
+ }
137
+
138
+ input[type="radio"]:checked {
139
+ border-color: #64b5ce;
140
+ background: url("../../assets/images/radio-checked-button.svg") #ffffff
141
+ no-repeat center;
142
+ }
143
+
144
+ input[type="checkbox"]:checked {
145
+ border-color: #64b5ce;
146
+ background: url("../../assets/images/check-checkbox-button.svg") #64b5ce
147
+ no-repeat center;
148
+ }
149
+
150
+ label {
151
+ width: fit-content;
152
+ cursor: pointer;
153
+ }
154
+
155
+ label:hover {
156
+ color: #64b5ce;
157
+ background: #ffffff;
158
+ }
159
+
160
+ button {
161
+ outline: none;
162
+ }
163
+ </style>
164
+
@@ -25,7 +25,7 @@ export default {
25
25
  },
26
26
  checkboxClasses: {
27
27
  type: String,
28
- default: 'psui-pl-8'
28
+ default: ''
29
29
  },
30
30
  labelClasses: {
31
31
  type: String,
@@ -42,7 +42,7 @@ export default {
42
42
  computed: {
43
43
  model: {
44
44
  get() {
45
- return this.value;
45
+ return this.value
46
46
  },
47
47
  set(newValue) {
48
48
  this.$emit('input', newValue)
@@ -50,7 +50,7 @@ export default {
50
50
  },
51
51
  },
52
52
  classes() {
53
- return `${this.disabled ? 'psui-border-gray-40': 'psui-border-gray-50'} ${checkboxClasses}`
53
+ return `${this.disabled ? 'psui-border-gray-40': 'psui-border-gray-50'} ${this.checkboxClasses}`
54
54
  },
55
55
  getSize() {
56
56
  return {
@@ -1,10 +1,35 @@
1
1
  <template>
2
-
2
+ <div>
3
+ <div>
4
+ <div class="psui-bg-gray-20 psui-rounded-lg psui-mb-4">
5
+ <div class="psui-flex psui-justify-between psui-items-center psui-p-2">
6
+ <h2 class="psui-text-gray-80 psui-font-bold psui-leading-4">Cost Effectiveness</h2>
7
+ <i class="material-icons-round psui-text-gray-40" >drag_indicator</i>
8
+ </div>
9
+ </div>
10
+ <div>
11
+ <div class="psui-flex psui-flex-col psui-bg-gray-20 psui-rounded-lg psui-mb-4">
12
+ <div class="psui-flex psui-justify-between psui-items-center psui-p-2">
13
+ <h2 class="psui-text-gray-80 psui-font-bold psui-leading-4">Per Home Results</h2>
14
+ <i class="material-icons-round psui-text-gray-40">drag_indicator</i>
15
+ </div>
16
+ <slot>
17
+ </slot>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
3
22
  </template>
4
23
 
5
24
  <script>
6
25
  export default {
7
-
26
+ name: 'PsDraggable',
27
+ props:{
28
+ data: {
29
+ type: Array,
30
+ required: true,
31
+ }
32
+ }
8
33
  }
9
34
  </script>
10
35