@awes-io/ui 2.75.0 → 2.76.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.76.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.75.0...@awes-io/ui@2.76.0) (2023-10-25)
7
+
8
+
9
+ ### Features
10
+
11
+ * add square classes for cropper and avatar ([ed653b7](https://github.com/awes-io/client/commit/ed653b722f898234636cac914b26f6b40a10e240))
12
+ * aw-page-single component added ([10f90ee](https://github.com/awes-io/client/commit/10f90eecfe17e2942dd1562c32f3c90626cfb0c3))
13
+
14
+
15
+
16
+
17
+
6
18
  # [2.75.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.74.1...@awes-io/ui@2.75.0) (2023-10-12)
7
19
 
8
20
 
@@ -31,6 +31,7 @@
31
31
  @import './context-menu.css';
32
32
  @import './description.css';
33
33
  @import './download-link.css';
34
+ @import './empty-container.css';
34
35
 
35
36
  @import './dropdown.css';
36
37
  @import './dropdown-button.css';
@@ -65,7 +66,10 @@
65
66
  @import './page.css';
66
67
  @import './page-modal.css';
67
68
  @import './page-menu-buttons.css';
69
+ @import './page-header.css';
68
70
  @import './page-headline.css';
71
+ @import './page-single.css';
72
+ @import './progress.css';
69
73
 
70
74
  @import './modal.css';
71
75
  @import './model-edit.css';
@@ -13,6 +13,14 @@
13
13
  min-height: var(--ui-avatar-size, 2.25rem);
14
14
  border-radius: var(--ui-avatar-size, 2.25rem);
15
15
 
16
+ &--square {
17
+ border-radius: 20%;
18
+
19
+ &.aw-avatar > * {
20
+ border-radius: 20%;
21
+ }
22
+ }
23
+
16
24
  & > * {
17
25
  grid-row: 1 / -1;
18
26
  grid-column: 1 / -1;
@@ -27,7 +35,6 @@
27
35
  }
28
36
 
29
37
  & > :not(img):not(&__no-img-icon) {
30
- @apply bg-mono-400 text-on-overlay;
31
38
  text-align: center;
32
39
  font-size: var(--ui-avatar-font-size);
33
40
  }
@@ -1,7 +1,6 @@
1
1
  .aw-button-nav {
2
2
  display: inline-flex;
3
3
  font-size: theme('fontSize.sm');
4
- @apply bg-mono-900;
5
4
  border: none;
6
5
  border-radius: 0.625rem;
7
6
 
@@ -22,6 +21,8 @@
22
21
  }
23
22
 
24
23
  &__toggler {
24
+ @apply bg-mono-800;
25
+
25
26
  position: relative;
26
27
  flex-shrink: 0;
27
28
  padding: 0;
@@ -31,7 +31,7 @@
31
31
  justify-content: center;
32
32
  width: 100%;
33
33
  transition: 100ms opacity;
34
- font-size: 14px;
34
+ font-size: 0.875rem;
35
35
  line-height: 1.125rem;
36
36
 
37
37
  &:focus {
@@ -82,6 +82,7 @@
82
82
  &:focus > &__content {
83
83
  /* opacity: 0.15; */
84
84
  outline: theme('focusOutline', 'none');
85
+ height: 100%;
85
86
  }
86
87
 
87
88
  /**
@@ -117,13 +118,10 @@
117
118
  }
118
119
 
119
120
  &__content_md {
120
- @apply px-4 text-sm leading-4;
121
+ @apply p-4 text-sm leading-4;
121
122
 
122
- padding-top: 1rem;
123
- padding-bottom: 1rem;
124
123
  min-width: 3rem;
125
124
  min-height: 3rem;
126
- height: 100%;
127
125
  }
128
126
 
129
127
  &.theme-icon &__content_md,
@@ -554,6 +552,10 @@
554
552
  box-shadow: none;
555
553
  }
556
554
 
555
+ .aw-button.color-default .aw-icon {
556
+ @apply text-mono-400;
557
+ }
558
+
557
559
  @screen lg {
558
560
  .aw-button.aw-button_md.theme-solid,
559
561
  .aw-button.aw-button_md .aw-button__overlay,
@@ -566,8 +568,7 @@
566
568
  }
567
569
 
568
570
  .aw-button__content_md {
569
- padding-top: 0.75rem;
570
- padding-bottom: 0.75rem;
571
+ padding: 0.75rem;
571
572
  min-width: 2.5rem;
572
573
  min-height: 2.5rem;
573
574
  }
@@ -5,6 +5,14 @@
5
5
  margin-left: auto;
6
6
  margin-right: auto;
7
7
 
8
+ &.aw-cropper--square {
9
+ .croppie-container {
10
+ .cr-viewport {
11
+ border-radius: 20%;
12
+ }
13
+ }
14
+ }
15
+
8
16
  &__croppie {
9
17
  position: relative;
10
18
  }
@@ -0,0 +1,8 @@
1
+ .aw-empty-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ gap: 1.5rem;
6
+
7
+ padding: 1.5rem 0;
8
+ }
@@ -47,10 +47,10 @@
47
47
  &__text {
48
48
  display: block;
49
49
 
50
- font-size: 0.5625rem;
50
+ font-size: 0.5rem;
51
51
  font-weight: 400;
52
- line-height: 0.625rem;
53
- color: var(--c-mono-400);
52
+ line-height: 0.58625rem;
53
+ color: var(--c-mono-300);
54
54
  transition: 60ms color;
55
55
 
56
56
  text-align: center;
@@ -59,6 +59,8 @@
59
59
  text-overflow: ellipsis;
60
60
  overflow: hidden;
61
61
  width: 100%;
62
+
63
+ margin-top: 0.25rem;
62
64
  }
63
65
 
64
66
  &__icon-badge {
@@ -8,9 +8,9 @@
8
8
 
9
9
  @screen lg {
10
10
  :root {
11
- --header-padding-bottom: 1.5rem;
12
- --header-padding-top: calc(env(safe-area-inset-top, 0px) + var(--header-padding-bottom, 1.5rem));
11
+ --header-padding-bottom: 1rem;
12
+ --header-padding-top: calc(env(safe-area-inset-top, 0px) + var(--header-padding-bottom, 1rem));
13
13
  --header-padding: var(--header-padding-top) var(--header-padding-horizontal) var(--header-padding-bottom);
14
- --header-height: calc(env(safe-area-inset-top, 0px) + 5.5rem);
14
+ --header-height: calc(env(safe-area-inset-top, 0px) + 4.5rem);
15
15
  }
16
16
  }
@@ -66,7 +66,7 @@
66
66
  margin-left: 5px;
67
67
  margin-top: -3px;
68
68
  border-radius: 50%;
69
- background-color: var(--c-accent, green);
69
+ background-color: var(--c-mono-100, green);
70
70
 
71
71
  position: absolute;
72
72
  left: theme('spacing.8');
@@ -0,0 +1,61 @@
1
+ .aw-page-header {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 1rem;
5
+ padding: var(--header-padding-top) 1.5rem var(--header-padding-bottom);
6
+ height: var(--header-height);
7
+
8
+ position: relative;
9
+
10
+ .aw-progress {
11
+ position: absolute;
12
+ bottom: 2px;
13
+ left: 0;
14
+ }
15
+
16
+ &--primary {
17
+ @apply bg-surface;
18
+ }
19
+
20
+ &__title {
21
+ @apply font-body;
22
+
23
+ flex: 1 0 50%;
24
+
25
+ display: -webkit-box;
26
+ -webkit-line-clamp: 2;
27
+ -webkit-box-orient: vertical;
28
+ overflow: hidden;
29
+
30
+ margin: 0;
31
+
32
+ font-size: 0.875rem;
33
+ line-height: 1.4285;
34
+ font-weight: 700;
35
+ text-align: center;
36
+ }
37
+
38
+ &__breadcrumbs,
39
+ &__buttons {
40
+ flex: 1 1 25%;
41
+
42
+ display: flex;
43
+ gap: 1rem;
44
+ }
45
+
46
+ &__buttons {
47
+ justify-content: flex-end;
48
+ }
49
+ }
50
+
51
+ @screen lg {
52
+ .aw-page-header {
53
+ padding-left: 2.5rem;
54
+ padding-right: 2.5rem;
55
+
56
+ &__title {
57
+ font-size: 1.25rem;
58
+ line-height: 1.2;
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,186 @@
1
+ .aw-page-single {
2
+ @apply bg-page-bg;
3
+
4
+ display: flex;
5
+ flex-direction: column;
6
+ min-height: 100dvh;
7
+
8
+ &__header {
9
+ box-shadow: none;
10
+
11
+ transition: none;
12
+
13
+ z-index: 10;
14
+
15
+ &--is-stuck {
16
+ box-shadow: 0px 10px 20px 0px rgba(0, 19, 106, 0.1);
17
+
18
+ transition: 60ms box-shadow 120ms;
19
+ animation: aw-page-single-header-slide 180ms ease-out;
20
+
21
+ position: sticky;
22
+ top: 0;
23
+ }
24
+ }
25
+
26
+ &__container {
27
+ flex-grow: 1;
28
+
29
+ display: flex;
30
+ flex-direction: column;
31
+ gap: 1.5rem;
32
+
33
+ padding-top: 1rem;
34
+ padding-bottom: 0;
35
+ }
36
+
37
+ &__content {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 1.5rem;
41
+ }
42
+
43
+ &__mobile-title {
44
+ order: -4;
45
+
46
+ padding: 0 1.5rem;
47
+
48
+ font-size: 1.5rem;
49
+ line-height: 1;
50
+ font-weight: bold;
51
+ }
52
+
53
+ &__mobile-description {
54
+ order: -3;
55
+
56
+ padding: 0 1.5rem;
57
+ margin-top: -1rem;
58
+ }
59
+
60
+ &__preview {
61
+ &--reverse {
62
+ order: -1;
63
+ }
64
+ }
65
+
66
+ &__top-scroll-mark {
67
+ order: -3;
68
+ height: 1px;
69
+ margin-top: -1.5rem;
70
+ margin-bottom: -1px;
71
+ }
72
+
73
+ &__mobile-action-button {
74
+ display: grid;
75
+
76
+ padding: 1rem 2rem;
77
+
78
+ position: sticky;
79
+ bottom: 0;
80
+
81
+ &--is-stuck {
82
+ background: rgba(255, 255, 255, 0.03);
83
+ backdrop-filter: blur(5px);
84
+ }
85
+ }
86
+
87
+ &__bottom-scroll-mark {
88
+ margin-top: -1.5rem;
89
+ }
90
+ }
91
+
92
+ @screen sm {
93
+ .aw-page-single {
94
+ &__container--preview {
95
+ padding-left: 1.5rem;
96
+ padding-right: 1.5rem;
97
+ }
98
+
99
+ &__mobile-title,
100
+ &__mobile-description {
101
+ padding: 0;
102
+ }
103
+
104
+ &__mobile-action-button {
105
+ padding-left: 1.5rem;
106
+ padding-right: 1.5rem;
107
+
108
+ margin-left: -1.5rem;
109
+ margin-right: -1.5rem;
110
+ }
111
+ }
112
+ }
113
+
114
+ @screen lg {
115
+ .aw-page-single {
116
+ &__header {
117
+ position: sticky;
118
+ top: 0;
119
+
120
+ &--is-stuck {
121
+ animation: none;
122
+ }
123
+ }
124
+
125
+ &__container {
126
+ padding-top: 2rem;
127
+ padding-bottom: 10rem;
128
+
129
+ &--preview {
130
+ display: grid;
131
+ grid-template-columns: minmax(1rem, 1fr) minmax(0, max-content);
132
+ justify-content: center;
133
+ align-content: start;
134
+ gap: 0;
135
+
136
+ padding-left: 2.5rem;
137
+ padding-right: 2.5rem;
138
+ margin: 0 auto;
139
+ max-width: 70.25rem;
140
+ }
141
+ }
142
+
143
+ &__mobile-title,
144
+ &__mobile-description {
145
+ display: none;
146
+ }
147
+
148
+ &__top-scroll-mark {
149
+ margin-top: calc(-2rem - var(--header-height, 0px));
150
+ margin-bottom: calc(var(--header-height, 0px) + 0.5rem);
151
+ grid-column: 1 / -1;
152
+ }
153
+
154
+ &__content--column {
155
+ width: 40rem;
156
+ max-width: 100%;
157
+ }
158
+
159
+ &__preview {
160
+ &--column {
161
+ align-self: start;
162
+ order: unset;
163
+
164
+ width: 23.75rem;
165
+ margin-left: 1.5rem;
166
+
167
+ position: sticky;
168
+ top: calc(var(--header-height, 0px) + 2rem);
169
+ }
170
+
171
+ /* &--header-sticky {
172
+ transition: top 180ms ease-out;
173
+ } */
174
+ }
175
+ }
176
+ }
177
+
178
+ @keyframes aw-page-single-header-slide {
179
+ from {
180
+ transform: translateY(-100%);
181
+ }
182
+
183
+ to {
184
+ transform: translateY(0);
185
+ }
186
+ }
@@ -0,0 +1,23 @@
1
+ .aw-progress {
2
+ height: 0;
3
+ width: 100%;
4
+
5
+ position: relative;
6
+
7
+ &::after {
8
+ content: '';
9
+ display: block;
10
+
11
+ width: 100%;
12
+ height: 2px;
13
+ background-color: var(--color);
14
+
15
+ transform-origin: left;
16
+ transform: scaleX(var(--progress));
17
+
18
+ position: absolute;
19
+ top: 0;
20
+ left: 0;
21
+ z-index: 1;
22
+ }
23
+ }
@@ -9,6 +9,20 @@
9
9
 
10
10
  &__user {
11
11
  cursor: pointer;
12
+
13
+ &--outline {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 0.25rem;
17
+
18
+ padding: 0.75rem;
19
+ border-radius: 0.625rem;
20
+ box-shadow: 0 0 0 2px var(--c-mono-800) inset;
21
+
22
+ &:hover {
23
+ @apply bg-mono-800;
24
+ }
25
+ }
12
26
  }
13
27
 
14
28
  &__header {
@@ -21,7 +35,7 @@
21
35
  &__name {
22
36
  font-size: 1rem;
23
37
  line-height: 1.5rem;
24
- }
38
+ }
25
39
 
26
40
  &__content {
27
41
  margin-left: 0;
@@ -75,7 +89,7 @@
75
89
  &.aw-dropdown--desktop {
76
90
  max-width: 17.625rem;
77
91
  min-width: 17.625rem;
78
- }
92
+ }
79
93
  }
80
94
 
81
95
  &__nav-item {
@@ -113,3 +127,14 @@
113
127
  }
114
128
  }
115
129
  }
