@usssa/component-library 1.0.0-alpha.2 → 1.0.0-alpha.200

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 (139) hide show
  1. package/README.md +8 -5
  2. package/package.json +24 -8
  3. package/src/assets/logo.svg +19 -0
  4. package/src/assets/no-result.svg +25 -0
  5. package/src/assets/quasar-logo-vertical.svg +15 -0
  6. package/src/assets/upload-illustration.svg +48 -0
  7. package/src/components/ComponentLink.vue +26 -0
  8. package/src/components/core/UAvatar.vue +210 -0
  9. package/src/components/core/UAvatarGroup.vue +129 -0
  10. package/src/components/core/UBadgeStd.vue +96 -0
  11. package/src/components/core/UBannerStd.vue +184 -0
  12. package/src/components/core/UBreadCrumbs.vue +171 -0
  13. package/src/components/core/UBtnIcon.vue +160 -0
  14. package/src/components/core/UBtnStd.vue +134 -0
  15. package/src/components/core/UBtnToggle.vue +73 -0
  16. package/src/components/core/UCheckboxStd.vue +101 -0
  17. package/src/components/core/UChip.vue +274 -0
  18. package/src/components/core/UDate.vue +581 -0
  19. package/src/components/core/UDialogStd.vue +614 -0
  20. package/src/components/core/UDrawer/UDrawer.vue +471 -0
  21. package/src/components/core/UDrawer/UDrawerMenuItem.vue +124 -0
  22. package/src/components/core/UExpansionStd.vue +266 -0
  23. package/src/components/core/UInnerLoader.vue +69 -0
  24. package/src/components/core/UInputAddressLookup.vue +484 -0
  25. package/src/components/core/UInputPhoneStd.vue +303 -0
  26. package/src/components/core/UInputTextStd.vue +308 -0
  27. package/src/components/core/UInputTypeahead.vue +44 -0
  28. package/src/components/core/UInputTypeaheadAdvanceSearch.vue +134 -0
  29. package/src/components/core/UMenuButtonStd.vue +280 -0
  30. package/src/components/core/UMenuDropdown.vue +80 -0
  31. package/src/components/core/UMenuDropdownAdvancedSearch.vue +306 -0
  32. package/src/components/core/UMenuItem.vue +183 -0
  33. package/src/components/core/UMenuSearch.vue +73 -0
  34. package/src/components/core/UModal.vue +660 -0
  35. package/src/components/core/UMultiSelectStd.vue +699 -0
  36. package/src/components/core/UPagination.vue +156 -0
  37. package/src/components/core/URadioBtn.vue +139 -0
  38. package/src/components/core/URadioStd.vue +71 -0
  39. package/src/components/core/USelectStd.vue +564 -0
  40. package/src/components/core/USheet.vue +349 -0
  41. package/src/components/core/UStepper/UProgress.vue +157 -0
  42. package/src/components/core/UStepper/UStepper.vue +211 -0
  43. package/src/components/core/UTabBtnStd.vue +181 -0
  44. package/src/components/core/UTable/UTable.vue +1984 -0
  45. package/src/components/core/UTable/UTd.vue +63 -0
  46. package/src/components/core/UTable/UTh.vue +48 -0
  47. package/src/components/core/UTable/UTr.vue +20 -0
  48. package/src/components/core/UTableStd.vue +1449 -0
  49. package/src/components/core/UTabsStd.vue +140 -0
  50. package/src/components/core/UToggleStd.vue +164 -0
  51. package/src/components/core/UToolbar/UCustomMenuIcon.vue +58 -0
  52. package/src/components/core/UToolbar/UToolbar.vue +226 -0
  53. package/src/components/core/UTooltip.vue +78 -0
  54. package/src/components/core/UTypeahead.vue +890 -0
  55. package/src/components/core/UUploader.vue +644 -0
  56. package/src/components/index.js +91 -0
  57. package/src/composables/useNotify.js +79 -0
  58. package/src/composables/useOverlayLoader.js +23 -0
  59. package/src/composables/useScreenType.js +30 -0
  60. package/src/css/app.sass +168 -0
  61. package/src/css/colors.sass +103 -0
  62. package/src/css/media.sass +1 -0
  63. package/src/css/quasar.variables.sass +150 -0
  64. package/src/css/typography.sass +0 -0
  65. package/src/css/vars/colors.variables.sass +113 -0
  66. package/src/utils/data.ts +170 -0
  67. package/dist/spa/assets/Avatar.45667392.js +0 -9
  68. package/dist/spa/assets/AvatarGroup.99557443.js +0 -9
  69. package/dist/spa/assets/AvatarGroup.bb4cd03a.css +0 -1
  70. package/dist/spa/assets/BadgeStd.ee4129c5.js +0 -6
  71. package/dist/spa/assets/BannerPage.6c6a98c4.js +0 -10
  72. package/dist/spa/assets/BannerPage.d195fcac.css +0 -1
  73. package/dist/spa/assets/BtnIcon.89e50d2e.css +0 -1
  74. package/dist/spa/assets/BtnIcon.934f8c5b.js +0 -10
  75. package/dist/spa/assets/BtnStd.95fc4510.js +0 -11
  76. package/dist/spa/assets/CheckBox.3c204a4b.css +0 -1
  77. package/dist/spa/assets/CheckBox.fbc0bd1a.js +0 -7
  78. package/dist/spa/assets/Chip.49ffc857.js +0 -11
  79. package/dist/spa/assets/Chip.74acaa33.css +0 -1
  80. package/dist/spa/assets/ComponentBase.1ae19b7e.js +0 -1
  81. package/dist/spa/assets/ErrorNotFound.6cccfaee.js +0 -1
  82. package/dist/spa/assets/IndexPage.17d09b76.js +0 -1
  83. package/dist/spa/assets/InputText.19c0d7d1.css +0 -1
  84. package/dist/spa/assets/InputText.3fcd97a4.js +0 -20
  85. package/dist/spa/assets/KFOkCnqEu92Fr1MmgVxIIzQ.34e9582c.woff +0 -0
  86. package/dist/spa/assets/KFOlCnqEu92Fr1MmEU9fBBc-.9ce7f3ac.woff +0 -0
  87. package/dist/spa/assets/KFOlCnqEu92Fr1MmSU5fBBc-.bf14c7d7.woff +0 -0
  88. package/dist/spa/assets/KFOlCnqEu92Fr1MmWUlfBBc-.e0fd57c0.woff +0 -0
  89. package/dist/spa/assets/KFOlCnqEu92Fr1MmYUtfBBc-.f6537e32.woff +0 -0
  90. package/dist/spa/assets/KFOmCnqEu92Fr1Mu4mxM.f2abf7fb.woff +0 -0
  91. package/dist/spa/assets/MainLayout.912bb0f8.js +0 -1
  92. package/dist/spa/assets/MultiSelectStd.644b108c.js +0 -17
  93. package/dist/spa/assets/MultiSelectStd.c7af49eb.css +0 -1
  94. package/dist/spa/assets/QAvatar.5940a79e.js +0 -1
  95. package/dist/spa/assets/QCheckbox.48b43f7d.js +0 -1
  96. package/dist/spa/assets/QPage.ca395ec4.js +0 -1
  97. package/dist/spa/assets/QRadio.0a7f5e2c.js +0 -1
  98. package/dist/spa/assets/QResizeObserver.30c3566c.js +0 -1
  99. package/dist/spa/assets/QSelect.a40eb786.js +0 -1
  100. package/dist/spa/assets/QTabs.72f2507e.js +0 -1
  101. package/dist/spa/assets/QToggle.376c48be.js +0 -1
  102. package/dist/spa/assets/QTooltip.5aa8e325.js +0 -1
  103. package/dist/spa/assets/Radio.0ac35288.js +0 -7
  104. package/dist/spa/assets/Radio.aca54a89.css +0 -1
  105. package/dist/spa/assets/SelectStd.5c6891db.css +0 -1
  106. package/dist/spa/assets/SelectStd.daf1def9.js +0 -16
  107. package/dist/spa/assets/TabButtonPage.20e871dd.js +0 -7
  108. package/dist/spa/assets/TabButtonPage.36ce9f9c.css +0 -1
  109. package/dist/spa/assets/TabsPage.9b94ff39.css +0 -1
  110. package/dist/spa/assets/TabsPage.b92cccee.js +0 -9
  111. package/dist/spa/assets/TogglePage.8129b631.css +0 -1
  112. package/dist/spa/assets/TogglePage.ba6e325c.js +0 -9
  113. package/dist/spa/assets/UAvatar.dda7e478.js +0 -1
  114. package/dist/spa/assets/UAvatar.ea8daa38.css +0 -1
  115. package/dist/spa/assets/UBadgeStd.3965db9a.css +0 -1
  116. package/dist/spa/assets/UBadgeStd.e165ee05.js +0 -1
  117. package/dist/spa/assets/UBtnStd.979ec4e8.js +0 -1
  118. package/dist/spa/assets/UBtnStd.bdd4f5e5.css +0 -1
  119. package/dist/spa/assets/UTooltip.d2e04d0c.js +0 -1
  120. package/dist/spa/assets/UTooltip.efa029a7.css +0 -1
  121. package/dist/spa/assets/dom.e9d4ad51.js +0 -1
  122. package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.fd84f88b.woff +0 -0
  123. package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.4a4dbc62.woff2 +0 -0
  124. package/dist/spa/assets/format.41663636.js +0 -1
  125. package/dist/spa/assets/index.43c62a18.js +0 -21
  126. package/dist/spa/assets/index.4fbd73cf.css +0 -5
  127. package/dist/spa/assets/option-sizes.10cc02d3.js +0 -1
  128. package/dist/spa/assets/render.e67ff27a.js +0 -1
  129. package/dist/spa/assets/tooltip.7c0d0774.js +0 -8
  130. package/dist/spa/assets/touch.9135741d.js +0 -1
  131. package/dist/spa/assets/use-checkbox.44a623c0.js +0 -1
  132. package/dist/spa/favicon.ico +0 -0
  133. package/dist/spa/icons/caret-down.svg +0 -5
  134. package/dist/spa/icons/circle-xmark.svg +0 -6
  135. package/dist/spa/icons/favicon-128x128.png +0 -0
  136. package/dist/spa/icons/favicon-16x16.png +0 -0
  137. package/dist/spa/icons/favicon-32x32.png +0 -0
  138. package/dist/spa/icons/favicon-96x96.png +0 -0
  139. package/dist/spa/index.html +0 -3
