@usssa/component-library 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (161) hide show
  1. package/README.md +4 -1
  2. package/package.json +6 -4
  3. package/src/App.vue +9 -0
  4. package/src/assets/quasar-logo-vertical.svg +15 -0
  5. package/src/boot/.gitkeep +0 -0
  6. package/src/boot/google-maps.js +11 -0
  7. package/src/components/ComponentLink.vue +26 -0
  8. package/src/components/core/UAvatar.vue +161 -0
  9. package/src/components/core/UAvatarGroup.vue +119 -0
  10. package/src/components/core/UBadgeStd.vue +91 -0
  11. package/src/components/core/UBannerStd.vue +115 -0
  12. package/src/components/core/UBreadCrumbs.vue +67 -0
  13. package/src/components/core/UBtnIcon.vue +159 -0
  14. package/src/components/core/UBtnStd.vue +129 -0
  15. package/src/components/core/UBtnToggle.vue +68 -0
  16. package/src/components/core/UCheckboxStd.vue +95 -0
  17. package/src/components/core/UChip.vue +251 -0
  18. package/src/components/core/UDialogStd.vue +228 -0
  19. package/src/components/core/UDrawer.vue +211 -0
  20. package/src/components/core/UInnerLoader.vue +58 -0
  21. package/src/components/core/UInputAddressLookup.vue +466 -0
  22. package/src/components/core/UInputPhoneStd.vue +295 -0
  23. package/src/components/core/UInputTextStd.vue +293 -0
  24. package/src/components/core/UMenuButtonStd.vue +274 -0
  25. package/src/components/core/UMenuDropdown.vue +77 -0
  26. package/src/components/core/UMenuDropdownAdvancedSearch.vue +262 -0
  27. package/src/components/core/UMenuItem.vue +132 -0
  28. package/src/components/core/UMultiSelectStd.vue +259 -0
  29. package/src/components/core/UPagination.vue +104 -0
  30. package/src/components/core/URadioBtn.vue +116 -0
  31. package/src/components/core/URadioStd.vue +62 -0
  32. package/src/components/core/USelectStd.vue +233 -0
  33. package/src/components/core/UTabBtnStd.vue +167 -0
  34. package/src/components/core/UTable/UTable.vue +93 -0
  35. package/src/components/core/UTable/UTd.vue +63 -0
  36. package/src/components/core/UTable/UTh.vue +48 -0
  37. package/src/components/core/UTable/UTr.vue +20 -0
  38. package/src/components/core/UTableStd.vue +636 -0
  39. package/src/components/core/UTabsStd.vue +111 -0
  40. package/src/components/core/UToggleStd.vue +159 -0
  41. package/src/components/core/UTooltip.vue +71 -0
  42. package/src/components/index.js +66 -0
  43. package/src/composables/useNotify.js +79 -0
  44. package/src/composables/useOverlayLoader.js +23 -0
  45. package/src/css/app.sass +159 -0
  46. package/src/css/colors.sass +101 -0
  47. package/src/css/media.sass +1 -0
  48. package/src/css/quasar.variables.sass +119 -0
  49. package/src/css/typography.sass +0 -0
  50. package/src/css/vars/colors.variables.sass +126 -0
  51. package/src/layouts/MainLayout.vue +177 -0
  52. package/src/pages/AdvancedSearch.vue +512 -0
  53. package/src/pages/Avatar.vue +77 -0
  54. package/src/pages/AvatarGroup.vue +139 -0
  55. package/src/pages/BadgeStd.vue +83 -0
  56. package/src/pages/BannerPage.vue +76 -0
  57. package/src/pages/BreadCrumbs.vue +100 -0
  58. package/src/pages/BtnIcon.vue +120 -0
  59. package/src/pages/BtnStd.vue +138 -0
  60. package/src/pages/BtnToggle.vue +131 -0
  61. package/src/pages/CheckBox.vue +62 -0
  62. package/src/pages/Chip.vue +108 -0
  63. package/src/pages/ComponentBase.vue +54 -0
  64. package/src/pages/Dialog.vue +206 -0
  65. package/src/pages/Drawer.vue +128 -0
  66. package/src/pages/ErrorNotFound.vue +11 -0
  67. package/src/pages/IndexPage.vue +11 -0
  68. package/src/pages/InnerLoader.vue +81 -0
  69. package/src/pages/InputAddressLookup.vue +258 -0
  70. package/src/pages/InputPhone.vue +152 -0
  71. package/src/pages/InputText.vue +140 -0
  72. package/src/pages/MenuButton.vue +194 -0
  73. package/src/pages/MenuDropdown.vue +79 -0
  74. package/src/pages/MenuItem.vue +68 -0
  75. package/src/pages/MultiSelectStd.vue +174 -0
  76. package/src/pages/NotifyPage.vue +109 -0
  77. package/src/pages/OverlayLoader.vue +128 -0
  78. package/src/pages/Pagination.vue +71 -0
  79. package/src/pages/Radio.vue +80 -0
  80. package/src/pages/RadioBtn.vue +104 -0
  81. package/src/pages/SelectStd.vue +160 -0
  82. package/src/pages/TabButtonPage.vue +126 -0
  83. package/src/pages/TablePage.vue +375 -0
  84. package/src/pages/TabsPage.vue +261 -0
  85. package/src/pages/TogglePage.vue +58 -0
  86. package/src/pages/TooltipPage.vue +125 -0
  87. package/src/router/index.js +34 -0
  88. package/src/router/routes.js +149 -0
  89. package/dist/spa/assets/Avatar.45667392.js +0 -9
  90. package/dist/spa/assets/AvatarGroup.99557443.js +0 -9
  91. package/dist/spa/assets/AvatarGroup.bb4cd03a.css +0 -1
  92. package/dist/spa/assets/BadgeStd.ee4129c5.js +0 -6
  93. package/dist/spa/assets/BannerPage.6c6a98c4.js +0 -10
  94. package/dist/spa/assets/BannerPage.d195fcac.css +0 -1
  95. package/dist/spa/assets/BtnIcon.89e50d2e.css +0 -1
  96. package/dist/spa/assets/BtnIcon.934f8c5b.js +0 -10
  97. package/dist/spa/assets/BtnStd.95fc4510.js +0 -11
  98. package/dist/spa/assets/CheckBox.3c204a4b.css +0 -1
  99. package/dist/spa/assets/CheckBox.fbc0bd1a.js +0 -7
  100. package/dist/spa/assets/Chip.49ffc857.js +0 -11
  101. package/dist/spa/assets/Chip.74acaa33.css +0 -1
  102. package/dist/spa/assets/ComponentBase.1ae19b7e.js +0 -1
  103. package/dist/spa/assets/ErrorNotFound.6cccfaee.js +0 -1
  104. package/dist/spa/assets/IndexPage.17d09b76.js +0 -1
  105. package/dist/spa/assets/InputText.19c0d7d1.css +0 -1
  106. package/dist/spa/assets/InputText.3fcd97a4.js +0 -20
  107. package/dist/spa/assets/KFOkCnqEu92Fr1MmgVxIIzQ.34e9582c.woff +0 -0
  108. package/dist/spa/assets/KFOlCnqEu92Fr1MmEU9fBBc-.9ce7f3ac.woff +0 -0
  109. package/dist/spa/assets/KFOlCnqEu92Fr1MmSU5fBBc-.bf14c7d7.woff +0 -0
  110. package/dist/spa/assets/KFOlCnqEu92Fr1MmWUlfBBc-.e0fd57c0.woff +0 -0
  111. package/dist/spa/assets/KFOlCnqEu92Fr1MmYUtfBBc-.f6537e32.woff +0 -0
  112. package/dist/spa/assets/KFOmCnqEu92Fr1Mu4mxM.f2abf7fb.woff +0 -0
  113. package/dist/spa/assets/MainLayout.912bb0f8.js +0 -1
  114. package/dist/spa/assets/MultiSelectStd.644b108c.js +0 -17
  115. package/dist/spa/assets/MultiSelectStd.c7af49eb.css +0 -1
  116. package/dist/spa/assets/QAvatar.5940a79e.js +0 -1
  117. package/dist/spa/assets/QCheckbox.48b43f7d.js +0 -1
  118. package/dist/spa/assets/QPage.ca395ec4.js +0 -1
  119. package/dist/spa/assets/QRadio.0a7f5e2c.js +0 -1
  120. package/dist/spa/assets/QResizeObserver.30c3566c.js +0 -1
  121. package/dist/spa/assets/QSelect.a40eb786.js +0 -1
  122. package/dist/spa/assets/QTabs.72f2507e.js +0 -1
  123. package/dist/spa/assets/QToggle.376c48be.js +0 -1
  124. package/dist/spa/assets/QTooltip.5aa8e325.js +0 -1
  125. package/dist/spa/assets/Radio.0ac35288.js +0 -7
  126. package/dist/spa/assets/Radio.aca54a89.css +0 -1
  127. package/dist/spa/assets/SelectStd.5c6891db.css +0 -1
  128. package/dist/spa/assets/SelectStd.daf1def9.js +0 -16
  129. package/dist/spa/assets/TabButtonPage.20e871dd.js +0 -7
  130. package/dist/spa/assets/TabButtonPage.36ce9f9c.css +0 -1
  131. package/dist/spa/assets/TabsPage.9b94ff39.css +0 -1
  132. package/dist/spa/assets/TabsPage.b92cccee.js +0 -9
  133. package/dist/spa/assets/TogglePage.8129b631.css +0 -1
  134. package/dist/spa/assets/TogglePage.ba6e325c.js +0 -9
  135. package/dist/spa/assets/UAvatar.dda7e478.js +0 -1
  136. package/dist/spa/assets/UAvatar.ea8daa38.css +0 -1
  137. package/dist/spa/assets/UBadgeStd.3965db9a.css +0 -1
  138. package/dist/spa/assets/UBadgeStd.e165ee05.js +0 -1
  139. package/dist/spa/assets/UBtnStd.979ec4e8.js +0 -1
  140. package/dist/spa/assets/UBtnStd.bdd4f5e5.css +0 -1
  141. package/dist/spa/assets/UTooltip.d2e04d0c.js +0 -1
  142. package/dist/spa/assets/UTooltip.efa029a7.css +0 -1
  143. package/dist/spa/assets/dom.e9d4ad51.js +0 -1
  144. package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.fd84f88b.woff +0 -0
  145. package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.4a4dbc62.woff2 +0 -0
  146. package/dist/spa/assets/format.41663636.js +0 -1
  147. package/dist/spa/assets/index.43c62a18.js +0 -21
  148. package/dist/spa/assets/index.4fbd73cf.css +0 -5
  149. package/dist/spa/assets/option-sizes.10cc02d3.js +0 -1
  150. package/dist/spa/assets/render.e67ff27a.js +0 -1
  151. package/dist/spa/assets/tooltip.7c0d0774.js +0 -8
  152. package/dist/spa/assets/touch.9135741d.js +0 -1
  153. package/dist/spa/assets/use-checkbox.44a623c0.js +0 -1
  154. package/dist/spa/favicon.ico +0 -0
  155. package/dist/spa/icons/caret-down.svg +0 -5
  156. package/dist/spa/icons/circle-xmark.svg +0 -6
  157. package/dist/spa/icons/favicon-128x128.png +0 -0
  158. package/dist/spa/icons/favicon-16x16.png +0 -0
  159. package/dist/spa/icons/favicon-32x32.png +0 -0
  160. package/dist/spa/icons/favicon-96x96.png +0 -0
  161. package/dist/spa/index.html +0 -3
