@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,119 @@
1
+ <script setup lang='ts'>
2
+ import { Icon } from '@iconify/vue'
3
+ import { ref } from 'vue'
4
+ import Button from '../components/Button/Button.vue'
5
+ import Tab from '../components/Tabs/Tab.vue'
6
+ import Tabs from '../components/Tabs/Tabs.vue'
7
+
8
+ const activeTab = ref('Home')
9
+ </script>
10
+
11
+ <template>
12
+ <div class="mb-xxl">
13
+ <h3 class="mb-l">
14
+ Tabs
15
+ </h3>
16
+ <table>
17
+ <tbody>
18
+ <tr>
19
+ <th>Base</th>
20
+ <td>
21
+ <Tabs v-model="activeTab">
22
+ <Tab label="Home" />
23
+ <Tab label="About" />
24
+ <Tab label="You" />
25
+ </Tabs>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <th>Filled</th>
30
+ <td>
31
+ <Tabs v-model="activeTab" variant="filled">
32
+ <Tab label="Home" />
33
+ <Tab label="About" />
34
+ <Tab label="You" />
35
+ </Tabs>
36
+ </td>
37
+ </tr>
38
+ <tr class="w-100">
39
+ <th>Expanded</th>
40
+ <td class="w-100">
41
+ <Tabs v-model="activeTab" expand>
42
+ <Tab label="Home" />
43
+ <Tab label="About" />
44
+ <Tab label="You" />
45
+ </Tabs>
46
+
47
+ <div class="mb-xl" />
48
+
49
+ <Tabs v-model="activeTab" expand variant="filled">
50
+ <Tab label="Home" />
51
+ <Tab label="About" />
52
+ <Tab label="You" />
53
+ </Tabs>
54
+ </td>
55
+ </tr>
56
+ <tr>
57
+ <th>With slots</th>
58
+ <td class="w-100">
59
+ <Tabs v-model="activeTab">
60
+ <template #start>
61
+ <Button>
62
+ <template #start>
63
+ <Icon icon="ph:sidebar" />
64
+ </template>
65
+ Sidebar
66
+ </Button>
67
+ </template>
68
+ <Tab label="Home" />
69
+ <Tab label="About" />
70
+ <Tab label="You" />
71
+ </Tabs>
72
+
73
+ <div class="mb-xl" />
74
+
75
+ <Tabs v-model="activeTab" variant="filled">
76
+ <Tab label="Home" />
77
+ <Tab label="About" />
78
+ <Tab label="You" />
79
+
80
+ <template #end>
81
+ <Button icon="ph:x" plain />
82
+ </template>
83
+ </Tabs>
84
+ </td>
85
+ </tr>
86
+ <tr>
87
+ <th>With slots expanded</th>
88
+ <td class="w-100">
89
+ <Tabs v-model="activeTab" expand>
90
+ <template #start>
91
+ <Button>
92
+ <template #start>
93
+ <Icon icon="ph:sidebar" />
94
+ </template>
95
+ Sidebar
96
+ </Button>
97
+ </template>
98
+ <Tab label="Home" />
99
+ <Tab label="About" />
100
+ <Tab label="You" />
101
+ </Tabs>
102
+
103
+ <div class="mb-xl" />
104
+
105
+ <Tabs v-model="activeTab" expand variant="filled">
106
+ <Tab label="Home" />
107
+ <Tab label="About" />
108
+ <Tab label="You" />
109
+
110
+ <template #end>
111
+ <Button icon="ph:x" plain />
112
+ </template>
113
+ </Tabs>
114
+ </td>
115
+ </tr>
116
+ </tbody>
117
+ </table>
118
+ </div>
119
+ </template>
@@ -0,0 +1,96 @@
1
+ <script setup lang="ts">
2
+ import { defineComponent, h, markRaw } from 'vue'
3
+ import Button from '../components/Button/Button.vue'
4
+ import { pushToast, removeToast } from '../components/Toast/toast'
5
+ import Toasts from '../components/Toast/Toasts.vue'
6
+
7
+ const testBody = markRaw(defineComponent((props) => {
8
+ return () => h('h2', `${props.data.title} ${props.toastId}`)
9
+ }, {
10
+ props: {
11
+ data: Object,
12
+ toastId: Number,
13
+ },
14
+ }))
15
+ </script>
16
+
17
+ <template>
18
+ <div class="mb-xxl">
19
+ <h3 class="mb-l">
20
+ Toasts
21
+ </h3>
22
+
23
+ <table>
24
+ <tbody>
25
+ <tr>
26
+ <th>Base</th>
27
+ <td>
28
+ <Button @click="pushToast('Hello')">
29
+ Push toast
30
+ </Button>
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <th>+ Description</th>
35
+ <td>
36
+ <Button @click="pushToast('Hello', { description: 'Lorem ipsum dolor sit amet and others stuff but I never learned it past that.' })">
37
+ Push toast
38
+ </Button>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <th>+ Action</th>
43
+ <td>
44
+ <Button
45
+ @click="pushToast('Hello', {
46
+ action: {
47
+ label: 'Close',
48
+ handler: (id) => {
49
+ removeToast(id)
50
+ },
51
+ },
52
+ })"
53
+ >
54
+ Push toast
55
+ </Button>
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <th>+ persist</th>
60
+ <td>
61
+ <Button
62
+ @click="pushToast('Read the description!!', {
63
+ description: 'So when you add an action, the handler exposes the ID of the toast. And you can then manually remove it. This toast will also stay up until you close it. It persists!!',
64
+ action: {
65
+ label: 'Close',
66
+ handler: (id) => {
67
+ removeToast(id)
68
+ },
69
+ },
70
+ persist: true,
71
+ })"
72
+ >
73
+ Push toast
74
+ </Button>
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <th>Custom body</th>
79
+ <td>
80
+ <Button
81
+ @click="pushToast('uhhh', {
82
+ bodyProps: {
83
+ title: 'Bro im a custom component and my id is',
84
+ },
85
+ body: testBody,
86
+ })"
87
+ >
88
+ Push toast
89
+ </Button>
90
+ </td>
91
+ </tr>
92
+ </tbody>
93
+ </table>
94
+ <Toasts />
95
+ </div>
96
+ </template>
@@ -0,0 +1,70 @@
1
+ <script setup lang='ts'>
2
+ import Flex from '../components/Flex/Flex.vue'
3
+ import Tooltip from '../components/Tooltip/Tooltip.vue'
4
+ </script>
5
+
6
+ <template>
7
+ <div class="mb-xxl">
8
+ <h3 class="mb-l">
9
+ Tooltips
10
+ </h3>
11
+
12
+ <table>
13
+ <tbody>
14
+ <tr>
15
+ <th>Base</th>
16
+ <td>
17
+ <Tooltip>
18
+ <span>Hover me</span>
19
+ <template #tooltip>
20
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam minus labore commodi aliquid molestiae non voluptas, veritatis nesciunt. Nihil quod necessitatibus veritatis nam enim eius deleniti unde recusandae reprehenderit voluptate?</p>
21
+ </template>
22
+ </Tooltip>
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <th>Hover delay</th>
27
+ <td>
28
+ <Tooltip :delay="500">
29
+ <span>Hover me</span>
30
+ <template #tooltip>
31
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
32
+ </template>
33
+ </Tooltip>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <th>Custom placement</th>
38
+ <td>
39
+ <Flex>
40
+ <Tooltip placement="top">
41
+ <span>Above</span>
42
+ <template #tooltip>
43
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
44
+ </template>
45
+ </Tooltip>
46
+ <Tooltip placement="right">
47
+ <span>Right</span>
48
+ <template #tooltip>
49
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
50
+ </template>
51
+ </Tooltip>
52
+ <Tooltip placement="left">
53
+ <span>Left</span>
54
+ <template #tooltip>
55
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
56
+ </template>
57
+ </Tooltip>
58
+ <Tooltip placement="bottom">
59
+ <span>Bottom</span>
60
+ <template #tooltip>
61
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
62
+ </template>
63
+ </Tooltip>
64
+ </Flex>
65
+ </td>
66
+ </tr>
67
+ </tbody>
68
+ </table>
69
+ </div>
70
+ </template>
@@ -0,0 +1,28 @@
1
+ <script setup lang='ts'>
2
+ import Grid from '../../components/Grid/Grid.vue'
3
+
4
+ const props = defineProps<{
5
+ name: string
6
+ color: string
7
+ }>()
8
+ </script>
9
+
10
+ <template>
11
+ <Grid columns="212px 32px" align-center>
12
+ <span>{{ props.name }}</span>
13
+ <div
14
+ class="cube" :style="{
15
+ backgroundColor: `var(${props.color})`,
16
+ }"
17
+ />
18
+ </Grid>
19
+ </template>
20
+
21
+ <style scoped>
22
+ .cube {
23
+ display: block;
24
+ width: 32px;
25
+ height: 32px;
26
+ border-radius: var(--border-radius-xs);
27
+ }
28
+ </style>
package/src/index.ts CHANGED
@@ -41,13 +41,8 @@ import Sheet from './components/Sheet/Sheet.vue'
41
41
  import Skeleton from './components/Skeleton/Skeleton.vue'
