@robuust-digital/vue-components 1.0.1-rc.3 → 1.1.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.
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-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.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-5{width:1.25rem;height:1.25rem}.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-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;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,188 @@
1
+ /**
2
+ * Alert component
3
+ *
4
+ * @param {Object} theme - The global theme object
5
+ */
6
+ export default (theme) => ({
7
+ '.alert': {
8
+ display: 'flex',
9
+ position: 'relative',
10
+ width: '100%',
11
+ overflow: 'hidden',
12
+ paddingTop: theme('padding.6'),
13
+ paddingBottom: theme('padding.6'),
14
+ paddingLeft: theme('padding.6'),
15
+ paddingRight: theme('padding.6'),
16
+ borderRadius: theme('borderRadius.md'),
17
+ borderStyle: 'solid',
18
+ fontSize: theme('fontSize.base.0'),
19
+ backgroundColor: theme('colors.blue.50'),
20
+ color: theme('colors.blue.700'),
21
+ ...theme('components.alert'),
22
+
23
+ a: {
24
+ textDecoration: 'underline',
25
+ color: 'inherit',
26
+ ...theme('components.alert.link'),
27
+ },
28
+
29
+ ul: {
30
+ listStyleType: 'disc',
31
+ listStylePosition: 'inside',
32
+ marginTop: '0',
33
+ marginBottom: '0',
34
+ marginLeft: theme('margin.2'),
35
+ paddingLeft: '0',
36
+ ...theme('components.alert.list'),
37
+
38
+ li: {
39
+ marginTop: '0',
40
+ ...theme('components.alert.listitem'),
41
+ },
42
+ },
43
+
44
+ ol: {
45
+ listStyleType: 'decimal',
46
+ listStylePosition: 'inside',
47
+ marginTop: '0',
48
+ marginBottom: '0',
49
+ marginLeft: theme('margin.2'),
50
+ paddingLeft: '0',
51
+ ...theme('components.alert.orderedlist'),
52
+
53
+ li: {
54
+ marginTop: '0',
55
+ ...theme('components.alert.orderedlistitem'),
56
+ },
57
+ },
58
+
59
+ '.alert-close': {
60
+ display: 'inline-flex',
61
+ justifyContent: 'center',
62
+ alignItems: 'center',
63
+ position: 'absolute',
64
+ top: '0',
65
+ right: '0',
66
+ padding: theme('padding[1.5]'),
67
+ borderBottomLeftRadius: theme('borderRadius.md'),
68
+ backgroundColor: theme('colors.blue.100'),
69
+ color: theme('colors.blue.400'),
70
+ transitionProperty: theme('transitionProperty.colors'),
71
+ transitionDuration: theme('transitionDuration.300'),
72
+ transitionTimingFunction: theme('transitionTimingFunction.DEFAULT'),
73
+ ...theme('components.alert.close'),
74
+
75
+ '&:hover': {
76
+ backgroundColor: theme('colors.blue.200'),
77
+ color: theme('colors.blue.800'),
78
+ ...theme('components.alert.close.hover'),
79
+ },
80
+ },
81
+
82
+ '.alert-icon': {
83
+ display: 'block',
84
+ width: theme('width.6'),
85
+ height: theme('height.6'),
86
+ marginRight: theme('margin.1'),
87
+ flexShrink: theme('flexShrink.0'),
88
+ color: theme('colors.blue.400'),
89
+ ...theme('components.alert.icon'),
90
+ },
91
+
92
+ '.alert-title': {
93
+ display: 'block',
94
+ marginBottom: theme('margin.2'),
95
+ fontWeight: theme('fontWeight.medium'),
96
+ color: theme('colors.blue.800'),
97
+ ...theme('components.alert.title'),
98
+
99
+ '&:last-child': {
100
+ marginBottom: '0',
101
+ ...theme('components.alert.title.last'),
102
+ },
103
+ },
104
+
105
+ // Color variants
106
+ '&.alert-warning': {
107
+ backgroundColor: theme('colors.yellow.50'),
108
+ color: theme('colors.yellow.700'),
109
+ ...theme('components.alert.warning'),
110
+
111
+ '.alert-close': {
112
+ backgroundColor: theme('colors.yellow.100'),
113
+ color: theme('colors.yellow.400'),
114
+ ...theme('components.alert.warning.close'),
115
+
116
+ '&:hover': {
117
+ backgroundColor: theme('colors.yellow.200'),
118
+ color: theme('colors.yellow.800'),
119
+ ...theme('components.alert.warning.close.hover'),
120
+ },
121
+ },
122
+
123
+ '.alert-icon': {
124
+ color: theme('colors.yellow.400'),
125
+ ...theme('components.alert.warning.icon'),
126
+ },
127
+
128
+ '.alert-title': {
129
+ color: theme('colors.yellow.800'),
130
+ ...theme('components.alert.warning.title'),
131
+ },
132
+ },
133
+ '&.alert-success': {
134
+ backgroundColor: theme('colors.green.50'),
135
+ color: theme('colors.green.700'),
136
+ ...theme('components.alert.success'),
137
+
138
+ '.alert-close': {
139
+ backgroundColor: theme('colors.green.100'),
140
+ color: theme('colors.green.400'),
141
+ ...theme('components.alert.success.close'),
142
+
143
+ '&:hover': {
144
+ backgroundColor: theme('colors.green.200'),
145
+ color: theme('colors.green.800'),
146
+ ...theme('components.alert.success.close.hover'),
147
+ },
148
+ },
149
+
150
+ '.alert-icon': {
151
+ color: theme('colors.green.400'),
152
+ ...theme('components.alert.success.icon'),
153
+ },
154
+
155
+ '.alert-title': {
156
+ color: theme('colors.green.800'),
157
+ ...theme('components.alert.success.title'),
158
+ },
159
+ },
160
+ '&.alert-danger': {
161
+ backgroundColor: theme('colors.red.50'),
162
+ color: theme('colors.red.700'),
163
+ ...theme('components.alert.danger'),
164
+
165
+ '.alert-close': {
166
+ backgroundColor: theme('colors.red.100'),
167
+ color: theme('colors.red.400'),
168
+ ...theme('components.alert.danger.close'),
169
+
170
+ '&:hover': {
171
+ backgroundColor: theme('colors.red.200'),
172
+ color: theme('colors.red.800'),
173
+ ...theme('components.alert.danger.close.hover'),
174
+ },
175
+ },
176
+
177
+ '.alert-icon': {
178
+ color: theme('colors.red.400'),
179
+ ...theme('components.alert.danger.icon'),
180
+ },
181
+
182
+ '.alert-title': {
183
+ color: theme('colors.red.800'),
184
+ ...theme('components.alert.danger.title'),
185
+ },
186
+ },
187
+ },
188
+ });
@@ -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,35 @@ 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
 
