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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.0.21",
3
+ "version": "1.0.25",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -15,7 +15,8 @@
15
15
  "storybook": "start-storybook -p 6006",
16
16
  "build-storybook": "build-storybook",
17
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"
18
+ "publish": "npm run lint && npm run build-tailwind && npm publish",
19
+ "dev": "watch 'npm run build-tailwind' ./src/assets"
19
20
  },
20
21
  "dependencies": {
21
22
  "core-js": "^3.6.5",
@@ -44,6 +45,7 @@
44
45
  "prettier": "^2.2.1",
45
46
  "tailwindcss": "^1.9.6",
46
47
  "vue-loader": "^15.9.8",
47
- "vue-template-compiler": "^2.6.11"
48
+ "vue-template-compiler": "^2.6.11",
49
+ "watch": "^1.0.2"
48
50
  }
49
51
  }
@@ -1,5 +1,9 @@
1
1
  @import url('https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round');
2
+ @import './components/PsTabHeader.scss';
3
+ @import './components/PsAccordion.scss';
2
4
  @import './components/PsInput.scss';
5
+ @import './components/PsButton.scss';
6
+ @import './components//PsDialog.scss';
3
7
  @import "tailwindcss/base";
4
8
  @import "tailwindcss/components";
5
9
  @import "tailwindcss/utilities";
@@ -11,3 +15,7 @@ html {
11
15
  -webkit-font-smoothing: antialiased;
12
16
  -moz-osx-font-smoothing: grayscale;
13
17
  }