42
42
  import Spinner from './components/Spinner/Spinner.vue'
43
43
  import Switch from './components/Switch/Switch.vue'
44
- import Cell from './components/Table/Cell.vue'
45
- import Header from './components/Table/Header.vue'
46
- import Row from './components/Table/Row.vue'
47
- import SelectAll from './components/Table/SelectAll.vue'
48
- import SelectRow from './components/Table/SelectRow.vue'
44
+ import * as Table from './components/Table'
49
45
  import { defineTable } from './components/Table/table'
50
- import Table from './components/Table/Table.vue'
51
46
  import Tab from './components/Tabs/Tab.vue'
52
47
  import Tabs from './components/Tabs/Tabs.vue'
53
48
  import { pushToast, removeToast } from './components/Toast/toast'
@@ -55,6 +50,7 @@ import Toasts from './components/Toast/Toasts.vue'
55
50
  import Tooltip from './components/Tooltip/Tooltip.vue'
56
51
  import Backdrop from './internal/Backdrop/Backdrop.vue'
57
52
  import { searchString } from './shared/helpers'
53
+ import { setColorTheme, theme } from './shared/theme'
58
54
  import './index.scss'
59
55
 
60
56
  export {
@@ -70,7 +66,6 @@ export {
70
66
  ButtonGroup,
71
67
  Calendar,
72
68
  Card,
73
- Cell,
74
69
  Checkbox,
75
70
  Confirm,
76
71
  CopyClipboard,
@@ -85,7 +80,6 @@ export {
85
80
  File,
86
81
  Flex,
87
82
  Grid,
88
- Header,
89
83
  Input,
90
84
  Kbd,
91
85
  KbdGroup,
@@ -101,11 +95,9 @@ export {
101
95
  Radio,
102
96
  RadioGroup,
103
97
  removeToast,
104
- Row,
105
98
  searchString,
106
99
  Select,
107
- SelectAll,
108
- SelectRow,
100
+ setColorTheme,
109
101
  Sheet,
110
102
  Skeleton,
111
103
  Spinner,
@@ -114,6 +106,7 @@ export {
114
106
  Table,
115
107
  Tabs,
116
108
  Textarea,
109
+ theme,
117
110
  Toasts,
118
111
  Tooltip,
119
112
  }
@@ -19,10 +19,16 @@
19
19
  z-index: -1;
20
20
  inset: 0;
21
21
  background-color: var(--color-bg-lowered);
22
- opacity: 0.9;
22
+ opacity: 0.75;
23
23
  }
24
24
  }
25
25
 
26
26
  html:has(.vui-backdrop) {
27
27
  overflow: hidden;
28
28
  }
29
+
30
+ :root.light {
31
+ .vui-backdrop:after {
32
+ background-color: var(--dark-color-bg);
33
+ }
34
+ }
@@ -42,6 +42,13 @@ export function stringRgbToValues(rgbString: string): [number, number, number] {
42
42
  return rgbString.match(/\d+/g)!.map(Number) as any as [number, number, number]
43
43
  }
44
44
 
45
+ // export function rgbToHex(r: number, g: number, b: number): string {
46
+ // return `#${[r, g, b].map((x) => {
47
+ // const hex = x.toString(16)
48
+ // return hex.length === 1 ? `0${hex}` : hex
49
+ // }).join('')}`
50
+ // }
51
+
45
52
  export function randomMinMax(min: number, max: number): number {
46
53
  min = Math.ceil(min)
47
54
  max = Math.floor(max)
@@ -72,3 +79,39 @@ export function formatUnitValue(value: string | number, unit: string = 'px'): st
72
79
  ? value
73
80
  : `${value}${unit}`
74
81
  }
82
+
83
+ export function clamp(min: number, max: number, value: number): number {
84
+ return Math.min(Math.max(value, min), max)
85
+ }
86
+
87
+ /**
88
+ * Checks wether an object is inside of Set, based on comparing values. Not reference
89
+ *
90
+ * @param set The Set
91
+ * @param obj Object which should be in the side
92
+ * @returns If object is inside the set
93
+ */
94
+ export function isObjectInSet(set: Set<any>, obj: any): boolean {
95
+ for (const item of set) {
96
+ // Check if both have the same number of keys
97
+ if (Object.keys(item).length !== Object.keys(obj).length) {
98
+ continue
99
+ }
100
+
101
+ // Compare each key-value pair
102
+ let isEqual = true
103
+
104
+ for (const key in item) {
105
+ if (key in item && item[key] !== obj[key]) {
106
+ isEqual = false
107
+ break
108
+ }
109
+ }
110
+
111
+ if (isEqual) {
112
+ return true
113
+ }
114
+ }
115
+
116
+ return false
117
+ }
@@ -0,0 +1,22 @@
1
+ import { useColorMode } from '@vueuse/core'
2
+ import { readonly } from 'vue'
3
+
4
+ export type VuiTheme = 'light' | 'dark' | 'auto'
5
+
6
+ const themeImpl = useColorMode({
7
+ modes: {
8
+ dark: 'dark',
9
+ light: 'light',
10
+ // TODO: add black theme
11
+ // TODO: add high contrast light & dark theme
12
+ },
13
+ })
14
+
15
+ export const theme = readonly(themeImpl)
16
+
17
+ export function setColorTheme(newTheme: VuiTheme): void {
18
+ if (newTheme === themeImpl.value)
19
+ return
20
+
21
+ themeImpl.value = newTheme
22
+ }
@@ -1,6 +1,7 @@
1
1
  .fade-enter-active,
2
2
  .fade-leave-active {
3
3
  transition: var(--transition);
4
+ will-change: opacity;
4
5
  }
5
6
 
6
7
  .fade-enter-from,
@@ -5,8 +5,9 @@
5
5
  // To overwrite any of these styles, simply create a style file and import it
6
6
  // after this one
7
7
  @use './reset.scss';
8
- @use './fonts.scss';
8
+ @use './theme.scss';
9
9
 
10
+ // TODO: Split this into based on media query prefers-dark-mode
10
11
  :root {
11
12
  color-scheme: dark;
12
13
 
@@ -17,16 +18,16 @@
17
18
  --container-xl: 1540px;
18
19
  --container-xxl: 1920px;
19
20
 
20
- --border-radius-xs: 2px;
21
- --border-radius-s: 4px;
21
+ --border-radius-xs: 3px;
22
+ --border-radius-s: 5px;
22
23
  --border-radius-m: 8px;
23
24
  --border-radius-l: 12px;
24
25
 
25
26
  --font-size-xxs: 1rem;
26
27
  --font-size-xs: 1.15rem;
27
28
  --font-size-s: 1.3rem;
28
- --font-size-ms: 1.45rem;
29
- --font-size-m: 1.6rem;
29
+ --font-size-m: 1.45rem;
30
+ --font-size-m: 1.5rem;
30
31
  --font-size-l: 1.8rem;
31
32
  --font-size-xl: 2rem;
32
33
  --font-size-xxl: 2.6rem;
@@ -42,70 +43,47 @@
42
43
  --space-xxl: 48px;
43
44
  --space-xxxl: 64px;
44
45
 
45
- --transition-fast: 0.15s all cubic-bezier(0.65, 0, 0.35, 1);
46
+ --transition-fast: 0.1s all ease-in-out;
46
47
  --transition: 0.2s all cubic-bezier(0.65, 0, 0.35, 1);
47
48
  --transition-slow: 0.35s all cubic-bezier(0.65, 0, 0.35, 1);
48
49
 
49
- --color-bg: rgb(18, 18, 18);
50
- --color-bg-raised: rgb(28, 28, 28);
51
- --color-bg-lowered: rgb(14, 14, 14);
52
-
53
- --color-text: rgb(231, 231, 231);
54
- --color-text-light: rgb(158, 158, 158);
55
- --color-text-lighter: rgb(100, 100, 100);
56
- --color-text-lightest: rgb(65, 65, 65);
57
- --color-text-invert: rgb(17, 17, 17);
58
-
59
- --color-button-gray: rgb(28, 28, 28);
60
- --color-button-gray-hover: rgb(38, 38, 38);
61
-
62
- --color-text-red: rgb(243, 78, 70);
63
- --color-bg-red-lowered: rgb(66, 22, 20);
64
- --color-bg-red-raised: rgb(119, 31, 26);
65
- --color-border-red: rgb(94, 23, 19);
66
-
67
- --color-text-green: rgb(44, 214, 52);
68
- --color-text-green-disabled: rgb(109, 193, 113);
69
- --color-bg-green-lowered: rgb(19, 46, 9);
70
- --color-bg-green-raised: rgb(48, 122, 22);
71
- --color-border-green: rgb(27, 70, 12);
72
-
73
- --color-text-yellow: rgb(243, 231, 70);
74
- --color-bg-yellow-lowered: rgb(59, 46, 10);
75
- --color-bg-yellow-raised: rgb(119, 82, 26);
76
- --color-border-yellow: rgb(99, 97, 16);
77
-
78
- --color-text-blue: rgb(85, 141, 245);
79
- --color-bg-blue-lowered: rgb(10, 25, 59);
80
- --color-bg-blue-raised: rgb(26, 59, 119);
81
- --color-border-blue: rgb(20, 45, 112);
82
-
83
- --color-border: rgb(38, 38, 38);
84
- --color-border-strong: rgb(54, 54, 54);
85
- --color-border-weak: rgb(36, 36, 36);
86
-
87
- --color-accent: rgb(56, 214, 219);
88
- --color-accent-disabled: hsl(from var(--color-accent) calc(h) calc(s * 0.4) calc(l));
89
- --color-bg-accent-lowered: hsl(from var(--color-accent) calc(h) s calc(l * 0.2));
90
- --color-bg-accent-raised: hsl(from var(--color-accent) calc(h) s calc(l * 0.5));
91
- --color-border-accent: hsl(from var(--color-accent) calc(h) s calc(l * 0.4));
92
-
93
- --box-shadow: 0 2px 12px rgba(8, 8, 8, 0.2);
94
- --box-shadow-strong: 0 4px 15px rgba(8, 8, 8, 0.4);
95
-
96
- --global-font: Geist, sans-serif;
50
+ --global-font: Inter, sans-serif;
97
51
  --global-font-mono: 'Geist Mono', 'Courier New', Courier, monospace;
52
+
53
+ --font-weight-thin: 200;
54
+ --font-weight-light: 300;
55
+ --font-weight: 400;
56
+ --font-weight-medium: 500;
57
+ --font-weight-semibold: 600;
58
+ --font-weight-bold: 700;
59
+ --font-weight-extrabold: 700;
60
+ --font-weight-black: 900;
61
+
62
+ --interactive-el-height: 34px;
63
+ }
64
+
65
+ @media (prefers-color-scheme: dark) {
66
+ }
67
+
68
+ // Disable motion for users who have requested it
69
+ @media (prefers-reduced-motion: reduce) {
70
+ :root {
71
+ --transition-fast: 0s all linear;
72
+ --transition: 0s all linear;
73
+ --transition-slow: 0s all linear;
74
+ }
98
75
  }
99
76
 
100
77
  :root {
101
78
  font-family: var(--global-font);
102
79
  font-size: 63.5%;
103
- // TODO remove
80
+ // TODO remove - should remove?
104
81
  position: relative;
105
82
  background-color: var(--color-bg);
106
83
 
107
84
  overflow-x: hidden;
108
85
  width: 100%;
86
+ font-weight: var(--font-weight);
109
87
 
110
88
  font-feature-settings: normal;
111
89
  font-variation-settings: normal;
@@ -143,6 +121,5 @@ body {
143
121
  @include meta.load-css('animation.scss');
144
122
  @include meta.load-css('tooltip.scss');
145
123
  @include meta.load-css('utils.scss');
146
- @include meta.load-css('fonts.scss');
147
-
124
+ @include meta.load-css('text.scss');
148
125
  @include meta.load-css('media-query.scss');