@dolanske/vui 0.3.4 → 0.5.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 (114) hide show
  1. package/LICENSE +673 -673
  2. package/README.md +41 -40
  3. package/dist/components/Dropdown/DropdownItem.vue.d.ts +1 -0
  4. package/dist/components/Flex/Flex.vue.d.ts +3 -1
  5. package/dist/components/Grid/Grid.vue.d.ts +3 -1
  6. package/dist/components/Tabs/Tabs.vue.d.ts +4 -0
  7. package/dist/style.css +1 -1
  8. package/dist/vui.js +1547 -1534
  9. package/package.json +68 -68
  10. package/src/App.vue +176 -175
  11. package/src/components/Accordion/Accordion.vue +91 -91
  12. package/src/components/Accordion/AccordionGroup.vue +43 -43
  13. package/src/components/Accordion/accordion.scss +81 -80
  14. package/src/components/Alert/Alert.vue +53 -53
  15. package/src/components/Alert/alert.scss +80 -80
  16. package/src/components/Avatar/Avatar.vue +50 -50
  17. package/src/components/Avatar/avatar.scss +52 -52
  18. package/src/components/Badge/Badge.vue +21 -21
  19. package/src/components/Badge/badge.scss +89 -89
  20. package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -26
  21. package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -33
  22. package/src/components/Breadcrumbs/breadcrumbs.scss +30 -30
  23. package/src/components/Button/Button.vue +90 -90
  24. package/src/components/Button/button.scss +178 -176
  25. package/src/components/ButtonGroup/ButtonGroup.vue +25 -25
  26. package/src/components/ButtonGroup/button-group.scss +51 -51
  27. package/src/components/Calendar/Calendar.vue +63 -60
  28. package/src/components/Calendar/calendar.scss +60 -56
  29. package/src/components/Card/Card.vue +48 -48
  30. package/src/components/Card/card.scss +53 -53
  31. package/src/components/Checkbox/Checkbox.vue +51 -52
  32. package/src/components/Checkbox/checkbox.scss +75 -66
  33. package/src/components/CopyClipboard/CopyClipboard.vue +82 -82
  34. package/src/components/CopyClipboard/copy-clipboard.scss +17 -17
  35. package/src/components/Divider/Divider.vue +44 -44
  36. package/src/components/Divider/divider.scss +35 -35
  37. package/src/components/Drawer/Drawer.vue +97 -97
  38. package/src/components/Drawer/drawer.scss +36 -36
  39. package/src/components/Dropdown/Dropdown.vue +111 -111
  40. package/src/components/Dropdown/DropdownItem.vue +33 -29
  41. package/src/components/Dropdown/DropdownTitle.vue +8 -8
  42. package/src/components/Dropdown/dropdown-item.scss +77 -0
  43. package/src/components/Dropdown/dropdown.scss +39 -117
  44. package/src/components/Flex/Flex.vue +113 -106
  45. package/src/components/Grid/Grid.vue +60 -54
  46. package/src/components/Input/Counter.vue +70 -70
  47. package/src/components/Input/Dropzone.vue +65 -65
  48. package/src/components/Input/File.vue +15 -15
  49. package/src/components/Input/Input.vue +121 -121
  50. package/src/components/Input/Password.vue +47 -47
  51. package/src/components/Input/Textarea.vue +76 -76
  52. package/src/components/Input/input.scss +208 -208
  53. package/src/components/Kbd/Kbd.vue +48 -48
  54. package/src/components/Kbd/KbdGroup.vue +31 -31
  55. package/src/components/Kbd/kbd.scss +18 -18
  56. package/src/components/Modal/Confirm.vue +56 -56
  57. package/src/components/Modal/Modal.vue +91 -91
  58. package/src/components/Modal/modal.scss +49 -49
  59. package/src/components/OTP/OTP.vue +133 -133
  60. package/src/components/OTP/OTPItem.vue +37 -37
  61. package/src/components/OTP/otp.scss +83 -83
  62. package/src/components/Pagination/Pagination.vue +74 -74
  63. package/src/components/Pagination/pagination.ts +78 -78
  64. package/src/components/Popout/Popout.vue +42 -42
  65. package/src/components/Popout/popout.scss +8 -8
  66. package/src/components/Progress/Progress.vue +90 -90
  67. package/src/components/Progress/progress.scss +41 -41
  68. package/src/components/Radio/Radio.vue +36 -36
  69. package/src/components/Radio/RadioGroup.vue +40 -40
  70. package/src/components/Radio/radio.scss +68 -59
  71. package/src/components/Select/Select.vue +180 -180
  72. package/src/components/Select/select.scss +44 -44
  73. package/src/components/Sheet/Sheet.vue +92 -92
  74. package/src/components/Sheet/sheet.scss +60 -60
  75. package/src/components/Sidebar/Sidebar.vue +102 -0
  76. package/src/components/Sidebar/sidebar.scss +123 -0
  77. package/src/components/Skeleton/Skeleton.vue +43 -43
  78. package/src/components/Skeleton/skeleton.scss +14 -14
  79. package/src/components/Spinner/Spinner.vue +42 -42
  80. package/src/components/Spinner/spinner.scss +46 -46
  81. package/src/components/Switch/Switch.vue +30 -30
  82. package/src/components/Switch/switch.scss +60 -52
  83. package/src/components/Table/Cell.vue +23 -23
  84. package/src/components/Table/Header.vue +59 -59
  85. package/src/components/Table/Row.vue +9 -9
  86. package/src/components/Table/SelectAll.vue +23 -23
  87. package/src/components/Table/SelectRow.vue +29 -29
  88. package/src/components/Table/Table.vue +66 -66
  89. package/src/components/Table/table.scss +134 -134
  90. package/src/components/Table/table.ts +244 -244
  91. package/src/components/Tabs/Tab.vue +27 -27
  92. package/src/components/Tabs/Tabs.vue +89 -82
  93. package/src/components/Tabs/tabs.scss +80 -79
  94. package/src/components/Toast/Toasts.vue +47 -47
  95. package/src/components/Toast/toast.scss +41 -41
  96. package/src/components/Toast/toast.ts +68 -68
  97. package/src/components/Tooltip/Tooltip.vue +86 -86
  98. package/src/components/Tooltip/tooltip.scss +4 -4
  99. package/src/index.scss +1 -1
  100. package/src/index.ts +119 -119
  101. package/src/internal/Backdrop/Backdrop.vue +22 -22
  102. package/src/internal/Backdrop/backdrop.scss +28 -28
  103. package/src/main.ts +5 -5
  104. package/src/shared/helpers.ts +74 -74
  105. package/src/shared/types.ts +29 -29
  106. package/src/style/animation.scss +21 -21
  107. package/src/style/core.scss +150 -148
  108. package/src/style/layout.scss +168 -136
  109. package/src/style/media-query.scss +29 -29
  110. package/src/style/reset.scss +135 -135
  111. package/src/style/{fonts.scss → text.scss} +74 -53
  112. package/src/style/tooltip.scss +128 -128
  113. package/src/style/typography.scss +338 -338
  114. package/src/style/utils.scss +36 -36
