@dolanske/vui 0.4.0 → 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 (155) hide show
  1. package/README.md +6 -13
  2. package/dist/components/Alert/Alert.vue.d.ts +7 -1
  3. package/dist/components/Avatar/Avatar.vue.d.ts +15 -1
  4. package/dist/components/Badge/Badge.vue.d.ts +1 -1
  5. package/dist/components/Breadcrumbs/BreadcrumbItem.vue.d.ts +1 -1
  6. package/dist/components/Button/Button.vue.d.ts +5 -15
  7. package/dist/components/ButtonGroup/ButtonGroup.vue.d.ts +2 -0
  8. package/dist/components/Calendar/Calendar.vue.d.ts +1 -1
  9. package/dist/components/Checkbox/Checkbox.vue.d.ts +1 -0
  10. package/dist/components/Dropdown/Dropdown.vue.d.ts +19 -4
  11. package/dist/components/Dropdown/DropdownTitle.vue.d.ts +5 -1
  12. package/dist/components/Flex/Flex.vue.d.ts +3 -1
  13. package/dist/components/Grid/Grid.vue.d.ts +7 -2
  14. package/dist/components/Input/Dropzone.vue.d.ts +1 -1
  15. package/dist/components/Input/Input.vue.d.ts +2 -2
  16. package/dist/components/Kbd/KbdGroup.vue.d.ts +3 -11
  17. package/dist/components/Modal/Confirm.vue.d.ts +1 -1
  18. package/dist/components/Modal/Modal.vue.d.ts +1 -1
  19. package/dist/components/Pagination/Pagination.vue.d.ts +3 -0
  20. package/dist/components/Popout/Popout.vue.d.ts +8 -1
  21. package/dist/components/Progress/Progress.vue.d.ts +2 -0
  22. package/dist/components/Radio/Radio.vue.d.ts +1 -0
  23. package/dist/components/Select/Select.vue.d.ts +2 -0
  24. package/dist/components/Sheet/Sheet.vue.d.ts +3 -0
  25. package/dist/components/Switch/Switch.vue.d.ts +1 -0
  26. package/dist/components/Table/index.d.ts +6 -0
  27. package/dist/components/Table/table.d.ts +1 -1
  28. package/dist/components/Tabs/Tab.vue.d.ts +16 -3
  29. package/dist/components/Tabs/Tabs.vue.d.ts +4 -0
  30. package/dist/components/Toast/toast.d.ts +245 -0
  31. package/dist/index.d.ts +2 -7
  32. package/dist/shared/helpers.d.ts +9 -0
  33. package/dist/shared/theme.d.ts +3 -0
  34. package/dist/style.css +1 -1
  35. package/dist/vui.js +6423 -6046
  36. package/package.json +8 -4
  37. package/src/App.vue +89 -192
  38. package/src/components/Accordion/accordion.scss +2 -0
  39. package/src/components/Alert/Alert.vue +11 -5
  40. package/src/components/Alert/alert.scss +104 -23
  41. package/src/components/Avatar/Avatar.vue +4 -1
  42. package/src/components/Avatar/avatar.scss +1 -1
  43. package/src/components/Badge/Badge.vue +1 -1
  44. package/src/components/Badge/badge.scss +134 -17
  45. package/src/components/Breadcrumbs/BreadcrumbItem.vue +2 -2
  46. package/src/components/Breadcrumbs/Breadcrumbs.vue +1 -2
  47. package/src/components/Breadcrumbs/breadcrumbs.scss +2 -1
  48. package/src/components/Button/Button.vue +16 -21
  49. package/src/components/Button/button.scss +159 -56
  50. package/src/components/ButtonGroup/ButtonGroup.vue +4 -1
  51. package/src/components/ButtonGroup/button-group.scss +2 -2
  52. package/src/components/Calendar/Calendar.vue +9 -3
  53. package/src/components/Calendar/calendar.scss +29 -2
  54. package/src/components/Card/Card.vue +2 -2
  55. package/src/components/Card/card.scss +4 -4
  56. package/src/components/Checkbox/Checkbox.vue +7 -5
  57. package/src/components/Checkbox/checkbox.scss +27 -13
  58. package/src/components/CopyClipboard/CopyClipboard.vue +15 -6
  59. package/src/components/CopyClipboard/copy-clipboard.scss +10 -2
  60. package/src/components/Drawer/Drawer.vue +4 -4
  61. package/src/components/Drawer/drawer.scss +1 -0
  62. package/src/components/Dropdown/Dropdown.vue +44 -20
  63. package/src/components/Dropdown/DropdownItem.vue +5 -4
  64. package/src/components/Dropdown/DropdownTitle.vue +7 -1
  65. package/src/components/Dropdown/dropdown-item.scss +84 -0
  66. package/src/components/Dropdown/dropdown.scss +21 -86
  67. package/src/components/Flex/Flex.vue +4 -1
  68. package/src/components/Grid/Grid.vue +25 -2
  69. package/src/components/Input/Color.vue +26 -0
  70. package/src/components/Input/Counter.vue +12 -16
  71. package/src/components/Input/Dropzone.vue +1 -1
  72. package/src/components/Input/File.vue +1 -1
  73. package/src/components/Input/Input.vue +8 -6
  74. package/src/components/Input/Password.vue +1 -13
  75. package/src/components/Input/Textarea.vue +4 -2
  76. package/src/components/Input/input.scss +113 -19
  77. package/src/components/Kbd/KbdGroup.vue +2 -6
  78. package/src/components/Kbd/kbd.scss +7 -6
  79. package/src/components/Modal/Confirm.vue +1 -1
  80. package/src/components/Modal/Modal.vue +23 -15
  81. package/src/components/Modal/modal.scss +11 -6
  82. package/src/components/OTP/otp.scss +8 -7
  83. package/src/components/Pagination/Pagination.vue +6 -3
  84. package/src/components/Popout/Popout.vue +15 -5
  85. package/src/components/Popout/popout.scss +8 -1
  86. package/src/components/Progress/Progress.vue +18 -5
  87. package/src/components/Progress/progress.scss +7 -1
  88. package/src/components/Radio/Radio.vue +4 -2
  89. package/src/components/Radio/radio.scss +28 -9
  90. package/src/components/Select/Select.vue +49 -18
  91. package/src/components/Select/select.scss +35 -2
  92. package/src/components/Sheet/Sheet.vue +8 -2
  93. package/src/components/Sheet/sheet.scss +9 -0
  94. package/src/components/Sidebar/Sidebar.vue +46 -16
  95. package/src/components/Sidebar/sidebar.scss +6 -5
  96. package/src/components/Spinner/spinner.scss +2 -1
  97. package/src/components/Switch/Switch.vue +4 -3
  98. package/src/components/Switch/switch.scss +48 -7
  99. package/src/components/Table/{Header.vue → Head.vue} +5 -5
  100. package/src/components/Table/{Table.vue → Root.vue} +2 -2
  101. package/src/components/Table/SelectRow.vue +2 -1
  102. package/src/components/Table/index.ts +7 -0
  103. package/src/components/Table/table.scss +25 -5
  104. package/src/components/Table/table.ts +7 -3
  105. package/src/components/Tabs/Tab.vue +7 -9
  106. package/src/components/Tabs/Tabs.vue +9 -2
  107. package/src/components/Tabs/tabs.scss +11 -3
  108. package/src/components/Toast/Toasts.vue +5 -0
  109. package/src/components/Toast/toast.scss +6 -2
  110. package/src/components/Toast/toast.ts +7 -0
  111. package/src/components/Tooltip/Tooltip.vue +9 -9
  112. package/src/components/Tooltip/tooltip.scss +4 -0
  113. package/src/examples/ExampleAccordions.vue +58 -0
  114. package/src/examples/ExampleAlerts.vue +78 -0
  115. package/src/examples/ExampleAvatars.vue +44 -0
  116. package/src/examples/ExampleBadges.vue +48 -0
  117. package/src/examples/ExampleBreadcrumbs.vue +46 -0
  118. package/src/examples/ExampleButtons.vue +140 -0
  119. package/src/examples/ExampleCalendars.vue +40 -0
  120. package/src/examples/ExampleCards.vue +94 -0
  121. package/src/examples/ExampleCheckboxes.vue +123 -0
  122. package/src/examples/ExampleCopyClipboard.vue +47 -0
  123. package/src/examples/ExampleDividers.vue +39 -0
  124. package/src/examples/ExampleDrawers.vue +67 -0
  125. package/src/examples/ExampleDropdowns.vue +114 -0
  126. package/src/examples/ExampleFlexGrid.vue +122 -0
  127. package/src/examples/ExampleInputs.vue +234 -0
  128. package/src/examples/ExampleKBD.vue +65 -0
  129. package/src/examples/ExampleModals.vue +143 -0
  130. package/src/examples/ExamplePalette.vue +159 -0
  131. package/src/examples/ExamplePopouts.vue +41 -0
  132. package/src/examples/ExampleSheets.vue +77 -0
  133. package/src/examples/ExampleSidebars.vue +270 -0
  134. package/src/examples/ExampleSkeletons.vue +26 -0
  135. package/src/examples/ExampleSpinners.vue +78 -0
  136. package/src/examples/ExampleTables.vue +195 -0
  137. package/src/examples/ExampleTabs.vue +119 -0
  138. package/src/examples/ExampleToasts.vue +96 -0
  139. package/src/examples/ExampleTooltips.vue +70 -0
  140. package/src/examples/shared/ExampleColor.vue +28 -0
  141. package/src/index.ts +4 -11
  142. package/src/internal/Backdrop/backdrop.scss +7 -1
  143. package/src/shared/helpers.ts +43 -0
  144. package/src/shared/theme.ts +22 -0
  145. package/src/style/animation.scss +1 -0
  146. package/src/style/core.scss +34 -57
  147. package/src/style/layout.scss +102 -5
  148. package/src/style/{fonts.scss → text.scss} +39 -0
  149. package/src/style/theme.scss +195 -0
  150. package/src/style/tooltip.scss +22 -4
  151. package/src/style/typography.scss +95 -18
  152. package/dist/components/Table/Row.vue.d.ts +0 -16
  153. package/src/components/Table/Row.vue +0 -9
  154. /package/dist/components/Table/{Header.vue.d.ts → Head.vue.d.ts} +0 -0
  155. /package/dist/components/Table/{Table.vue.d.ts → Root.vue.d.ts} +0 -0
