@dolanske/vui 0.1.0 → 0.1.2

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 (162) hide show
  1. package/README.md +7 -0
  2. package/dist/components/Accordion/Accordion.vue.d.ts +45 -0
  3. package/dist/components/Accordion/AccordionGroup.vue.d.ts +32 -0
  4. package/dist/components/Alert/Alert.vue.d.ts +29 -0
  5. package/dist/components/Avatar/Avatar.vue.d.ts +9 -0
  6. package/dist/components/Badge/Badge.vue.d.ts +21 -0
  7. package/dist/components/Breadcrumbs/BreadcrumbItem.vue.d.ts +21 -0
  8. package/dist/components/Breadcrumbs/Breadcrumbs.vue.d.ts +27 -0
  9. package/dist/components/Button/Button.vue.d.ts +41 -0
  10. package/dist/components/ButtonGroup/ButtonGroup.vue.d.ts +19 -0
  11. package/dist/components/Calendar/Calendar.vue.d.ts +27 -0
  12. package/dist/components/Card/Card.vue.d.ts +25 -0
  13. package/dist/components/Checkbox/Checkbox.vue.d.ts +31 -0
  14. package/dist/components/CopyClipboard/CopyClipboard.vue.d.ts +40 -0
  15. package/dist/components/Divider/Divider.vue.d.ts +24 -0
  16. package/dist/components/Drawer/Drawer.vue.d.ts +52 -0
  17. package/dist/components/Dropdown/DropdownItem.vue.d.ts +21 -0
  18. package/dist/components/Dropdown/DropdownTitle.vue.d.ts +17 -0
  19. package/dist/components/Flex/Flex.vue.d.ts +38 -0
  20. package/dist/components/Grid/Grid.vue.d.ts +27 -0
  21. package/dist/components/Input/Counter.vue.d.ts +19 -0
  22. package/dist/components/Input/Dropzone.vue.d.ts +107 -0
  23. package/dist/components/Input/File.vue.d.ts +7 -0
  24. package/dist/components/Input/Input.vue.d.ts +54 -0
  25. package/dist/components/Input/Password.vue.d.ts +6 -0
  26. package/dist/components/Input/Textarea.vue.d.ts +30 -0
  27. package/dist/components/Kbd/Kbd.vue.d.ts +23 -0
  28. package/dist/components/Kbd/KbdGroup.vue.d.ts +31 -0
  29. package/dist/components/Modal/Confirm.vue.d.ts +45 -0
  30. package/dist/components/Modal/Modal.vue.d.ts +55 -0
  31. package/dist/components/Pagination/Pagination.vue.d.ts +42 -0
  32. package/dist/components/Pagination/pagination.d.ts +12 -0
  33. package/dist/components/Popout/Popout.vue.d.ts +34 -0
  34. package/dist/components/Progress/Progress.vue.d.ts +31 -0
  35. package/dist/components/Radio/Radio.vue.d.ts +27 -0
  36. package/dist/components/Radio/RadioGroup.vue.d.ts +40 -0
  37. package/dist/components/Select/Select.vue.d.ts +37 -0
  38. package/dist/components/Sheet/Sheet.vue.d.ts +35 -0
  39. package/dist/components/Skeleton/Skeleton.vue.d.ts +8 -0
  40. package/dist/components/Spinner/Spinner.vue.d.ts +6 -0
  41. package/dist/components/Switch/Switch.vue.d.ts +26 -0
  42. package/dist/components/Table/Cell.vue.d.ts +19 -0
  43. package/dist/components/Table/Header.vue.d.ts +29 -0
  44. package/dist/components/Table/Row.vue.d.ts +16 -0
  45. package/dist/components/Table/SelectAll.vue.d.ts +2 -0
  46. package/dist/components/Table/SelectRow.vue.d.ts +6 -0
  47. package/dist/components/Table/Table.vue.d.ts +40 -0
  48. package/dist/components/Table/table.d.ts +68 -0
  49. package/dist/components/Tabs/Tab.vue.d.ts +8 -0
  50. package/dist/components/Tabs/Tabs.vue.d.ts +43 -0
  51. package/dist/components/Toast/Toasts.vue.d.ts +2 -0
  52. package/dist/components/Toast/toast.d.ts +42 -0
  53. package/dist/components/Tooltip/Tooltip.vue.d.ts +32 -0
  54. package/dist/index.d.ts +54 -1
  55. package/dist/internal/Backdrop/Backdrop.vue.d.ts +20 -0
  56. package/dist/shared/composables.d.ts +3 -0
  57. package/dist/shared/helpers.d.ts +16 -0
  58. package/dist/shared/types.d.ts +10 -0
  59. package/dist/style.css +1 -1
  60. package/dist/vui.js +199 -214
  61. package/package.json +11 -9
  62. package/src/App.vue +162 -0
  63. package/src/components/Accordion/Accordion.vue +75 -0
  64. package/src/components/Accordion/AccordionGroup.vue +43 -0
  65. package/src/components/Accordion/accordion.scss +44 -0
  66. package/src/components/Alert/Alert.vue +53 -0
  67. package/src/components/Alert/alert.scss +80 -0
  68. package/src/components/Avatar/Avatar.vue +36 -0
  69. package/src/components/Avatar/avatar.scss +46 -0
  70. package/src/components/Badge/Badge.vue +21 -0
  71. package/src/components/Badge/badge.scss +89 -0
  72. package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -0
  73. package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -0
  74. package/src/components/Breadcrumbs/breadcrumbs.scss +30 -0
  75. package/src/components/Button/Button.vue +90 -0
  76. package/src/components/Button/button.scss +176 -0
  77. package/src/components/ButtonGroup/ButtonGroup.vue +25 -0
  78. package/src/components/ButtonGroup/button-group.scss +51 -0
  79. package/src/components/Calendar/Calendar.vue +58 -0
  80. package/src/components/Calendar/calendar.scss +56 -0
  81. package/src/components/Card/Card.vue +48 -0
  82. package/src/components/Card/card.scss +53 -0
  83. package/src/components/Checkbox/Checkbox.vue +49 -0
  84. package/src/components/Checkbox/checkbox.scss +60 -0
  85. package/src/components/CopyClipboard/CopyClipboard.vue +82 -0
  86. package/src/components/CopyClipboard/copy-clipboard.scss +17 -0
  87. package/src/components/Divider/Divider.vue +34 -0
  88. package/src/components/Divider/divider.scss +35 -0
  89. package/src/components/Drawer/Drawer.vue +93 -0
  90. package/src/components/Drawer/drawer.scss +49 -0
  91. package/src/components/Dropdown/Dropdown.vue +100 -0
  92. package/src/components/Dropdown/DropdownItem.vue +29 -0
  93. package/src/components/Dropdown/DropdownTitle.vue +8 -0
  94. package/src/components/Dropdown/dropdown.scss +112 -0
  95. package/src/components/Flex/Flex.vue +109 -0
  96. package/src/components/Grid/Grid.vue +59 -0
  97. package/src/components/Input/Counter.vue +70 -0
  98. package/src/components/Input/Dropzone.vue +63 -0
  99. package/src/components/Input/File.vue +15 -0
  100. package/src/components/Input/Input.vue +118 -0
  101. package/src/components/Input/Password.vue +47 -0
  102. package/src/components/Input/Textarea.vue +73 -0
  103. package/src/components/Input/input.scss +199 -0
  104. package/src/components/Kbd/Kbd.vue +48 -0
  105. package/src/components/Kbd/KbdGroup.vue +31 -0
  106. package/src/components/Kbd/kbd.scss +18 -0
  107. package/src/components/Modal/Confirm.vue +56 -0
  108. package/src/components/Modal/Modal.vue +91 -0
  109. package/src/components/Modal/modal.scss +49 -0
  110. package/src/components/Pagination/Pagination.vue +74 -0
  111. package/src/components/Pagination/pagination.ts +78 -0
  112. package/src/components/Popout/Popout.vue +39 -0
  113. package/src/components/Popout/popout.scss +7 -0
  114. package/src/components/Progress/Progress.vue +84 -0
  115. package/src/components/Progress/progress.scss +41 -0
  116. package/src/components/Radio/Radio.vue +36 -0
  117. package/src/components/Radio/RadioGroup.vue +35 -0
  118. package/src/components/Radio/radio.scss +59 -0
  119. package/src/components/Select/Select.vue +180 -0
  120. package/src/components/Select/select.scss +43 -0
  121. package/src/components/Sheet/Sheet.vue +91 -0
  122. package/src/components/Sheet/sheet.scss +56 -0
  123. package/src/components/Skeleton/Skeleton.vue +46 -0
  124. package/src/components/Skeleton/skeleton.scss +14 -0
  125. package/src/components/Spinner/Spinner.vue +44 -0
  126. package/src/components/Spinner/spinner.scss +46 -0
  127. package/src/components/Switch/Switch.vue +30 -0
  128. package/src/components/Switch/switch.scss +52 -0
  129. package/src/components/Table/Cell.vue +23 -0
  130. package/src/components/Table/Header.vue +59 -0
  131. package/src/components/Table/Row.vue +9 -0
  132. package/src/components/Table/SelectAll.vue +23 -0
  133. package/src/components/Table/SelectRow.vue +29 -0
  134. package/src/components/Table/Table.vue +66 -0
  135. package/src/components/Table/table.scss +134 -0
  136. package/src/components/Table/table.ts +243 -0
  137. package/src/components/Tabs/Tab.vue +21 -0
  138. package/src/components/Tabs/Tabs.vue +76 -0
  139. package/src/components/Tabs/tabs.scss +78 -0
  140. package/src/components/Toast/Toasts.vue +47 -0
  141. package/src/components/Toast/toast.scss +41 -0
  142. package/src/components/Toast/toast.ts +92 -0
  143. package/src/components/Tooltip/Tooltip.vue +80 -0
  144. package/src/components/Tooltip/tooltip.scss +4 -0
  145. package/src/index.scss +1 -0
  146. package/src/index.ts +111 -0
  147. package/src/internal/Backdrop/Backdrop.vue +22 -0
  148. package/src/internal/Backdrop/backdrop.scss +28 -0
  149. package/src/main.ts +5 -0
  150. package/src/shared/composables.ts +18 -0
  151. package/src/shared/helpers.ts +53 -0
  152. package/src/shared/types.ts +11 -0
  153. package/src/style/animation.scss +21 -0
  154. package/src/style/core.scss +128 -0
  155. package/src/style/fonts.scss +0 -0
  156. package/src/style/layout.scss +9 -0
  157. package/src/style/media-query.scss +29 -0
  158. package/src/style/reset.scss +135 -0
  159. package/src/style/tooltip.scss +128 -0
  160. package/src/style/typography.scss +339 -0
  161. package/src/style/utils.scss +22 -0
  162. package/src/vite-env.d.ts +1 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolanske/vui",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "private": false,
