@awes-io/ui 2.84.0 → 2.87.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/assets/css/components/_index.css +5 -0
  3. package/assets/css/components/action-button.css +53 -0
  4. package/assets/css/components/action-card-body.css +20 -0
  5. package/assets/css/components/action-card.css +36 -0
  6. package/assets/css/components/action-icon.css +45 -0
  7. package/assets/css/components/avatar.css +1 -0
  8. package/assets/css/components/button-fixed.css +4 -4
  9. package/assets/css/components/button-nav.css +39 -18
  10. package/assets/css/components/button.css +154 -493
  11. package/assets/css/components/context-menu.css +6 -0
  12. package/assets/css/components/dropdown-button.css +1 -1
  13. package/assets/css/components/filter-month.css +17 -0
  14. package/assets/css/components/icon.css +26 -0
  15. package/assets/css/components/mobile-menu.css +2 -2
  16. package/assets/css/components/modal.css +4 -4
  17. package/assets/css/components/page-menu-buttons.css +3 -3
  18. package/assets/css/components/square-icon-button.css +69 -0
  19. package/assets/css/components/text-field.css +4 -0
  20. package/assets/css/components/user-menu.css +8 -8
  21. package/assets/css/typography.css +13 -1
  22. package/assets/js/icons/animated.js +7 -0
  23. package/assets/js/styles.js +15 -13
  24. package/components/1_atoms/AwActionCard.vue +77 -0
  25. package/components/1_atoms/AwActionCardBody.vue +19 -0
  26. package/components/1_atoms/AwActionIcon.vue +150 -0
  27. package/components/1_atoms/AwDropdown.vue +1 -2
  28. package/components/1_atoms/AwDropdownButton.vue +2 -5
  29. package/components/1_atoms/AwIcon/AwIcon.vue +47 -21
  30. package/components/1_atoms/AwLabel.vue +9 -6
  31. package/components/2_molecules/AwActionButton.vue +110 -0
  32. package/components/2_molecules/AwButton.vue +36 -81
  33. package/components/2_molecules/AwIsland/AwIsland.vue +4 -3
  34. package/components/2_molecules/AwSelect.vue +10 -7
  35. package/components/2_molecules/AwSelectObject.vue +1 -0
  36. package/components/2_molecules/AwSquareIconButton.vue +52 -0
  37. package/components/2_molecules/AwTabNav.vue +8 -3
  38. package/components/3_organisms/AwAddressBlock.vue +4 -7
  39. package/components/3_organisms/AwCodeSnippet.vue +2 -1
  40. package/components/3_organisms/AwContextMenu.vue +14 -4
  41. package/components/3_organisms/AwFilterMonth.vue +10 -14
  42. package/components/3_organisms/AwModal.vue +5 -8
  43. package/components/3_organisms/AwModelEdit.vue +2 -4
  44. package/components/3_organisms/AwPagination.vue +15 -19
  45. package/components/3_organisms/AwTable/AwTableBuilder.vue +2 -2
  46. package/components/4_pages/AwPage.vue +1 -1
  47. package/components/4_pages/AwPageSingle.vue +4 -7
  48. package/components/4_pages/_AwButtonFixed.vue +3 -1
  49. package/components/4_pages/_AwPageHeadline.vue +7 -9
  50. package/components/5_layouts/_AwMobileMenu.vue +21 -26
  51. package/components/5_layouts/_AwUserMenu.vue +5 -3
  52. package/mixins/button.js +10 -2
  53. package/nuxt/awes.config.js +1 -1
  54. package/package.json +2 -2
@@ -1,5 +1,8 @@
1
1
  <script>
2
- import { isNil } from 'rambdax'
2
+ import { isNil, mergeDeepRight } from 'rambdax'
3
+ import { VIEW_BOX, ICONS as ANIMATED_ICONS } from '@AwUtils/icons/animated'
4
+
5
+ const staticClass = 'aw-icon'
3
6
 
