@policystudio/policy-studio-ui-vue 1.2.0-access.2 → 1.2.0-access.21

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 (37) hide show
  1. package/dist/css/psui_styles_output.css +585 -325
  2. package/doc/src/stories/Button.stories.ts +95 -73
  3. package/doc/src/stories/DropdownList.stories.ts +2 -2
  4. package/doc/src/stories/Typography.mdx +14 -14
  5. package/package.json +1 -1
  6. package/src/assets/scss/components/PsAccordion.scss +19 -28
  7. package/src/assets/scss/components/PsButton.scss +128 -91
  8. package/src/assets/scss/components/PsCardInfos.scss +1 -1
  9. package/src/assets/scss/components/PsChartLegend.scss +2 -2
  10. package/src/assets/scss/components/PsCheckbox.scss +2 -2
  11. package/src/assets/scss/components/PsChips.scss +1 -1
  12. package/src/assets/scss/components/PsCollapse.scss +1 -1
  13. package/src/assets/scss/components/PsDataTable.scss +1 -1
  14. package/src/assets/scss/components/PsDateCardInfo.scss +7 -4
  15. package/src/assets/scss/components/PsDialog.scss +2 -2
  16. package/src/assets/scss/components/PsDraggable.scss +1 -1
  17. package/src/assets/scss/components/PsDropdownList.scss +2 -2
  18. package/src/assets/scss/components/PsInlineSelector.scss +3 -3
  19. package/src/assets/scss/components/PsInput.scss +2 -2
  20. package/src/assets/scss/components/PsInputSelect.scss +2 -2
  21. package/src/assets/scss/components/PsInputTextArea.scss +3 -3
  22. package/src/assets/scss/components/PsMiniTag.scss +25 -30
  23. package/src/assets/scss/components/PsRadioButton.scss +2 -2
  24. package/src/assets/scss/components/PsSlider.scss +1 -1
  25. package/src/assets/scss/components/PsTabHeader.scss +134 -134
  26. package/src/assets/scss/components/PsTableResults.scss +12 -12
  27. package/src/assets/scss/components/PsTestimonialCard.scss +3 -3
  28. package/src/assets/scss/components/PsToast.scss +1 -1
  29. package/src/assets/scss/components/PsToggle.scss +1 -1
  30. package/src/assets/scss/components/_PsTableResults.scss +3 -3
  31. package/src/components/badges-and-tags/PsDateCardInfo.vue +16 -5
  32. package/src/components/badges-and-tags/PsMiniTag.vue +5 -5
  33. package/src/components/buttons/PsButton.vue +111 -20
  34. package/src/components/navigations/PsBreadcrumb.vue +1 -1
  35. package/src/components/table-results/PsTableResults.vue +2 -2
  36. package/src/components/ui/PsIcon.vue +10 -5
  37. package/tailwind.config.js +70 -87
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <button
2
+ <component
3
+ :is="href ? 'a' : 'button'"
4
+ v-bind="$attrs"
5
+ :href="href || undefined"
6
+ :target="target || undefined"
7
+ :rel="target === '_blank' ? 'noopener noreferrer' : undefined"
8
+ :aria-label="ariaLabel || undefined"
3
9
  @click="onClick($event)"
4
10
  @mouseenter="onMouseEnter"
5
11
  @mouseleave="onMouseLeave"
@@ -7,9 +13,9 @@
7
13
  :class="[getComponentClass, { hover: isHover && !disabled}, { disabled: disabled || loading }]"
8
14
  >
9
15
  <svg
10
- v-if="loading"
11
- class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
12
- :class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
16
+ v-if="loading && showLoadingLeft"
17
+ class="psui-animate-spin psui-text-black"
18
+ :class="[loadingSizeClass, iconLeft ? 'icon-left-side' : 'psui-mr-2']"
13
19
  xmlns="http://www.w3.org/2000/svg"
14
20
  fill="none"
15
21
  viewBox="0 0 24 24"
@@ -28,13 +34,44 @@
28
34
  d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
29
35
  />
30
36
  </svg>
37
+
31
38
  <i
