@policystudio/policy-studio-ui-vue 1.0.22 → 1.0.23

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.22",
3
+ "version": "1.0.23",
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,7 @@
1
1
  @import url('https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round');
2
+ @import './components/PsAccordion.scss';
2
3
  @import './components/PsInput.scss';
4
+ @import './components/PsButton.scss';
3
5
  @import "tailwindcss/base";
4
6
  @import "tailwindcss/components";
5
7
  @import "tailwindcss/utilities";
@@ -11,3 +13,7 @@ html {
11
13
  -webkit-font-smoothing: antialiased;
12
14
  -moz-osx-font-smoothing: grayscale;
13
15
  }
16
+
17
+ .transition-default {
18
+ transition: cubic-bezier(.17,.67,.83,.67) 250ms;
19
+ }
@@ -0,0 +1,63 @@
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;
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
+ }
49
+ }
50
+
51
+ .psui-el-accordion-item {
52
+ &.status-opened, &-header:hover {
53
+ .psui-el-accordion-item-icon {
54
+ @apply psui-text-blue-60;
55
+ }
56
+ }
57
+ }
58
+
59
+
60
+
61
+ }
62
+
63
+ }
@@ -0,0 +1,145 @@
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
+ &.right {
19
+ @apply psui-flex-row-reverse;
20
+ }
21
+
22
+ &.big {
23
+ @apply psui-flex psui-items-center psui-content-center;
24
+ padding: 9.5px 16px;
25
+ font-size: 16px;
26
+
27
+ &.left i {
28
+ font-size: 24px;
29
+ margin-right: 8px;
30
+ }
31
+
32
+ &.right i {
33
+ font-size: 24px;
34
+ margin-left: 8px;
35
+ }
36
+
37
+ }
38
+
39
+ &.medium {
40
+
41
+ @apply psui-flex psui-items-center psui-content-center;
42
+ padding: 7px 16px;
43
+ font-size: 14px;
44
+
45
+ &.left i {
46
+ font-size: 18px;
47
+ margin-right: 4px;
48
+ }
49
+
50
+ &.right i {
51
+ font-size: 18px;
52
+ margin-left: 4px;
53
+ }
54
+ }
55
+
56
+ &.small {
57
+
58
+ @apply psui-flex psui-items-center psui-content-center;
59
+ padding: 4px 8px;
60
+ font-size: 14px;
61
+
62
+ &.active {
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
+ &.left {
72
+ i {
73
+ font-size: 18px;
74
+ margin-right: 4px;
75
+ }
76
+ }
77
+
78
+ &.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
+ &.active {
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
+ &.active {
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
+ &.hover,
124
+ &.active {
125
+ @apply psui-bg-blue-10
126
+ }
127
+ &.disabled {
128
+ @apply psui-text-gray-40 psui-bg-gray-20 psui-cursor-default
129
+ }
130
+ }
131
+
132
+ &.layout-onlytext {
133
+
134
+ @apply psui-bg-white psui-text-blue-60;
135
+
136
+ &.disabled {
137
+ @apply psui-text-gray-40 psui-cursor-default
138
+ }
139
+
140
+ &.hover {
141
+ @apply psui-text-blue-50
142
+ }
143
+ }
144
+ }
145
+ }
@@ -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
 
@@ -1,40 +1,45 @@
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
25
  required: true,
26
+ validator: (value) => layouts.indexOf(value) !== -1,
17
27
  },
18
- },
19
- computed: {
20
- classes() {
21
- if (this.size === 'big') return 'big'
22
- return 'medium'
28
+ 'iconOpened': {
29
+ type: String,
23
30
  },
31
+ 'iconClosed': {
32
+ type: String,
33
+ }
24
34
  },
35
+ computed: {
36
+ getIcons() {
37
+ return {
38
+ 'iconOpened' : this.iconOpened ?? defaultIconsByLayout[this.layout].iconOpened,
39
+ 'iconClosed' : this.iconClosed ?? defaultIconsByLayout[this.layout].iconClosed,
40
+ }
41
+ }
42
+ }
25
43
  }
26
44
  </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>