6
6
  "description": "Brother in Christ there's a new UI library ",
7
7
  "author": "dolanske",
@@ -11,26 +11,28 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/dolanske/vui.git"
13
13
  },
14
+ "keywords": ["vue", "vue3", "component"],
14
15
  "exports": {
15
16
  ".": {
16
17
  "types": "./dist/index.d.ts",
17
18
  "import": "./dist/vui.js"
18
19
  },
19
- "./dist/style.css": {
20
+ "./style": {
20
21
  "import": "./dist/style.css",
21
22
  "require": "./dist/style.css",
22
23
  "default": "./dist/style.css"
23
24
  }
24
25
  },
25
- "main": "dist/vuicjs",
26
- "module": "dist/vui.js",
27
- "browser": "dist/vui.js",
28
- "unpkg": "dist/vui.js",
29
- "types": "dist/index.d.ts",
26
+ "main": "./dist/vuicjs",
27
+ "module": "./dist/vui.js",
28
+ "browser": "./dist/vui.js",
29
+ "unpkg": "./dist/vui.js",
30
+ "types": "./dist/index.d.ts",
30
31
  "files": [
32
+ "./dist/*",
33
+ "./src/*",
31
34
  "LICENSE",
32
- "README.md",
33
- "dist/*"
35
+ "README.md"
34
36
  ],
35
37
  "scripts": {
36
38
  "dev": "vite",
package/src/App.vue ADDED
@@ -0,0 +1,162 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import Accordion from './components/Accordion/Accordion.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 Tab from './components/Tabs/Tab.vue'
8
+ import Tabs from './components/Tabs/Tabs.vue'
9
+
10
+ const tab = ref('components')
11
+ const value = ref('')
12
+ </script>
13
+
14
+ <template>
15
+ <main vaul-drawer-wrapper>
16
+ <Tabs v-model="tab" expand variant="filled">
17
+ <Tab id="home" label="Home" icon="ph:house" />
18
+ <Tab id="components" label="Components" />
19
+ <Tab id="typography" label="Typography" />
20
+ </Tabs>
21
+ <div style="margin-bottom: 64px;" />
22
+ <div v-if="tab === 'home'">
23
+ home
24
+ </div>
25
+ <div v-if="tab === 'components'">
26
+ <Flex>
27
+ <Button variant="success">
28
+ Hello
29
+ </Button>
30
+ <Button variant="success" plain>
31
+ Hello
32
+ </Button>
33
+ <Button variant="success" active>
34
+ Hello
35
+ </Button>
36
+
37
+ {{ value }}
38
+
39
+ <Button variant="success" disabled>
40
+ Hello
41
+ </Button>
42
+ </Flex>
43
+
44
+ <Accordion label="Hi">
45
+ <Input v-model="value" />
46
+ </Accordion>
47
+ </div>
48
+ <div v-else-if="tab === 'typography'" class="typeset" :style="{ maxWidth: '688px', margin: 'auto' }">
49
+ <h1>The Joke Tax Chronicles</h1>
50
+ <p>Once upon a time, in a far-off land, there <code>was a very lazy</code> king who spent all day lounging on his throne. One day, his advisors came to him with a problem: the kingdom was running out of money</p>
51
+ <h2>The King's Plan</h2>
52
+ <p>The king thought long and hard, and finally came up with <a href="#">a brilliant plan</a>: he would tax the jokes in the kingdom.</p>
53
+ <blockquote>"After all," he said, "everyone enjoys a good joke, so it's only fair that they should pay for the privilege."</blockquote>
54
+ <h3>The Joke Tax</h3>
55
+ <p>The king's subjects were not amused. They grumbled and complained, but the king was firm:</p>
56
+ <ul class="ul">
57
+ <li>
58
+ I am an item
59
+ <ul>
60
+ <li>1st level of puns: 5 gold coins</li>
61
+ <li>2nd level of jokes: 10 gold coins</li>
62
+ <li>
63
+ 3rd level of one-liners : 20 gold coins
64
+ <ul>
65
+ <li>1st level of puns: 5 gold coins</li>
66
+ <li>2nd level of jokes: 10 gold coins</li>
67
+ <li>3rd level of one-liners : 20 gold coins</li>
68
+ </ul>
69
+ </li>
70
+ </ul>
71
+ </li>
72
+ <li>2nd level of jokes: 10 gold coins</li>
73
+ <li>3rd level of one-liners : 20 gold coins</li>
74
+ </ul>
75
+ <p>As a result, people stopped telling jokes, and the kingdom fell into a gloom. But there was one person who refused to let the king's foolishness get him down: a court jester named Jokester.</p>
76
+
77
+ <figure>
78
+ <img src="https://i.imgur.com/6WQYrfN.jpeg" alt="">
79
+ <figcaption>Woah look at these mountains</figcaption>
80
+ </figure>
81
+
82
+ <h3>Jokester's Revolt</h3>
83
+ <p>Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place: under the king's pillow, in his soup, even in the royal toilet. The king was furious, but he couldn't seem to stop Jokester.</p>
84
+ <hr>
85
+ <p>And then, one day, the people of the kingdom discovered that the jokes left by Jokester were so funny that they couldn't help but laugh. And once they started laughing, they couldn't stop.</p>
86
+ <ol>
87
+ <li>But the kind was stupid</li>
88
+ <li>He was ratioed 5 times</li>
89
+ </ol>
90
+ <h3>The People's Rebellion</h3>
91
+ <p>The people of the kingdom, feeling uplifted by the laughter, started to tell jokes and puns again, and soon the entire kingdom was in on the joke.</p>
92
+
93
+ <table>
94
+ <thead>
95
+ <tr>
96
+ <th>King's Treasury</th>
97
+ <th>People's happiness</th>
98
+ </tr>
99
+ </thead>
100
+ <tbody>
101
+ <tr>
102
+ <td>Empty</td>
103
+ <td>And then, one day, the people of the kingdom discovered that the jokes left by Jokester were so funny that they couldn't help but laugh. And once they started laughing, they couldn't stop.</td>
104
+ </tr>
105
+ <tr>
106
+ <td>Modest</td>
107
+ <td>Satisfied</td>
108
+ </tr>
109
+ <tr>
110
+ <td>Full</td>
111
+ <td>Ecstatic</td>
112
+ </tr>
113
+ </tbody>
114
+ </table>
115
+ <p>The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax. Jokester was declared a hero, and the kingdom lived happily ever after.</p>
116
+ <p>The moral of the story is: never <code>underestimate</code> the power of a good laugh and always be careful of bad ideas.</p>
117
+
118
+ <pre data-lang="JSON">
119
+ {
120
+ "type": "Feature",
121
+ "properties": {
122
+ "mag": 1.5,
123
+ "place": "77kmNWofSkwentna,Alaska",
124
+ "time": 1668256022741,
125
+ "updated": 1668256203692,
126
+ "tz": null,
127
+ "url": "https://earthquake.usgs.gov/earthquakes/eventpage/ak022eit4nup",
128
+ "detail": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak022eit4nup.geojson",
129
+ "felt": null,
130
+ "cdi": null,
131
+ "mmi": null,
132
+ "alert": null,
133
+ "status": "automatic",
134
+ "tsunami": 0,
135
+ "sig": 35,
136
+ "net": "ak",
137
+ "code": "022eit4nup",
138
+ "ids": ",ak022eit4nup,",
139
+ "sources": ",ak,",
140
+ "types": ",origin,phase-data,",
141
+ "nst": null,
142
+ "dmin": null,
143
+ "rms": 0.55,
144
+ "gap": null,
145
+ "magType": "ml",
146
+ "type": "earthquake",
147
+ "title": "M1.5-77kmNWofSkwentna,Alaska"
148
+ },
149
+ "geometry": {
150
+ "type": "Point",
151
+ "coordinates": [
152
+ -152.2722,
153
+ 62.5489,
154
+ 4.5
155
+ ]
156
+ },
157
+ "id": "ak022eit4nup"
158
+ },
159
+ </pre>
160
+ </div>
161
+ </main>
162
+ </template>
@@ -0,0 +1,75 @@
1
+ <script setup lang="ts">
2
+ import { Icon } from '@iconify/vue'
3
+ import { ref, useTemplateRef, watch, watchEffect } from 'vue'
4
+ import './accordion.scss'
5
+
6
+ export interface AccordionProps {
7
+ open?: boolean
8
+ label?: string
9
+ }
10
+
11
+ const props = defineProps<AccordionProps>()
12
+ const emits = defineEmits<{
13
+ open: []
14
+ close: []
15
+ }>()
16
+
17
+ const isOpen = ref(false)
18
+ const contentRef = useTemplateRef('content')
19
+ const contentMaxHeight = ref(0)
20
+
21
+ watchEffect(() => {
22
+ isOpen.value = props.open
23
+ }, {
24
+ flush: 'post',
25
+ })
26
+
27
+ watch(isOpen, (value) => {
28
+ if (value) {
29
+ emits('open')
30
+ contentMaxHeight.value = contentRef.value?.scrollHeight || 0
31
+ }
32
+ else {
33
+ emits('close')
34
+ }
35
+ }, {
36
+ flush: 'post',
37
+ immediate: true,
38
+ })
39
+
40
+ function open() {
41
+ isOpen.value = true
42
+ }
43
+
44
+ function close() {
45
+ isOpen.value = false
46
+ }
47
+
48
+ function toggle() {
49
+ isOpen.value = !isOpen.value
50
+ }
51
+
52
+ defineExpose({
53
+ open,
54
+ close,
55
+ toggle,
56
+ isOpen,
57
+ })
58
+ </script>
59
+
60
+ <template>
61
+ <div class="vui-accordion" :class="{ open: isOpen }">
62
+ <!-- Completely custom header which needs to be styled and implemented by the developer -->
63
+ <slot v-if="$slots.trigger" name="trigger" :open :close :toggle :is-open />
64
+ <button v-else class="vui-accordion-header" @click="isOpen = !isOpen">
65
+ <slot name="header">
66
+ {{ props.label }}
67
+ </slot>
68
+ <Icon icon="ph:caret-down" />
69
+ </button>
70
+
71
+ <div ref="content" class="vui-accordion-content" :style="{ 'max-height': isOpen ? `${contentMaxHeight}px` : '0px' }">
72
+ <slot />
73
+ </div>
74
+ </div>
75
+ </template>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ import type { VNode } from 'vue'
3
+ import type { AccordionProps } from './Accordion.vue'
4
+ import type Accordion from './Accordion.vue'
5
+ import { useTemplateRef } from 'vue'
6
+ // Renderless component which is used to house multiple accordions which can be triggered together in some way
7
+
8
+ interface Props {
9
+ /**
10
+ * If set to true, if an accordion opens, all other close
11
+ */
12
+ single?: boolean
13
+ }
14
+
15
+ const props = defineProps<Props>()
16
+
17
+ const slots = defineSlots<{
18
+ default: () => Array<VNode & { props: AccordionProps }>
19
+ }>()
20
+
21
+ const accordionRefs = useTemplateRef<InstanceType<typeof Accordion>[]>('accordion')
22
+
23
+ function handleAccordionOpen(newIndex: number) {
24
+ if (!accordionRefs.value || !props.single)
25
+ return
26
+
27
+ accordionRefs.value.forEach((item, index) => {
28
+ if (index !== newIndex) {
29
+ item.close()
30
+ }
31
+ })
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <component
37
+ :is="item"
38
+ v-for="(item, index) of slots.default()"
39
+ ref="accordion"
40
+ :key="item"
41
+ @open="handleAccordionOpen(index)"
42
+ />
43
+ </template>
@@ -0,0 +1,44 @@
1
+ .vui-accordion {
2
+ width: 100%;
3
+ transition: var(--transition);
4
+ border-bottom: 1px solid var(--color-border);
5
+ padding-bottom: 0;
6
+
7
+ &.open {
8
+ padding-bottom: var(--space-m);
9
+
10
+ .vui-accordion-header svg {
11
+ transform: rotate(180deg);
12
+ }
13
+ }
14
+
15
+ .vui-accordion-header {
16
+ display: flex;
17
+ width: 100%;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ padding: var(--space-m) 0;
21
+ color: pointer;
22
+ font-size: var(--font-size-m);
23
+ font-weight: 500;
24
+ color: var(--color-text);
25
+
26
+ &:hover {
27
+ text-decoration: underline;
28
+ text-underline-offset: 4px;
29
+ }
30
+
31
+ svg {
32
+ transition: var(--transition);
33
+ }
34
+
35
+ // padding-bottom: var(--w);
36
+ }
37
+
38
+ .vui-accordion-content {
39
+ transition: var(--transition-slow);
40
+ width: 100%;
41
+ max-height: 0;
42
+ overflow: hidden;
43
+ }
44
+ }
@@ -0,0 +1,53 @@
1
+ <script setup lang="ts">
2
+ import { Icon } from '@iconify/vue'
3
+ import { computed } from 'vue'
4
+ import './alert.scss'
5
+
6
+ interface Props {
7
+ variant?: 'neutral' | 'info' | 'success' | 'warning' | 'danger'
8
+ /**
9
+ * Override the variant's default icon
10
+ */
11
+ icon?: string
12
+
13
+ /**
14
+ * Setting a title and description will use slightly different styling other than slots.
15
+ */
16
+ title?: string
17
+ description?: string
18
+ }
19
+
20
+ const {
21
+ icon = 'ph:circle-light',
22
+ variant = 'neutral',
23
+ title,
24
+ description,
25
+ } = defineProps<Props>()
26
+
27
+ const actualIcon = computed(() => {
28
+ switch (variant) {
29
+ case 'info': return 'ph:info'
30
+ case 'success': return 'ph:check-circle'
31
+ case 'warning': return 'ph:warning'
32
+ case 'danger': return 'ph:warning-diamond'
33
+ default: return icon
34
+ }
35
+ })
36
+ </script>
37
+
38
+ <template>
39
+ <div class="vui-alert" :class="[`vui-alert-variant-${variant}`]">
40
+ <Icon v-if="actualIcon" class="vui-alert-icon" :icon="actualIcon" />
41
+ <div v-if="$slots.default" class="vui-alert-content">
42
+ <slot />
43
+ </div>
44
+ <div v-else class="vui-alert-default-content">
45
+ <strong v-if="title">{{ title }}</strong>
46
+ <p v-if="description">
47
+ {{ description }}
48
+ </p>
49
+ </div>
50
+
51
+ <slot name="end" />
52
+ </div>
53
+ </template>
@@ -0,0 +1,80 @@
1
+ .vui-alert {
2
+ display: flex;
3
+ gap: var(--space-s);
4
+ border-radius: var(--border-radius-m);
5
+ padding: var(--space-s);
6
+ font-size: var(--font-size-m);
7
+ flex-wrap: nowrap;
8
+ align-items: flex-start;
9
+
10
+ svg {
11
+ width: 22px;
12
+ height: 22px;
13
+ }
14
+
15
+ .vui-alert-content,
16
+ .vui-alert-default-content {
17
+ flex: 1;
18
+ }
19
+
20
+ .vui-alert-default-content {
21
+ padding-top: 3px;
22
+
23
+ strong {
24
+ display: block;
25
+ font-size: var(--font-size-l);
26
+ font-weight: 550;
27
+ margin-bottom: 6px;
28
+ }
29
+
30
+ p {
31
+ font-size: var(--font-size-ms);
32
+ color: var(--color-text-light);
33
+ font-weight: 350;
34
+ }
35
+ }
36
+
37
+ .vui-alert-content {
38
+ font-size: var(--font-size-m);
39
+ }
40
+
41
+ &.vui-alert-variant-neutral {
42
+ border: 1px solid var(--color-border);
43
+
44
+ svg path {
45
+ color: var(--color-text);
46
+ }
47
+ }
48
+
49
+ &.vui-alert-variant-info {
50
+ border: 1px solid var(--color-border-blue);
51
+
52
+ svg path {
53
+ color: var(--color-text-blue);
54
+ }
55
+ }
56
+
57
+ &.vui-alert-variant-success {
58
+ border: 1px solid var(--color-border-green);
59
+
60
+ svg path {
61
+ color: var(--color-text-green);
62
+ }
63
+ }
64
+
65
+ &.vui-alert-variant-warning {
66
+ border: 1px solid var(--color-border-yellow);
67
+
68
+ svg path {
69
+ color: var(--color-text-yellow);
70
+ }
71
+ }
72
+
73
+ &.vui-alert-variant-danger {
74
+ border: 1px solid var(--color-border-red);
75
+
76
+ svg path {
77
+ color: var(--color-text-red);
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ import type { Sizes } from '../../shared/types'
3
+ import { Icon } from '@iconify/vue'
4
+ import { ref } from 'vue'
5
+ import './avatar.scss'
6
+
7
+ interface Props {
8
+ size?: Sizes
9
+ url?: string
10
+ fallback?: string
11
+ icon?: string
12
+ }
13
+
14
+ const {
15
+ size = 'm',
16
+ url,
17
+ fallback,
18
+ } = defineProps<Props>()
19
+
20
+ const showFallback = ref(false)
21
+ </script>
22
+
23
+ <template>
24
+ <div
25
+ class="vui-avatar"
26
+ :class="[`vui-avatar-size-${size}`]"
27
+ >
28
+ <img v-if="url && !showFallback" :src="url" @error="showFallback = true">
29
+ <strong v-else>
30
+ <template v-if="showFallback">
31
+ {{ fallback }}
32
+ </template>
33
+ <Icon v-else :icon="icon ?? 'ph:user'" />
34
+ </strong>
35
+ </div>
36
+ </template>
@@ -0,0 +1,46 @@
1
+ .vui-avatar {
2
+ --button-size: 36px;
3
+
4
+ &.vui-avatar-size-s {
5
+ --button-size: 28px;
6
+
7
+ strong {
8
+ font-size: var(--font-size-xs);
9
+ }
10
+ }
11
+
12
+ &.vui-avatar-size-l {
13
+ --button-size: 48px;
14
+
15
+ strong {
16
+ font-size: var(--font-size-m);
17
+ }
18
+ }
19
+
20
+ width: var(--button-size);
21
+ height: var(--button-size);
22
+ border-radius: 100%;
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ overflow: hidden;
27
+ background-color: var(--color-bg-raised);
28
+ font-weight: 500;
29
+
30
+ strong {
31
+ display: block;
32
+ font-size: var(--font-size-s);
33
+ }
34
+
35
+ img {
36
+ display: block;
37
+ height: 100%;
38
+ width: 100%;
39
+ object-position: center;
40
+ object-fit: cover;
41
+ }
42
+
43
+ img[src=''] {
44
+ display: none;
45
+ }
46
+ }
@@ -0,0 +1,21 @@
1
+ <script setup lang="ts">
2
+ import './badge.scss'
3
+
4
+ interface Props {
5
+ variant?: 'neutral' | 'danger' | 'warning' | 'success' | 'info'
6
+ outline?: boolean
7
+ filled?: boolean
8
+ }
9
+
10
+ const {
11
+ variant = 'neutral',
12
+ outline,
13
+ filled,
14
+ } = defineProps<Props>()
15
+ </script>
16
+
17
+ <template>
18
+ <div class="vui-badge" :class="[{ outline, filled }, `vui-badge-variant-${variant}`]">
19
+ <slot />
20
+ </div>
21
+ </template>
@@ -0,0 +1,89 @@
1
+ .vui-badge {
2
+ display: inline-flex;
3
+ gap: var(--space-s);
4
+ place-items: center;
5
+ height: 26px;
6
+ padding-inline: var(--space-s);
7
+ border-radius: 999px;
8
+ font-weight: 300;
9
+ font-size: var(--font-size-s);
10
+
11
+ &.filled {
12
+ font-weight: 500;
13
+ }
14
+
15
+ &.vui-badge-variant-neutral {
16
+ &:not(.outline) {
17
+ background-color: var(--color-bg-raised);
18
+
19
+ &.filled {
20
+ background-color: var(--color-text);
21
+ color: var(--color-text-invert);
22
+ border-color: transparent;
23
+ }
24
+ }
25
+
26
+ color: var(--color-text);
27
+ border: 1px solid var(--color-border);
28
+ }
29
+
30
+ &.vui-badge-variant-info {
31
+ &:not(.outline) {
32
+ background-color: var(--color-bg-blue-lowered);
33
+
34
+ &.filled {
35
+ background-color: var(--color-text-blue);
36
+ color: var(--color-text-invert);
37
+ border-color: transparent;
38
+ }
39
+ }
40
+
41
+ color: var(--color-text);
42
+ border: 1px solid var(--color-border-blue);
43
+ }
44
+
45
+ &.vui-badge-variant-success {
46
+ &:not(.outline) {
47
+ background-color: var(--color-bg-green-lowered);
48
+
49
+ &.filled {
50
+ background-color: var(--color-text-green);
51
+ color: var(--color-text-invert);
52
+ border-color: transparent;
53
+ }
54
+ }
55
+
56
+ color: var(--color-text);
57
+ border: 1px solid var(--color-border-green);
58
+ }
59
+
60
+ &.vui-badge-variant-warning {
61
+ &:not(.outline) {
62
+ background-color: var(--color-bg-yellow-lowered);
63
+
64
+ &.filled {
65
+ background-color: var(--color-text-yellow);
66
+ color: var(--color-text-invert);
67
+ border-color: transparent;
68
+ }
69
+ }
70
+
71
+ color: var(--color-text);
72
+ border: 1px solid var(--color-border-yellow);
73
+ }
74
+
75
+ &.vui-badge-variant-danger {
76
+ &:not(.outline) {
77
+ background-color: var(--color-bg-red-lowered);
78
+
79
+ &.filled {
80
+ background-color: var(--color-text-red);
81
+ color: var(--color-text-invert);
82
+ border-color: transparent;
83
+ }
84
+ }
85
+
86
+ color: var(--color-text);
87
+ border: 1px solid var(--color-border-red);
88
+ }
89
+ }