130
+
131
+ @screen lg {
132
+ .aw-user-menu {
133
+ &__user {
134
+ &--outline {
135
+ padding-top: 0.5rem;
136
+ padding-bottom: 0.5rem;
137
+ }
138
+ }
139
+ }
140
+ }
@@ -1,3 +1,5 @@
1
+ import { CUSTOM_COLORS, toColor, toOnColor } from './styles'
2
+
1
3
  export const TABLE_INDEX_ATTR = 'data-row-index'
2
4
 
3
5
  export const TABLE_ROW_CLICK_EVENT = 'click:row'
@@ -10,26 +12,10 @@ export const TABLE_DATA_FETCHED = 'data-fetched'
10
12
 
11
13
  export const FORM_ENTER_SKIP_ATTR = 'data-enter-skip'
12
14
 
13
- export const COLORS = [
14
- '#E0AB61',
15
- '#E29D5D',
16
- '#E68262',
17
- '#E45284',
18
- '#DF54BD',
19
- '#DA61D9',
20
- '#BF55CF',
21
- '#AF57DB',
22
- '#9C55D3',
23
- '#834EE3',
24
- '#634EE3',
25
- '#594FCF',
26
- '#6086E3',
27
- '#66B9E4',
28
- '#66C3D1',
29
- '#66C7B9',
30
- '#5CBC98',
31
- '#9A6F66'
32
- ]
15
+ export const COLORS = Object.keys(CUSTOM_COLORS).map((color) => ({
16
+ color: toColor(color),
17
+ onColor: toOnColor(color)
18
+ }))
33
19
 