18
+
19
+ .transition-default {
20
+ transition: cubic-bezier(.17,.67,.83,.67) 250ms;
21
+ }
@@ -0,0 +1,67 @@
1
+ @layer components{
2
+
3
+ .psui-el-accordion {
4
+
5
+ &-item {
6
+ border-bottom: 1px solid #e6ecf2;
7
+
8
+ &-header {
9
+ @apply psui-flex psui-cursor-pointer psui-transition-all psui-justify-between transition-default psui-text-gray-80;
10
+ padding-top: 16px;
11
+ padding-bottom: 16px;
12
+ &:hover {
13
+ @apply psui-text-blue-60;
14
+ }
15
+ }
16
+
17
+ &-content {
18
+ padding-bottom: 24px;
19
+ }
20
+
21
+ &-icon {
22
+ font-size: 20px;
23
+ width: 20px;
24
+ }
25
+
26
+ }
27
+
28
+ &.layout-big {
29
+ .psui-el-accordion-item {
30
+ &-header, &-content {
31
+ padding-left: 16px;
32
+ padding-right: 16px;
33
+ }
34
+ &-title {
35
+ @apply psui-text-h5 psui-font-bold;
36
+ }
37
+ &-icon {
38
+ @apply psui-text-gray-30
39
+ }
40
+ }
41
+ }
42
+
43
+ &.layout-medium {
44
+ .psui-el-accordion-item {
45
+ &-title {
46
+ @apply psui-text-small psui-font-bold;
47
+ }
48
+ &-icon {
49
+ @apply psui-text-gray-60
50
+ }
51
+ }
52
+ }
53
+
54
+ .psui-el-accordion-item {
55
+ &.status-opened .psui-el-accordion-item-header, &-header:hover {
56
+ @apply psui-text-blue-60;
57
+ .psui-el-accordion-item-icon {
58
+ @apply psui-text-blue-60;
59
+ }
60
+ }
61
+ }
62
+
63
+
64
+
65
+ }
66
+
67
+ }
@@ -0,0 +1,147 @@
1
+ @layer components {
2
+
3
+ .psui-el-button {
4
+
5
+ @apply psui-font-bold psui-items-center psui-flex psui-content-center psui-rounded-md transition-default;
6
+
7
+ span {
8
+ @apply psui-font-bold;
9
+ line-height: 130%;
10
+ font-family: inherit;
11
+ text-align: right;
12
+ }
13
+
14
+ &:focus {
15
+ outline: none;
16
+ }
17
+
18
+ &.icon-right {
19
+ @apply psui-flex-row-reverse;
20
+ }
21
+
22
+ &.size-big {
23
+ @apply psui-flex psui-items-center psui-content-center;
24
+ padding: 9.5px 16px;
25
+ font-size: 16px;
26
+
27
+ &.icon-left i {
28
+ font-size: 24px;
29
+ margin-right: 8px;
30
+ }
31
+
32
+ &.icon-right i {
33
+ font-size: 24px;
34
+ margin-left: 8px;
35
+ }
36
+
37
+ }
38
+
39
+ &.size-medium {
40
+
41
+ @apply psui-flex psui-items-center psui-content-center;
42
+ padding: 7px 16px;
43
+ font-size: 14px;
44
+
45
+ &.icon-left i {
46
+ font-size: 18px;
47
+ margin-right: 4px;
48
+ }
49
+
50
+ &.icon-right i {
51
+ font-size: 18px;
52
+ margin-left: 4px;
53
+ }
54
+ }
55
+
56
+ &.size-small {
57
+
58
+ @apply psui-flex psui-items-center psui-content-center;
59
+ padding: 4px 8px;
60
+ font-size: 14px;
61
+
62
+ &:focus {
63
+ @apply psui-bg-blue-20 psui-text-blue-60;
64
+ box-shadow: inset 0px 1px 2px rgba(0,0,0,0.05);
65
+ }
66
+
67
+ &.hover.layout-onlytext {
68
+ @apply psui-text-blue-60 psui-bg-blue-20 !important;
69
+ }
70
+
71
+ &.icon-left {
72
+ i {
73
+ font-size: 18px;
74
+ margin-right: 4px;
75
+ }
76
+ }
77
+
78
+ &.icon-right {
79
+ i {
80
+ font-size: 18px;
81
+ margin-left: 4px;
82
+ }
83
+ }
84
+
85
+ }
86
+
87
+ &.layout-solid {
88
+
89
+ @apply psui-bg-blue-60 psui-text-white;
90
+
91
+ &.hover {
92
+ @apply psui-bg-blue-50 psui-text-white;
93
+ }
94
+
95
+ &:focus {
96
+ @apply psui-bg-blue-50 psui-text-white;
97
+ box-shadow: inset 0px 1px 2px rgba(0,0,0,0.15);
98
+ }
99
+
100
+ &.disabled {
101
+ @apply psui-text-gray-40 psui-bg-gray-20 psui-cursor-default
102
+ }
103
+ }
104
+
105
+ &.layout-outline {
106
+
107
+ @apply psui-text-blue-60 psui-border psui-border-blue-50;
108
+ background: transparent;
109
+
110
+ &.hover,
111
+ &:focus {
112
+ @apply psui-border psui-border-blue-60
113
+ }
114
+
115
+ &.disabled {
116
+ @apply psui-text-gray-40 psui-border-gray-30 psui-cursor-default;
117
+ }
118
+ }
119
+
120
+ &.layout-ghost {
121
+
122
+ @apply psui-bg-blue-20 psui-text-blue-60;
123
+
124
+ &.hover,
125
+ &:focus {
126
+ box-shadow: inset 0px 1px 2px rgba(0,0,0,0.05);
127
+ }
128
+
129
+ &.disabled {
130
+ @apply psui-text-gray-40 psui-bg-gray-20 psui-cursor-default
131
+ }
132
+ }
133
+
134
+ &.layout-onlytext {
135
+
136
+ @apply psui-bg-white psui-text-blue-60;
137
+
138
+ &.disabled {
139
+ @apply psui-text-gray-40 psui-cursor-default
140
+ }
141
+
142
+ &.hover {
143
+ @apply psui-text-blue-50
144
+ }
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,71 @@
1
+ @layer components {
2
+
3
+ .psui-el-dialog {
4
+ @apply psui-flex psui-justify-start psui-items-start psui-pr-3 psui-pl-2 psui-py-2 psui-rounded-md;
5
+
6
+ &-wrapper {
7
+ @apply psui-flex psui-flex-grow
8
+ }
9
+ &-icon {
10
+ @apply psui-flex psui-mr-2 psui-align-top;
11
+
12
+ }
13
+ &-close {
14
+ @apply psui-ml-auto psui-inline-block;
15
+
16
+ &:focus{
17
+ @apply psui-outline-none
18
+ }
19
+
20
+ i {
21
+ @apply psui-align-middle;
22
+ font-size: 18px;
23
+ }
24
+
25
+ }
26
+
27
+ &.layout-vertical {
28
+ @apply psui-pr-2 psui-pl-2 psui-flex psui-items-start;
29
+
30
+ .psui-el-dialog-wrapper {
31
+ @apply psui-flex-col psui-text-small
32
+ }
33
+
34
+ i {
35
+ @apply psui-align-top
36
+ }
37
+
38
+ .psui-el-dialog-action {
39
+ @apply psui-pt-2
40
+ }
41
+ }
42
+
43
+ &.layout-horizontal {
44
+ .psui-el-dialog-close {
45
+ @apply psui-ml-3
46
+ }
47
+ .psui-el-dialog-default {
48
+ @apply psui-mr-auto
49
+ }
50
+ .psui-el-dialog-action {
51
+ @apply psui-ml-3
52
+ }
53
+ .psui-el-dialog-wrapper {
54
+ @apply psui-text-small psui-py-1
55
+ }
56
+ }
57
+
58
+
59
+ &.theme-informative {
60
+ @apply psui-bg-blue-20 psui-text-blue-60;
61
+ }
62
+
63
+ &.theme-success {
64
+ @apply psui-bg-green-10 psui-text-green-70;
65
+ }
66
+
67
+ &.theme-alert {
68
+ @apply psui-bg-yellow-10 psui-text-yellow-70;
69
+ }
70
+ }
71
+ }
@@ -2,27 +2,20 @@
2
2
 
3
3
  .psui-el-input {
4
4
 
5
- input {
6
- @apply psui-w-full psui-border psui-border-gray-30 psui-rounded-md psui-block
7
- }
8
-
9
5
  &-prepend {
10
- @apply psui-absolute psui-inset-y-0 psui-left-0 psui-pl-2 psui-flex psui-items-center psui-pointer-events-none
6
+ @apply psui-pl-2 psui-flex psui-items-center psui-pointer-events-none
11
7
  }
12
8
 
13
9
  &-append {
14
- @apply psui-absolute psui-inset-y-0 psui-right-0 psui-pr-2 psui-flex psui-items-center
10
+ @apply psui-pr-2 psui-flex psui-items-center
15
11
  }
16
12
 
17
13
  &-hint {
18
- @apply psui-text-gray-50 psui-text-xsmall
14
+ @apply psui-text-gray-50 psui-text-xsmall psui-mt-1
19
15
  }
20
16
 
21
17
  &-wrapper {
22
- @apply psui-relative;
23
- &.hover input {
24
- @apply psui-border-blue-50
25
- }
18
+ @apply psui-relative psui-w-full psui-border psui-border-gray-30 psui-rounded-md psui-bg-white psui-flex transition-default
26
19
  }
27
20
 
28
21
  label {
@@ -30,9 +23,29 @@
30
23
  }
31
24
 
32
25
  input {
33
- @apply psui-bg-white psui-text-gray-60
26
+ @apply psui-bg-white psui-text-gray-60 psui-w-full psui-rounded-md
27
+ }
28
+
29
+ &.status-error {
30
+ .psui-el-input-wrapper {
31
+ @apply psui-border-red-20
32
+ }
33
+ .psui-el-input-hint {
34
+ @apply psui-text-red-20
35
+ }
34
36
  }
35
37
 
38
+ &.status-disabled {
39
+ .psui-el-input-wrapper {
40
+ @apply psui-bg-gray-20 psui-border-gray-20
41
+ }
42
+ input {
43
+ @apply psui-bg-gray-20 psui-text-gray-40
44
+ }
45
+ label {
46
+ @apply psui-text-gray-40
47
+ }
48
+ }
36
49
 
37
50
  /* Layout Default */
38
51
  /* ----------------------------------------- */
@@ -44,32 +57,18 @@
44
57
  padding: 11.5px 16px;
45
58
  }
46
59
 
60
+ &.status-resting {
61
+ .psui-el-input-wrapper.hover {
62
+ @apply psui-border-blue-50
63
+ }
64
+ }
65
+
47
66
  &.status-active {
48
- input {
67
+ .psui-el-input-wrapper {
49
68
  @apply psui-border-blue-60
50
69
  }
51
70
  }
52
-
53
- &.status-error {
54
- input {
55
- @apply psui-border-red-20
56
- }
57
- &-hint {
58
- @apply psui-text-red-20
59
- }
60
- }
61
-
62
- &.status-disabled {
63
-
64
- input {
65
- @apply psui-bg-gray-20 psui-border-gray-20 psui-text-gray-40
66
- }
67
-
68
- label {
69
- @apply psui-text-gray-40
70
- }
71
71
 
72
- }
73
72
  }
74
73
  /* ----------------------------------------- Layout Default */
75
74
 
@@ -81,6 +80,22 @@
81
80
  @apply psui-text-small;
82
81
  padding: 7px 8px;
83
82
  }
83
+ &.status-resting {
84
+ .psui-el-input-wrapper.hover {
85
+ @apply psui-border-green-20
86
+ }
87
+ }
88
+ &.status-active {
89
+ .psui-el-input-wrapper {
90
+ @apply psui-border-green-20;
91
+ input {
92
+ @apply psui-text-green-20;
93
+ &.focus {
94
+ @apply psui-text-gray-60
95
+ }
96
+ }
97
+ }
98
+ }
84
99
  }
85
100
  /* ----------------------------------------- Layout Mini */
86
101
 
@@ -0,0 +1,98 @@
1
+ @layer components{
2
+
3
+ .psui-el-tab-header {
4
+ @apply psui-flex;
5
+
6
+ button {
7
+ @apply transition-default psui-text-small;
8
+ }
9
+
10
+ &.status-disabled {
11
+ .psui-el-input-wrapper {
12
+ @apply psui-bg-gray-20 psui-border-gray-20
13
+ }
14
+ }
15
+
16
+ /* Layout Standard */
17
+ /* ----------------------------------------- */
18
+ &.layout-standard {
19
+ @apply psui-rounded-md;
20
+
21
+ button {
22
+ @apply psui-bg-gray-10 psui-text-gray-60;
23
+ padding: 6px 12px;
24
+
25
+ &:not(:last-child) {
26
+ margin-right: 1px;
27
+ }
28
+
29
+ &:first-child {
30
+ @apply psui-rounded-l;
31
+ }
32
+
33
+ &:last-child {
34
+ @apply psui-rounded-r;
35
+ }
36
+
37
+ &:hover {
38
+ @apply psui-text-blue-60;
39
+ }
40
+
41
+ &.status-active {
42
+ @apply psui-text-white psui-bg-blue-60 psui-font-bold;
43
+ }
44
+ }
45
+ }
46
+ /* ----------------------------------------- Layout Standard */
47
+
48
+ /* Layout Underline */
49
+ /* ----------------------------------------- */
50
+ &.layout-underline {
51
+ @apply psui-border-b psui-border-gray-20;
52
+
53
+ button {
54
+ @apply psui-text-gray-50 psui-font-bold;
55
+ border-bottom: 3px solid transparent;
56
+ padding: 11.5px 0;
57
+
58
+ &:not(:last-child) {
59
+ margin-right: 20px;
60
+ }
61
+
62
+ &:hover {
63
+ @apply psui-text-blue-60;
64
+ }
65
+
66
+ &.status-active {
67
+ @apply psui-text-blue-60 psui-border-blue-60;
68
+ }
69
+ }
70
+ }
71
+ /* ----------------------------------------- Layout Underline */
72
+
73
+
74
+ /* Layout Folder */
75
+ /* ----------------------------------------- */
76
+ &.layout-folder {
77
+ button {
78
+ @apply psui-bg-gray-10 psui-text-gray-50 psui-rounded-t;
79
+ padding: 9px 12px;
80
+
81
+ &:not(:last-child) {
82
+ margin-right: 4px;
83
+ }
84
+
85
+ &:hover {
86
+ @apply psui-text-gray-60;
87
+ }
88
+
89
+ &.status-active {
90
+ @apply psui-text-blue-60 psui-font-bold psui-bg-white;
91
+ }
92
+ }
93
+ }
94
+ /* ----------------------------------------- Layout Folder */
95
+
96
+ }
97
+
98
+ }
@@ -1,40 +1,44 @@
1
1
  <template>
2
- <div :class="classes" class="accordion">
2
+ <div class="psui-el-accordion" :class="`layout-${layout}`">
3
3
  <slot></slot>
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script>
8
- export const sizes = ['big', 'medium']
9
-
8
+ export const layouts = ['big', 'medium']
9
+ export const defaultIconsByLayout = {
10
+ big: {
11
+ 'iconOpened': 'remove',
12
+ 'iconClosed': 'add'
13
+ },
14
+ medium: {
15
+ 'iconOpened': 'expand_less',
16
+ 'iconClosed': 'expand_more'
17
+ }
18
+ }
10
19
  export default {
11
20
  name: 'PsAccordion',
12
21
  props: {
13
- size: {
22
+ layout: {
14
23
  type: String,
15
24
  default: 'medium',
16
- required: true,
25
+ validator: (value) => layouts.indexOf(value) !== -1,
17
26
  },
18
- },
19
- computed: {
20
- classes() {
21
- if (this.size === 'big') return 'big'
22
- return 'medium'
27
+ 'iconOpened': {
28
+ type: String,
23
29
  },
30
+ 'iconClosed': {
31
+ type: String,
32
+ }
24
33
  },
34
+ computed: {
35
+ getIcons() {
36
+ return {
37
+ 'iconOpened' : this.iconOpened ?? defaultIconsByLayout[this.layout].iconOpened,
38
+ 'iconClosed' : this.iconClosed ?? defaultIconsByLayout[this.layout].iconClosed,
39
+ }
40
+ }
41
+ }
25
42
  }
26
43
  </script>
27
- <style scoped>
28
- .medium {
29
- width: 390px;
30
- }
31
-
32
- .big {
33
- width: 580px;
34
- }
35
-
36
- .accordion {
37
- display: flex;
38
- flex-direction: column;
39
- }
40
- </style>
44
+ <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>