@dolanske/vui 0.1.5 → 0.3.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 (67) hide show
  1. package/README.md +29 -98
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -0
  3. package/dist/components/Avatar/Avatar.vue.d.ts +1 -1
  4. package/dist/components/Calendar/Calendar.vue.d.ts +1 -1
  5. package/dist/components/Divider/Divider.vue.d.ts +2 -4
  6. package/dist/components/Dropdown/Dropdown.vue.d.ts +105 -0
  7. package/dist/components/Flex/Flex.vue.d.ts +2 -2
  8. package/dist/components/Grid/Grid.vue.d.ts +2 -2
  9. package/dist/components/Input/Dropzone.vue.d.ts +1 -0
  10. package/dist/components/Input/Input.vue.d.ts +1 -0
  11. package/dist/components/Popout/Popout.vue.d.ts +3 -3
  12. package/dist/components/Radio/Radio.vue.d.ts +1 -1
  13. package/dist/components/Radio/RadioGroup.vue.d.ts +3 -12
  14. package/dist/components/Tooltip/Tooltip.vue.d.ts +1 -1
  15. package/dist/index.d.ts +3 -1
  16. package/dist/shared/helpers.d.ts +6 -0
  17. package/dist/shared/types.d.ts +14 -0
  18. package/dist/style.css +1 -1
  19. package/dist/vui.js +4617 -4470
  20. package/package.json +6 -2
  21. package/src/App.vue +24 -16
  22. package/src/components/Accordion/Accordion.vue +8 -4
  23. package/src/components/Accordion/accordion.scss +38 -2
  24. package/src/components/Alert/alert.scss +1 -1
  25. package/src/components/Avatar/Avatar.vue +10 -3
  26. package/src/components/Avatar/avatar.scss +5 -5
  27. package/src/components/Button/Button.vue +6 -9
  28. package/src/components/Calendar/Calendar.vue +10 -8
  29. package/src/components/Card/Card.vue +2 -2
  30. package/src/components/Checkbox/Checkbox.vue +4 -1
  31. package/src/components/Checkbox/checkbox.scss +12 -6
  32. package/src/components/Divider/Divider.vue +18 -8
  33. package/src/components/Drawer/Drawer.vue +14 -10
  34. package/src/components/Drawer/drawer.scss +1 -14
  35. package/src/components/Dropdown/Dropdown.vue +14 -9
  36. package/src/components/Dropdown/dropdown.scss +4 -0
  37. package/src/components/Flex/Flex.vue +14 -17
  38. package/src/components/Grid/Grid.vue +9 -14
  39. package/src/components/Input/Input.vue +4 -1
  40. package/src/components/Input/Textarea.vue +7 -4
  41. package/src/components/Input/input.scss +13 -4
  42. package/src/components/OTP/otp.scss +1 -2
  43. package/src/components/Popout/Popout.vue +3 -3
  44. package/src/components/Progress/Progress.vue +13 -7
  45. package/src/components/Progress/progress.scss +1 -1
  46. package/src/components/Radio/Radio.vue +1 -1
  47. package/src/components/Radio/RadioGroup.vue +10 -5
  48. package/src/components/Sheet/Sheet.vue +16 -15
  49. package/src/components/Sheet/sheet.scss +4 -0
  50. package/src/components/Skeleton/Skeleton.vue +13 -16
  51. package/src/components/Spinner/Spinner.vue +9 -11
  52. package/src/components/Table/table.scss +1 -1
  53. package/src/components/Table/table.ts +2 -1
  54. package/src/components/Tabs/Tab.vue +1 -1
  55. package/src/components/Tabs/Tabs.vue +1 -0
  56. package/src/components/Toast/toast.ts +0 -24
  57. package/src/components/Tooltip/Tooltip.vue +6 -3
  58. package/src/index.ts +4 -0
  59. package/src/shared/helpers.ts +15 -0
  60. package/src/shared/types.ts +18 -0
  61. package/src/style/core.scss +28 -15
  62. package/src/style/fonts.scss +23 -0
  63. package/src/style/layout.scss +133 -1
  64. package/src/style/typography.scss +9 -9
  65. package/src/style/utils.scss +13 -0
  66. package/dist/shared/composables.d.ts +0 -3
  67. package/src/shared/composables.ts +0 -18