74
+ // Icon-only styling
75
+ '&.button-icon-only': {
76
+ padding: theme('padding.2'),
77
+ aspectRatio: '1 / 1',
78
+ ...theme('components.button.iconOnly'),
79
+ },
80
+
64
81
  // Reverse icon
65
82
  '&.button-reverse': {
66
- '@apply flex-row-reverse': {},
83
+ flexDirection: 'row-reverse',
67
84
  },
68
85
 
69
86
  // Color variants
@@ -335,7 +352,9 @@ export default (theme) => {
335
352
  },
336
353
  },
337
354
  '&.button-clear': {
338
- '@apply bg-transparent px-0': {},
355
+ backgroundColor: theme('colors.transparent'),
356
+ paddingLeft: theme('padding.0'),
357
+ paddingRight: theme('padding.0'),
339
358
  color: theme('colors.stone.600'),
340
359
  ...theme('components.button.clear'),
341
360
 
@@ -355,23 +374,6 @@ export default (theme) => {
355
374
  ...customColorStyles,
356
375
 
357
376
  // Size variants
358
- '&.button-xs': {
359
- paddingTop: theme('padding.1'),
360
- paddingRight: theme('padding.2'),
361
- paddingBottom: theme('padding.1'),
362
- paddingLeft: theme('padding.2'),
363
- gap: theme('gap[1.5]'),
364
- borderRadius: theme('borderRadius.md'),
365
- fontWeight: theme('fontWeight.medium'),
366
- fontSize: theme('fontSize.xs.0'),
367
- ...theme('components.button.xs'),
368
-
369
- '.button-icon': {
370
- width: theme('width.3'),
371
- height: theme('height.3'),
372
- ...theme('components.button.xs.icon'),
373
- },
374
- },
375
377
  '&.button-sm': {
376
378
  paddingTop: theme('padding[1.5]'),
377
379
  paddingRight: theme('padding.3'),
@@ -388,22 +390,10 @@ export default (theme) => {
388
390
  height: theme('height.4'),
389
391
  ...theme('components.button.sm.icon'),
390
392
  },
391
- },
392
- '&.button-lg': {
393
- paddingTop: theme('padding[2.5]'),
394
- paddingRight: theme('padding.6'),
395
- paddingBottom: theme('padding[2.5]'),
396
- paddingLeft: theme('padding.6'),
397
- gap: theme('gap.4'),
398
- borderRadius: theme('borderRadius.2xl'),
399
- fontWeight: theme('fontWeight.medium'),
400
- fontSize: theme('fontSize.lg.0'),
401
- ...theme('components.button.lg'),
402
393
 
403
- '.button-icon': {
404
- width: theme('width.6'),
405
- height: theme('height.6'),
406
- ...theme('components.button.lg.icon'),
394
+ '&.button-icon-only': {
395
+ padding: theme('padding[1.5]'),
396
+ ...theme('components.button.sm.iconOnly'),
407
397
  },
408
398
  },
409
399
  },
@@ -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,10 @@
1
1
  import plugin from 'tailwindcss/plugin';
2
2
 
3
3
  // Components
4
+ import alert from './components/alert.js';
5
+ import badge from './components/badge.js';
4
6
  import button from './components/button.js';
7
+ import drawer from './components/drawer.js';
5
8
 
6
9
  /**
7
10
  * Tailwind Theme plugin
@@ -14,7 +17,10 @@ import button from './components/button.js';
14
17
  * @returns {void}
15
18
  */
16
19
  export default plugin.withOptions(() => ({ addComponents, theme }) => {
17
- addComponents({
18
- ...button(theme),
19
- });
20
+ addComponents([
21
+ alert(theme),
22
+ badge(theme),
23
+ button(theme),
24
+ drawer(theme),
25
+ ], { respectPrefix: false });
20
26
  });