34
20
  export const TEST_ID_ATTR = 'data-testid'
35
21
 
@@ -1,7 +1,21 @@
1
1
  <template>
2
- <Component :is="tag" :style="sizeVariables" class="aw-avatar">
2
+ <Component
3
+ :is="tag"
4
+ :style="sizeVariables"
5
+ class="aw-avatar"
6
+ :class="{ 'aw-avatar--square': square }"
7
+ >
3
8
  <!-- image -->
4
- <slot v-bind="{ src, name, initials, color, imageError }">
9
+ <slot
10
+ v-bind="{
11
+ src,
12
+ name,
13
+ initials,
14
+ color: color.background,
15
+ onColor: color.text,
16
+ imageError
17
+ }"
18
+ >
5
19
  <img
6
20
  v-if="src && !imageError"
7
21
  :src="src"
@@ -15,7 +29,8 @@
15
29
  (type === 'initials' || type === 'empty')
16
30
  "
17
31
  :style="{
18
- backgroundColor: color
32
+ backgroundColor: color.background,
33
+ color: color.text
19
34
  }"
20
35
  >
21
36
  {{ type === 'initials' ? initials : '' }}
@@ -23,7 +38,12 @@
23
38
  </slot>
24
39
 
25
40
  <!-- no image placeholder -->
