@robuust-digital/vue-components 1.1.1 → 1.2.1

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.
@@ -5,91 +5,102 @@ import { withAlphaValue } from 'tailwindcss/lib/util/withAlphaVariable';
5
5
  *
6
6
  * @param {Object} theme - The global theme object
7
7
  */
8
- export default (theme) => {
9
- // Reserved keys that should not be applied to root
10
- const reservedKeys = ['backdrop', 'header', 'title', 'close', 'content', 'footer'];
11
-
12
- // Filter drawer theme object
13
- const drawerRootTheme = Object.entries(theme('components.drawer') || {})
14
- .filter(([key]) => !reservedKeys.includes(key))
15
- .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
16
-
17
- return {
18
- '.drawer': {
19
- position: 'relative',
20
- zIndex: 500,
21
- ...drawerRootTheme,
22
-
23
- // Backdrop
24
- '.drawer-backdrop': {
25
- backgroundColor: withAlphaValue(theme('colors.neutral.900'), 0.5),
26
- ...theme('components.drawer.backdrop'),
27
- },
28
-
29
- // Header
30
- '.drawer-header': {
31
- padding: theme('padding.4'),
32
- backgroundColor: theme('colors.white'),
33
- borderColor: theme('colors.neutral.200'),
34
- borderBottomWidth: theme('borderWidth.DEFAULT'),
35
- borderBottomStyle: theme('borderStyle.solid'),
36
-
37
- [`@media (min-width: ${theme('screens.sm')})`]: {
38
- padding: theme('padding.6'),
39
- },
40
-
41
- ...theme('components.drawer.header'),
42
- },
43
-
44
- // Title
45
- '.drawer-title': {
46
- fontSize: theme('fontSize.2xl'),
47
- fontWeight: theme('fontWeight.bold'),
48
- color: theme('colors.neutral.900'),
49
- ...theme('components.drawer.title'),
50
- },
51
-
52
- // Close
53
- '.drawer-close': {
54
- width: theme('width.6'),
55
- height: theme('height.6'),
56
- color: theme('colors.neutral.700'),
57
-
58
- '&:hover': {
59
- color: theme('colors.neutral.950'),
60
- },
8
+ export default (theme) => ({
9
+ ':root': {
10
+ '--rvc-drawer-backdrop-bg-color': withAlphaValue(theme('colors.slate.900'), 0.5),
11
+ '--rvc-drawer-padding-x': theme('padding.4'),
12
+ '--rvc-drawer-padding-y': theme('padding.4'),
13
+ '--rvc-drawer-border-color': theme('colors.slate.200'),
14
+ '--rvc-drawer-border-width': theme('borderWidth.DEFAULT'),
15
+ '--rvc-drawer-border-style': 'solid',
16
+ '--rvc-drawer-header-bg-color': theme('colors.white'),
17
+ '--rvc-drawer-title-font-size': theme('fontSize.2xl'),
18
+ '--rvc-drawer-title-font-weight': theme('fontWeight.bold'),
19
+ '--rvc-drawer-title-color': theme('colors.slate.900'),
20
+ '--rvc-drawer-close-size': theme('width.6'),
21
+ '--rvc-drawer-close-color': theme('colors.slate.700'),
22
+ '--rvc-drawer-close-color-hover': theme('colors.slate.900'),
23
+ '--rvc-drawer-content-bg-color': theme('colors.white'),
24
+ '--rvc-drawer-footer-bg-color': theme('colors.slate.50'),
25
+ '--rvc-drawer-footer-gap': theme('gap.3'),
26
+ '--rvc-drawer-footer-justify-content': 'space-between',
27
+ },
28
+
29
+ '.rvc-drawer': {
30
+ zIndex: 500,
31
+ position: 'relative',
32
+ ...theme('components.drawer'),
33
+
34
+ // Backdrop
35
+ '.rvc-drawer-backdrop': {
36
+ backgroundColor: 'var(--rvc-drawer-backdrop-bg-color)',
37
+ ...theme('components.drawer[.rvc-drawer-backdrop]'),
38
+ },
61
39
 
62
- ...theme('components.drawer.close'),
63
- },
40
+ // Header
41
+ '.rvc-drawer-header': {
42
+ paddingTop: 'var(--rvc-drawer-padding-y)',
43
+ paddingRight: 'var(--rvc-drawer-padding-x)',
44
+ paddingBottom: 'var(--rvc-drawer-padding-y)',
45
+ paddingLeft: 'var(--rvc-drawer-padding-x)',
46
+ borderColor: 'var(--rvc-drawer-border-color)',
47
+ borderBottomWidth: 'var(--rvc-drawer-border-width)',
48
+ borderBottomStyle: 'var(--rvc-drawer-border-style)',
49
+ backgroundColor: 'var(--rvc-drawer-header-bg-color)',
50
+ ...theme('components.drawer[.rvc-drawer-header]'),
51
+ },
64
52
 
65
- // Content
66
- '.drawer-content': {
67
- padding: theme('padding.4'),
68
- backgroundColor: theme('colors.white'),
53
+ // Title
54
+ '.rvc-drawer-title': {
55
+ fontSize: 'var(--rvc-drawer-title-font-size)',
56
+ fontWeight: 'var(--rvc-drawer-title-font-weight)',
57
+ color: 'var(--rvc-drawer-title-color)',
58
+ ...theme('components.drawer[.rvc-drawer-title]'),
59
+ },
69
60
 
70
- [`@media (min-width: ${theme('screens.sm')})`]: {
71
- padding: theme('padding.6'),
72
- },
61
+ // Close
62
+ '.rvc-drawer-close': {
63
+ width: 'var(--rvc-drawer-close-size)',
64
+ height: 'var(--rvc-drawer-close-size)',
65
+ color: 'var(--rvc-drawer-close-color)',
66
+ ...theme('components.drawer[.rvc-drawer-close]'),
73
67
 
74
- ...theme('components.drawer.content'),
68
+ '&:hover': {
69
+ color: 'var(--rvc-drawer-close-color-hover)',
70
+ ...theme('components.drawer[.rvc-drawer-close][&:hover]'),
75
71
  },
72
+ },
76
73
 
77
- // Footer
78
- '.drawer-footer': {
79
- padding: theme('padding.4'),
80
- backgroundColor: theme('colors.neutral.50'),
81
- borderColor: theme('colors.neutral.200'),
82
- borderTopWidth: theme('borderWidth.DEFAULT'),
83
- borderTopStyle: theme('borderStyle.solid'),
84
- gap: theme('gap.3'),
85
- justifyContent: 'space-between',
74
+ // Content
75
+ '.rvc-drawer-content': {
76
+ paddingTop: 'var(--rvc-drawer-padding-y)',
77
+ paddingRight: 'var(--rvc-drawer-padding-x)',
78
+ paddingBottom: 'var(--rvc-drawer-padding-y)',
79
+ paddingLeft: 'var(--rvc-drawer-padding-x)',
80
+ backgroundColor: 'var(--rvc-drawer-content-bg-color)',
81
+ ...theme('components.drawer[.rvc-drawer-content]'),
82
+ },
86
83
 
87
- [`@media (min-width: ${theme('screens.sm')})`]: {
88
- padding: theme('padding.6'),
89
- },
84
+ // Footer
85
+ '.rvc-drawer-footer': {
86
+ paddingTop: 'var(--rvc-drawer-padding-y)',
87
+ paddingRight: 'var(--rvc-drawer-padding-x)',
88
+ paddingBottom: 'var(--rvc-drawer-padding-y)',
89
+ paddingLeft: 'var(--rvc-drawer-padding-x)',
90
+ borderColor: 'var(--rvc-drawer-border-color)',
91
+ borderTopWidth: 'var(--rvc-drawer-border-width)',
92
+ borderTopStyle: 'var(--rvc-drawer-border-style)',
93
+ backgroundColor: 'var(--rvc-drawer-footer-bg-color)',
94
+ gap: 'var(--rvc-drawer-footer-gap)',
95
+ justifyContent: 'var(--rvc-drawer-footer-justify-content)',
96
+ ...theme('components.drawer[.rvc-drawer-footer]'),
97
+ },
90
98
 
91
- ...theme('components.drawer.footer'),
92
- },
99
+ // Larger screens
100
+ [`@media (min-width: ${theme('screens.sm')})`]: {
101
+ '--rvc-drawer-padding-x': theme('padding.6'),
102
+ '--rvc-drawer-padding-y': theme('padding.6'),
103
+ ...theme('components.drawer[screen-sm]'),
93
104
  },
94
- };
95
- };
105
+ },
106
+ });
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Lightswitch component
3
+ *
4
+ * @param {Object} theme - The global theme object
5
+ */
6
+ export default (theme) => ({
7
+ ':root': {
8
+ '--rvc-lightswitch-border-radius': theme('borderRadius.full'),
9
+ '--rvc-lightswitch-height': '1.875rem',
10
+ '--rvc-lightswitch-width': '3.125rem',
11
+ '--rvc-lightswitch-bg-color': theme('colors.slate.200'),
12
+ '--rvc-lightswitch-bg-color-enabled': theme('colors.green.400'),
13
+ '--rvc-lightswitch-transition-property': theme('transitionProperty.colors'),
14
+ '--rvc-lightswitch-transition-duration': theme('transitionDuration.DEFAULT'),
15
+ '--rvc-lightswitch-transition-timing-function': theme('transitionTimingFunction.DEFAULT'),
16
+ '--rvc-lightswitch-label-offset': '0.5rem',
17
+ '--rvc-lightswitch-toggle-offset': '0.1875rem',
18
+ '--rvc-lightswitch-toggle-size': theme('width.6'),
19
+ '--rvc-lightswitch-toggle-bg-color': theme('colors.white'),
20
+ '--rvc-lightswitch-toggle-transition-property': theme('transitionProperty.transform'),
21
+ '--rvc-lightswitch-toggle-transition-duration': theme('transitionDuration.DEFAULT'),
22
+ '--rvc-lightswitch-toggle-transition-timing-function': theme('transitionTimingFunction.DEFAULT'),
23
+ },
24
+
25
+ '.rvc-lightswitch-group': {
26
+ display: 'inline-block',
27
+ ...theme('components.lightswitch'),
28
+
29
+ '&:has(label)': {
30
+ display: 'inline-flex',
31
+ alignItems: 'center',
32
+ ...theme('components.lightswitch[&:has(label)]'),
33
+ },
34
+
35
+ label: {
36
+ cursor: 'pointer',
37
+ paddingLeft: 'var(--rvc-lightswitch-label-offset)',
38
+ ...theme('components.lightswitch.label'),
39
+ },
40
+
41
+ '.rvc-lightswitch': {
42
+ height: 'var(--rvc-lightswitch-height)',
43
+ transitionProperty: 'var(--rvc-lightswitch-transition-property)',
44
+ transitionDuration: 'var(--rvc-lightswitch-transition-duration)',
45
+ transitionTimingFunction: 'var(--rvc-lightswitch-transition-timing-function)',
46
+ width: 'var(--rvc-lightswitch-width)',
47
+ borderRadius: 'var(--rvc-lightswitch-border-radius)',
48
+ backgroundColor: 'var(--rvc-lightswitch-bg-color)',
49
+ position: 'relative',
50
+ display: 'inline-flex',
51
+ alignItems: 'center',
52
+ ...theme('components.lightswitch[.rvc-lightswitch]'),
53
+
54
+ '.rvc-lightswitch-toggle': {
55
+ width: 'var(--rvc-lightswitch-toggle-size)',
56
+ height: 'var(--rvc-lightswitch-toggle-size)',
57
+ transform: 'translateX(var(--rvc-lightswitch-toggle-offset))',
58
+ borderRadius: 'var(--rvc-lightswitch-border-radius)',
59
+ backgroundColor: 'var(--rvc-lightswitch-toggle-bg-color)',
60
+ transitionProperty: 'var(--rvc-lightswitch-toggle-transition-property)',
61
+ transitionDuration: 'var(--rvc-lightswitch-toggle-transition-duration)',
62
+ transitionTimingFunction: 'var(--rvc-lightswitch-toggle-transition-timing-function)',
63
+ display: 'inline-block',
64
+ boxShadow: theme('boxShadow.md'),
65
+ ...theme('components.lightswitch[.rvc-lightswitch][.rvc-lightswitch-toggle]'),
66
+ },
67
+
68
+ '&.rvc-lightswitch-enabled': {
69
+ backgroundColor: 'var(--rvc-lightswitch-bg-color-enabled)',
70
+ ...theme('components.lightswitch[.rvc-lightswitch][&.rvc-lightswitch-enabled]'),
71
+
72
+ '.rvc-lightswitch-toggle': {
73
+ transform: 'translateX(calc(var(--rvc-lightswitch-width) - var(--rvc-lightswitch-toggle-size) - var(--rvc-lightswitch-toggle-offset)))',
74
+ ...theme('components.lightswitch[.rvc-lightswitch][&.rvc-lightswitch-enabled][.rvc-lightswitch-toggle]'),
75
+ },
76
+ },
77
+ },
78
+ },
79
+ });
@@ -0,0 +1,135 @@
1
+ import { withAlphaValue } from 'tailwindcss/lib/util/withAlphaVariable';
2
+
3
+ /**
4
+ * Modal component
5
+ *
6
+ * @param {Object} theme - The global theme object
7
+ */
8
+ export default (theme) => ({
9
+ ':root': {
10
+ '--rvc-modal-backdrop-bg-color': withAlphaValue(theme('colors.slate.900'), 0.5),
11
+ '--rvc-modal-border-color': theme('colors.slate.200'),
12
+ '--rvc-modal-border-width': theme('borderWidth.DEFAULT'),
13
+ '--rvc-modal-border-style': 'solid',
14
+ '--rvc-modal-border-radius': theme('borderRadius.DEFAULT'),
15
+ '--rvc-modal-box-shadow': theme('boxShadow.xl'),
16
+ '--rvc-modal-margin-y': 0,
17
+ '--rvc-modal-padding-x': theme('padding.4'),
18
+ '--rvc-modal-padding-y': theme('padding.4'),
19
+ '--rvc-modal-header-bg-color': theme('colors.slate.50'),
20
+ '--rvc-modal-title-font-size': theme('fontSize.xl'),
21
+ '--rvc-modal-title-font-weight': theme('fontWeight.bold'),
22
+ '--rvc-modal-title-color': theme('colors.slate.900'),
23
+ '--rvc-modal-close-size': theme('width.6'),
24
+ '--rvc-modal-close-color': theme('colors.slate.700'),
25
+ '--rvc-modal-close-color-hover': theme('colors.slate.900'),
26
+ '--rvc-modal-content-bg-color': theme('colors.white'),
27
+ '--rvc-modal-footer-bg-color': theme('colors.white'),
28
+ '--rvc-modal-footer-gap': theme('gap.2'),
29
+ },
30
+
31
+ '.rvc-modal': {
32
+ zIndex: 600,
33
+ position: 'relative',
34
+ ...theme('components.modal'),
35
+
36
+ // Backdrop
37
+ '.rvc-modal-backdrop': {
38
+ backgroundColor: 'var(--rvc-modal-backdrop-bg-color)',
39
+ ...theme('components.modal[.rvc-modal-backdrop]'),
40
+ },
41
+
42
+ // Panel
43
+ '.rvc-modal-panel': {
44
+ borderColor: 'var(--rvc-modal-border-color)',
45
+ borderWidth: 'var(--rvc-modal-border-width)',
46
+ borderStyle: 'var(--rvc-modal-border-style)',
47
+ borderRadius: 'var(--rvc-modal-border-radius)',
48
+ boxShadow: 'var(--rvc-modal-box-shadow)',
49
+ marginTop: 'var(--rvc-modal-margin-y)',
50
+ marginBottom: 'var(--rvc-modal-margin-y)',
51
+ display: 'flex',
52
+ height: '100%',
53
+ flexDirection: 'column',
54
+ position: 'relative',
55
+ transform: 'translate(0, 0)',
56
+ overflow: 'hidden',
57
+ width: '100%',
58
+ textAlign: 'left',
59
+ ...theme('components.modal[.rvc-modal-panel]'),
60
+ },
61
+
62
+ // Header
63
+ '.rvc-modal-header': {
64
+ paddingTop: 'var(--rvc-modal-padding-y)',
65
+ paddingRight: 'var(--rvc-modal-padding-x)',
66
+ paddingBottom: 'var(--rvc-modal-padding-y)',
67
+ paddingLeft: 'var(--rvc-modal-padding-x)',
68
+ backgroundColor: 'var(--rvc-modal-header-bg-color)',
69
+ borderBottomColor: 'var(--rvc-modal-border-color)',
70
+ borderBottomWidth: 'var(--rvc-modal-border-width)',
71
+ borderBottomStyle: 'var(--rvc-modal-border-style)',
72
+ ...theme('components.modal[.rvc-modal-header]'),
73
+ },
74
+
75
+ // Title
76
+ '.rvc-modal-title': {
77
+ fontSize: 'var(--rvc-modal-title-font-size)',
78
+ fontWeight: 'var(--rvc-modal-title-font-weight)',
79
+ color: 'var(--rvc-modal-title-color)',
80
+ ...theme('components.modal[.rvc-modal-title]'),
81
+ },
82
+
83
+ // Close
84
+ '.rvc-modal-close': {
85
+ width: 'var(--rvc-modal-close-size)',
86
+ height: 'var(--rvc-modal-close-size)',
87
+ color: 'var(--rvc-modal-close-color)',
88
+ ...theme('components.modal[.rvc-modal-close]'),
89
+
90
+ '&:hover': {
91
+ color: 'var(--rvc-modal-close-color-hover)',
92
+ ...theme('components.modal[.rvc-modal-close][&:hover]'),
93
+ },
94
+ },
95
+
96
+ // Content
97
+ '.rvc-modal-content': {
98
+ paddingTop: 'var(--rvc-modal-padding-y)',
99
+ paddingRight: 'var(--rvc-modal-padding-x)',
100
+ paddingBottom: 'var(--rvc-modal-padding-y)',
101
+ paddingLeft: 'var(--rvc-modal-padding-x)',
102
+ backgroundColor: 'var(--rvc-modal-content-bg-color)',
103
+ ...theme('components.modal[.rvc-modal-content]'),
104
+ },
105
+
106
+ // Footer
107
+ '.rvc-modal-footer': {
108
+ paddingTop: 'var(--rvc-modal-padding-y)',
109
+ paddingRight: 'var(--rvc-modal-padding-x)',
110
+ paddingBottom: 'var(--rvc-modal-padding-y)',
111
+ paddingLeft: 'var(--rvc-modal-padding-x)',
112
+ gap: 'var(--rvc-modal-footer-gap)',
113
+ backgroundColor: 'var(--rvc-modal-footer-bg-color)',
114
+ borderTopColor: 'var(--rvc-modal-border-color)',
115
+ borderTopWidth: 'var(--rvc-modal-border-width)',
116
+ borderTopStyle: 'var(--rvc-modal-border-style)',
117
+ display: 'flex',
118
+ flexDirection: 'column',
119
+ ...theme('components.modal[.rvc-modal-footer]'),
120
+
121
+ [`@media (min-width: ${theme('screens.sm')})`]: {
122
+ flexDirection: 'row-reverse',
123
+ ...theme('components.modal[.rvc-modal-footer][screen-sm]'),
124
+ },
125
+ },
126
+
127
+ // Larger screens
128
+ [`@media (min-width: ${theme('screens.sm')})`]: {
129
+ '--rvc-modal-padding-x': theme('padding.6'),
130
+ '--rvc-modal-padding-y': theme('padding.4'),
131
+ '--rvc-modal-footer-gap': theme('gap.3'),
132
+ ...theme('components.modal[screen-sm]'),
133
+ },
134
+ },
135
+ });
@@ -0,0 +1,109 @@
1
+ /**
2
+ * DataTable component
3
+ *
4
+ * @param {Object} theme - The global theme object
5
+ */
6
+ export default (theme) => ({
7
+ ':root': {
8
+ '--rvc-table-head-border-color': theme('colors.slate.300'),
9
+ '--rvc-table-border-color': theme('colors.slate.200'),
10
+ '--rvc-table-border-style': 'solid',
11
+ '--rvc-table-border-width': theme('borderWidth.DEFAULT'),
12
+ '--rvc-table-head-bg-color': theme('colors.slate.200'),
13
+ '--rvc-table-bg-color': theme('colors.slate.50'),
14
+ '--rvc-table-font-size': '0.875rem',
15
+ '--rvc-table-head-font-size': '0.875rem',
16
+ '--rvc-table-head-font-weight': theme('fontWeight.medium'),
17
+ '--rvc-table-font-weight': theme('fontWeight.normal'),
18
+ '--rvc-table-padding-x': theme('padding.2'),
19
+ '--rvc-table-padding-y': theme('padding.3'),
20
+ '--rvc-table-white-space': 'nowrap',
21
+ '--rvc-table-line-height': '1.1',
22
+ '--rvc-table-spinner-size': theme('size.5'),
23
+ },
24
+
25
+ '.rvc-table': {
26
+ ...theme('components.table'),
27
+
28
+ '&.rvc-table-striped': {
29
+ thead: {
30
+ th: {
31
+ paddingRight: 'var(--rvc-table-padding-x)',
32
+ paddingLeft: 'var(--rvc-table-padding-x)',
33
+ backgroundColor: 'var(--rvc-table-head-bg-color)',
34
+ },
35
+ },
36
+
37
+ 'tr:nth-of-type(even)': {
38
+ td: {
39
+ backgroundColor: 'var(--rvc-table-bg-color)',
40
+ },
41
+ },
42
+
43
+ td: {
44
+ paddingRight: 'var(--rvc-table-padding-x)',
45
+ paddingLeft: 'var(--rvc-table-padding-x)',
46
+ },
47
+ },
48
+
49
+ '&:not(.rvc-table-striped)': {
50
+ thead: {
51
+ th: {
52
+ borderBottomWidth: 'var(--rvc-table-border-width)',
53
+ borderBottomColor: 'var(--rvc-table-head-border-color)',
54
+ borderBottomStyle: 'var(--rvc-table-border-style)',
55
+
56
+ '&:not(:first-child,:last-child)': {
57
+ paddingRight: 'var(--rvc-table-padding-x)',
58
+ paddingLeft: 'var(--rvc-table-padding-x)',
59
+ },
60
+ },
61
+ },
62
+
63
+ 'tr:not(:last-child)': {
64
+ td: {
65
+ borderBottomWidth: 'var(--rvc-table-border-width)',
66
+ borderBottomColor: 'var(--rvc-table-border-color)',
67
+ borderBottomStyle: 'var(--rvc-table-border-style)',
68
+ },
69
+ },
70
+
71
+ 'td:not(:first-child,:last-child)': {
72
+ paddingRight: 'var(--rvc-table-padding-x)',
73
+ paddingLeft: 'var(--rvc-table-padding-x)',
74
+ },
75
+ },
76
+
77
+ thead: {
78
+ th: {
79
+ paddingTop: 'var(--rvc-table-padding-y)',
80
+ paddingBottom: 'var(--rvc-table-padding-y)',
81
+ fontSize: 'var(--rvc-table-head-font-size)',
82
+ fontWeight: 'var(--rvc-table-head-font-weight)',
83
+ lineHeight: 'var(--rvc-table-line-height)',
84
+ whiteSpace: 'var(--rvc-table-white-space)',
85
+ },
86
+ },
87
+
88
+ td: {
89
+ paddingTop: 'var(--rvc-table-padding-y)',
90
+ paddingBottom: 'var(--rvc-table-padding-y)',
91
+ fontSize: 'var(--rvc-table-font-size)',
92
+ fontWeight: 'var(--rvc-table-font-weight)',
93
+ lineHeight: 'var(--rvc-table-line-height)',
94
+ whiteSpace: 'var(--rvc-table-white-space)',
95
+ },
96
+
97
+ '.rvc-table-spinner': {
98
+ animation: theme('animation.spin'),
99
+ width: 'var(--rvc-table-spinner-size)',
100
+ height: 'var(--rvc-table-spinner-size)',
101
+ },
102
+
103
+ 'td.rvc-table-state': {
104
+ borderBottomWidth: 'var(--rvc-table-border-width)',
105
+ borderBottomColor: 'var(--rvc-table-border-color)',
106
+ borderBottomStyle: 'var(--rvc-table-border-style)',
107
+ },
108
+ },
109
+ });
@@ -0,0 +1,66 @@
1
+ import { withAlphaValue } from 'tailwindcss/lib/util/withAlphaVariable';
2
+
3
+ /**
4
+ * Tooltip component
5
+ *
6
+ * @param {Object} theme - The global theme object
7
+ */
8
+ export default (theme) => ({
9
+ ':root': {
10
+ '--rvc-tooltip-color': theme('colors.white'),
11
+ '--rvc-tooltip-transition-property': 'opacity, visibility',
12
+ '--rvc-tooltip-transition-duration': theme('transitionDuration.DEFAULT'),
13
+ '--rvc-tooltip-transition-timing-function': theme('transitionTimingFunction.DEFAULT'),
14
+ '--rvc-tooltip-text-align': 'left',
15
+ '--rvc-tooltip-padding-x': theme('padding.4'),
16
+ '--rvc-tooltip-padding-y': theme('padding.4'),
17
+ '--rvc-tooltip-width': theme('width.max'),
18
+ '--rvc-tooltip-border-radius': theme('borderRadius.DEFAULT'),
19
+ '--rvc-tooltip-bg-color': withAlphaValue(theme('colors.neutral.700'), 0.6),
20
+ '--rvc-tooltip-arrow-size': theme('width.3'),
21
+ '--rvc-tooltip-blur-size': theme('blur.sm'),
22
+ },
23
+
24
+ '.rvc-tooltip': {
25
+ zIndex: 10,
26
+ color: 'var(--rvc-tooltip-color)',
27
+ transitionProperty: 'var(--rvc-tooltip-transition-property)',
28
+ transitionDuration: 'var(--rvc-tooltip-transition-duration)',
29
+ transitionTimingFunction: 'var(--rvc-tooltip-transition-timing-function)',
30
+ textAlign: 'var(--rvc-tooltip-text-align)',
31
+ paddingTop: 'var(--rvc-tooltip-padding-y)',
32
+ paddingRight: 'var(--rvc-tooltip-padding-x)',
33
+ paddingBottom: 'var(--rvc-tooltip-padding-y)',
34
+ paddingLeft: 'var(--rvc-tooltip-padding-x)',
35
+ width: 'var(--rvc-tooltip-width)',
36
+ position: 'absolute',
37
+ top: 0,
38
+ left: 0,
39
+ ...theme('components.tooltip'),
40
+
41
+ '&::before': {
42
+ content: '""',
43
+ position: 'absolute',
44
+ top: 0,
45
+ right: 0,
46
+ bottom: 0,
47
+ left: 0,
48
+ borderRadius: 'var(--rvc-tooltip-border-radius)',
49
+ backgroundColor: 'var(--rvc-tooltip-bg-color)',
50
+ zIndex: -1,
51
+ },
52
+
53
+ // Arrow
54
+ '.rvc-tooltip-arrow': {
55
+ backgroundColor: 'var(--rvc-tooltip-bg-color)',
56
+ width: 'var(--rvc-tooltip-arrow-size)',
57
+ height: 'var(--rvc-tooltip-arrow-size)',
58
+ clipPath: 'polygon(0 0, 50% 50%, 100% 0)',
59
+ zIndex: -1,
60
+ },
61
+
62
+ '&.rvc-tooltip-blur::before, &.rvc-tooltip-blur .rvc-tooltip-arrow': {
63
+ backdropFilter: 'blur(var(--rvc-tooltip-blur-size))',
64
+ },
65
+ },
66
+ });
@@ -1,10 +1,19 @@
1
1
  import plugin from 'tailwindcss/plugin';
2
2
 
3
+ // Base
4
+ import base from './base/index.js';
5
+
3
6
  // Components
7
+ import accordion from './components/accordion.js';
4
8
  import alert from './components/alert.js';
5
9
  import badge from './components/badge.js';
6
10
  import button from './components/button.js';
11
+ import checkbox from './components/checkbox.js';
7
12
  import drawer from './components/drawer.js';
13
+ import lightswitch from './components/lightswitch.js';
14
+ import modal from './components/modal.js';
15
+ import table from './components/table.js';
16
+ import tooltip from './components/tooltip.js';
8
17
 
9
18
  /**
10
19
  * Tailwind Theme plugin
@@ -16,11 +25,37 @@ import drawer from './components/drawer.js';
16
25
  *
17
26
  * @returns {void}
18
27
  */
19
- export default plugin.withOptions(() => ({ addComponents, theme }) => {
20
- addComponents([
21
- alert(theme),
22
- badge(theme),
23
- button(theme),
24
- drawer(theme),
25
- ], { respectPrefix: false });
26
- });
28
+ export default plugin.withOptions(
29
+ () => ({ addComponents, addBase, theme }) => {
30
+ addBase(base(theme));
31
+ addComponents([
32
+ accordion(theme),
33
+ alert(theme),
34
+ badge(theme),
35
+ button(theme),
36
+ checkbox(theme),
37
+ drawer(theme),
38
+ lightswitch(theme),
39
+ modal(theme),
40
+ table(theme),
41
+ tooltip(theme),
42
+ ], { respectPrefix: false });
43
+ },
44
+ () => ({
45
+ safelist: [
46
+ // Base
47
+ 'rvc-focus',
48
+ // Components
49
+ 'rvc-accordion',
50
+ 'rvc-alert',
51
+ 'rvc-badge',
52
+ 'rvc-button',
53
+ 'rvc-checkbox',
54
+ 'rvc-drawer',
55
+ 'rvc-lightswitch-group',
56
+ 'rvc-modal',
57
+ 'rvc-table',
58
+ 'rvc-tooltip',
59
+ ],
60
+ }),
61
+ );