@primer/components 0.0.0-202111616587 → 0.0.0-2021116181214
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 +11 -0
- package/lib/CheckboxInputField.js +73 -0
- package/lib/ChoiceFieldset/ChoiceFieldCaption.d.ts +3 -0
- package/lib/ChoiceFieldset/ChoiceFieldCaption.js +35 -0
- package/lib/ChoiceFieldset/ChoiceFieldLabel.d.ts +3 -0
- package/lib/ChoiceFieldset/ChoiceFieldLabel.js +35 -0
- package/lib/ChoiceFieldset/ChoiceFieldset.d.ts +65 -0
- package/lib/ChoiceFieldset/ChoiceFieldset.js +95 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +3 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.js +29 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +9 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.js +44 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetList.d.ts +9 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetList.js +69 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +19 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.js +15 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +25 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.js +75 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +6 -0
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.js +17 -0
- package/lib/ChoiceFieldset/index.d.ts +3 -0
- package/lib/ChoiceFieldset/index.js +23 -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 +10 -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 +27 -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 +4 -0
- package/lib/index.js +38 -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 +11 -0
- package/lib-esm/CheckboxInputField.js +56 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.d.ts +3 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.js +20 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.d.ts +3 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.js +20 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.d.ts +65 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.js +72 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +3 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.js +17 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +9 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.js +31 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.d.ts +9 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.js +52 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +19 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.js +5 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +25 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.js +51 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +6 -0
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.js +7 -0
- package/lib-esm/ChoiceFieldset/index.d.ts +3 -0
- package/lib-esm/ChoiceFieldset/index.js +2 -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 +10 -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 +16 -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 +4 -0
- package/lib-esm/index.js +4 -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
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ComponentProps } from '../utils/types';
|
3
|
+
export interface ChoiceFieldProps {
|
4
|
+
/**
|
5
|
+
* Whether the field is ready for user input
|
6
|
+
*/
|
7
|
+
disabled?: boolean;
|
8
|
+
/**
|
9
|
+
* The unique identifier for this field. Used to associate the label, validation text, and caption text.
|
10
|
+
* If an ID is not provided, one will be automatically generated.
|
11
|
+
*/
|
12
|
+
id?: string;
|
13
|
+
/**
|
14
|
+
* The value that is being selected
|
15
|
+
*/
|
16
|
+
value: string;
|
17
|
+
}
|
18
|
+
declare const ChoiceFieldsetListItem: React.FC<ChoiceFieldProps>;
|
19
|
+
export declare type ChoiceFieldComponentProps = ComponentProps<typeof ChoiceFieldsetListItem>;
|
20
|
+
declare const _default: React.FC<ChoiceFieldProps> & {
|
21
|
+
Caption: React.FC<{}>;
|
22
|
+
Label: React.FC<{}>;
|
23
|
+
LeadingVisual: React.FC<{}>;
|
24
|
+
};
|
25
|
+
export default _default;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _uniqueId = require("../utils/uniqueId");
|
11
|
+
|
12
|
+
var _ToggleInputLeadingVisual = _interopRequireDefault(require("../_InputField/ToggleInputLeadingVisual"));
|
13
|
+
|
14
|
+
var _ChoiceFieldCaption = _interopRequireDefault(require("./ChoiceFieldCaption"));
|
15
|
+
|
16
|
+
var _ChoiceFieldLabel = _interopRequireDefault(require("./ChoiceFieldLabel"));
|
17
|
+
|
18
|
+
var _ChoiceFieldsetListContext = _interopRequireDefault(require("./ChoiceFieldsetListContext"));
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
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); }
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
|
26
|
+
const ChoiceFieldsetListItem = ({
|
27
|
+
children,
|
28
|
+
id,
|
29
|
+
disabled: disabledProp,
|
30
|
+
value
|
31
|
+
}) => {
|
32
|
+
const choiceFieldsetListContext = (0, _react.useContext)(_ChoiceFieldsetListContext.default);
|
33
|
+
|
34
|
+
if (choiceFieldsetListContext === null) {
|
35
|
+
throw new Error('ChoiceFieldsetListContext returned null');
|
36
|
+
}
|
37
|
+
|
38
|
+
const {
|
39
|
+
name,
|
40
|
+
onChange,
|
41
|
+
fieldComponent: FieldComponent,
|
42
|
+
selected,
|
43
|
+
disabled,
|
44
|
+
selectionVariant
|
45
|
+
} = choiceFieldsetListContext;
|
46
|
+
const fieldId = id || (0, _uniqueId.uniqueId)();
|
47
|
+
|
48
|
+
const labelChild = _react.default.Children.toArray(children).find(child => /*#__PURE__*/_react.default.isValidElement(child) && child.type === _ChoiceFieldLabel.default);
|
49
|
+
|
50
|
+
const otherValidChildren = _react.default.Children.toArray(children).filter(child => /*#__PURE__*/_react.default.isValidElement(child) && (child.type === _ChoiceFieldCaption.default || child.type === _ToggleInputLeadingVisual.default));
|
51
|
+
|
52
|
+
return /*#__PURE__*/_react.default.createElement(FieldComponent, {
|
53
|
+
id: fieldId,
|
54
|
+
disabled: disabledProp || disabled
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(FieldComponent.Input, {
|
56
|
+
checked: selected === null || selected === void 0 ? void 0 : selected.includes(value),
|
57
|
+
value: value,
|
58
|
+
name: selectionVariant === 'multiple' ? value : name,
|
59
|
+
onChange: onChange
|
60
|
+
}), labelChild ? // if <Item.Label> was passed, we can just render the children as-is
|
61
|
+
children :
|
62
|
+
/*#__PURE__*/
|
63
|
+
// if <Item.Label> was NOT passed, treat all the children except <Item.Caption> and <Item.LeadingVisual> as the label
|
64
|
+
_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(FieldComponent.Label, null, children), otherValidChildren));
|
65
|
+
};
|
66
|
+
|
67
|
+
ChoiceFieldsetListItem.displayName = "ChoiceFieldsetListItem";
|
68
|
+
|
69
|
+
var _default = Object.assign(ChoiceFieldsetListItem, {
|
70
|
+
Caption: _ChoiceFieldCaption.default,
|
71
|
+
Label: _ChoiceFieldLabel.default,
|
72
|
+
LeadingVisual: _ToggleInputLeadingVisual.default
|
73
|
+
});
|
74
|
+
|
75
|
+
exports.default = _default;
|
@@ -0,0 +1,17 @@
|
|
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
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
const ChoiceFieldsetValidation = ({
|
13
|
+
children
|
14
|
+
}) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
15
|
+
|
16
|
+
var _default = ChoiceFieldsetValidation;
|
17
|
+
exports.default = _default;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "default", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _ChoiceFieldset.default;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "Item", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _ChoiceFieldsetListItem.default;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
var _ChoiceFieldset = _interopRequireDefault(require("./ChoiceFieldset"));
|
20
|
+
|
21
|
+
var _ChoiceFieldsetListItem = _interopRequireDefault(require("./ChoiceFieldsetListItem"));
|
22
|
+
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -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,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RadioProps } from '.';
|
3
|
+
import { ToggleInputFieldProps } from './_InputField/ToggleInputField';
|
4
|
+
declare const _default: React.FC<ToggleInputFieldProps> & {
|
5
|
+
Input: React.FC<RadioProps>;
|
6
|
+
Caption: React.FC<{}>;
|
7
|
+
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
8
|
+
LeadingVisual: React.FC<{}>;
|
9
|
+
};
|
10
|
+
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;
|