@@ -0,0 +1,77 @@
1
+ <script setup lang='ts'>
2
+ import type { SelectOption } from '../components/Select/Select.vue'
3
+ import { ref } from 'vue'
4
+ import Button from '../components/Button/Button.vue'
5
+ import Flex from '../components/Flex/Flex.vue'
6
+ import Input from '../components/Input/Input.vue'
7
+ import Select from '../components/Select/Select.vue'
8
+ import Sheet from '../components/Sheet/Sheet.vue'
9
+
10
+ const open1 = ref()
11
+ const open2 = ref()
12
+ const width = ref(328)
13
+ const options: SelectOption[] = [{ value: 'left', label: 'Left' }, { value: 'right', label: ' Right' }, { value: 'top', label: 'Top' }, { value: 'bottom', label: 'Bottom' }]
14
+ const option = ref([options[0]])
15
+ </script>
16
+
17
+ <template>
18
+ <div class="mb-xxl">
19
+ <h3 class="mb-l">
20
+ Sheets
21
+ </h3>
22
+
23
+ <Select v-model="option" expand label="Position" :options class="mb-l" required />
24
+
25
+ <table>
26
+ <tbody>
27
+ <tr>
28
+ <th>Base + divider + footer</th>
29
+ <td>
30
+ <Flex gap="m" justify-start>
31
+ <Button @click="open1 = !open1">
32
+ Open
33
+ </Button>
34
+ <Sheet v-model="open1" :position="option[0].value" separator>
35
+ <template #header>
36
+ <h2>Hello </h2>
37
+ </template>
38
+ <h2 class="text-color-lighter">
39
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus alias consectetur obcaecati recusandae debitis voluptatum exercitationem. Nam facilis laudantium labore sint cum, veritatis autem asperiores consectetur possimus cumque beatae eveniet. Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit rem quod quisquam laborum sed excepturi, eum nisi nostrum, totam nihil magni voluptatum rerum culpa voluptatibus velit, sapiente fuga similique eius?
40
+ </h2>
41
+ <template #footer="{ close }">
42
+ <p class="mb-s">
43
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis placeat nisi, in velit temporibus at esse error et iusto vero odit illo veritatis rem cum delectus autem minus quod reiciendis.
44
+ </p>
45
+ <Button @click="close">
46
+ Close
47
+ </Button>
48
+ </template>
49
+ </Sheet>
50
+ </Flex>
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <th>Width</th>
55
+ <td>
56
+ <Flex gap="m" justify-start align-center>
57
+ <Input v-model="width">
58
+ <template #start>
59
+ Width
60
+ </template>
61
+ </Input>
62
+ <Button @click="open2 = !open2">
63
+ Open
64
+ </Button>
65
+ <Sheet v-model="open2" :position="option[0].value" :size="width">
66
+ <template #header>
67
+ <h2>Hello </h2>
68
+ </template>
69
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus alias consectetur obcaecati recusandae debitis voluptatum exercitationem. Nam facilis laudantium labore sint cum, veritatis autem asperiores consectetur possimus cumque beatae eveniet.</p>
70
+ </Sheet>
71
+ </Flex>
72
+ </td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+ </div>
77
+ </template>
@@ -0,0 +1,270 @@
1
+ <script setup lang='ts'>
2
+ import { ref } from 'vue'
3
+ import Avatar from '../components/Avatar/Avatar.vue'
4
+ import Button from '../components/Button/Button.vue'
5
+ import DropdownItem from '../components/Dropdown/DropdownItem.vue'
6
+ import Flex from '../components/Flex/Flex.vue'
7
+ import Grid from '../components/Grid/Grid.vue'
8
+ import Sidebar from '../components/Sidebar/Sidebar.vue'
9
+
10
+ const s1 = ref(true)
11
+ const s2 = ref(true)
12
+ const s3 = ref(true)
13
+ </script>
14
+
15
+ <template>
16
+ <div class="mb-xxl">
17
+ <h3 class="mb-l">
18
+ Sidebars
19
+ </h3>
20
+
21
+ <Grid :columns="2" gap="xl">
22
+ <div>
23
+ <span class="mb-m block">Base + slots</span>
24
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
25
+ <Sidebar>
26
+ <template #header>
27
+ <Flex align-center>
28
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
29
+ <h3>ABC</h3>
30
+ </Flex>
31
+ </template>
32
+ <DropdownItem icon="ph:house">
33
+ Home
34
+ </DropdownItem>
35
+ <DropdownItem icon="ph:user">
36
+ About
37
+ </DropdownItem>
38
+ <DropdownItem icon="ph:phone">
39
+ Contact
40
+ </DropdownItem>
41
+
42
+ <template #footer>
43
+ <Flex align-center>
44
+ <Avatar size="m" />
45
+ <span class="flex-1">dolanske</span>
46
+ <Button plain size="s" icon="ph:sign-out" />
47
+ </Flex>
48
+ </template>
49
+ </Sidebar>
50
+ <main class="p-l typeset">
51
+ <h4>My page</h4>
52
+ <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Atque deleniti asperiores quibusdam et commodi deserunt libero officia doloremque. Possimus ipsum sunt odit culpa consequatur hic reiciendis doloremque consequuntur tempore excepturi?</p>
53
+ <hr>
54
+ <p>Yes that's correct</p>
55
+ <ul>
56
+ <li>Secure</li>
57
+ <li>Reliant</li>
58
+ <li>Ublumf</li>
59
+ </ul>
60
+ </main>
61
+ </div>
62
+ </div>
63
+
64
+ <div>
65
+ <span class="mb-m block">Toggleable + floaty</span>
66
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
67
+ <Sidebar v-model="s1" floaty>
68
+ <template #header="{ close }">
69
+ <Flex align-center>
70
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
71
+ <h3 class="flex-1">
72
+ ABC
73
+ </h3>
74
+ <Button plain size="s" icon="ph:x" @click="close" />
75
+ </Flex>
76
+ </template>
77
+ <DropdownItem icon="ph:house">
78
+ Outside
79
+ </DropdownItem>
80
+ <DropdownItem icon="ph:user">
81
+ About You
82
+ </DropdownItem>
83
+ <DropdownItem icon="ph:phone">
84
+ No contact
85
+ </DropdownItem>
86
+ </Sidebar>
87
+ <main class="p-l">
88
+ <Flex align-center class="mb-m">
89
+ <Button plain size="s" icon="ph:sidebar-simple" @click="s1 = !s1" />
90
+ <h4>
91
+ My page
92
+ </h4>
93
+ </Flex>
94
+
95
+ <div class="typeset">
96
+ <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Atque deleniti asperiores quibusdam et commodi deserunt libero officia doloremque. Possimus ipsum sunt odit culpa consequatur hic reiciendis doloremque consequuntur tempore excepturi?</p>
97
+ <hr>
98
+ <p>Yes that's correct</p>
99
+ <ul>
100
+ <li>Secure</li>
101
+ <li>Reliant</li>
102
+ <li>Ublumf</li>
103
+ </ul>
104
+ </div>
105
+ </main>
106
+ </div>
107
+ </div>
108
+
109
+ <div>
110
+ <span class="mb-m block">Mini </span>
111
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
112
+ <Sidebar v-model="s2" mini>
113
+ <template #header>
114
+ <Flex align-center>
115
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
116
+ </Flex>
117
+ </template>
118
+ <DropdownItem icon="ph:house">
119
+ Home
120
+ </DropdownItem>
121
+ <DropdownItem icon="ph:user">
122
+ About
123
+ </DropdownItem>
124
+ <DropdownItem icon="ph:phone">
125
+ Contact
126
+ </DropdownItem>
127
+
128
+ <template #footer="{ close }">
129
+ <Flex justify-center>
130
+ <Button plain icon="ph:x" @click="close" />
131
+ </Flex>
132
+ </template>
133
+ </Sidebar>
134
+ <main class="p-l">
135
+ <Flex align-center class="mb-m">
136
+ <Button plain size="s" icon="ph:sidebar-simple" @click="s2 = !s2" />
137
+ <h4>
138
+ My page
139
+ </h4>
140
+ </Flex>
141
+
142
+ <div class="typeset">
143
+ <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Atque deleniti asperiores quibusdam et commodi deserunt libero officia doloremque. Possimus ipsum sunt odit culpa consequatur hic reiciendis doloremque consequuntur tempore excepturi?</p>
144
+ <hr>
145
+ <p>Yes that's correct</p>
146
+ <ul>
147
+ <li>Secure</li>
148
+ <li>Reliant</li>
149
+ <li>Ublumf</li>
150
+ </ul>
151
+ </div>
152
+ </main>
153
+ </div>
154
+ </div>
155
+
156
+ <div>
157
+ <span class="mb-m block">Mini & floaty </span>
158
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
159
+ <Sidebar v-model="s3" mini floaty>
160
+ <template #header>
161
+ <Flex align-center>
162
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
163
+ </Flex>
164
+ </template>
165
+ <DropdownItem icon="ph:house">
166
+ Home
167
+ </DropdownItem>
168
+ <DropdownItem icon="ph:user">
169
+ About
170
+ </DropdownItem>
171
+ <DropdownItem icon="ph:phone">
172
+ Contact
173
+ </DropdownItem>
174
+
175
+ <template #footer="{ close }">
176
+ <Flex justify-center>
177
+ <Button plain icon="ph:x" @click="close" />
178
+ </Flex>
179
+ </template>
180
+ </Sidebar>
181
+ <main class="p-l">
182
+ <Flex align-center class="mb-m">
183
+ <Button plain size="s" icon="ph:sidebar-simple" @click="s3 = !s3" />
184
+ <h4>
185
+ My page
186
+ </h4>
187
+ </Flex>
188
+
189
+ <div class="typeset">
190
+ <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Atque deleniti asperiores quibusdam et commodi deserunt libero officia doloremque. Possimus ipsum sunt odit culpa consequatur hic reiciendis doloremque consequuntur tempore excepturi?</p>
191
+ <hr>
192
+ <p>Yes that's correct</p>
193
+ <ul>
194
+ <li>Secure</li>
195
+ <li>Reliant</li>
196
+ <li>Ublumf</li>
197
+ </ul>
198
+ </div>
199
+ </main>
200
+ </div>
201
+ </div>
202
+
203
+ <div>
204
+ <span class="mb-m block">Appear + custom width</span>
205
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
206
+ <Sidebar appear :width="300">
207
+ <template #header>
208
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
209
+ </template>
210
+ <DropdownItem icon="ph:house">
211
+ Home
212
+ </DropdownItem>
213
+ <DropdownItem icon="ph:user">
214
+ About
215
+ </DropdownItem>
216
+ <DropdownItem icon="ph:phone">
217
+ Contact
218
+ </DropdownItem>
219
+ </Sidebar>
220
+ <main class="p-l typeset">
221
+ <h4>
222
+ Appear sidebar
223
+ </h4>
224
+ <p>This sidebar will appear automatically whenever the curosor is close to the edge of the sidebar wrapper.</p>
225
+ </main>
226
+ </div>
227
+ </div>
228
+
229
+ <div>
230
+ <span class="mb-m block">Appear + mini + floaty</span>
231
+ <div class="vui-sidebar-layout" :style="{ height: '512px' }">
232
+ <Sidebar appear mini floaty>
233
+ <template #header>
234
+ <img src="https://dolansky.dev/backgrounds/star.png" class="sidebar-logo" width="40" alt="">
235
+ </template>
236
+ <DropdownItem icon="ph:house">
237
+ Home
238
+ </DropdownItem>
239
+ <DropdownItem icon="ph:user">
240
+ About
241
+ </DropdownItem>
242
+ <DropdownItem icon="ph:phone">
243
+ Contact
244
+ </DropdownItem>
245
+ </Sidebar>
246
+ <main class="p-l typeset">
247
+ <h4>
248
+ Appear sidebar
249
+ </h4>
250
+ <p>This sidebar will appear automatically whenever the curosor is close to the edge of the sidebar wrapper.</p>
251
+ </main>
252
+ </div>
253
+ </div>
254
+ </Grid>
255
+ </div>
256
+ </template>
257
+
258
+ <style scoped>
259
+ .vui-sidebar-layout {
260
+ border: 1px solid var(--color-border);
261
+ border-radius: var(--border-radius-m);
262
+ overflow: hidden;
263
+ }
264
+
265
+ html.dark {
266
+ .sidebar-logo {
267
+ filter: invert() !important;
268
+ }
269
+ }
270
+ </style>
@@ -0,0 +1,26 @@
1
+ <script setup lang='ts'>
2
+ import Flex from '../components/Flex/Flex.vue'
3
+ import Skeleton from '../components/Skeleton/Skeleton.vue'
4
+ </script>
5
+
6
+ <template>
7
+ <div class="mb-xxl">
8
+ <h3 class="mb-l">
9
+ Skeletons
10
+ </h3>
11
+ <table>
12
+ <tbody>
13
+ <tr>
14
+ <th>No defaults <br> Width, height, roundness must be specified</th>
15
+ <td>
16
+ <Flex gap="s">
17
+ <Skeleton :width="80" :height="48" :radius="8" />
18
+ <Skeleton :width="48" :height="48" :radius="8" />
19
+ <Skeleton :width="48" circle />
20
+ </Flex>
21
+ </td>
22
+ </tr>
23
+ </tbody>
24
+ </table>
25
+ </div>
26
+ </template>
@@ -0,0 +1,78 @@
1
+ <script setup lang='ts'>
2
+ import { ref, watch } from 'vue'
3
+ import Button from '../components/Button/Button.vue'
4
+ import Checkbox from '../components/Checkbox/Checkbox.vue'
5
+ import Flex from '../components/Flex/Flex.vue'
6
+ import Progress from '../components/Progress/Progress.vue'
7
+ import Spinner from '../components/Spinner/Spinner.vue'
8
+
9
+ const paused = ref(true)
10
+ const progress = ref(25)
11
+
12
+ const fakeProgress = ref(15)
13
+ const showFixed = ref(false)
14
+ const variants = ['s', 'm', 'l'] as const
15
+
16
+ watch(paused, () => fakeProgress.value = 0)
17
+ </script>
18
+
19
+ <template>
20
+ <div class="mb-xxl">
21
+ <h3 class="mb-l flex g-m y-center">
22
+ Loading
23
+ <Button square :icon="paused ? 'ph:play' : 'ph:pause'" size="s" plain @click="paused = !paused" />
24
+ </h3>
25
+ <table>
26
+ <tbody>
27
+ <tr>
28
+ <th>Spinners</th>
29
+ <td>
30
+ <Flex
31
+ gap="l" :style="{
32
+ 'animation-play-state': 'paused',
33
+ }"
34
+ >
35
+ <Spinner
36
+ v-for="size in variants" :key="size" :size :style="{
37
+ 'animation-play-state': paused ? 'paused' : 'running',
38
+ }"
39
+ />
40
+ </Flex>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th>Progress bar</th>
45
+ <td class="w-80">
46
+ <Flex gap="s" align-center>
47
+ <Button square icon="ph:minus" size="s" @click="progress -= 5" />
48
+ <Progress v-model="progress" class="w-full" />
49
+ <Button square icon="ph:plus" size="s" @click="progress += 5" />
50
+ </Flex>
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <th>Progress bar tall</th>
55
+ <td class="w-80">
56
+ <Flex gap="s" align-center>
57
+ <Progress v-model="progress" :height="8" class="w-full" />
58
+ </Flex>
59
+ </td>
60
+ </tr>
61
+ <tr>
62
+ <th>Fake</th>
63
+ <td>
64
+ <Progress v-model="fakeProgress" :fake="!paused" />
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <th>Fixed</th>
69
+ <td>
70
+ <Checkbox v-model="showFixed" label="Show fixed progress bar (look up)" />
71
+
72
+ <Progress v-if="showFixed" v-model="fakeProgress" :fake="!paused" fixed />
73
+ </td>
74
+ </tr>
75
+ </tbody>
76
+ </table>
77
+ </div>
78
+ </template>
@@ -0,0 +1,195 @@
1
+ <script setup lang="ts">
2
+ import { computed, onBeforeMount, ref } from 'vue'
3
+ import Accordion from '../components/Accordion/Accordion.vue'
4
+ import Divider from '../components/Divider/Divider.vue'
5
+ import { paginate } from '../components/Pagination/pagination'
6
+ import Pagination from '../components/Pagination/Pagination.vue'
7
+ import * as Table from '../components/Table/index'
8
+ import { defineTable } from '../components/Table/table'
9
+
10
+ interface Item {
11
+ 'ID Nation': string
12
+ 'ID Year': number
13
+ 'Nation': string
14
+ 'Population': number
15
+ 'Slug Nation': string
16
+ 'Year': string
17
+ }
18
+
19
+ interface StrippedItem {
20
+ Nation: string
21
+ Population: number
22
+ Year: string
23
+ }
24
+
25
+ const data = ref<StrippedItem[]>([])
26
+
27
+ onBeforeMount(async () => {
28
+ data.value = await fetch('https://datausa.io/api/data?drilldowns=Nation&measures=Population')
29
+ .then(response => response.json())
30
+ .then(({ data }: { data: Item[] }) => {
31
+ return data.map(row => ({
32
+ Nation: row.Nation,
33
+ Population: row.Population,
34
+ Year: row.Year,
35
+ }))
36
+ })
37
+ })
38
+
39
+ const {
40
+ rows,
41
+ headers,
42
+ pagination,
43
+ allRows,
44
+ setPage,
45
+ selectedRows,
46
+ } = defineTable(data, {
47
+ pagination: {
48
+ enabled: true,
49
+ perPage: 3,
50
+ },
51
+ select: true,
52
+ })
53
+
54
+ // Example
55
+ //
56
+ const testData = ['Jan', 'Andrew', 'Kasper', 'Anton', 'Felix', 'Daniel', 'Gabriel', 'Ayalga', 'Floris']
57
+ const page = ref(1)
58
+ const paginationExample = computed(() => paginate(testData.length, page.value, 2))
59
+ const exampleToRender = computed(() => testData.slice(paginationExample.value.startIndex, paginationExample.value.endIndex + 1))
60
+ </script>
61
+
62
+ <template>
63
+ <div class="mb-xxl">
64
+ <h3 class="mb-l">
65
+ Tables
66
+ </h3>
67
+
68
+ <p class="mb-l">
69
+ This library has two way to define tables. By default, you can use the classic <code>table</code> element and compose simple tables. <br> Or you can go overkill with the <code>{{ `<Table />` }}</code> component, which comes with its own composable function
70
+ </p>
71
+
72
+ <strong class="mb-s block">Simple vertical table</strong>
73
+
74
+ <table class="mb-l">
75
+ <thead>
76
+ <tr>
77
+ <th>One</th>
78
+ <th>Two</th>
79
+ <th>Three</th>
80
+ </tr>
81
+ </thead>
82
+ <tbody>
83
+ <tr>
84
+ <td>First </td>
85
+ <td>Second</td>
86
+ <td>Third</td>
87
+ </tr>
88
+ </tbody>
89
+ </table>
90
+
91
+ <strong class="mb-s block">Simple horizontal table</strong>
92
+
93
+ <table class="mb-xxl">
94
+ <tbody>
95
+ <tr>
96
+ <th>One</th>
97
+ <td>First</td>
98
+ </tr>
99
+ <tr>
100
+ <th>Two</th>
101
+ <td>Second</td>
102
+ </tr>
103
+ <tr>
104
+ <th>Three</th>
105
+ <td>Third</td>
106
+ </tr>
107
+ </tbody>
108
+ </table>
109
+
110
+ <h5 class="mb-s">
111
+ Data table
112
+ </h5>
113
+
114
+ <p class="mb-s">
115
+ This example demonstrates the full capability of the table component. Including column sorting, pagination and row selection.
116
+ </p>
117
+
118
+ <Table.Root separate-cells class="mb-l">
119
+ <template #header>
120
+ <Table.SelectAll />
121
+ <Table.Head v-for="header in headers" :key="header.label" :header sort />
122
+ </template>
123
+ <template #body>
124
+ <tr v-for="row in rows" :key="row.Year">
125
+ <Table.SelectRow :row />
126
+ <Table.Cell>{{ row.Nation }}</Table.Cell>
127
+ <Table.Cell>{{ row.Population }}</Table.Cell>
128
+ <Table.Cell>{{ row.Year }}</Table.Cell>
129
+ </tr>
130
+ </template>
131
+ <template #pagination>
132
+ <Pagination :pagination :first-last="false" @change="setPage" />
133
+ </template>
134
+ </Table.Root>
135
+
136
+ <Accordion :label="`Selected rows (${selectedRows.size})`" class="mb-xl">
137
+ <pre>
138
+ {{ selectedRows }}
139
+ </pre>
140
+ </Accordion>
141
+
142
+ <h5 class="mb-s">
143
+ Variations
144
+ </h5>
145
+
146
+ <div class="typeset mb-xl">
147
+ <ul>
148
+ <li><p><code>separate-rows</code> Adds a border between rows (default: <code>true</code>)</p></li>
149
+ <li><p><code>separate-cells</code> Adds a border between cells (default: <code>false</code>)</p></li>
150
+ <li><p><code>outer-border</code> Adds a border around the entire table component (default: <code>true</code>)</p></li>
151
+ <li><p><code>nowrap</code> Adds ellipsis to text which overflows to keep row size consistent (default: <code>false</code>)</p></li>
152
+ <li><p><code>fixed</code> Keeps all the columns the same size (default: <code>false</code>)</p></li>
153
+ </ul>
154
+ </div>
155
+
156
+ <div class="container container-s mb-xxl ml-0">
157
+ <Table.Root :outer-border="false" :separate-cells="true" nowrap fixed>
158
+ <template #body>
159
+ <tr v-for="row in allRows" :key="row.Year">
160
+ <Table.Cell>{{ `${row.Nation} ${row.Nation}` }}</Table.Cell>
161
+ <Table.Cell>{{ row.Population }}</Table.Cell>
162
+ <Table.Cell>{{ row.Year }}</Table.Cell>
163
+ </tr>
164
+ </template>
165
+ </Table.Root>
166
+ </div>
167
+
168
+ <h5 class="mb-s">
169
+ Pagination
170
+ </h5>
171
+
172
+ <p class="mb-m">
173
+ Pagination does not need to be used with table only. The calculation of pages is done via an external function and the pagination component accepts all the necesary props to implement it for any kind of dataset and UI
174
+ </p>
175
+
176
+ <p class="mb-m">
177
+ Here we have a list of names and we're gonna paginate through them:<br><br> {{ testData.join(', ') }}
178
+ </p>
179
+ <Pagination :pagination="paginationExample" @change="(num) => page = num" />
180
+ <div class="typeset">
181
+ <ul>
182
+ <li
183
+ v-for="name in exampleToRender"
184
+ :key="name"
185
+ >
186
+ {{ name }}
187
+ </li>
188
+ </ul>
189
+ </div>
190
+
191
+ <Divider :size="40" class="w-40" />
192
+
193
+ <p>The <code>defineTable</code> hook can also be used with other UI components. Not just tables. That's why all the table interactivity is not within the component, but in a hook. It's very flexible and allows custom functionality.</p>
194
+ </div>
195
+ </template>