package/src/index.ts CHANGED
@@ -30,6 +30,7 @@ import Confirm from './components/Modal/Confirm.vue'
30
30
  import Modal from './components/Modal/Modal.vue'
31
31
  import OTP from './components/OTP/OTP.vue'
32
32
  import OTPItem from './components/OTP/OTPItem.vue'
33
+ import { paginate } from './components/Pagination/pagination'
33
34
  import Pagination from './components/Pagination/Pagination.vue'
34
35
  import Popout from './components/Popout/Popout.vue'
35
36
  import Progress from './components/Progress/Progress.vue'
@@ -45,6 +46,7 @@ import Header from './components/Table/Header.vue'
45
46
  import Row from './components/Table/Row.vue'
46
47
  import SelectAll from './components/Table/SelectAll.vue'
47
48
  import SelectRow from './components/Table/SelectRow.vue'
49
+ import { defineTable } from './components/Table/table'
48
50
  import Table from './components/Table/Table.vue'
49
51
  import Tab from './components/Tabs/Tab.vue'
50
52
  import Tabs from './components/Tabs/Tabs.vue'
@@ -73,6 +75,7 @@ export {
73
75
  Confirm,
74
76
  CopyClipboard,
75
77
  Counter,
78
+ defineTable,
76
79
  Divider,
77
80
  Drawer,
78
81
  Dropdown,
@@ -89,6 +92,7 @@ export {
89
92
  Modal,
90
93
  OTP,
91
94
  OTPItem,
95
+ paginate,
92
96
  Pagination,
93
97
  Password,
94
98
  Popout,
@@ -57,3 +57,18 @@ export function setCharAt(str: string, char: string | number, index: number): st
57
57
  return char.toString()
58
58
  return str.substring(0, index) + char + str.substring(index + 1)
59
59
  }
60
+
61
+ /**
62
+ * Takes in a value and if it is a number, appends "px" to it, otherwise returns
63
+ * the original value.
64
+ *
65
+ */
66
+ export function formatUnitValue(value: string | number, unit: string = 'px'): string {
67
+ return typeof value === 'number'
68
+ ? `${value}${unit}`
69
+ // If last value of string is NOT a number, do not add "px" at the end
70
+ // eslint-disable-next-line unicorn/prefer-number-properties
71
+ : isNaN(Number(value[value.length - 1]))
72
+ ? value
73
+ : `${value}${unit}`
74
+ }
@@ -1,3 +1,5 @@
1
+ import type { ComponentPublicInstance } from 'vue'
2
+
1
3
  export enum Size {
2
4
  s = 's',
3
5
  m = 'm',
@@ -9,3 +11,19 @@ export type Sizes = 's' | 'm' | 'l'
9
11
  export type DeepRequired<T> = { [K in keyof T]: DeepRequired<T[K]> } & Required<T>
10
12
 
11
13
  export type VueClass = string | Record<string, | boolean> | Array<string | Record<string, string | boolean>>
14
+
15
+ // FLoating UI imported types were ruining the build so here we go
16
+ export type PopoutMaybeElement<T> = T | ComponentPublicInstance | null | undefined
17
+ export type Placement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end'
18
+
19
+ export type Space = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'
20
+ export enum SpaceSize {
21
+ xxs = 'xxs',
22
+ xs = 'xs',
23
+ s = 's',
24
+ m = 'm',
25
+ l = 'l',
26
+ xl = 'xl',
27
+ xxl = 'xxl',
28
+ xxxl = 'xxxl',
29
+ }
@@ -1,3 +1,4 @@
1
+ @use 'sass:meta';
1
2
  // Core of the UI library, it should only contain styles which are relevant to
2
3
  // the library and each component should import it
3
4
 
@@ -7,31 +8,40 @@
7
8
  @use './fonts.scss';
8
9
 
9
10
  :root {
11
+ --container-xs: 360px;
10
12
  --container-s: 498px;
11
13
  --container-m: 856px;
12
14
  --container-l: 1140px;
13
15
  --container-xl: 1540px;
16
+ --container-xxl: 1920px;
14
17
 
15
18
  --border-radius-xs: 2px;
16
19
  --border-radius-s: 4px;
17
20
  --border-radius-m: 8px;
18
21
  --border-radius-l: 12px;
19
22
 
23
+ --font-size-xxs: 1rem;
20
24
  --font-size-xs: 1.15rem;
21
25
  --font-size-s: 1.3rem;
22
26
  --font-size-ms: 1.45rem;
23
27
  --font-size-m: 1.6rem;
24
- --font-size-l: 1.65rem;
28
+ --font-size-l: 1.8rem;
29
+ --font-size-xl: 2rem;
30
+ --font-size-xxl: 2.6rem;
31
+ --font-size-xxxl: 3.4rem;
32
+ --font-size-xxxxl: 4.8rem;
25
33
 
34
+ --space-xxs: 4px;
26
35
  --space-xs: 8px;
27
36
  --space-s: 12px;
28
37
  --space-m: 18px;
29
- --space-l: 26px;
30
- --space-xl: 40px;
31
- --space-xxl: 52px;
38
+ --space-l: 24px;
39
+ --space-xl: 34px;
40
+ --space-xxl: 48px;
41
+ --space-xxxl: 64px;
32
42
 
33
- --transition-quick: 0.08s all ease-in-out;
34
- --transition: 0.1s all ease-in-out;
43
+ --transition-fast: 0.08s all ease-in-out;
44
+ --transition: 0.14s all ease-in-out;
35
45
  --transition-slow: 0.3s all ease-in-out;
36
46
 
37
47
  --color-bg: rgb(18, 18, 18);
@@ -41,6 +51,7 @@
41
51
  --color-text: rgb(231, 231, 231);
42
52
  --color-text-light: rgb(158, 158, 158);
43
53
  --color-text-lighter: rgb(100, 100, 100);
54
+ --color-text-lightest: rgb(65, 65, 65);
44
55
  --color-text-invert: rgb(17, 17, 17);
45
56
 
46
57
  --color-button-gray: rgb(28, 28, 28);
@@ -72,10 +83,10 @@
72
83
  --color-border-weak: rgb(36, 36, 36);
73
84
 
74
85
  --color-accent: rgb(56, 214, 219);
75
- --color-accent-disabled: hsl(from var(--color-accent) calc(h) calc(s * 0.5) calc(l));
86
+ --color-accent-disabled: hsl(from var(--color-accent) calc(h) calc(s * 0.4) calc(l));
76
87
  --color-bg-accent-lowered: hsl(from var(--color-accent) calc(h) s calc(l * 0.2));
77
- --color-bg-accent-raised: hsl(from var(--color-accent) calc(h) s calc(l * 0.6));
78
- --color-border-accent: hsl(from var(--color-accent) calc(h) s calc(l * 0.5));
88
+ --color-bg-accent-raised: hsl(from var(--color-accent) calc(h) s calc(l * 0.5));
89
+ --color-border-accent: hsl(from var(--color-accent) calc(h) s calc(l * 0.4));
79
90
 
80
91
  --box-shadow: 0 2px 12px rgba(8, 8, 8, 0.2);
81
92
  --box-shadow-strong: 0 4px 15px rgba(8, 8, 8, 0.4);
@@ -117,12 +128,14 @@
117
128
 
118
129
  body {
119
130
  color: var(--color-text);
131
+ min-height: 100dvh;
120
132
  }
121
133
 
122
- @import './typography.scss';
123
- @import './layout.scss';
124
- @import './animation.scss';
125
- @import './tooltip.scss';
126
- @import './utils.scss';
134
+ @include meta.load-css('typography.scss');
135
+ @include meta.load-css('layout.scss');
136
+ @include meta.load-css('animation.scss');
137
+ @include meta.load-css('tooltip.scss');
138
+ @include meta.load-css('utils.scss');
139
+ @include meta.load-css('fonts.scss');
127
140
 
128
- @import './media-query.scss';
141
+ @include meta.load-css('media-query.scss');
@@ -0,0 +1,23 @@
1
+ $sizes: 'xxs', 'xs', 's', 'ms', 'm', 'l', 'xl', 'xxl', 'xxxl', 'xxxxl';
2
+
3
+ @each $size in $sizes {
4
+ .text-#{$size} {
5
+ font-size: var(--font-size-#{$size});
6
+ }
7
+ }
8
+
9
+ .text-color {
10
+ color: var(--color-text);
11
+ }
12
+
13
+ .text-color-accent {
14
+ color: var(--color-accent);
15
+ }
16
+
17
+ $colors: 'light', 'lighter', 'lightest', 'red', 'green', 'yellow', 'blue';
18
+
19
+ @each $color in $colors {
20
+ .text-color-#{$color} {
21
+ font-size: var(--color-text-#{$color});
22
+ }
23
+ }
@@ -1,4 +1,5 @@
1
- // Contains basic layout definitions and classes to compose basic layouts
1
+ // Container layout styling
2
+ $containers: 'xs', 's', 'm', 'l', 'xl', 'xxl';
2
3
 
3
4
  .container {
4
5
  display: block;
@@ -6,4 +7,135 @@
6
7
  width: 100%;
7
8
  padding-inline: var(--space-m);
8
9
  max-width: var(--container-l);
10
+
11
+ @each $container in $containers {
12
+ &.container-#{$container} {
13
+ max-width: var(--container-#{$container});
14
+ }
15
+ }
16
+
17
+ &.container-full {
18
+ max-width: 100%;
19
+ }
20
+ }
21
+
22
+ // Sizes
23
+
24
+ // Paddings & margins
25
+
26
+ .mx-auto {
27
+ margin-inline: auto;
28
+ }
29
+
30
+ .my-auto {
31
+ margin-block: auto;
32
+ }
33
+
34
+ .m-auto {
35
+ margin: auto;
36
+ }
37
+
38
+ // Generate layout classes from size styles
39
+ $sizes: 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl';
40
+
41
+ @each $size in $sizes {
42
+ // Margin
43
+ .mb-#{$size} {
44
+ margin-bottom: var(--space-#{$size});
45
+ }
46
+
47
+ .mr-#{$size} {
48
+ margin-right: var(--space-#{$size});
49
+ }
50
+
51
+ .ml-#{$size} {
52
+ margin-left: var(--space-#{$size});
53
+ }
54
+
55
+ .mt-#{$size} {
56
+ margin-top: var(--space-#{$size});
57
+ }
58
+
59
+ .mx-#{$size} {
60
+ margin-inline: var(--space-#{$size});
61
+ }
62
+
63
+ .my-#{$size} {
64
+ margin-block: var(--space-#{$size});
65
+ }
66
+
67
+ .m-#{$size} {
68
+ margin: var(--space-#{$size});
69
+ }
70
+
71
+ // Padding
72
+ .pb-#{$size} {
73
+ padding-bottom: var(--space-#{$size});
74
+ }
75
+
76
+ .pr-#{$size} {
77
+ padding-right: var(--space-#{$size});
78
+ }
79
+
80
+ .pl-#{$size} {
81
+ padding-left: var(--space-#{$size});
82
+ }
83
+
84
+ .pt-#{$size} {
85
+ padding-top: var(--space-#{$size});
86
+ }
87
+
88
+ .px-#{$size} {
89
+ padding-inline: var(--space-#{$size});
90
+ }
91
+
92
+ .py-#{$size} {
93
+ padding-block: var(--space-#{$size});
94
+ }
95
+
96
+ .p-#{$size} {
97
+ padding: var(--space-#{$size});
98
+ }
99
+
100
+ // Gap
101
+ .g-#{$size} {
102
+ gap: var(--space-#{$size});
103
+ }
104
+
105
+ .g-y-#{$size} {
106
+ row-gap: var(--space-#{$size});
107
+ }
108
+
109
+ .g-x-#{$size} {
110
+ column-gap: var(--space-#{$size});
111
+ }
112
+ }
113
+
114
+ // Z-index
115
+ .z-0 {
116
+ z-index: 0;
117
+ }
118
+
119
+ .z-10 {
120
+ z-index: 10;
121
+ }
122
+
123
+ .z-20 {
124
+ z-index: 20;
125
+ }
126
+
127
+ .z-30 {
128
+ z-index: 30;
129
+ }
130
+
131
+ .z-40 {
132
+ z-index: 40;
133
+ }
134
+
135
+ .z-50 {
136
+ z-index: 50;
137
+ }
138
+
139
+ .z-auto {
140
+ z-index: auto;
9
141
  }
@@ -15,27 +15,27 @@ h6 {
15
15
  }
16
16
 
17
17
  h1 {
18
- font-size: 5rem;
18
+ font-size: var(--font-size-xxxxl);
19
19
  }
20
20
 
21
21
  h2 {
22
- font-size: 3.5rem;
22
+ font-size: var(--font-size-xxxl);
23
23
  }
24
24
 
25
25
  h3 {
26
- font-size: 2.6rem;
26
+ font-size: var(--font-size-xxl);
27
27
  }
28
28
 
29
29
  h4 {
30
- font-size: 2rem;
30
+ font-size: var(--font-size-xl);
31
31
  }
32
32
 
33
33
  h5 {
34
- font-size: 1.8rem;
34
+ font-size: var(--font-size-l);
35
35
  }
36
36
 
37
37
  h6 {
38
- font-size: 1.6rem;
38
+ font-size: var(--font-size-m);
39
39
  }
40
40
 
41
41
  figcaption,
@@ -62,7 +62,7 @@ p {
62
62
  }
63
63
 
64
64
  code {
65
- border-radius: 2px;
65
+ border-radius: var(--border-radius-xs);
66
66
  background-color: var(--color-bg-raised);
67
67
  color: var(--color-text);
68
68
  border: 1px solid var(--color-border);
@@ -96,7 +96,7 @@ p {
96
96
  blockquote {
97
97
  display: block;
98
98
  padding-block: var(--space-s);
99
- padding-left: 24px;
99
+ padding-left: var(--space-l);
100
100
  border-left: 3px solid var(--color-border);
101
101
  }
102
102
 
@@ -327,7 +327,7 @@ article,
327
327
 
328
328
  figure {
329
329
  img {
330
- margin-bottom: 8px;
330
+ margin-bottom: var(--space-xs);
331
331
  }
332
332
 
333
333
  figcaption {
@@ -20,3 +20,16 @@ mark {
20
20
  padding: 1px;
21
21
  border-radius: 2px;
22
22
  }
23
+
24
+ .counter {
25
+ display: inline-flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ min-width: 20px;
29
+ height: 20px;
30
+ border-radius: 10px;
31
+ font-size: var(--font-size-xs);
32
+ color: var(--color-text);
33
+ background-color: var(--color-button-gray-hover);
34
+ font-weight: 400;
35
+ }
@@ -1,3 +0,0 @@
1
- import { ComputedRef } from 'vue';
2
- import { Sizes } from './types';
3
- export declare function useActualGap(gap?: Sizes | number): ComputedRef<string>;
@@ -1,18 +0,0 @@
1
- import type { ComputedRef } from 'vue'
2
- import type { Sizes } from './types'
3
- import { computed } from 'vue'
4
- import { Size } from './types'
5
-
6
- // Some files may share the same properties
7
- export function useActualGap(gap?: Sizes | number): ComputedRef<string> {
8
- return computed(() => {
9
- if (typeof gap === 'number')
10
- return `${gap}px`
11
- switch (gap) {
12
- case Size.s: return '4px'
13
- case Size.l: return '16px'
14
- case Size.m:
15
- default: return '8px'
16
- }
17
- })
18
- }