@@ -0,0 +1,375 @@
1
+ <script setup>
2
+ import UTableStd from '../components/core/UTableStd.vue'
3
+ import ComponentBase from './ComponentBase.vue'
4
+ import { computed, ref, watch } from 'vue'
5
+
6
+ defineOptions({
7
+ name: 'TablePage',
8
+ })
9
+
10
+ const htmlContent = `<UTableStd
11
+ v-model:selected-rows="selectedRows"
12
+ v-model:rows="rows"
13
+ v-model:columns="columns"
14
+ v-model:pagination="pagination"
15
+ :tableRowHover="tableRowHover" // hover effect on each row of table
16
+ :separator="separator"
17
+ :loading="loading"
18
+ :multiSelection="multiSelection" // if user want to add selection to table
19
+ :flat="flat"
20
+ :bordered="bordered"
21
+ :grid="grid" // grid display for different screens
22
+ :virtualScroll="virtualScroll" // adding virtual Scroll to handle many rows in thousands
23
+ :stickyHeader="stickyHeader" // make sticky header
24
+ :isCustomSort="isCustomSort"
25
+ @onCustomSort="handleCustomSort" // is user adding custom sort need to emit this event
26
+ :customClass="customClass" // if user want to add any custom class
27
+ :title="title"
28
+ :showPagination="showPagination"
29
+ />
30
+
31
+
32
+ // columns configurations
33
+ {
34
+ field: 'name',
35
+ label: 'Dessert (100g serving)',
36
+ align: 'left',
37
+ sortable: true,
38
+ type: 'text',
39
+ sortOrder: 'asc', // sortOrder is required to sort according/descending to data type like text, number
40
+ avatarKey: 'image', // if user want to show avtar/icon/initials need to pass this, also modify rows like this
41
+ image: {type: 'initials/image',value: 'database value',name: 'databasekey'},
42
+ captionKey: 'calories',
43
+ autoWidth: true,
44
+ style: 'color: red; width: 200px !important', // custom style on td, also its good to add property in percentage for custom styling
45
+ classes: 'my-classs', // custom class on td
46
+ headerStyle: 'width:50%', // custom header style
47
+ headerClasses: 'my-header-class', // custom header classes
48
+ showChipTooltip:true/false // to hide show tooltip on chip
49
+ }
50
+ `
51
+
52
+ const columns = ref([
53
+ {
54
+ field: 'name',
55
+ label: 'Dessert (100g serving)',
56
+ align: 'left',
57
+ sortable: true,
58
+ type: 'text',
59
+ sortOrder: 'asc', // sortOrder is required to sort according/descending to data type like text, number
60
+ avatarKey: 'image', // if user want to show avtar/icon/initials need to pass this, { type: 'initials/image', value: value from database, name: 'name' }
61
+ captionKey: 'calories',
62
+ autoWidth: true,
63
+ // style: 'color: red; width: 200px !important',
64
+ // classes: ['my-classs'],
65
+ headerStyle: 'width:10% !important',
66
+ // headerClasses: ['my-header-class'],
67
+ },
68
+ {
69
+ align: 'center',
70
+ label: 'Calories',
71
+ field: 'calories',
72
+ sortable: true,
73
+ type: 'number',
74
+ sortOrder: 'desc',
75
+ align: 'center',
76
+ captionKey: 'calories', // if user want to show any caption below primary text need to pass this key with data key
77
+ autoWidth: true,
78
+ },
79
+ {
80
+ label: 'Fat (g)',
81
+ field: 'fat',
82
+ sortable: true,
83
+ type: 'number',
84
+ sortOrder: 'desc',
85
+ align: 'center',
86
+ autoWidth: true,
87
+ },
88
+ {
89
+ label: 'Carbs (g)',
90
+ field: 'carbs',
91
+ align: 'center',
92
+ autoWidth: true,
93
+ },
94
+ {
95
+ label: 'Protein (g)',
96
+ field: 'protein',
97
+ align: 'center',
98
+ autoWidth: true,
99
+ },
100
+ {
101
+ label: 'Sodium (mg)',
102
+ field: 'sodium',
103
+ align: 'center',
104
+ autoWidth: true,
105
+ },
106
+ {
107
+ label: 'Active',
108
+ field: 'active',
109
+ sortable: true,
110
+ type: 'text',
111
+ sortOrder: 'asc',
112
+ chipValues: [
113
+ // to show different types of chip
114
+ { value: 'Active', color: 'positive' },
115
+ { value: 'Inactive', color: 'accent' },
116
+ { value: 'Reghold', color: 'warning' },
117
+ { value: 'Default', color: 'primary' },
118
+ ],
119
+ align: 'center',
120
+ showChipTooltip: true, // to show and hide tooltip on chip only
121
+ offset: [14, 14], // tooltip offset to set position
122
+ anchor: 'bottom middle', // tooltip anchor
123
+ autoWidth: true,
124
+ },
125
+ {
126
+ label: 'Iron (%)',
127
+ field: 'iron',
128
+ sortable: true,
129
+ type: 'text',
130
+ sortOrder: 'asc',
131
+ align: 'center',
132
+ autoWidth: true,
133
+ },
134
+ {
135
+ label: '',
136
+ field: 'action',
137
+ align: 'center',
138
+ autoWidth: true,
139
+ actions: [
140
+ // {
141
+ // label: 'View Team',
142
+ // flat: true,
143
+ // icon: 'fa-kit-duotone fa-eye',
144
+ // handler: () => {
145
+ // console.log('clicked',row)
146
+ // },
147
+ // size: 'sm',
148
+ // color: 'primary',
149
+ // tooltip: "View Team"
150
+ // },
151
+ {
152
+ icon: 'fa-kit-duotone fa-eye',
153
+ label: 'Edit', //for aria label
154
+ handler: (row) => handleEdit(row),
155
+ size: 'sm',
156
+ tooltip: 'View Team',
157
+ },
158
+ {
159
+ icon: 'fa-kit-duotone fa-circle-bolt',
160
+ label: 'Open', //for aria label
161
+ handler: (row) => handleOpen(row),
162
+ size: 'sm',
163
+ tooltip: 'Remove Team',
164
+ },
165
+ {
166
+ icon: 'fa-kit-duotone fa-circle-arrow-down',
167
+ label: 'Open', //for aria label
168
+ handler: (row) => handleOpen(row),
169
+ size: 'sm',
170
+ tooltip: 'Down',
171
+ },
172
+ {
173
+ icon: 'fa-kit-duotone fa-circle-arrow-up',
174
+ label: 'Open', //for aria label
175
+ handler: (row) => handleOpen(row),
176
+ size: 'sm',
177
+ tooltip: 'UP',
178
+ },
179
+ ],
180
+ },
181
+ ])
182
+
183
+ const columnsData = computed(() => {
184
+ return columns.value
185
+ })
186
+
187
+ const handleEdit = (row) => {
188
+ console.log(row, 'demo')
189
+ }
190
+
191
+ const handleOpen = (row) => {
192
+ console.log(row, 'demo')
193
+ }
194
+
195
+ const rowsData = computed(() => {
196
+ let newRows = []
197
+ for (let index = 0; index < 5000; index++) {
198
+ newRows.push({
199
+ _id: `${index + 1 * 295}`,
200
+ name: `Frozen Yogurt - ${index}`,
201
+ calories: 159 + index * 1000,
202
+ fat: 6.0 + index,
203
+ carbs: 24 + index,
204
+ protein: 4.0 + index,
205
+ sodium: 87 + index / 2,
206
+ active: index % 2 ? 'Active' : isPrime(index) ? 'Reghold' : 'Inactive',
207
+ iron: `1% - ${index}`,
208
+ image: {
209
+ type: 'initials',
210
+ value: 'AC',
211
+ name: `Frozen Yogurt - ${index}`,
212
+ },
213
+ })
214
+ }
215
+ return newRows
216
+ })
217
+
218
+ const tableRowHover = ref(false)
219
+ const separator = ref('horizontal')
220
+ const loading = ref(false)
221
+ const flat = ref(false)
222
+ const bordered = ref(false)
223
+ const multiSelection = ref(false)
224
+ const grid = ref(false)
225
+ const virtualScroll = ref(false)
226
+ const stickyHeader = ref(true)
227
+ const isCustomSort = ref(false)
228
+ const customClass = ref('')
229
+ const showPagination = ref(true)
230
+ const title = ref('My table')
231
+ const pagination = ref({
232
+ page: 1,
233
+ rowsPerPage: 15,
234
+ // rowsNumber: xx if getting data from a server
235
+ })
236
+ const selectedRows = ref([])
237
+
238
+ const isPrime = (number) => {
239
+ if (number <= 1) {
240
+ return false
241
+ }
242
+ for (var i = 2; i < number; i++) {
243
+ if (number % i == 0) {
244
+ return false
245
+ }
246
+ }
247
+ return true
248
+ }
249
+
250
+ watch(virtualScroll, (newValue, oldValue) => {
251
+ if (newValue) {
252
+ pagination.value.rowsPerPage = 100
253
+ } else {
254
+ pagination.value.rowsPerPage = 15
255
+ }
256
+ })
257
+
258
+ const handleCustomSort = (key, sortOrder, type) => {
259
+ alert('This is custom sort.')
260
+ }
261
+ </script>
262
+
263
+ <template>
264
+ <q-page class="flex flex-center">
265
+ <ComponentBase
266
+ figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-27&t=RjtvChIRixuak5fz-0"
267
+ cardWidth="90%"
268
+ >
269
+ <template v-slot:component>
270
+ <UTableStd
271
+ v-model:selected-rows="selectedRows"
272
+ v-model:rows="rowsData"
273
+ v-model:columns="columnsData"
274
+ v-model:pagination="pagination"
275
+ :tableRowHover="tableRowHover"
276
+ :separator="separator"
277
+ v-model:loading="loading"
278
+ :multiSelection="multiSelection"
279
+ :flat="flat"
280
+ :bordered="bordered"
281
+ :grid="grid"
282
+ :virtualScroll="virtualScroll"
283
+ :stickyHeader="stickyHeader"
284
+ :isCustomSort="isCustomSort"
285
+ @onCustomSort="handleCustomSort"
286
+ :customClass="customClass"
287
+ :title="title"
288
+ :showPagination="showPagination"
289
+ />
290
+ </template>
291
+ <template v-slot:properties>
292
+ <div class="column q-gutter-y-lg">
293
+ <div class="flex justify-start items-center">
294
+ <q-input
295
+ class="q-ml-sm"
296
+ label="Table Title"
297
+ v-model="title"
298
+ ></q-input>
299
+ </div>
300
+ <q-option-group
301
+ v-model="separator"
302
+ inline
303
+ :options="[
304
+ { label: 'Horizontal (default)', value: 'horizontal' },
305
+ { label: 'Vertical', value: 'vertical' },
306
+ { label: 'Cell', value: 'cell' },
307
+ { label: 'None', value: 'none' },
308
+ ]"
309
+ />
310
+
311
+ <div class="flex justify-start items-center">
312
+ <q-checkbox
313
+ size="sm"
314
+ v-model="multiSelection"
315
+ label="Multi Selection"
316
+ />
317
+ <q-checkbox
318
+ size="sm"
319
+ v-model="showPagination"
320
+ label="Show pagination"
321
+ />
322
+ <q-checkbox
323
+ class="q-ml-sm"
324
+ size="sm"
325
+ v-model="loading"
326
+ label="Loading"
327
+ />
328
+ <q-checkbox class="q-ml-sm" size="sm" v-model="flat" label="Flat" />
329
+ <q-checkbox
330
+ class="q-ml-sm"
331
+ size="sm"
332
+ v-model="bordered"
333
+ label="Bordered"
334
+ />
335
+ <q-checkbox
336
+ class="q-ml-sm"
337
+ size="sm"
338
+ v-model="tableRowHover"
339
+ label="Disable Table Row Hover Effect"
340
+ />
341
+ <q-checkbox
342
+ class="q-ml-sm"
343
+ size="sm"
344
+ v-model="grid"
345
+ label="Grid Style"
346
+ />
347
+ <q-checkbox
348
+ class="q-ml-sm"
349
+ size="sm"
350
+ v-model="virtualScroll"
351
+ label="Virtual Scroll"
352
+ />
353
+ <q-checkbox
354
+ class="q-ml-sm"
355
+ size="sm"
356
+ v-model="stickyHeader"
357
+ label="Sticky Header"
358
+ />
359
+ <q-checkbox
360
+ class="q-ml-sm"
361
+ size="sm"
362
+ v-model="isCustomSort"
363
+ label="Custom Sorting"
364
+ />
365
+ </div>
366
+ </div>
367
+ </template>
368
+ <template v-slot:code>
369
+ <pre><code>{{ htmlContent }}</code></pre>
370
+ </template>
371
+ </ComponentBase>
372
+ </q-page>
373
+ </template>
374
+
375
+ <style lang="sass"></style>
@@ -0,0 +1,261 @@
1
+ <script setup>
2
+ import { UTabsStd } from 'src/components'
3
+ import ComponentBase from './ComponentBase.vue'
4
+ import { computed, ref } from 'vue'
5
+
6
+ defineOptions({
7
+ name: 'TabsPage',
8
+ })
9
+
10
+ const align = ref('Justify')
11
+ const isShowLeftIcon = ref(false)
12
+ const isShowRightIcon = ref(false)
13
+ const isShowOnlyIcon = ref(false)
14
+ const behaviour = ref(true)
15
+ const alignment = computed(() => {
16
+ return align.value.toLocaleLowerCase()
17
+ })
18
+
19
+ const htmlContent = `<UTabsStd
20
+ v-model="selectedTab"
21
+ :tabs="tabsOptions"
22
+ :align="align"
23
+ />`
24
+
25
+ const contentInfo = `// The 'tabOptions' property allows you to configure tabs for both routing and basic use.
26
+ To enable routing, include a 'route' property in each tab configuration, which links the tab to specific routes.
27
+ For basic tabs, omit the 'route' property. Additionally, the component supports keyboard navigation,
28
+ enabling users to switch between tabs using the left and right arrow keys, ensuring improved accessibility.
29
+ [{name: 'home', label: 'Home', leftIcon: 'home', rightIcon: 'home', route:'home'}]`
30
+
31
+ const alignmentOptions = ['Justify', 'Left', 'Right']
32
+ const defaultTabs = ref([
33
+ {
34
+ name: 'home',
35
+ label: 'Home',
36
+ leftIcon: 'fa-kit-duotone fa-home',
37
+ rightIcon: 'fa-kit-duotone fa-home',
38
+ route: 'home',
39
+ disable: false,
40
+ },
41
+ {
42
+ name: 'cart',
43
+ label: 'Cart',
44
+ leftIcon: 'fa-kit-duotone fa-cart-shopping',
45
+ rightIcon: 'fa-kit-duotone fa-cart-shopping',
46
+ route: 'cart',
47
+ disable: false,
48
+ },
49
+ {
50
+ name: 'info',
51
+ label: 'Information',
52
+ leftIcon: 'fa-kit-duotone fa-circle-exclamation',
53
+ rightIcon: 'fa-kit-duotone fa-circle-exclamation',
54
+ route: 'info',
55
+ disable: true,
56
+ },
57
+ {
58
+ name: 'mail',
59
+ label: 'Mails',
60
+ leftIcon: 'fa-kit-duotone fa-envelope',
61
+ rightIcon: 'fa-kit-duotone fa-envelope',
62
+ route: 'mail',
63
+ disable: false,
64
+ },
65
+ ])
66
+ const tabs = computed(() => {
67
+ return defaultTabs.value.map((tab) => {
68
+ if (!behaviour.value) {
69
+ return { ...tab, route: undefined }
70
+ }
71
+ return tab
72
+ })
73
+ })
74
+
75
+ const isShowBothIcon = computed(() => {
76
+ return isShowLeftIcon.value && isShowRightIcon.value
77
+ })
78
+
79
+ const tabsOptions = computed(() => {
80
+ return tabs.value.map((tab) => {
81
+ if (isShowOnlyIcon.value) {
82
+ // Only show the left icon , hide right icon
83
+ return { ...tab, rightIcon: undefined, label: undefined }
84
+ }
85
+
86
+ if (!isShowLeftIcon.value && !isShowRightIcon.value) {
87
+ // Show only the label
88
+ return { ...tab, leftIcon: undefined, rightIcon: undefined }
89
+ }
90
+
91
+ if (!isShowLeftIcon.value) {
92
+ // Show right icon with label
93
+ return { ...tab, leftIcon: undefined }
94
+ }
95
+
96
+ if (!isShowRightIcon.value) {
97
+ // Show left icon with label
98
+ return { ...tab, rightIcon: undefined }
99
+ }
100
+
101
+ // Show both icons with label
102
+ return tab
103
+ })
104
+ })
105
+
106
+ const handleOnlyIconChange = (value, evt) => {
107
+ if (value) {
108
+ isShowLeftIcon.value = true // when it is true only one icon should visible
109
+ isShowRightIcon.value = false
110
+ }
111
+ isShowOnlyIcon.value = value
112
+ }
113
+
114
+ const handleBothIconChange = (value, evt) => {
115
+ isShowLeftIcon.value = value
116
+ isShowRightIcon.value = value
117
+ }
118
+
119
+ const handleBehaviourChange = (value) => {
120
+ behaviour.value = value
121
+ }
122
+
123
+ const updateItem = (index, key, value) => {
124
+ tabs.value[index][key] = value
125
+ }
126
+
127
+ const selectedTab = ref('home') // if user don't want to use tabs as route tab then it should be use like this
128
+ </script>
129
+
130
+ <template>
131
+ <q-page class="flex flex-center">
132
+ <ComponentBase
133
+ figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-28&t=K9pIC6Ve5iom3wvc-0"
134
+ cardWidth="70%"
135
+ >
136
+ <template v-slot:component>
137
+ <UTabsStd
138
+ v-model="selectedTab"
139
+ :tabs="tabsOptions"
140
+ :align="alignment"
141
+ />
142
+
143
+ <q-tab-panels
144
+ class="bg-transparent"
145
+ v-model="selectedTab"
146
+ keep-alive
147
+ animated
148
+ transition-prev="scale"
149
+ transition-next="scale"
150
+ >
151
+ <q-tab-panel class="text-center" name="home">
152
+ <q-card class="q-pa-sm">
153
+ <div class="text-h6">Home</div>
154
+ This is a example q-tab-panels with animation - Home
155
+ </q-card>
156
+ </q-tab-panel>
157
+ <q-tab-panel class="text-center" name="cart">
158
+ <q-card class="q-pa-sm">
159
+ <div class="text-h6">Cart</div>
160
+ This is a example q-tab-panels with animation - Cart
161
+ </q-card>
162
+ </q-tab-panel>
163
+ <q-tab-panel class="text-center" name="info">
164
+ <q-card class="q-pa-sm">
165
+ <div class="text-h6">Info</div>
166
+ This is a example q-tab-panels with animation - Info
167
+ </q-card>
168
+ </q-tab-panel>
169
+ <q-tab-panel class="text-center" name="mail">
170
+ <q-card class="q-pa-sm">
171
+ <div class="text-h6">Mail</div>
172
+ This is a example q-tab-panels with animation - Mail
173
+ </q-card>
174
+ </q-tab-panel>
175
+ </q-tab-panels>
176
+ </template>
177
+ <template v-slot:properties>
178
+ <div class="column q-gutter-y-lg" style="position: relative">
179
+ <q-toggle
180
+ color="primary"
181
+ label="Route Tabs"
182
+ v-model="behaviour"
183
+ @update:modelValue="handleBehaviourChange"
184
+ style="position: absolute; right: 0.5rem; top: -35px"
185
+ />
186
+ <q-select
187
+ v-model="align"
188
+ :options="alignmentOptions"
189
+ label="Alignment"
190
+ />
191
+ <div class="q-mb-sm">
192
+ <q-checkbox
193
+ class="q-mr-sm"
194
+ size="xs"
195
+ v-model="isShowOnlyIcon"
196
+ @update:modelValue="handleOnlyIconChange"
197
+ label="Only Icon"
198
+ />
199
+ <q-checkbox
200
+ class="q-mr-sm"
201
+ size="xs"
202
+ v-model="isShowLeftIcon"
203
+ label="Left Icon"
204
+ :disable="isShowOnlyIcon"
205
+ />
206
+ <q-checkbox
207
+ class="q-mr-sm"
208
+ size="xs"
209
+ v-model="isShowRightIcon"
210
+ label="Right Icon"
211
+ :disable="isShowOnlyIcon"
212
+ />
213
+ <q-checkbox
214
+ class="q-mr-sm"
215
+ size="xs"
216
+ :model-value="isShowBothIcon"
217
+ @update:modelValue="handleBothIconChange"
218
+ label="Left-Right Icon"
219
+ :disable="isShowOnlyIcon"
220
+ />
221
+ </div>
222
+ <div v-for="(tab, index) in tabs" :key="tab.name" class="row">
223
+ <div class="col-12 col-md-2 flex justify-start items-center">
224
+ <q-checkbox
225
+ size="xs"
226
+ @input="updateItem(index, 'disable', tab.disable)"
227
+ v-model="tab.disable"
228
+ label="Disable tab"
229
+ />
230
+ </div>
231
+
232
+ <q-input
233
+ class="col-12 col-md-3"
234
+ placeholder="Label"
235
+ v-model="tab.label"
236
+ @input="updateItem(index, 'label', tab.label)"
237
+ ></q-input>
238
+ <q-input
239
+ placeholder="Left Icon"
240
+ class="col-12 col-md-3"
241
+ v-model="tab.leftIcon"
242
+ @input="updateItem(index, 'leftIcon', tab.leftIcon)"
243
+ ></q-input>
244
+ <q-input
245
+ placeholder="Right Icon"
246
+ class="col-12 col-md-4"
247
+ v-model="tab.rightIcon"
248
+ @input="updateItem(index, 'rightIcon', tab.rightIcon)"
249
+ ></q-input>
250
+ </div>
251
+ </div>
252
+ </template>
253
+ <template v-slot:code>
254
+ <pre>{{ htmlContent }}</pre>
255
+ <pre class="text-neutral-6" style="font-size: 12px; font-weight: 600">{{
256
+ contentInfo
257
+ }}</pre>
258
+ </template>
259
+ </ComponentBase>
260
+ </q-page>
261
+ </template>
@@ -0,0 +1,58 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import ComponentBase from './ComponentBase.vue'
4
+ import { UToggleStd } from 'src/components'
5
+
6
+ defineOptions({
7
+ name: 'TogglePage',
8
+ })
9
+
10
+ const htmlContent = `<UToggleStd
11
+ v-model="toggle"
12
+ id="playground-1"
13
+ name="toggle-1"
14
+ :disabled="disabled"
15
+ :label="label"
16
+ :checkedIcon="checkedIcon"
17
+ :unCheckedIcon="unCheckedIcon"
18
+ />`
19
+
20
+ const toggle = ref(false)
21
+ const disabled = ref(false)
22
+ const label = ref('Dark Mode')
23
+ const checkedIcon = ref('fa-kit-duotone fa-moon')
24
+ const unCheckedIcon = ref('fa-kit-duotone fa-sun')
25
+ </script>
26
+
27
+ <template>
28
+ <q-page class="flex flex-center">
29
+ <ComponentBase
30
+ figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-23&t=HegwRwdR5yoKKzMy-0"
31
+ >
32
+ <template v-slot:component>
33
+ <UToggleStd
34
+ v-model="toggle"
35
+ :id="`playground-1`"
36
+ :name="`toggle-1`"
37
+ :disabled="disabled"
38
+ :label="label"
39
+ :checkedIcon="checkedIcon"
40
+ :unCheckedIcon="unCheckedIcon"
41
+ />
42
+ </template>
43
+ <template v-slot:properties>
44
+ <div class="column q-gutter-y-lg">
45
+ <q-input label="Checked Icon" v-model="checkedIcon" />
46
+ <q-input label="Unchecked Icon" v-model="unCheckedIcon" />
47
+ <q-input label="Label" v-model="label" />
48
+ <q-checkbox size="xs" v-model="disabled" label="Disable" />
49
+ </div>
50
+ </template>
51
+ <template v-slot:code>
52
+ <pre><code>{{ htmlContent }}</code></pre>
53
+ </template>
54
+ </ComponentBase>
55
+ </q-page>
56
+ </template>
57
+
58
+ <style></style>