26
- <slot name="no-img" :initials="initials" :color="color">
41
+ <slot
42
+ name="no-img"
43
+ :initials="initials"
44
+ :color="color.background"
45
+ :onColor="color.text"
46
+ >
27
47
  <svg
28
48
  v-if="(imageError || !src) && type === 'no-img'"
29
49
  xmlns="http://www.w3.org/2000/svg"
@@ -31,7 +51,7 @@
31
51
  class="aw-avatar__no-img-icon"
32
52
  >
33
53
  <path
34
- :fill="color"
54
+ :fill="color.background"
35
55
  d="M248 8a248 248 0 100 496 248 248 0 000-496zm0 96a88 88 0 110 176 88 88 0 010-176zm0 344c-59 0-111-27-146-68 18-36 55-60 98-60l7 1c13 4 27 7 41 7s28-3 41-7l7-1c43 0 80 24 99 60-36 41-88 68-147 68z"
36
56
  />
37
57
  </svg>
@@ -49,6 +69,7 @@ import { memoize } from 'rambdax'
49
69
  import { hashStringToIndex } from '@AwUtils/string'
50
70
  import { conf } from '@AwUtils/component'
51
71
  import { AwAvatar as _config } from '@AwConfig'
72
+ import { toColor, toOnColor } from '../../assets/js/styles'
52
73
 
53
74
  const memoizedHasher = memoize(hashStringToIndex)
54
75
 
@@ -109,7 +130,9 @@ export default {
109
130
  default() {
110
131
  return conf(this, 'colors')
111
132
  }
112
- }
133
+ },
134
+
135
+ square: Boolean
113
136
  },
114
137
 
115
138
  data() {
@@ -150,11 +173,19 @@ export default {
150
173
 
151
174
  // Get random color from the preset list
152
175
  color() {
153
- if (!this.isColored) return null
176
+ if (!this.isColored) {
177
+ return {
178
+ background: toColor('mono-400'),
179
+ text: toOnColor('mono-400')
180
+ }
181
+ }
154
182
 
155
183
  const index = memoizedHasher(this.name.trim(), this.colors.length)
156
184
 
157
- return this.colors[index]
185
+ return {
186
+ background: this.colors[index]?.onColor,
187
+ text: this.colors[index]?.color
188
+ }
158
189
  },
159
190
 
160
191
  isLoading() {