@primer/components 0.0.0-2021101705729 → 0.0.0-2021101717425
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/CHANGELOG.md +1 -1
- package/lib/ActionList/index.js +23 -12
- package/lib/ActionList2/index.js +41 -23
- package/lib/AnchoredOverlay/index.js +12 -4
- package/lib/Autocomplete/index.js +14 -7
- package/lib/Button/index.js +70 -21
- package/lib/DropdownMenu/index.js +20 -6
- package/lib/DropdownStyles.js +26 -18
- package/lib/FilteredActionList/index.js +12 -4
- package/lib/Pagination/index.js +12 -6
- package/lib/Portal/index.js +16 -5
- package/lib/SelectMenu/hooks/useKeyboardNav.js +96 -80
- package/lib/SelectMenu/index.js +14 -7
- package/lib/SelectPanel/index.js +12 -4
- package/lib/Token/index.js +30 -11
- package/lib/behaviors/anchoredPosition.js +234 -205
- package/lib/behaviors/focusTrap.js +157 -121
- package/lib/behaviors/focusZone.js +509 -434
- package/lib/behaviors/scrollIntoViewingArea.js +35 -18
- package/lib/constants.js +43 -39
- package/lib/drafts.js +17 -19
- package/lib/hooks/index.js +60 -16
- package/lib/hooks/useAnchoredPosition.js +40 -32
- package/lib/hooks/useCombinedRefs.js +36 -32
- package/lib/hooks/useDialog.js +96 -72
- package/lib/hooks/useFocusTrap.js +60 -43
- package/lib/hooks/useFocusZone.js +50 -54
- package/lib/hooks/useOnEscapePress.js +36 -25
- package/lib/hooks/useOpenAndCloseFocus.js +34 -22
- package/lib/hooks/useProvidedRefOrCreate.js +14 -10
- package/lib/hooks/useProvidedStateOrCreate.js +16 -13
- package/lib/hooks/useRenderForcingRef.js +17 -13
- package/lib/hooks/useResizeObserver.js +18 -15
- package/lib/hooks/useSafeTimeout.js +30 -22
- package/lib/hooks/useScrollFlash.js +23 -16
- package/lib/index.js +636 -161
- package/lib/polyfills/eventListenerSignal.js +45 -37
- package/lib/sx.js +22 -10
- package/lib/theme-preval.js +3023 -64
- package/lib/theme.js +12 -3
- package/lib/utils/iterateFocusableElements.js +85 -63
- package/lib/utils/theme.js +47 -33
- package/lib/utils/types/AriaRole.js +1 -2
- package/lib/utils/types/ComponentProps.js +1 -2
- package/lib/utils/types/Flatten.js +1 -2
- package/lib/utils/types/KeyPaths.js +1 -2
- package/lib/utils/types/MandateProps.js +1 -16
- package/lib/utils/types/Merge.js +1 -2
- package/lib/utils/types/index.js +69 -16
- package/lib/utils/uniqueId.js +8 -5
- package/lib/utils/use-force-update.js +14 -8
- package/lib/utils/useIsomorphicLayoutEffect.js +11 -8
- package/lib/utils/userAgent.js +12 -8
- package/package.json +2 -3
- package/lib/ActionList/Divider.jsx +0 -29
- package/lib/ActionList/Group.jsx +0 -23
- package/lib/ActionList/Header.jsx +0 -66
- package/lib/ActionList/Item.jsx +0 -301
- package/lib/ActionList/List.jsx +0 -138
- package/lib/ActionList2/Description.jsx +0 -30
- package/lib/ActionList2/Divider.jsx +0 -22
- package/lib/ActionList2/Group.jsx +0 -25
- package/lib/ActionList2/Header.jsx +0 -36
- package/lib/ActionList2/Item.jsx +0 -174
- package/lib/ActionList2/LinkItem.jsx +0 -28
- package/lib/ActionList2/List.jsx +0 -41
- package/lib/ActionList2/Selection.jsx +0 -36
- package/lib/ActionList2/Visuals.jsx +0 -48
- package/lib/ActionMenu.jsx +0 -73
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +0 -100
- package/lib/Autocomplete/Autocomplete.jsx +0 -100
- package/lib/Autocomplete/AutocompleteContext.jsx +0 -5
- package/lib/Autocomplete/AutocompleteInput.jsx +0 -113
- package/lib/Autocomplete/AutocompleteMenu.jsx +0 -190
- package/lib/Autocomplete/AutocompleteOverlay.jsx +0 -55
- package/lib/Avatar.jsx +0 -34
- package/lib/AvatarPair.jsx +0 -29
- package/lib/AvatarStack.jsx +0 -151
- package/lib/BaseStyles.jsx +0 -65
- package/lib/BorderBox.jsx +0 -18
- package/lib/Box.jsx +0 -10
- package/lib/BranchName.jsx +0 -20
- package/lib/Breadcrumbs.jsx +0 -74
- package/lib/Button/Button.jsx +0 -60
- package/lib/Button/ButtonBase.jsx +0 -36
- package/lib/Button/ButtonClose.jsx +0 -55
- package/lib/Button/ButtonDanger.jsx +0 -63
- package/lib/Button/ButtonGroup.jsx +0 -55
- package/lib/Button/ButtonInvisible.jsx +0 -52
- package/lib/Button/ButtonOutline.jsx +0 -63
- package/lib/Button/ButtonPrimary.jsx +0 -62
- package/lib/Button/ButtonStyles.jsx +0 -37
- package/lib/Button/ButtonTableList.jsx +0 -49
- package/lib/Caret.jsx +0 -93
- package/lib/CircleBadge.jsx +0 -43
- package/lib/CircleOcticon.jsx +0 -21
- package/lib/CounterLabel.jsx +0 -44
- package/lib/Details.jsx +0 -21
- package/lib/Dialog/ConfirmationDialog.jsx +0 -146
- package/lib/Dialog/Dialog.jsx +0 -273
- package/lib/Dialog.jsx +0 -131
- package/lib/Dropdown.jsx +0 -134
- package/lib/DropdownMenu/DropdownButton.jsx +0 -14
- package/lib/DropdownMenu/DropdownMenu.jsx +0 -70
- package/lib/FilterList.jsx +0 -63
- package/lib/FilteredActionList/FilteredActionList.jsx +0 -100
- package/lib/FilteredSearch.jsx +0 -29
- package/lib/Flash.jsx +0 -70
- package/lib/Flex.jsx +0 -15
- package/lib/FormGroup.jsx +0 -25
- package/lib/Grid.jsx +0 -15
- package/lib/Header.jsx +0 -90
- package/lib/Heading.jsx +0 -21
- package/lib/Label.jsx +0 -84
- package/lib/LabelGroup.jsx +0 -19
- package/lib/Link.jsx +0 -38
- package/lib/Overlay.jsx +0 -156
- package/lib/Pagehead.jsx +0 -18
- package/lib/Pagination/Pagination.jsx +0 -163
- package/lib/Pagination/model.jsx +0 -174
- package/lib/PointerBox.jsx +0 -25
- package/lib/Popover.jsx +0 -210
- package/lib/Portal/Portal.jsx +0 -79
- package/lib/Position.jsx +0 -46
- package/lib/ProgressBar.jsx +0 -39
- package/lib/SelectMenu/SelectMenu.jsx +0 -114
- package/lib/SelectMenu/SelectMenuContext.jsx +0 -5
- package/lib/SelectMenu/SelectMenuDivider.jsx +0 -43
- package/lib/SelectMenu/SelectMenuFilter.jsx +0 -59
- package/lib/SelectMenu/SelectMenuFooter.jsx +0 -46
- package/lib/SelectMenu/SelectMenuHeader.jsx +0 -44
- package/lib/SelectMenu/SelectMenuItem.jsx +0 -143
- package/lib/SelectMenu/SelectMenuList.jsx +0 -60
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +0 -21
- package/lib/SelectMenu/SelectMenuModal.jsx +0 -119
- package/lib/SelectMenu/SelectMenuTab.jsx +0 -93
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +0 -43
- package/lib/SelectMenu/SelectMenuTabs.jsx +0 -58
- package/lib/SelectPanel/SelectPanel.jsx +0 -105
- package/lib/SideNav.jsx +0 -177
- package/lib/Spinner.jsx +0 -35
- package/lib/StateLabel.jsx +0 -94
- package/lib/StyledOcticon.jsx +0 -20
- package/lib/SubNav.jsx +0 -104
- package/lib/TabNav.jsx +0 -60
- package/lib/Text.jsx +0 -14
- package/lib/TextInput.jsx +0 -23
- package/lib/TextInputWithTokens.jsx +0 -218
- package/lib/ThemeProvider.jsx +0 -130
- package/lib/Timeline.jsx +0 -124
- package/lib/Token/AvatarToken.jsx +0 -54
- package/lib/Token/IssueLabelToken.jsx +0 -125
- package/lib/Token/Token.jsx +0 -103
- package/lib/Token/TokenBase.jsx +0 -88
- package/lib/Token/_RemoveTokenButton.jsx +0 -108
- package/lib/Token/_TokenTextContainer.jsx +0 -49
- package/lib/Tooltip.jsx +0 -246
- package/lib/Truncate.jsx +0 -27
- package/lib/UnderlineNav.jsx +0 -90
- package/lib/_TextInputWrapper.jsx +0 -120
- package/lib/_UnstyledTextInput.jsx +0 -22
- package/lib/hooks/useDetails.jsx +0 -39
- package/lib/hooks/useOnOutsideClick.jsx +0 -61
- package/lib/hooks/useOverlay.jsx +0 -15
- package/lib/utils/create-slots.jsx +0 -65
- package/lib/utils/deprecate.jsx +0 -59
- package/lib/utils/isNumeric.jsx +0 -7
- package/lib/utils/ssr.jsx +0 -6
- package/lib/utils/test-deprecations.jsx +0 -20
- package/lib/utils/test-helpers.jsx +0 -8
- package/lib/utils/test-matchers.jsx +0 -100
- package/lib/utils/testing.jsx +0 -206
package/CHANGELOG.md
CHANGED
package/lib/ActionList/index.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ActionList = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var _List = require("./List");
|
|
9
|
+
|
|
10
|
+
var _Group = require("./Group");
|
|
11
|
+
|
|
12
|
+
var _Item = require("./Item");
|
|
13
|
+
|
|
14
|
+
var _Divider = require("./Divider");
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Collection of list-related components.
|
|
10
18
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
const ActionList = Object.assign(_List.List, {
|
|
20
|
+
/** Collects related `Items` in an `ActionList`. */
|
|
21
|
+
Group: _Group.Group,
|
|
22
|
+
|
|
23
|
+
/** An actionable or selectable `Item` with an optional icon and description. */
|
|
24
|
+
Item: _Item.Item,
|
|
25
|
+
|
|
26
|
+
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
|
27
|
+
Divider: _Divider.Divider
|
|
18
28
|
});
|
|
29
|
+
exports.ActionList = ActionList;
|
package/lib/ActionList2/index.js
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ActionList = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
|
|
8
|
+
var _List = require("./List");
|
|
9
|
+
|
|
10
|
+
var _Group = require("./Group");
|
|
11
|
+
|
|
12
|
+
var _Item = require("./Item");
|
|
13
|
+
|
|
14
|
+
var _LinkItem = require("./LinkItem");
|
|
15
|
+
|
|
16
|
+
var _Divider = require("./Divider");
|
|
17
|
+
|
|
18
|
+
var _Description = require("./Description");
|
|
19
|
+
|
|
20
|
+
var _Visuals = require("./Visuals");
|
|
21
|
+
|
|
11
22
|
/**
|
|
12
23
|
* Collection of list-related components.
|
|
13
24
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const ActionList = Object.assign(_List.List, {
|
|
26
|
+
/** Collects related `Items` in an `ActionList`. */
|
|
27
|
+
Group: _Group.Group,
|
|
28
|
+
|
|
29
|
+
/** An actionable or selectable `Item` */
|
|
30
|
+
Item: _Item.Item,
|
|
31
|
+
|
|
32
|
+
/** A `Item` that renders a full-size anchor inside ListItem */
|
|
33
|
+
LinkItem: _LinkItem.LinkItem,
|
|
34
|
+
|
|
35
|
+
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
|
36
|
+
Divider: _Divider.Divider,
|
|
37
|
+
|
|
38
|
+
/** Secondary text which provides additional information about an `Item`. */
|
|
39
|
+
Description: _Description.Description,
|
|
40
|
+
|
|
41
|
+
/** Icon (or similar) positioned before `Item` text. */
|
|
42
|
+
LeadingVisual: _Visuals.LeadingVisual,
|
|
43
|
+
|
|
44
|
+
/** Icon (or similar) positioned after `Item` text. */
|
|
45
|
+
TrailingVisual: _Visuals.TrailingVisual
|
|
29
46
|
});
|
|
47
|
+
exports.ActionList = ActionList;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AnchoredOverlay", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AnchoredOverlay.AnchoredOverlay;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _AnchoredOverlay = require("./AnchoredOverlay");
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Autocomplete.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/Button/index.js
CHANGED
|
@@ -1,22 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Button.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ButtonDanger", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ButtonDanger.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ButtonGroup", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _ButtonGroup.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ButtonOutline", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _ButtonOutline.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "ButtonPrimary", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _ButtonPrimary.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "ButtonInvisible", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _ButtonInvisible.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "ButtonTableList", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _ButtonTableList.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "ButtonClose", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _ButtonClose.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
56
|
+
|
|
57
|
+
var _ButtonDanger = _interopRequireDefault(require("./ButtonDanger"));
|
|
58
|
+
|
|
59
|
+
var _ButtonGroup = _interopRequireDefault(require("./ButtonGroup"));
|
|
60
|
+
|
|
61
|
+
var _ButtonOutline = _interopRequireDefault(require("./ButtonOutline"));
|
|
62
|
+
|
|
63
|
+
var _ButtonPrimary = _interopRequireDefault(require("./ButtonPrimary"));
|
|
64
|
+
|
|
65
|
+
var _ButtonInvisible = _interopRequireDefault(require("./ButtonInvisible"));
|
|
66
|
+
|
|
67
|
+
var _ButtonTableList = _interopRequireDefault(require("./ButtonTableList"));
|
|
68
|
+
|
|
69
|
+
var _ButtonClose = _interopRequireDefault(require("./ButtonClose"));
|
|
70
|
+
|
|
71
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DropdownMenu", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _DropdownMenu.DropdownMenu;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DropdownButton", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _DropdownButton.DropdownButton;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _DropdownMenu = require("./DropdownMenu");
|
|
20
|
+
|
|
21
|
+
var _DropdownButton = require("./DropdownButton");
|
package/lib/DropdownStyles.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _constants = require("./constants");
|
|
9
|
+
|
|
4
10
|
const getDirectionStyles = (theme, direction) => {
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
const map = {
|
|
12
|
+
w: `
|
|
7
13
|
top: 0;
|
|
8
14
|
right: 100%;
|
|
9
15
|
left: auto;
|
|
@@ -16,7 +22,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
16
22
|
right: -16px;
|
|
17
23
|
left: auto;
|
|
18
24
|
border-color: transparent;
|
|
19
|
-
border-left-color: ${
|
|
25
|
+
border-left-color: ${(0, _constants.get)('colors.border.default')(theme)};
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
&::after {
|
|
@@ -24,10 +30,10 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
24
30
|
right: -14px;
|
|
25
31
|
left: auto;
|
|
26
32
|
border-color: transparent;
|
|
27
|
-
border-left-color: ${
|
|
33
|
+
border-left-color: ${(0, _constants.get)('colors.border.default')(theme)};
|
|
28
34
|
}
|
|
29
35
|
`,
|
|
30
|
-
|
|
36
|
+
e: `
|
|
31
37
|
top: 0;
|
|
32
38
|
left: 100%;
|
|
33
39
|
width: auto;
|
|
@@ -38,17 +44,17 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
38
44
|
top: 10px;
|
|
39
45
|
left: -16px;
|
|
40
46
|
border-color: transparent;
|
|
41
|
-
border-right-color: ${
|
|
47
|
+
border-right-color: ${(0, _constants.get)('colors.border.default')(theme)};
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
&::after {
|
|
45
51
|
top: 11px;
|
|
46
52
|
left: -14px;
|
|
47
53
|
border-color: transparent;
|
|
48
|
-
border-right-color: ${
|
|
54
|
+
border-right-color: ${(0, _constants.get)('colors.border.default')(theme)};
|
|
49
55
|
}
|
|
50
56
|
`,
|
|
51
|
-
|
|
57
|
+
ne: `
|
|
52
58
|
top: auto;
|
|
53
59
|
bottom: 100%;
|
|
54
60
|
left: 0;
|
|
@@ -63,7 +69,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
63
69
|
&::before {
|
|
64
70
|
bottom: -8px;
|
|
65
71
|
left: 9px;
|
|
66
|
-
border-top: 8px solid ${
|
|
72
|
+
border-top: 8px solid ${(0, _constants.get)('colors.border.default')(theme)};
|
|
67
73
|
border-bottom: 0;
|
|
68
74
|
border-left: 8px solid transparent;
|
|
69
75
|
}
|
|
@@ -71,13 +77,13 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
71
77
|
&::after {
|
|
72
78
|
bottom: -7px;
|
|
73
79
|
left: 10px;
|
|
74
|
-
border-top: 7px solid ${
|
|
80
|
+
border-top: 7px solid ${(0, _constants.get)('colors.border.default')(theme)};
|
|
75
81
|
border-right: 7px solid transparent;
|
|
76
82
|
border-bottom: 0;
|
|
77
83
|
border-left: 7px solid transparent;
|
|
78
84
|
}
|
|
79
85
|
`,
|
|
80
|
-
|
|
86
|
+
s: `
|
|
81
87
|
right: 50%;
|
|
82
88
|
left: auto;
|
|
83
89
|
transform: translateX(50%);
|
|
@@ -94,7 +100,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
94
100
|
transform: translateX(50%);
|
|
95
101
|
}
|
|
96
102
|
`,
|
|
97
|
-
|
|
103
|
+
sw: `
|
|
98
104
|
right: 0;
|
|
99
105
|
left: auto;
|
|
100
106
|
|
|
@@ -110,7 +116,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
110
116
|
left: auto;
|
|
111
117
|
}
|
|
112
118
|
`,
|
|
113
|
-
|
|
119
|
+
se: `
|
|
114
120
|
&::before {
|
|
115
121
|
top: -16px;
|
|
116
122
|
left: 9px;
|
|
@@ -121,7 +127,9 @@ const getDirectionStyles = (theme, direction) => {
|
|
|
121
127
|
left: 10px;
|
|
122
128
|
}
|
|
123
129
|
`
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
};
|
|
131
|
+
return map[direction];
|
|
126
132
|
};
|
|
127
|
-
|
|
133
|
+
|
|
134
|
+
var _default = getDirectionStyles;
|
|
135
|
+
exports.default = _default;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "FilteredActionList", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _FilteredActionList.FilteredActionList;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _FilteredActionList = require("./FilteredActionList");
|
package/lib/Pagination/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Pagination.default;
|
|
13
|
+
exports.default = _default;
|
package/lib/Portal/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "registerPortalRoot", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Portal.registerPortalRoot;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
|
|
14
|
+
var _Portal = require("./Portal");
|
|
15
|
+
|
|
16
|
+
var _default = _Portal.Portal;
|
|
17
|
+
exports.default = _default;
|
|
@@ -1,85 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
4
10
|
// adapted from details-menu web component https://github.com/github/details-menu-element
|
|
5
11
|
function useKeyboardNav(details, open, setOpen) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
if (isSummaryFocused && !open) {
|
|
42
|
-
openDetails(details);
|
|
43
|
-
}
|
|
44
|
-
const target = focusItem(true);
|
|
45
|
-
if (target)
|
|
46
|
-
target.focus();
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case 'ArrowUp':
|
|
51
|
-
{
|
|
52
|
-
if (isSummaryFocused && !open) {
|
|
53
|
-
openDetails();
|
|
54
|
-
}
|
|
55
|
-
const target = focusItem(false);
|
|
56
|
-
if (target)
|
|
57
|
-
target.focus();
|
|
58
|
-
event.preventDefault();
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
case ' ':
|
|
62
|
-
case 'Enter':
|
|
63
|
-
{
|
|
64
|
-
const selected = document.activeElement;
|
|
65
|
-
if (selected && isMenuItem(selected) && selected.closest('details') === details) {
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
event.stopPropagation();
|
|
68
|
-
selected.click();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
12
|
+
const handleKeyDown = (0, _react.useCallback)(event => {
|
|
13
|
+
const closeDetails = () => {
|
|
14
|
+
setOpen(false);
|
|
15
|
+
const summary = details.current.querySelector('summary');
|
|
16
|
+
if (summary) summary.focus();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const openDetails = () => {
|
|
20
|
+
setOpen(true);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const focusItem = next => {
|
|
24
|
+
const options = Array.from(details.current.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled]):not([aria-disabled="true"])'));
|
|
25
|
+
const selected = document.activeElement;
|
|
26
|
+
const index = options.indexOf(selected);
|
|
27
|
+
const found = next ? options[index + 1] : options[index - 1];
|
|
28
|
+
const def = next ? options[0] : options[options.length - 1];
|
|
29
|
+
return found || def;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const isMenuItem = el => {
|
|
33
|
+
const role = el.getAttribute('role');
|
|
34
|
+
return role === 'menuitem' || role === 'menuitemcheckbox' || role === 'menuitemradio';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (!(event instanceof KeyboardEvent)) return;
|
|
38
|
+
const isSummaryFocused = event.target instanceof Element && event.target.tagName === 'SUMMARY';
|
|
39
|
+
|
|
40
|
+
switch (event.key) {
|
|
41
|
+
case 'Escape':
|
|
42
|
+
if (open) {
|
|
43
|
+
closeDetails(details);
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.stopPropagation();
|
|
73
46
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
47
|
+
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'ArrowDown':
|
|
51
|
+
{
|
|
52
|
+
if (isSummaryFocused && !open) {
|
|
53
|
+
openDetails(details);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const target = focusItem(true);
|
|
57
|
+
if (target) target.focus();
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
|
|
62
|
+
case 'ArrowUp':
|
|
63
|
+
{
|
|
64
|
+
if (isSummaryFocused && !open) {
|
|
65
|
+
openDetails();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const target = focusItem(false);
|
|
69
|
+
if (target) target.focus();
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case ' ':
|
|
75
|
+
case 'Enter':
|
|
76
|
+
{
|
|
77
|
+
const selected = document.activeElement;
|
|
78
|
+
|
|
79
|
+
if (selected && isMenuItem(selected) && selected.closest('details') === details) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
selected.click();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
default:
|
|
88
|
+
}
|
|
89
|
+
}, [details, open, setOpen]);
|
|
90
|
+
(0, _react.useEffect)(() => {
|
|
91
|
+
const current = details.current;
|
|
92
|
+
if (!current) return;
|
|
93
|
+
current.addEventListener('keydown', handleKeyDown);
|
|
94
|
+
return () => {
|
|
95
|
+
current.removeEventListener('keydown', handleKeyDown);
|
|
96
|
+
};
|
|
97
|
+
}, [details, handleKeyDown]);
|
|
84
98
|
}
|
|
85
|
-
|
|
99
|
+
|
|
100
|
+
var _default = useKeyboardNav;
|
|
101
|
+
exports.default = _default;
|