45
+ <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
@@ -1,34 +1,16 @@
1
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
- <i v-if="!display" class="material-icons">{{ iconClass.closed }}</i>
18
- <i v-else :class="display ? 'selected' : ''" class="material-icons">{{
19
- iconClass.open
20
- }}</i>
2
+ <div class="psui-el-accordion-item" :class="`status-${isOpen ? 'opened' : 'closed'}`">
3
+ <div @click="toggle" class="psui-el-accordion-item-header">
4
+ <h2 v-if="title" class="psui-el-accordion-item-title">{{ title }}</h2>
5
+ <i class="psui-el-accordion-item-icon material-icons">{{ getIcon }}</i>
21
6
  </div>
22
- <div v-if="display" class="psui-transition-all psui-duration-300">
7
+ <div v-if="isOpen" class="psui-el-accordion-item-content">
23
8
  <slot></slot>
24
9
  </div>
25
10
  </div>
26
11
  </template>
27
12
 
28
13
  <script>
29
- export const iconTypes = ["mathsign", "chevron"]
30
- export const fontCss = ["medium", "big"]
31
-
32
14
  export default {
33
15
  name: "PsAccordionItem",
34
16
  props: {
@@ -36,67 +18,47 @@ export default {
36
18
  type: String,
37
19
  required: true,
38
20
  },
39
- iconType: {
21
+ 'iconOpened': {
40
22
  type: String,
41
- default: "chevron",
42
23
  },
43
- fontCss: {
24
+ 'iconClosed': {
44
25
  type: String,
45
- default: "medium",
46
26
  },
27
+ opened: {
28
+ type: [Boolean],
29
+ default: false
30
+ }
47
31
  },
48
32
  data() {
49
33
  return {
50
- display: false,
34
+ localOpened: null,
51
35
  }
52
36
  },
53
37
  computed: {
54
- iconClass() {
55
- if (this.iconType === "chevron") {
56
- return { closed: "expand_more", open: "expand_less" }
57
- } else if (this.iconType === "mathsign") {
58
- return { closed: "add", open: "remove" }
38
+ getIcons() {
39
+ return {
40
+ 'iconOpened' : this.iconOpened ?? this.$parent.getIcons.iconOpened,
41
+ 'iconClosed' : this.iconClosed ?? this.$parent.getIcons.iconClosed,
59
42
  }
60
- return ''
61
43
  },
62
- cssClass() {
63
- if (this.fontCss === "big") return "big"
64
- return "medium"
44
+ getIcon() {
45
+ return this.isOpen ? this.getIcons.iconOpened : this.getIcons.iconClosed
65
46
  },
47
+ isOpen() {
48
+ return this.localOpened !== null ? this.localOpened : this.opened
49
+ }
66
50
  },
67
51
  methods: {
68
- toggleTitle() {
69
- this.display = !this.display
52
+ toggle() {
53
+ if (this.localOpened === null) {
54
+ this.localOpened = !this.opened
55
+ } else {
56
+ this.localOpened = !this.localOpened
57
+ }
70
58
  },
71
- },
59
+ }
72
60
  }
73
61
  </script>
74
62
 
75
- <style scoped>
76
- .container {
77
- border-bottom: 1px solid #e6ecf2;
78
- padding-top: 16px;
79
- padding-bottom: 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>
63
+ <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
102
64
 
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="psui-border psui-border-gray-20 psui-rounded-md psui-flex psui-flex-col psui-items-center psui-justify-center psui-px-3 psui-py-2 psui-space-y-2">
3
+ <h5 class="psui-text-xsmall psui-font-bold psui-text-gray-40">
4
+ <span class="psui-text-gray-60">{{ title }} </span>{{ subtitle }}
5
+ </h5>
6
+ <div class="psui-w-full psui-flex psui-justify-center psui-items-center psui-space-x-2 psui-text-p">
7
+ <span class="psui-text-blue-50 material-icons-round">{{ icon }}</span>
8
+ <h5 class="psui-text-gray-80">{{ total }}</h5>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'PsCardInfos',
16
+ props: {
17
+ title: {
18
+ type: String,
19
+ default: 'Total',
20
+ },
21
+ subtitle: {
22
+ type: String,
23
+ default: '',
24
+ },
25
+ icon: {
26
+ type: String,
27
+ default: 'edit',
28
+ },
29
+ total: {
30
+ type: String,
31
+ default: '',
32
+ },
33
+ }
34
+ };
35
+ </script>
36
+
37
+ <style scoped>
38
+ </style>