@@ -0,0 +1,96 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+
4
+ const props = defineProps({
5
+ color: {
6
+ type: String,
7
+ default: 'primary',
8
+ },
9
+ dataTestId: {
10
+ type: String,
11
+ default: 'badge-std'
12
+ },
13
+ label: {
14
+ type: String,
15
+ default: '',
16
+ },
17
+ size: {
18
+ type: String,
19
+ default: 'md',
20
+ validator: (val) => ['xxs', 'xs', 'sm', 'md', 'lg'].includes(val),
21
+ },
22
+ type: {
23
+ type: String,
24
+ default: 'basic',
25
+ validator: (val) => ['basic', 'indicator'].includes(val),
26
+ },
27
+ })
28
+
29
+ const currentColor = computed(() => {
30
+ if (props.color === 'neutral') {
31
+ return 'neutral-6'
32
+ }
33
+ return props.color
34
+ })
35
+ </script>
36
+
37
+ <template>
38
+ <q-badge
39
+ class="u-badge"
40
+ :class="[
41
+ type === 'basic' ? 'type-basic' : 'type-indicator justify-center',
42
+ `size-${size}`,
43
+ type === 'basic'
44
+ ? size === 'md'
45
+ ? `text-overline-xs`
46
+ : `text-overline-sm`
47
+ : '',
48
+ ]"
49
+ :aria-label="label"
50
+ :color="currentColor"
51
+ :dataTestId="dataTestId"
52
+ rounded
53
+ tabindex="0"
54
+ >
55
+ <div v-if="type === 'basic'">
56
+ {{ label }}
57
+ </div>
58
+ <slot name="default" />
59
+ </q-badge>
60
+ </template>
61
+
62
+ <style lang="sass">
63
+ .u-badge
64
+ min-height:0px
65
+
66
+ &.size-xxs
67
+ width: $xs
68
+ height: $xs
69
+ padding: 0px
70
+
71
+ &.size-xs
72
+ width: $sm
73
+ height: $sm
74
+ padding: 0px
75
+
76
+ &.size-sm
77
+ width: $ba
78
+ height: $ba
79
+ padding: 0px
80
+
81
+ &.size-md
82
+ letter-spacing: 0.24px
83
+ line-height: 1.013rem
84
+
85
+ &.size-lg
86
+ width: $md
87
+ height: $ms
88
+ justify-content: center
89
+ line-height: 0
90
+
91
+ &.type-basic
92
+ border: 1.5px solid $neutral-1
93
+
94
+ &.type-indicator
95
+ border: 1px solid $neutral-1
96
+ </style>
@@ -0,0 +1,184 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import UBtnStd from './UBtnStd.vue'
4
+ import { useScreenType } from '../../composables/useScreenType'
5
+
6
+ const emit = defineEmits(['primaryAction', 'secondaryAction'])
7
+
8
+ const props = defineProps({
9
+ dataTestId: {
10
+ type: String,
11
+ default: 'banner-std',
12
+ },
13
+ icon: {
14
+ type: String,
15
+ default: 'fa-kit-duotone fa-circle-info',
16
+ },
17
+ label: {
18
+ type: String,
19
+ default: '',
20
+ },
21
+ message: {
22
+ type: String,
23
+ default: '',
24
+ required: true,
25
+ },
26
+ primaryActionLabel: {
27
+ type: String,
28
+ },
29
+ secondaryActionLabel: {
30
+ type: String,
31
+ },
32
+ show: {
33
+ type: Boolean,
34
+ default: false,
35
+ required: true,
36
+ },
37
+ showBorder: {
38
+ type: Boolean,
39
+ default: true,
40
+ },
41
+ type: {
42
+ type: String,
43
+ default: 'info',
44
+ },
45
+ })
46
+
47
+ const $screen = useScreenType()
48
+
49
+ const bordered = computed(() => {
50
+ if (props.showBorder) {
51
+ return 'bordered'
52
+ }
53
+ return ''
54
+ })
55
+
56
+ const handlePrimaryActionClick = () => {
57
+ emit('primaryAction')
58
+ }
59
+
60
+ const handleSecondaryActionClick = () => {
61
+ emit('secondaryAction')
62
+ }
63
+ </script>
64
+
65
+ <template>
66
+ <q-banner
67
+ v-if="show && (message.trim() || label.trim())"
68
+ :class="[
69
+ `u-banner u-banner-${type}`,
70
+ !icon ? 'no-padding-label' : '',
71
+ bordered,
72
+ $screen.isMobile ? 'u-banner-sm' : 'u-banner-md',
73
+ ]"
74
+ :dataTestId="dataTestId"
75
+ inline-actions
76
+ tabindex="0"
77
+ >
78
+ <template v-slot:avatar>
79
+ <q-icon
80
+ v-if="icon"
81
+ :class="icon"
82
+ alt="Banner Info Icon"
83
+ aria-label="Banner Icon"
84
+ :color="type"
85
+ size="sm"
86
+ />
87
+ </template>
88
+
89
+ <div>
90
+ <span v-if="!label" class="text-caption-lg">{{ message }}</span>
91
+ <div v-else class="column">
92
+ <span class="text-caption-lg">{{ label }}</span>
93
+ <span class="text-body-sm">{{ message }}</span>
94
+ </div>
95
+ </div>
96
+
97
+ <template v-slot:action>
98
+ <div :class="['row', $screen.isMobile ? 'full-width q-mt-ba' : '']">
99
+ <u-btn-std
100
+ v-if="secondaryActionLabel"
101
+ :color="type"
102
+ :label="secondaryActionLabel"
103
+ :outline="true"
104
+ size="md"
105
+ @onClick="handleSecondaryActionClick"
106
+ />
107
+ <u-btn-std
108
+ v-if="primaryActionLabel"
109
+ :color="type"
110
+ :label="primaryActionLabel"
111
+ size="md"
112
+ @onClick="handlePrimaryActionClick"
113
+ />
114
+ </div>
115
+ </template>
116
+ </q-banner>
117
+ </template>
118
+
119
+ <style lang="sass">
120
+ .u-banner
121
+ .q-banner__avatar
122
+ align-self: center
123
+
124
+ .q-banner__content
125
+ padding-left: $xs !important
126
+ word-break: break-word
127
+ overflow-wrap: break-word
128
+
129
+ .u-banner-sm
130
+ flex-wrap: wrap
131
+ padding: $ba
132
+ .q-banner__actions
133
+ width: 100%
134
+ padding-left: 0px !important
135
+ >div
136
+ gap: $sm
137
+ .q-btn
138
+ flex: 1
139
+ min-width: 0
140
+
141
+ .u-banner-md
142
+ padding: $sm
143
+ .q-banner__actions
144
+ padding-left: $xs
145
+ >div
146
+ gap: $xs !important
147
+
148
+ .u-banner-positive
149
+ background: $green-1 !important
150
+ color: $green-7 !important
151
+ &.bordered
152
+ border: 0.094rem solid $green-7
153
+
154
+ .u-banner-info
155
+ background: $purple-1 !important
156
+ color: $info !important
157
+ &.bordered
158
+ border: 0.094rem solid $purple-7
159
+
160
+ .u-banner-warning
161
+ background: $orange-1 !important
162
+ color: $orange-7 !important
163
+ &.bordered
164
+ border: 0.094rem solid $orange-7
165
+
166
+ .u-banner-accent
167
+ background: $red-1 !important
168
+ color: $red-7 !important
169
+ &.bordered
170
+ border: 0.094rem solid $red-7
171
+
172
+ .u-banner-primary
173
+ background: $blue-1 !important
174
+ color: $primary !important
175
+ &.bordered
176
+ border: 0.094rem solid $primary
177
+
178
+ .no-padding-label
179
+ .q-banner__content
180
+ padding-left: 0px !important
181
+
182
+ .bordered
183
+ border-radius: $xs
184
+ </style>
@@ -0,0 +1,171 @@
1
+ <script setup>
2
+ import { ref, computed } from 'vue'
3
+ import { useRouter } from 'vue-router'
4
+ import { useScreenType } from '../../composables/useScreenType'
5
+ import UTooltip from './UTooltip.vue'
6
+
7
+ const props = defineProps({
8
+ activeColor: {
9
+ type: String,
10
+ default: 'primary',
11
+ },
12
+ align: {
13
+ type: String,
14
+ default: 'left',
15
+ },
16
+ dataTestId: {
17
+ type: String,
18
+ default: 'breadcrumbs-std',
19
+ },
20
+ fontTypo: {
21
+ type: String,
22
+ default: 'text-caption-sm',
23
+ },
24
+ links: {
25
+ type: Array,
26
+ default: () => [],
27
+ },
28
+ showActiveRoute: {
29
+ type: Boolean,
30
+ default: true,
31
+ },
32
+ })
33
+
34
+ const router = useRouter()
35
+ const $screen = useScreenType()
36
+
37
+ const isOverflowing = ref(false)
38
+ const textEl = ref(null)
39
+
40
+ const currentLink = computed(() => {
41
+ return props.links[props.links.length - 1]
42
+ })
43
+
44
+ const lastTwoLinks = computed(() => {
45
+ return props.links.slice(-2)
46
+ })
47
+
48
+ const previousLinks = computed(() => {
49
+ if (props.links.length < 2) return []
50
+ return props.links.slice(0, -1).reverse()
51
+ })
52
+
53
+ const previousLinksForDesktop = computed(() => {
54
+ if (props.links.length <= 2) return []
55
+ return props.links.slice(0, -2).reverse()
56
+ })
57
+
58
+ const showMenuDropdown = computed(() => {
59
+ if ($screen.value.isMobile) {
60
+ if (previousLinks.value.length) {
61
+ return true
62
+ }
63
+ } else {
64
+ if (previousLinksForDesktop.value.length) {
65
+ return true
66
+ }
67
+ }
68
+ return false
69
+ })
70
+
71
+ const checkOverflow = () => {
72
+ if (textEl.value) {
73
+ isOverflowing.value = textEl.value.scrollWidth > textEl.value.clientWidth
74
+ }
75
+ }
76
+
77
+ const onClick = (link) => {
78
+ if (link.to) router.push(link.to)
79
+ }
80
+ </script>
81
+
82
+ <template>
83
+ <q-breadcrumbs
84
+ v-bind="$attrs"
85
+ class="u-breadcrumb"
86
+ :active-color="showActiveRoute ? activeColor : 'text-dark'"
87
+ :align="align"
88
+ :dataTestId="dataTestId"
89
+ gutter="none"
90
+ separator-color="text-dark"
91
+ >
92
+ <template v-slot:separator>
93
+ <span :class="fontTypo">/</span>
94
+ </template>
95
+
96
+ <!-- Dropdown for previous links -->
97
+ <q-breadcrumbs-el v-if="showMenuDropdown">
98
+ <span :class="`${fontTypo} cursor-pointer`">...</span>
99
+ <q-menu class="breadcrumb-menu">
100
+ <q-list class="u-menu-dropdown">
101
+ <q-item
102
+ v-for="(link, i) in $screen.isMobile
103
+ ? previousLinks
104
+ : previousLinksForDesktop"
105
+ class="u-menu-link"
106
+ clickable
107
+ :key="i"
108
+ @click="onClick(link)"
109
+ >
110
+ <q-item-section
111
+ :class="`text-body-sm text-${
112
+ showActiveRoute ? activeColor : 'dark'
113
+ }`"
114
+ >
115
+ {{ link.label }}
116
+ </q-item-section>
117
+ </q-item>
118
+ </q-list>
119
+ </q-menu>
120
+ </q-breadcrumbs-el>
121
+
122
+ <!-- For mobile -->
123
+
124
+ <q-breadcrumbs-el
125
+ v-if="currentLink && $screen.isMobile"
126
+ :class="fontTypo"
127
+ :aria-label="currentLink.label"
128
+ @click="onClick"
129
+ >
130
+ <div class="ellipsis-label" ref="textEl" @mouseenter="checkOverflow">
131
+ {{ currentLink?.label }}
132
+ </div>
133
+ <UTooltip v-if="isOverflowing" :description="currentLink?.label" />
134
+ </q-breadcrumbs-el>
135
+
136
+ <!-- For Desktop and Tablet -->
137
+
138
+ <template v-if="lastTwoLinks && !$screen.isMobile">
139
+ <q-breadcrumbs-el
140
+ v-for="(link, index) in lastTwoLinks"
141
+ :class="`${fontTypo}`"
142
+ :aria-label="link.label"
143
+ :key="index"
144
+ :to="link.to"
145
+ @click="onClick"
146
+ >
147
+ <div class="ellipsis-label" ref="textEl" @mouseenter="checkOverflow">
148
+ {{ link.label }}
149
+ </div>
150
+ <UTooltip v-if="isOverflowing" :description="link.label" />
151
+ </q-breadcrumbs-el>
152
+ </template>
153
+ </q-breadcrumbs>
154
+ </template>
155
+
156
+ <style lang="sass">
157
+ .u-breadcrumb
158
+ .q-breadcrumbs__separator
159
+ margin-left: $xs
160
+ margin-right: $xs
161
+ .ellipsis-label
162
+ max-width: 80vw
163
+ white-space: nowrap
164
+ overflow: hidden
165
+ text-overflow: ellipsis
166
+ .breadcrumb-menu
167
+ .u-menu-dropdown
168
+ .u-menu-link.q-item
169
+ padding: $xxs $xs
170
+ gap: 0px
171
+ </style>
@@ -0,0 +1,160 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import UTooltip from './UTooltip.vue'
4
+
5
+ const emit = defineEmits(['onClick'])
6
+ const props = defineProps({
7
+ anchor: {
8
+ type: String,
9
+ default: 'center left',
10
+ },
11
+ ariaLabel: {
12
+ type: String,
13
+ default: '',
14
+ },
15
+ color: {
16
+ type: String,
17
+ default: 'primary',
18
+ },
19
+ dataTestId: {
20
+ type: String,
21
+ default: 'button-icon',
22
+ },
23
+ iconClass: {
24
+ type: String,
25
+ required: true,
26
+ default: 'fa-kit-duotone fa-circle-bolt',
27
+ },
28
+ offset: {
29
+ type: Array,
30
+ default: () => [4, 4],
31
+ },
32
+ round: {
33
+ type: Boolean,
34
+ default: true,
35
+ },
36
+ self: {
37
+ type: String,
38
+ default: 'center end',
39
+ },
40
+ size: {
41
+ type: String,
42
+ default: 'md',
43
+ validator: (val) => ['sm', 'md', 'lg'].includes(val),
44
+ },
45
+ tooltip: {
46
+ type: String,
47
+ default: '',
48
+ },
49
+ tooltipPosition: {
50
+ type: String,
51
+ default: 'top',
52
+ },
53
+ })
54
+
55
+ const btnClass = computed(() => {
56
+ if (props.color === 'neutral') {
57
+ return 'neutral-4'
58
+ }
59
+ return props.color
60
+ })
61
+ const iconColor = computed(() => {
62
+ if (props.color === 'neutral') {
63
+ return 'neutral-9'
64
+ }
65
+ return props.color
66
+ })
67
+ const iconSize = computed(() => {
68
+ if (props.size === 'sm') {
69
+ return 'xs'
70
+ }
71
+ if (props.size === 'md') {
72
+ return 'sm'
73
+ }
74
+ if (props.size === 'lg') {
75
+ return 'md'
76
+ }
77
+ return props.size
78
+ })
79
+
80
+ const handleClick = () => {
81
+ return emit('onClick')
82
+ }
83
+ </script>
84
+
85
+ <template>
86
+ <q-btn
87
+ :class="`u-btn-icon size-${size} ${btnClass}`"
88
+ :aria-label="ariaLabel"
89
+ :dataTestId="dataTestId"
90
+ flat="flat"
91
+ :round="round"
92
+ @click="handleClick"
93
+ >
94
+ <template #default>
95
+ <q-icon
96
+ :class="`${iconClass} size-${size}`"
97
+ :aria-hidden="true"
98
+ :color="iconColor"
99
+ :size="iconSize"
100
+ />
101
+
102
+ <UTooltip
103
+ v-if="tooltip"
104
+ :anchor="anchor"
105
+ :description="tooltip"
106
+ :offset="offset"
107
+ :self="self"
108
+ />
109
+ <slot name="menu" />
110
+ </template>
111
+ </q-btn>
112
+ </template>
113
+
114
+ <style lang="sass">
115
+ .u-btn-icon
116
+ &.neutral-4
117
+ color: $neutral-4
118
+
119
+ &.transparent
120
+ color: $neutral-1
121
+
122
+ &.size-sm
123
+ height: $md
124
+ width: $md
125
+
126
+ &.size-md
127
+ height: $lg
128
+ width: $lg
129
+
130
+ &.size-lg
131
+ height: $xl
132
+ width: $xl
133
+
134
+ .q-icon
135
+ &.text-transparent
136
+ color: $neutral-1 !important
137
+
138
+ &.size-sm
139
+ height: $ba
140
+ width: $ba
141
+
142
+ &.size-md
143
+ height: $ms
144
+ width: $ms
145
+
146
+ &.size-lg
147
+ height: $md
148
+ width: $md
149
+ &.neutral-9
150
+ color: $neutral-9
151
+
152
+ &.accent:hover
153
+ background: $accent-bg-hover
154
+
155
+ .icon-tooltip
156
+ background: $dark
157
+ border-radius: $xxs
158
+ padding: $xs $sm
159
+ box-shadow: 0px 0px 4px 0px rgba(16, 17, 20, 0.08)
160
+ </style>