@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,52 +1,51 @@
1
- <script setup lang="ts">
2
- import { Icon } from '@iconify/vue'
3
- import { useId } from 'vue'
4
- import './checkbox.scss'
5
-
6
- interface Props {
7
- label?: string
8
- iconOn?: string
9
- iconOff?: string
10
- disabled?: boolean
11
- checked?: boolean
12
- }
13
-
14
- const {
15
- label,
16
- iconOn = 'ph:check-square-fill',
17
- iconOff = 'ph:square',
18
- disabled,
19
- checked: checkedProp,
20
- } = defineProps<Props>()
21
- const emit = defineEmits<{
22
- change: [checked: boolean]
23
- }>()
24
- const slots = defineSlots()
25
- const checked = defineModel<boolean>()
26
- const id = useId()
27
- </script>
28
-
29
- <template>
30
- <div class="vui-checkbox" :class="{ disabled: !!disabled, checked }">
31
- <input
32
- :id
33
- v-model="checked"
34
- type="checkbox"
35
- :disabled
36
- :checked="checkedProp"
37
- @change="(e) => {
38
- if (disabled) return
39
- emit('change', (e.target as HTMLInputElement).checked)
40
- }"
41
- >
42
- <label :for="id">
43
- <span class="vui-checkbox-icon">
44
- <Icon :icon="checked ? iconOn : iconOff" />
45
- </span>
46
- <p v-if="label" class="vui-checkbox-content">{{ label }}</p>
47
- <div v-else-if="slots.default" class="vui-checkbox-content">
48
- <slot />
49
- </div>
50
- </label>
51
- </div>
52
- </template>
1
+ <script setup lang="ts">
2
+ import { Icon } from '@iconify/vue'
3
+ import { useId } from 'vue'
4
+ import './checkbox.scss'
5
+
6
+ interface Props {
7
+ label?: string
8
+ iconOn?: string
9
+ iconOff?: string
10
+ disabled?: boolean
11
+ checked?: boolean
12
+ }
13
+
14
+ const {
15
+ label,
16
+ iconOn = 'ph:check-square-fill',
17
+ iconOff = 'ph:square',
18
+ disabled,
19
+ checked: checkedProp,
20
+ } = defineProps<Props>()
21
+ const emit = defineEmits<{
22
+ change: [checked: boolean]
23
+ }>()
24
+ const slots = defineSlots()
25
+ const checked = defineModel<boolean>()
26
+ const id = useId()
27
+ </script>
28
+
29
+ <template>
30
+ <div class="vui-checkbox" :class="{ disabled: !!disabled, checked }">
31
+ <input
32
+ :id
33
+ v-model="checked"
34
+ type="checkbox"
35
+ :disabled
36
+ :checked="checkedProp"
37
+ @change="(e) => {
38
+ if (disabled) return
39
+ emit('change', (e.target as HTMLInputElement).checked)
40
+ }"
41
+ >
42
+ <label :for="id">
43
+ <span class="vui-checkbox-icon">
44
+ <Icon :icon="checked ? iconOn : iconOff" />
45
+ </span>
46
+ <p v-if="label || slots.default" class="vui-checkbox-content">
47
+ <slot>{{ label }}</slot>
48
+ </p>
49
+ </label>
50
+ </div>
51
+ </template>
@@ -1,66 +1,75 @@
1
- .vui-checkbox {
2
- --checkbox-size: 24px;
3
-
4
- &.checked {
5
- .vui-checkbox-icon svg {
6
- color: var(--color-text);
7
- }
8
- }
9
-
10
- &.disabled {
11
- cursor: not-allowed;
12
-
13
- .vui-checkbox-icon {
14
- pointer-events: none;
15
- svg path {
16
- color: var(--color-text-lighter);
17
- }
18
- }
19
-
20
- input + label {
21
- cursor: not-allowed;
22
-
23
- p {
24
- color: var(--color-text-lighter);
25
- }
26
- }
27
- }
28
-
29
- .vui-checkbox-icon {
30
- width: var(--checkbox-size);
31
- height: var(--checkbox-size);
32
-
33
- svg {
34
- width: 100%;
35
- height: 100%;
36
- color: var(--color-text);
37
- }
38
- }
39
-
40
- input {
41
- display: none;
42
-
43
- & + label {
44
- display: grid;
45
- grid-template-columns: 20px 1fr;
46
- gap: 10px;
47
- font-size: var(--font-size-m);
48
- color: var(--color-text);
49
- user-select: none;
50
- align-items: baseline;
51
-
52
- .vui-checkbox-content {
53
- display: block;
54
-
55
- &:is(p) {
56
- display: flex;
57
- align-items: center;
58
- min-height: var(--checkbox-size);
59
- font-size: var(--font-size-ms);
60
- align-self: flex-start;
61
- // line-height: var(--checkbox-size);
62
- }
63
- }
64
- }
65
- }
66
- }
1
+ .vui-checkbox {
2
+ --checkbox-size: 24px;
3
+
4
+ &.checked {
5
+ .vui-checkbox-icon svg {
6
+ color: var(--color-text);
7
+ }
8
+ }
9
+
10
+ &.disabled {
11
+ cursor: not-allowed;
12
+
13
+ .vui-checkbox-icon {
14
+ pointer-events: none;
15
+ svg path {
16
+ color: var(--color-text-lighter);
17
+ }
18
+ }
19
+
20
+ input + label {
21
+ cursor: not-allowed;
22
+
23
+ p {
24
+ color: var(--color-text-lighter);
25
+ }
26
+ }
27
+ }
28
+
29
+ .vui-checkbox-icon {
30
+ width: var(--checkbox-size);
31
+ height: var(--checkbox-size);
32
+
33
+ svg {
34
+ width: 100%;
35
+ height: 100%;
36
+ color: var(--color-text);
37
+ }
38
+ }
39
+
40
+ input {
41
+ width: 1px;
42
+ height: 1px;
43
+ position: absolute;
44
+ overflow: hidden;
45
+ outline: none !important;
46
+
47
+ &:focus-visible + label .vui-checkbox-icon {
48
+ outline: 2px solid var(--color-text);
49
+ border-radius: var(--border-radius-s);
50
+ }
51
+
52
+ & + label {
53
+ display: grid;
54
+ grid-template-columns: 20px 1fr;
55
+ gap: 10px;
56
+ font-size: var(--font-size-m);
57
+ color: var(--color-text);
58
+ user-select: none;
59
+ align-items: baseline;
60
+
61
+ .vui-checkbox-content {
62
+ display: block;
63
+
64
+ &:is(p) {
65
+ display: flex;
66
+ align-items: center;
67
+ min-height: var(--checkbox-size);
68
+ font-size: var(--font-size-ms);
69
+ align-self: flex-start;
70
+ // line-height: var(--checkbox-size);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
@@ -1,82 +1,82 @@
1
- <script setup lang='ts'>
2
- import { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue'
3
- import { Icon } from '@iconify/vue'
4
- import { useClipboard } from '@vueuse/core'
5
- import { onMounted, useSlots, useTemplateRef } from 'vue'
6
- import Flex from '../Flex/Flex.vue'
7
- import './copy-clipboard.scss'
8
-
9
- interface Props {
10
- /**
11
- * Text to copy
12
- */
13
- text: string
14
- /**
15
- * Wether to show a tooltip after successful copy
16
- */
17
- confirm?: string | boolean
18
- /**
19
- * How long will the copy confirmation tooltip be visible in milliseconds.
20
- */
21
- confirmTime?: number
22
- }
23
-
24
- const {
25
- text,
26
- confirm,
27
- confirmTime,
28
- } = defineProps<Props>()
29
-
30
- const {
31
- copy,
32
- copied,
33
- isSupported,
34
- } = useClipboard({
35
- copiedDuring: confirmTime,
36
- })
37
- const slots = useSlots()
38
-
39
- onMounted(() => {
40
- if (!isSupported.value) {
41
- console.error('Clipboard API is not supported. This component will not work')
42
- }
43
-
44
- if (confirm && slots.confirm) {
45
- console.warn('You are using the \'confirm\' prop and slot. The slot will take precedence.')
46
- }
47
- })
48
-
49
- const anchorRef = useTemplateRef('anchor')
50
- const tooltipRef = useTemplateRef('tooltip')
51
-
52
- const { floatingStyles } = useFloating(anchorRef, tooltipRef, {
53
- whileElementsMounted: autoUpdate,
54
- transform: false,
55
- placement: 'top',
56
- middleware: [
57
- offset(8),
58
- shift(),
59
- flip(),
60
- ],
61
- })
62
- </script>
63
-
64
- <template>
65
- <div ref="anchor" class="vui-clipboard-copy-wrap" role="button" @click="copy(text)">
66
- <slot :copy :copied />
67
- </div>
68
-
69
- <Transition name="fade-up" mode="in-out">
70
- <div v-if="copied && (confirm || $slots.confirm)" ref="tooltip" class="vui-clipboard-tooltip" :style="floatingStyles">
71
- <slot name="confirm">
72
- <template v-if="confirm">
73
- {{ confirm }}
74
- </template>
75
- <Flex v-else align-center justify-center>
76
- <Icon width="16" height="16" icon="ph:check-bold" />
77
- Copied to clipboard
78
- </Flex>
79
- </slot>
80
- </div>
81
- </Transition>
82
- </template>
1
+ <script setup lang='ts'>
2
+ import { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue'
3
+ import { Icon } from '@iconify/vue'
4
+ import { useClipboard } from '@vueuse/core'
5
+ import { onMounted, useSlots, useTemplateRef } from 'vue'
6
+ import Flex from '../Flex/Flex.vue'
7
+ import './copy-clipboard.scss'
8
+
9
+ interface Props {
10
+ /**
11
+ * Text to copy
12
+ */
13
+ text: string
14
+ /**
15
+ * Wether to show a tooltip after successful copy
16
+ */
17
+ confirm?: string | boolean
18
+ /**
19
+ * How long will the copy confirmation tooltip be visible in milliseconds.
20
+ */
21
+ confirmTime?: number
22
+ }
23
+
24
+ const {
25
+ text,
26
+ confirm,
27
+ confirmTime,
28
+ } = defineProps<Props>()
29
+
30
+ const {
31
+ copy,
32
+ copied,
33
+ isSupported,
34
+ } = useClipboard({
35
+ copiedDuring: confirmTime,
36
+ })
37
+ const slots = useSlots()
38
+
39
+ onMounted(() => {
40
+ if (!isSupported.value) {
41
+ console.error('Clipboard API is not supported. This component will not work')
42
+ }
43
+
44
+ if (confirm && slots.confirm) {
45
+ console.warn('You are using the \'confirm\' prop and slot. The slot will take precedence.')
46
+ }
47
+ })
48
+
49
+ const anchorRef = useTemplateRef('anchor')
50
+ const tooltipRef = useTemplateRef('tooltip')
51
+
52
+ const { floatingStyles } = useFloating(anchorRef, tooltipRef, {
53
+ whileElementsMounted: autoUpdate,
54
+ transform: false,
55
+ placement: 'top',
56
+ middleware: [
57
+ offset(8),
58
+ shift(),
59
+ flip(),
60
+ ],
61
+ })
62
+ </script>
63
+
64
+ <template>
65
+ <div ref="anchor" class="vui-clipboard-copy-wrap" role="button" @click="copy(text)">
66
+ <slot :copy :copied />
67
+ </div>
68
+
69
+ <Transition name="fade-up" mode="in-out">
70
+ <div v-if="copied && (confirm || $slots.confirm)" ref="tooltip" class="vui-clipboard-tooltip" :style="floatingStyles">
71
+ <slot name="confirm">
72
+ <template v-if="confirm">
73
+ {{ confirm }}
74
+ </template>
75
+ <Flex v-else align-center justify-center>
76
+ <Icon width="16" height="16" icon="ph:check-bold" />
77
+ Copied to clipboard
78
+ </Flex>
79
+ </slot>
80
+ </div>
81
+ </Transition>
82
+ </template>
@@ -1,17 +1,17 @@
1
- .vui-clipboard-copy-wrap {
2
- display: inline-block;
3
- position: relative;
4
- }
5
-
6
- .vui-clipboard-tooltip {
7
- padding: 6px 8px;
8
- border-radius: var(--border-radius-s);
9
- background-color: var(--color-bg-raised);
10
- font-size: var(--font-size-s);
11
- color: var(--color-text-light);
12
- box-shadow: var(--box-shadow);
13
-
14
- svg path {
15
- color: var(--color-text);
16
- }
17
- }
1
+ .vui-clipboard-copy-wrap {
2
+ display: inline-block;
3
+ position: relative;
4
+ }
5
+
6
+ .vui-clipboard-tooltip {
7
+ padding: 6px 8px;
8
+ border-radius: var(--border-radius-s);
9
+ background-color: var(--color-bg-raised);
10
+ font-size: var(--font-size-s);
11
+ color: var(--color-text-light);
12
+ box-shadow: var(--box-shadow);
13
+
14
+ svg path {
15
+ color: var(--color-text);
16
+ }
17
+ }
@@ -1,44 +1,44 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { formatUnitValue } from '../../shared/helpers'
4
- import './divider.scss'
5
-
6
- interface Props {
7
- thickness?: number
8
- size?: number | string
9
- vertical?: boolean
10
- margin?: string | number
11
- }
12
-
13
- const {
14
- thickness = 1,
15
- size = 32,
16
- vertical,
17
- margin = '0',
18
- } = defineProps<Props>()
19
-
20
- const h = computed(() => formatUnitValue(size))
21
- const w = computed(() => vertical ? h.value : 'initial')
22
- const bW = computed(() => `${thickness}px`)
23
- const m = computed(() => formatUnitValue(margin))
24
- </script>
25
-
26
- <template>
27
- <div
28
- class="vui-divider" :class="{ vertical }" :style="{
29
- margin: m,
30
- width: w,
31
- height: h,
32
- }"
33
- >
34
- <div v-if="$slots.default" class="vui-divider-slot">
35
- <slot />
36
- </div>
37
- </div>
38
- </template>
39
-
40
- <style lang="scss" scoped>
41
- .vui-divider:before {
42
- border-width: v-bind(bW);
43
- }
44
- </style>
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { formatUnitValue } from '../../shared/helpers'
4
+ import './divider.scss'
5
+
6
+ interface Props {
7
+ thickness?: number
8
+ size?: number | string
9
+ vertical?: boolean
10
+ margin?: string | number
11
+ }
12
+
13
+ const {
14
+ thickness = 1,
15
+ size = 32,
16
+ vertical,
17
+ margin = '0',
18
+ } = defineProps<Props>()
19
+
20
+ const h = computed(() => formatUnitValue(size))
21
+ const w = computed(() => vertical ? h.value : 'initial')
22
+ const bW = computed(() => `${thickness}px`)
23
+ const m = computed(() => formatUnitValue(margin))
24
+ </script>
25
+
26
+ <template>
27
+ <div
28
+ class="vui-divider" :class="{ vertical }" :style="{
29
+ margin: m,
30
+ width: w,
31
+ height: h,
32
+ }"
33
+ >
34
+ <div v-if="$slots.default" class="vui-divider-slot">
35
+ <slot />
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <style lang="scss" scoped>
41
+ .vui-divider:before {
42
+ border-width: v-bind(bW);
43
+ }
44
+ </style>
@@ -1,35 +1,35 @@
1
- .vui-divider {
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- position: relative;
6
- height: 32px;
7
- width: 100%;
8
-
9
- &.vertical:before {
10
- border-bottom: none;
11
- border-right: 1px solid var(--color-border);
12
- transform: translateX(-50%);
13
- width: 1px;
14
- height: 100%;
15
- }
16
-
17
- &:before {
18
- content: '';
19
- display: block;
20
- transform: translateY(-50%);
21
- width: 100%;
22
- border-bottom: 1px solid var(--color-border);
23
- }
24
-
25
- .vui-divider-slot {
26
- position: absolute;
27
- top: 50%;
28
- left: 50%;
29
- transform: translate(-50%, -50%);
30
-
31
- & > *:first-child {
32
- outline: 3px solid var(--color-bg);
33
- }
34
- }
35
- }
1
+ .vui-divider {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ position: relative;
6
+ height: 32px;
7
+ width: 100%;
8
+
9
+ &.vertical:before {
10
+ border-bottom: none;
11
+ border-right: 1px solid var(--color-border);
12
+ transform: translateX(-50%);
13
+ width: 1px;
14
+ height: 100%;
15
+ }
16
+
17
+ &:before {
18
+ content: '';
19
+ display: block;
20
+ transform: translateY(-50%);
21
+ width: 100%;
22
+ border-bottom: 1px solid var(--color-border);
23
+ }
24
+
25
+ .vui-divider-slot {
26
+ position: absolute;
27
+ top: 50%;
28
+ left: 50%;
29
+ transform: translate(-50%, -50%);
30
+
31
+ & > *:first-child {
32
+ outline: 3px solid var(--color-bg);
33
+ }
34
+ }
35
+ }