@@ -1,30 +1,30 @@
1
- <script setup lang="ts">
2
- import { useId } from 'vue'
3
- import './switch.scss'
4
-
5
- interface Props {
6
- label?: string
7
- disabled?: boolean
8
- }
9
-
10
- const { label, disabled } = defineProps<Props>()
11
- const slots = defineSlots()
12
- const checked = defineModel<boolean>()
13
- const id = useId()
14
- </script>
15
-
16
- <template>
17
- <div class="vui-switch" :class="{ disabled, checked }">
18
- <input :id v-model="checked" type="checkbox">
19
- <label :for="id">
20
- <div class="vui-switch-icon">
21
- <span class="vui-switch-indicator" />
22
- </div>
23
-
24
- <p v-if="!slots.default" class="vui-switch-content">{{ label }}</p>
25
- <div v-else class="vui-switch-content">
26
- <slot />
27
- </div>
28
- </label>
29
- </div>
30
- </template>
1
+ <script setup lang="ts">
2
+ import { useId } from 'vue'
3
+ import './switch.scss'
4
+
5
+ interface Props {
6
+ label?: string
7
+ disabled?: boolean
8
+ }
9
+
10
+ const { label, disabled } = defineProps<Props>()
11
+ const slots = defineSlots()
12
+ const checked = defineModel<boolean>()
13
+ const id = useId()
14
+ </script>
15
+
16
+ <template>
17
+ <div class="vui-switch" :class="{ disabled, checked }">
18
+ <input :id v-model="checked" type="checkbox">
19
+ <label :for="id">
20
+ <div class="vui-switch-icon">
21
+ <span class="vui-switch-indicator" />
22
+ </div>
23
+
24
+ <p v-if="!slots.default" class="vui-switch-content">{{ label }}</p>
25
+ <div v-else class="vui-switch-content">
26
+ <slot />
27
+ </div>
28
+ </label>
29
+ </div>
30
+ </template>
@@ -1,52 +1,60 @@
1
- .vui-switch {
2
- --switch-size: 24px;
3
-
4
- &.checked .vui-switch-icon .vui-switch-indicator {
5
- left: calc(100% - 24px);
6
- background-color: var(--color-text);
7
- }
8
-
9
- .vui-switch-icon {
10
- width: 44px;
11
- height: var(--switch-size);
12
- border-radius: 22px;
13
- background-color: var(--color-bg-raised);
14
- position: relative;
15
- cursor: pointer;
16
-
17
- .vui-switch-indicator {
18
- display: block;
19
- position: absolute;
20
- left: 2px;
21
- top: 2px;
22
- width: 20px;
23
- height: 20px;
24
- border-radius: 100%;
25
- background-color: var(--color-bg);
26
- transition: var(--transition);
27
- }
28
- }
29
-
30
- input {
31
- display: none;
32
-
33
- & + label {
34
- display: grid;
35
- grid-template-columns: 44px 1fr;
36
- gap: 10px;
37
- font-size: var(--font-size-m);
38
- color: var(--color-text);
39
- user-select: none;
40
-
41
- .vui-switch-content {
42
- display: block;
43
-
44
- &:is(p) {
45
- height: var(--switch-size);
46
- line-height: var(--switch-size);
47
- font-size: var(--font-size-ms);
48
- }
49
- }
50
- }
51
- }
52
- }
1
+ .vui-switch {
2
+ --switch-size: 24px;
3
+
4
+ &.checked .vui-switch-icon .vui-switch-indicator {
5
+ left: calc(100% - 24px);
6
+ background-color: var(--color-text);
7
+ }
8
+
9
+ .vui-switch-icon {
10
+ width: 44px;
11
+ height: var(--switch-size);
12
+ border-radius: 22px;
13
+ background-color: var(--color-bg-raised);
14
+ position: relative;
15
+ cursor: pointer;
16
+
17
+ .vui-switch-indicator {
18
+ display: block;
19
+ position: absolute;
20
+ left: 2px;
21
+ top: 2px;
22
+ width: 20px;
23
+ height: 20px;
24
+ border-radius: 100%;
25
+ background-color: var(--color-bg);
26
+ transition: var(--transition);
27
+ }
28
+ }
29
+
30
+ input {
31
+ width: 1px;
32
+ height: 1px;
33
+ position: absolute;
34
+ overflow: hidden;
35
+ outline: none !important;
36
+
37
+ &:focus-visible + label .vui-switch-icon {
38
+ outline: 2px solid var(--color-text);
39
+ }
40
+
41
+ & + label {
42
+ display: grid;
43
+ grid-template-columns: 44px 1fr;
44
+ gap: 10px;
45
+ font-size: var(--font-size-m);
46
+ color: var(--color-text);
47
+ user-select: none;
48
+
49
+ .vui-switch-content {
50
+ display: block;
51
+
52
+ &:is(p) {
53
+ height: var(--switch-size);
54
+ line-height: var(--switch-size);
55
+ font-size: var(--font-size-ms);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
@@ -1,23 +1,23 @@
1
- <script setup lang="ts">
2
- import { computed, useSlots, useTemplateRef } from 'vue'
3
-
4
- const slots = useSlots()
5
- const contextRef = useTemplateRef<HTMLTableCellElement>('context')
6
- const computedStyle = computed(() => {
7
- if (!slots.context || !window)
8
- return {}
9
- const width = contextRef.value?.getBoundingClientRect().width ?? 0
10
- return {
11
- paddingRight: `${width}px`,
12
- }
13
- })
14
- </script>
15
-
16
- <template>
17
- <td :style="computedStyle">
18
- <slot />
19
- <div v-if="$slots.context" ref="context" class="vui-cell-context">
20
- <slot name="context" />
21
- </div>
22
- </td>
23
- </template>
1
+ <script setup lang="ts">
2
+ import { computed, useSlots, useTemplateRef } from 'vue'
3
+
4
+ const slots = useSlots()
5
+ const contextRef = useTemplateRef<HTMLTableCellElement>('context')
6
+ const computedStyle = computed(() => {
7
+ if (!slots.context || !window)
8
+ return {}
9
+ const width = contextRef.value?.getBoundingClientRect().width ?? 0
10
+ return {
11
+ paddingRight: `${width}px`,
12
+ }
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <td :style="computedStyle">
18
+ <slot />
19
+ <div v-if="$slots.context" ref="context" class="vui-cell-context">
20
+ <slot name="context" />
21
+ </div>
22
+ </td>
23
+ </template>
@@ -1,59 +1,59 @@
1
- <script setup lang="ts">
2
- import type { Header } from './table'
3
- import { computed } from 'vue'
4
- import Button from '../Button/Button.vue'
5
-
6
- interface Props {
7
- /**
8
- * Main header data. This can be empty in case we are just adding an empty
9
- * padder. It is recommended to just use <th> instead, but this shouldn't fail
10
- * anyway
11
- */
12
- header?: Header
13
- /**
14
- * Enable sorting on this column
15
- */
16
- sort?: boolean
17
- }
18
-
19
- const props = defineProps<Props>()
20
-
21
- const sortStateBind = computed(() => {
22
- if (!props.header)
23
- return
24
- switch (props.header.sortKey) {
25
- case 'asc': return {
26
- 'icon': 'ph:sort-ascending',
27
- 'data-title-top': 'Ascending',
28
- }
29
- case 'desc': return {
30
- 'icon': 'ph:sort-descending',
31
- 'data-title-top': 'Descending',
32
- }
33
- default: return {
34
- 'icon': 'ph:arrows-down-up',
35
- 'data-title-top': 'Sort column',
36
- }
37
- }
38
- })
39
- </script>
40
-
41
- <template>
42
- <th>
43
- <div v-if="props.header" class="vui-table-th-content">
44
- <slot>
45
- {{ props.header.label }}
46
- </slot>
47
- <Button
48
- v-if="props.sort"
49
- class="vui-table-sort-button"
50
- v-bind="sortStateBind"
51
- :class="{ active: !!props.header.sortKey }"
52
- size="s"
53
- plain
54
- square
55
- @click="props.header.sortToggle"
56
- />
57
- </div>
58
- </th>
59
- </template>
1
+ <script setup lang="ts">
2
+ import type { Header } from './table'
3
+ import { computed } from 'vue'
4
+ import Button from '../Button/Button.vue'
5
+
6
+ interface Props {
7
+ /**
8
+ * Main header data. This can be empty in case we are just adding an empty
9
+ * padder. It is recommended to just use <th> instead, but this shouldn't fail
10
+ * anyway
11
+ */
12
+ header?: Header
13
+ /**
14
+ * Enable sorting on this column
15
+ */
16
+ sort?: boolean
17
+ }
18
+
19
+ const props = defineProps<Props>()
20
+
21
+ const sortStateBind = computed(() => {
22
+ if (!props.header)
23
+ return
24
+ switch (props.header.sortKey) {
25
+ case 'asc': return {
26
+ 'icon': 'ph:sort-ascending',
27
+ 'data-title-top': 'Ascending',
28
+ }
29
+ case 'desc': return {
30
+ 'icon': 'ph:sort-descending',
31
+ 'data-title-top': 'Descending',
32
+ }
33
+ default: return {
34
+ 'icon': 'ph:arrows-down-up',
35
+ 'data-title-top': 'Sort column',
36
+ }
37
+ }
38
+ })
39
+ </script>
40
+
41
+ <template>
42
+ <th>
43
+ <div v-if="props.header" class="vui-table-th-content">
44
+ <slot>
45
+ {{ props.header.label }}
46
+ </slot>
47
+ <Button
48
+ v-if="props.sort"
49
+ class="vui-table-sort-button"
50
+ v-bind="sortStateBind"
51
+ :class="{ active: !!props.header.sortKey }"
52
+ size="s"
53
+ plain
54
+ square
55
+ @click="props.header.sortToggle"
56
+ />
57
+ </div>
58
+ </th>
59
+ </template>
@@ -1,9 +1,9 @@
1
- <script setup lang="ts">
2
- //
3
- </script>
4
-
5
- <template>
6
- <tr class="vui-table-row">
7
- <slot />
8
- </tr>
9
- </template>
1
+ <script setup lang="ts">
2
+ //
3
+ </script>
4
+
5
+ <template>
6
+ <tr class="vui-table-row">
7
+ <slot />
8
+ </tr>
9
+ </template>
@@ -1,23 +1,23 @@
1
- <script setup lang='ts'>
2
- import type { TableSelectionProvide } from './table'
3
- import { inject } from 'vue'
4
- import Button from '../Button/Button.vue'
5
- import { TableSelectionProvideSymbol } from './table'
6
-
7
- const {
8
- isSelectedAll,
9
- enabled,
10
- selectAllRows,
11
- } = inject(TableSelectionProvideSymbol) as TableSelectionProvide
12
- </script>
13
-
14
- <template>
15
- <th v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelectedAll }">
16
- <Button
17
- square
18
- plain
19
- :icon="isSelectedAll ? 'ph:check-square-fill' : 'ph:square'"
20
- @click="selectAllRows()"
21
- />
22
- </th>
23
- </template>
1
+ <script setup lang='ts'>
2
+ import type { TableSelectionProvide } from './table'
3
+ import { inject } from 'vue'
4
+ import Button from '../Button/Button.vue'
5
+ import { TableSelectionProvideSymbol } from './table'
6
+
7
+ const {
8
+ isSelectedAll,
9
+ enabled,
10
+ selectAllRows,
11
+ } = inject(TableSelectionProvideSymbol) as TableSelectionProvide
12
+ </script>
13
+
14
+ <template>
15
+ <th v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelectedAll }">
16
+ <Button
17
+ square
18
+ plain
19
+ :icon="isSelectedAll ? 'ph:check-square-fill' : 'ph:square'"
20
+ @click="selectAllRows()"
21
+ />
22
+ </th>
23
+ </template>
@@ -1,29 +1,29 @@
1
- <script setup lang='ts'>
2
- import type { BaseRow, TableSelectionProvide } from './table'
3
- import { computed, inject } from 'vue'
4
- import Button from '../Button/Button.vue'
5
- import { TableSelectionProvideSymbol } from './table'
6
-
7
- interface Props {
8
- row: BaseRow
9
- }
10
-
11
- const props = defineProps<Props>()
12
- const {
13
- enabled,
14
- selectRow,
15
- selectedRows,
16
- } = inject(TableSelectionProvideSymbol) as TableSelectionProvide
17
- const isSelected = computed(() => selectedRows.value.has(props.row))
18
- </script>
19
-
20
- <template>
21
- <td v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelected }">
22
- <Button
23
- square
24
- plain
25
- :icon="isSelected ? 'ph:check-square-fill' : 'ph:square'"
26
- @click="selectRow(props.row)"
27
- />
28
- </td>
29
- </template>
1
+ <script setup lang='ts'>
2
+ import type { BaseRow, TableSelectionProvide } from './table'
3
+ import { computed, inject } from 'vue'
4
+ import Button from '../Button/Button.vue'
5
+ import { TableSelectionProvideSymbol } from './table'
6
+
7
+ interface Props {
8
+ row: BaseRow
9
+ }
10
+
11
+ const props = defineProps<Props>()
12
+ const {
13
+ enabled,
14
+ selectRow,
15
+ selectedRows,
16
+ } = inject(TableSelectionProvideSymbol) as TableSelectionProvide
17
+ const isSelected = computed(() => selectedRows.value.has(props.row))
18
+ </script>
19
+
20
+ <template>
21
+ <td v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelected }">
22
+ <Button
23
+ square
24
+ plain
25
+ :icon="isSelected ? 'ph:check-square-fill' : 'ph:square'"
26
+ @click="selectRow(props.row)"
27
+ />
28
+ </td>
29
+ </template>
@@ -1,66 +1,66 @@
1
- <script setup lang='ts'>
2
- import type { TableSelectionProvide } from './table'
3
- import { inject } from 'vue'
4
- import { TableSelectionProvideSymbol } from './table'
5
- import './table.scss'
6
-
7
- interface Props {
8
- /**
9
- * Sets the `table-layout` property
10
- */
11
- fixed?: boolean
12
- /**
13
- * Table cells with content overflowing on new line will be cropped
14
- */
15
- nowrap?: boolean
16
- /**
17
- * Add a visual separator between each row
18
- */
19
- separateRows?: boolean
20
- /**
21
- * Add a visual separator between each cell
22
- */
23
- separateCells?: boolean
24
- /**
25
- * Wrap table with a border
26
- */
27
- outerBorder?: boolean
28
- }
29
-
30
- const {
31
- fixed,
32
- nowrap,
33
- separateRows = true,
34
- separateCells = false,
35
- outerBorder = true,
36
- } = defineProps<Props>()
37
- const selecting = inject(TableSelectionProvideSymbol) as TableSelectionProvide
38
- </script>
39
-
40
- <template>
41
- <div
42
- class="vui-table-container"
43
- :class="{
44
- fixed,
45
- nowrap,
46
- 'selecting': selecting.enabled,
47
- 'separated-rows': separateRows,
48
- 'separated-cells': separateCells,
49
- 'outer-border': outerBorder,
50
- }"
51
- >
52
- <table>
53
- <thead>
54
- <tr>
55
- <slot name="header" />
56
- </tr>
57
- </thead>
58
- <tbody>
59
- <slot name="body" />
60
- </tbody>
61
- </table>
62
- <div class="vui-table-pagination-wrap">
63
- <slot name="pagination" />
64
- </div>
65
- </div>
66
- </template>
1
+ <script setup lang='ts'>
2
+ import type { TableSelectionProvide } from './table'
3
+ import { inject } from 'vue'
4
+ import { TableSelectionProvideSymbol } from './table'
5
+ import './table.scss'
6
+
7
+ interface Props {
8
+ /**
9
+ * Sets the `table-layout` property
10
+ */
11
+ fixed?: boolean
12
+ /**
13
+ * Table cells with content overflowing on new line will be cropped
14
+ */
15
+ nowrap?: boolean
16
+ /**
17
+ * Add a visual separator between each row
18
+ */
19
+ separateRows?: boolean
20
+ /**
21
+ * Add a visual separator between each cell
22
+ */
23
+ separateCells?: boolean
24
+ /**
25
+ * Wrap table with a border
26
+ */
27
+ outerBorder?: boolean
28
+ }
29
+
30
+ const {
31
+ fixed,
32
+ nowrap,
33
+ separateRows = true,
34
+ separateCells = false,
35
+ outerBorder = true,
36
+ } = defineProps<Props>()
37
+ const selecting = inject(TableSelectionProvideSymbol) as TableSelectionProvide
38
+ </script>
39
+
40
+ <template>
41
+ <div
42
+ class="vui-table-container"
43
+ :class="{
44
+ fixed,
45
+ nowrap,
46
+ 'selecting': selecting.enabled,
47
+ 'separated-rows': separateRows,
48
+ 'separated-cells': separateCells,
49
+ 'outer-border': outerBorder,
50
+ }"
51
+ >
52
+ <table>
53
+ <thead>
54
+ <tr>
55
+ <slot name="header" />
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <slot name="body" />
60
+ </tbody>
61
+ </table>
62
+ <div class="vui-table-pagination-wrap">
63
+ <slot name="pagination" />
64
+ </div>
65
+ </div>
66
+ </template>