4
7
  export default {
5
8
  name: 'AwIcon',
@@ -31,27 +34,50 @@ export default {
31
34
  render(h, { props: { name, color, size, viewBox }, data }) {
32
35
  const attrs = data.attrs || {}
33
36
 
34
- return name
35
- ? h('SvgIcon', {
36
- props: { name, viewBox },
37
- staticClass: 'aw-icon',
38
- class: [
39
- data.class,
40
- data.staticClass,
41
- {
42
- 'aw-icon--size-text':
43
- !size && isNil(attrs.width) && isNil(attrs.height)
37
+ const aniamtedIconContent = ANIMATED_ICONS[name]
38
+
39
+ const getOptions = (overrides = {}) =>
40
+ mergeDeepRight(
41
+ {
42
+ staticClass,
43
+ class: [
44
+ data.class,
45
+ data.staticClass,
46
+ {
47
+ 'aw-icon--size-text':
48
+ !size &&
49
+ isNil(attrs.width) &&
50
+ isNil(attrs.height),
51
+ 'aw-icon--animated': !!aniamtedIconContent
52
+ }
53
+ ],
54
+ style: [data.style, data.staticStyle].concat(
55
+ color ? { fill: `var(--c-${color})` } : []
56
+ ),
57
+ attrs: {
58
+ 'aria-hidden': true,
59
+ width: size || null,
60
+ height: size || null,
61
+ ...attrs
62
+ }
63
+ },
64
+ overrides
65
+ )
66
+
67
+ return aniamtedIconContent
68
+ ? h('svg', {
69
+ ...getOptions({
70
+ attrs: {
71
+ viewBox: VIEW_BOX,
72
+ xmlns: 'http://www.w3.org/2000/svg'
44
73
  }
45
- ],
46
- style: [data.style, data.staticStyle].concat(
47
- color ? { fill: `var(--c-${color})` } : []
48
- ),
49
- attrs: {
50
- 'aria-hidden': true,
51
- width: size || null,
52
- height: size || null,
53
- ...attrs
54
- }
74
+ }),
75
+ domProps: { innerHTML: aniamtedIconContent }
76
+ })
77
+ : name
78
+ ? h('SvgIcon', {
79
+ ...getOptions(),
80
+ props: { name, viewBox }
55
81
  })
56
82
  : null
57
83
  }
@@ -1,9 +1,5 @@
1
1
  <template>
2
- <div
3
- v-if="label"
4
- class="aw-label"
5
- :style="styleVariables"
6
- >
2
+ <div v-if="label" class="aw-label" :style="styleVariables">
7
3
  <span
8
4
  class="aw-label__wrapper relative inline-flex items-center leading-5 px-2 rounded-lg"
9
5
  >
@@ -56,7 +52,7 @@ export default {
56
52
 
57
53
  color: {
58
54
  type: String,
59
- default: 'green'
55
+ default: ''
60
56
  },
61
57
 
62
58
  onColor: {
@@ -97,6 +93,13 @@ export default {
97
93
  },
98
94
 
99
95
  styleVariables() {
96
+ if (!this.color && !this.onColor) {
97
+ return {
98
+ '--aw-label-bg': 'var(--c-mono-900)',
99
+ '--aw-label-on-color': 'var(--c-mono-400)'
100
+ }
101
+ }
102
+
100
103
  return {
101
104
  '--aw-label-bg': this.isCustomColor
102
105
  ? toColor(this.color)
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <Component
3
+ :is="_linkComponent"
4
+ class="aw-action-button"
5
+ v-bind="{
6
+ ..._linkAttrs,
7
+ class: {
8
+ 'aw-animated-icon-parent': isAnimatedIcon,
9
+ 'aw-action-button--outline': modifiers.includes('outline'),
10
+ 'aw-action-button--narrow': modifiers.includes('narrow')
11
+ }
12
+ }"
13
+ v-on="$listeners"
14
+ >
15
+ <slot name="icon-wrapper">
16
+ <AwActionIcon
17
+ v-if="icon"
18
+ class="aw-action-button__icon-wrapper"
19
+ :icon="icon"
20
+ :color="iconColor"
21
+ :on-color="iconOnColor"
22
+ :size="iconSize"
23
+ />
24
+ </slot>
25
+
26
+ <span class="aw-action-button__text">
27
+ <slot :text="text">{{ text }}</slot>
28
+
29
+ <AwDescription
30
+ v-if="description"
31
+ class="aw-action-button__description"
32
+ >
33
+ {{ description }}
34
+ </AwDescription>
35
+ </span>
36
+
37
+ <AwActionIcon v-if="iconRight" :icon="iconRight" size="sm" color="mono-900" />
38
+
39
+ <AwDescription
40
+ v-if="subdescription"
41
+ class="aw-action-button__subdescription"
42
+ >
43
+ {{ subdescription }}
44
+ </AwDescription>
45
+ </Component>
46
+ </template>
47
+
48
+ <script>
49
+ import { isAnimatedIcon } from '@AwUtils/icons/animated'
50
+ import linkMixin from '@AwMixins/link'
51
+
52
+ export default {
53
+ name: 'AwActionButton',
54
+
55
+ mixins: [linkMixin],
56
+
57
+ props: {
58
+ icon: {
59
+ type: String,
60
+ default: ''
61
+ },
62
+
63
+ iconColor: {
64
+ type: String,
65
+ default: 'green'
66
+ },
67
+
68
+ iconOnColor: {
69
+ type: String,
70
+ default: null
71
+ },
72
+
73
+ iconSize: {
74
+ type: String,
75
+ default: 'md'
76
+ },
77
+
78
+ text: {
79
+ type: String,
80
+ default: ''
81
+ },
82
+
83
+ description: {
84
+ type: String,
85
+ default: ''
86
+ },
87
+
88
+ subdescription: {
89
+ type: String,
90
+ default: ''
91
+ },
92
+
93
+ iconRight: {
94
+ type: String,
95
+ default: 'arrow-animated'
96
+ },
97
+
98
+ modifiers: {
99
+ type: [String, Array],
100
+ default: ''
101
+ }
102
+ },
103
+
104
+ computed: {
105
+ isAnimatedIcon() {
106
+ return isAnimatedIcon(this.iconRight)
107
+ }
108
+ }
109
+ }
110
+ </script>
@@ -2,13 +2,12 @@
2
2
  <component
3
3
  :is="_linkComponent"
4
4
  class="aw-button"
5
- :class="classes"
5
+ :class="[classes, contentClass]"
6
6
  :disabled="isDisabled"
7
+ :aria-label="$attrs['aria-label'] || text || null"
7
8
  v-bind="_linkAttrs"
8
9
  v-on="$listeners"
9
10
  >
10
- <span class="aw-button__overlay"></span>
11
-
12
11
  <AwIconSystemColor
13
12
  v-if="loading"
14
13
  class="aw-button__loader"
@@ -16,70 +15,50 @@
16
15
  />
17
16
 
18
17
  <span
19
- class="aw-button__content"
20
- :class="[
21
- {
22
- 'aw-button__content_sm': size === 'sm',
23
- 'aw-button__content_md': size === 'md',
24
- 'aw-button__content_lg': size === 'lg',
25
- 'aw-button__content_no-text': mobileTextHidden
26
- },
27
- contentClass
28
- ]"
29
- tabindex="-1"
18
+ v-else-if="locked"
19
+ class="aw-button__lock"
20
+ v-tooltip="lockedTooltip"
30
21
  >
31
- <slot name="icon" v-bind="{ icon, iconSize }">
22
+ <span>
23
+ <AwIconSystemMono name="lock" />
24
+ </span>
25
+ </span>
26
+
27
+ <template v-else>
28
+ <slot name="icon" v-bind="{ icon }">
32
29
  <AwIcon
33
30
  v-if="icon"
31
+ class="aw-button__icon-left"
32
+ :class="{ 'mr-2': text }"
34
33
  :name="icon"
35
- class="flex-shrink-0"
36
- :size="iconSize"
34
+ :size="16"
37
35
  />
38
36
  </slot>
39
37
 
40
- <span
41
- class="aw-button__text"
42
- :class="{
43
- 'hidden lg:block': mobileTextHidden,
44
- 'sr-only': (theme === 'icon' || theme === 'circle') && icon,
45
- 'ml-2': icon && isContentAdded,
46
- 'mr-2': iconRight && isContentAdded
47
- }"
48
- >
49
- <slot>{{ text }}</slot>
50
- </span>
38
+ <slot v-if="!hideText">
39
+ <span class="aw-button__text">
40
+ {{ text }}
41
+ </span>
42
+ </slot>
51
43
 
52
- <slot name="icon-right" v-bind="{ iconRight, iconSize }">
44
+ <slot name="iconRight" v-bind="{ iconRight }">
53
45
  <AwIcon
54
46
  v-if="iconRight"
47
+ class="aw-button__icon-right"
48
+ :class="{ 'ml-2': text }"
55
49
  :name="iconRight"
56
- class="flex-shrink-0"
57
- :size="iconSize"
50
+ :size="16"
58
51
  />
59
52
  </slot>
60
- </span>
61
-
62
- <span v-if="locked" class="aw-button__lock" v-tooltip="lockedTooltip">
63
- <span>
64
- <AwIconSystemMono name="lock" />
65
- </span>
66
- </span>
53
+ </template>
67
54
  </component>
68
55
  </template>
69
56
 
70
57
  <script>
71
58
  import AwLink from '@AwAtoms/AwLink.vue'
72
- import { pathOr } from 'rambdax'
73
59
  import { AwButton as _config } from '@AwConfig'
74
60
  import { conf } from '@AwUtils/component'
75
61
 
76
- const iconSizes = {
77
- xs: 10,
78
- sm: 12,
79
- md: 14,
80
- lg: 16
81
- }
82
-
83
62
  export default {
84
63
  name: 'AwButton',
85
64
 
@@ -96,7 +75,7 @@ export default {
96
75
  }
97
76
  },
98
77
 
99
- // Background color of button. Possible values: 'info', 'success', 'warning', 'error', 'surface'
78
+ // Background color of button. Possible values: 'accent', 'error', 'mono', 'dark'
100
79
  color: {
101
80
  type: String,
102
81
  default() {
@@ -104,7 +83,7 @@ export default {
104
83
  }
105
84
  },
106
85
 
107
- // Possible values: outline, ghost
86
+ // Possible values: solid, outline, icon
108
87
  theme: {
109
88
  type: String,
110
89
  default() {
@@ -136,11 +115,6 @@ export default {
136
115
  default: ''
137
116
  },
138
117
 
139
- // Active state
140
- active: Boolean,
141
-
142
- mobileTextHidden: Boolean,
143
-
144
118
  // Show lock icon and disable button
145
119
  locked: Boolean,
146
120
 
@@ -148,27 +122,23 @@ export default {
148
122
  lockedTooltip: {
149
123
  type: String,
150
124
  default: ''
151
- }
152
- },
125
+ },
153
126
 
154
- data() {
155
- return {
156
- isPressed: false
157
- }
127
+ hideText: Boolean
158
128
  },
159
129
 
160
130
  computed: {
161
131
  classes() {
162
132
  return [
163
133
  {
164
- 'is-active': this.active,
165
- 'is-loading': this.loading,
166
- 'aw-button_sm': this.size === 'sm',
167
- 'aw-button_md': this.size === 'md',
168
- 'aw-button_lg': this.size === 'lg'
134
+ 'aw-button--size-sm': this.size === 'sm',
135
+ 'aw-button--size-md': this.size === 'md',
136
+ 'aw-button--size-lg': this.size === 'lg',
137
+ 'aw-button--loading': this.loading,
138
+ 'aw-button--square': this.hideText
169
139
  },
170
- `color-${this.color || 'default'}`,
171
- this.theme && `theme-${this.theme}`
140
+ `aw-button--color-${this.color || 'green'}`,
141
+ `aw-button--theme-${this.theme || 'solid'}`
172
142
  ]
173
143
  },
174
144
 
@@ -179,21 +149,6 @@ export default {
179
149
  this.loading ||
180
150
  this.locked
181
151
  )
182
- },
183
-
184
- isContentAdded() {
185
- return this.text || this.$scopedSlots.default
186
- },
187
-
188
- // loadingText() {
189
- // return (
190
- // (isType('String', this.loading) && this.loading) ||
191
- // this.$t('Loading...')
192
- // )
193
- // },
194
-
195
- iconSize() {
196
- return pathOr(12, this.size, iconSizes)
197
152
  }
198
153
  },
199
154
 
@@ -42,7 +42,9 @@
42
42
  class="aw-island__description"
43
43
  >
44
44
  <slot name="description" v-bind="{ isOpened, toggle }">
45
- <AwDescription tag="div">{{ description }}</AwDescription>
45
+ <AwDescription tag="div">{{
46
+ description
47
+ }}</AwDescription>
46
48
  </slot>
47
49
  </div>
48
50
 
@@ -101,8 +103,7 @@
101
103
  <template v-else>
102
104
  <AwButton
103
105
  text="Reset"
104
- color="default"
105
- theme="ghost"
106
+ color="mono"
106
107
  :disabled="model.saving"
107
108
  @click="reset"
108
109
  />
@@ -54,13 +54,15 @@
54
54
  <AwButton
55
55
  v-if="_isCreateButton"
56
56
  v-show="!isEditing"
57
- theme="icon"
58
57
  type="button"
58
+ theme="icon"
59
59
  @click="_onAddClick"
60
60
  >
61
- <slot name="create-icon">
62
- <AwIconSystemMono name="add-circle" size="20" />
63
- </slot>
61
+ <template #icon>
62
+ <slot name="create-icon">
63
+ <AwIconSystemMono name="add-circle" size="20" />
64
+ </slot>
65
+ </template>
64
66
  </AwButton>
65
67
 
66
68
  <AwButton
@@ -73,11 +75,11 @@
73
75
  <AwIconSystemMono name="close" />
74
76
  </AwButton>
75
77
  <AwButton
76
- :size="$attrs.size || 'md'"
77
78
  tabindex="-1"
78
- theme="icon"
79
79
  type="button"
80
80
  class="h-full"
81
+ theme="icon"
82
+ :size="$attrs.size || 'md'"
81
83
  @click="searchable ? toggleDropdown() : null"
82
84
  >
83
85
  <AwIconSystemColor
@@ -86,6 +88,7 @@
86
88
  name="spinner"
87
89
  class="h-5 w-5"
88
90
  />
91
+
89
92
  <AwIconSystemMono
90
93
  v-if="
91
94
  !isLoading &&
@@ -150,9 +153,9 @@
150
153
  <AwIconSystemMono name="close" />
151
154
  </AwButton>
152
155
  <AwButton
153
- :size="$attrs.size || 'md'"
154
156
  tabindex="-1"
155
157
  theme="icon"
158
+ :size="$attrs.size || 'md'"
156
159
  class="h-full"
157
160
  @click="searchable ? toggleDropdown() : null"
158
161
  >
@@ -67,6 +67,7 @@
67
67
  <slot name="caret" v-bind="data" />
68
68
  </template>
69
69
  </AwSelectFakeInput>
70
+
70
71
  <AwSelectInput
71
72
  v-else
72
73
  ref="input"
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <component
3
+ class="aw-square-icon-button"
4
+ :class="classes"
5
+ :is="_linkComponent"
6
+ :disabled="isDisabled"
7
+ v-bind="_linkAttrs"
8
+ v-on="$listeners"
9
+ >
10
+ <slot>
11
+ <AwIcon :name="icon" :size="iconSize" />
12
+ </slot>
13
+ </component>
14
+ </template>
15
+
16
+ <script>
17
+ import AwLink from '@AwAtoms/AwLink.vue'
18
+
19
+ export default {
20
+ name: 'AwSquareIconButton',
21
+
22
+ extends: AwLink,
23
+
24
+ props: {
25
+ icon: {
26
+ type: String,
27
+ default: 'close'
28
+ },
29
+
30
+ iconSize: {
31
+ type: [String, Number],
32
+ default: 16
33
+ },
34
+
35
+ // Possible values: mono-900, mono-800, mono-700, mono-600
36
+ color: {
37
+ type: String,
38
+ default: 'mono-900'
39
+ }
40
+ },
41
+
42
+ computed: {
43
+ classes() {
44
+ return [`aw-square-icon-button--color-${this.color || 'mono-900'}`]
45
+ },
46
+
47
+ isDisabled() {
48
+ return this.$attrs.disabled === true || this.$attrs.disabled === ''
49
+ }
50
+ }
51
+ }
52
+ </script>
@@ -8,9 +8,14 @@
8
8
  [`${_cssClasses.base}--without-min-with`]: modifiers.includes(
9
9
  'without-min-with'
10
10
  ),
11
- [`${_cssClasses.base}--fullwidth`]: modifiers.includes(
12
- 'fullwidth'
13
- )
11
+ [`${_cssClasses.base}--expand`]:
12
+ (modifiers.includes('expand') ||
13
+ !modifiers.includes('always-small')) &&
14
+ !modifiers.includes('without-min-with'),
15
+ [`${_cssClasses.base}--fullwidth`]:
16
+ modifiers.includes('fullwidth') &&
17
+ !modifiers.includes('always-small') &&
18
+ !modifiers.includes('without-min-with')
14
19
  }
15
20
  ]"
16
21
  @resized="scrollToActive(false)"
@@ -15,9 +15,8 @@
15
15
  <!-- Address info -->
16
16
  <AwAccordionFold :show="hasAddress">
17
17
  <div class="flex justify-end relative w-full">
18
- <AwButton
18
+ <AwSquareIconButton
19
19
  icon="edit"
20
- theme="circle"
21
20
  class="edit-button"
22
21
  @click="openModal(null)"
23
22
  />
@@ -175,11 +174,7 @@
175
174
  @click="saveAddress"
176
175
  />
177
176
 
178
- <AwButton
179
- color="default"
180
- theme="ghost"
181
- @click="resetAddress"
182
- >
177
+ <AwButton color="mono" @click="resetAddress">
183
178
  <span class="text-dark-blue">
184
179
  {{ $t('Cancel') }}
185
180
  </span>
@@ -193,6 +188,7 @@
193
188
  <script>
194
189
  import { clone } from 'rambdax'
195
190
  import { makePreventableEventMock } from '@AwUtils/events'
191
+ import AwSquareIconButton from '../2_molecules/AwSquareIconButton.vue'
196
192
 
197
193
  const BASE = {
198
194
  description: null,
@@ -216,6 +212,7 @@ const BASE = {
216
212
 
217
213
  export default {
218
214
  name: 'AwAddressBlock',
215
+ components: { AwSquareIconButton },
219
216
 
220
217
  props: {
221
218
  model: {
@@ -46,7 +46,8 @@ export default {
46
46
  staticClass: 'absolute top-0 right-0 mr-4 mt-4',
47
47
  props: {
48
48
  size: 'sm',
49
- color: 'surface'
49
+ color: 'mono',
50
+ theme: 'outline'
50
51
  },
51
52
  on: {
52
53
  click: () => copyFn(props.code)
@@ -27,7 +27,10 @@ export default {
27
27
  default: ''
28
28
  },
29
29
 
30
- hideText: Boolean
30
+ hideText: {
31
+ type: Boolean,
32
+ default: null
33
+ }
31
34
  },
32
35
 
33
36
  render(h) {
@@ -77,9 +80,10 @@ export default {
77
80
 
78
81
  const button = h('AwButton', {
79
82
  props: {
80
- theme: 'ghost',
81
- color: 'default',
82
- text: this.hideText ? '' : this.text
83
+ theme: 'outline',
84
+ color: 'mono',
85
+ text: this.hideText ? '' : this.text,
86
+ hideText: this.hideText === null ? !this.text : this.hideText
83
87
  },
84
88
  staticClass: this.buttonClass,
85
89
  class: { 'aw-context-menu--text': this.text && !this.hideText },
@@ -95,6 +99,12 @@ export default {
95
99
  props: {
96
100
  name: 'more',
97
101
  rotate: this.vertical ? 90 : null
102
+ },
103
+ class: {
104
+ 'mr-2':
105
+ this.hideText === null
106
+ ? this.text
107
+ : !this.hideText
98
108
  }
99
109
  })
100
110
  }