pgo-uiux2 1.0.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 (180) hide show
  1. package/.env +1 -0
  2. package/.env.production +1 -0
  3. package/.prettierrc +13 -0
  4. package/.vscode/extensions.json +3 -0
  5. package/BUTTON_GUIDE.md +257 -0
  6. package/README.md +49 -0
  7. package/THEME_REFERENCE.md +310 -0
  8. package/eslint.config.ts +27 -0
  9. package/index.html +13 -0
  10. package/package.json +85 -0
  11. package/public/favicon.ico +0 -0
  12. package/src/App.vue +368 -0
  13. package/src/assets/fonts/Faruma.ttf +0 -0
  14. package/src/components/examples/AppBarExample.vue +101 -0
  15. package/src/components/examples/AvatarExample.vue +47 -0
  16. package/src/components/examples/BannerExample.vue +287 -0
  17. package/src/components/examples/BaseInputExample.vue +25 -0
  18. package/src/components/examples/BreadcrumbExample.vue +53 -0
  19. package/src/components/examples/CardExample.vue +77 -0
  20. package/src/components/examples/ChipExample.vue +225 -0
  21. package/src/components/examples/DatePickerExample.vue +31 -0
  22. package/src/components/examples/DropdownExample.vue +84 -0
  23. package/src/components/examples/EditorExample.vue +200 -0
  24. package/src/components/examples/ExpansionPanelExample.vue +42 -0
  25. package/src/components/examples/FileUploadExample.vue +40 -0
  26. package/src/components/examples/FormExample.vue +121 -0
  27. package/src/components/examples/HugeTest.vue +8 -0
  28. package/src/components/examples/LayoutContainerExample.vue +80 -0
  29. package/src/components/examples/ModalExample.vue +82 -0
  30. package/src/components/examples/NavDrawerExample.vue +170 -0
  31. package/src/components/examples/NumberFieldExample.vue +145 -0
  32. package/src/components/examples/RadioButtonExample.vue +161 -0
  33. package/src/components/examples/SearchExample.vue +322 -0
  34. package/src/components/examples/SelectExample.vue +121 -0
  35. package/src/components/examples/StackedTableViewExample.vue +53 -0
  36. package/src/components/examples/TabExample.vue +336 -0
  37. package/src/components/examples/TableExample.vue +228 -0
  38. package/src/components/examples/TextFieldExample.vue +181 -0
  39. package/src/components/examples/TextareaExample.vue +173 -0
  40. package/src/components/examples/ThemeToggle.vue +50 -0
  41. package/src/components/examples/TimelineExample.vue +66 -0
  42. package/src/components/examples/TipTapEditorExample.vue +20 -0
  43. package/src/components/examples/TooltipExample.vue +53 -0
  44. package/src/components/examples/VueDatePickerShowcase.vue +214 -0
  45. package/src/components/examples/_DatePickerExample.vue +33 -0
  46. package/src/components/examples/__FormExample.vue +77 -0
  47. package/src/components/index.ts +25 -0
  48. package/src/components/pgo/AppBar.vue +347 -0
  49. package/src/components/pgo/Avatar.vue +139 -0
  50. package/src/components/pgo/Banner.vue +300 -0
  51. package/src/components/pgo/Breadcrumb.vue +101 -0
  52. package/src/components/pgo/Button.vue +171 -0
  53. package/src/components/pgo/Card.vue +178 -0
  54. package/src/components/pgo/ConfirmationModel.vue +32 -0
  55. package/src/components/pgo/DataTable.vue +845 -0
  56. package/src/components/pgo/DatePicker/CalendarPanel.vue +43 -0
  57. package/src/components/pgo/DatePicker/__DatePicker.vue +122 -0
  58. package/src/components/pgo/DatePicker/types.ts +11 -0
  59. package/src/components/pgo/DatePicker/useCalendar.ts +39 -0
  60. package/src/components/pgo/DatePicker/useDatePicker.ts +31 -0
  61. package/src/components/pgo/Deprecated/ToastContainer.vue +51 -0
  62. package/src/components/pgo/Deprecated/ToastItem.vue +55 -0
  63. package/src/components/pgo/Dropdown.vue +296 -0
  64. package/src/components/pgo/DropdownItem.vue +40 -0
  65. package/src/components/pgo/Editor.vue +511 -0
  66. package/src/components/pgo/ExpansionPanel.vue +185 -0
  67. package/src/components/pgo/Footer.vue +39 -0
  68. package/src/components/pgo/HeroIcon.vue +124 -0
  69. package/src/components/pgo/InputSearch.vue +194 -0
  70. package/src/components/pgo/LayoutContainer.vue +104 -0
  71. package/src/components/pgo/Main.vue +37 -0
  72. package/src/components/pgo/Modal.vue +273 -0
  73. package/src/components/pgo/NavDrawer.vue +127 -0
  74. package/src/components/pgo/NavDrawerItem.vue +161 -0
  75. package/src/components/pgo/NavigationDrawer.vue +849 -0
  76. package/src/components/pgo/OLDNavDrawer.vue +661 -0
  77. package/src/components/pgo/OldAppBar.vue +223 -0
  78. package/src/components/pgo/PApp.vue +102 -0
  79. package/src/components/pgo/Pagination.vue +242 -0
  80. package/src/components/pgo/Search copy.vue +310 -0
  81. package/src/components/pgo/Search.vue +411 -0
  82. package/src/components/pgo/StackedTableView.vue +167 -0
  83. package/src/components/pgo/Tab.vue +617 -0
  84. package/src/components/pgo/TestInput.vue +395 -0
  85. package/src/components/pgo/Timeline.vue +367 -0
  86. package/src/components/pgo/TimelineItem.vue +80 -0
  87. package/src/components/pgo/TipTapEditor.vue +315 -0
  88. package/src/components/pgo/Tooltip.NOTES.md +12 -0
  89. package/src/components/pgo/Tooltip.PROPS.md +21 -0
  90. package/src/components/pgo/Tooltip.vue +281 -0
  91. package/src/components/pgo/base/Base.vue +444 -0
  92. package/src/components/pgo/buttons/Chip.vue +324 -0
  93. package/src/components/pgo/buttons/ChipGroup.vue +224 -0
  94. package/src/components/pgo/buttons/Radio.vue +424 -0
  95. package/src/components/pgo/filters/FilterSection.vue +188 -0
  96. package/src/components/pgo/filters/Searchbar.vue +216 -0
  97. package/src/components/pgo/forms/DynamicForm.vue +45 -0
  98. package/src/components/pgo/forms/Form.vue +132 -0
  99. package/src/components/pgo/index.ts +15 -0
  100. package/src/components/pgo/inputs/Checkbox.vue +320 -0
  101. package/src/components/pgo/inputs/DatePicker.vue +395 -0
  102. package/src/components/pgo/inputs/FileUpload.vue +326 -0
  103. package/src/components/pgo/inputs/NumberField.vue +243 -0
  104. package/src/components/pgo/inputs/Radio.vue +162 -0
  105. package/src/components/pgo/inputs/RadioGroup.vue +188 -0
  106. package/src/components/pgo/inputs/Select.vue +535 -0
  107. package/src/components/pgo/inputs/TextField.vue +194 -0
  108. package/src/components/pgo/inputs/Textarea.vue +181 -0
  109. package/src/main.js +12 -0
  110. package/src/pgo-components/_index.js +31 -0
  111. package/src/pgo-components/assets/fonts/Faruma.ttf +0 -0
  112. package/src/pgo-components/assets/fonts/logo.png +0 -0
  113. package/src/pgo-components/composables/useTheme.js +10 -0
  114. package/src/pgo-components/directives/tooltip-directive.ts +393 -0
  115. package/src/pgo-components/index.js +96 -0
  116. package/src/pgo-components/lib/componentConfig.js +147 -0
  117. package/src/pgo-components/lib/core/composables/_useCalendar.ts +127 -0
  118. package/src/pgo-components/lib/core/composables/useDefaults.ts +15 -0
  119. package/src/pgo-components/lib/core/composables/useLanguageSelect.js +0 -0
  120. package/src/pgo-components/lib/core/composables/useRtl.ts +12 -0
  121. package/src/pgo-components/lib/core/defaults/createDefaults.ts +5 -0
  122. package/src/pgo-components/lib/core/defaults/defaults.ts +7 -0
  123. package/src/pgo-components/lib/core/rtl/rtl.ts +3 -0
  124. package/src/pgo-components/lib/core/rtl/setRtl.ts +19 -0
  125. package/src/pgo-components/lib/drawerState.ts +3 -0
  126. package/src/pgo-components/lib/i18n/defaultLables.js +71 -0
  127. package/src/pgo-components/lib/i18n/i18nPlugin.js +52 -0
  128. package/src/pgo-components/lib/i18n/useI18n.js +35 -0
  129. package/src/pgo-components/lib/index.ts +38 -0
  130. package/src/pgo-components/pages/Component.vue +7 -0
  131. package/src/pgo-components/pages/ComponentRenderer.vue +85 -0
  132. package/src/pgo-components/pages/Home.vue +130 -0
  133. package/src/pgo-components/pages/ListView.vue +370 -0
  134. package/src/pgo-components/pages/Page1.vue +296 -0
  135. package/src/pgo-components/pages/_Page1.vue +180 -0
  136. package/src/pgo-components/plugins/SnackBar.vue +251 -0
  137. package/src/pgo-components/plugins/SnackBarContainer.vue +53 -0
  138. package/src/pgo-components/plugins/SnackBarPlugin.ts +136 -0
  139. package/src/pgo-components/plugins/theme-plugin.js +114 -0
  140. package/src/pgo-components/plugins/types.ts +46 -0
  141. package/src/pgo-components/plugins/useSnackBar.js +11 -0
  142. package/src/pgo-components/plugins/useSnackBar.ts +21 -0
  143. package/src/pgo-components/plugins/validation-plugin.js +11 -0
  144. package/src/pgo-components/services/Entry.json +813 -0
  145. package/src/pgo-components/services/axios.js +54 -0
  146. package/src/pgo-components/services/data.json +90 -0
  147. package/src/pgo-components/services/person.json +260 -0
  148. package/src/pgo-components/services/toast.ts +44 -0
  149. package/src/pgo-components/styles/global.css +234 -0
  150. package/src/pgo-components/styles/reset.css +96 -0
  151. package/src/pgo-components/styles/tokens.css +18 -0
  152. package/src/pgo-components/styles/utilities/border-radius.css +57 -0
  153. package/src/pgo-components/styles/utilities/borders.css +85 -0
  154. package/src/pgo-components/styles/utilities/colors.css +38 -0
  155. package/src/pgo-components/styles/utilities/cursor.css +19 -0
  156. package/src/pgo-components/styles/utilities/display.css +78 -0
  157. package/src/pgo-components/styles/utilities/elevation.css +33 -0
  158. package/src/pgo-components/styles/utilities/flex.css +403 -0
  159. package/src/pgo-components/styles/utilities/float.css +41 -0
  160. package/src/pgo-components/styles/utilities/hover.css +9 -0
  161. package/src/pgo-components/styles/utilities/index.css +18 -0
  162. package/src/pgo-components/styles/utilities/opacity.css +27 -0
  163. package/src/pgo-components/styles/utilities/overflow.css +26 -0
  164. package/src/pgo-components/styles/utilities/palette.css +515 -0
  165. package/src/pgo-components/styles/utilities/position.css +14 -0
  166. package/src/pgo-components/styles/utilities/sizing.css +70 -0
  167. package/src/pgo-components/styles/utilities/spacing.css +578 -0
  168. package/src/pgo-components/styles/utilities/transitions.css +58 -0
  169. package/src/pgo-components/styles/utilities/typography.css +91 -0
  170. package/src/pgo-components/styles/utilities/z-index.css +11 -0
  171. package/src/pgo-components/tokens/index.js +337 -0
  172. package/src/router/index.js +88 -0
  173. package/src/shims-vue.d.ts +14 -0
  174. package/src/validations/validationRules.js +50 -0
  175. package/tailwind.config.js +73 -0
  176. package/test.php +5 -0
  177. package/tsconfig.json +25 -0
  178. package/ui +31 -0
  179. package/ui.pgo.mv.conf +18 -0
  180. package/vite.config.js +42 -0
