@react-spectrum/s2 3.0.0-nightly-fd7075c5f-250128 → 3.0.0-nightly-e3ed3c7f6-250130
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 +3 -3
- package/dist/Accordion.css +2 -2
- package/dist/Accordion.mjs +3 -3
- package/dist/ActionBar.cjs +47 -47
- package/dist/ActionBar.css +51 -51
- package/dist/ActionBar.mjs +47 -47
- package/dist/ActionButton.cjs +97 -97
- package/dist/ActionButton.css +96 -96
- package/dist/ActionButton.mjs +97 -97
- package/dist/ActionButtonGroup.cjs +11 -11
- package/dist/ActionButtonGroup.css +9 -9
- package/dist/ActionButtonGroup.mjs +11 -11
- package/dist/AlertDialog.cjs +3 -3
- package/dist/AlertDialog.css +3 -3
- package/dist/AlertDialog.mjs +3 -3
- package/dist/Avatar.cjs +17 -17
- package/dist/Avatar.css +14 -14
- package/dist/Avatar.mjs +17 -17
- package/dist/AvatarGroup.cjs +100 -100
- package/dist/AvatarGroup.css +34 -34
- package/dist/AvatarGroup.mjs +100 -100
- package/dist/Badge.cjs +91 -67
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +163 -91
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +91 -67
- package/dist/Badge.mjs.map +1 -1
- package/dist/Breadcrumbs.cjs +115 -115
- package/dist/Breadcrumbs.css +89 -89
- package/dist/Breadcrumbs.mjs +115 -115
- package/dist/Button.cjs +236 -152
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +309 -165
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +236 -152
- package/dist/Button.mjs.map +1 -1
- package/dist/ButtonGroup.cjs +19 -19
- package/dist/ButtonGroup.css +15 -15
- package/dist/ButtonGroup.mjs +19 -19
- package/dist/Card.cjs +264 -261
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css +210 -198
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +264 -261
- package/dist/Card.mjs.map +1 -1
- package/dist/CardView.cjs +15 -15
- package/dist/CardView.css +18 -18
- package/dist/CardView.mjs +15 -15
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +2 -2
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +124 -73
- package/dist/Checkbox.cjs.map +1 -1
- package/dist/Checkbox.css +201 -81
- package/dist/Checkbox.css.map +1 -1
- package/dist/Checkbox.mjs +124 -73
- package/dist/Checkbox.mjs.map +1 -1
- package/dist/CheckboxGroup.cjs +49 -49
- package/dist/CheckboxGroup.css +41 -41
- package/dist/CheckboxGroup.mjs +49 -49
- package/dist/ClearButton.cjs +15 -15
- package/dist/ClearButton.css +17 -17
- package/dist/ClearButton.mjs +15 -15
- package/dist/CloseButton.cjs +35 -35
- package/dist/CloseButton.css +33 -33
- package/dist/CloseButton.mjs +35 -35
- package/dist/ColorArea.cjs +22 -22
- package/dist/ColorArea.css +15 -15
- package/dist/ColorArea.mjs +22 -22
- package/dist/ColorField.cjs +38 -38
- package/dist/ColorField.css +32 -32
- package/dist/ColorField.mjs +38 -38
- package/dist/ColorHandle.cjs +27 -21
- package/dist/ColorHandle.cjs.map +1 -1
- package/dist/ColorHandle.css +93 -45
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs +27 -21
- package/dist/ColorHandle.mjs.map +1 -1
- package/dist/ColorSlider.cjs +52 -52
- package/dist/ColorSlider.css +51 -51
- package/dist/ColorSlider.mjs +52 -52
- package/dist/ColorSwatch.cjs +27 -24
- package/dist/ColorSwatch.cjs.map +1 -1
- package/dist/ColorSwatch.css +41 -29
- package/dist/ColorSwatch.css.map +1 -1
- package/dist/ColorSwatch.mjs +27 -24
- package/dist/ColorSwatch.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +23 -23
- package/dist/ColorSwatchPicker.css +60 -48
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +23 -23
- package/dist/ColorWheel.cjs +22 -22
- package/dist/ColorWheel.css +16 -16
- package/dist/ColorWheel.mjs +22 -22
- package/dist/ComboBox.cjs +80 -80
- package/dist/ComboBox.css +88 -88
- package/dist/ComboBox.mjs +80 -80
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +38 -38
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/CustomDialog.cjs +31 -31
- package/dist/CustomDialog.css +25 -25
- package/dist/CustomDialog.mjs +31 -31
- package/dist/Dialog.cjs +17 -17
- package/dist/Dialog.css +64 -64
- package/dist/Dialog.mjs +17 -17
- package/dist/Disclosure.cjs +111 -108
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +124 -112
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +111 -108
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/Divider.cjs +26 -26
- package/dist/Divider.css +16 -16
- package/dist/Divider.mjs +26 -26
- package/dist/DropZone.cjs +56 -47
- package/dist/DropZone.cjs.map +1 -1
- package/dist/DropZone.css +80 -56
- package/dist/DropZone.css.map +1 -1
- package/dist/DropZone.mjs +56 -47
- package/dist/DropZone.mjs.map +1 -1
- package/dist/Field.cjs +204 -150
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +246 -150
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +204 -150
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.cjs +10 -10
- package/dist/Form.css +9 -9
- package/dist/Form.mjs +10 -10
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +72 -72
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +134 -134
- package/dist/IllustratedMessage.css +69 -69
- package/dist/IllustratedMessage.mjs +134 -134
- package/dist/Image.cjs +12 -12
- package/dist/Image.css +13 -13
- package/dist/Image.mjs +12 -12
- package/dist/InlineAlert.cjs +104 -77
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +149 -77
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +104 -77
- package/dist/InlineAlert.mjs.map +1 -1
- package/dist/Link.cjs +31 -31
- package/dist/Link.css +30 -30
- package/dist/Link.mjs +31 -31
- package/dist/Menu.cjs +269 -264
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +152 -152
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +270 -265
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +85 -85
- package/dist/Meter.css +81 -81
- package/dist/Meter.mjs +85 -85
- package/dist/Modal.cjs +48 -48
- package/dist/Modal.css +46 -46
- package/dist/Modal.mjs +48 -48
- package/dist/NumberField.cjs +115 -115
- package/dist/NumberField.css +114 -114
- package/dist/NumberField.mjs +115 -115
- package/dist/Picker.cjs +193 -175
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css +223 -163
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +193 -175
- package/dist/Picker.mjs.map +1 -1
- package/dist/Popover.cjs +84 -78
- package/dist/Popover.cjs.map +1 -1
- package/dist/Popover.css +89 -65
- package/dist/Popover.css.map +1 -1
- package/dist/Popover.mjs +84 -78
- package/dist/Popover.mjs.map +1 -1
- package/dist/ProgressBar.cjs +98 -98
- package/dist/ProgressBar.css +92 -92
- package/dist/ProgressBar.mjs +98 -98
- package/dist/ProgressCircle.cjs +17 -17
- package/dist/ProgressCircle.css +15 -15
- package/dist/ProgressCircle.mjs +17 -17
- package/dist/Provider.cjs +4 -4
- package/dist/Provider.css +5 -5
- package/dist/Provider.mjs +4 -4
- package/dist/Radio.cjs +152 -80
- package/dist/Radio.cjs.map +1 -1
- package/dist/Radio.css +240 -96
- package/dist/Radio.css.map +1 -1
- package/dist/Radio.mjs +152 -80
- package/dist/Radio.mjs.map +1 -1
- package/dist/RadioGroup.cjs +47 -47
- package/dist/RadioGroup.css +41 -41
- package/dist/RadioGroup.mjs +47 -47
- package/dist/SearchField.cjs +42 -42
- package/dist/SearchField.css +47 -47
- package/dist/SearchField.mjs +42 -42
- package/dist/SegmentedControl.cjs +101 -89
- package/dist/SegmentedControl.cjs.map +1 -1
- package/dist/SegmentedControl.css +140 -92
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +101 -89
- package/dist/SegmentedControl.mjs.map +1 -1
- package/dist/Slider.cjs +229 -196
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css +221 -149
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs +229 -196
- package/dist/Slider.mjs.map +1 -1
- package/dist/StatusLight.cjs +56 -56
- package/dist/StatusLight.css +59 -59
- package/dist/StatusLight.mjs +56 -56
- package/dist/Switch.cjs +107 -74
- package/dist/Switch.cjs.map +1 -1
- package/dist/Switch.css +141 -69
- package/dist/Switch.css.map +1 -1
- package/dist/Switch.mjs +107 -74
- package/dist/Switch.mjs.map +1 -1
- package/dist/TableView.cjs +280 -253
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css +199 -163
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +280 -253
- package/dist/TableView.mjs.map +1 -1
- package/dist/Tabs.cjs +83 -83
- package/dist/Tabs.css +58 -58
- package/dist/Tabs.mjs +83 -83
- package/dist/TagGroup.cjs +148 -148
- package/dist/TagGroup.css +134 -134
- package/dist/TagGroup.mjs +148 -148
- package/dist/TextField.cjs +59 -59
- package/dist/TextField.css +62 -62
- package/dist/TextField.mjs +59 -59
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -12
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +60 -57
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css +83 -71
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +60 -57
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs +465 -0
- package/dist/TreeView.cjs.map +1 -0
- package/dist/TreeView.css +632 -0
- package/dist/TreeView.css.map +1 -0
- package/dist/TreeView.mjs +455 -0
- package/dist/TreeView.mjs.map +1 -0
- package/dist/main.cjs +4 -0
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +3 -1
- package/dist/module.mjs.map +1 -1
- package/dist/types.d.ts +21 -1
- package/dist/types.d.ts.map +1 -1
- package/icons/Skeleton.cjs +2 -2
- package/icons/Skeleton.css +5 -5
- package/icons/Skeleton.mjs +2 -2
- package/package.json +20 -19
- package/src/Menu.tsx +2 -0
- package/src/TreeView.tsx +497 -0
- package/src/index.ts +2 -0
- package/style/__tests__/style-macro.test.js +18 -18
- package/style/dist/spectrum-theme.cjs +20 -10
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +20 -10
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +4 -0
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +18 -11
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
@layer _.a {
|
|
2
|
-
.
|
|
2
|
+
.hc {
|
|
3
3
|
row-gap: .25rem;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
6
|
+
.ic {
|
|
7
7
|
column-gap: .25rem;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -11,69 +11,69 @@
|
|
|
11
11
|
background-color: var(--lightningcss-light, #e9e9e9) var(--lightningcss-dark, #2c2c2c);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.
|
|
14
|
+
.ke {
|
|
15
15
|
width: fit-content;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
18
|
+
._Pa {
|
|
19
19
|
outline-style: none;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
._Pb {
|
|
23
23
|
outline-style: solid;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.cx {
|
|
27
27
|
outline-color: var(--lightningcss-light, #4b75ff) var(--lightningcss-dark, #4069fd);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
._Rc {
|
|
31
31
|
outline-width: 2px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
._Q-3t1z {
|
|
35
35
|
outline-offset: 2px;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.Yc {
|
|
39
39
|
position: relative;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
._Db {
|
|
43
43
|
forced-color-adjust: none;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
46
|
+
._ga {
|
|
47
47
|
font-family: adobe-clean-variable, adobe-clean, ui-sans-serif, system-ui, sans-serif;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.
|
|
50
|
+
._he {
|
|
51
51
|
font-size: .875rem;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.
|
|
54
|
+
._ha {
|
|
55
55
|
font-size: .6875rem;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.
|
|
58
|
+
._hc {
|
|
59
59
|
font-size: .75rem;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
._hg {
|
|
63
63
|
font-size: 1rem;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.
|
|
66
|
+
._hi {
|
|
67
67
|
font-size: 1.125rem;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
._ib {
|
|
71
71
|
font-variation-settings: "wght" 400;
|
|
72
72
|
font-synthesis-weight: none;
|
|
73
73
|
font-weight: 400;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.
|
|
76
|
+
._ja {
|
|
77
77
|
line-height: 1.3;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -93,35 +93,35 @@
|
|
|
93
93
|
color: var(--lightningcss-light, #c6c6c6) var(--lightningcss-dark, #444);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.
|
|
97
|
-
padding-inline-start: calc(var(--
|
|
96
|
+
.FI {
|
|
97
|
+
padding-inline-start: calc(var(--j, var(--n)) * 3 / 8);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.
|
|
101
|
-
padding-inline-end: calc(var(--
|
|
100
|
+
.GI {
|
|
101
|
+
padding-inline-end: calc(var(--j, var(--n)) * 3 / 8);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.
|
|
105
|
-
height: var(--
|
|
104
|
+
.j-375top {
|
|
105
|
+
height: var(--j);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.
|
|
108
|
+
.__d-3t1y {
|
|
109
109
|
flex-grow: 1;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
.
|
|
112
|
+
.ga {
|
|
113
113
|
flex-basis: 0;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
._6d {
|
|
117
117
|
justify-content: center;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.
|
|
120
|
+
.__V-yksgrp {
|
|
121
121
|
-webkit-tap-highlight-color: #0000;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.
|
|
124
|
+
.__Ha {
|
|
125
125
|
-webkit-user-select: none;
|
|
126
126
|
user-select: none;
|
|
127
127
|
}
|
|
@@ -130,220 +130,244 @@
|
|
|
130
130
|
background-color: #0000;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
.
|
|
133
|
+
.zf {
|
|
134
134
|
border-style: none;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.
|
|
137
|
+
._zc {
|
|
138
138
|
border-start-start-radius: .5rem;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
.
|
|
141
|
+
._Ac {
|
|
142
142
|
border-start-end-radius: .5rem;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
.
|
|
145
|
+
._Bc {
|
|
146
146
|
border-end-start-radius: .5rem;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
.
|
|
149
|
+
._Cc {
|
|
150
150
|
border-end-end-radius: .5rem;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
.-
|
|
153
|
+
.-rwx0fg_d-b {
|
|
154
154
|
--iconPrimary: currentColor;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
.-
|
|
158
|
-
--
|
|
157
|
+
.-_375top_j-U {
|
|
158
|
+
--j: calc(2rem * var(--s2-scale));
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.bd {
|
|
162
162
|
background-color: var(--lightningcss-light, #fff) var(--lightningcss-dark, #111);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
.
|
|
165
|
+
._ca {
|
|
166
166
|
left: 0;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
.
|
|
169
|
+
.kb {
|
|
170
170
|
width: 100%;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
.
|
|
173
|
+
.jb {
|
|
174
174
|
height: 100%;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
.
|
|
177
|
+
.Ya {
|
|
178
178
|
position: absolute;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
.
|
|
181
|
+
.__ra {
|
|
182
182
|
box-sizing: border-box;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
.
|
|
185
|
+
.za {
|
|
186
186
|
border-style: solid;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
.
|
|
189
|
+
.tc {
|
|
190
190
|
border-top-width: 2px;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
.
|
|
193
|
+
.uc {
|
|
194
194
|
border-bottom-width: 2px;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
.
|
|
197
|
+
.rc {
|
|
198
198
|
border-inline-start-width: 2px;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
.
|
|
201
|
+
.sc {
|
|
202
202
|
border-inline-end-width: 2px;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
.
|
|
206
|
-
border-color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
205
|
+
.xo {
|
|
206
|
+
border-top-color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.xi {
|
|
210
|
+
border-top-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.yo {
|
|
214
|
+
border-bottom-color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.yi {
|
|
218
|
+
border-bottom-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.vo {
|
|
222
|
+
border-inline-start-color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.vi {
|
|
226
|
+
border-inline-start-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
207
227
|
}
|
|
208
228
|
|
|
209
|
-
.
|
|
210
|
-
border-color: var(--lightningcss-light, #
|
|
229
|
+
.wo {
|
|
230
|
+
border-inline-end-color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
211
231
|
}
|
|
212
232
|
|
|
213
|
-
.
|
|
233
|
+
.wi {
|
|
234
|
+
border-inline-end-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
._zd {
|
|
214
238
|
border-start-start-radius: .625rem;
|
|
215
239
|
}
|
|
216
240
|
|
|
217
|
-
.
|
|
241
|
+
._Ad {
|
|
218
242
|
border-start-end-radius: .625rem;
|
|
219
243
|
}
|
|
220
244
|
|
|
221
|
-
.
|
|
245
|
+
._Bd {
|
|
222
246
|
border-end-start-radius: .625rem;
|
|
223
247
|
}
|
|
224
248
|
|
|
225
|
-
.
|
|
249
|
+
._Cd {
|
|
226
250
|
border-end-end-radius: .625rem;
|
|
227
251
|
}
|
|
228
252
|
|
|
229
|
-
.
|
|
253
|
+
.__E-3t1x {
|
|
230
254
|
order: 0;
|
|
231
255
|
}
|
|
232
256
|
|
|
233
|
-
.
|
|
257
|
+
.__c-3t1x {
|
|
234
258
|
flex-shrink: 0;
|
|
235
259
|
}
|
|
236
260
|
|
|
237
|
-
.
|
|
261
|
+
.__E-3t1y {
|
|
238
262
|
order: 1;
|
|
239
263
|
}
|
|
240
264
|
|
|
241
|
-
.
|
|
265
|
+
.__zb {
|
|
242
266
|
overflow-x: hidden;
|
|
243
267
|
}
|
|
244
268
|
|
|
245
|
-
.
|
|
269
|
+
.__Ab {
|
|
246
270
|
overflow-y: hidden;
|
|
247
271
|
}
|
|
248
272
|
|
|
249
|
-
.
|
|
273
|
+
._qa {
|
|
250
274
|
text-overflow: ellipsis;
|
|
251
275
|
}
|
|
252
276
|
|
|
253
|
-
.
|
|
277
|
+
._tb {
|
|
254
278
|
white-space: nowrap;
|
|
255
279
|
}
|
|
256
280
|
|
|
257
|
-
.
|
|
281
|
+
._3d {
|
|
258
282
|
display: flex;
|
|
259
283
|
}
|
|
260
284
|
|
|
261
|
-
.
|
|
285
|
+
.hG {
|
|
262
286
|
row-gap: .428571em;
|
|
263
287
|
}
|
|
264
288
|
|
|
265
|
-
.
|
|
289
|
+
.iG {
|
|
266
290
|
column-gap: .428571em;
|
|
267
291
|
}
|
|
268
292
|
|
|
269
|
-
.
|
|
293
|
+
._Sa {
|
|
270
294
|
transition-property: color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter;
|
|
271
295
|
}
|
|
272
296
|
|
|
273
|
-
.
|
|
297
|
+
._U-375x7f {
|
|
274
298
|
transition-duration: .15s;
|
|
275
299
|
}
|
|
276
300
|
|
|
277
|
-
.
|
|
301
|
+
._Va {
|
|
278
302
|
transition-timing-function: cubic-bezier(.45, 0, .4, 1);
|
|
279
303
|
}
|
|
280
304
|
|
|
281
|
-
.
|
|
305
|
+
._5c {
|
|
282
306
|
align-items: center;
|
|
283
307
|
}
|
|
284
308
|
|
|
285
|
-
.
|
|
309
|
+
.po {
|
|
286
310
|
min-width: 0;
|
|
287
311
|
}
|
|
288
312
|
}
|
|
289
313
|
|
|
290
314
|
@layer _.b {
|
|
291
|
-
.
|
|
315
|
+
._g-enzrfpb:lang(ar) {
|
|
292
316
|
font-family: myriad-arabic, ui-sans-serif, system-ui, sans-serif;
|
|
293
317
|
}
|
|
294
318
|
|
|
295
|
-
.
|
|
319
|
+
._j-1x99dlob:is(:lang(ja), :lang(ko), :lang(zh), :lang(zh-Hant), :lang(zh-Hans)) {
|
|
296
320
|
line-height: 1.5;
|
|
297
321
|
}
|
|
298
322
|
|
|
299
|
-
.
|
|
323
|
+
.F-soocic-6njx2e:has([slot="icon"]):not(:has([data-rsp-slot="text"])) {
|
|
300
324
|
padding-inline-start: .375rem;
|
|
301
325
|
}
|
|
302
326
|
|
|
303
|
-
.
|
|
327
|
+
.G-soocic-6njx2e:has([slot="icon"]):not(:has([data-rsp-slot="text"])) {
|
|
304
328
|
padding-inline-end: .375rem;
|
|
305
329
|
}
|
|
306
330
|
}
|
|
307
331
|
|
|
308
332
|
@layer _.c {
|
|
309
|
-
.
|
|
333
|
+
._g-enzwzjc:lang(he) {
|
|
310
334
|
font-family: myriad-hebrew, ui-sans-serif, system-ui, sans-serif;
|
|
311
335
|
}
|
|
312
336
|
}
|
|
313
337
|
|
|
314
338
|
@layer _.d {
|
|
315
|
-
.
|
|
339
|
+
._g-enzykdd:lang(ja) {
|
|
316
340
|
font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
|
|
317
341
|
}
|
|
318
342
|
}
|
|
319
343
|
|
|
320
344
|
@layer _.e {
|
|
321
|
-
.
|
|
345
|
+
._g-enzzrge:lang(ko) {
|
|
322
346
|
font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
|
|
323
347
|
}
|
|
324
348
|
}
|
|
325
349
|
|
|
326
350
|
@layer _.f {
|
|
327
|
-
.
|
|
351
|
+
._g-eo0c6sf:lang(zh) {
|
|
328
352
|
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
|
|
329
353
|
}
|
|
330
354
|
}
|
|
331
355
|
|
|
332
356
|
@layer _.g {
|
|
333
|
-
.
|
|
357
|
+
._g-1uotwbwg:lang(zh-hant) {
|
|
334
358
|
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
|
|
335
359
|
}
|
|
336
360
|
}
|
|
337
361
|
|
|
338
362
|
@layer _.h {
|
|
339
|
-
.
|
|
363
|
+
._g-bc1l9oh:is(:lang(zh-Hans), :lang(zh-CN), :lang(zh-SG)) {
|
|
340
364
|
font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
|
|
341
365
|
}
|
|
342
366
|
}
|
|
343
367
|
|
|
344
368
|
@layer _.b.a {
|
|
345
369
|
@media (forced-colors: active) {
|
|
346
|
-
.
|
|
370
|
+
.ca_____M {
|
|
347
371
|
outline-color: highlight;
|
|
348
372
|
}
|
|
349
373
|
|
|
@@ -367,43 +391,67 @@
|
|
|
367
391
|
background-color: graytext;
|
|
368
392
|
}
|
|
369
393
|
|
|
370
|
-
.
|
|
371
|
-
border-color: highlight;
|
|
394
|
+
.xa_____M {
|
|
395
|
+
border-top-color: highlight;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.xa_____O {
|
|
399
|
+
border-top-color: graytext;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.ya_____M {
|
|
403
|
+
border-bottom-color: highlight;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.ya_____O {
|
|
407
|
+
border-bottom-color: graytext;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.va_____M {
|
|
411
|
+
border-inline-start-color: highlight;
|
|
372
412
|
}
|
|
373
413
|
|
|
374
|
-
.
|
|
375
|
-
border-color: graytext;
|
|
414
|
+
.va_____O {
|
|
415
|
+
border-inline-start-color: graytext;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.wa_____M {
|
|
419
|
+
border-inline-end-color: highlight;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.wa_____O {
|
|
423
|
+
border-inline-end-color: graytext;
|
|
376
424
|
}
|
|
377
425
|
}
|
|
378
426
|
}
|
|
379
427
|
|
|
380
428
|
@layer _.b.b {
|
|
381
429
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
382
|
-
.
|
|
430
|
+
._hbf {
|
|
383
431
|
font-size: 1.0625rem;
|
|
384
432
|
}
|
|
385
433
|
|
|
386
|
-
.
|
|
434
|
+
._hbb {
|
|
387
435
|
font-size: .8125rem;
|
|
388
436
|
}
|
|
389
437
|
|
|
390
|
-
.
|
|
438
|
+
._hbd {
|
|
391
439
|
font-size: .9375rem;
|
|
392
440
|
}
|
|
393
441
|
|
|
394
|
-
.
|
|
442
|
+
._hbh {
|
|
395
443
|
font-size: 1.1875rem;
|
|
396
444
|
}
|
|
397
445
|
|
|
398
|
-
.
|
|
446
|
+
._hbj {
|
|
399
447
|
font-size: 1.375rem;
|
|
400
448
|
}
|
|
401
449
|
|
|
402
|
-
.
|
|
450
|
+
.hbH {
|
|
403
451
|
row-gap: .470588em;
|
|
404
452
|
}
|
|
405
453
|
|
|
406
|
-
.
|
|
454
|
+
.ibH {
|
|
407
455
|
column-gap: .470588em;
|
|
408
456
|
}
|
|
409
457
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACwDyB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6CL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkK+C;;;;EAAA;;;;EAGzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAE4C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5NxD;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IA6CL;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA7CK;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAoN6D;;;;IAAA","sources":["90909571be522c78","packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["@import \"3076f581d900045a\";\n@import \"37c2fdb040131115\";\n@import \"d075b97bae773d34\";\n@import \"6903fca31535b056\";\n@import \"a6b79b4602e6c53c\";\n@import \"c3f3a2eb3541e76f\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<SegmentedControlProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children?: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let isReduced = false;\n if (window?.matchMedia) {\n isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !isReduced) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.css.map"}
|
|
1
|
+
{"mappings":"ACwDyB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6CL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkK+C;;;;EAAA;;;;EAGzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAE4C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5NxD;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IA6CL;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA7CK;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAoN6D;;;;IAAA","sources":["90909571be522c78","packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["@import \"3076f581d900045a\";\n@import \"37c2fdb040131115\";\n@import \"d075b97bae773d34\";\n@import \"6903fca31535b056\";\n@import \"a6b79b4602e6c53c\";\n@import \"c3f3a2eb3541e76f\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<SegmentedControlProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children?: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let isReduced = false;\n if (window?.matchMedia) {\n isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !isReduced) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.css.map"}
|