32
- v-else-if="icon"
33
- :class="iconClass"
39
+ v-else-if="iconLeft"
40
+ :class="[iconLeftClass, 'icon-left-side']"
34
41
  class="material-icons-round"
35
- >{{ icon }}</i>
42
+ >{{ iconLeft }}</i>
43
+
36
44
  <span v-if="label">{{ label }}</span>
37
- </button>
45
+
46
+ <svg
47
+ v-if="loading && showLoadingRight"
48
+ class="psui-animate-spin psui-text-black"
49
+ :class="[loadingSizeClass, iconRight ? 'icon-right-side' : 'psui-ml-2']"
50
+ xmlns="http://www.w3.org/2000/svg"
51
+ fill="none"
52
+ viewBox="0 0 24 24"
53
+ >
54
+ <circle
55
+ class="psui-opacity-25"
56
+ cx="12"
57
+ cy="12"
58
+ r="10"
59
+ stroke="currentColor"
60
+ stroke-width="4"
61
+ />
62
+ <path
63
+ class="psui-opacity-75"
64
+ fill="currentColor"
65
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
66
+ />
67
+ </svg>
68
+
69
+ <i
70
+ v-else-if="iconRight"
71
+ :class="[iconRightClass, 'icon-right-side']"
72
+ class="material-icons-round"
73
+ >{{ iconRight }}</i>
74
+ </component>
38
75
  </template>
39
76
 
40
77
  <script setup>
