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,82 @@
1
+ <template>
2
+ <div class="flex gap-2">
3
+ <Button color="primary" @click="basic = true">Open Basic Modal</Button>
4
+ <Button color="primary" @click="persistent = true">Open Persistent Modal</Button>
5
+ <Button color="primary" @click="bottom = true">Open Bottom Sheet</Button>
6
+ <Button color="primary" @click="fullscreen = true">Open Fullscreen Modal</Button>
7
+
8
+ <!-- Basic -->
9
+ <Modal v-model="basic">
10
+ <template #header>
11
+ <div class="flex items-center justify-between">
12
+ <h2 class="text-lg font-semibold" :style="headingStyles">Basic Modal</h2>
13
+ <Button color="primary" @click="basic = false">Close</Button>
14
+ </div>
15
+ </template>
16
+ <p :style="textStyles">Click outside or press ESC to close.</p>
17
+ </Modal>
18
+
19
+ <!-- Persistent -->
20
+ <Modal v-model="persistent" persistent>
21
+ <template #header>
22
+ <h2 class="text-lg font-semibold faruma" :style="headingStyles">ތަޅުވާ މޮޑެލް</h2>
23
+ </template>
24
+ <p class="faruma" :style="textStyles">ތެޅެންޔާ ތަޅުވާނެ</p>
25
+ <template #footer>
26
+ <Button class="faruma" color="primary" @click="persistent = false">ފަހިމްތި</Button>
27
+ </template>
28
+ </Modal>
29
+
30
+ <!-- Bottom sheet -->
31
+ <Modal v-model="bottom" transition="bottom" modal-class="rounded">
32
+ <template #header>
33
+ <h2 class="text-lg font-semibold" :style="headingStyles">Header</h2>
34
+ </template>
35
+ <p class="mb-4 faruma" :style="textStyles">ސްކްރޯލް</p>
36
+ <div class="space-y-2">
37
+ <p v-for="i in 60" :key="i" class="faruma" :style="textStyles">ވަރަށް ގިނަ ބައިވަރު އެކި އެކި ލިޔުންލިޔަން ހިތާ ހިތާ {{ i }}</p>
38
+ </div>
39
+
40
+ <template #footer>
41
+ <h2 class="text-lg font-semibold" :style="headingStyles">Footer</h2>
42
+ </template>
43
+ </Modal>
44
+
45
+ <!-- Fullscreen -->
46
+ <Modal v-model="fullscreen" fullscreen transition="right">
47
+ <template #header>
48
+ <div class="flex items-center justify-between">
49
+ <h2 class="text-lg font-semibold" :style="headingStyles">Fullscreen Modal</h2>
50
+ <Button color="primary" @click="fullscreen = false">Close</Button>
51
+ </div>
52
+ </template>
53
+ <p :style="textStyles">Slides in from the right and occupies full viewport.</p>
54
+ <template #footer>
55
+ <Button color="primary" @click="fullscreen = false">Close</Button>
56
+ </template>
57
+ </Modal>
58
+ </div>
59
+ </template>
60
+
61
+ <script setup lang="ts">
62
+ import { ref, computed } from 'vue'
63
+ import Modal from '../pgo/Modal.vue'
64
+ import Button from '../pgo/Button.vue'
65
+
66
+ const basic = ref(false)
67
+ const persistent = ref(false)
68
+ const bottom = ref(false)
69
+ const fullscreen = ref(false)
70
+
71
+ const headingStyles = computed(() => ({
72
+ color: 'var(--vts-color-text)'
73
+ }))
74
+
75
+ const textStyles = computed(() => ({
76
+ color: 'var(--vts-color-text)'
77
+ }))
78
+ </script>
79
+
80
+ <style scoped>
81
+ /* Styles are now applied via theme tokens in template */
82
+ </style>
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <div class="flex">
3
+ <NavDrawer
4
+ v-model="drawerOpen"
5
+ v-model:items="sampleItems"
6
+ :temporary="temporary"
7
+ :rail="rail"
8
+ :hover-expand="hoverExpand"
9
+ :persistent="persistent"
10
+ :permanent="permanent"
11
+ :location="location"
12
+ :is-stuck="isStuck"
13
+ :filterable="true"
14
+ :group-by="'group'"
15
+ :draggable="true"
16
+ searchPlaceholder="ހޯދާ"
17
+ :group-icons="{
18
+ އާންމު: 'home',
19
+ 'ތަފާސް ހިސާބު': 'document',
20
+ އެޑްމިން: 'cog',
21
+ }"
22
+ color="bg-blue-500"
23
+ width="w-64"
24
+ rail-width="w-16"
25
+ :close-on-scrim-click="true"
26
+ :overlay-app-bar="overlayAppBar"
27
+ :z-index="zIndex"
28
+ :app-bar-offset="appBarOffset"
29
+ >
30
+ <template #prepend>
31
+ <div class="px-3 py-2 text-sm font-semibold">މިފިނި</div>
32
+ </template>
33
+
34
+ <!-- <template #default>
35
+ <ul class="py-4">
36
+ <NavDrawerItem class="px-4" href="#/">
37
+ <HeroIcon name="home" size="20" /> ޑޭޝްބޯޑް
38
+ </NavDrawerItem>
39
+ <NavDrawerItem class="px-4" href="#/users">
40
+ <HeroIcon name="user" size="20" /> ޔޫސަރސް
41
+ </NavDrawerItem>
42
+ <NavDrawerItem class="px-4" href="#/reports">
43
+ <HeroIcon name="document" size="20" />ރިޕޯޓް
44
+ </NavDrawerItem>
45
+ <NavDrawerItem class="px-4" href="#/users">
46
+ <HeroIcon name="cog" size="20" /> ސެޓިންގްސް
47
+ </NavDrawerItem>
48
+ </ul>
49
+ </template> -->
50
+
51
+ <!-- <template #footer>
52
+ <NavDrawerItem class="px-4" href="#/">
53
+ <HeroIcon name="arrow-uturn-left" size="20" /> Logout
54
+ </NavDrawerItem>
55
+ </template> -->
56
+ </NavDrawer>
57
+
58
+ <div class="ml-72 mr-72 mt-32 p-4">
59
+ <label class="block">
60
+ <input type="checkbox" v-model="drawerOpen" /> Open drawer
61
+ </label>
62
+ <label class="block mt-2"
63
+ ><input type="checkbox" v-model="temporary" /> Temporary</label
64
+ >
65
+ <label class="block mt-2"
66
+ ><input type="checkbox" v-model="rail" /> Rail</label
67
+ >
68
+ <label class="block mt-2"
69
+ ><input type="checkbox" v-model="hoverExpand" /> Expand on hover</label
70
+ >
71
+ <label class="block mt-2"
72
+ ><input type="checkbox" v-model="persistent" /> Persistent
73
+ (open/close)</label
74
+ >
75
+ <label class="block mt-2"
76
+ ><input type="checkbox" v-model="permanent" /> Permanent (always
77
+ open)</label
78
+ >
79
+ <label class="block mt-2"
80
+ >Location:
81
+ <select v-model="location" class="ml-2">
82
+ <option value="left">Left</option>
83
+ <option value="right">Right</option>
84
+ </select>
85
+ </label>
86
+ <label class="block mt-2"
87
+ ><input type="checkbox" v-model="isStuck" /> Stuck (top)</label
88
+ >
89
+ <label class="block mt-2"
90
+ ><input type="checkbox" v-model="overlayAppBar" /> Overlay AppBar</label
91
+ >
92
+ <label class="block mt-2"
93
+ >Custom Z Index:
94
+ <input
95
+ type="number"
96
+ v-model.number="zIndex"
97
+ class="ml-2 w-20 border p-1 rounded"
98
+ />
99
+ </label>
100
+ <label class="block mt-2"
101
+ >AppBar Offset:
102
+ <input type="checkbox" v-model="appBarOffset" class="ml-2" />
103
+ </label>
104
+ </div>
105
+
106
+ <!-- second example: data-driven drawer -->
107
+ <!-- <div class="ml-72 p-4 mt-6">
108
+ <h3 class="text-lg font-semibold mb-2">Data-driven NavDrawer</h3>
109
+ <NavDrawer
110
+ v-model="drawerOpen"
111
+ v-model:items="sampleItems"
112
+ :filterable="true"
113
+ :group-by="'group'"
114
+ :group-icons="{ 'އާންމު': 'home', 'ތަފާސް ހިސާބު': 'document', 'އެޑްމިން': 'cog' }"
115
+ :render-group-parent="true"
116
+ :group-parents="{ 'އާންމު': { label: 'އާންމު', href: '#/main', icon: 'home' }, 'ތަފާސް ހިސާބު': { label: 'ތަފާސް', href: '#/reports', icon: 'document' }, 'އެޑްމިން': { label: 'އެޑްމިން', href: '#/admin', icon: 'cog' } }"
117
+ :draggable="true"
118
+ :overlay-app-bar="overlayAppBar"
119
+ color="bg-white"
120
+ width="w-64"
121
+ />
122
+ </div> -->
123
+ </div>
124
+ </template>
125
+
126
+ <script setup>
127
+ import { HeroIcon, NavDrawer, NavDrawerItem } from "../"
128
+ import { ref, watch, computed, onMounted } from "vue";
129
+ import { drawerOpen } from "../../pgo-components/lib/drawerState";
130
+ import { globalRtl } from "../../pgo-components/lib/core/rtl/rtl";
131
+
132
+ const temporary = ref(false);
133
+ const rail = ref(false);
134
+ const hoverExpand = ref(false);
135
+ const persistent = ref(false);
136
+ const permanent = ref(false);
137
+ const isStuck = ref(false);
138
+ const location = ref(globalRtl.value ? "right" : "left");
139
+ const overlayAppBar = ref(true);
140
+ const zIndex = ref(undefined);
141
+ const appBarOffset = ref(false);
142
+
143
+ const sampleItems = ref([
144
+ { id: 1, label: "އެޑްމިން", href: "#/", group: "އާންމު" },
145
+ { id: 2, label: "މީހުން", href: "page/Person/listView", group: "އާންމު" },
146
+ { id: 3, label: "ރިޕޯޓް", href: "#/reports", group: "ތަފާސް ހިސާބު" },
147
+ { id: 4, label: "ސެޓިންގްސް", href: "#/settings", group: "އެޑްމިން" },
148
+ ]);
149
+
150
+ onMounted(() => {
151
+ const savedRtl = localStorage.getItem("rtlSetting");
152
+ if (savedRtl !== null) {
153
+ // Convert string to boolean
154
+ location.value = savedRtl === "true" ? "right" : "left";
155
+ console.log("Loaded saved RTL setting:", savedRtl);
156
+ } else {
157
+ // Fallback to globalRtl if no saved setting
158
+ location.value = globalRtl.value ? "right" : "left";
159
+ console.log("No saved RTL setting, using globalRtl:", globalRtl.value);
160
+ }
161
+ });
162
+
163
+ watch(globalRtl, () => {
164
+ if (globalRtl.value) {
165
+ location.value = "right";
166
+ } else {
167
+ location.value = "left";
168
+ }
169
+ });
170
+ </script>
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <div class="space-y-6 p-6">
3
+ <h2 class="text-lg font-semibold">NumberField Examples</h2>
4
+
5
+ <!-- Basic -->
6
+ <section class="space-y-2">
7
+ <h3 class="font-medium">Basic</h3>
8
+ <div class="flex items-center space-x-4">
9
+ <NumberField v-model="basic" placeholder="Enter number" />
10
+ </div>
11
+ <div class="text-sm text-gray-600">Value: {{ basic }}</div>
12
+ </section>
13
+
14
+ <!-- Min / Max / Step -->
15
+ <section class="space-y-2">
16
+ <h3 class="font-medium">Min / Max / Step</h3>
17
+ <div class="flex items-center space-x-4">
18
+ <NumberField label="numbers" v-model="minmax" :min="0" :max="10" :step="0.5" placeholder="0 - 10 step 0.5" />
19
+ </div>
20
+ <div class="text-sm text-gray-600">Value: {{ minmax }}</div>
21
+ </section>
22
+
23
+ <!-- Allow decimals toggle -->
24
+ <section class="space-y-2">
25
+ <h3 class="font-medium">Disable decimals</h3>
26
+ <div class="flex items-center space-x-4">
27
+ <NumberField v-model="noDecimal" :allow-decimal="false" placeholder="Integers only" />
28
+ <button @click="noDecimal = 5" class="px-2 py-1 border rounded">Set 5</button>
29
+ </div>
30
+ <div class="text-sm text-gray-600">Value: {{ noDecimal }}</div>
31
+ </section>
32
+
33
+ <!-- Clearable / Loading -->
34
+ <section class="space-y-2">
35
+ <h3 class="font-medium">Clearable & Loading</h3>
36
+ <div class="flex items-center space-x-4">
37
+ <NumberField v-model="loadingValue" :loading="loading" clearable />
38
+ <button @click="toggleLoading" class="px-2 py-1 rounded border">
39
+ {{ loading ? 'Stop' : 'Start' }} Loading
40
+ </button>
41
+ <button @click="clearLoadingValue" class="px-2 py-1 rounded border">Clear</button>
42
+ </div>
43
+ <div class="text-sm text-gray-600">Value: {{ loadingValue }}</div>
44
+ </section>
45
+
46
+ <!-- Sizes -->
47
+ <section class="space-y-2">
48
+ <h3 class="font-medium">Sizes</h3>
49
+ <div class="flex items-center space-x-4">
50
+ <NumberField v-model="sizeVal" size="sm" :placeholder="'small'"/>
51
+ <NumberField v-model="sizeVal" size="md" :placeholder="'medium'"/>
52
+ <NumberField v-model="sizeVal" size="lg" :placeholder="'large'"/>
53
+ </div>
54
+ <div class="text-sm text-gray-600">Shared value: {{ sizeVal }}</div>
55
+ </section>
56
+
57
+ <!-- Disabled -->
58
+ <section class="space-y-2">
59
+ <h3 class="font-medium">Disabled</h3>
60
+ <div class="flex items-center space-x-4">
61
+ <NumberField v-model="disabledVal" disabled />
62
+ </div>
63
+ <div class="text-sm text-gray-600">Value: {{ disabledVal }}</div>
64
+ </section>
65
+
66
+ <!-- Programmatic focus / clear -->
67
+ <section class="space-y-2">
68
+ <h3 class="font-medium">Programmatic focus & clear</h3>
69
+ <div class="flex items-center space-x-4">
70
+ <NumberField ref="progRef" v-model="progValue" placeholder="Focus me" />
71
+ <button @click="focusField" class="px-2 py-1 rounded border">Focus</button>
72
+ <button @click="clearField" class="px-2 py-1 rounded border">Clear</button>
73
+ </div>
74
+ <div class="text-sm text-gray-600">Value: {{ progValue }}</div>
75
+ </section>
76
+
77
+ <!-- Form example -->
78
+ <section class="space-y-2">
79
+ <h3 class="font-medium">Form submit</h3>
80
+ <form @submit.prevent="submitForm" class="space-y-3">
81
+ <div class="flex items-center space-x-4">
82
+ <NumberField v-model="formValue" :min="1" :max="100" placeholder="1 - 100" />
83
+ </div>
84
+ <div class="flex items-center space-x-2">
85
+ <button type="submit" class="px-3 py-1 rounded bg-primary text-white">Submit</button>
86
+ <button type="button" @click="formValue = 50" class="px-3 py-1 rounded border">Set 50</button>
87
+ </div>
88
+ <div class="text-sm text-gray-600">Form value: {{ formValue }}</div>
89
+ </form>
90
+ </section>
91
+ </div>
92
+ </template>
93
+
94
+ <script setup>
95
+ import { ref } from 'vue'
96
+ import NumberField from '../pgo/inputs/NumberField.vue'
97
+
98
+ const basic = ref('')
99
+ const minmax = ref('')
100
+ const noDecimal = ref('')
101
+ const loadingValue = ref('')
102
+ const loading = ref(false)
103
+ const sizeVal = ref('')
104
+ const disabledVal = ref(7)
105
+ const progValue = ref('')
106
+ const progRef = ref(null)
107
+ const formValue = ref('')
108
+
109
+ // Programmatic actions
110
+ const toggleLoading = () => {
111
+ loading.value = !loading.value
112
+ if (!loading.value) return
113
+ // demo auto-fill while loading
114
+ setTimeout(() => {
115
+ loadingValue.value = 123.45
116
+ loading.value = false
117
+ }, 1200)
118
+ }
119
+
120
+ const clearLoadingValue = () => {
121
+ loadingValue.value = ''
122
+ }
123
+
124
+ const focusField = () => {
125
+ // NumberField exposes focus() method
126
+ progRef.value?.focus?.()
127
+ }
128
+
129
+ const clearField = () => {
130
+ progRef.value?.clear?.()
131
+ }
132
+
133
+ // Form submit
134
+ const submitForm = () => {
135
+ // eslint-disable-next-line no-alert
136
+ alert('Submitted: ' + String(formValue.value))
137
+ }
138
+ </script>
139
+
140
+ <style scoped>
141
+ /* Demo only: make .bg-primary available if your tokens don't provide it */
142
+ .bg-primary {
143
+ background-color: theme('colors.primary', '#2563eb');
144
+ }
145
+ </style>
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <div class="space-y-6 p-6">
3
+ <h2 class="text-lg font-semibold">Radio Examples</h2>
4
+
5
+ <!-- Basic single radios -->
6
+ <section class="space-y-2">
7
+ <h3 class="font-medium">Basic</h3>
8
+ <div class="flex items-center space-x-4">
9
+ <Radio v-model="gender" value="M">Male</Radio>
10
+ <Radio v-model="gender" value="F">Female</Radio>
11
+ </div>
12
+ <div class="text-sm text-gray-600">Selected: {{ gender }}</div>
13
+ </section>
14
+
15
+ <!-- Named group -->
16
+ <section class="space-y-2">
17
+ <h3 class="font-medium">Named group (keyboard navigation)</h3>
18
+ <div class="flex items-center space-x-4">
19
+ <Radio v-model="choice" name="group1" value="a">Option A</Radio>
20
+ <Radio v-model="choice" name="group1" value="b">Option B</Radio>
21
+ <Radio v-model="choice" name="group1" value="c">Option C</Radio>
22
+ </div>
23
+ <div class="text-sm text-gray-600">Choice: {{ choice }}</div>
24
+ </section>
25
+
26
+ <!-- RadioGroup: options array -->
27
+ <section class="space-y-2">
28
+ <h3 class="font-medium">RadioGroup (options array)</h3>
29
+ <RadioGroup v-model="rgVal" :options="rgOptions" />
30
+ <div class="text-sm text-gray-600">RadioGroup value: {{ rgVal }}</div>
31
+ </section>
32
+
33
+ <!-- RadioGroup: descriptions & disabled options -->
34
+ <section class="space-y-2">
35
+ <h3 class="font-medium">RadioGroup (descriptions & disabled)</h3>
36
+ <RadioGroup v-model="rgVal2" :options="rgOptions2" direction="vertical" />
37
+ <div class="text-sm text-gray-600">RadioGroup value: {{ rgVal2 }}</div>
38
+ </section>
39
+
40
+ <!-- RadioGroup slot fallback -->
41
+ <section class="space-y-2">
42
+ <h3 class="font-medium">RadioGroup (slot fallback)</h3>
43
+ <RadioGroup v-model="rgSlotVal">
44
+ <div class="flex items-center space-x-4">
45
+ <Radio v-model="rgSlotVal" name="fallback" value="one">One</Radio>
46
+ <Radio v-model="rgSlotVal" name="fallback" value="two">Two</Radio>
47
+ <Radio v-model="rgSlotVal" name="fallback" value="three">Three</Radio>
48
+ </div>
49
+ </RadioGroup>
50
+ <div class="text-sm text-gray-600">Slot group value: {{ rgSlotVal }}</div>
51
+ </section>
52
+
53
+ <!-- Numeric values -->
54
+ <section class="space-y-2">
55
+ <h3 class="font-medium">Numeric values</h3>
56
+ <div class="flex items-center space-x-4">
57
+ <Radio v-model="selectedId" :value="1">Item 1</Radio>
58
+ <Radio v-model="selectedId" :value="2">Item 2</Radio>
59
+ <Radio v-model="selectedId" :value="3">Item 3</Radio>
60
+ </div>
61
+ <div class="text-sm text-gray-600">Selected id: {{ selectedId }}</div>
62
+ </section>
63
+
64
+ <!-- Sizes and custom color -->
65
+ <section class="space-y-2">
66
+ <h3 class="font-medium">Sizes & colors</h3>
67
+ <div class="flex items-center space-x-4">
68
+ <Radio v-model="sizeChoice" value="x" size="sm" color="success">Small / green</Radio>
69
+ <Radio v-model="sizeChoice" value="y" size="md" color="warning">Default / amber</Radio>
70
+ <Radio v-model="sizeChoice" value="z" size="lg" color="bg-red-500">Large / custom Tailwind</Radio>
71
+ </div>
72
+ <div class="text-sm text-gray-600">Size choice: {{ sizeChoice }}</div>
73
+ </section>
74
+
75
+ <!-- Disabled example -->
76
+ <section class="space-y-2">
77
+ <h3 class="font-medium">Disabled</h3>
78
+ <div class="flex items-center space-x-4">
79
+ <Radio v-model="val" value="a">Enabled</Radio>
80
+ <Radio v-model="val" value="b" disabled>Disabled</Radio>
81
+ </div>
82
+ <div class="text-sm text-gray-600">Val: {{ val }}</div>
83
+ </section>
84
+
85
+ <!-- Slot label example -->
86
+ <section class="space-y-2">
87
+ <h3 class="font-medium">Rich label (slot)</h3>
88
+ <div>
89
+ <Radio v-model="opt" :value="1">
90
+ <div class="flex flex-col">
91
+ <span class="font-semibold">Option 1</span>
92
+ <small class="text-gray-500">Extra description</small>
93
+ </div>
94
+ </Radio>
95
+ </div>
96
+ <div class="text-sm text-gray-600">Opt: {{ opt }}</div>
97
+ </section>
98
+
99
+ <!-- Form submit example -->
100
+ <section class="space-y-2">
101
+ <h3 class="font-medium">Form submit</h3>
102
+ <form @submit.prevent="handleSubmit" class="space-y-3">
103
+ <div class="flex items-center space-x-4">
104
+ <Radio v-model="formModel" value="yes">Yes</Radio>
105
+ <Radio v-model="formModel" value="no">No</Radio>
106
+ </div>
107
+ <div class="flex items-center space-x-2">
108
+ <button type="submit" class="px-3 py-1 rounded bg-primary text-white">Submit</button>
109
+ <button type="button" @click="formModel = 'yes'" class="px-3 py-1 rounded border">Set Yes</button>
110
+ </div>
111
+ <div class="text-sm text-gray-600">Form value: {{ formModel }}</div>
112
+ </form>
113
+ </section>
114
+ </div>
115
+ </template>
116
+
117
+ <script setup>
118
+ import { ref } from 'vue'
119
+ import Radio from '../pgo/inputs/Radio.vue'
120
+ import RadioGroup from '../pgo/inputs/RadioGroup.vue'
121
+
122
+ const gender = ref(null)
123
+ const choice = ref('a')
124
+ const selectedId = ref(2)
125
+ const sizeChoice = ref('y')
126
+ const val = ref('a')
127
+ const opt = ref(null)
128
+ const formModel = ref('yes')
129
+
130
+ // RadioGroup examples state
131
+ const rgVal = ref('M')
132
+ const rgOptions = [
133
+ { label: 'Male', value: 'M' },
134
+ { label: 'Female', value: 'F' },
135
+ { label: 'Other', value: 'O' }
136
+ ]
137
+
138
+ const rgVal2 = ref(2)
139
+ const rgOptions2 = [
140
+ { label: 'One', value: 1, description: 'First option' },
141
+ { label: 'Two (disabled)', value: 2, disabled: true, description: 'Temporarily unavailable' },
142
+ { label: 'Three', value: 3, description: 'Third option' }
143
+ ]
144
+
145
+ // Slot fallback example value
146
+ const rgSlotVal = ref('two')
147
+
148
+ const handleSubmit = () => {
149
+ // Replace with your submit logic
150
+ // For demo we just alert the value
151
+ // eslint-disable-next-line no-alert
152
+ alert('Submitted: ' + String(formModel.value))
153
+ }
154
+ </script>
155
+
156
+ <style scoped>
157
+ /* Small adjustments for demonstration layout */
158
+ .bg-primary {
159
+ background-color: theme('colors.primary', '#2563eb');
160
+ }
161
+ </style>