@react-spectrum/s2 0.9.0 → 0.9.2
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 +60 -60
- package/dist/ActionBar.css +59 -59
- package/dist/ActionBar.mjs +60 -60
- package/dist/ActionButton.cjs +187 -187
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +134 -134
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +187 -187
- package/dist/ActionButton.mjs.map +1 -1
- 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 +120 -120
- package/dist/AvatarGroup.css +37 -37
- package/dist/AvatarGroup.mjs +120 -120
- package/dist/Badge.cjs +196 -196
- package/dist/Badge.css +129 -129
- package/dist/Badge.mjs +196 -196
- package/dist/Breadcrumbs.cjs +231 -231
- package/dist/Breadcrumbs.css +102 -102
- package/dist/Breadcrumbs.mjs +231 -231
- package/dist/Button.cjs +328 -328
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +176 -176
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +328 -328
- package/dist/Button.mjs.map +1 -1
- package/dist/ButtonGroup.cjs +20 -20
- package/dist/ButtonGroup.css +15 -15
- package/dist/ButtonGroup.mjs +20 -20
- package/dist/Card.cjs +294 -294
- package/dist/Card.css +205 -205
- package/dist/Card.mjs +294 -294
- package/dist/CardView.cjs +17 -17
- package/dist/CardView.css +17 -17
- package/dist/CardView.mjs +17 -17
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +2 -2
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +160 -160
- package/dist/Checkbox.css +94 -94
- package/dist/Checkbox.mjs +160 -160
- package/dist/CheckboxGroup.cjs +43 -43
- package/dist/CheckboxGroup.css +41 -41
- package/dist/CheckboxGroup.mjs +43 -43
- 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 +31 -31
- package/dist/ColorField.css +31 -31
- package/dist/ColorField.mjs +31 -31
- package/dist/ColorHandle.cjs +27 -27
- package/dist/ColorHandle.css +42 -42
- package/dist/ColorHandle.mjs +27 -27
- package/dist/ColorSlider.cjs +108 -108
- package/dist/ColorSlider.css +56 -56
- package/dist/ColorSlider.mjs +108 -108
- 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 +378 -376
- package/dist/ComboBox.cjs.map +1 -1
- package/dist/ComboBox.css +179 -179
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs +378 -376
- package/dist/ComboBox.mjs.map +1 -1
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.cjs.map +1 -1
- package/dist/ContextualHelp.css +49 -49
- package/dist/ContextualHelp.css.map +1 -1
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/ContextualHelp.mjs.map +1 -1
- 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/Dialog.cjs +17 -17
- package/dist/Dialog.css +70 -70
- package/dist/Dialog.mjs +17 -17
- package/dist/Disclosure.cjs +129 -129
- package/dist/Disclosure.css +104 -104
- package/dist/Disclosure.mjs +129 -129
- package/dist/Divider.cjs +25 -25
- package/dist/Divider.css +25 -25
- package/dist/Divider.mjs +25 -25
- package/dist/DropZone.cjs +58 -58
- package/dist/DropZone.css +54 -54
- package/dist/DropZone.mjs +58 -58
- package/dist/Field.cjs +340 -340
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +144 -144
- package/dist/Field.mjs +340 -340
- 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 +79 -79
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +219 -219
- package/dist/IllustratedMessage.css +74 -74
- package/dist/IllustratedMessage.mjs +219 -219
- package/dist/Image.cjs +14 -14
- package/dist/Image.cjs.map +1 -1
- package/dist/Image.css +14 -14
- package/dist/Image.css.map +1 -1
- package/dist/Image.mjs +14 -14
- package/dist/Image.mjs.map +1 -1
- package/dist/InlineAlert.cjs +108 -108
- package/dist/InlineAlert.css +90 -90
- package/dist/InlineAlert.mjs +108 -108
- package/dist/Link.cjs +49 -49
- package/dist/Link.css +41 -41
- package/dist/Link.mjs +49 -49
- package/dist/LinkOut.cjs +8 -8
- package/dist/LinkOut.css +8 -8
- package/dist/LinkOut.mjs +8 -8
- package/dist/Menu.cjs +422 -422
- package/dist/Menu.css +180 -180
- package/dist/Menu.mjs +422 -422
- package/dist/Meter.cjs +153 -153
- package/dist/Meter.css +95 -95
- package/dist/Meter.mjs +153 -153
- package/dist/Modal.cjs +58 -58
- package/dist/Modal.css +50 -50
- package/dist/Modal.mjs +58 -58
- package/dist/NotificationBadge.cjs +56 -56
- package/dist/NotificationBadge.css +51 -51
- package/dist/NotificationBadge.mjs +56 -56
- package/dist/NumberField.cjs +114 -118
- package/dist/NumberField.cjs.map +1 -1
- package/dist/NumberField.css +103 -103
- package/dist/NumberField.css.map +1 -1
- package/dist/NumberField.mjs +115 -119
- package/dist/NumberField.mjs.map +1 -1
- package/dist/Picker.cjs +273 -271
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css +169 -169
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +273 -271
- package/dist/Picker.mjs.map +1 -1
- package/dist/Popover.cjs +85 -85
- package/dist/Popover.css +66 -66
- package/dist/Popover.mjs +85 -85
- package/dist/ProgressBar.cjs +163 -163
- package/dist/ProgressBar.css +103 -103
- package/dist/ProgressBar.mjs +163 -163
- package/dist/ProgressCircle.cjs +17 -17
- package/dist/ProgressCircle.css +17 -17
- package/dist/ProgressCircle.mjs +17 -17
- package/dist/Provider.cjs +10 -10
- package/dist/Provider.css +9 -9
- package/dist/Provider.mjs +10 -10
- package/dist/Radio.cjs +144 -144
- package/dist/Radio.css +81 -81
- package/dist/Radio.mjs +144 -144
- package/dist/RadioGroup.cjs +41 -41
- package/dist/RadioGroup.css +41 -41
- package/dist/RadioGroup.mjs +41 -41
- package/dist/SearchField.cjs +41 -41
- package/dist/SearchField.css +49 -49
- package/dist/SearchField.mjs +41 -41
- package/dist/SegmentedControl.cjs +171 -171
- package/dist/SegmentedControl.css +120 -120
- package/dist/SegmentedControl.mjs +171 -171
- package/dist/Slider.cjs +288 -288
- package/dist/Slider.css +152 -152
- package/dist/Slider.mjs +288 -288
- package/dist/StatusLight.cjs +115 -115
- package/dist/StatusLight.css +63 -63
- package/dist/StatusLight.mjs +115 -115
- package/dist/Switch.cjs +152 -152
- package/dist/Switch.css +76 -76
- package/dist/Switch.mjs +152 -152
- package/dist/TableView.cjs +310 -310
- package/dist/TableView.css +172 -172
- package/dist/TableView.mjs +310 -310
- package/dist/Tabs.cjs +113 -110
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +92 -92
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +113 -110
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs +123 -123
- package/dist/TabsPicker.css +112 -112
- package/dist/TabsPicker.mjs +123 -123
- package/dist/TagGroup.cjs +202 -202
- package/dist/TagGroup.cjs.map +1 -1
- package/dist/TagGroup.css +147 -147
- package/dist/TagGroup.css.map +1 -1
- package/dist/TagGroup.mjs +202 -202
- package/dist/TagGroup.mjs.map +1 -1
- package/dist/TextField.cjs +57 -57
- package/dist/TextField.css +57 -57
- package/dist/TextField.mjs +57 -57
- package/dist/Toast.cjs +118 -118
- package/dist/Toast.css +105 -105
- package/dist/Toast.mjs +118 -118
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -12
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +81 -81
- package/dist/Tooltip.css +68 -68
- package/dist/Tooltip.mjs +81 -81
- package/dist/TreeView.cjs +143 -149
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css +143 -143
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs +143 -149
- package/dist/TreeView.mjs.map +1 -1
- package/dist/types.d.ts +2 -2
- 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 +4 -3
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css +6 -6
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs +4 -3
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +45 -26
- package/src/ActionButton.tsx +1 -1
- package/src/Button.tsx +3 -3
- package/src/ComboBox.tsx +3 -2
- package/src/ContextualHelp.tsx +2 -2
- package/src/Image.tsx +1 -1
- package/src/NumberField.tsx +0 -2
- package/src/Picker.tsx +3 -2
- package/src/Skeleton.tsx +2 -1
- package/src/Tabs.tsx +7 -5
- package/src/TagGroup.tsx +1 -1
- package/src/TreeView.tsx +1 -6
- package/style/__tests__/style-macro.test.js +56 -56
package/dist/TreeView.cjs
CHANGED
|
@@ -9,7 +9,6 @@ var $6367bc87eb7d24ad$exports = require("./Content.cjs");
|
|
|
9
9
|
var $ee7b4c497f520c08$exports = require("./utils.cjs");
|
|
10
10
|
var $6K4Mt$reactjsxruntime = require("react/jsx-runtime");
|
|
11
11
|
var $6K4Mt$reactariacomponents = require("react-aria-components");
|
|
12
|
-
var $6K4Mt$reactariautils = require("@react-aria/utils");
|
|
13
12
|
var $6K4Mt$react = require("react");
|
|
14
13
|
var $6K4Mt$reactspectrumutils = require("@react-spectrum/utils");
|
|
15
14
|
var $6K4Mt$reactaria = require("react-aria");
|
|
@@ -45,7 +44,6 @@ $parcel$export(module.exports, "TreeView", () => $8a2a97a0cb171e69$export$6940b0
|
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
|
|
49
47
|
const $8a2a97a0cb171e69$var$TreeRendererContext = /*#__PURE__*/ (0, $6K4Mt$react.createContext)({});
|
|
50
48
|
let $8a2a97a0cb171e69$var$InternalTreeContext = /*#__PURE__*/ (0, $6K4Mt$react.createContext)({});
|
|
51
49
|
// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the
|
|
@@ -65,22 +63,22 @@ const $8a2a97a0cb171e69$var$tree = function anonymous(props, overrides) {
|
|
|
65
63
|
if (p[1] === "F") height = true;
|
|
66
64
|
rules += p[0];
|
|
67
65
|
}
|
|
68
|
-
if (props.isFocusVisible) rules += '
|
|
69
|
-
else rules += '
|
|
70
|
-
rules += '
|
|
71
|
-
rules += '
|
|
72
|
-
rules += '
|
|
73
|
-
rules += '
|
|
74
|
-
if (!minHeight) rules += '
|
|
75
|
-
if (!minWidth) rules += '
|
|
76
|
-
if (!width) rules += '
|
|
77
|
-
if (!height) rules += '
|
|
78
|
-
rules += '
|
|
79
|
-
rules += '
|
|
80
|
-
rules += '
|
|
81
|
-
if (props.isEmpty) rules += '
|
|
82
|
-
if (props.isEmpty) rules += '
|
|
83
|
-
rules += ' -lPUMEc-
|
|
66
|
+
if (props.isFocusVisible) rules += ' _Lf91';
|
|
67
|
+
else rules += ' _Le91';
|
|
68
|
+
rules += ' Oh91';
|
|
69
|
+
rules += ' _Mc91';
|
|
70
|
+
rules += ' _Kb91';
|
|
71
|
+
rules += ' _4c91';
|
|
72
|
+
if (!minHeight) rules += ' Ma91';
|
|
73
|
+
if (!minWidth) rules += ' Na91';
|
|
74
|
+
if (!width) rules += ' Za91';
|
|
75
|
+
if (!height) rules += ' Fb91';
|
|
76
|
+
rules += ' _Na91';
|
|
77
|
+
rules += ' Pa91';
|
|
78
|
+
rules += ' _oa91';
|
|
79
|
+
if (props.isEmpty) rules += ' _Ca91';
|
|
80
|
+
if (props.isEmpty) rules += ' eb91';
|
|
81
|
+
rules += ' -lPUMEc-Zu91';
|
|
84
82
|
return rules;
|
|
85
83
|
};
|
|
86
84
|
function $8a2a97a0cb171e69$var$TreeView(props, ref) {
|
|
@@ -148,93 +146,93 @@ const $8a2a97a0cb171e69$var$rowBackgroundColor = {
|
|
|
148
146
|
};
|
|
149
147
|
const $8a2a97a0cb171e69$var$treeRow = function anonymous(props) {
|
|
150
148
|
let rules = " ";
|
|
151
|
-
rules += '
|
|
152
|
-
rules += '
|
|
153
|
-
rules += '
|
|
154
|
-
rules += '
|
|
155
|
-
rules += '
|
|
156
|
-
rules += '
|
|
157
|
-
rules += '
|
|
158
|
-
rules += '
|
|
159
|
-
rules += '
|
|
160
|
-
rules += '
|
|
161
|
-
rules += '
|
|
162
|
-
rules += '
|
|
163
|
-
rules += '
|
|
164
|
-
rules += '
|
|
165
|
-
rules += '
|
|
166
|
-
rules += '
|
|
167
|
-
rules += '
|
|
168
|
-
rules += '
|
|
169
|
-
rules += '
|
|
170
|
-
rules += '
|
|
171
|
-
rules += '
|
|
172
|
-
rules += '
|
|
173
|
-
if (props.isLink) rules += '
|
|
174
|
-
else rules += '
|
|
149
|
+
rules += ' _Pc91';
|
|
150
|
+
rules += ' sd91';
|
|
151
|
+
rules += ' Fv91';
|
|
152
|
+
rules += ' Za91';
|
|
153
|
+
rules += ' _oa91';
|
|
154
|
+
rules += ' ug91';
|
|
155
|
+
rules += ' uch91';
|
|
156
|
+
rules += ' udi91';
|
|
157
|
+
rules += ' uea91';
|
|
158
|
+
rules += ' ugb91';
|
|
159
|
+
rules += ' uhd91';
|
|
160
|
+
rules += ' uje91';
|
|
161
|
+
rules += ' uic91';
|
|
162
|
+
rules += ' vd91';
|
|
163
|
+
rules += ' vsf91';
|
|
164
|
+
rules += ' wb91';
|
|
165
|
+
rules += ' xb91';
|
|
166
|
+
rules += ' _xa91';
|
|
167
|
+
rules += ' _Fa91';
|
|
168
|
+
rules += ' _Ffb91';
|
|
169
|
+
rules += ' pt91';
|
|
170
|
+
rules += ' _Le91';
|
|
171
|
+
if (props.isLink) rules += ' ry91';
|
|
172
|
+
else rules += ' ri91';
|
|
175
173
|
if (props.isSelected) {
|
|
176
174
|
if (props.isPressed) {
|
|
177
|
-
if (props.isEmphasized) rules += ' -qH4xad-
|
|
178
|
-
else rules += ' -qH4xad-
|
|
175
|
+
if (props.isEmphasized) rules += ' -qH4xad-gT9rOHd91';
|
|
176
|
+
else rules += ' -qH4xad-gRfT7e91';
|
|
179
177
|
} else if (props.isHovered) {
|
|
180
|
-
if (props.isEmphasized) rules += ' -qH4xad-
|
|
181
|
-
else rules += ' -qH4xad-
|
|
178
|
+
if (props.isEmphasized) rules += ' -qH4xad-gT9rOHd91';
|
|
179
|
+
else rules += ' -qH4xad-gRfT7e91';
|
|
182
180
|
} else if (props.isFocusVisibleWithin) {
|
|
183
|
-
if (props.isEmphasized) rules += ' -qH4xad-
|
|
184
|
-
else rules += ' -qH4xad-
|
|
185
|
-
} else if (props.isEmphasized) rules += ' -qH4xad-
|
|
186
|
-
else rules += ' -qH4xad-
|
|
187
|
-
} else if (props.isPressed) rules += ' -qH4xad-
|
|
188
|
-
else if (props.isHovered) rules += ' -qH4xad-
|
|
189
|
-
else if (props.isFocusVisibleWithin) rules += ' -qH4xad-
|
|
190
|
-
else rules += ' -qH4xad-
|
|
191
|
-
rules += ' -qH4xad-
|
|
192
|
-
rules += ' -_34HbNb-
|
|
193
|
-
rules += ' -_34HbNb-
|
|
181
|
+
if (props.isEmphasized) rules += ' -qH4xad-gT9rOHd91';
|
|
182
|
+
else rules += ' -qH4xad-gRfT7e91';
|
|
183
|
+
} else if (props.isEmphasized) rules += ' -qH4xad-gJpow3b91';
|
|
184
|
+
else rules += ' -qH4xad-gj1B7i91';
|
|
185
|
+
} else if (props.isPressed) rules += ' -qH4xad-gRfT7e91';
|
|
186
|
+
else if (props.isHovered) rules += ' -qH4xad-gj1B7i91';
|
|
187
|
+
else if (props.isFocusVisibleWithin) rules += ' -qH4xad-gj1B7i91';
|
|
188
|
+
else rules += ' -qH4xad-gEzkoQe91';
|
|
189
|
+
rules += ' -qH4xad-lga91';
|
|
190
|
+
rules += ' -_34HbNb-Oh91';
|
|
191
|
+
rules += ' -_34HbNb-lOc91';
|
|
194
192
|
return rules;
|
|
195
193
|
};
|
|
196
194
|
const $8a2a97a0cb171e69$var$treeCellGrid = function anonymous(props) {
|
|
197
195
|
let rules = " ";
|
|
198
|
-
rules += '
|
|
199
|
-
rules += '
|
|
200
|
-
rules += '
|
|
201
|
-
rules += '
|
|
202
|
-
rules += '
|
|
203
|
-
rules += '
|
|
204
|
-
rules += '
|
|
205
|
-
rules += '
|
|
206
|
-
rules += '
|
|
207
|
-
rules += '
|
|
208
|
-
rules += '
|
|
196
|
+
rules += ' se91';
|
|
197
|
+
rules += ' Za91';
|
|
198
|
+
rules += ' Fb91';
|
|
199
|
+
rules += ' _oa91';
|
|
200
|
+
rules += ' _cb91';
|
|
201
|
+
rules += ' eb91';
|
|
202
|
+
rules += ' Dw9uTxc91';
|
|
203
|
+
rules += ' EM8Mfn91';
|
|
204
|
+
rules += ' CgjMZ2c91';
|
|
205
|
+
rules += ' gs9yXOb91';
|
|
206
|
+
rules += ' Rp91';
|
|
209
207
|
if (props.isDisabled) {
|
|
210
|
-
rules += '
|
|
211
|
-
rules += '
|
|
208
|
+
rules += ' pp91';
|
|
209
|
+
rules += ' plc91';
|
|
212
210
|
}
|
|
213
|
-
if (props.isFocusVisible) rules += ' -_7xg3bb-
|
|
214
|
-
else rules += ' -_7xg3bb-
|
|
215
|
-
rules += ' -_7xg3bb-
|
|
216
|
-
rules += ' -pKMv1c-
|
|
217
|
-
rules += ' -pKMv1c-
|
|
211
|
+
if (props.isFocusVisible) rules += ' -_7xg3bb-Oh91';
|
|
212
|
+
else rules += ' -_7xg3bb-O8Izf8c91';
|
|
213
|
+
rules += ' -_7xg3bb-lOc91';
|
|
214
|
+
rules += ' -pKMv1c-Oh91';
|
|
215
|
+
rules += ' -pKMv1c-lOc91';
|
|
218
216
|
if (props.isDetached) {
|
|
219
|
-
if (props.isSelected) rules += '
|
|
220
|
-
else rules += '
|
|
217
|
+
if (props.isSelected) rules += ' iBGbjub91';
|
|
218
|
+
else rules += ' iA91';
|
|
221
219
|
}
|
|
222
|
-
if (props.isDetached) rules += '
|
|
223
|
-
if (props.isDetached) rules += '
|
|
224
|
-
if (props.isDetached) rules += '
|
|
225
|
-
if (props.isDetached) rules += '
|
|
226
|
-
if (props.isDetached) rules += '
|
|
227
|
-
if (props.isDetached) rules += '
|
|
228
|
-
if (props.isDetached) rules += '
|
|
229
|
-
if (props.isDetached) rules += '
|
|
230
|
-
if (props.isDetached) rules += '
|
|
220
|
+
if (props.isDetached) rules += ' _kb91';
|
|
221
|
+
if (props.isDetached) rules += ' hb91';
|
|
222
|
+
if (props.isDetached) rules += ' mb91';
|
|
223
|
+
if (props.isDetached) rules += ' lb91';
|
|
224
|
+
if (props.isDetached) rules += ' ob91';
|
|
225
|
+
if (props.isDetached) rules += ' nb91';
|
|
226
|
+
if (props.isDetached) rules += ' kb91';
|
|
227
|
+
if (props.isDetached) rules += ' jb91';
|
|
228
|
+
if (props.isDetached) rules += ' _jf91';
|
|
231
229
|
return rules;
|
|
232
230
|
};
|
|
233
|
-
const $8a2a97a0cb171e69$var$treeCheckbox = "
|
|
234
|
-
const $8a2a97a0cb171e69$var$treeIcon = "
|
|
235
|
-
const $8a2a97a0cb171e69$var$treeContent = "
|
|
236
|
-
const $8a2a97a0cb171e69$var$treeActions = "
|
|
237
|
-
const $8a2a97a0cb171e69$var$treeActionMenu = "
|
|
231
|
+
const $8a2a97a0cb171e69$var$treeCheckbox = " zoRzcu91 yoRzcu91 BoRzcu91 AoRzcu91 Ix91 Hy91 Rd91";
|
|
232
|
+
const $8a2a97a0cb171e69$var$treeIcon = " z2U5Crc91 y2U5Crc91 B2U5Crc91 A2U5Crc91 Ht91 Hsu91 -_8sjo0b-t5ZbAob91";
|
|
233
|
+
const $8a2a97a0cb171e69$var$treeContent = " zk52g2d91 yk52g2d91 Bk52g2d91 Ak52g2d91 _Yb91 _7c91 _Nc91 Pc91";
|
|
234
|
+
const $8a2a97a0cb171e69$var$treeActions = " zkG38H91 ykG38H91 BkG38H91 AkG38H91 Ir91 Hs91";
|
|
235
|
+
const $8a2a97a0cb171e69$var$treeActionMenu = " z6Nrfjc91 y6Nrfjc91 B6Nrfjc91 A6Nrfjc91";
|
|
238
236
|
const $8a2a97a0cb171e69$var$cellFocus = {
|
|
239
237
|
outlineStyle: {
|
|
240
238
|
default: 'none',
|
|
@@ -288,7 +286,7 @@ const $8a2a97a0cb171e69$export$9a5779ed3fade674 = (props1)=>{
|
|
|
288
286
|
})
|
|
289
287
|
}),
|
|
290
288
|
/*#__PURE__*/ (0, $6K4Mt$reactjsxruntime.jsx)("div", {
|
|
291
|
-
className: "
|
|
289
|
+
className: " z7fSmKc91 y7fSmKc91 B7fSmKc91 A7fSmKc91 ZecPNad91"
|
|
292
290
|
}),
|
|
293
291
|
/*#__PURE__*/ (0, $6K4Mt$reactjsxruntime.jsx)($8a2a97a0cb171e69$var$ExpandableRowChevron, {
|
|
294
292
|
isDisabled: isDisabled,
|
|
@@ -311,7 +309,7 @@ const $8a2a97a0cb171e69$export$9a5779ed3fade674 = (props1)=>{
|
|
|
311
309
|
slot: 'icon',
|
|
312
310
|
styles: $8a2a97a0cb171e69$var$treeIcon
|
|
313
311
|
}),
|
|
314
|
-
styles: "
|
|
312
|
+
styles: " ZuUmpre91 FuUmpre91 _va91"
|
|
315
313
|
}
|
|
316
314
|
],
|
|
317
315
|
[
|
|
@@ -334,20 +332,20 @@ const $8a2a97a0cb171e69$export$9a5779ed3fade674 = (props1)=>{
|
|
|
334
332
|
role: "presentation",
|
|
335
333
|
className: function anonymous(props) {
|
|
336
334
|
let rules = " ";
|
|
337
|
-
if (props.isFocusVisible) rules += '
|
|
338
|
-
else rules += '
|
|
339
|
-
rules += '
|
|
340
|
-
rules += '
|
|
341
|
-
rules += '
|
|
342
|
-
rules += '
|
|
343
|
-
rules += '
|
|
344
|
-
rules += '
|
|
345
|
-
rules += '
|
|
346
|
-
rules += '
|
|
347
|
-
rules += '
|
|
348
|
-
rules += '
|
|
349
|
-
rules += '
|
|
350
|
-
rules += '
|
|
335
|
+
if (props.isFocusVisible) rules += ' _Lf91';
|
|
336
|
+
else rules += ' _Le91';
|
|
337
|
+
rules += ' _Kb91';
|
|
338
|
+
rules += ' _Mc91';
|
|
339
|
+
rules += ' Oh91';
|
|
340
|
+
rules += ' of91';
|
|
341
|
+
rules += ' nf91';
|
|
342
|
+
rules += ' kf91';
|
|
343
|
+
rules += ' jf91';
|
|
344
|
+
rules += ' _Pa91';
|
|
345
|
+
rules += ' Wr91';
|
|
346
|
+
rules += ' _lr91';
|
|
347
|
+
rules += ' _Ar91';
|
|
348
|
+
rules += ' _zr91';
|
|
351
349
|
return rules;
|
|
352
350
|
}({
|
|
353
351
|
isFocusVisible: true
|
|
@@ -360,37 +358,37 @@ const $8a2a97a0cb171e69$export$9a5779ed3fade674 = (props1)=>{
|
|
|
360
358
|
};
|
|
361
359
|
const $8a2a97a0cb171e69$var$expandButton = function anonymous(props) {
|
|
362
360
|
let rules = " ";
|
|
363
|
-
rules += '
|
|
364
|
-
rules += '
|
|
365
|
-
rules += '
|
|
366
|
-
rules += '
|
|
361
|
+
rules += ' z8dW5Qb91';
|
|
362
|
+
rules += ' y8dW5Qb91';
|
|
363
|
+
rules += ' B8dW5Qb91';
|
|
364
|
+
rules += ' A8dW5Qb91';
|
|
367
365
|
if (props.isDisabled) {
|
|
368
|
-
rules += '
|
|
369
|
-
rules += '
|
|
370
|
-
} else rules += '
|
|
371
|
-
rules += '
|
|
372
|
-
rules += '
|
|
373
|
-
rules += '
|
|
374
|
-
rules += '
|
|
375
|
-
rules += '
|
|
376
|
-
rules += '
|
|
377
|
-
rules += '
|
|
378
|
-
rules += '
|
|
366
|
+
rules += ' pp91';
|
|
367
|
+
rules += ' plc91';
|
|
368
|
+
} else rules += ' p40ub4c91';
|
|
369
|
+
rules += ' Fv91';
|
|
370
|
+
rules += ' Zw91';
|
|
371
|
+
rules += ' sd91';
|
|
372
|
+
rules += ' _wb91';
|
|
373
|
+
rules += ' _cb91';
|
|
374
|
+
rules += ' _Ca91';
|
|
375
|
+
rules += ' _Le91';
|
|
376
|
+
rules += ' ri91';
|
|
379
377
|
if (props.isExpanded) {
|
|
380
|
-
if (props.isRTL) rules += '
|
|
381
|
-
else rules += '
|
|
378
|
+
if (props.isRTL) rules += ' _Za91';
|
|
379
|
+
else rules += ' _Zb91';
|
|
382
380
|
}
|
|
383
|
-
rules += '
|
|
384
|
-
rules += '
|
|
385
|
-
rules += '
|
|
386
|
-
rules += '
|
|
387
|
-
rules += '
|
|
388
|
-
rules += '
|
|
389
|
-
rules += '
|
|
390
|
-
rules += '
|
|
391
|
-
rules += '
|
|
392
|
-
rules += '
|
|
393
|
-
if (props.isHidden) rules += '
|
|
381
|
+
rules += ' Td91';
|
|
382
|
+
rules += ' Qd91';
|
|
383
|
+
rules += ' Sd91';
|
|
384
|
+
rules += ' Rd91';
|
|
385
|
+
rules += ' Yd91';
|
|
386
|
+
rules += ' Xb91';
|
|
387
|
+
rules += ' _2b91';
|
|
388
|
+
rules += ' g991';
|
|
389
|
+
rules += ' _je91';
|
|
390
|
+
rules += ' __ca91';
|
|
391
|
+
if (props.isHidden) rules += ' _6b91';
|
|
394
392
|
return rules;
|
|
395
393
|
};
|
|
396
394
|
function $8a2a97a0cb171e69$var$ExpandableRowChevron(props1) {
|
|
@@ -399,16 +397,12 @@ function $8a2a97a0cb171e69$var$ExpandableRowChevron(props1) {
|
|
|
399
397
|
...props1,
|
|
400
398
|
slot: 'chevron'
|
|
401
399
|
}, expandButtonRef, (0, $6K4Mt$reactariacomponents.ButtonContext));
|
|
402
|
-
let { isExpanded: isExpanded,
|
|
400
|
+
let { isExpanded: isExpanded, scale: scale, isHidden: isHidden } = fullProps;
|
|
403
401
|
let { direction: direction } = (0, $6K4Mt$reactaria.useLocale)();
|
|
404
|
-
isDisabled = isDisabled || isHidden;
|
|
405
402
|
return /*#__PURE__*/ (0, $6K4Mt$reactjsxruntime.jsx)((0, $6K4Mt$reactariacomponents.Button), {
|
|
406
403
|
...props1,
|
|
407
404
|
ref: ref,
|
|
408
405
|
slot: "chevron",
|
|
409
|
-
// Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually "focus" it
|
|
410
|
-
excludeFromTabOrder: (0, $6K4Mt$reactariautils.isAndroid)() && !isDisabled,
|
|
411
|
-
preventFocusOnPress: true,
|
|
412
406
|
className: (renderProps)=>$8a2a97a0cb171e69$var$expandButton({
|
|
413
407
|
...renderProps,
|
|
414
408
|
isExpanded: isExpanded,
|
|
@@ -420,20 +414,20 @@ function $8a2a97a0cb171e69$var$ExpandableRowChevron(props1) {
|
|
|
420
414
|
className: function anonymous(props) {
|
|
421
415
|
let rules = " ";
|
|
422
416
|
if (props.direction === "rtl") {
|
|
423
|
-
rules += ' -Z4Pn4c-
|
|
424
|
-
rules += '
|
|
417
|
+
rules += ' -Z4Pn4c-a91';
|
|
418
|
+
rules += ' __Ha91';
|
|
425
419
|
} else if (props.direction === "ltr") {
|
|
426
|
-
rules += ' -Z4Pn4c-
|
|
427
|
-
rules += '
|
|
420
|
+
rules += ' -Z4Pn4c-b91';
|
|
421
|
+
rules += ' __Ha91';
|
|
428
422
|
}
|
|
429
423
|
if (props.direction === "rtl") {
|
|
430
|
-
rules += ' -_04Pn4c-
|
|
431
|
-
rules += '
|
|
424
|
+
rules += ' -_04Pn4c-a91';
|
|
425
|
+
rules += ' __Ha91';
|
|
432
426
|
} else if (props.direction === "ltr") {
|
|
433
|
-
rules += ' -_04Pn4c-
|
|
434
|
-
rules += '
|
|
427
|
+
rules += ' -_04Pn4c-b91';
|
|
428
|
+
rules += ' __Ha91';
|
|
435
429
|
}
|
|
436
|
-
rules += ' -_8sjo0b-
|
|
430
|
+
rules += ' -_8sjo0b-t5ZbAob91';
|
|
437
431
|
return rules;
|
|
438
432
|
}({
|
|
439
433
|
direction: direction
|
package/dist/TreeView.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAsDD,MAAM,0DAAsB,CAA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AC,SAAS,EAAC,GAAG,CAAA,GAAA,0BAAQ;IAC1B,aAAa,cAAc;IAE3B,qBACE,gCAAC,CAAA,GAAA,iCAAK;QACH,GAAG,MAAK;QACT,KAAK;QACL,MAAK;QACL,kHAAkH;QAClH,qBAAqB,CAAA,GAAA,+BAAQ,OAAO,CAAC;QACrC,mBAAmB;QACnB,WAAW,CAAA,cAAe,mCAAa;gBAAC,GAAG,WAAW;4BAAE;gBAAY,OAAO,cAAc;uBAAO;0BAAO;YAAQ;kBAC/G,cAAA,gCAAC,CAAA,GAAA,iCAAM;YACL,WAAW;;;;;;;;;;;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.tsx"],"sourcesContent":["/*\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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps): ReactNode => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: 'calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: 'inherit',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAqDD,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAA4B,CAAC;AAGrE,IAAI,0DAAsB,CAAA,GAAA,0BAAY,EAAkD,CAAC;AAEzF,4KAA4K;AAC5K,gHAAgH;AAChH,sIAAsI;AACtI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBN,SAAS,+BAAS,KAAoB,EAAE,GAA2B;IACjE,IAAI,YAAC,QAAQ,cAAE,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,gBAAE,YAAY,EAAC,GAAG;IAC3E,IAAI,QAAQ,CAAA,GAAA,kCAAO;IAEnB,IAAI;IACJ,IAAI,OAAO,aAAa,YACtB,WAAW;IAGb,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,sCAAU;QACT,QAAQ,CAAA,GAAA,qCAAS;QACjB,eAAe;YACb,WAAW,UAAU,UAAU,KAAK;YACpC,KAAK,aAAa,IAAI;QACxB;kBACA,cAAA,gCAAC,0CAAoB,QAAQ;YAAC,OAAO;0BAAC;YAAQ;sBAC5C,cAAA,gCAAC,0CAAoB,QAAQ;gBAAC,OAAO;gCAAC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,QAAQ;oCAAgB,SAAS;gCAAI;6BAAE;yBAC7D;kCACA;;oBAEF,kBAAkB,4BAAc,gCAAC;wBAAI,MAAK;wBAAe,WAAW;;;;;;;;;;;;;;;;;0BAAsD;4BAAC,gBAAgB;wBAAI;;;;QAGtJ;;AAGN;AAUA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCN,SAAS,2CAAqB,MAAgC;IAC5D,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAAqB;IAChD,IAAI,CAAC,WAAW,IAAI,GAAG,CAAA,GAAA,0CAAc,EAAE;QAAC,GAAG,MAAK;QAAE,MAAM;IAAS,GAAG,iBAAiB,CAAA,GAAA,wCAAY;IACjG,IAAI,cAAC,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAC,GAAG;IACpC,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,0BAAQ;IAE1B,qBACE,gCAAC,CAAA,GAAA,iCAAK;QACH,GAAG,MAAK;QACT,KAAK;QACL,MAAK;QACL,WAAW,CAAA,cAAe,mCAAa;gBAAC,GAAG,WAAW;4BAAE;gBAAY,OAAO,cAAc;uBAAO;0BAAO;YAAQ;kBAC/G,cAAA,gCAAC,CAAA,GAAA,iCAAM;YACL,WAAW;;;;;;;;;;;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.tsx"],"sourcesContent":["/*\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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps): ReactNode => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: 'calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: 'inherit',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.cjs.map"}
|