@awes-io/ui 2.64.0 → 2.66.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,55 @@
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.66.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.65.1...@awes-io/ui@2.66.0) (2023-08-22)
7
+
8
+
9
+ ### Features
10
+
11
+ * add group and disable for select object ([756348a](https://github.com/awes-io/client/commit/756348a0a3f49e4a60cec7e112046ebccea29682))
12
+ * add group and disable for select object ([e252ddb](https://github.com/awes-io/client/commit/e252ddb6b29f366eec82ffd0631e2ebd69453bee))
13
+ * add refresh wrapper in table builder ([2727c01](https://github.com/awes-io/client/commit/2727c017b6d3ce0d05bd469181fa6bbc256f44d6))
14
+ * add refresh wrapper in table builder ([5e2d058](https://github.com/awes-io/client/commit/5e2d058e6f1adb80c469bb75be70e1bf1ce1d49f))
15
+ * change din on template for select object items ([bb7ba13](https://github.com/awes-io/client/commit/bb7ba130aebc2c27d0aa9f61de3b9f9c9db16266))
16
+ * change logic for clear events in refresh wrapper ([67f6c4c](https://github.com/awes-io/client/commit/67f6c4c1f4f552e25a21d717ff3fb4b2e8ebb64d))
17
+ * change styles and add arrow for tooltip ([6e4f495](https://github.com/awes-io/client/commit/6e4f495ecf6331e894bb600182487daf64a71e7a))
18
+ * remove all place with postcss-color-function ([a53bd65](https://github.com/awes-io/client/commit/a53bd6572d6ac4f2fc8ebfb55522e642a78bf494))
19
+ * remove plugins for update nuxt ([b230f4b](https://github.com/awes-io/client/commit/b230f4becab4af6befbb9a92a7dd8dcdf5872961))
20
+ * replace method for remove refresh wrapper events ([e63d9df](https://github.com/awes-io/client/commit/e63d9dfd58108668ac324dce32cfb52e37fbdfbe))
21
+ * replace style for fake input disable in text field css ([29f3d5f](https://github.com/awes-io/client/commit/29f3d5f8c4cf66e56beee686dd6d94b332cfffdd))
22
+ * unused modules removed ([09334f1](https://github.com/awes-io/client/commit/09334f1677a837df5eac8c4063e4a55941fde40e))
23
+
24
+
25
+
26
+
27
+
28
+ ## [2.65.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.65.0...@awes-io/ui@2.65.1) (2023-07-06)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **aw-tab-nav:** else key fixed ([fac9f72](https://github.com/awes-io/client/commit/fac9f7214606540f95fa8aa5e57782b7ad837a10))
34
+
35
+
36
+
37
+
38
+
39
+ # [2.65.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.64.0...@awes-io/ui@2.65.0) (2023-07-06)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * tooltip shown on pointer events ([a1827a1](https://github.com/awes-io/client/commit/a1827a142e5b823ba526bce0e90ccf7a5a36dc20))
45
+
46
+
47
+ ### Features
48
+
49
+ * **aw-tab-nav:** icons added ([eb1c876](https://github.com/awes-io/client/commit/eb1c87634e47f7ca15593fd82fb5d685ffa4e9b6))
50
+
51
+
52
+
53
+
54
+
6
55
  # [2.64.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.6...@awes-io/ui@2.64.0) (2023-06-27)
7
56
 
8
57
 
@@ -74,6 +74,8 @@
74
74
  @import './dashboard.css';
75
75
  @import './dashboard-card.css';
76
76
 
77
+ @import './refresh-wrapper.css';
78
+
77
79
  @import './select.css';
78
80
 
79
81
  @import './userpic.css';
@@ -0,0 +1,9 @@
1
+ .aw-refresh-wrapper {
2
+ &__loader {
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ width: 100%;
7
+ z-index: 9999;
8
+ }
9
+ }
@@ -207,6 +207,8 @@
207
207
  }
208
208
  }
209
209
 
210
+ .is-disabled .aw-text-field__fake-input { opacity: 0.5 }
211
+
210
212
  @keyframes autoFillStart {
211
213
  from {
212
214
  opacity: 1
@@ -1,12 +1,12 @@
1
1
  .aw-tooltip {
2
- padding: theme('spacing.1') theme('spacing.3');
2
+ padding: 1rem;
3
3
  font-size: theme('fontSize.xs', 0.75rem);
4
4
  line-height: theme('leading.5', 1.25rem);
5
- border-radius: theme('borderRadius.default');
6
- background-color: rgba(var(--c-on-surface-rgb), 0.8);
5
+ border-radius: 0.625rem;
6
+ background-color: var(--c-mono-200);
7
7
  color: var(--c-surface);
8
8
  display: none;
9
- max-width: 235px;
9
+ max-width: min(14.625rem, calc(100vw - 2rem));
10
10
 
11
11
  &[data-visible] {
12
12
  display: block;
@@ -18,7 +18,7 @@
18
18
  pointer-events: none;
19
19
  }
20
20
 
21
- /* & > [data-popper-arrow] {
21
+ & > [data-popper-arrow] {
22
22
  background-clip: content-box;
23
23
  padding: 4px;
24
24
 
@@ -51,5 +51,5 @@
51
51
 
52
52
  &[data-popper-placement^='right'] > [data-popper-arrow] {
53
53
  left: -4px;
54
- } */
54
+ }
55
55
  }
@@ -12,6 +12,11 @@ export default {
12
12
  required: true
13
13
  },
14
14
 
15
+ color: {
16
+ type: String,
17
+ default: ''
18
+ },
19
+
15
20
  viewBox: {
16
21
  type: String,
17
22
  default: null
@@ -23,7 +28,7 @@ export default {
23
28
  }
24
29
  },
25
30
 
26
- render(h, { props: { name, size, viewBox }, data }) {
31
+ render(h, { props: { name, color, size, viewBox }, data }) {
27
32
  const attrs = data.attrs || {}
28
33
 
29
34
  return name
@@ -38,7 +43,9 @@ export default {
38
43
  !size && isNil(attrs.width) && isNil(attrs.height)
39
44
  }
40
45
  ],
41
- style: [data.style, data.staticStyle],
46
+ style: [data.style, data.staticStyle].concat(
47
+ color ? { fill: `var(--c-${color})` } : []
48
+ ),
42
49
  attrs: {
43
50
  'aria-hidden': true,
44
51
  width: size || null,
@@ -0,0 +1,151 @@
1
+ <template>
2
+ <div ref="refreshLoader" class="aw-refresh-wrapper">
3
+ <slot name="before" />
4
+
5
+ <div
6
+ v-if="distance"
7
+ class="aw-refresh-wrapper__loader"
8
+ :style="{
9
+ height: `${distance}px`
10
+ }"
11
+ >
12
+ <svg
13
+ :style="touchRotateIconStyle"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="24"
16
+ height="24"
17
+ viewBox="0 0 512 512"
18
+ >
19
+ <path
20
+ d="M484 28l-53 53A247 247 0 008 256a248 248 0 00414 184c5-5 6-12 1-17l-20-20c-5-5-12-5-17-1a196 196 0 118-285l-54 55c-7 7-2 20 9 20h143c7 0 12-5 12-12V37c0-11-13-16-20-9z"
21
+ />
22
+ </svg>
23
+ </div>
24
+
25
+ <slot />
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ const MAX_DISTANCE = Math.max(200, window.innerHeight / 1.75)
31
+ const MIN_DISTANCE = 75
32
+
33
+ export default {
34
+ name: 'AwRefreshWrapper',
35
+
36
+ props: {
37
+ loading: Boolean
38
+ },
39
+
40
+ data: () => ({
41
+ startY: 0,
42
+ distance: 0
43
+ }),
44
+
45
+ computed: {
46
+ touchRotateIconStyle() {
47
+ return !this.loading && this.distance > 0
48
+ ? `transform: rotate(${this.distance}deg)`
49
+ : ''
50
+ }
51
+ },
52
+
53
+ mounted() {
54
+ this.$refs.refreshLoader.addEventListener(
55
+ 'touchmove',
56
+ this.onTouchStartMove,
57
+ { passive: false }
58
+ )
59
+ },
60
+
61
+ beforeDestroy() {
62
+ this.removeListeners()
63
+
64
+ this.$refs.refreshLoader.removeEventListener(
65
+ 'touchmove',
66
+ this.onTouchStartMove,
67
+ { passive: false }
68
+ )
69
+ },
70
+
71
+ methods: {
72
+ removeListeners() {
73
+ this.$refs.refreshLoader.removeEventListener(
74
+ 'touchmove',
75
+ this.onTouchMove,
76
+ { capture: true, passive: false }
77
+ )
78
+
79
+ this.$refs.refreshLoader.removeEventListener(
80
+ 'touchend',
81
+ this.onTouchEnd,
82
+ { capture: true, passive: false }
83
+ )
84
+ },
85
+
86
+ onTouchStartMove(e) {
87
+ if (
88
+ !this.loading &&
89
+ e.touches.length === 1 &&
90
+ document.scrollingElement.scrollTop === 0
91
+ ) {
92
+ this.startY = e.touches[0].pageY
93
+
94
+ this.$refs.refreshLoader.addEventListener(
95
+ 'touchmove',
96
+ this.onTouchMove,
97
+ { capture: true, passive: false }
98
+ )
99
+ this.$refs.refreshLoader.addEventListener(
100
+ 'touchend',
101
+ this.onTouchEnd,
102
+ { capture: true, passive: false }
103
+ )
104
+ }
105
+ },
106
+
107
+ onTouchMove(e) {
108
+ if (document.scrollingElement.scrollTop !== 0) {
109
+ this.distance = 0
110
+
111
+ this.removeListeners()
112
+
113
+ return
114
+ }
115
+
116
+ const diff = e.touches[0].pageY - this.startY
117
+
118
+ if (diff < 0) {
119
+ this.onTouchEnd()
120
+ return
121
+ }
122
+
123
+ try {
124
+ if (e.cancelable) {
125
+ e.preventDefault()
126
+ }
127
+
128
+ e.stopPropagation()
129
+ } catch (e) {
130
+ console.log(e)
131
+ }
132
+
133
+ this.distance = Math.max(0, Math.min(MAX_DISTANCE, diff))
134
+ },
135
+
136
+ onTouchEnd() {
137
+ this.removeListeners()
138
+
139
+ if (this.distance && this.distance >= MIN_DISTANCE) {
140
+ if (typeof window.navigator.vibrate === 'function') {
141
+ window.navigator.vibrate(200)
142
+ }
143
+
144
+ this.$emit('refresh')
145
+ }
146
+
147
+ this.distance = 0
148
+ }
149
+ }
150
+ }
151
+ </script>
@@ -34,6 +34,7 @@
34
34
  :clearable="clearable && !_isEmpty"
35
35
  :is-opened="isOpened"
36
36
  :caret="isCaretVisible"
37
+ :disabled="disabled"
37
38
  :class="{
38
39
  'is-filled': searchable && isOpened,
39
40
  'not-searchable': !searchable
@@ -76,6 +77,7 @@
76
77
  :clearable="clearable && !_isEmpty"
77
78
  :is-opened="isOpened"
78
79
  :caret="isCaretVisible"
80
+ :disabled="disabled"
79
81
  :class="{
80
82
  'is-filled': searchable && isOpened,
81
83
  'not-searchable': !searchable
@@ -179,35 +181,52 @@
179
181
 
180
182
  <!-- options list -->
181
183
  <template v-if="optionsList.length">
182
- <AwDropdownButton
184
+ <template
183
185
  v-for="({
184
186
  optionLabel,
185
187
  optionValue,
188
+ optionGroup,
186
189
  index,
187
190
  active,
188
191
  disabled
189
192
  },
190
193
  i) in optionsList"
191
- :key="`${optionLabel}-${index}`"
192
- :active="active"
193
- :data-select-index="index"
194
- :data-selected="active ? '' : null"
195
- :data-value="optionValue"
196
- :disabled="disabled"
197
- tabindex="-1"
198
- data-arrow-focus
199
194
  >
200
- <slot
201
- name="option-label"
202
- v-bind="{
203
- ...optionsList[i],
204
- searchPhrase,
205
- highlightSearch
206
- }"
195
+ <div
196
+ v-if="
197
+ groupBy &&
198
+ (index === 0 ||
199
+ optionGroup !==
200
+ optionsList[index - 1].optionGroup)
201
+ "
202
+ class="font-bold p-4"
203
+ :key="`group-${optionGroup}-${index}`"
204
+ >
205
+ {{ optionGroup }}
206
+ </div>
207
+
208
+ <AwDropdownButton
209
+ :active="active"
210
+ :data-select-index="index"
211
+ :data-selected="active ? '' : null"
212
+ :data-value="optionValue"
213
+ :disabled="disabled"
214
+ tabindex="-1"
215
+ data-arrow-focus
216
+ :key="`btn-${optionLabel}-${index}`"
207
217
  >
208
- <span v-html="highlightSearch(optionLabel)" />
209
- </slot>
210
- </AwDropdownButton>
218
+ <slot
219
+ name="option-label"
220
+ v-bind="{
221
+ ...optionsList[i],
222
+ searchPhrase,
223
+ highlightSearch
224
+ }"
225
+ >
226
+ <span v-html="highlightSearch(optionLabel)" />
227
+ </slot>
228
+ </AwDropdownButton>
229
+ </template>
211
230
  </template>
212
231
 
213
232
  <!-- not found -->
@@ -298,6 +317,11 @@ export default {
298
317
  default: ''
299
318
  },
300
319
 
320
+ groupBy: {
321
+ type: String,
322
+ default: ''
323
+ },
324
+
301
325
  searchable: {
302
326
  type: Boolean,
303
327
  default: true
@@ -421,6 +445,10 @@ export default {
421
445
  return this.trackBy ? path(this.trackBy) : returnSelf
422
446
  },
423
447
 
448
+ _getGroup() {
449
+ return this.groupBy ? path(this.groupBy) : returnSelf
450
+ },
451
+
424
452
  _valueKey() {
425
453
  return this._getValue(this.value)
426
454
  },
@@ -435,6 +463,7 @@ export default {
435
463
  if (inRange && matchSearch) {
436
464
  const optionLabel = this._getLabel(option)
437
465
  const optionValue = this._getValue(option)
466
+ const optionGroup = this._getGroup(option)
438
467
  const active = this._isActive(optionValue)
439
468
  const disabled = this.optionDisabled(option)
440
469
 
@@ -442,6 +471,7 @@ export default {
442
471
  option,
443
472
  optionLabel,
444
473
  optionValue,
474
+ optionGroup,
445
475
  index,
446
476
  active,
447
477
  disabled
@@ -15,31 +15,59 @@
15
15
  :href="isDisabled ? null : route.fullPath"
16
16
  :class="[
17
17
  _cssClasses.toggler,
18
- { [_cssClasses.togglerActive]: isActive },
19
- { [_cssClasses.togglerDisabled]: isDisabled }
18
+ {
19
+ [_cssClasses.togglerActive]: isActive,
20
+ [_cssClasses.togglerDisabled]: isDisabled,
21
+ [_cssClasses.togglerNoText]: item.hideText
22
+ }
20
23
  ]"
21
24
  @click.prevent="navigate(route)"
22
25
  >
23
26
  <span tabindex="-1">
24
- {{ text }}
25
- <AwBadge v-if="item.badge" v-bind="item.badge" />
27
+ <AwIcon
28
+ v-if="item.icon"
29
+ v-bind="_toIconProps(item.icon)"
30
+ :class="{ 'mr-1': !item.hideText }"
31
+ />
32
+ <span v-if="item.hideText" class="sr-only">
33
+ {{ text }}
34
+ </span>
35
+ <template v-else>{{ text }}</template>
36
+ <AwBadge
37
+ v-if="item.badge"
38
+ v-bind="_toBadgeProps(item.badge)"
39
+ />
26
40
  </span>
27
41
  </a>
28
42
  <button
29
43
  v-else
30
- :key="key"
44
+ :key="'btn-' + key"
31
45
  :class="[
32
46
  _cssClasses.toggler,
33
- { [_cssClasses.togglerActive]: isActive },
34
- { [_cssClasses.togglerDisabled]: isDisabled }
47
+ {
48
+ [_cssClasses.togglerActive]: isActive,
49
+ [_cssClasses.togglerDisabled]: isDisabled,
50
+ [_cssClasses.togglerNoText]: item.hideText
51
+ }
35
52
  ]"
36
53
  :disabled="isDisabled ? '' : null"
37
54
  type="button"
38
55
  @click.prevent="update(i)"
39
56
  >
40
57
  <span tabindex="-1">
41
- {{ text }}
42
- <AwBadge v-if="item.badge" v-bind="item.badge" />
58
+ <AwIcon
59
+ v-if="item.icon"
60
+ v-bind="_toIconProps(item.icon)"
61
+ :class="{ 'mr-1': !item.hideText }"
62
+ />
63
+ <span v-if="item.hideText" class="sr-only">
64
+ {{ text }}
65
+ </span>
66
+ <template v-else>{{ text }}</template>
67
+ <AwBadge
68
+ v-if="item.badge"
69
+ v-bind="_toBadgeProps(item.badge)"
70
+ />
43
71
  </span>
44
72
  </button>
45
73
  </slot>
@@ -115,7 +143,8 @@ export default {
115
143
  'wrapper',
116
144
  'toggler',
117
145
  'toggler_active',
118
- 'toggler_disabled'
146
+ 'toggler_disabled',
147
+ 'toggler_no_text'
119
148
  ])
120
149
  }
121
150
  },
@@ -233,6 +262,14 @@ export default {
233
262
  }
234
263
 
235
264
  return equals(currentParams, route.query)
265
+ },
266
+
267
+ _toBadgeProps(props) {
268
+ return isType('Object', props) ? props : { text: props }
269
+ },
270
+
271
+ _toIconProps(props) {
272
+ return isType('Object', props) ? props : { name: props }
236
273
  }
237
274
  }
238
275
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="element"
4
- class="flex max-w-full aw-text-field is-text"
4
+ class="aw-select-fake-input flex max-w-full aw-text-field is-text"
5
5
  :class="{
6
6
  'is-filled': value === 0 || !!value,
7
7
  'has-label': !!label,
@@ -1,5 +1,13 @@
1
1
  <template>
2
- <div class="aw-table-builder relative">
2
+ <AwRefreshWrapper
3
+ class="aw-table-builder relative"
4
+ :loading="collection.loading"
5
+ @refresh="fetch"
6
+ >
7
+ <template #before>
8
+ <slot name="before-refresh" />
9
+ </template>
10
+
3
11
  <div v-if="isEmpty && !collection.loading">
4
12
  <!-- The empty container. Will be shown if the data (without filters) is empty. Your can compleatly overwrite the block. -->
5
13
  <slot v-if="!isWatchParamsPresent" name="empty-container">
@@ -55,7 +63,9 @@
55
63
  <slot name="empty-filter-title">
56
64
  <!-- Text: "There are no data to show" -->
57
65
  <div class="text-mono-400 mb-4">
58
- {{ $t('No results were found for your request') }}
66
+ {{
67
+ $t('No results were found for your request')
68
+ }}
59
69
  </div>
60
70
  </slot>
61
71
 
@@ -175,7 +185,7 @@
175
185
  </AwChip>
176
186
  </slot>
177
187
  </div>
178
- </div>
188
+ </AwRefreshWrapper>
179
189
  </template>
180
190
 
181
191
  <script>
@@ -12,10 +12,16 @@ function showTooltip() {
12
12
  tooltip.setAttribute('data-visible', '')
13
13
 
14
14
  const modifiers = [
15
- // {
16
- // name: 'arrow',
17
- // options: { padding: 6 }
18
- // },
15
+ {
16
+ name: 'arrow',
17
+ options: { padding: 6 }
18
+ },
19
+ {
20
+ name: 'flip',
21
+ options: {
22
+ fallbackPlacements: ['top', 'right', 'bottom', 'left']
23
+ }
24
+ },
19
25
  {
20
26
  name: 'preventOverflow',
21
27
  options: {
@@ -52,11 +58,11 @@ function hideTooltip() {
52
58
 
53
59
  const EVENTS = [
54
60
  {
55
- names: ['mouseenter', 'focus'],
61
+ names: ['pointerenter', 'focus'],
56
62
  handler: showTooltip
57
63
  },
58
64
  {
59
- names: ['mouseleave', 'blur'],
65
+ names: ['pointerleave', 'blur'],
60
66
  handler: hideTooltip
61
67
  }
62
68
  ]
@@ -74,7 +80,7 @@ function toggleEvents(el, on = false, $events = EVENTS) {
74
80
  function _updateTooltipContent(tooltip, content) {
75
81
  tooltip.__content__ = content
76
82
 
77
- tooltip.innerHTML = content // + '</span><span data-popper-arrow></span>'
83
+ tooltip.innerHTML = content + '<span data-popper-arrow></span>'
78
84
 
79
85
  return tooltip
80
86
  }
package/nuxt/index.js CHANGED
@@ -131,7 +131,8 @@ async function AwesIoUi() {
131
131
  const _locale = locale.code || locale
132
132
  const file = getDayjsLang(_locale)
133
133
 
134
- localesMap[_locale] = getDayjsLocaleNameFromFile(file) || DEFAULT_DAYJS_LOCALE
134
+ localesMap[_locale] =
135
+ getDayjsLocaleNameFromFile(file) || DEFAULT_DAYJS_LOCALE
135
136
 
136
137
  return file ? acc.concat(file) : acc
137
138
  },
@@ -229,7 +230,6 @@ async function AwesIoUi() {
229
230
  resolve(__dirname, '..', 'assets', 'css', 'main.css')
230
231
  )
231
232
 
232
- postcss.preset.stage = 1
233
233
  postcss.plugins = postcss.plugins || {}
234
234
 
235
235
  postcss.plugins = mergeDeepRight(
@@ -245,9 +245,6 @@ async function AwesIoUi() {
245
245
  )
246
246
 
247
247
  postcss.plugins.tailwindcss = tailwindConfig
248
-
249
- // include last
250
- postcss['postcss-color-function'] = {}
251
248
  })
252
249
 
253
250
  /**