@@ -52,21 +89,46 @@ const props = defineProps({
52
89
  layout: {
53
90
  type: String,
54
91
  default: 'solid',
55
- validator: (value) => ['solid', 'outline', 'ghost', 'onlytext', 'caution'].includes(value),
92
+ validator: (value) => [
93
+ 'solid',
94
+ 'outline',
95
+ // 'ghost',
96
+ 'onlytext',
97
+ 'caution'
98
+ ].includes(value),
56
99
  },
57
- icon: {
100
+ href: {
58
101
  type: String,
59
102
  default: '',
60
103
  },
61
- iconPosition: {
104
+ target: {
62
105
  type: String,
63
- default: 'left',
64
- validator: (value) => ['left', 'right'].includes(value),
106
+ default: '',
107
+ },
108
+ ariaLabel: {
109
+ type: String,
110
+ default: '',
111
+ },
112
+ iconLeft: {
113
+ type: String,
114
+ default: '',
115
+ },
116
+ iconLeftClass: {
117
+ type: String,
118
+ default: '',
119
+ },
120
+ iconRight: {
121
+ type: String,
122
+ default: '',
123
+ },
124
+ iconRightClass: {
125
+ type: String,
126
+ default: '',
65
127
  },
66
128
  size: {
67
129
  type: String,
68
130
  default: 'big',
69
- validator: (value) => ['small', 'medium', 'big'].includes(value),
131
+ validator: (value) => ['compact', 'small', 'medium', 'big'].includes(value),
70
132
  },
71
133
  disabled: {
72
134
  type: Boolean,
@@ -76,18 +138,47 @@ const props = defineProps({
76
138
  type: Boolean,
77
139
  default: false,
78
140
  },
79
- iconClass: {
141
+ loadingPosition: {
80
142
  type: String,
81
- default: '',
143
+ default: 'left',
144
+ validator: (value) => ['left', 'right'].includes(value),
82
145
  },
83
146
  })
84
147
 
148
+ const showLoadingLeft = computed(() => {
149
+ if (props.iconLeft) return true
150
+ if (!props.iconLeft && !props.iconRight && props.loadingPosition === 'left') return true
151
+ return false
152
+ })
153
+
154
+ const showLoadingRight = computed(() => {
155
+ if (props.iconRight) return true
156
+ if (!props.iconLeft && !props.iconRight && props.loadingPosition === 'right') return true
157
+ return false
158
+ })
159
+
160
+ const loadingSizeClass = computed(() => {
161
+ const sizeMap = {
162
+ compact: 'psui-h-3.5 psui-w-3.5',
163
+ small: 'psui-h-4 psui-w-4',
164
+ medium: 'psui-h-[18px] psui-w-[18px]',
165
+ big: 'psui-h-5 psui-w-5',
166
+ }
167
+ return sizeMap[props.size] || sizeMap.big
168
+ })
169
+
85
170
  const getComponentClass = computed(() => {
86
- if (props.icon) {
87
- return `layout-${props.layout} size-${props.size} icon-${props.iconPosition}`
88
- } else {
89
- return `layout-${props.layout} size-${props.size}`
171
+ const classes = [`layout-${props.layout}`, `size-${props.size}`]
172
+
173
+ if (props.iconLeft && props.iconRight) {
174
+ classes.push('icon-both')
175
+ } else if (props.iconLeft) {
176
+ classes.push('icon-left')
177
+ } else if (props.iconRight) {
178
+ classes.push('icon-right')
90
179
  }
180
+
181
+ return classes.join(' ')
91
182
  })
92
183
 
93
184
  const onClick = (event) => {
@@ -58,7 +58,7 @@ defineProps({
58
58
  */
59
59
  liClass: {
60
60
  type: String,
61
- default: 'psui-text-small psui-text-gray-60',
61
+ default: 'psui-text-14 psui-text-gray-60',
62
62
  },
63
63
  })
64
64
 
@@ -74,7 +74,7 @@
74
74
  />
75
75
 
76
76
  <div v-if="item.is_appended">
77
- <span class="psui-text-small psui-font-bold psui-text-blue-60 psui-ml-2">
77
+ <span class="psui-text-14 psui-font-bold psui-text-blue-60 psui-ml-2">
78
78
  {{ item.title }}
79
79
  </span>
80
80
  </div>
@@ -189,7 +189,7 @@
189
189
  class="psui-text-gray-60 hover:psui-bg-blue-10 hover:psui-text-blue-60 psui-font-bold psui-cursor-pointer psui-flex psui-items-center psui-gap-3 psui-px-5 psui-py-1 transition-all"
190
190
  @click="executeCallback(item, action)"
191
191
  >
192
- <span class="psui-w-auto psui-text-small">{{ action.title }}</span>
192
+ <span class="psui-w-auto psui-text-14">{{ action.title }}</span>
193
193
  </li>
194
194
  </ul>
195
195
  </template>
@@ -83,10 +83,11 @@ const props = defineProps({
83
83
  type: String,
84
84
  default: null,
85
85
  validator: (value) => {
86
- return (
87
- (value?.includes('psui-text-') && typeof tailwindConfig.theme.colors[value.replace('psui-text-', '')] != 'undefined') ||
88
- typeof tailwindConfig.theme.colors[value] != 'undefined'
89
- )
86
+ if (value === null || value === undefined || value === '') return true
87
+ const colors = tailwindConfig?.theme?.colors
88
+ if (!colors) return true
89
+ const colorKey = value?.replace(/^(psui-)?text-/, '')
90
+ return typeof colors[colorKey] !== 'undefined'
90
91
  },
91
92
  },
92
93
  /**
@@ -143,8 +144,12 @@ const getIconClasses = computed(() => {
143
144
  })
144
145
 
145
146
  const getColor = computed(() => {
147
+ if (!props.color) return null
146
148
  if (getIconType.value === 'material-icons') return props.color
147
- return tailwindConfig.theme.colors[props.color.replace('psui-text-', '')] || tailwindConfig.theme.colors[props.color]
149
+ const colors = tailwindConfig?.theme?.colors
150
+ if (!colors) return null
151
+ const colorKey = props.color.replace(/^(psui-)?text-/, '')
152
+ return colors[colorKey] || null
148
153
  })
149
154
 
150
155
  watch(
@@ -1,19 +1,21 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
 
3
+ //This sizemap is to use until we switch everthing to new design system format
4
+ const sizeMap = {
5
+ 14: ['14px', { lineHeight: '20px' }],
6
+ 16: ['16px', { lineHeight: '24px' }],
7
+ 18: ['18px', { lineHeight: '24px' }],
8
+ 20: ['20px', { lineHeight: '28px' }],
9
+ 28: ['28px', { lineHeight: '36px' }]
10
+ }
11
+
3
12
  export default {
4
13
  prefix: 'psui-',
5
- content: [
6
- './index.html',
7
- './src/**/*.vue',
8
- './src/**/*.js',
9
- './src/**/*.ts',
10
- './src/**/*.jsx',
11
- './src/**/*.tsx',
12
- ],
14
+ content: ['./index.html', './src/**/*.vue', './src/**/*.js', './src/**/*.ts', './src/**/*.jsx', './src/**/*.tsx'],
13
15
  darkMode: 'media', // or 'media' or 'class'
14
16
  theme: {
15
17
  colors: {
16
- 'white': '#ffffff ',
18
+ white: '#ffffff',
17
19
  'gray-10': '#F3F6F9',
18
20
  'gray-20': '#E6ECF2',
19
21
  'gray-30': '#D6DDE5',
@@ -23,29 +25,33 @@ export default {
23
25
  'gray-70': '#34404A',
24
26
  'gray-80': '#28323B',
25
27
 
26
- 'blue': '#5094D3',
28
+ blue: '#5094D3',
27
29
  'blue-10': '#ECF7FB',
28
30
  'blue-20': '#E0EFF6',
29
- 'blue-50': '#64B5CE',
30
- 'blue-60': '#318FAC',
31
+ 'blue-30': '#BEDCEB',
32
+ 'blue-40': '#86C0DB',
33
+ 'blue-50': '#2DA5CC',
34
+ 'blue-60': '#127999',
35
+ 'blue-65': '#0A6480',
31
36
  'blue-70': '#00465F',
32
37
  'blue-80': '#002A3A',
33
38
 
34
39
  'green-10': '#DEF8E8',
35
- 'green-20': '#5DB883',
40
+ 'green-20': '#9BDEB5',
36
41
  'green-70': '#44A06A',
37
- 'green-80': '#286943',
42
+ 'green-80': '#0E7C45',
38
43
 
39
44
  'yellow-10': '#FDF3E3',
40
- 'yellow-20': '#EDAB3E',
45
+ 'yellow-20': '#D7A556',
46
+ 'yellow-60': '#584C25',
41
47
  'yellow-70': '#B87305',
42
- 'yellow-80': '#834C0D',
48
+ 'yellow-80': '#B85614',
43
49
 
44
50
  'red-10': '#FCEBEB',
45
51
  'red-15': '#EAC5C5',
46
- 'red-20': '#D65C5A',
52
+ 'red-20': '#CD9B9B',
47
53
  'red-70': '#AA3937',
48
- 'red-80': '#832F2E',
54
+ 'red-80': '#A23634',
49
55
 
50
56
  sky: '#518BE2',
51
57
  teal: '#57C0BA',
@@ -55,120 +61,97 @@ export default {
55
61
  pink: '#FF77B8',
56
62
  purple: '#9278C9',
57
63
  transparent: 'transparent',
64
+ 'focus-ring': '#2563EB'
65
+ },
66
+ backgroundImage: {
67
+ 'gradient-emerald': 'linear-gradient(270deg, #5DB883 0%, #28B08E 100%)'
58
68
  },
59
69
  fontFamily: {
60
- sans: ['Lato', 'sans-serif'],
70
+ sans: ['Lato', 'sans-serif']
61
71
  },
62
72
  fontSize: {
63
- big: ['16px', '130%'],
64
- small: ['14px', '130%'],
73
+ ...sizeMap,
74
+
75
+ big: sizeMap['16'],
76
+ small: sizeMap['14'],
65
77
  xsmall: ['12px', '130%'],
66
- accent: ['14px', { lineHeight: '130%', letterSpacing: '0.6px' }],
78
+ accent: sizeMap['14'],
67
79
  accentSmall: ['12px', { lineHeight: '130%', letterSpacing: '0.6px' }],
68
- p: ['16px', '130%'],
69
- h1: ['28px', '130%'],
80
+ p: sizeMap['16'],
81
+ h1: sizeMap['28'],
70
82
  h2: ['24px', '130%'],
71
83
  h3: ['22px', '120%'],
72
- h4: ['20px', '120%'],
73
- h5: ['18px', '120%'],
74
- h6: ['17px', '120%'],
84
+ h4: sizeMap['20'],
85
+ h5: sizeMap['18'],
86
+ h6: ['17px', '120%']
75
87
  },
76
88
  boxShadow: {
77
- 'elevation--5':
78
- '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
79
- 'elevation-5':
80
- '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
81
- 'elevation-10':
82
- '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
83
- 'elevation-20':
84
- '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
85
- 'elevation-30':
86
- '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
87
- 'elevation-40':
88
- '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
89
+ 'elevation--5': '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
90
+ 'elevation-5': '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
91
+ 'elevation-10': '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
92
+ 'elevation-20': '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
93
+ 'elevation-30': '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
94
+ 'elevation-40': '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
89
95
  sm: '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
90
- default:
91
- '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
96
+ default: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
92
97
  md: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
93
98
  lg: '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
94
99
  xl: '0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
95
100
  inner: '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
96
- none: 'none',
101
+ none: 'none'
97
102
  },
98
103
  borderColor: (theme) => ({
99
104
  ...theme('colors'),
100
- DEFAULT: theme('colors.blue-70', 'currentColor'),
105
+ DEFAULT: theme('colors.blue-70', 'currentColor')
101
106
  }),
102
107
  divideColor: (theme) => ({
103
- ...theme('colors'),
108
+ ...theme('colors')
104
109
  }),
105
110
  extend: {
106
111
  divideOpacity: {
107
112
  10: '0.1',
108
113
  20: '0.2',
109
- 95: '0.95',
114
+ 95: '0.95'
110
115
  },
111
116
  cursor: {
112
- 'grab': 'grab',
113
- 'grabbing': 'grabbing'
117
+ grab: 'grab',
118
+ grabbing: 'grabbing'
114
119
  },
115
120
  zIndex: {
116
- '15': '15',
121
+ 15: '15'
117
122
  },
118
123
  space: {
119
- '0.5': '0.125rem',
124
+ 0.5: '0.125rem'
120
125
  },
121
126
  margin: {
122
- '0.5': '0.125rem',
127
+ 0.5: '0.125rem'
123
128
  },
124
129
  padding: {
125
- '0.5': '0.125rem',
130
+ 0.5: '0.125rem'
126
131
  },
127
- inset:{
132
+ inset: {
128
133
  '-1': '-1rem',
129
134
  '-2': '-0.5rem'
130
- }
135
+ },
131
136
  },
132
137
  screens: {
133
- 'sm': '640px',
134
- 'md': '768px',
135
- 'lg': '1024px',
136
- 'xl': '1280px',
137
- '2xl': '1536px',
138
- }
138
+ sm: '640px',
139
+ md: '768px',
140
+ lg: '1024px',
141
+ xl: '1280px',
142
+ '2xl': '1536px'
143
+ },
144
+
139
145
  },
140
146
  variants: {
141
147
  boxShadow: ['active'],
142
148
  borderRadius: ['last', 'first'],
143
- backgroundColor: [
144
- 'responsive',
145
- 'hover',
146
- 'active',
147
- 'focus',
148
- 'group-hover',
149
- 'even',
150
- 'first',
151
- 'disabled',
152
- 'checked',
153
- ],
154
- textColor: [
155
- 'responsive',
156
- 'hover',
157
- 'active',
158
- 'focus',
159
- 'group-hover',
160
- 'first',
161
- 'disabled',
162
- 'checked',
163
- ],
164
- borderColor: [
165
- 'disabled',
166
- 'hover',
167
- 'checked'
168
- ],
149
+ backgroundColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'even', 'first', 'disabled', 'checked'],
150
+ textColor: ['responsive', 'hover', 'active', 'focus', 'group-hover', 'first', 'disabled', 'checked'],
151
+ borderColor: ['disabled', 'hover', 'checked'],
169
152
  space: ['responsive', 'hover', 'focus', 'first'],
170
153
  padding: ['responsive', 'hover', 'focus', 'first'],
171
- extend: {},
154
+ extend: {}
172
155
  },
173
- plugins: [],
156
+ plugins: []
174
157
  }