@react-spectrum/s2 0.10.0 → 0.10.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/dist/Accordion.cjs +2 -2
- package/dist/Accordion.css +2 -2
- package/dist/Accordion.mjs +2 -2
- package/dist/ActionBar.cjs +62 -62
- package/dist/ActionBar.css +61 -61
- package/dist/ActionBar.mjs +62 -62
- package/dist/ActionButton.cjs +202 -202
- package/dist/ActionButton.css +138 -138
- package/dist/ActionButton.mjs +202 -202
- package/dist/ActionButtonGroup.cjs +15 -15
- package/dist/ActionButtonGroup.css +9 -9
- package/dist/ActionButtonGroup.mjs +15 -15
- package/dist/Add.cjs +10 -10
- package/dist/Add.css +6 -6
- package/dist/Add.mjs +10 -10
- package/dist/AlertDialog.cjs +3 -3
- package/dist/AlertDialog.css +3 -3
- package/dist/AlertDialog.mjs +3 -3
- package/dist/Asterisk.cjs +6 -6
- package/dist/Asterisk.css +4 -4
- package/dist/Asterisk.mjs +6 -6
- package/dist/Avatar.cjs +14 -14
- package/dist/Avatar.css +14 -14
- package/dist/Avatar.mjs +14 -14
- package/dist/AvatarGroup.cjs +134 -134
- package/dist/AvatarGroup.css +33 -33
- package/dist/AvatarGroup.mjs +134 -134
- package/dist/Badge.cjs +206 -206
- package/dist/Badge.css +127 -127
- package/dist/Badge.mjs +206 -206
- package/dist/Breadcrumbs.cjs +254 -254
- package/dist/Breadcrumbs.css +109 -109
- package/dist/Breadcrumbs.mjs +254 -254
- package/dist/Button.cjs +341 -341
- package/dist/Button.css +177 -177
- package/dist/Button.mjs +341 -341
- package/dist/ButtonGroup.cjs +20 -20
- package/dist/ButtonGroup.css +15 -15
- package/dist/ButtonGroup.mjs +20 -20
- package/dist/Calendar.cjs +151 -139
- package/dist/Calendar.cjs.map +1 -1
- package/dist/Calendar.css +134 -134
- package/dist/Calendar.css.map +1 -1
- package/dist/Calendar.mjs +153 -141
- package/dist/Calendar.mjs.map +1 -1
- package/dist/Card.cjs +304 -304
- package/dist/Card.css +209 -209
- package/dist/Card.mjs +304 -304
- package/dist/CardView.cjs +16 -16
- package/dist/CardView.css +16 -16
- package/dist/CardView.mjs +16 -16
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +2 -2
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +170 -170
- package/dist/Checkbox.css +92 -92
- package/dist/Checkbox.mjs +170 -170
- package/dist/CheckboxGroup.cjs +45 -45
- package/dist/CheckboxGroup.css +38 -38
- package/dist/CheckboxGroup.mjs +45 -45
- package/dist/Checkmark.cjs +12 -12
- package/dist/Checkmark.css +8 -8
- package/dist/Checkmark.mjs +12 -12
- package/dist/Chevron.cjs +12 -12
- package/dist/Chevron.css +10 -10
- package/dist/Chevron.mjs +12 -12
- package/dist/ClearButton.cjs +29 -29
- package/dist/ClearButton.css +29 -29
- package/dist/ClearButton.mjs +29 -29
- package/dist/CloseButton.cjs +54 -54
- package/dist/CloseButton.css +46 -46
- package/dist/CloseButton.mjs +54 -54
- package/dist/ColorArea.cjs +16 -16
- package/dist/ColorArea.css +16 -16
- package/dist/ColorArea.mjs +16 -16
- package/dist/ColorField.cjs +32 -32
- package/dist/ColorField.css +28 -28
- package/dist/ColorField.mjs +32 -32
- package/dist/ColorHandle.cjs +27 -27
- package/dist/ColorHandle.css +42 -42
- package/dist/ColorHandle.mjs +27 -27
- package/dist/ColorSlider.cjs +118 -118
- package/dist/ColorSlider.css +54 -54
- package/dist/ColorSlider.mjs +118 -118
- package/dist/ColorSwatch.cjs +29 -29
- package/dist/ColorSwatch.css +29 -29
- package/dist/ColorSwatch.mjs +29 -29
- package/dist/ColorSwatchPicker.cjs +27 -27
- package/dist/ColorSwatchPicker.css +46 -46
- package/dist/ColorSwatchPicker.mjs +27 -27
- package/dist/ColorWheel.cjs +26 -26
- package/dist/ColorWheel.css +17 -17
- package/dist/ColorWheel.mjs +26 -26
- package/dist/ComboBox.cjs +396 -396
- package/dist/ComboBox.css +181 -181
- package/dist/ComboBox.mjs +396 -396
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +60 -60
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/Cross.cjs +14 -14
- package/dist/Cross.css +10 -10
- package/dist/Cross.mjs +14 -14
- package/dist/CustomDialog.cjs +25 -25
- package/dist/CustomDialog.css +25 -25
- package/dist/CustomDialog.mjs +25 -25
- package/dist/Dash.cjs +10 -10
- package/dist/Dash.css +6 -6
- package/dist/Dash.mjs +10 -10
- package/dist/DateField.cjs +73 -73
- package/dist/DateField.css +77 -77
- package/dist/DateField.mjs +73 -73
- package/dist/DatePicker.cjs +180 -180
- package/dist/DatePicker.css +126 -126
- package/dist/DatePicker.mjs +180 -180
- package/dist/DateRangePicker.cjs +56 -56
- package/dist/DateRangePicker.css +60 -60
- package/dist/DateRangePicker.mjs +56 -56
- package/dist/Dialog.cjs +17 -17
- package/dist/Dialog.css +82 -82
- package/dist/Dialog.mjs +17 -17
- package/dist/Disclosure.cjs +135 -135
- package/dist/Disclosure.css +106 -106
- package/dist/Disclosure.mjs +135 -135
- package/dist/Divider.cjs +25 -25
- package/dist/Divider.css +25 -25
- package/dist/Divider.mjs +25 -25
- package/dist/DropZone.cjs +62 -62
- package/dist/DropZone.css +58 -58
- package/dist/DropZone.mjs +62 -62
- package/dist/Field.cjs +370 -370
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +142 -142
- package/dist/Field.mjs +370 -370
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.cjs +9 -9
- package/dist/Form.css +9 -9
- package/dist/Form.mjs +9 -9
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +91 -91
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +256 -256
- package/dist/IllustratedMessage.css +78 -78
- package/dist/IllustratedMessage.mjs +256 -256
- package/dist/Image.cjs +13 -13
- package/dist/Image.css +14 -14
- package/dist/Image.mjs +13 -13
- package/dist/InlineAlert.cjs +117 -117
- package/dist/InlineAlert.css +98 -98
- package/dist/InlineAlert.mjs +117 -117
- package/dist/Link.cjs +54 -54
- package/dist/Link.css +46 -46
- package/dist/Link.mjs +54 -54
- package/dist/LinkOut.cjs +8 -8
- package/dist/LinkOut.css +8 -8
- package/dist/LinkOut.mjs +8 -8
- package/dist/Menu.cjs +459 -459
- package/dist/Menu.css +185 -185
- package/dist/Menu.mjs +459 -459
- package/dist/Meter.cjs +163 -163
- package/dist/Meter.css +93 -93
- package/dist/Meter.mjs +163 -163
- package/dist/Modal.cjs +58 -58
- package/dist/Modal.css +50 -50
- package/dist/Modal.mjs +58 -58
- package/dist/NotificationBadge.cjs +58 -58
- package/dist/NotificationBadge.css +51 -51
- package/dist/NotificationBadge.mjs +58 -58
- package/dist/NumberField.cjs +115 -115
- package/dist/NumberField.css +100 -100
- package/dist/NumberField.mjs +115 -115
- package/dist/Picker.cjs +283 -283
- package/dist/Picker.css +169 -169
- package/dist/Picker.mjs +283 -283
- package/dist/Popover.cjs +86 -86
- package/dist/Popover.css +66 -66
- package/dist/Popover.mjs +86 -86
- package/dist/ProgressBar.cjs +173 -173
- package/dist/ProgressBar.css +101 -101
- package/dist/ProgressBar.mjs +173 -173
- package/dist/ProgressCircle.cjs +31 -31
- package/dist/ProgressCircle.css +24 -24
- package/dist/ProgressCircle.mjs +31 -31
- package/dist/Provider.cjs +11 -11
- package/dist/Provider.css +10 -10
- package/dist/Provider.mjs +11 -11
- package/dist/Radio.cjs +154 -154
- package/dist/Radio.css +79 -79
- package/dist/Radio.mjs +154 -154
- package/dist/RadioGroup.cjs +42 -42
- package/dist/RadioGroup.css +38 -38
- package/dist/RadioGroup.mjs +42 -42
- package/dist/RangeCalendar.cjs +32 -20
- package/dist/RangeCalendar.cjs.map +1 -1
- package/dist/RangeCalendar.css +10 -10
- package/dist/RangeCalendar.css.map +1 -1
- package/dist/RangeCalendar.mjs +34 -22
- package/dist/RangeCalendar.mjs.map +1 -1
- package/dist/SearchField.cjs +42 -42
- package/dist/SearchField.css +46 -46
- package/dist/SearchField.mjs +42 -42
- package/dist/SegmentedControl.cjs +181 -181
- package/dist/SegmentedControl.css +118 -118
- package/dist/SegmentedControl.mjs +181 -181
- package/dist/Slider.cjs +299 -299
- package/dist/Slider.css +151 -151
- package/dist/Slider.mjs +299 -299
- package/dist/StatusLight.cjs +125 -125
- package/dist/StatusLight.css +61 -61
- package/dist/StatusLight.mjs +125 -125
- package/dist/Switch.cjs +162 -162
- package/dist/Switch.css +74 -74
- package/dist/Switch.mjs +162 -162
- package/dist/TableView.cjs +319 -319
- package/dist/TableView.css +172 -172
- package/dist/TableView.mjs +319 -319
- package/dist/Tabs.cjs +115 -115
- package/dist/Tabs.css +99 -99
- package/dist/Tabs.mjs +115 -115
- package/dist/TabsPicker.cjs +127 -127
- package/dist/TabsPicker.css +111 -111
- package/dist/TabsPicker.mjs +127 -127
- package/dist/TagGroup.cjs +213 -213
- package/dist/TagGroup.css +147 -147
- package/dist/TagGroup.mjs +213 -213
- package/dist/TextField.cjs +59 -59
- package/dist/TextField.css +54 -54
- package/dist/TextField.mjs +59 -59
- package/dist/TimeField.cjs +52 -52
- package/dist/TimeField.css +48 -48
- package/dist/TimeField.mjs +52 -52
- package/dist/Toast.cjs +120 -120
- package/dist/Toast.css +107 -107
- package/dist/Toast.mjs +120 -120
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -12
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +83 -83
- package/dist/Tooltip.css +70 -70
- package/dist/Tooltip.mjs +83 -83
- package/dist/TreeView.cjs +146 -146
- package/dist/TreeView.css +147 -147
- package/dist/TreeView.mjs +146 -146
- package/dist/types.d.ts.map +1 -1
- package/icons/Icon.cjs +10 -10
- package/icons/Icon.css +9 -9
- package/icons/Icon.mjs +10 -10
- package/icons/Skeleton.cjs +2 -2
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css +6 -6
- package/icons/Skeleton.mjs +2 -2
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +2 -2
- package/src/Calendar.tsx +13 -6
- package/src/RangeCalendar.tsx +13 -6
- package/style/__tests__/style-macro.test.js +162 -166
package/src/Calendar.tsx
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {ActionButton, Header, Heading, pressScale} from './';
|
|
13
|
+
import {ActionButton, Header, HeaderContext, Heading, HeadingContext, pressScale} from './';
|
|
14
14
|
import {
|
|
15
15
|
Calendar as AriaCalendar,
|
|
16
16
|
CalendarCell as AriaCalendarCell,
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
CalendarStateContext,
|
|
28
28
|
ContextValue,
|
|
29
29
|
DateValue,
|
|
30
|
+
Provider,
|
|
30
31
|
RangeCalendarState,
|
|
31
32
|
RangeCalendarStateContext,
|
|
32
33
|
Text
|
|
@@ -304,11 +305,17 @@ export const Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function Ca
|
|
|
304
305
|
{({isInvalid, isDisabled}) => {
|
|
305
306
|
return (
|
|
306
307
|
<>
|
|
307
|
-
<
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
<Provider
|
|
309
|
+
values={[
|
|
310
|
+
[HeaderContext, null],
|
|
311
|
+
[HeadingContext, null]
|
|
312
|
+
]}>
|
|
313
|
+
<Header styles={headerStyles}>
|
|
314
|
+
<CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
|
|
315
|
+
<CalendarHeading />
|
|
316
|
+
<CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
|
|
317
|
+
</Header>
|
|
318
|
+
</Provider>
|
|
312
319
|
<div
|
|
313
320
|
className={style({
|
|
314
321
|
display: 'flex',
|
package/src/RangeCalendar.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
RangeCalendarProps as AriaRangeCalendarProps,
|
|
16
16
|
ContextValue,
|
|
17
17
|
DateValue,
|
|
18
|
+
Provider,
|
|
18
19
|
Text
|
|
19
20
|
} from 'react-aria-components';
|
|
20
21
|
import {CalendarButton, CalendarGrid, CalendarHeading} from './Calendar';
|
|
@@ -23,7 +24,7 @@ import ChevronRightIcon from '../s2wf-icons/S2_Icon_ChevronRight_20_N.svg';
|
|
|
23
24
|
import {createContext, ForwardedRef, forwardRef, ReactNode} from 'react';
|
|
24
25
|
import {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';
|
|
25
26
|
import {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
|
|
26
|
-
import {Header} from './';
|
|
27
|
+
import {Header, HeaderContext, HeadingContext} from './';
|
|
27
28
|
import {helpTextStyles} from './Field';
|
|
28
29
|
// @ts-ignore
|
|
29
30
|
import intlMessages from '../intl/*.json';
|
|
@@ -85,11 +86,17 @@ export const RangeCalendar = /*#__PURE__*/ (forwardRef as forwardRefType)(functi
|
|
|
85
86
|
{({isInvalid, isDisabled}) => {
|
|
86
87
|
return (
|
|
87
88
|
<>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
<Provider
|
|
90
|
+
values={[
|
|
91
|
+
[HeaderContext, null],
|
|
92
|
+
[HeadingContext, null]
|
|
93
|
+
]}>
|
|
94
|
+
<Header styles={headerStyles}>
|
|
95
|
+
<CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
|
|
96
|
+
<CalendarHeading />
|
|
97
|
+
<CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
|
|
98
|
+
</Header>
|
|
99
|
+
</Provider>
|
|
93
100
|
<div
|
|
94
101
|
className={style({
|
|
95
102
|
display: 'flex',
|
|
@@ -37,25 +37,25 @@ describe('style-macro', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
expect(css).toMatchInlineSnapshot(`
|
|
40
|
-
|
|
40
|
+
"@layer _.a, _.b, _.c;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
@layer _.b {
|
|
43
|
+
.Jbs11:first-child {
|
|
44
|
+
margin-top: 0.25rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
@layer _.c.p {
|
|
49
|
+
@media (min-width: 64rem) {
|
|
50
|
+
.Jbpv11:first-child {
|
|
51
|
+
margin-top: 0.5rem;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
expect(js).toMatchInlineSnapshot('"
|
|
56
|
+
"
|
|
57
|
+
`);
|
|
58
|
+
expect(js).toMatchInlineSnapshot('" Jbs11 Jbpv11"');
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
it('should support self references', () => {
|
|
@@ -66,60 +66,58 @@ describe('style-macro', () => {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
expect(css).toMatchInlineSnapshot(`
|
|
69
|
-
|
|
69
|
+
"@layer _.a;
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
@layer _.a {
|
|
72
|
+
._kc11 {
|
|
73
|
+
border-top-width: 2px;
|
|
74
|
+
}
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
.hc11 {
|
|
78
|
+
border-bottom-width: 2px;
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
.mCPFGYc11 {
|
|
83
|
+
border-inline-start-width: var(--m);
|
|
84
|
+
}
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
.lc11 {
|
|
88
|
+
border-inline-end-width: 2px;
|
|
89
|
+
}
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
.SMBFGYc11 {
|
|
93
|
+
padding-inline-start: var(--S);
|
|
94
|
+
}
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
.Rv11 {
|
|
98
|
+
padding-inline-end: calc(var(--F, var(--M)) * 3 / 8);
|
|
99
|
+
}
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
.ZjUQgKd11 {
|
|
103
|
+
width: calc(200px - var(--m) - var(--S));
|
|
104
|
+
}
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
.-m_-mc11 {
|
|
108
|
+
--m: 2px;
|
|
109
|
+
}
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
.-S_-Sv11 {
|
|
113
|
+
--S: calc(var(--F, var(--M)) * 3 / 8);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
"
|
|
118
|
+
`);
|
|
119
119
|
|
|
120
|
-
expect(js).toMatchInlineSnapshot(
|
|
121
|
-
'" _kc92 hc92 mCPFGYc92 lc92 SMBFGYc92 Rv92 ZjUQgKd92 -m_-mc92 -S_-Sv92"'
|
|
122
|
-
);
|
|
120
|
+
expect(js).toMatchInlineSnapshot('" _kc11 hc11 mCPFGYc11 lc11 SMBFGYc11 Rv11 ZjUQgKd11 -m_-mc11 -S_-Sv11"');
|
|
123
121
|
});
|
|
124
122
|
|
|
125
123
|
it('should support allowed overrides', () => {
|
|
@@ -136,9 +134,9 @@ describe('style-macro', () => {
|
|
|
136
134
|
color: 'green-400'
|
|
137
135
|
});
|
|
138
136
|
|
|
139
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
140
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
141
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
137
|
+
expect(js()).toMatchInlineSnapshot('" gw11 pg11"');
|
|
138
|
+
expect(overrides).toMatchInlineSnapshot('" g8tmWqb11 pHJ3AUd11"');
|
|
139
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" g8tmWqb11 pg11"');
|
|
142
140
|
});
|
|
143
141
|
|
|
144
142
|
it('should support allowed overrides for properties that expand into multiple', () => {
|
|
@@ -153,9 +151,9 @@ describe('style-macro', () => {
|
|
|
153
151
|
translateX: 40
|
|
154
152
|
});
|
|
155
153
|
|
|
156
|
-
expect(js()).toMatchInlineSnapshot('" -_7PloMd-
|
|
157
|
-
expect(overrides).toMatchInlineSnapshot('" -_7PloMd-
|
|
158
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('" -_7PloMd-
|
|
154
|
+
expect(js()).toMatchInlineSnapshot('" -_7PloMd-B11 __Ya11"');
|
|
155
|
+
expect(overrides).toMatchInlineSnapshot('" -_7PloMd-D11 __Ya11"');
|
|
156
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" -_7PloMd-D11 __Ya11"');
|
|
159
157
|
});
|
|
160
158
|
|
|
161
159
|
it('should support allowed overrides for shorthands', () => {
|
|
@@ -170,9 +168,9 @@ describe('style-macro', () => {
|
|
|
170
168
|
padding: 40
|
|
171
169
|
});
|
|
172
170
|
|
|
173
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
174
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
175
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
171
|
+
expect(js()).toMatchInlineSnapshot('" Tk11 Qk11 Sk11 Rk11"');
|
|
172
|
+
expect(overrides).toMatchInlineSnapshot('" Tm11 Qm11 Sm11 Rm11"');
|
|
173
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" Tm11 Qm11 Sm11 Rm11"');
|
|
176
174
|
});
|
|
177
175
|
|
|
178
176
|
it("should support allowed overrides for values that aren't defined", () => {
|
|
@@ -187,9 +185,9 @@ describe('style-macro', () => {
|
|
|
187
185
|
minWidth: 32
|
|
188
186
|
});
|
|
189
187
|
|
|
190
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
191
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
192
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
188
|
+
expect(js()).toMatchInlineSnapshot('" gE11"');
|
|
189
|
+
expect(overrides).toMatchInlineSnapshot('" Nk11"');
|
|
190
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" Nk11 gE11"');
|
|
193
191
|
});
|
|
194
192
|
|
|
195
193
|
it('should support runtime conditions', () => {
|
|
@@ -207,45 +205,45 @@ describe('style-macro', () => {
|
|
|
207
205
|
});
|
|
208
206
|
|
|
209
207
|
expect(css).toMatchInlineSnapshot(`
|
|
210
|
-
|
|
208
|
+
"@layer _.a;
|
|
211
209
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
@layer _.a {
|
|
211
|
+
.gH11 {
|
|
212
|
+
background-color: light-dark(rgb(233, 233, 233), rgb(44, 44, 44));
|
|
213
|
+
}
|
|
216
214
|
|
|
217
215
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
.gF11 {
|
|
217
|
+
background-color: light-dark(rgb(225, 225, 225), rgb(50, 50, 50));
|
|
218
|
+
}
|
|
221
219
|
|
|
222
220
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
.gE11 {
|
|
222
|
+
background-color: light-dark(rgb(218, 218, 218), rgb(57, 57, 57));
|
|
223
|
+
}
|
|
226
224
|
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
.pt11 {
|
|
227
|
+
color: light-dark(rgb(41, 41, 41), rgb(219, 219, 219));
|
|
228
|
+
}
|
|
231
229
|
|
|
232
230
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
231
|
+
.po11 {
|
|
232
|
+
color: light-dark(rgb(19, 19, 19), rgb(242, 242, 242));
|
|
233
|
+
}
|
|
236
234
|
|
|
237
235
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
.pm11 {
|
|
237
|
+
color: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
242
240
|
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
"
|
|
242
|
+
`);
|
|
245
243
|
|
|
246
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
247
|
-
expect(js({isHovered: true})).toMatchInlineSnapshot('"
|
|
248
|
-
expect(js({isPressed: true})).toMatchInlineSnapshot('"
|
|
244
|
+
expect(js({})).toMatchInlineSnapshot('" gH11 pt11"');
|
|
245
|
+
expect(js({isHovered: true})).toMatchInlineSnapshot('" gF11 po11"');
|
|
246
|
+
expect(js({isPressed: true})).toMatchInlineSnapshot('" gE11 pm11"');
|
|
249
247
|
});
|
|
250
248
|
|
|
251
249
|
it('should support nested runtime conditions', () => {
|
|
@@ -261,37 +259,35 @@ describe('style-macro', () => {
|
|
|
261
259
|
});
|
|
262
260
|
|
|
263
261
|
expect(css).toMatchInlineSnapshot(`
|
|
264
|
-
|
|
262
|
+
"@layer _.a;
|
|
265
263
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
@layer _.a {
|
|
265
|
+
.gH11 {
|
|
266
|
+
background-color: light-dark(rgb(233, 233, 233), rgb(44, 44, 44));
|
|
267
|
+
}
|
|
270
268
|
|
|
271
269
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
270
|
+
.gF11 {
|
|
271
|
+
background-color: light-dark(rgb(225, 225, 225), rgb(50, 50, 50));
|
|
272
|
+
}
|
|
275
273
|
|
|
276
274
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
.g_h11 {
|
|
276
|
+
background-color: light-dark(rgb(75, 117, 255), rgb(64, 105, 253));
|
|
277
|
+
}
|
|
280
278
|
|
|
281
279
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
.g311 {
|
|
281
|
+
background-color: light-dark(rgb(59, 99, 251), rgb(86, 129, 255));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
290
|
-
expect(js({isHovered: true})).toMatchInlineSnapshot('"
|
|
291
|
-
expect(js({isSelected: true})).toMatchInlineSnapshot('"
|
|
292
|
-
expect(js({isSelected: true, isHovered: true})).toMatchInlineSnapshot(
|
|
293
|
-
'" g392"'
|
|
294
|
-
);
|
|
285
|
+
"
|
|
286
|
+
`);
|
|
287
|
+
expect(js({})).toMatchInlineSnapshot('" gH11"');
|
|
288
|
+
expect(js({isHovered: true})).toMatchInlineSnapshot('" gF11"');
|
|
289
|
+
expect(js({isSelected: true})).toMatchInlineSnapshot('" g_h11"');
|
|
290
|
+
expect(js({isSelected: true, isHovered: true})).toMatchInlineSnapshot('" g311"');
|
|
295
291
|
});
|
|
296
292
|
|
|
297
293
|
it('should support variant runtime conditions', () => {
|
|
@@ -305,9 +301,9 @@ describe('style-macro', () => {
|
|
|
305
301
|
}
|
|
306
302
|
});
|
|
307
303
|
|
|
308
|
-
expect(js({variant: 'accent'})).toMatchInlineSnapshot('"
|
|
309
|
-
expect(js({variant: 'primary'})).toMatchInlineSnapshot('"
|
|
310
|
-
expect(js({variant: 'secondary'})).toMatchInlineSnapshot('"
|
|
304
|
+
expect(js({variant: 'accent'})).toMatchInlineSnapshot('" gY11"');
|
|
305
|
+
expect(js({variant: 'primary'})).toMatchInlineSnapshot('" gjQquMe11"');
|
|
306
|
+
expect(js({variant: 'secondary'})).toMatchInlineSnapshot('" gw11"');
|
|
311
307
|
});
|
|
312
308
|
|
|
313
309
|
it('supports runtime conditions nested inside css conditions', () => {
|
|
@@ -321,28 +317,28 @@ describe('style-macro', () => {
|
|
|
321
317
|
});
|
|
322
318
|
|
|
323
319
|
expect(css).toMatchInlineSnapshot(`
|
|
324
|
-
|
|
320
|
+
"@layer _.a, _.b;
|
|
325
321
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
322
|
+
@layer _.b.l {
|
|
323
|
+
@media (forced-colors: active) {
|
|
324
|
+
.plb11 {
|
|
325
|
+
color: ButtonText;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
332
328
|
|
|
333
329
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
330
|
+
@media (forced-colors: active) {
|
|
331
|
+
.ple11 {
|
|
332
|
+
color: HighlightText;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
340
336
|
|
|
341
|
-
|
|
342
|
-
|
|
337
|
+
"
|
|
338
|
+
`);
|
|
343
339
|
|
|
344
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
345
|
-
expect(js({isSelected: true})).toMatchInlineSnapshot('"
|
|
340
|
+
expect(js({})).toMatchInlineSnapshot('" plb11"');
|
|
341
|
+
expect(js({isSelected: true})).toMatchInlineSnapshot('" ple11"');
|
|
346
342
|
});
|
|
347
343
|
|
|
348
344
|
it('should expand shorthand properties to longhands', () => {
|
|
@@ -350,33 +346,33 @@ describe('style-macro', () => {
|
|
|
350
346
|
padding: 24
|
|
351
347
|
});
|
|
352
348
|
|
|
353
|
-
expect(js).toMatchInlineSnapshot('"
|
|
349
|
+
expect(js).toMatchInlineSnapshot('" Th11 Qh11 Sh11 Rh11"');
|
|
354
350
|
expect(css).toMatchInlineSnapshot(`
|
|
355
|
-
|
|
351
|
+
"@layer _.a;
|
|
356
352
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
353
|
+
@layer _.a {
|
|
354
|
+
.Th11 {
|
|
355
|
+
padding-top: 24px;
|
|
356
|
+
}
|
|
361
357
|
|
|
362
358
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
359
|
+
.Qh11 {
|
|
360
|
+
padding-bottom: 24px;
|
|
361
|
+
}
|
|
366
362
|
|
|
367
363
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
.Sh11 {
|
|
365
|
+
padding-inline-start: 24px;
|
|
366
|
+
}
|
|
371
367
|
|
|
372
368
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
369
|
+
.Rh11 {
|
|
370
|
+
padding-inline-end: 24px;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
377
373
|
|
|
378
|
-
|
|
379
|
-
|
|
374
|
+
"
|
|
375
|
+
`);
|
|
380
376
|
});
|
|
381
377
|
|
|
382
378
|
it('should support colors with opacity', () => {
|
|
@@ -385,16 +381,16 @@ describe('style-macro', () => {
|
|
|
385
381
|
});
|
|
386
382
|
|
|
387
383
|
expect(css).toMatchInlineSnapshot(`
|
|
388
|
-
|
|
384
|
+
"@layer _.a;
|
|
389
385
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
386
|
+
@layer _.a {
|
|
387
|
+
.gpQzfVb11 {
|
|
388
|
+
background-color: rgb(from light-dark(rgb(39, 77, 234), rgb(105, 149, 254)) r g b / 50%);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
395
391
|
|
|
396
|
-
|
|
397
|
-
|
|
392
|
+
"
|
|
393
|
+
`);
|
|
398
394
|
});
|
|
399
395
|
|
|
400
396
|
it('should support setting css variables', () => {
|
|
@@ -406,15 +402,15 @@ describe('style-macro', () => {
|
|
|
406
402
|
});
|
|
407
403
|
|
|
408
404
|
expect(css).toMatchInlineSnapshot(`
|
|
409
|
-
|
|
405
|
+
"@layer _.a;
|
|
410
406
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
407
|
+
@layer _.a {
|
|
408
|
+
.-FUeYm-gE11 {
|
|
409
|
+
--foo: light-dark(rgb(218, 218, 218), rgb(57, 57, 57));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
416
412
|
|
|
417
|
-
|
|
418
|
-
|
|
413
|
+
"
|
|
414
|
+
`);
|
|
419
415
|
});
|
|
420
416
|
});
|