@procore/core-react 11.14.0 → 11.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Form/closeWithConfirm.js +1 -1
- package/dist/Form/closeWithConfirm.js.map +1 -1
- package/dist/Modal/ChildRegistry.context.d.ts +19 -0
- package/dist/Modal/ChildRegistry.context.js +44 -0
- package/dist/Modal/ChildRegistry.context.js.map +1 -0
- package/dist/Modal/Modal.js +40 -16
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/Modal/useInitializeModalFocus.d.ts +7 -0
- package/dist/Modal/useInitializeModalFocus.js +34 -0
- package/dist/Modal/useInitializeModalFocus.js.map +1 -0
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +22 -22
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +13 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +11 -11
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +7 -7
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +4 -4
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +29 -29
- package/dist/_typedoc/Dropzone/Dropzone.types.json +41 -41
- package/dist/_typedoc/EmptyState/EmptyState.types.json +14 -14
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +26 -26
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +698 -698
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +4 -4
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +71 -71
- package/dist/_typedoc/Modal/Modal.types.json +41 -41
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +38 -38
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +30 -30
- package/dist/_typedoc/PageLayout/PageLayout.types.json +22 -22
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +27 -27
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +46 -46
- package/dist/_typedoc/Popover/Popover.types.json +12 -12
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +6 -6
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +18 -18
- package/dist/_typedoc/Section/Section.types.json +14 -14
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +20 -20
- package/dist/_typedoc/Select/Select.types.json +32 -32
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/Switch/Switch.types.json +3 -3
- package/dist/_typedoc/Table/Table.types.json +94 -94
- package/dist/_typedoc/Tabs/Tabs.types.json +17 -17
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +16 -16
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +9 -9
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +42 -42
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +30 -30
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +3 -3
- package/dist/_typedoc/Token/Token.types.json +4 -4
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +86 -86
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +8 -8
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_utils/CalendarHelpers.js +1 -1
- package/dist/_utils/CalendarHelpers.js.map +1 -1
- package/package.json +6 -6
|
@@ -29,7 +29,7 @@ export var useCloseWithConfirmState = function () {
|
|
|
29
29
|
export var CloseWithConfirmContext = React.createContext({
|
|
30
30
|
setFormIsDifferent: function () { },
|
|
31
31
|
// @ts-ignore
|
|
32
|
-
closeWithConfirm: function () { return
|
|
32
|
+
closeWithConfirm: function (onClose) { return onClose; },
|
|
33
33
|
});
|
|
34
34
|
export var useCloseWithConfirmContext = function () {
|
|
35
35
|
return React.useContext(CloseWithConfirmContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closeWithConfirm.js","sourceRoot":"","sources":["../../src/Form/closeWithConfirm.tsx"],"names":[],"mappings":"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AAc,EAAE,CAAA;IACvB,IAAA,KAAwC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA5D,eAAe,QAAA,EAAE,kBAAkB,QAAyB,CAAA;IAEnE,IAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACxC,UAAC,OAA6B;QAC5B,OAAA,OAAO;YACL,CAAC,CAAC;gBAAC,cAAc;qBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,yBAAc;;gBACb,IAAI,eAAe,IAAI,OAAO,EAAE;oBAC9B,IACE,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,CAAC,CAAC,2CAA2C,CAAC,CACpD,EACD;wBACA,OAAO,OAAO,eAAI,IAAI,EAAC;qBACxB;iBACF;qBAAM;oBACL,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,eAAM,IAAI,CAAC,CAAA;iBAC1B;YACH,CAAC;YACH,CAAC,CAAC,SAAS;IAdb,CAca,EACf,CAAC,eAAe,CAAC,CACyC,CAAA;IAE5D,OAAO;QACL,gBAAgB,kBAAA;QAChB,kBAAkB,oBAAA;KACnB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,uBAAuB,GAClC,KAAK,CAAC,aAAa,CAA2B;IAC5C,kBAAkB,EAAE,cAAO,CAAC;IAC5B,aAAa;IACb,gBAAgB,EAAE,UAAC,OAAO,IAAK,OAAA,OAAO,EAAP,CAAO;CACvC,CAAC,CAAA;AAEJ,MAAM,CAAC,IAAM,0BAA0B,GAAG;IACxC,OAAO,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAA;AAClD,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the children of the modal, primarily for managing focus
|
|
4
|
+
*/
|
|
5
|
+
interface ChildRegistry {
|
|
6
|
+
header?: React.RefObject<HTMLDivElement>;
|
|
7
|
+
body?: React.RefObject<HTMLDivElement>;
|
|
8
|
+
closeableButtons?: React.RefObject<HTMLDivElement>;
|
|
9
|
+
}
|
|
10
|
+
interface ChildToRegister {
|
|
11
|
+
child: keyof ChildRegistry;
|
|
12
|
+
ref: React.MutableRefObject<null>;
|
|
13
|
+
}
|
|
14
|
+
export declare function ChildRegistryProvider({ children, }: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
export declare function useModalChildRegistryContext(): ChildRegistry;
|
|
18
|
+
export declare function useModalChildRegistryDispatch(): React.Dispatch<ChildToRegister>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
var ChildRegistryContext = React.createContext({});
|
|
14
|
+
var ChildRegistryDispatch = React.createContext(function (childToRegister) { return ({}); });
|
|
15
|
+
var initState = {
|
|
16
|
+
header: undefined,
|
|
17
|
+
body: undefined,
|
|
18
|
+
closeableButtons: undefined,
|
|
19
|
+
};
|
|
20
|
+
function registerChild(state, childToRegister) {
|
|
21
|
+
var _a;
|
|
22
|
+
return __assign(__assign({}, state), (_a = {}, _a[childToRegister.child] = childToRegister.ref, _a));
|
|
23
|
+
}
|
|
24
|
+
export function ChildRegistryProvider(_a) {
|
|
25
|
+
var children = _a.children;
|
|
26
|
+
var _b = React.useReducer(registerChild, initState), state = _b[0], dispatch = _b[1];
|
|
27
|
+
return (React.createElement(ChildRegistryContext.Provider, { value: state },
|
|
28
|
+
React.createElement(ChildRegistryDispatch.Provider, { value: dispatch }, children)));
|
|
29
|
+
}
|
|
30
|
+
export function useModalChildRegistryContext() {
|
|
31
|
+
var context = React.useContext(ChildRegistryContext);
|
|
32
|
+
if (!context) {
|
|
33
|
+
throw new Error('useModalChildRegistryContext must be used within a ChildRegistryProvider');
|
|
34
|
+
}
|
|
35
|
+
return context;
|
|
36
|
+
}
|
|
37
|
+
export function useModalChildRegistryDispatch() {
|
|
38
|
+
var context = React.useContext(ChildRegistryDispatch);
|
|
39
|
+
if (!context) {
|
|
40
|
+
throw new Error('useModalChildRegistryDispatch must be used within a ChildRegistryProvider');
|
|
41
|
+
}
|
|
42
|
+
return context;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ChildRegistry.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildRegistry.context.js","sourceRoot":"","sources":["../../src/Modal/ChildRegistry.context.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,IAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAgB,EAAE,CAAC,CAAA;AACnE,IAAM,qBAAqB,GAAG,KAAK,CAAC,aAAa,CAE/C,UAAC,eAAgC,IAAK,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,CAAC,CAAA;AAW7C,IAAM,SAAS,GAAkB;IAC/B,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,SAAS;CAC5B,CAAA;AAOD,SAAS,aAAa,CAAC,KAAoB,EAAE,eAAgC;;IAC3E,6BACK,KAAK,gBACP,eAAe,CAAC,KAAK,IAAG,eAAe,CAAC,GAAG,OAC7C;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,EAIrC;QAHC,QAAQ,cAAA;IAIF,IAAA,KAAoB,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,EAA7D,KAAK,QAAA,EAAE,QAAQ,QAA8C,CAAA;IACpE,OAAO,CACL,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK;QACzC,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,IAC5C,QAAQ,CACsB,CACH,CACjC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IACtD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,6BAA6B;IAC3C,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAA;IACvD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAA;KACF;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/Modal/Modal.js
CHANGED
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { Clear } from '@procore/core-icons/dist';
|
|
24
24
|
import { FocusScope } from '@react-aria/focus';
|
|
25
|
-
import React from 'react';
|
|
25
|
+
import React, { useEffect } from 'react';
|
|
26
26
|
import { Button } from '../Button/Button';
|
|
27
27
|
import { CloseWithConfirmContext, useCloseWithConfirmContext, useCloseWithConfirmState, } from '../Form/closeWithConfirm';
|
|
28
28
|
import { useModalDialogLike } from '../OverlayTrigger/a11yPresets';
|
|
@@ -36,7 +36,9 @@ import { useScrollLock } from '../_hooks/ScrollLock';
|
|
|
36
36
|
import { Visibility } from '../_hooks/Visibility';
|
|
37
37
|
import { addSubcomponents } from '../_utils/addSubcomponents';
|
|
38
38
|
import { mergeRefs } from '../_utils/mergeRefs';
|
|
39
|
+
import { ChildRegistryProvider, useModalChildRegistryDispatch, } from './ChildRegistry.context';
|
|
39
40
|
import { fadeInClassName, fadeOutClassName, StyledModal, StyledModalBody, StyledModalButtons, StyledModalCancel, StyledModalContainer, StyledModalContent, StyledModalFooter, StyledModalFooterNotation, StyledModalFooterSummary, StyledModalHeader, StyledModalHeading, StyledModalScrim, StyledModalWarningIcon, } from './Modal.styles';
|
|
41
|
+
import { useInitializeModalFocus } from './useInitializeModalFocus';
|
|
40
42
|
function noop() { }
|
|
41
43
|
var defaultStartLevel = 2;
|
|
42
44
|
var initialBodyLevel = 3;
|
|
@@ -55,7 +57,12 @@ var ModalClosableHeader = React.forwardRef(function (_a, ref) {
|
|
|
55
57
|
var isBodyScrolled = React.useContext(ModalBodyScrollContext).isBodyScrolled;
|
|
56
58
|
var _b = React.useContext(ModalCloseContext), howToClose = _b.howToClose, onClose = _b.onClose;
|
|
57
59
|
var I18n = useI18nContext();
|
|
60
|
+
var modalClosableHeaderRef = React.useRef(null);
|
|
58
61
|
var closeWithConfirm = useCloseWithConfirmContext().closeWithConfirm;
|
|
62
|
+
var registerChildRef = useModalChildRegistryDispatch();
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
registerChildRef({ child: 'header', ref: modalClosableHeaderRef });
|
|
65
|
+
}, []);
|
|
59
66
|
function onClickButton(e) {
|
|
60
67
|
if (onClose && (howToClose === null || howToClose === void 0 ? void 0 : howToClose.includes('x'))) {
|
|
61
68
|
closeWithConfirm(onClose)(e, 'x');
|
|
@@ -63,32 +70,48 @@ var ModalClosableHeader = React.forwardRef(function (_a, ref) {
|
|
|
63
70
|
}
|
|
64
71
|
closeWithConfirm(externalOnClose)(e);
|
|
65
72
|
}
|
|
66
|
-
return (React.createElement(StyledModalHeader, __assign({ "$isBodyScrolled": isBodyScrolled }, props, { ref: ref }),
|
|
73
|
+
return (React.createElement(StyledModalHeader, __assign({ "$isBodyScrolled": isBodyScrolled }, props, { ref: mergeRefs(ref, modalClosableHeaderRef) }),
|
|
67
74
|
React.createElement(StyledModalHeading, null, children),
|
|
68
75
|
(onClose && (howToClose === null || howToClose === void 0 ? void 0 : howToClose.includes('x'))) || externalOnClose ? (React.createElement(StyledModalCancel, null,
|
|
69
|
-
React.createElement(Button, { "aria-label": I18n.t('core.modal.a11y.close'), "data-qa": qa === null || qa === void 0 ? void 0 : qa.closeButton, onClick: onClickButton, icon: React.createElement(Clear, null), variant: "tertiary"
|
|
76
|
+
React.createElement(Button, { "aria-label": I18n.t('core.modal.a11y.close'), "data-qa": qa === null || qa === void 0 ? void 0 : qa.closeButton, "data-internal": "close-button", onClick: onClickButton, icon: React.createElement(Clear, null), variant: "tertiary" }))) : null));
|
|
70
77
|
});
|
|
71
78
|
var ModalClosableFooterButtons = React.forwardRef(function (_a, ref) {
|
|
72
79
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
73
80
|
var _b = React.useContext(ModalCloseContext), howToClose = _b.howToClose, onClose = _b.onClose;
|
|
74
81
|
var I18n = useI18nContext();
|
|
75
82
|
var closeWithConfirm = useCloseWithConfirmContext().closeWithConfirm;
|
|
83
|
+
var modalClosableFooterButtonsRef = React.useRef(null);
|
|
84
|
+
var registerChildRef = useModalChildRegistryDispatch();
|
|
85
|
+
useEffect(function () {
|
|
86
|
+
registerChildRef({
|
|
87
|
+
child: 'closeableButtons',
|
|
88
|
+
ref: modalClosableFooterButtonsRef,
|
|
89
|
+
});
|
|
90
|
+
}, []);
|
|
76
91
|
function onClickButton(e) {
|
|
77
92
|
closeWithConfirm(onClose)(e, 'footer-button');
|
|
78
93
|
}
|
|
79
|
-
return (React.createElement(StyledModalButtons, __assign({}, props, { ref: ref }),
|
|
94
|
+
return (React.createElement(StyledModalButtons, __assign({}, props, { ref: mergeRefs(ref, modalClosableFooterButtonsRef) }),
|
|
80
95
|
(howToClose === null || howToClose === void 0 ? void 0 : howToClose.includes('footer-button')) && (React.createElement(Button, { onClick: onClickButton, variant: "tertiary" }, I18n.t('core.modal.cancel'))),
|
|
81
96
|
children));
|
|
82
97
|
});
|
|
83
98
|
var ModalContainer = React.forwardRef(function (_a, ref) {
|
|
84
99
|
var placement = _a.placement, width = _a.width, props = __rest(_a, ["placement", "width"]);
|
|
85
|
-
|
|
100
|
+
var onClose = React.useContext(ModalCloseContext).onClose;
|
|
101
|
+
var modalContainerRef = React.useRef(null);
|
|
102
|
+
useInitializeModalFocus({ modalContainerRef: modalContainerRef, hasOnClose: !!onClose });
|
|
103
|
+
return (React.createElement(StyledModalContainer, __assign({}, props, { shadowStrength: 4, "$placement": placement, "$width": width, ref: mergeRefs(ref, modalContainerRef) })));
|
|
86
104
|
});
|
|
87
105
|
var ModalBody = React.forwardRef(function (_a, ref) {
|
|
88
106
|
var children = _a.children, _b = _a.noSideSpacing, noSideSpacing = _b === void 0 ? false : _b, props = __rest(_a, ["children", "noSideSpacing"]);
|
|
89
107
|
var _c = useOverflowObserver(), isOverflowingY = _c.isOverflowingY, overflowRef = _c.ref;
|
|
90
108
|
var scrollRef = React.useRef(null);
|
|
109
|
+
var modalBodyRef = React.useRef(null);
|
|
91
110
|
var setIsBodyScrolled = React.useContext(ModalBodyScrollContext).setIsBodyScrolled;
|
|
111
|
+
var registerChildRef = useModalChildRegistryDispatch();
|
|
112
|
+
useEffect(function () {
|
|
113
|
+
registerChildRef({ child: 'body', ref: modalBodyRef });
|
|
114
|
+
}, []);
|
|
92
115
|
useLayoutEventListener({
|
|
93
116
|
event: 'scroll',
|
|
94
117
|
handler: function (e) {
|
|
@@ -98,7 +121,7 @@ var ModalBody = React.forwardRef(function (_a, ref) {
|
|
|
98
121
|
});
|
|
99
122
|
return (React.createElement(SectionProvider, null,
|
|
100
123
|
React.createElement(LevelContext.Provider, { value: initialBodyLevel },
|
|
101
|
-
React.createElement(StyledModalBody, __assign({}, props, { isOverflowingY: isOverflowingY, noSideSpacing: noSideSpacing, ref: mergeRefs(overflowRef, scrollRef, ref) }), children))));
|
|
124
|
+
React.createElement(StyledModalBody, __assign({}, props, { isOverflowingY: isOverflowingY, noSideSpacing: noSideSpacing, ref: mergeRefs(overflowRef, scrollRef, ref, modalBodyRef), tabIndex: 0 }), children))));
|
|
102
125
|
});
|
|
103
126
|
var ModalFooterSummary = React.forwardRef(function (_a, ref) {
|
|
104
127
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
@@ -176,17 +199,18 @@ var Modal_ = React.forwardRef(function (_a, ref) {
|
|
|
176
199
|
return visible ? (React.createElement(Portal, null,
|
|
177
200
|
React.createElement(ModalCloseContext.Provider, { value: { onClose: onClose, howToClose: howToClose } },
|
|
178
201
|
React.createElement(LevelContext.Provider, { value: defaultStartLevel },
|
|
179
|
-
React.createElement(
|
|
180
|
-
|
|
181
|
-
, {
|
|
202
|
+
React.createElement(ChildRegistryProvider, null,
|
|
203
|
+
React.createElement(FocusScope
|
|
182
204
|
// TODO breaking - always
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
React.createElement(
|
|
187
|
-
React.createElement(
|
|
188
|
-
|
|
189
|
-
|
|
205
|
+
, {
|
|
206
|
+
// TODO breaking - always
|
|
207
|
+
autoFocus: !!onClose, contain: !!onClose, restoreFocus: !!onClose },
|
|
208
|
+
React.createElement(StyledModal, __assign({ className: fadeType, ref: ref, onTransitionEnd: onTransitionEnd, onKeyDown: handleKeyDown }, dialogProps),
|
|
209
|
+
React.createElement(StyledModalScrim, { onClick: onClickScrim }),
|
|
210
|
+
React.createElement(ModalContainer, __assign({}, props, { placement: placement }),
|
|
211
|
+
React.createElement(StyledModalContent, null,
|
|
212
|
+
React.createElement(ModalBodyScrollObserver, null,
|
|
213
|
+
React.createElement(CloseWithConfirmContext.Provider, { value: closeWithConfirmState }, children))))))))))) : null;
|
|
190
214
|
});
|
|
191
215
|
function ModalBodyScrollObserver(_a) {
|
|
192
216
|
var children = _a.children;
|
package/dist/Modal/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/Modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KA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AAClC,IAAM,aAAa,GAAG,kBAAkB,CAAA;AACxC,IAAM,MAAM,GAAG,iBAAiB,CAAA;AAChC,IAAM,aAAa,GAAG,0BAA0B,CAAA;AAChD,IAAM,cAAc,GAAG,mBAAmB,CAAA;AAC1C,IAAM,MAAM,GAAG,mBAAmB,CAAA;AAClC,IAAM,OAAO,GAAG,WAAW,CAAA;AAC3B,IAAM,KAAK,GAAG,gBAAgB,CAAA;AAC9B,IAAM,KAAK,GAAG,UAAU,CAAA;AAExB,MAAM,CAAC,IAAM,KAAK,GAAG,gBAAgB,CACnC;IACE,IAAI,MAAA;IACJ,SAAS,WAAA;IACT,OAAO,SAAA;IACP,MAAM,QAAA;IACN,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,aAAa,eAAA;IACb,MAAM,QAAA;IACN,OAAO,EAAE,OAAO;IAChB,OAAO,SAAA;IACP,KAAK,OAAA;IACL,KAAK,OAAA;IACL,OAAO,SAAA;CACR,EACD,MAAM,CACP,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface InitializeModalFocusProps {
|
|
3
|
+
modalContainerRef: React.RefObject<HTMLDivElement>;
|
|
4
|
+
hasOnClose: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useInitializeModalFocus({ modalContainerRef, hasOnClose }: InitializeModalFocusProps): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useFocusManager } from "@react-aria/focus";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useModalChildRegistryContext } from "./ChildRegistry.context";
|
|
4
|
+
export function useInitializeModalFocus(_a) {
|
|
5
|
+
var modalContainerRef = _a.modalContainerRef, hasOnClose = _a.hasOnClose;
|
|
6
|
+
var focusManager = useFocusManager();
|
|
7
|
+
var childrenRegistryStatus = useModalChildRegistryContext();
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
+
// the same reason that Modal has a FocusScope with autoFocus={!!onClose}
|
|
11
|
+
if (!hasOnClose)
|
|
12
|
+
return;
|
|
13
|
+
var closeButtonElement = (_a = modalContainerRef === null || modalContainerRef === void 0 ? void 0 : modalContainerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-internal="close-button"]');
|
|
14
|
+
var anyFocusedItem = (_c = (_b = childrenRegistryStatus.body) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.querySelector(':focus');
|
|
15
|
+
if (closeButtonElement == null) {
|
|
16
|
+
// if no focus header button is represented then no need to change focus on next elements
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if ((_d = childrenRegistryStatus.body) === null || _d === void 0 ? void 0 : _d.current) {
|
|
20
|
+
// if nothing has been focused within body then focus in the scrollable body
|
|
21
|
+
if (anyFocusedItem == null) {
|
|
22
|
+
(_f = (_e = childrenRegistryStatus.body) === null || _e === void 0 ? void 0 : _e.current) === null || _f === void 0 ? void 0 : _f.focus();
|
|
23
|
+
}
|
|
24
|
+
// if there is a footer section the focus on the left most interactive element
|
|
25
|
+
}
|
|
26
|
+
else if ((_g = childrenRegistryStatus.closeableButtons) === null || _g === void 0 ? void 0 : _g.current) {
|
|
27
|
+
focusManager.focusNext({
|
|
28
|
+
from: closeButtonElement !== null && closeButtonElement !== void 0 ? closeButtonElement : undefined,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, [childrenRegistryStatus]);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=useInitializeModalFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitializeModalFocus.js","sourceRoot":"","sources":["../../src/Modal/useInitializeModalFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,OA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com/procore/core/blob/
|
|
13
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L42"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "className",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"description": "Additional classNames",
|
|
21
21
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional classNames</p>\n</div></div>",
|
|
22
22
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
23
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
23
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L47"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "icon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"description": "The icon to display",
|
|
31
31
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>The icon to display</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
32
32
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
33
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
33
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L100"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "style",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"description": "Additional CSS styles",
|
|
41
41
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional CSS styles</p>\n</div></div>",
|
|
42
42
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
43
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
43
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L52"
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"description": ""
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"description": "",
|
|
57
57
|
"descriptionHtml": "",
|
|
58
58
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
59
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
59
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L42"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"name": "className",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"description": "Additional classNames",
|
|
67
67
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional classNames</p>\n</div></div>",
|
|
68
68
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
69
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
69
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L47"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"name": "style",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"description": "Additional CSS styles",
|
|
77
77
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional CSS styles</p>\n</div></div>",
|
|
78
78
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
79
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
79
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L52"
|
|
80
80
|
}
|
|
81
81
|
],
|
|
82
82
|
"description": ""
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"description": "",
|
|
93
93
|
"descriptionHtml": "",
|
|
94
94
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
95
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
95
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L12"
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"name": "img",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"description": "",
|
|
103
103
|
"descriptionHtml": "",
|
|
104
104
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
105
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
105
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L13"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"name": "link",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"description": "",
|
|
113
113
|
"descriptionHtml": "",
|
|
114
114
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
115
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
115
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L14"
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
118
|
"description": ""
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"description": "",
|
|
129
129
|
"descriptionHtml": "",
|
|
130
130
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
131
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
131
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L42"
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"name": "className",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"description": "Additional classNames",
|
|
139
139
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional classNames</p>\n</div></div>",
|
|
140
140
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
141
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
141
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L47"
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
"name": "imageUrl",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"description": "The Avatar rich media url",
|
|
149
149
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>The Avatar rich media url</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
150
150
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
151
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
151
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L108"
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
"name": "style",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"description": "Additional CSS styles",
|
|
159
159
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional CSS styles</p>\n</div></div>",
|
|
160
160
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
161
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
161
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L52"
|
|
162
162
|
}
|
|
163
163
|
],
|
|
164
164
|
"description": ""
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"description": "",
|
|
175
175
|
"descriptionHtml": "",
|
|
176
176
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
177
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
177
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L42"
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
"name": "className",
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"description": "Additional classNames",
|
|
185
185
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional classNames</p>\n</div></div>",
|
|
186
186
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
187
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
187
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L47"
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
"name": "clickable",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"deprecated": "Reviewing for removal from system, prefer accessible `role` for interactive UI.",
|
|
198
198
|
"deprecatedSince": "TBD",
|
|
199
199
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
200
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
200
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L34"
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
203
|
"name": "disabled",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Sets the Avatar's disabled state</p>\n</div><dl class=\"tsd-comment-tags\"><dt>defaultvalue</dt><dd><p>false</p>\n</dd></dl></div>",
|
|
209
209
|
"defaultValue": "false\n",
|
|
210
210
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
211
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
211
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L40"
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
"name": "size",
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
"deprecated": "\n\nSize \"xl\" has been deprecated and will be removed in a future version.\nPlease use \"lg\" instead of \"xl\".\n\n**Before**\n\n`<Avatar size=\"xl\" />`\n\n**After**\n\n`<Avatar size=\"lg\" />`\n",
|
|
222
222
|
"deprecatedSince": "10.20.0",
|
|
223
223
|
"sourceFile": "packages/core-react/src/Avatar/Avatar.types.ts",
|
|
224
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
224
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/Avatar/Avatar.types.ts#L62"
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
"name": "style",
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
"description": "Additional CSS styles",
|
|
232
232
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional CSS styles</p>\n</div></div>",
|
|
233
233
|
"sourceFile": "packages/core-react/src/_utils/types.ts",
|
|
234
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
234
|
+
"sourceUrl": "https://github.com/procore/core/blob/be18e8c77/packages/core-react/src/_utils/types.ts#L52"
|
|
235
235
|
}
|
|
236
236
|
],
|
|
237
237
|
"description": ""
|