@primer/components 0.0.0-2021116153325 → 0.0.0-2021116165050
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/browser.esm.js +2 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +3 -3
- package/lib/ActionList/List.js +2 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -1
- package/lib/Autocomplete/AutocompleteMenu.js +11 -23
- package/lib/CheckboxInputField.d.ts +10 -0
- package/lib/CheckboxInputField.js +73 -0
- package/lib/Dialog/ConfirmationDialog.js +2 -2
- package/lib/Dialog/Dialog.js +2 -2
- package/lib/FilteredActionList/FilteredActionList.js +3 -10
- package/lib/Overlay.d.ts +1 -1
- package/lib/RadioInputField.d.ts +9 -0
- package/lib/RadioInputField.js +74 -0
- package/lib/TextInputField.d.ts +583 -0
- package/lib/TextInputField.js +66 -0
- package/lib/TextInputWithTokens.js +4 -4
- package/lib/_InputCaption.d.ts +13 -0
- package/lib/_InputCaption.js +26 -0
- package/lib/_InputField/InputField.d.ts +39 -0
- package/lib/_InputField/InputField.js +90 -0
- package/lib/_InputField/InputFieldCaption.d.ts +3 -0
- package/lib/_InputField/InputFieldCaption.js +30 -0
- package/lib/_InputField/InputFieldLabel.d.ts +9 -0
- package/lib/_InputField/InputFieldLabel.js +34 -0
- package/lib/_InputField/InputFieldValidation.d.ts +6 -0
- package/lib/_InputField/InputFieldValidation.js +17 -0
- package/lib/_InputField/ToggleInputField.d.ts +13 -0
- package/lib/_InputField/ToggleInputField.js +71 -0
- package/lib/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
- package/lib/_InputField/ToggleInputLeadingVisual.js +22 -0
- package/lib/_InputField/ValidationAnimationContainer.d.ts +6 -0
- package/lib/_InputField/ValidationAnimationContainer.js +48 -0
- package/lib/_InputField/index.d.ts +1 -0
- package/lib/_InputField/index.js +15 -0
- package/lib/_InputField/slots.d.ts +13 -0
- package/lib/_InputField/slots.js +17 -0
- package/lib/_InputLabel.d.ts +8 -0
- package/lib/_InputLabel.js +44 -0
- package/lib/_InputValidation.d.ts +8 -0
- package/lib/_InputValidation.js +56 -0
- package/lib/_VisuallyHidden.d.ts +6 -0
- package/lib/_VisuallyHidden.js +39 -0
- package/lib/behaviors/anchoredPosition.d.ts +89 -0
- package/lib/behaviors/anchoredPosition.js +316 -0
- package/lib/behaviors/focusTrap.d.ts +12 -0
- package/lib/behaviors/focusTrap.js +179 -0
- package/lib/behaviors/focusZone.d.ts +137 -0
- package/lib/behaviors/focusZone.js +578 -0
- package/lib/behaviors/scrollIntoViewingArea.d.ts +1 -0
- package/lib/behaviors/scrollIntoViewingArea.js +39 -0
- package/lib/hooks/useAnchoredPosition.d.ts +1 -1
- package/lib/hooks/useAnchoredPosition.js +2 -2
- package/lib/hooks/useFocusTrap.js +2 -2
- package/lib/hooks/useFocusZone.d.ts +1 -1
- package/lib/hooks/useFocusZone.js +2 -2
- package/lib/hooks/useOpenAndCloseFocus.js +2 -2
- package/lib/index.d.ts +3 -0
- package/lib/index.js +24 -0
- package/lib/utils/iterateFocusableElements.d.ts +42 -0
- package/lib/utils/iterateFocusableElements.js +113 -0
- package/lib/utils/types/FormValidationStatus.d.ts +1 -0
- package/lib/utils/types/FormValidationStatus.js +1 -0
- package/lib/utils/uniqueId.d.ts +1 -0
- package/lib/utils/uniqueId.js +12 -0
- package/lib/utils/userAgent.d.ts +1 -0
- package/lib/utils/userAgent.js +15 -0
- package/lib-esm/ActionList/Item.js +1 -1
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -1
- package/lib-esm/Autocomplete/AutocompleteMenu.js +7 -22
- package/lib-esm/CheckboxInputField.d.ts +10 -0
- package/lib-esm/CheckboxInputField.js +56 -0
- package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
- package/lib-esm/Dialog/Dialog.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +3 -9
- package/lib-esm/Overlay.d.ts +1 -1
- package/lib-esm/RadioInputField.d.ts +9 -0
- package/lib-esm/RadioInputField.js +56 -0
- package/lib-esm/TextInputField.d.ts +583 -0
- package/lib-esm/TextInputField.js +50 -0
- package/lib-esm/TextInputWithTokens.js +2 -2
- package/lib-esm/_InputCaption.d.ts +13 -0
- package/lib-esm/_InputCaption.js +15 -0
- package/lib-esm/_InputField/InputField.d.ts +39 -0
- package/lib-esm/_InputField/InputField.js +70 -0
- package/lib-esm/_InputField/InputFieldCaption.d.ts +3 -0
- package/lib-esm/_InputField/InputFieldCaption.js +18 -0
- package/lib-esm/_InputField/InputFieldLabel.d.ts +9 -0
- package/lib-esm/_InputField/InputFieldLabel.js +22 -0
- package/lib-esm/_InputField/InputFieldValidation.d.ts +6 -0
- package/lib-esm/_InputField/InputFieldValidation.js +7 -0
- package/lib-esm/_InputField/ToggleInputField.d.ts +13 -0
- package/lib-esm/_InputField/ToggleInputField.js +54 -0
- package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
- package/lib-esm/_InputField/ToggleInputLeadingVisual.js +11 -0
- package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +6 -0
- package/lib-esm/_InputField/ValidationAnimationContainer.js +33 -0
- package/lib-esm/_InputField/index.d.ts +1 -0
- package/lib-esm/_InputField/index.js +1 -0
- package/lib-esm/_InputField/slots.d.ts +13 -0
- package/lib-esm/_InputField/slots.js +5 -0
- package/lib-esm/_InputLabel.d.ts +8 -0
- package/lib-esm/_InputLabel.js +32 -0
- package/lib-esm/_InputValidation.d.ts +8 -0
- package/lib-esm/_InputValidation.js +43 -0
- package/lib-esm/_VisuallyHidden.d.ts +6 -0
- package/lib-esm/_VisuallyHidden.js +26 -0
- package/lib-esm/behaviors/anchoredPosition.d.ts +89 -0
- package/lib-esm/behaviors/anchoredPosition.js +309 -0
- package/lib-esm/behaviors/focusTrap.d.ts +12 -0
- package/lib-esm/behaviors/focusTrap.js +170 -0
- package/lib-esm/behaviors/focusZone.d.ts +137 -0
- package/lib-esm/behaviors/focusZone.js +560 -0
- package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +1 -0
- package/lib-esm/behaviors/scrollIntoViewingArea.js +30 -0
- package/lib-esm/hooks/useAnchoredPosition.d.ts +1 -1
- package/lib-esm/hooks/useAnchoredPosition.js +1 -1
- package/lib-esm/hooks/useFocusTrap.js +1 -1
- package/lib-esm/hooks/useFocusZone.d.ts +1 -1
- package/lib-esm/hooks/useFocusZone.js +1 -1
- package/lib-esm/hooks/useOpenAndCloseFocus.js +1 -1
- package/lib-esm/index.d.ts +3 -0
- package/lib-esm/index.js +3 -0
- package/lib-esm/utils/iterateFocusableElements.d.ts +42 -0
- package/lib-esm/utils/iterateFocusableElements.js +102 -0
- package/lib-esm/utils/types/FormValidationStatus.d.ts +1 -0
- package/lib-esm/utils/types/FormValidationStatus.js +1 -0
- package/lib-esm/utils/uniqueId.d.ts +1 -0
- package/lib-esm/utils/uniqueId.js +5 -0
- package/lib-esm/utils/userAgent.d.ts +1 -0
- package/lib-esm/utils/userAgent.js +8 -0
- package/package.json +6 -3
package/lib/ActionList/Item.js
CHANGED
@@ -23,7 +23,7 @@ var _Divider = require("./Divider");
|
|
23
23
|
|
24
24
|
var _ThemeProvider = require("../ThemeProvider");
|
25
25
|
|
26
|
-
var
|
26
|
+
var _focusZone = require("../behaviors/focusZone");
|
27
27
|
|
28
28
|
var _ssr = require("@react-aria/ssr");
|
29
29
|
|
@@ -98,10 +98,10 @@ const StyledItem = _styledComponents.default.div.withConfig({
|
|
98
98
|
showDivider
|
99
99
|
}) => showDivider ? `1px` : '0', DividedContent, (0, _constants.get)('colors.border.muted'), ({
|
100
100
|
showDivider
|
101
|
-
}) => showDivider ? `1px` : '0', DividedContent, DividedContent, DividedContent, DividedContent,
|
101
|
+
}) => showDivider ? `1px` : '0', DividedContent, DividedContent, DividedContent, DividedContent, _focusZone.isActiveDescendantAttribute, DividedContent, _focusZone.isActiveDescendantAttribute, DividedContent, _focusZone.isActiveDescendantAttribute, _focusZone.activeDescendantActivatedDirectly, ({
|
102
102
|
variant,
|
103
103
|
item
|
104
|
-
}) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg,
|
104
|
+
}) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg, _focusZone.isActiveDescendantAttribute, _focusZone.activeDescendantActivatedIndirectly, ({
|
105
105
|
variant,
|
106
106
|
item
|
107
107
|
}) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).hoverBg, ({
|
package/lib/ActionList/List.js
CHANGED
@@ -17,7 +17,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
17
|
|
18
18
|
var _constants = require("../constants");
|
19
19
|
|
20
|
-
var
|
20
|
+
var _focusZone = require("../behaviors/focusZone");
|
21
21
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
23
|
|
@@ -38,7 +38,7 @@ function isGroupedListProps(props) {
|
|
38
38
|
const StyledList = _styledComponents.default.div.withConfig({
|
39
39
|
displayName: "List__StyledList",
|
40
40
|
componentId: "sc-yr2k7d-0"
|
41
|
-
})(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], (0, _constants.get)('fontSizes.1'),
|
41
|
+
})(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], (0, _constants.get)('fontSizes.1'), _focusZone.hasActiveDescendantAttribute, (0, _constants.get)('colors.border.muted'));
|
42
42
|
/**
|
43
43
|
* Returns `sx` prop values for `List` children matching the given `List` style variation.
|
44
44
|
* @param variant `List` style variation.
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import { OverlayProps } from '../Overlay';
|
3
3
|
import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
|
4
4
|
import { FocusZoneHookSettings } from '../hooks/useFocusZone';
|
5
|
-
import
|
5
|
+
import { PositionSettings } from '../behaviors/anchoredPosition';
|
6
6
|
interface AnchoredOverlayPropsWithAnchor {
|
7
7
|
/**
|
8
8
|
* A custom function component used to render the anchor element.
|
@@ -17,9 +17,13 @@ var _AutocompleteContext = require("./AutocompleteContext");
|
|
17
17
|
|
18
18
|
var _octiconsReact = require("@primer/octicons-react");
|
19
19
|
|
20
|
-
var
|
20
|
+
var _uniqueId = require("../utils/uniqueId");
|
21
21
|
|
22
|
-
var
|
22
|
+
var _scrollIntoViewingArea = require("../behaviors/scrollIntoViewingArea");
|
23
|
+
|
24
|
+
var _VisuallyHidden = _interopRequireDefault(require("../_VisuallyHidden"));
|
25
|
+
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
27
|
|
24
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
29
|
|
@@ -27,11 +31,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
27
31
|
|
28
32
|
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
29
33
|
|
30
|
-
const menuScrollMargins = {
|
31
|
-
startMargin: 0,
|
32
|
-
endMargin: 8
|
33
|
-
};
|
34
|
-
|
35
34
|
function getDefaultItemFilter(filterValue) {
|
36
35
|
return function (item, _i) {
|
37
36
|
var _item$text;
|
@@ -130,7 +129,7 @@ function AutocompleteMenu(props) {
|
|
130
129
|
onAction: item => {
|
131
130
|
// TODO: make it possible to pass a leadingVisual when using `addNewItem`
|
132
131
|
addNewItem.handleAddItem({ ...item,
|
133
|
-
id: item.id || (0,
|
132
|
+
id: item.id || (0, _uniqueId.uniqueId)(),
|
134
133
|
leadingVisual: undefined
|
135
134
|
});
|
136
135
|
|
@@ -157,9 +156,9 @@ function AutocompleteMenu(props) {
|
|
157
156
|
}
|
158
157
|
|
159
158
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) {
|
160
|
-
(0,
|
159
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, customScrollContainerRef.current);
|
161
160
|
} else if (current && scrollContainerRef.current && directlyActivated) {
|
162
|
-
(0,
|
161
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
|
163
162
|
}
|
164
163
|
}
|
165
164
|
}, [loading]);
|
@@ -187,19 +186,8 @@ function AutocompleteMenu(props) {
|
|
187
186
|
setSelectedItemLength(selectedItemIds.length);
|
188
187
|
}
|
189
188
|
}, [selectedItemIds, setSelectedItemLength]);
|
190
|
-
return /*#__PURE__*/_react.default.createElement(
|
191
|
-
|
192
|
-
// visually hides this label for sighted users
|
193
|
-
position: 'absolute',
|
194
|
-
width: '1px',
|
195
|
-
height: '1px',
|
196
|
-
padding: '0',
|
197
|
-
margin: '-1px',
|
198
|
-
overflow: 'hidden',
|
199
|
-
clip: 'rect(0, 0, 0, 0)',
|
200
|
-
whiteSpace: 'nowrap',
|
201
|
-
borderWidth: '0'
|
202
|
-
} : {}
|
189
|
+
return /*#__PURE__*/_react.default.createElement(_VisuallyHidden.default, {
|
190
|
+
isVisible: showMenu
|
203
191
|
}, loading ? /*#__PURE__*/_react.default.createElement(_.Box, {
|
204
192
|
p: 3,
|
205
193
|
display: "flex",
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: React.FC<import("./_InputField/ToggleInputField").Props> & {
|
3
|
+
Input: React.FC<Omit<React.HTMLProps<HTMLInputElement>, "ref"> & {
|
4
|
+
ref?: React.Ref<HTMLInputElement> | undefined;
|
5
|
+
}>;
|
6
|
+
Caption: React.FC<{}>;
|
7
|
+
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
8
|
+
LeadingVisual: React.FC<{}>;
|
9
|
+
};
|
10
|
+
export default _default;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _ = require(".");
|
11
|
+
|
12
|
+
var _InputField = _interopRequireDefault(require("./_InputField/InputField"));
|
13
|
+
|
14
|
+
var _slots = require("./_InputField/slots");
|
15
|
+
|
16
|
+
var _ToggleInputField = _interopRequireDefault(require("./_InputField/ToggleInputField"));
|
17
|
+
|
18
|
+
var _ToggleInputLeadingVisual = _interopRequireDefault(require("./_InputField/ToggleInputLeadingVisual"));
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
+
|
24
|
+
const Input = ({
|
25
|
+
id: idProp,
|
26
|
+
required: requiredProp,
|
27
|
+
disabled: disabledProp,
|
28
|
+
...rest
|
29
|
+
}) => {
|
30
|
+
if (idProp) {
|
31
|
+
// eslint-disable-next-line no-console
|
32
|
+
console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
33
|
+
}
|
34
|
+
|
35
|
+
if (disabledProp) {
|
36
|
+
// eslint-disable-next-line no-console
|
37
|
+
console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
38
|
+
}
|
39
|
+
|
40
|
+
if (requiredProp) {
|
41
|
+
// eslint-disable-next-line no-console
|
42
|
+
console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
43
|
+
}
|
44
|
+
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_slots.Slot, {
|
46
|
+
name: "Input"
|
47
|
+
}, ({
|
48
|
+
disabled,
|
49
|
+
id,
|
50
|
+
required,
|
51
|
+
captionId
|
52
|
+
}) => /*#__PURE__*/_react.default.createElement(_.Checkbox, _extends({
|
53
|
+
"aria-describedby": captionId,
|
54
|
+
id: id,
|
55
|
+
required: required,
|
56
|
+
disabled: disabled
|
57
|
+
}, rest)));
|
58
|
+
};
|
59
|
+
|
60
|
+
Input.displayName = "Input";
|
61
|
+
|
62
|
+
const CheckboxInputField = props => /*#__PURE__*/_react.default.createElement(_ToggleInputField.default, props);
|
63
|
+
|
64
|
+
CheckboxInputField.displayName = "CheckboxInputField";
|
65
|
+
|
66
|
+
var _default = Object.assign(CheckboxInputField, {
|
67
|
+
Input,
|
68
|
+
Caption: _InputField.default.Caption,
|
69
|
+
Label: _InputField.default.Label,
|
70
|
+
LeadingVisual: _ToggleInputLeadingVisual.default
|
71
|
+
});
|
72
|
+
|
73
|
+
exports.default = _default;
|
@@ -16,7 +16,7 @@ var _Box = _interopRequireDefault(require("../Box"));
|
|
16
16
|
|
17
17
|
var _ThemeProvider = require("../ThemeProvider");
|
18
18
|
|
19
|
-
var
|
19
|
+
var _focusZone = require("../behaviors/focusZone");
|
20
20
|
|
21
21
|
var _constants = require("../constants");
|
22
22
|
|
@@ -81,7 +81,7 @@ const ConfirmationFooter = ({
|
|
81
81
|
const {
|
82
82
|
containerRef: footerRef
|
83
83
|
} = (0, _useFocusZone.useFocusZone)({
|
84
|
-
bindKeys:
|
84
|
+
bindKeys: _focusZone.FocusKeys.ArrowHorizontal | _focusZone.FocusKeys.Tab,
|
85
85
|
focusInStrategy: 'closest'
|
86
86
|
}); // Must have exactly 2 buttons!
|
87
87
|
|
package/lib/Dialog/Dialog.js
CHANGED
@@ -27,7 +27,7 @@ var _octiconsReact = require("@primer/octicons-react");
|
|
27
27
|
|
28
28
|
var _useFocusZone = require("../hooks/useFocusZone");
|
29
29
|
|
30
|
-
var
|
30
|
+
var _focusZone = require("../behaviors/focusZone");
|
31
31
|
|
32
32
|
var _Portal = _interopRequireDefault(require("../Portal"));
|
33
33
|
|
@@ -121,7 +121,7 @@ const DefaultFooter = ({
|
|
121
121
|
const {
|
122
122
|
containerRef: footerRef
|
123
123
|
} = (0, _useFocusZone.useFocusZone)({
|
124
|
-
bindKeys:
|
124
|
+
bindKeys: _focusZone.FocusKeys.ArrowHorizontal | _focusZone.FocusKeys.Tab,
|
125
125
|
focusInStrategy: 'closest'
|
126
126
|
});
|
127
127
|
return footerButtons ? /*#__PURE__*/_react.default.createElement(Dialog.Footer, {
|
@@ -29,7 +29,7 @@ var _useProvidedRefOrCreate = require("../hooks/useProvidedRefOrCreate");
|
|
29
29
|
|
30
30
|
var _useScrollFlash = _interopRequireDefault(require("../hooks/useScrollFlash"));
|
31
31
|
|
32
|
-
var
|
32
|
+
var _scrollIntoViewingArea = require("../behaviors/scrollIntoViewingArea");
|
33
33
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
35
|
|
@@ -39,11 +39,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
39
39
|
|
40
40
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
41
41
|
|
42
|
-
const menuScrollMargins = {
|
43
|
-
startMargin: 0,
|
44
|
-
endMargin: 8
|
45
|
-
};
|
46
|
-
|
47
42
|
const StyledHeader = _styledComponents.default.div.withConfig({
|
48
43
|
displayName: "FilteredActionList__StyledHeader",
|
49
44
|
componentId: "sc-yg3jkv-0"
|
@@ -91,7 +86,7 @@ function FilteredActionList({
|
|
91
86
|
activeDescendantRef.current = current;
|
92
87
|
|
93
88
|
if (current && scrollContainerRef.current && directlyActivated) {
|
94
|
-
(0,
|
89
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
|
95
90
|
}
|
96
91
|
}
|
97
92
|
}, [// List ref isn't set while loading. Need to re-bind focus zone when it changes
|
@@ -99,9 +94,7 @@ function FilteredActionList({
|
|
99
94
|
(0, _react.useEffect)(() => {
|
100
95
|
// if items changed, we want to instantly move active descendant into view
|
101
96
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
102
|
-
(0,
|
103
|
-
behavior: 'auto'
|
104
|
-
});
|
97
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
|
105
98
|
}
|
106
99
|
}, [items]);
|
107
100
|
(0, _useScrollFlash.default)(scrollContainerRef);
|
package/lib/Overlay.d.ts
CHANGED
@@ -2,7 +2,7 @@ import React, { ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { AriaRole, Merge } from './utils/types';
|
3
3
|
import { TouchOrMouseEvent } from './hooks';
|
4
4
|
import { SxProp } from './sx';
|
5
|
-
import
|
5
|
+
import { AnchorSide } from './behaviors/anchoredPosition';
|
6
6
|
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
|
7
7
|
declare type StyledOverlayProps = {
|
8
8
|
width?: keyof typeof widthMap;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RadioProps } from '.';
|
3
|
+
declare const _default: React.FC<import("./_InputField/ToggleInputField").Props> & {
|
4
|
+
Input: React.FC<RadioProps>;
|
5
|
+
Caption: React.FC<{}>;
|
6
|
+
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
7
|
+
LeadingVisual: React.FC<{}>;
|
8
|
+
};
|
9
|
+
export default _default;
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _ = require(".");
|
11
|
+
|
12
|
+
var _InputField = _interopRequireDefault(require("./_InputField/InputField"));
|
13
|
+
|
14
|
+
var _slots = require("./_InputField/slots");
|
15
|
+
|
16
|
+
var _ToggleInputField = _interopRequireDefault(require("./_InputField/ToggleInputField"));
|
17
|
+
|
18
|
+
var _ToggleInputLeadingVisual = _interopRequireDefault(require("./_InputField/ToggleInputLeadingVisual"));
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
+
|
24
|
+
// pulling out `id`, `disabled`, and `required` because those should come from the parent TextInputField component
|
25
|
+
const Input = ({
|
26
|
+
id: idProp,
|
27
|
+
required: requiredProp,
|
28
|
+
disabled: disabledProp,
|
29
|
+
...rest
|
30
|
+
}) => {
|
31
|
+
if (idProp) {
|
32
|
+
// eslint-disable-next-line no-console
|
33
|
+
console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
34
|
+
}
|
35
|
+
|
36
|
+
if (disabledProp) {
|
37
|
+
// eslint-disable-next-line no-console
|
38
|
+
console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
39
|
+
}
|
40
|
+
|
41
|
+
if (requiredProp) {
|
42
|
+
// eslint-disable-next-line no-console
|
43
|
+
console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
44
|
+
}
|
45
|
+
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_slots.Slot, {
|
47
|
+
name: "Input"
|
48
|
+
}, ({
|
49
|
+
disabled,
|
50
|
+
id,
|
51
|
+
required,
|
52
|
+
captionId
|
53
|
+
}) => /*#__PURE__*/_react.default.createElement(_.Radio, _extends({
|
54
|
+
"aria-describedby": captionId,
|
55
|
+
id: id,
|
56
|
+
required: required,
|
57
|
+
disabled: disabled
|
58
|
+
}, rest)));
|
59
|
+
};
|
60
|
+
|
61
|
+
Input.displayName = "Input";
|
62
|
+
|
63
|
+
const RadioInputField = props => /*#__PURE__*/_react.default.createElement(_ToggleInputField.default, props);
|
64
|
+
|
65
|
+
RadioInputField.displayName = "RadioInputField";
|
66
|
+
|
67
|
+
var _default = Object.assign(RadioInputField, {
|
68
|
+
Input,
|
69
|
+
Caption: _InputField.default.Caption,
|
70
|
+
Label: _InputField.default.Label,
|
71
|
+
LeadingVisual: _ToggleInputLeadingVisual.default
|
72
|
+
});
|
73
|
+
|
74
|
+
exports.default = _default;
|