@@ -0,0 +1,336 @@
1
+ <template>
2
+ <div class="space-y-8 p-6">
3
+ <div>
4
+ <h1 class="text-3xl font-bold mb-2">Tabs</h1>
5
+ </div>
6
+
7
+ <!-- Variant: Line (default) -->
8
+ <div class="border p-6 border-[var(--vts-color-borderHeavy)] ">
9
+ <h2 class="text-xl font-semibold mb-4">Line Variant (Default)</h2>
10
+ <Tab
11
+ v-model="activeTab1"
12
+ :tabs="tabsData"
13
+ variant="line"
14
+ @change="onTabChange"
15
+ >
16
+ <template #content-0>
17
+ <div class="space-y-2">
18
+ <p>This is the content for the Dashboard tab.</p>
19
+ <p class="text-sm text-gray-600 dark:text-gray-400">The line variant shows an underline under the active tab.</p>
20
+ </div>
21
+ </template>
22
+ <template #content-1>
23
+ <div class="space-y-2">
24
+ <p>This is the content for the Settings tab.</p>
25
+ <p class="text-sm text-gray-600 dark:text-gray-400">Perfect for primary navigation within a page.</p>
26
+ </div>
27
+ </template>
28
+ <template #content-2>
29
+ <div class="space-y-2">
30
+ <p>This is the content for the Profile tab.</p>
31
+ <p class="text-sm text-gray-600 dark:text-gray-400">Responsive and accessible by default.</p>
32
+ </div>
33
+ </template>
34
+ </Tab>
35
+ </div>
36
+
37
+ <!-- Variant: Pills -->
38
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
39
+ <h2 class="text-xl font-semibold mb-4">Pills Variant</h2>
40
+ <Tab
41
+ v-model="activeTab2"
42
+ :tabs="tabsData"
43
+ variant="pills"
44
+ >
45
+ <template #content-0>
46
+ <p>Pills are great for secondary navigation or filtering options.</p>
47
+ </template>
48
+ <template #content-1>
49
+ <p>They have a pill-shaped background for a modern look.</p>
50
+ </template>
51
+ <template #content-2>
52
+ <p>Fully customizable with Tailwind CSS classes.</p>
53
+ </template>
54
+ </Tab>
55
+ </div> -->
56
+
57
+ <!-- Variant: Enclosed -->
58
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
59
+ <h2 class="text-xl font-semibold mb-4">Enclosed Variant</h2>
60
+ <Tab
61
+ v-model="activeTab3"
62
+ :tabs="tabsData"
63
+ variant="enclosed"
64
+ >
65
+ <template #content-0>
66
+ <p>The enclosed variant wraps tabs in a border.</p>
67
+ </template>
68
+ <template #content-1>
69
+ <p>Great for grouping related content sections.</p>
70
+ </template>
71
+ <template #content-2>
72
+ <p>Provides visual containment for tab groups.</p>
73
+ </template>
74
+ </Tab>
75
+ </div> -->
76
+
77
+ <!-- Variant: Card -->
78
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
79
+ <h2 class="text-xl font-semibold mb-4">Card Variant</h2>
80
+ <Tab
81
+ v-model="activeTab4"
82
+ :tabs="tabsData"
83
+ variant="card"
84
+ >
85
+ <template #content-0>
86
+ <p>Card variant treats each tab as an individual card.</p>
87
+ </template>
88
+ <template #content-1>
89
+ <p>Ideal for standalone tab groups with prominent content.</p>
90
+ </template>
91
+ <template #content-2>
92
+ <p>Provides maximum visual separation between options.</p>
93
+ </template>
94
+ </Tab>
95
+ </div> -->
96
+
97
+ <!-- Size variants -->
98
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
99
+ <h2 class="text-xl font-semibold mb-4">Size Variants</h2>
100
+ <div class="space-y-6">
101
+ <div>
102
+ <h3 class="text-sm font-medium mb-2 text-gray-600">Small</h3>
103
+ <Tab
104
+ v-model="activeTab5"
105
+ :tabs="tabsData"
106
+ variant="pills"
107
+ size="sm"
108
+ >
109
+ <template #content-0><p>Small tabs</p></template>
110
+ <template #content-1><p>Compact layout</p></template>
111
+ <template #content-2><p>Dense design</p></template>
112
+ </Tab>
113
+ </div>
114
+ <div>
115
+ <h3 class="text-sm font-medium mb-2 text-gray-600">Medium (Default)</h3>
116
+ <Tab
117
+ v-model="activeTab6"
118
+ :tabs="tabsData"
119
+ variant="pills"
120
+ size="md"
121
+ >
122
+ <template #content-0><p>Medium tabs</p></template>
123
+ <template #content-1><p>Standard layout</p></template>
124
+ <template #content-2><p>Balanced spacing</p></template>
125
+ </Tab>
126
+ </div>
127
+ <div>
128
+ <h3 class="text-sm font-medium mb-2 text-gray-600">Large</h3>
129
+ <Tab
130
+ v-model="activeTab7"
131
+ :tabs="tabsData"
132
+ variant="pills"
133
+ size="lg"
134
+ >
135
+ <template #content-0><p>Large tabs</p></template>
136
+ <template #content-1><p>Spacious layout</p></template>
137
+ <template #content-2><p>Touch-friendly sizes</p></template>
138
+ </Tab>
139
+ </div>
140
+ </div>
141
+ </div> -->
142
+
143
+ <!-- Features: Closable tabs -->
144
+ <div class="border p-6 border-[var(--vts-color-borderHeavy)]">
145
+ <h2 class="text-xl font-semibold mb-4">Closable Tabs</h2>
146
+ <Tab
147
+ v-model="activeTab8"
148
+ :tabs="closableTabs"
149
+ variant="pills"
150
+ closable
151
+ @close="handleCloseTab"
152
+ >
153
+ <template #content-0><p>First closable tab</p></template>
154
+ <template #content-1><p>Second closable tab</p></template>
155
+ <template #content-2><p>Third closable tab</p></template>
156
+ </Tab>
157
+ <!-- <p class="text-xs text-gray-500 mt-2">Click the X button to close tabs. The @close event is emitted.</p> -->
158
+ </div>
159
+
160
+ <!-- Features: With Icons and Badges -->
161
+ <div class="border p-6 border-[var(--vts-color-borderHeavy)]">
162
+ <h2 class="text-xl font-semibold mb-4">Tabs with Icons & Badges</h2>
163
+ <Tab
164
+ v-model="activeTab9"
165
+ :tabs="tabsWithFeatures"
166
+ variant="line"
167
+ >
168
+ <template #content-0><p>Inbox messages loaded</p></template>
169
+ <template #content-1><p>Configuration complete</p></template>
170
+ <template #content-2><p>Your profile information</p></template>
171
+ </Tab>
172
+ </div>
173
+
174
+ <!-- Vertical tabs -->
175
+ <div class="border p-6 border-[var(--vts-color-borderHeavy)]">
176
+ <h2 class="text-xl font-semibold mb-4">Vertical Tabs</h2>
177
+ <Tab
178
+ v-model="activeTab10"
179
+ :tabs="tabsData"
180
+ variant="enclosed"
181
+ vertical
182
+ >
183
+ <template #content-0><p>Long Content</p></template>
184
+ <template #content-1><p>Short content.</p></template>
185
+ <template #content-2><p>Different content.</p></template>
186
+ </Tab>
187
+ </div>
188
+
189
+ <!-- Disabled tabs -->
190
+ <div class="border p-6 border-[var(--vts-color-borderHeavy)]">
191
+ <h2 class="text-xl font-semibold mb-4">Disabled Tabs</h2>
192
+ <Tab
193
+ v-model="activeTab11"
194
+ :tabs="disabledTabs"
195
+ variant="pills"
196
+ >
197
+ <template #content-0><p>First tab - active</p></template>
198
+ <template #content-1><p>This tab is disabled and cannot be clicked.</p></template>
199
+ <template #content-2><p>Third tab - enabled</p></template>
200
+ </Tab>
201
+ </div>
202
+
203
+ <!-- Centered & Justified -->
204
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
205
+ <h2 class="text-xl font-semibold mb-4">Layout Options</h2>
206
+ <div class="space-y-6">
207
+ <div>
208
+ <h3 class="text-sm font-medium mb-2 text-gray-600">Centered</h3>
209
+ <Tab
210
+ v-model="activeTab12"
211
+ :tabs="tabsData"
212
+ variant="line"
213
+ centered
214
+ >
215
+ <template #content-0><p>Tabs are centered</p></template>
216
+ <template #content-1><p>Good for small tab counts</p></template>
217
+ <template #content-2><p>Creates visual balance</p></template>
218
+ </Tab>
219
+ </div>
220
+ <div>
221
+ <h3 class="text-sm font-medium mb-2 text-gray-600">Justified (Equal Width)</h3>
222
+ <Tab
223
+ v-model="activeTab13"
224
+ :tabs="tabsData"
225
+ variant="line"
226
+ justified
227
+ >
228
+ <template #content-0><p>All tabs have equal width</p></template>
229
+ <template #content-1><p>Fills the container width</p></template>
230
+ <template #content-2><p>Balanced visual layout</p></template>
231
+ </Tab>
232
+ </div>
233
+ </div>
234
+ </div> -->
235
+
236
+ <!-- Event logging -->
237
+ <!-- <div class="border rounded-lg p-6 dark:border-gray-700">
238
+ <h2 class="text-xl font-semibold mb-4">Events & Keyboard Navigation</h2>
239
+ <Tab
240
+ v-model="activeTab14"
241
+ :tabs="tabsData"
242
+ variant="pills"
243
+ >
244
+ <template #content-0><p>Use arrow keys to navigate (RTL aware)</p></template>
245
+ <template #content-1><p>Home/End keys jump to first/last tab</p></template>
246
+ <template #content-2><p>All events are logged below</p></template>
247
+ </Tab>
248
+ <div class="mt-4 p-4 bg-gray-100 dark:bg-gray-900 rounded text-sm max-h-40 overflow-y-auto">
249
+ <div class="text-gray-600 dark:text-gray-400 font-mono">
250
+ <div v-if="eventLog.length === 0" class="text-gray-400">Interact with tabs to see events...</div>
251
+ <div v-for="(event, idx) in eventLog.slice(-5)" :key="idx" class="mb-1">
252
+ {{ event }}
253
+ </div>
254
+ </div>
255
+ </div>
256
+ </div> -->
257
+ </div>
258
+ </template>
259
+
260
+ <script setup>
261
+ import { ref } from 'vue'
262
+ import Tab from '../pgo/Tab.vue'
263
+
264
+ // Active tabs for different examples
265
+ const activeTab1 = ref(0)
266
+ const activeTab2 = ref(0)
267
+ const activeTab3 = ref(0)
268
+ const activeTab4 = ref(0)
269
+ const activeTab5 = ref(0)
270
+ const activeTab6 = ref(0)
271
+ const activeTab7 = ref(0)
272
+ const activeTab8 = ref(0)
273
+ const activeTab9 = ref(0)
274
+ const activeTab10 = ref(0)
275
+ const activeTab11 = ref(0)
276
+ const activeTab12 = ref(0)
277
+ const activeTab13 = ref(0)
278
+ const activeTab14 = ref(0)
279
+
280
+ // Event logging
281
+ const eventLog = ref([])
282
+
283
+ // Basic tabs
284
+ const tabsData = [
285
+ { label: 'Dashboard' },
286
+ { label: 'Settings' },
287
+ { label: 'Profile' }
288
+ ]
289
+
290
+ // Closable tabs
291
+ const closableTabs = ref([
292
+ { label: 'Tab 1' },
293
+ { label: 'Tab 2' },
294
+ { label: 'Tab 3' }
295
+ ])
296
+
297
+ // Tabs with icons and badges
298
+ const tabsWithFeatures = [
299
+ {
300
+ label: 'އިންބޮކްސް',
301
+ badge: '5',
302
+ badgeVariant: 'bg-red-500'
303
+ },
304
+ {
305
+ label: 'ސެޓިންގްސް',
306
+ badge: '2',
307
+ badgeVariant: 'bg-blue-500'
308
+ },
309
+ {
310
+ label: 'ޕްރޮފައިލް',
311
+ badge: 'New',
312
+ badgeVariant: 'bg-green-500'
313
+ }
314
+ ]
315
+
316
+ // Disabled tabs
317
+ const disabledTabs = [
318
+ { label: 'Enabled' },
319
+ { label: 'Disabled', disabled: true },
320
+ { label: 'Enabled' }
321
+ ]
322
+
323
+ // Methods
324
+ const onTabChange = (index) => {
325
+ addEvent(`Tab changed to index ${index}`)
326
+ }
327
+
328
+ const handleCloseTab = (index) => {
329
+ addEvent(`Tab ${index} closed`)
330
+ closableTabs.value.splice(index, 1)
331
+ }
332
+
333
+ const addEvent = (message) => {
334
+ eventLog.value.push(`[${new Date().toLocaleTimeString()}] ${message}`)
335
+ }
336
+ </script>
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div class="p-6 max-w-4xl mx-auto space-y-8">
3
+ <!-- <div class="p-6 max-w-7xl mx-auto"> -->
4
+ <!-- Example 1: Default Card-like styling -->
5
+ <DataTable
6
+ :items="tableData"
7
+ :headers="headers"
8
+ :server-side-options="options"
9
+ :loading="loading"
10
+ title="Users Management Table"
11
+ searchable
12
+ selectable
13
+ @update:options="handleOptionsUpdate"
14
+ @row-click="handleRowClick"
15
+ @selection-change="handleSelectionChange"
16
+ >
17
+ <!-- Custom cell content for status -->
18
+ <template #item.status="{ item }">
19
+ <Chip :label="item.status" size="small" :color="getStatusClass(item.status)" />
20
+ </template>
21
+
22
+ <!-- Custom header actions -->
23
+ <template #header-actions>
24
+ <button class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors font-medium">
25
+ Add User
26
+ </button>
27
+ </template>
28
+ </DataTable>
29
+
30
+ <!-- Example 2: Custom colored table -->
31
+ <div class="mt-8">
32
+ <DataTable
33
+ :items="tableData"
34
+ :headers="headers"
35
+ :server-side-options="options"
36
+ :loading="loading"
37
+ title=" Users Table2"
38
+ searchable
39
+ selectable
40
+ header-class="text-xl font-bold text-primary-800"
41
+ bg="bg-primary-50"
42
+ border="border-2 border-primary-200"
43
+ rounded="rounded-xl"
44
+ shadow="shadow-lg"
45
+ header-bg="bg-primary-100"
46
+ header-border="border-b border-primary-300"
47
+ header-text="text-primary-700"
48
+ row-hover="hover:bg-primary-100"
49
+ row-selected="bg-primary-200"
50
+ cell-text="text-primary-900"
51
+ input-border="border-primary-300 focus:border-primary-500 focus:ring-primary-500"
52
+ button-primary="bg-primary-600 hover:bg-primary-700 text-white"
53
+ button-secondary="bg-primary-100 hover:bg-primary-200 text-primary-700 border border-primary-300"
54
+ pagination-bg="bg-primary-50"
55
+ pagination-border="border-t-2 border-primary-300"
56
+ @update:options="handleOptionsUpdate"
57
+ @row-click="handleRowClick"
58
+ @selection-change="handleSelectionChange"
59
+ >
60
+ <!-- Custom cell content for status -->
61
+ <template #item.status="{ item }">
62
+ <Chip :label="item.status" :color="getStatusClass(item.status)" />
63
+ <!-- <span :class="getStatusClass(item.status)">
64
+ {{ item.status }}
65
+ </span> -->
66
+ </template>
67
+
68
+ <!-- Custom actions -->
69
+ <template #item-actions="{ item }">
70
+ <div class="flex space-x-2">
71
+ <Button @click.stop="editItem(item)" size="md" color="success" variant="text" icon="arrow-right-end-on-rectangle" label="" />
72
+ <Button @click.stop="deleteItem(item)" size="md" color="danger" variant="text" icon="trash" label="" />
73
+ <Button size="md" icon="pencil-square" color="primary" variant="text" label="" />
74
+ </div>
75
+ </template>
76
+
77
+ <!-- Custom header actions -->
78
+ <template #header-actions>
79
+ <button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-medium">
80
+ Add User
81
+ </button>
82
+ </template>
83
+ </DataTable>
84
+ </div>
85
+ </div>
86
+ <!-- </div> -->
87
+ </template>
88
+ <script setup>
89
+ import { ref } from 'vue'
90
+ import DataTable from '../pgo/DataTable.vue'
91
+ import Chip from '../pgo/buttons/Chip.vue'
92
+ import Button from '../pgo/Button.vue'
93
+
94
+ // Mock data for DataTable
95
+ const tableData = ref([])
96
+ const loading = ref(false)
97
+
98
+ const headers = [
99
+ { key: 'name', title: 'Name' },
100
+ { key: 'email', title: 'Email' },
101
+ { key: 'status', title: 'Status' },
102
+ { key: 'created_at', title: 'Created', format: (value) => new Date(value).toLocaleDateString() }
103
+ ]
104
+
105
+ const options = ref({
106
+ page: 1,
107
+ itemsPerPage: 10,
108
+ sortBy: [],
109
+ sortDesc: [],
110
+ itemsLength: 0
111
+ })
112
+
113
+ // Mock server data
114
+ const mockServerData = [
115
+ { id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active', created_at: '2023-01-15T10:00:00Z' },
116
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive', created_at: '2023-02-20T14:30:00Z' },
117
+ { id: 3, name: 'Bob Johnson', email: 'bob@example.com', status: 'Active', created_at: '2023-03-10T09:15:00Z' },
118
+ { id: 4, name: 'Alice Brown', email: 'alice@example.com', status: 'Pending', created_at: '2023-04-05T16:45:00Z' },
119
+ { id: 5, name: 'Charlie Wilson', email: 'charlie@example.com', status: 'Active', created_at: '2023-05-12T11:20:00Z' },
120
+ { id: 6, name: 'Diana Davis', email: 'diana@example.com', status: 'Inactive', created_at: '2023-06-18T13:00:00Z' },
121
+ { id: 7, name: 'Edward Miller', email: 'edward@example.com', status: 'Active', created_at: '2023-07-22T08:30:00Z' },
122
+ { id: 8, name: 'Fiona Garcia', email: 'fiona@example.com', status: 'Pending', created_at: '2023-08-14T15:10:00Z' },
123
+ { id: 9, name: 'George Martinez', email: 'george@example.com', status: 'Active', created_at: '2023-09-03T12:45:00Z' },
124
+ { id: 10, name: 'Helen Anderson', email: 'helen@example.com', status: 'Inactive', created_at: '2023-10-07T17:20:00Z' },
125
+ { id: 11, name: 'Ian Taylor', email: 'ian@example.com', status: 'Active', created_at: '2023-11-11T10:55:00Z' },
126
+ { id: 12, name: 'Julia Thomas', email: 'julia@example.com', status: 'Pending', created_at: '2023-12-01T14:15:00Z' }
127
+ ]
128
+
129
+ // Simulate server-side data fetching
130
+ const fetchTableData = async (newOptions) => {
131
+ loading.value = true
132
+
133
+ // Simulate API delay
134
+ await new Promise(resolve => setTimeout(resolve, 800))
135
+
136
+ let filteredData = [...mockServerData]
137
+
138
+ // Apply search filter
139
+ if (newOptions.search) {
140
+ const searchTerm = newOptions.search.toLowerCase()
141
+ filteredData = filteredData.filter(item =>
142
+ item.name.toLowerCase().includes(searchTerm) ||
143
+ item.email.toLowerCase().includes(searchTerm) ||
144
+ item.status.toLowerCase().includes(searchTerm)
145
+ )
146
+ }
147
+
148
+ // Apply sorting
149
+ if (newOptions.sortBy.length > 0) {
150
+ const sortKey = newOptions.sortBy[0]
151
+ const sortDesc = newOptions.sortDesc[0]
152
+
153
+ filteredData.sort((a, b) => {
154
+ let aVal = a[sortKey]
155
+ let bVal = b[sortKey]
156
+
157
+ // Handle date sorting
158
+ if (sortKey === 'created_at') {
159
+ aVal = new Date(aVal)
160
+ bVal = new Date(bVal)
161
+ }
162
+
163
+ // Handle string sorting
164
+ if (typeof aVal === 'string') {
165
+ aVal = aVal.toLowerCase()
166
+ bVal = bVal.toLowerCase()
167
+ }
168
+
169
+ if (aVal < bVal) return sortDesc ? 1 : -1
170
+ if (aVal > bVal) return sortDesc ? -1 : 1
171
+ return 0
172
+ })
173
+ }
174
+
175
+ // Update total count
176
+ options.value.itemsLength = filteredData.length
177
+
178
+ // Apply pagination
179
+ const start = (newOptions.page - 1) * newOptions.itemsPerPage
180
+ const end = start + newOptions.itemsPerPage
181
+ tableData.value = filteredData.slice(start, end)
182
+
183
+ loading.value = false
184
+ }
185
+
186
+ // Handle table options update
187
+ const handleOptionsUpdate = (newOptions) => {
188
+ options.value = { ...options.value, ...newOptions }
189
+ fetchTableData(newOptions)
190
+ }
191
+
192
+ // Handle row click
193
+ const handleRowClick = (item, index) => {
194
+ console.log('Row clicked:', item, index)
195
+ }
196
+
197
+ // Handle selection change
198
+ const handleSelectionChange = (selectedIds, selectedItems) => {
199
+ console.log('Selection changed:', selectedIds, selectedItems)
200
+ }
201
+
202
+ // Get status class for styling
203
+ const getStatusClass = (status) => {
204
+ switch (status?.toLowerCase()) {
205
+ case 'active':
206
+ return 'success'
207
+ case 'inactive':
208
+ return 'error'
209
+ case 'pending':
210
+ return 'warning'
211
+ default:
212
+ return 'primary'
213
+ }
214
+ }
215
+
216
+ // Edit item function
217
+ const editItem = (item) => {
218
+ console.log('Edit item:', item)
219
+ }
220
+
221
+ // Delete item function
222
+ const deleteItem = (item) => {
223
+ console.log('Delete item:', item)
224
+ }
225
+
226
+ // Initial data load
227
+ fetchTableData(options.value)
228
+ </script>