@robuust-digital/vue-components 1.0.1-rc.3 → 1.1.0-rc.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.
package/README.md CHANGED
@@ -54,6 +54,16 @@ export default {
54
54
  };
55
55
  ```
56
56
 
57
+ ## Import the CSS
58
+
59
+ Import our base CSS file in your main entry file:
60
+
61
+ ```javascript
62
+ import '@robuust-digital/vue-components/css';
63
+ ```
64
+
65
+ *This CSS file includes essential base styles and transitions required by the components. Make sure to import it before using any components.*
66
+
57
67
  ## For Nuxt 3 Projects
58
68
 
59
69
  **Add the module to your `nuxt.config.ts` or `nuxt.config.js`:**
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .rvc-pointer-events-none{pointer-events:none}.rvc-pointer-events-auto{pointer-events:auto}.rvc-fixed{position:fixed}.rvc-absolute{position:absolute}.rvc-relative{position:relative}.rvc-sticky{position:sticky}.rvc-inset-0{top:0;right:0;bottom:0;left:0}.rvc-inset-y-0{top:0;bottom:0}.rvc-left-0{left:0}.rvc-right-0{right:0}.rvc-top-0{top:0}.rvc-z-10{z-index:10}.rvc-ml-3{margin-left:.75rem}.rvc-flex{display:flex}.rvc-size-full{width:100%;height:100%}.rvc-h-7{height:1.75rem}.rvc-h-full{height:100%}.rvc-min-h-0{min-height:0px}.rvc-w-full{width:100%}.rvc-w-screen{width:100vw}.rvc-max-w-full{max-width:100%}.rvc-max-w-xl{max-width:36rem}.rvc-flex-1{flex:1 1 0%}.rvc-shrink-0{flex-shrink:0}.rvc-translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rvc-translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rvc-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rvc-flex-col{flex-direction:column}.rvc-flex-col-reverse{flex-direction:column-reverse}.rvc-items-center{align-items:center}.rvc-justify-between{justify-content:space-between}.rvc-overflow-hidden{overflow:hidden}.rvc-overflow-y-scroll{overflow-y:scroll}.rvc-pl-10{padding-left:2.5rem}.rvc-font-black{font-weight:900}.rvc-opacity-0{opacity:0}.rvc-opacity-100{opacity:1}.rvc-shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.rvc-transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.rvc-transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.rvc-duration-500{transition-duration:.5s}.rvc-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (min-width: 640px){.sm\:rvc-duration-700{transition-duration:.7s}}
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Badge component
3
+ *
4
+ * @param {Object} theme - The global theme object
5
+ */
6
+ export default (theme) => {
7
+ const customColors = theme('components.badge.custom') || {};
8
+ const customColorStyles = Object.keys(customColors).reduce((acc, colorName) => {
9
+ acc[`&.badge-custom-${colorName}`] = {
10
+ ...customColors[colorName],
11
+ };
12
+ return acc;
13
+ }, {});
14
+
15
+ return {
16
+ '.badge': {
17
+ display: 'inline-flex',
18
+ alignItems: 'center',
19
+ justifyContent: 'center',
20
+ textAlign: 'center',
21
+ position: 'relative',
22
+ width: 'fit-content',
23
+ paddingTop: theme('padding[0.5]'),
24
+ paddingBottom: theme('padding[0.5]'),
25
+ paddingLeft: theme('padding[2.5]'),
26
+ paddingRight: theme('padding[2.5]'),
27
+ fontWeight: theme('fontWeight.semibold'),
28
+ borderRadius: theme('borderRadius.full'),
29
+ borderWidth: theme('borderWidth.DEFAULT'),
30
+ borderStyle: 'solid',
31
+ fontSize: theme('fontSize.sm.0'),
32
+ lineHeight: theme('lineHeight.5'),
33
+ gap: theme('gap.1'),
34
+ whiteSpace: 'nowrap',
35
+ textDecoration: 'none',
36
+ ...theme('components.badge'),
37
+
38
+ '&[type=button], &:where(a.badge)': {
39
+ transitionProperty: theme('transitionProperty.colors'),
40
+ transitionDuration: theme('transitionDuration.300'),
41
+ transitionTimingFunction: theme('transitionTimingFunction.DEFAULT'),
42
+ },
43
+
44
+ // Color variants
45
+ '&.badge-primary': {
46
+ backgroundColor: theme('colors.lime.300'),
47
+ borderColor: theme('colors.lime.600'),
48
+ color: theme('colors.lime.900'),
49
+ ...theme('components.badge.primary'),
50
+
51
+ '&[type=button]:hover, &:where(a.badge):hover': {
52
+ backgroundColor: theme('colors.lime.200'),
53
+ ...theme('components.badge.primary.hover'),
54
+ },
55
+ },
56
+ '&.badge-primary-soft': {
57
+ backgroundColor: theme('colors.lime.100'),
58
+ borderColor: theme('colors.lime.300'),
59
+ color: theme('colors.lime.500'),
60
+ ...theme('components.badge.primary-soft'),
61
+
62
+ '&[type=button]:hover, &:where(a.badge):hover': {
63
+ backgroundColor: theme('colors.lime.200'),
64
+ ...theme('components.badge.primary-soft.hover'),
65
+ },
66
+ },
67
+ '&.badge-secondary': {
68
+ backgroundColor: theme('colors.indigo.300'),
69
+ borderColor: theme('colors.indigo.600'),
70
+ color: theme('colors.indigo.900'),
71
+ ...theme('components.badge.secondary'),
72
+
73
+ '&[type=button]:hover, &:where(a.badge):hover': {
74
+ backgroundColor: theme('colors.indigo.200'),
75
+ ...theme('components.badge.secondary.hover'),
76
+ },
77
+ },
78
+ '&.badge-secondary-soft': {
79
+ backgroundColor: theme('colors.indigo.100'),
80
+ borderColor: theme('colors.indigo.300'),
81
+ color: theme('colors.indigo.500'),
82
+ ...theme('components.badge.secondary-soft'),
83
+
84
+ '&[type=button]:hover, &:where(a.badge):hover': {
85
+ backgroundColor: theme('colors.indigo.200'),
86
+ ...theme('components.badge.secondary-hover.hover'),
87
+ },
88
+ },
89
+ '&.badge-tertiary': {
90
+ backgroundColor: theme('colors.orange.300'),
91
+ borderColor: theme('colors.orange.600'),
92
+ color: theme('colors.orange.900'),
93
+ ...theme('components.badge.tertiary'),
94
+
95
+ '&[type=button]:hover, &:where(a.badge):hover': {
96
+ backgroundColor: theme('colors.orange.200'),
97
+ ...theme('components.badge.tertiary.hover'),
98
+ },
99
+ },
100
+ '&.badge-tertiary-soft': {
101
+ backgroundColor: theme('colors.orange.100'),
102
+ borderColor: theme('colors.orange.300'),
103
+ color: theme('colors.orange.500'),
104
+ ...theme('components.badge.tertiary-soft'),
105
+
106
+ '&[type=button]:hover, &:where(a.badge):hover': {
107
+ backgroundColor: theme('colors.orange.200'),
108
+ ...theme('components.badge.tertiary-soft.hover'),
109
+ },
110
+ },
111
+ '&.badge-danger': {
112
+ backgroundColor: theme('colors.red.300'),
113
+ borderColor: theme('colors.red.600'),
114
+ color: theme('colors.red.900'),
115
+ ...theme('components.badge.danger'),
116
+
117
+ '&[type=button]:hover, &:where(a.badge):hover': {
118
+ backgroundColor: theme('colors.red.200'),
119
+ ...theme('components.badge.danger.hover'),
120
+ },
121
+ },
122
+ '&.badge-danger-soft': {
123
+ backgroundColor: theme('colors.red.100'),
124
+ borderColor: theme('colors.red.300'),
125
+ color: theme('colors.red.500'),
126
+ ...theme('components.badge.danger-soft'),
127
+
128
+ '&[type=button]:hover, &:where(a.badge):hover': {
129
+ backgroundColor: theme('colors.red.200'),
130
+ ...theme('components.badge.danger-soft.hover'),
131
+ },
132
+ },
133
+ '&.badge-warning': {
134
+ backgroundColor: theme('colors.yellow.300'),
135
+ borderColor: theme('colors.yellow.600'),
136
+ color: theme('colors.yellow.900'),
137
+ ...theme('components.badge.warning'),
138
+
139
+ '&[type=button]:hover, &:where(a.badge):hover': {
140
+ backgroundColor: theme('colors.yellow.200'),
141
+ ...theme('components.badge.warning.hover'),
142
+ },
143
+ },
144
+ '&.badge-warning-soft': {
145
+ backgroundColor: theme('colors.yellow.100'),
146
+ borderColor: theme('colors.yellow.300'),
147
+ color: theme('colors.yellow.500'),
148
+ ...theme('components.badge.warning-soft'),
149
+
150
+ '&[type=button]:hover, &:where(a.badge):hover': {
151
+ backgroundColor: theme('colors.yellow.200'),
152
+ ...theme('components.badge.warning-soft.hover'),
153
+ },
154
+ },
155
+ '&.badge-success': {
156
+ backgroundColor: theme('colors.green.300'),
157
+ borderColor: theme('colors.green.600'),
158
+ color: theme('colors.green.900'),
159
+ ...theme('components.badge.success'),
160
+
161
+ '&[type=button]:hover, &:where(a.badge):hover': {
162
+ backgroundColor: theme('colors.green.200'),
163
+ ...theme('components.badge.success.hover'),
164
+ },
165
+ },
166
+ '&.badge-success-soft': {
167
+ backgroundColor: theme('colors.green.100'),
168
+ borderColor: theme('colors.green.300'),
169
+ color: theme('colors.green.500'),
170
+ ...theme('components.badge.success-soft'),
171
+
172
+ '&[type=button]:hover, &:where(a.badge):hover': {
173
+ backgroundColor: theme('colors.green.200'),
174
+ ...theme('components.badge.success-soft.hover'),
175
+ },
176
+ },
177
+ '&.badge-light': {
178
+ backgroundColor: theme('colors.stone.100'),
179
+ borderColor: theme('colors.stone.500'),
180
+ color: theme('colors.stone.700'),
181
+ ...theme('components.badge.light'),
182
+
183
+ '&[type=button]:hover, &:where(a.badge):hover': {
184
+ backgroundColor: theme('colors.stone.200'),
185
+ ...theme('components.badge.light.hover'),
186
+ },
187
+ },
188
+ '&.badge-dark': {
189
+ backgroundColor: theme('colors.stone.800'),
190
+ borderColor: theme('colors.stone.500'),
191
+ color: theme('colors.stone.100'),
192
+ ...theme('components.badge.dark'),
193
+
194
+ '&[type=button]:hover, &:where(a.badge):hover': {
195
+ backgroundColor: theme('colors.stone.700'),
196
+ ...theme('components.badge.dark.hover'),
197
+ },
198
+ },
199
+ '&.badge-clear': {
200
+ backgroundColor: theme('colors.transparent'),
201
+ color: theme('colors.stone.800'),
202
+ borderColor: theme('colors.transparent'),
203
+ ...theme('components.badge.clear'),
204
+
205
+ '&[type=button]:hover, &:where(a.badge):hover': {
206
+ color: theme('colors.stone.700'),
207
+ ...theme('components.badge.clear.hover'),
208
+ },
209
+ },
210
+ ...customColorStyles,
211
+
212
+ // Size variants
213
+ '&.badge-lg': {
214
+ paddingTop: theme('padding[1.5]'),
215
+ paddingRight: theme('padding.4'),
216
+ paddingBottom: theme('padding[1.5]'),
217
+ paddingLeft: theme('padding.4'),
218
+ fontSize: theme('fontSize.base.0'),
219
+ gap: theme('gap.2'),
220
+ ...theme('components.badge.lg'),
221
+ },
222
+ },
223
+ };
224
+ };
@@ -25,7 +25,17 @@ export default (theme) => {
25
25
 
26
26
  return {
27
27
  '.button': {
28
- '@apply inline-flex items-center justify-center text-center h-fit border border-transparent relative': {},
28
+ appearance: 'none',
29
+ cursor: theme('cursor.pointer'),
30
+ display: 'inline-flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ textAlign: 'center',
34
+ height: theme('height.fit'),
35
+ borderWidth: theme('borderWidth.DEFAULT'),
36
+ borderStyle: 'solid',
37
+ borderColor: theme('colors.transparent'),
38
+ position: 'relative',
29
39
  paddingTop: theme('padding.2'),
30
40
  paddingRight: theme('padding.4'),
31
41
  paddingBottom: theme('padding.2'),
@@ -42,28 +52,28 @@ export default (theme) => {
42
52
 
43
53
  // Disabled state
44
54
  '&:disabled': {
45
- '@apply pointer-events-none': {},
55
+ pointerEvents: 'none',
46
56
  opacity: theme('opacity.50'),
47
57
  ...theme('components.button.disabled'),
48
58
  },
49
59
 
50
60
  // Icon styling
51
61
  '.button-icon': {
52
- '@apply block': {},
62
+ display: 'block',
53
63
  width: theme('width.5'),
54
64
  height: theme('height.5'),
55
65
  flexShrink: theme('flexShrink.0'),
56
66
  ...theme('components.button.icon'),
57
67
 
58
68
  '&.button-icon-loading': {
59
- '@apply animate-spin': {},
69
+ animation: theme('animation.spin'),
60
70
  ...theme('components.button.icon.loading'),
61
71
  },
62
72
  },
63
73
 
64
74
  // Reverse icon
65
75
  '&.button-reverse': {
66
- '@apply flex-row-reverse': {},
76
+ flexDirection: 'row-reverse',
67
77
  },
68
78
 
69
79
  // Color variants
@@ -335,7 +345,9 @@ export default (theme) => {
335
345
  },
336
346
  },
337
347
  '&.button-clear': {
338
- '@apply bg-transparent px-0': {},
348
+ backgroundColor: theme('colors.transparent'),
349
+ paddingLeft: theme('padding.0'),
350
+ paddingRight: theme('padding.0'),
339
351
  color: theme('colors.stone.600'),
340
352
  ...theme('components.button.clear'),
341
353
 
@@ -0,0 +1,95 @@
1
+ import { withAlphaValue } from 'tailwindcss/lib/util/withAlphaVariable';
2
+
3
+ /**
4
+ * Drawer component
5
+ *
6
+ * @param {Object} theme - The global theme object
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
+ },
61
+
62
+ ...theme('components.drawer.close'),
63
+ },
64
+
65
+ // Content
66
+ '.drawer-content': {
67
+ padding: theme('padding.4'),
68
+ backgroundColor: theme('colors.white'),
69
+
70
+ [`@media (min-width: ${theme('screens.sm')})`]: {
71
+ padding: theme('padding.6'),
72
+ },
73
+
74
+ ...theme('components.drawer.content'),
75
+ },
76
+
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',
86
+
87
+ [`@media (min-width: ${theme('screens.sm')})`]: {
88
+ padding: theme('padding.6'),
89
+ },
90
+
91
+ ...theme('components.drawer.footer'),
92
+ },
93
+ },
94
+ };
95
+ };
@@ -1,7 +1,9 @@
1
1
  import plugin from 'tailwindcss/plugin';
2
2
 
3
3
  // Components
4
+ import badge from './components/badge.js';
4
5
  import button from './components/button.js';
6
+ import drawer from './components/drawer.js';
5
7
 
6
8
  /**
7
9
  * Tailwind Theme plugin
@@ -14,7 +16,9 @@ import button from './components/button.js';
14
16
  * @returns {void}
15
17
  */
16
18
  export default plugin.withOptions(() => ({ addComponents, theme }) => {
17
- addComponents({
18
- ...button(theme),
19
- });
19
+ addComponents([
20
+ badge(theme),
21
+ button(theme),
22
+ drawer(theme),
23
+ ], { respectPrefix: false });
20
24
  });