@dolanske/vui 0.3.4 → 0.4.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 (110) hide show
  1. package/LICENSE +673 -673
  2. package/README.md +49 -40
  3. package/dist/components/Dropdown/DropdownItem.vue.d.ts +1 -0
  4. package/dist/style.css +1 -1
  5. package/dist/vui.js +864 -859
  6. package/package.json +68 -68
  7. package/src/App.vue +198 -175
  8. package/src/components/Accordion/Accordion.vue +91 -91
  9. package/src/components/Accordion/AccordionGroup.vue +43 -43
  10. package/src/components/Accordion/accordion.scss +80 -80
  11. package/src/components/Alert/Alert.vue +53 -53
  12. package/src/components/Alert/alert.scss +80 -80
  13. package/src/components/Avatar/Avatar.vue +50 -50
  14. package/src/components/Avatar/avatar.scss +52 -52
  15. package/src/components/Badge/Badge.vue +21 -21
  16. package/src/components/Badge/badge.scss +89 -89
  17. package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -26
  18. package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -33
  19. package/src/components/Breadcrumbs/breadcrumbs.scss +30 -30
  20. package/src/components/Button/Button.vue +90 -90
  21. package/src/components/Button/button.scss +176 -176
  22. package/src/components/ButtonGroup/ButtonGroup.vue +25 -25
  23. package/src/components/ButtonGroup/button-group.scss +51 -51
  24. package/src/components/Calendar/Calendar.vue +60 -60
  25. package/src/components/Calendar/calendar.scss +56 -56
  26. package/src/components/Card/Card.vue +48 -48
  27. package/src/components/Card/card.scss +53 -53
  28. package/src/components/Checkbox/Checkbox.vue +52 -52
  29. package/src/components/Checkbox/checkbox.scss +66 -66
  30. package/src/components/CopyClipboard/CopyClipboard.vue +82 -82
  31. package/src/components/CopyClipboard/copy-clipboard.scss +17 -17
  32. package/src/components/Divider/Divider.vue +44 -44
  33. package/src/components/Divider/divider.scss +35 -35
  34. package/src/components/Drawer/Drawer.vue +97 -97
  35. package/src/components/Drawer/drawer.scss +36 -36
  36. package/src/components/Dropdown/Dropdown.vue +111 -111
  37. package/src/components/Dropdown/DropdownItem.vue +32 -29
  38. package/src/components/Dropdown/DropdownTitle.vue +8 -8
  39. package/src/components/Dropdown/dropdown.scss +118 -117
  40. package/src/components/Flex/Flex.vue +110 -106
  41. package/src/components/Grid/Grid.vue +57 -54
  42. package/src/components/Input/Counter.vue +70 -70
  43. package/src/components/Input/Dropzone.vue +65 -65
  44. package/src/components/Input/File.vue +15 -15
  45. package/src/components/Input/Input.vue +121 -121
  46. package/src/components/Input/Password.vue +47 -47
  47. package/src/components/Input/Textarea.vue +76 -76
  48. package/src/components/Input/input.scss +208 -208
  49. package/src/components/Kbd/Kbd.vue +48 -48
  50. package/src/components/Kbd/KbdGroup.vue +31 -31
  51. package/src/components/Kbd/kbd.scss +18 -18
  52. package/src/components/Modal/Confirm.vue +56 -56
  53. package/src/components/Modal/Modal.vue +91 -91
  54. package/src/components/Modal/modal.scss +49 -49
  55. package/src/components/OTP/OTP.vue +133 -133
  56. package/src/components/OTP/OTPItem.vue +37 -37
  57. package/src/components/OTP/otp.scss +83 -83
  58. package/src/components/Pagination/Pagination.vue +74 -74
  59. package/src/components/Pagination/pagination.ts +78 -78
  60. package/src/components/Popout/Popout.vue +42 -42
  61. package/src/components/Popout/popout.scss +8 -8
  62. package/src/components/Progress/Progress.vue +90 -90
  63. package/src/components/Progress/progress.scss +41 -41
  64. package/src/components/Radio/Radio.vue +36 -36
  65. package/src/components/Radio/RadioGroup.vue +40 -40
  66. package/src/components/Radio/radio.scss +59 -59
  67. package/src/components/Select/Select.vue +180 -180
  68. package/src/components/Select/select.scss +44 -44
  69. package/src/components/Sheet/Sheet.vue +92 -92
  70. package/src/components/Sheet/sheet.scss +60 -60
  71. package/src/components/Sidebar/Sidebar.vue +85 -0
  72. package/src/components/Sidebar/sidebar.scss +123 -0
  73. package/src/components/Skeleton/Skeleton.vue +43 -43
  74. package/src/components/Skeleton/skeleton.scss +14 -14
  75. package/src/components/Spinner/Spinner.vue +42 -42
  76. package/src/components/Spinner/spinner.scss +46 -46
  77. package/src/components/Switch/Switch.vue +30 -30
  78. package/src/components/Switch/switch.scss +52 -52
  79. package/src/components/Table/Cell.vue +23 -23
  80. package/src/components/Table/Header.vue +59 -59
  81. package/src/components/Table/Row.vue +9 -9
  82. package/src/components/Table/SelectAll.vue +23 -23
  83. package/src/components/Table/SelectRow.vue +29 -29
  84. package/src/components/Table/Table.vue +66 -66
  85. package/src/components/Table/table.scss +134 -134
  86. package/src/components/Table/table.ts +244 -244
  87. package/src/components/Tabs/Tab.vue +27 -27
  88. package/src/components/Tabs/Tabs.vue +82 -82
  89. package/src/components/Tabs/tabs.scss +79 -79
  90. package/src/components/Toast/Toasts.vue +47 -47
  91. package/src/components/Toast/toast.scss +41 -41
  92. package/src/components/Toast/toast.ts +68 -68
  93. package/src/components/Tooltip/Tooltip.vue +86 -86
  94. package/src/components/Tooltip/tooltip.scss +4 -4
  95. package/src/index.scss +1 -1
  96. package/src/index.ts +119 -119
  97. package/src/internal/Backdrop/Backdrop.vue +22 -22
  98. package/src/internal/Backdrop/backdrop.scss +28 -28
  99. package/src/main.ts +5 -5
  100. package/src/shared/helpers.ts +74 -74
  101. package/src/shared/types.ts +29 -29
  102. package/src/style/animation.scss +21 -21
  103. package/src/style/core.scss +148 -148
  104. package/src/style/fonts.scss +53 -53
  105. package/src/style/layout.scss +136 -136
  106. package/src/style/media-query.scss +29 -29
  107. package/src/style/reset.scss +135 -135
  108. package/src/style/tooltip.scss +128 -128
  109. package/src/style/typography.scss +338 -338
  110. package/src/style/utils.scss +36 -36
@@ -1,52 +1,52 @@
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" 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,66 +1,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
- 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
+ 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,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
+ }