tailwindcss-react-aria-components 1.2.0 → 2.0.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/package.json +6 -5
- package/src/index.js +14 -29
- package/src/index.test.js +0 -554
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-react-aria-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A Tailwind plugin that adds variants for data attributes in React Aria Components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
"url": "https://github.com/adobe/react-spectrum"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"tailwindcss": "
|
|
19
|
+
"tailwindcss": "^4.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"postcss": "^
|
|
23
|
-
"
|
|
22
|
+
"@tailwindcss/postcss": "^4.0.0",
|
|
23
|
+
"postcss": "^8.0.0",
|
|
24
|
+
"tailwindcss": "^4.0.0"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|
|
27
28
|
},
|
|
28
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
|
|
29
30
|
}
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const attributes = {
|
|
|
10
10
|
'allows-sorting',
|
|
11
11
|
'allows-dragging',
|
|
12
12
|
'has-submenu',
|
|
13
|
+
'has-child-items',
|
|
13
14
|
|
|
14
15
|
// States
|
|
15
16
|
'open',
|
|
@@ -36,6 +37,7 @@ const attributes = {
|
|
|
36
37
|
['focus', 'focused'],
|
|
37
38
|
'focus-visible',
|
|
38
39
|
'pressed',
|
|
40
|
+
'active',
|
|
39
41
|
'selected',
|
|
40
42
|
'selection-start',
|
|
41
43
|
'selection-end',
|
|
@@ -68,6 +70,7 @@ const nativeVariantSelectors = new Map([
|
|
|
68
70
|
...nativeVariants.map((variant) => [variant, `:${variant}`]),
|
|
69
71
|
['hovered', ':hover'],
|
|
70
72
|
['focused', ':focus'],
|
|
73
|
+
['active', ':active'],
|
|
71
74
|
['readonly', ':read-only'],
|
|
72
75
|
['open', '[open]'],
|
|
73
76
|
['expanded', '[expanded]']
|
|
@@ -79,14 +82,14 @@ const nativeMergeSelectors = new Map([
|
|
|
79
82
|
]);
|
|
80
83
|
|
|
81
84
|
// If no prefix is specified, we want to avoid overriding native variants on non-RAC components, so we only target elements with the data-rac attribute for those variants.
|
|
82
|
-
let getSelector = (prefix, attributeName, attributeValue
|
|
85
|
+
let getSelector = (prefix, attributeName, attributeValue) => {
|
|
83
86
|
let baseSelector = attributeValue ? `[data-${attributeName}="${attributeValue}"]` : `[data-${attributeName}]`;
|
|
84
87
|
let nativeSelector = nativeVariantSelectors.get(attributeName);
|
|
85
88
|
if (prefix === '' && nativeSelector) {
|
|
86
89
|
let wrappedNativeSelector = `&:where(:not([data-rac]))${nativeSelector}`;
|
|
87
90
|
let nativeSelectorGenerator = wrappedNativeSelector;
|
|
88
|
-
if (nativeSelector === ':hover'
|
|
89
|
-
nativeSelectorGenerator = wrap => `@media (hover: hover)
|
|
91
|
+
if (nativeSelector === ':hover') {
|
|
92
|
+
nativeSelectorGenerator = wrap => `@media (hover: hover) { ${wrap(wrappedNativeSelector)} }`;
|
|
90
93
|
}
|
|
91
94
|
return [`&:where([data-rac])${baseSelector}`, nativeSelectorGenerator];
|
|
92
95
|
} else if (prefix === '' && nativeMergeSelectors.has(attributeName)) {
|
|
@@ -112,48 +115,30 @@ let wrapSelector = (selector, wrap) => {
|
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
117
|
|
|
115
|
-
let addVariants = (variantName, selectors, addVariant
|
|
118
|
+
let addVariants = (variantName, selectors, addVariant) => {
|
|
116
119
|
addVariant(variantName, mapSelector(selectors, selector => wrapSelector(selector, s => s)));
|
|
117
|
-
matchVariant(
|
|
118
|
-
'group',
|
|
119
|
-
(_, {modifier}) =>
|
|
120
|
-
modifier
|
|
121
|
-
? mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.group\\/${modifier})${s.slice(1)} &`))
|
|
122
|
-
: mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.group)${s.slice(1)} &`)),
|
|
123
|
-
{values: {[variantName]: variantName}}
|
|
124
|
-
);
|
|
125
|
-
matchVariant(
|
|
126
|
-
'peer',
|
|
127
|
-
(_, {modifier}) =>
|
|
128
|
-
modifier
|
|
129
|
-
? mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.peer\\/${modifier})${s.slice(1)} ~ &`))
|
|
130
|
-
: mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.peer)${s.slice(1)} ~ &`)),
|
|
131
|
-
{values: {[variantName]: variantName}}
|
|
132
|
-
);
|
|
133
120
|
};
|
|
134
121
|
|
|
135
|
-
module.exports = plugin.withOptions((options) => (({addVariant
|
|
122
|
+
module.exports = plugin.withOptions((options) => (({addVariant}) => {
|
|
136
123
|
let prefix = options?.prefix ? `${options.prefix}-` : '';
|
|
137
|
-
let future = config().future;
|
|
138
|
-
let hoverOnlyWhenSupported = future === 'all' || future?.hoverOnlyWhenSupported;
|
|
139
124
|
|
|
140
125
|
// Enum attributes go first because currently they are all non-interactive states.
|
|
141
126
|
Object.keys(attributes.enum).forEach((attributeName) => {
|
|
142
127
|
attributes.enum[attributeName].forEach(
|
|
143
|
-
(attributeValue) => {
|
|
128
|
+
(attributeValue, i) => {
|
|
144
129
|
let name = shortNames[attributeName] || attributeName;
|
|
145
130
|
let variantName = `${prefix}${name}-${attributeValue}`;
|
|
146
|
-
let selectors = getSelector(prefix, attributeName, attributeValue
|
|
147
|
-
addVariants(variantName, selectors, addVariant,
|
|
131
|
+
let selectors = getSelector(prefix, attributeName, attributeValue);
|
|
132
|
+
addVariants(variantName, selectors, addVariant, i);
|
|
148
133
|
}
|
|
149
134
|
);
|
|
150
135
|
});
|
|
151
136
|
|
|
152
|
-
attributes.boolean.forEach((attribute) => {
|
|
137
|
+
attributes.boolean.forEach((attribute, i) => {
|
|
153
138
|
let variantName = Array.isArray(attribute) ? attribute[0] : attribute;
|
|
154
139
|
variantName = `${prefix}${variantName}`;
|
|
155
140
|
let attributeName = Array.isArray(attribute) ? attribute[1] : attribute;
|
|
156
|
-
let selectors = getSelector(prefix, attributeName, null
|
|
157
|
-
addVariants(variantName, selectors, addVariant,
|
|
141
|
+
let selectors = getSelector(prefix, attributeName, null);
|
|
142
|
+
addVariants(variantName, selectors, addVariant, i);
|
|
158
143
|
});
|
|
159
144
|
}));
|
package/src/index.test.js
DELETED
|
@@ -1,554 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const tailwind = require('tailwindcss');
|
|
3
|
-
const postcss = require('postcss');
|
|
4
|
-
|
|
5
|
-
let html = String.raw;
|
|
6
|
-
let css = String.raw;
|
|
7
|
-
|
|
8
|
-
function run({options, content, future = {}}) {
|
|
9
|
-
let {currentTestName} = expect.getState();
|
|
10
|
-
let config = {
|
|
11
|
-
plugins: [require('./index.js')(options)],
|
|
12
|
-
corePlugins: {preflight: false},
|
|
13
|
-
theme: {colors: {red: 'red'}},
|
|
14
|
-
content: [{raw: content}],
|
|
15
|
-
future
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return postcss(tailwind(config)).process(
|
|
19
|
-
['@tailwind base;', '@tailwind components;', '@tailwind utilities'].join('\n'),
|
|
20
|
-
{
|
|
21
|
-
from: `${path.resolve(__filename)}?test=${currentTestName}`
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
test('variants', async () => {
|
|
27
|
-
let content = html`<div data-rac className="hover:bg-red focus:bg-red focus-visible:bg-red focus-within:bg-red pressed:bg-red disabled:bg-red pending:bg-red drop-target:bg-red dragging:bg-red empty:bg-red allows-dragging:bg-red allows-removing:bg-red allows-sorting:bg-red has-submenu:bg-red placeholder-shown:bg-red selected:bg-red indeterminate:bg-red read-only:bg-red required:bg-red entering:bg-red exiting:bg-red open:bg-red expanded:bg-red unavailable:bg-red outside-month:bg-red outside-visible-range:bg-red selection-start:bg-red selection-end:bg-red current:bg-red invalid:bg-red resizing:bg-red placement-left:bg-red placement-right:bg-red placement-top:bg-red placement-bottom:bg-red type-literal:bg-red type-year:bg-red type-month:bg-red type-day:bg-red layout-grid:bg-red layout-stack:bg-red orientation-horizontal:bg-red orientation-vertical:bg-red selection-single:bg-red selection-multiple:bg-red resizable-right:bg-red resizable-left:bg-red resizable-both:bg-red sort-ascending:bg-red sort-descending:bg-red group-pressed:bg-red peer-pressed:bg-red group-hover:bg-red group/custom-name group-hover/custom-name:bg-red peer-pressed/custom-name:bg-red"></div>`;
|
|
28
|
-
return run({content}).then((result) => {
|
|
29
|
-
expect(result.css).toContain(css`
|
|
30
|
-
.placement-left\:bg-red[data-placement="left"] {
|
|
31
|
-
--tw-bg-opacity: 1;
|
|
32
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
33
|
-
}
|
|
34
|
-
.placement-right\:bg-red[data-placement="right"] {
|
|
35
|
-
--tw-bg-opacity: 1;
|
|
36
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
37
|
-
}
|
|
38
|
-
.placement-top\:bg-red[data-placement="top"] {
|
|
39
|
-
--tw-bg-opacity: 1;
|
|
40
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
41
|
-
}
|
|
42
|
-
.placement-bottom\:bg-red[data-placement="bottom"] {
|
|
43
|
-
--tw-bg-opacity: 1;
|
|
44
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
45
|
-
}
|
|
46
|
-
.type-literal\:bg-red[data-type="literal"] {
|
|
47
|
-
--tw-bg-opacity: 1;
|
|
48
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
49
|
-
}
|
|
50
|
-
.type-year\:bg-red[data-type="year"] {
|
|
51
|
-
--tw-bg-opacity: 1;
|
|
52
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
53
|
-
}
|
|
54
|
-
.type-month\:bg-red[data-type="month"] {
|
|
55
|
-
--tw-bg-opacity: 1;
|
|
56
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
57
|
-
}
|
|
58
|
-
.type-day\:bg-red[data-type="day"] {
|
|
59
|
-
--tw-bg-opacity: 1;
|
|
60
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
61
|
-
}
|
|
62
|
-
.layout-grid\:bg-red[data-layout="grid"] {
|
|
63
|
-
--tw-bg-opacity: 1;
|
|
64
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
65
|
-
}
|
|
66
|
-
.layout-stack\:bg-red[data-layout="stack"] {
|
|
67
|
-
--tw-bg-opacity: 1;
|
|
68
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
69
|
-
}
|
|
70
|
-
.orientation-horizontal\:bg-red[data-orientation="horizontal"] {
|
|
71
|
-
--tw-bg-opacity: 1;
|
|
72
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
73
|
-
}
|
|
74
|
-
.orientation-vertical\:bg-red[data-orientation="vertical"] {
|
|
75
|
-
--tw-bg-opacity: 1;
|
|
76
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
77
|
-
}
|
|
78
|
-
.selection-single\:bg-red[data-selection-mode="single"] {
|
|
79
|
-
--tw-bg-opacity: 1;
|
|
80
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
81
|
-
}
|
|
82
|
-
.selection-multiple\:bg-red[data-selection-mode="multiple"] {
|
|
83
|
-
--tw-bg-opacity: 1;
|
|
84
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
85
|
-
}
|
|
86
|
-
.resizable-right\:bg-red[data-resizable-direction="right"] {
|
|
87
|
-
--tw-bg-opacity: 1;
|
|
88
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
89
|
-
}
|
|
90
|
-
.resizable-left\:bg-red[data-resizable-direction="left"] {
|
|
91
|
-
--tw-bg-opacity: 1;
|
|
92
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
93
|
-
}
|
|
94
|
-
.resizable-both\:bg-red[data-resizable-direction="both"] {
|
|
95
|
-
--tw-bg-opacity: 1;
|
|
96
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
97
|
-
}
|
|
98
|
-
.sort-ascending\:bg-red[data-sort-direction="ascending"] {
|
|
99
|
-
--tw-bg-opacity: 1;
|
|
100
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
101
|
-
}
|
|
102
|
-
.sort-descending\:bg-red[data-sort-direction="descending"] {
|
|
103
|
-
--tw-bg-opacity: 1;
|
|
104
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
105
|
-
}
|
|
106
|
-
.allows-removing\:bg-red[data-allows-removing] {
|
|
107
|
-
--tw-bg-opacity: 1;
|
|
108
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
109
|
-
}
|
|
110
|
-
.allows-sorting\:bg-red[data-allows-sorting] {
|
|
111
|
-
--tw-bg-opacity: 1;
|
|
112
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
113
|
-
}
|
|
114
|
-
.allows-dragging\:bg-red[data-allows-dragging] {
|
|
115
|
-
--tw-bg-opacity: 1;
|
|
116
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
117
|
-
}
|
|
118
|
-
.has-submenu\:bg-red[data-has-submenu] {
|
|
119
|
-
--tw-bg-opacity: 1;
|
|
120
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
121
|
-
}
|
|
122
|
-
.open\:bg-red:where([data-rac])[data-open] {
|
|
123
|
-
--tw-bg-opacity: 1;
|
|
124
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
125
|
-
}
|
|
126
|
-
.open\:bg-red:where(:not([data-rac]))[open] {
|
|
127
|
-
--tw-bg-opacity: 1;
|
|
128
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
129
|
-
}
|
|
130
|
-
.expanded\:bg-red:where([data-rac])[data-expanded] {
|
|
131
|
-
--tw-bg-opacity: 1;
|
|
132
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
133
|
-
}
|
|
134
|
-
.expanded\:bg-red:where(:not([data-rac]))[expanded] {
|
|
135
|
-
--tw-bg-opacity: 1;
|
|
136
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
137
|
-
}
|
|
138
|
-
.entering\:bg-red[data-entering] {
|
|
139
|
-
--tw-bg-opacity: 1;
|
|
140
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
141
|
-
}
|
|
142
|
-
.exiting\:bg-red[data-exiting] {
|
|
143
|
-
--tw-bg-opacity: 1;
|
|
144
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
145
|
-
}
|
|
146
|
-
.indeterminate\:bg-red:where([data-rac])[data-indeterminate] {
|
|
147
|
-
--tw-bg-opacity: 1;
|
|
148
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
149
|
-
}
|
|
150
|
-
.indeterminate\:bg-red:where(:not([data-rac])):indeterminate {
|
|
151
|
-
--tw-bg-opacity: 1;
|
|
152
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
153
|
-
}
|
|
154
|
-
.placeholder-shown\:bg-red[data-placeholder] {
|
|
155
|
-
--tw-bg-opacity: 1;
|
|
156
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
157
|
-
}
|
|
158
|
-
.placeholder-shown\:bg-red:placeholder-shown {
|
|
159
|
-
--tw-bg-opacity: 1;
|
|
160
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
161
|
-
}
|
|
162
|
-
.current\:bg-red[data-current] {
|
|
163
|
-
--tw-bg-opacity: 1;
|
|
164
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
165
|
-
}
|
|
166
|
-
.required\:bg-red:where([data-rac])[data-required] {
|
|
167
|
-
--tw-bg-opacity: 1;
|
|
168
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
169
|
-
}
|
|
170
|
-
.required\:bg-red:where(:not([data-rac])):required {
|
|
171
|
-
--tw-bg-opacity: 1;
|
|
172
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
173
|
-
}
|
|
174
|
-
.unavailable\:bg-red[data-unavailable] {
|
|
175
|
-
--tw-bg-opacity: 1;
|
|
176
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
177
|
-
}
|
|
178
|
-
.invalid\:bg-red:where([data-rac])[data-invalid] {
|
|
179
|
-
--tw-bg-opacity: 1;
|
|
180
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
181
|
-
}
|
|
182
|
-
.invalid\:bg-red:where(:not([data-rac])):invalid {
|
|
183
|
-
--tw-bg-opacity: 1;
|
|
184
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
185
|
-
}
|
|
186
|
-
.read-only\:bg-red:where([data-rac])[data-readonly] {
|
|
187
|
-
--tw-bg-opacity: 1;
|
|
188
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
189
|
-
}
|
|
190
|
-
.read-only\:bg-red:where(:not([data-rac])):read-only {
|
|
191
|
-
--tw-bg-opacity: 1;
|
|
192
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
193
|
-
}
|
|
194
|
-
.outside-month\:bg-red[data-outside-month] {
|
|
195
|
-
--tw-bg-opacity: 1;
|
|
196
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
197
|
-
}
|
|
198
|
-
.outside-visible-range\:bg-red[data-outside-visible-range] {
|
|
199
|
-
--tw-bg-opacity: 1;
|
|
200
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
201
|
-
}
|
|
202
|
-
.pending\:bg-red[data-pending] {
|
|
203
|
-
--tw-bg-opacity: 1;
|
|
204
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
205
|
-
}
|
|
206
|
-
.empty\:bg-red:where([data-rac])[data-empty] {
|
|
207
|
-
--tw-bg-opacity: 1;
|
|
208
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
209
|
-
}
|
|
210
|
-
.empty\:bg-red:where(:not([data-rac])):empty {
|
|
211
|
-
--tw-bg-opacity: 1;
|
|
212
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
213
|
-
}
|
|
214
|
-
.focus-within\:bg-red:where([data-rac])[data-focus-within] {
|
|
215
|
-
--tw-bg-opacity: 1;
|
|
216
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
217
|
-
}
|
|
218
|
-
.focus-within\:bg-red:where(:not([data-rac])):focus-within {
|
|
219
|
-
--tw-bg-opacity: 1;
|
|
220
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
221
|
-
}
|
|
222
|
-
.hover\:bg-red:where([data-rac])[data-hovered] {
|
|
223
|
-
--tw-bg-opacity: 1;
|
|
224
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
225
|
-
}
|
|
226
|
-
.hover\:bg-red:where(:not([data-rac])):hover {
|
|
227
|
-
--tw-bg-opacity: 1;
|
|
228
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
229
|
-
}
|
|
230
|
-
.group\/custom-name:where([data-rac])[data-hovered] .group-hover\/custom-name\:bg-red {
|
|
231
|
-
--tw-bg-opacity: 1;
|
|
232
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
233
|
-
}
|
|
234
|
-
.group:where([data-rac])[data-hovered] .group-hover\:bg-red {
|
|
235
|
-
--tw-bg-opacity: 1;
|
|
236
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
237
|
-
}
|
|
238
|
-
.group\/custom-name:where(:not([data-rac])):hover .group-hover\/custom-name\:bg-red {
|
|
239
|
-
--tw-bg-opacity: 1;
|
|
240
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
241
|
-
}
|
|
242
|
-
.group:where(:not([data-rac])):hover .group-hover\:bg-red {
|
|
243
|
-
--tw-bg-opacity: 1;
|
|
244
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
245
|
-
}
|
|
246
|
-
.focus\:bg-red:where([data-rac])[data-focused] {
|
|
247
|
-
--tw-bg-opacity: 1;
|
|
248
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
249
|
-
}
|
|
250
|
-
.focus\:bg-red:where(:not([data-rac])):focus {
|
|
251
|
-
--tw-bg-opacity: 1;
|
|
252
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
253
|
-
}
|
|
254
|
-
.focus-visible\:bg-red:where([data-rac])[data-focus-visible] {
|
|
255
|
-
--tw-bg-opacity: 1;
|
|
256
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
257
|
-
}
|
|
258
|
-
.focus-visible\:bg-red:where(:not([data-rac])):focus-visible {
|
|
259
|
-
--tw-bg-opacity: 1;
|
|
260
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
261
|
-
}
|
|
262
|
-
.pressed\:bg-red[data-pressed] {
|
|
263
|
-
--tw-bg-opacity: 1;
|
|
264
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
265
|
-
}
|
|
266
|
-
.group[data-pressed] .group-pressed\:bg-red {
|
|
267
|
-
--tw-bg-opacity: 1;
|
|
268
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
269
|
-
}
|
|
270
|
-
.peer\/custom-name[data-pressed] ~ .peer-pressed\/custom-name\:bg-red {
|
|
271
|
-
--tw-bg-opacity: 1;
|
|
272
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
273
|
-
}
|
|
274
|
-
.peer[data-pressed] ~ .peer-pressed\:bg-red {
|
|
275
|
-
--tw-bg-opacity: 1;
|
|
276
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
277
|
-
}
|
|
278
|
-
.selected\:bg-red[data-selected] {
|
|
279
|
-
--tw-bg-opacity: 1;
|
|
280
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
281
|
-
}
|
|
282
|
-
.selection-start\:bg-red[data-selection-start] {
|
|
283
|
-
--tw-bg-opacity: 1;
|
|
284
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
285
|
-
}
|
|
286
|
-
.selection-end\:bg-red[data-selection-end] {
|
|
287
|
-
--tw-bg-opacity: 1;
|
|
288
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
289
|
-
}
|
|
290
|
-
.dragging\:bg-red[data-dragging] {
|
|
291
|
-
--tw-bg-opacity: 1;
|
|
292
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
293
|
-
}
|
|
294
|
-
.drop-target\:bg-red[data-drop-target] {
|
|
295
|
-
--tw-bg-opacity: 1;
|
|
296
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
297
|
-
}
|
|
298
|
-
.resizing\:bg-red[data-resizing] {
|
|
299
|
-
--tw-bg-opacity: 1;
|
|
300
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
301
|
-
}
|
|
302
|
-
.disabled\:bg-red:where([data-rac])[data-disabled] {
|
|
303
|
-
--tw-bg-opacity: 1;
|
|
304
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
305
|
-
}
|
|
306
|
-
.disabled\:bg-red:where(:not([data-rac])):disabled {
|
|
307
|
-
--tw-bg-opacity: 1;
|
|
308
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
309
|
-
}`
|
|
310
|
-
);
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
test('variants with prefix', async () => {
|
|
315
|
-
let content = html`<div data-rac className="rac-hover:bg-red rac-focus:bg-red rac-focus-visible:bg-red rac-focus-within:bg-red rac-pressed:bg-red rac-disabled:bg-red rac-pending:bg-red rac-drop-target:bg-red rac-dragging:bg-red rac-empty:bg-red rac-allows-dragging:bg-red rac-allows-removing:bg-red rac-allows-sorting:bg-red rac-has-submenu:bg-red rac-placeholder-shown:bg-red rac-selected:bg-red rac-indeterminate:bg-red rac-read-only:bg-red rac-required:bg-red rac-entering:bg-red rac-exiting:bg-red rac-open:bg-red rac-expanded:bg-red rac-unavailable:bg-red rac-outside-month:bg-red rac-outside-visible-range:bg-red rac-selection-start:bg-red rac-selection-end:bg-red rac-current:bg-red rac-invalid:bg-red rac-resizing:bg-red rac-placement-left:bg-red rac-placement-right:bg-red rac-placement-top:bg-red rac-placement-bottom:bg-red rac-type-literal:bg-red rac-type-year:bg-red rac-type-month:bg-red rac-type-day:bg-red rac-layout-grid:bg-red rac-layout-stack:bg-red rac-orientation-horizontal:bg-red rac-orientation-vertical:bg-red rac-selection-single:bg-red rac-selection-multiple:bg-red rac-resizable-right:bg-red rac-resizable-left:bg-red rac-resizable-both:bg-red rac-sort-ascending:bg-red rac-sort-descending:bg-red group-rac-pressed:bg-red group/custom-name group-rac-hover/custom-name:bg-red peer-rac-pressed:bg-red peer-rac-pressed/custom-name:bg-red"></div>`;
|
|
316
|
-
return run({content, options: {prefix: 'rac'}}).then((result) => {
|
|
317
|
-
expect(result.css).toContain(css`
|
|
318
|
-
.rac-placement-left\:bg-red[data-placement="left"] {
|
|
319
|
-
--tw-bg-opacity: 1;
|
|
320
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
321
|
-
}
|
|
322
|
-
.rac-placement-right\:bg-red[data-placement="right"] {
|
|
323
|
-
--tw-bg-opacity: 1;
|
|
324
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
325
|
-
}
|
|
326
|
-
.rac-placement-top\:bg-red[data-placement="top"] {
|
|
327
|
-
--tw-bg-opacity: 1;
|
|
328
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
329
|
-
}
|
|
330
|
-
.rac-placement-bottom\:bg-red[data-placement="bottom"] {
|
|
331
|
-
--tw-bg-opacity: 1;
|
|
332
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
333
|
-
}
|
|
334
|
-
.rac-type-literal\:bg-red[data-type="literal"] {
|
|
335
|
-
--tw-bg-opacity: 1;
|
|
336
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
337
|
-
}
|
|
338
|
-
.rac-type-year\:bg-red[data-type="year"] {
|
|
339
|
-
--tw-bg-opacity: 1;
|
|
340
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
341
|
-
}
|
|
342
|
-
.rac-type-month\:bg-red[data-type="month"] {
|
|
343
|
-
--tw-bg-opacity: 1;
|
|
344
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
345
|
-
}
|
|
346
|
-
.rac-type-day\:bg-red[data-type="day"] {
|
|
347
|
-
--tw-bg-opacity: 1;
|
|
348
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
349
|
-
}
|
|
350
|
-
.rac-layout-grid\:bg-red[data-layout="grid"] {
|
|
351
|
-
--tw-bg-opacity: 1;
|
|
352
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
353
|
-
}
|
|
354
|
-
.rac-layout-stack\:bg-red[data-layout="stack"] {
|
|
355
|
-
--tw-bg-opacity: 1;
|
|
356
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
357
|
-
}
|
|
358
|
-
.rac-orientation-horizontal\:bg-red[data-orientation="horizontal"] {
|
|
359
|
-
--tw-bg-opacity: 1;
|
|
360
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
361
|
-
}
|
|
362
|
-
.rac-orientation-vertical\:bg-red[data-orientation="vertical"] {
|
|
363
|
-
--tw-bg-opacity: 1;
|
|
364
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
365
|
-
}
|
|
366
|
-
.rac-selection-single\:bg-red[data-selection-mode="single"] {
|
|
367
|
-
--tw-bg-opacity: 1;
|
|
368
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
369
|
-
}
|
|
370
|
-
.rac-selection-multiple\:bg-red[data-selection-mode="multiple"] {
|
|
371
|
-
--tw-bg-opacity: 1;
|
|
372
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
373
|
-
}
|
|
374
|
-
.rac-resizable-right\:bg-red[data-resizable-direction="right"] {
|
|
375
|
-
--tw-bg-opacity: 1;
|
|
376
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
377
|
-
}
|
|
378
|
-
.rac-resizable-left\:bg-red[data-resizable-direction="left"] {
|
|
379
|
-
--tw-bg-opacity: 1;
|
|
380
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
381
|
-
}
|
|
382
|
-
.rac-resizable-both\:bg-red[data-resizable-direction="both"] {
|
|
383
|
-
--tw-bg-opacity: 1;
|
|
384
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
385
|
-
}
|
|
386
|
-
.rac-sort-ascending\:bg-red[data-sort-direction="ascending"] {
|
|
387
|
-
--tw-bg-opacity: 1;
|
|
388
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
389
|
-
}
|
|
390
|
-
.rac-sort-descending\:bg-red[data-sort-direction="descending"] {
|
|
391
|
-
--tw-bg-opacity: 1;
|
|
392
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
393
|
-
}
|
|
394
|
-
.rac-allows-removing\:bg-red[data-allows-removing] {
|
|
395
|
-
--tw-bg-opacity: 1;
|
|
396
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
397
|
-
}
|
|
398
|
-
.rac-allows-sorting\:bg-red[data-allows-sorting] {
|
|
399
|
-
--tw-bg-opacity: 1;
|
|
400
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
401
|
-
}
|
|
402
|
-
.rac-allows-dragging\:bg-red[data-allows-dragging] {
|
|
403
|
-
--tw-bg-opacity: 1;
|
|
404
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
405
|
-
}
|
|
406
|
-
.rac-has-submenu\:bg-red[data-has-submenu] {
|
|
407
|
-
--tw-bg-opacity: 1;
|
|
408
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
409
|
-
}
|
|
410
|
-
.rac-open\:bg-red[data-open] {
|
|
411
|
-
--tw-bg-opacity: 1;
|
|
412
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
413
|
-
}
|
|
414
|
-
.rac-expanded\:bg-red[data-expanded] {
|
|
415
|
-
--tw-bg-opacity: 1;
|
|
416
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
417
|
-
}
|
|
418
|
-
.rac-entering\:bg-red[data-entering] {
|
|
419
|
-
--tw-bg-opacity: 1;
|
|
420
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
421
|
-
}
|
|
422
|
-
.rac-exiting\:bg-red[data-exiting] {
|
|
423
|
-
--tw-bg-opacity: 1;
|
|
424
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
425
|
-
}
|
|
426
|
-
.rac-indeterminate\:bg-red[data-indeterminate] {
|
|
427
|
-
--tw-bg-opacity: 1;
|
|
428
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
429
|
-
}
|
|
430
|
-
.rac-placeholder-shown\:bg-red[data-placeholder] {
|
|
431
|
-
--tw-bg-opacity: 1;
|
|
432
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
433
|
-
}
|
|
434
|
-
.rac-current\:bg-red[data-current] {
|
|
435
|
-
--tw-bg-opacity: 1;
|
|
436
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
437
|
-
}
|
|
438
|
-
.rac-required\:bg-red[data-required] {
|
|
439
|
-
--tw-bg-opacity: 1;
|
|
440
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
441
|
-
}
|
|
442
|
-
.rac-unavailable\:bg-red[data-unavailable] {
|
|
443
|
-
--tw-bg-opacity: 1;
|
|
444
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
445
|
-
}
|
|
446
|
-
.rac-invalid\:bg-red[data-invalid] {
|
|
447
|
-
--tw-bg-opacity: 1;
|
|
448
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
449
|
-
}
|
|
450
|
-
.rac-read-only\:bg-red[data-readonly] {
|
|
451
|
-
--tw-bg-opacity: 1;
|
|
452
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
453
|
-
}
|
|
454
|
-
.rac-outside-month\:bg-red[data-outside-month] {
|
|
455
|
-
--tw-bg-opacity: 1;
|
|
456
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
457
|
-
}
|
|
458
|
-
.rac-outside-visible-range\:bg-red[data-outside-visible-range] {
|
|
459
|
-
--tw-bg-opacity: 1;
|
|
460
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
461
|
-
}
|
|
462
|
-
.rac-pending\:bg-red[data-pending] {
|
|
463
|
-
--tw-bg-opacity: 1;
|
|
464
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
465
|
-
}
|
|
466
|
-
.rac-empty\:bg-red[data-empty] {
|
|
467
|
-
--tw-bg-opacity: 1;
|
|
468
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
469
|
-
}
|
|
470
|
-
.rac-focus-within\:bg-red[data-focus-within] {
|
|
471
|
-
--tw-bg-opacity: 1;
|
|
472
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
473
|
-
}
|
|
474
|
-
.rac-hover\:bg-red[data-hovered] {
|
|
475
|
-
--tw-bg-opacity: 1;
|
|
476
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
477
|
-
}
|
|
478
|
-
.group\/custom-name[data-hovered] .group-rac-hover\/custom-name\:bg-red {
|
|
479
|
-
--tw-bg-opacity: 1;
|
|
480
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
481
|
-
}
|
|
482
|
-
.rac-focus\:bg-red[data-focused] {
|
|
483
|
-
--tw-bg-opacity: 1;
|
|
484
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
485
|
-
}
|
|
486
|
-
.rac-focus-visible\:bg-red[data-focus-visible] {
|
|
487
|
-
--tw-bg-opacity: 1;
|
|
488
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
489
|
-
}
|
|
490
|
-
.rac-pressed\:bg-red[data-pressed] {
|
|
491
|
-
--tw-bg-opacity: 1;
|
|
492
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
493
|
-
}
|
|
494
|
-
.group[data-pressed] .group-rac-pressed\:bg-red {
|
|
495
|
-
--tw-bg-opacity: 1;
|
|
496
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
497
|
-
}
|
|
498
|
-
.peer\/custom-name[data-pressed] ~ .peer-rac-pressed\/custom-name\:bg-red {
|
|
499
|
-
--tw-bg-opacity: 1;
|
|
500
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
501
|
-
}
|
|
502
|
-
.peer[data-pressed] ~ .peer-rac-pressed\:bg-red {
|
|
503
|
-
--tw-bg-opacity: 1;
|
|
504
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
505
|
-
}
|
|
506
|
-
.rac-selected\:bg-red[data-selected] {
|
|
507
|
-
--tw-bg-opacity: 1;
|
|
508
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
509
|
-
}
|
|
510
|
-
.rac-selection-start\:bg-red[data-selection-start] {
|
|
511
|
-
--tw-bg-opacity: 1;
|
|
512
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
513
|
-
}
|
|
514
|
-
.rac-selection-end\:bg-red[data-selection-end] {
|
|
515
|
-
--tw-bg-opacity: 1;
|
|
516
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
517
|
-
}
|
|
518
|
-
.rac-dragging\:bg-red[data-dragging] {
|
|
519
|
-
--tw-bg-opacity: 1;
|
|
520
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
521
|
-
}
|
|
522
|
-
.rac-drop-target\:bg-red[data-drop-target] {
|
|
523
|
-
--tw-bg-opacity: 1;
|
|
524
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
525
|
-
}
|
|
526
|
-
.rac-resizing\:bg-red[data-resizing] {
|
|
527
|
-
--tw-bg-opacity: 1;
|
|
528
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
529
|
-
}
|
|
530
|
-
.rac-disabled\:bg-red[data-disabled] {
|
|
531
|
-
--tw-bg-opacity: 1;
|
|
532
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
533
|
-
}`
|
|
534
|
-
);
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
test('hoverOnlyWhenSupported', () => {
|
|
539
|
-
let content = html`<div data-rac className="hover:bg-red"></div>`;
|
|
540
|
-
return run({content, future: {hoverOnlyWhenSupported: true}}).then((result) => {
|
|
541
|
-
expect(result.css).toContain(css`
|
|
542
|
-
.hover\:bg-red:where([data-rac])[data-hovered] {
|
|
543
|
-
--tw-bg-opacity: 1;
|
|
544
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
545
|
-
}
|
|
546
|
-
@media (hover: hover) and (pointer: fine) {
|
|
547
|
-
.hover\:bg-red:where(:not([data-rac])):hover {
|
|
548
|
-
--tw-bg-opacity: 1;
|
|
549
|
-
background-color: rgb(255 0 0 / var(--tw-bg-opacity))
|
|
550
|
-
}
|
|
551
|
-
}`);
|
|
552
|
-
});
|
|
553
|
-
});
|
|
554
|
-
|