@primer/components 0.0.0-2021111225614 → 0.0.0-202111136954
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 -2209
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2209
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Header.js +1 -1
- package/lib/ActionList/Item.js +10 -10
- package/lib/ActionList/List.js +1 -1
- package/lib/ActionList2/{MenuContext.d.ts → ActionListContainerContext.d.ts} +3 -3
- package/lib/ActionList2/{MenuContext.js → ActionListContainerContext.js} +3 -3
- package/lib/ActionList2/Item.js +5 -7
- package/lib/ActionList2/List.js +3 -3
- package/lib/ActionList2/Selection.js +4 -4
- package/lib/ActionMenu2.d.ts +19 -12
- package/lib/ActionMenu2.js +63 -29
- package/lib/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib/BaseStyles.js +2 -20
- package/lib/BorderBox.js +1 -1
- package/lib/Box.js +1 -1
- package/lib/BranchName.js +1 -1
- package/lib/Breadcrumbs.js +3 -3
- package/lib/Button/Button.d.ts +2 -2
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonClose.d.ts +2 -2
- package/lib/Button/ButtonDanger.d.ts +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Button/ButtonInvisible.d.ts +2 -2
- package/lib/Button/ButtonOutline.d.ts +2 -2
- package/lib/Button/ButtonPrimary.d.ts +2 -2
- package/lib/Checkbox.d.ts +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/CircleOcticon.d.ts +35 -35
- package/lib/Details.js +1 -1
- package/lib/Dialog.d.ts +37 -37
- package/lib/Dropdown.d.ts +6 -6
- package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib/FilterList.d.ts +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +1 -1
- package/lib/Flex.js +1 -1
- package/lib/LabelGroup.js +1 -1
- package/lib/NewButton/button-base.d.ts +6 -0
- package/lib/NewButton/button-base.js +69 -0
- package/lib/NewButton/button-link.d.ts +27 -0
- package/lib/NewButton/button-link.js +31 -0
- package/lib/NewButton/button.d.ts +2 -11
- package/lib/NewButton/button.js +6 -283
- package/lib/NewButton/icon-button.d.ts +4 -0
- package/lib/NewButton/icon-button.js +62 -0
- package/lib/NewButton/index.d.ts +6 -11
- package/lib/NewButton/index.js +18 -0
- package/lib/NewButton/styles.d.ts +202 -0
- package/lib/NewButton/styles.js +248 -0
- package/lib/NewButton/types.d.ts +28 -8
- package/lib/NewButton/types.js +19 -1
- package/lib/Overlay.js +1 -1
- package/lib/Pagination/Pagination.js +2 -2
- package/lib/Position.d.ts +4 -4
- package/lib/Position.js +1 -1
- package/lib/Radio.d.ts +38 -0
- package/lib/Radio.js +55 -0
- package/lib/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib/SelectMenu/SelectMenu.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/StateLabel.js +1 -1
- package/lib/StyledOcticon.js +1 -1
- package/lib/SubNav.js +3 -3
- package/lib/TextInputWithTokens.d.ts +2 -1
- package/lib/ThemeProvider.d.ts +1 -0
- package/lib/ThemeProvider.js +17 -4
- package/lib/Timeline.js +4 -4
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/AvatarToken.js +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/TokenBase.js +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/UnderlineNav.js +2 -2
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +9 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/lib-esm/ActionList/Header.js +1 -1
- package/lib-esm/ActionList/Item.js +10 -10
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/ActionList2/{MenuContext.d.ts → ActionListContainerContext.d.ts} +3 -3
- package/lib-esm/ActionList2/{MenuContext.js → ActionListContainerContext.js} +1 -1
- package/lib-esm/ActionList2/Item.js +5 -7
- package/lib-esm/ActionList2/List.js +3 -3
- package/lib-esm/ActionList2/Selection.js +4 -4
- package/lib-esm/ActionMenu2.d.ts +19 -12
- package/lib-esm/ActionMenu2.js +60 -27
- package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib-esm/BaseStyles.js +2 -20
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Box.js +1 -1
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/Breadcrumbs.js +3 -3
- package/lib-esm/Button/Button.d.ts +2 -2
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +2 -2
- package/lib-esm/Button/ButtonGroup.js +1 -1
- package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/Checkbox.js +1 -1
- package/lib-esm/CircleOcticon.d.ts +35 -35
- package/lib-esm/Details.js +1 -1
- package/lib-esm/Dialog.d.ts +37 -37
- package/lib-esm/Dropdown.d.ts +6 -6
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib-esm/FilterList.d.ts +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
- package/lib-esm/Flex.js +1 -1
- package/lib-esm/LabelGroup.js +1 -1
- package/lib-esm/NewButton/button-base.d.ts +6 -0
- package/lib-esm/NewButton/button-base.js +47 -0
- package/lib-esm/NewButton/button-link.d.ts +27 -0
- package/lib-esm/NewButton/button-link.js +15 -0
- package/lib-esm/NewButton/button.d.ts +2 -11
- package/lib-esm/NewButton/button.js +4 -275
- package/lib-esm/NewButton/icon-button.d.ts +4 -0
- package/lib-esm/NewButton/icon-button.js +39 -0
- package/lib-esm/NewButton/index.d.ts +6 -11
- package/lib-esm/NewButton/index.js +4 -1
- package/lib-esm/NewButton/styles.d.ts +202 -0
- package/lib-esm/NewButton/styles.js +229 -0
- package/lib-esm/NewButton/types.d.ts +28 -8
- package/lib-esm/NewButton/types.js +6 -1
- package/lib-esm/Overlay.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/Position.js +1 -1
- package/lib-esm/Radio.d.ts +38 -0
- package/lib-esm/Radio.js +40 -0
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib-esm/SelectMenu/SelectMenu.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib-esm/StateLabel.js +1 -1
- package/lib-esm/StyledOcticon.js +1 -1
- package/lib-esm/SubNav.js +3 -3
- package/lib-esm/TextInputWithTokens.d.ts +2 -1
- package/lib-esm/ThemeProvider.d.ts +1 -0
- package/lib-esm/ThemeProvider.js +17 -4
- package/lib-esm/Timeline.js +4 -4
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/AvatarToken.js +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Token/TokenBase.js +1 -1
- package/lib-esm/Tooltip.js +1 -1
- package/lib-esm/UnderlineNav.js +2 -2
- package/lib-esm/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +2 -1
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +1 -0
- package/package.json +14 -8
- package/CHANGELOG.md +0 -996
@@ -48,15 +48,15 @@ const getItemVariant = (variant = 'default', disabled) => {
|
|
48
48
|
|
49
49
|
const DividedContent = styled.div.withConfig({
|
50
50
|
displayName: "Item__DividedContent",
|
51
|
-
componentId: "jqpvy8-0"
|
51
|
+
componentId: "sc-jqpvy8-0"
|
52
52
|
})(["display:flex;min-width:0;position:relative;flex-grow:1;"]);
|
53
53
|
const MainContent = styled.div.withConfig({
|
54
54
|
displayName: "Item__MainContent",
|
55
|
-
componentId: "jqpvy8-1"
|
55
|
+
componentId: "sc-jqpvy8-1"
|
56
56
|
})(["align-items:baseline;display:flex;min-width:0;flex-direction:var(--main-content-flex-direction);flex-grow:1;"]);
|
57
57
|
const StyledItem = styled.div.withConfig({
|
58
58
|
displayName: "Item__StyledItem",
|
59
|
-
componentId: "jqpvy8-2"
|
59
|
+
componentId: "sc-jqpvy8-2"
|
60
60
|
})(["padding:6px ", ";display:flex;border-radius:", ";color:", ";transition:background 33.333ms linear;text-decoration:none;@media (hover:hover) and (pointer:fine){:hover{background:var( --item-hover-bg-override,", " );color:", ";cursor:", ";}}:not(:first-of-type):not(", " + &):not(", " + &){margin-top:", ";", "::before{content:' ';display:block;position:absolute;width:100%;top:-7px;border:0 solid ", ";border-top-width:", ";}}&:hover ", "::before,:hover + * ", "::before{border-color:var(--item-hover-divider-border-color-override,transparent) !important;}&:focus ", "::before,:focus + * ", "::before,&[", "] ", "::before,[", "] + & ", "::before{border-color:transparent !important;}&[", "='", "']{background:", ";}&[", "='", "']{background:", ";}&:focus{background:", ";outline:none;}&:active{background:", ";}", ""], get('space.2'), get('radii.2'), ({
|
61
61
|
variant,
|
62
62
|
item
|
@@ -88,37 +88,37 @@ const StyledItem = styled.div.withConfig({
|
|
88
88
|
}) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg, sx);
|
89
89
|
export const TextContainer = styled.span.withConfig({
|
90
90
|
displayName: "Item__TextContainer",
|
91
|
-
componentId: "jqpvy8-3"
|
91
|
+
componentId: "sc-jqpvy8-3"
|
92
92
|
})([""]);
|
93
93
|
const BaseVisualContainer = styled.div.withConfig({
|
94
94
|
displayName: "Item__BaseVisualContainer",
|
95
|
-
componentId: "jqpvy8-4"
|
95
|
+
componentId: "sc-jqpvy8-4"
|
96
96
|
})(["height:20px;width:", ";margin-right:", ";display:flex;justify-content:center;align-items:center;flex-shrink:0;"], get('space.3'), get('space.2'));
|
97
97
|
const ColoredVisualContainer = styled(BaseVisualContainer).withConfig({
|
98
98
|
displayName: "Item__ColoredVisualContainer",
|
99
|
-
componentId: "jqpvy8-5"
|
99
|
+
componentId: "sc-jqpvy8-5"
|
100
100
|
})(["svg{fill:", ";font-size:", ";}"], ({
|
101
101
|
variant,
|
102
102
|
disabled
|
103
103
|
}) => getItemVariant(variant, disabled).iconColor, get('fontSizes.0'));
|
104
104
|
const LeadingVisualContainer = styled(ColoredVisualContainer).withConfig({
|
105
105
|
displayName: "Item__LeadingVisualContainer",
|
106
|
-
componentId: "jqpvy8-6"
|
106
|
+
componentId: "sc-jqpvy8-6"
|
107
107
|
})(["display:flex;flex-direction:column;justify-content:center;"]);
|
108
108
|
const TrailingContent = styled(ColoredVisualContainer).withConfig({
|
109
109
|
displayName: "Item__TrailingContent",
|
110
|
-
componentId: "jqpvy8-7"
|
110
|
+
componentId: "sc-jqpvy8-7"
|
111
111
|
})(["color:", "};margin-left:", ";margin-right:0;width:auto;div:nth-child(2){margin-left:", ";}"], ({
|
112
112
|
variant,
|
113
113
|
disabled
|
114
114
|
}) => getItemVariant(variant, disabled).annotationColor, get('space.2'), get('space.2'));
|
115
115
|
const DescriptionContainer = styled.span.withConfig({
|
116
116
|
displayName: "Item__DescriptionContainer",
|
117
|
-
componentId: "jqpvy8-8"
|
117
|
+
componentId: "sc-jqpvy8-8"
|
118
118
|
})(["color:", ";font-size:", ";line-height:16px;margin-left:var(--description-container-margin-left);min-width:0;flex-grow:1;flex-basis:var(--description-container-flex-basis);"], get('colors.fg.muted'), get('fontSizes.0'));
|
119
119
|
const MultiSelectIcon = styled.svg.withConfig({
|
120
120
|
displayName: "Item__MultiSelectIcon",
|
121
|
-
componentId: "jqpvy8-9"
|
121
|
+
componentId: "sc-jqpvy8-9"
|
122
122
|
})(["rect{fill:", ";stroke:", ";shape-rendering:auto;}path{fill:", ";boxshadow:", ";opacity:", ";}"], ({
|
123
123
|
selected
|
124
124
|
}) => selected ? get('colors.accent.fg') : get('colors.canvas.default'), ({
|
@@ -22,7 +22,7 @@ function isGroupedListProps(props) {
|
|
22
22
|
|
23
23
|
const StyledList = styled.div.withConfig({
|
24
24
|
displayName: "List__StyledList",
|
25
|
-
componentId: "yr2k7d-0"
|
25
|
+
componentId: "sc-yr2k7d-0"
|
26
26
|
})(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], get('fontSizes.1'), hasActiveDescendantAttribute, get('colors.border.muted'));
|
27
27
|
/**
|
28
28
|
* Returns `sx` prop values for `List` children matching the given `List` style variation.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/** This context can be used by components that compose ActionList inside a Menu */
|
2
2
|
import React from 'react';
|
3
3
|
declare type ContextProps = {
|
4
|
-
|
4
|
+
container?: string;
|
5
5
|
listRole?: string;
|
6
6
|
itemRole?: string;
|
7
|
-
afterSelect?:
|
7
|
+
afterSelect?: Function;
|
8
8
|
};
|
9
|
-
export declare const
|
9
|
+
export declare const ActionListContainerContext: React.Context<ContextProps>;
|
10
10
|
export {};
|
@@ -8,7 +8,7 @@ import Box from '../Box';
|
|
8
8
|
import sx, { merge } from '../sx';
|
9
9
|
import createSlots from '../utils/create-slots';
|
10
10
|
import { ListContext } from './List';
|
11
|
-
import {
|
11
|
+
import { ActionListContainerContext } from './ActionListContainerContext';
|
12
12
|
import { Selection } from './Selection';
|
13
13
|
export const getVariantStyles = (variant, disabled) => {
|
14
14
|
if (disabled) {
|
@@ -44,7 +44,7 @@ const {
|
|
44
44
|
export { Slot };
|
45
45
|
const LiBox = styled.li.withConfig({
|
46
46
|
displayName: "Item__LiBox",
|
47
|
-
componentId: "c3scat-0"
|
47
|
+
componentId: "sc-c3scat-0"
|
48
48
|
})(sx);
|
49
49
|
export const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
|
50
50
|
|
@@ -66,7 +66,7 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
66
66
|
const {
|
67
67
|
itemRole,
|
68
68
|
afterSelect
|
69
|
-
} = React.useContext(
|
69
|
+
} = React.useContext(ActionListContainerContext);
|
70
70
|
const {
|
71
71
|
theme
|
72
72
|
} = useTheme();
|
@@ -139,21 +139,19 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
139
139
|
}
|
140
140
|
};
|
141
141
|
const clickHandler = React.useCallback(event => {
|
142
|
-
if (typeof onSelect !== 'function') return;
|
143
142
|
if (disabled) return;
|
144
143
|
|
145
144
|
if (!event.defaultPrevented) {
|
146
|
-
onSelect(event); // if this Item is inside a Menu, close the Menu
|
145
|
+
if (typeof onSelect === 'function') onSelect(event); // if this Item is inside a Menu, close the Menu
|
147
146
|
|
148
147
|
if (typeof afterSelect === 'function') afterSelect();
|
149
148
|
}
|
150
149
|
}, [onSelect, disabled, afterSelect]);
|
151
150
|
const keyPressHandler = React.useCallback(event => {
|
152
|
-
if (typeof onSelect !== 'function') return;
|
153
151
|
if (disabled) return;
|
154
152
|
|
155
153
|
if (!event.defaultPrevented && [' ', 'Enter'].includes(event.key)) {
|
156
|
-
onSelect(event); // if this Item is inside a Menu, close the Menu
|
154
|
+
if (typeof onSelect === 'function') onSelect(event); // if this Item is inside a Menu, close the Menu
|
157
155
|
|
158
156
|
if (typeof afterSelect === 'function') afterSelect();
|
159
157
|
}
|
@@ -3,11 +3,11 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
3
3
|
import React from 'react';
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import sx, { merge } from '../sx';
|
6
|
-
import {
|
6
|
+
import { ActionListContainerContext } from './ActionListContainerContext';
|
7
7
|
export const ListContext = /*#__PURE__*/React.createContext({});
|
8
8
|
const ListBox = styled.ul.withConfig({
|
9
9
|
displayName: "List__ListBox",
|
10
|
-
componentId: "cvbq60-0"
|
10
|
+
componentId: "sc-cvbq60-0"
|
11
11
|
})(sx);
|
12
12
|
export const List = /*#__PURE__*/React.forwardRef(({
|
13
13
|
variant = 'inset',
|
@@ -27,7 +27,7 @@ export const List = /*#__PURE__*/React.forwardRef(({
|
|
27
27
|
|
28
28
|
const {
|
29
29
|
listRole
|
30
|
-
} = React.useContext(
|
30
|
+
} = React.useContext(ActionListContainerContext);
|
31
31
|
return /*#__PURE__*/React.createElement(ListBox, _extends({
|
32
32
|
sx: merge(styles, sxProp),
|
33
33
|
role: role || listRole
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import { CheckIcon } from '@primer/octicons-react';
|
3
3
|
import { ListContext } from './List';
|
4
4
|
import { GroupContext } from './Group';
|
5
|
-
import {
|
5
|
+
import { ActionListContainerContext } from './ActionListContainerContext';
|
6
6
|
import { LeadingVisualContainer } from './Visuals';
|
7
7
|
export const Selection = ({
|
8
8
|
selected
|
@@ -14,8 +14,8 @@ export const Selection = ({
|
|
14
14
|
selectionVariant: groupSelectionVariant
|
15
15
|
} = React.useContext(GroupContext);
|
16
16
|
const {
|
17
|
-
|
18
|
-
} = React.useContext(
|
17
|
+
container
|
18
|
+
} = React.useContext(ActionListContainerContext);
|
19
19
|
/** selectionVariant in Group can override the selectionVariant in List root */
|
20
20
|
|
21
21
|
const selectionVariant = typeof groupSelectionVariant !== 'undefined' ? groupSelectionVariant : listSelectionVariant; // if selectionVariant is not set on List, don't show selection
|
@@ -26,7 +26,7 @@ export const Selection = ({
|
|
26
26
|
return null;
|
27
27
|
}
|
28
28
|
|
29
|
-
if (
|
29
|
+
if (container === 'ActionMenu') {
|
30
30
|
throw new Error('ActionList cannot have a selectionVariant inside ActionMenu, please use DropdownMenu or SelectPanel instead. More information: https://primer.style/design/components/action-list#application');
|
31
31
|
return null;
|
32
32
|
}
|
package/lib-esm/ActionMenu2.d.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import { ButtonProps } from './Button';
|
2
2
|
import React from 'react';
|
3
|
+
import { AnchoredOverlayProps } from './AnchoredOverlay';
|
3
4
|
import { OverlayProps } from './Overlay';
|
4
|
-
|
5
|
-
declare
|
5
|
+
declare type MenuContextProps = Pick<AnchoredOverlayProps, 'anchorRef' | 'renderAnchor' | 'open' | 'onOpen' | 'onClose'>;
|
6
|
+
export declare const MenuContext: React.Context<MenuContextProps>;
|
7
|
+
export declare type ActionMenuProps = {
|
6
8
|
/**
|
7
|
-
* Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with
|
9
|
+
* Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
|
8
10
|
*/
|
9
11
|
children: React.ReactElement[] | React.ReactElement;
|
10
12
|
/**
|
@@ -15,20 +17,22 @@ declare type ActionMenuBaseProps = {
|
|
15
17
|
* If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`.
|
16
18
|
*/
|
17
19
|
onOpenChange?: (s: boolean) => void;
|
18
|
-
|
19
|
-
* Props to be spread on the internal `Overlay` component.
|
20
|
-
*/
|
21
|
-
overlayProps?: Partial<OverlayProps>;
|
22
|
-
};
|
23
|
-
export declare type ActionMenuProps = ActionMenuBaseProps & AnchoredOverlayWrapperAnchorProps;
|
20
|
+
} & Pick<AnchoredOverlayProps, 'anchorRef'>;
|
24
21
|
export declare type MenuAnchorProps = {
|
25
22
|
children: React.ReactElement;
|
26
23
|
};
|
27
24
|
/** this component is syntactical sugar 🍭 */
|
28
25
|
export declare type MenuButtonProps = ButtonProps;
|
26
|
+
declare type MenuOverlayProps = Partial<OverlayProps> & {
|
27
|
+
/**
|
28
|
+
* Recommended: `ActionList`
|
29
|
+
*/
|
30
|
+
children: React.ReactElement[] | React.ReactElement;
|
31
|
+
};
|
29
32
|
export declare const ActionMenu: React.FC<ActionMenuProps> & {
|
30
33
|
Button: React.ForwardRefExoticComponent<Pick<{
|
31
34
|
color?: string | undefined;
|
35
|
+
property?: string | undefined;
|
32
36
|
translate?: "yes" | "no" | undefined;
|
33
37
|
hidden?: boolean | undefined;
|
34
38
|
children?: React.ReactNode;
|
@@ -64,7 +68,6 @@ export declare const ActionMenu: React.FC<ActionMenuProps> & {
|
|
64
68
|
datatype?: string | undefined;
|
65
69
|
inlist?: any;
|
66
70
|
prefix?: string | undefined;
|
67
|
-
property?: string | undefined;
|
68
71
|
resource?: string | undefined;
|
69
72
|
typeof?: string | undefined;
|
70
73
|
vocab?: string | undefined;
|
@@ -293,8 +296,8 @@ export declare const ActionMenu: React.FC<ActionMenuProps> & {
|
|
293
296
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
294
297
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
295
298
|
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
296
|
-
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
297
299
|
disabled?: boolean | undefined;
|
300
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
298
301
|
autoFocus?: boolean | undefined;
|
299
302
|
formAction?: string | undefined;
|
300
303
|
formEncType?: string | undefined;
|
@@ -303,8 +306,12 @@ export declare const ActionMenu: React.FC<ActionMenuProps> & {
|
|
303
306
|
formTarget?: string | undefined;
|
304
307
|
} & {
|
305
308
|
theme?: any;
|
306
|
-
}, "
|
309
|
+
}, "theme" | "sx" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement> | keyof {
|
310
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
311
|
+
variant?: "small" | "medium" | "large" | undefined;
|
312
|
+
}> & React.RefAttributes<React.RefObject<HTMLElement> | undefined>>;
|
307
313
|
Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<React.RefObject<HTMLElement> | undefined>>;
|
314
|
+
Overlay: React.FC<MenuOverlayProps>;
|
308
315
|
Divider: React.FC<import("./sx").SxProp>;
|
309
316
|
};
|
310
317
|
export {};
|
package/lib-esm/ActionMenu2.js
CHANGED
@@ -1,49 +1,49 @@
|
|
1
1
|
import Button from './Button';
|
2
2
|
import React from 'react';
|
3
3
|
import { AnchoredOverlay } from './AnchoredOverlay';
|
4
|
-
import { useProvidedStateOrCreate } from './hooks
|
5
|
-
import { useProvidedRefOrCreate } from './hooks';
|
4
|
+
import { useProvidedRefOrCreate, useProvidedStateOrCreate } from './hooks';
|
6
5
|
import { Divider } from './ActionList2/Divider';
|
7
|
-
import {
|
6
|
+
import { ActionListContainerContext } from './ActionList2/ActionListContainerContext';
|
7
|
+
export const MenuContext = /*#__PURE__*/React.createContext({
|
8
|
+
renderAnchor: null,
|
9
|
+
open: false
|
10
|
+
});
|
8
11
|
|
9
|
-
const
|
12
|
+
const Menu = ({
|
10
13
|
anchorRef: externalAnchorRef,
|
11
14
|
open,
|
12
15
|
onOpenChange,
|
13
|
-
overlayProps,
|
14
16
|
children
|
15
17
|
}) => {
|
16
18
|
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate(open, onOpenChange, false);
|
17
|
-
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
18
19
|
const onOpen = React.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
|
19
20
|
const onClose = React.useCallback(() => setCombinedOpenState(false), [setCombinedOpenState]);
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
22
|
+
let renderAnchor = null; // 🚨 Hack for good API!
|
23
|
+
// we strip out Anchor from children and pass it to AnchoredOverlay to render
|
24
|
+
// with additional props for accessibility
|
25
|
+
|
26
|
+
const contents = React.Children.map(children, child => {
|
23
27
|
if (child.type === MenuButton || child.type === Anchor) {
|
24
28
|
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child, anchorProps);
|
25
|
-
|
26
|
-
|
29
|
+
|
30
|
+
return null;
|
27
31
|
}
|
32
|
+
|
33
|
+
return child;
|
28
34
|
});
|
29
|
-
return /*#__PURE__*/React.createElement(
|
30
|
-
renderAnchor: renderAnchor,
|
31
|
-
anchorRef: anchorRef,
|
32
|
-
open: combinedOpenState,
|
33
|
-
onOpen: onOpen,
|
34
|
-
onClose: onClose,
|
35
|
-
overlayProps: overlayProps
|
36
|
-
}, /*#__PURE__*/React.createElement(ActionListMenuContext.Provider, {
|
35
|
+
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
37
36
|
value: {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
anchorRef,
|
38
|
+
renderAnchor,
|
39
|
+
open: combinedOpenState,
|
40
|
+
onOpen,
|
41
|
+
onClose
|
42
42
|
}
|
43
|
-
}, contents)
|
43
|
+
}, contents);
|
44
44
|
};
|
45
45
|
|
46
|
-
|
46
|
+
Menu.displayName = "Menu";
|
47
47
|
const Anchor = /*#__PURE__*/React.forwardRef(({
|
48
48
|
children,
|
49
49
|
...anchorProps
|
@@ -59,9 +59,42 @@ const MenuButton = /*#__PURE__*/React.forwardRef((props, anchorRef) => {
|
|
59
59
|
ref: anchorRef
|
60
60
|
}, /*#__PURE__*/React.createElement(Button, props));
|
61
61
|
});
|
62
|
-
|
63
|
-
|
62
|
+
|
63
|
+
const Overlay = ({
|
64
|
+
children,
|
65
|
+
...overlayProps
|
66
|
+
}) => {
|
67
|
+
// we typecast anchorRef as required instead of optional
|
68
|
+
// because we know that we're setting it in context in Menu
|
69
|
+
const {
|
70
|
+
anchorRef,
|
71
|
+
renderAnchor,
|
72
|
+
open,
|
73
|
+
onOpen,
|
74
|
+
onClose
|
75
|
+
} = React.useContext(MenuContext);
|
76
|
+
return /*#__PURE__*/React.createElement(AnchoredOverlay, {
|
77
|
+
anchorRef: anchorRef,
|
78
|
+
renderAnchor: renderAnchor,
|
79
|
+
open: open,
|
80
|
+
onOpen: onOpen,
|
81
|
+
onClose: onClose,
|
82
|
+
overlayProps: overlayProps
|
83
|
+
}, /*#__PURE__*/React.createElement(ActionListContainerContext.Provider, {
|
84
|
+
value: {
|
85
|
+
container: 'ActionMenu',
|
86
|
+
listRole: 'menu',
|
87
|
+
itemRole: 'menuitem',
|
88
|
+
afterSelect: onClose
|
89
|
+
}
|
90
|
+
}, children));
|
91
|
+
};
|
92
|
+
|
93
|
+
Overlay.displayName = "Overlay";
|
94
|
+
Menu.displayName = 'ActionMenu';
|
95
|
+
export const ActionMenu = Object.assign(Menu, {
|
64
96
|
Button: MenuButton,
|
65
97
|
Anchor,
|
98
|
+
Overlay,
|
66
99
|
Divider
|
67
100
|
});
|
@@ -15,6 +15,7 @@ declare const _default: React.FC<{
|
|
15
15
|
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
16
16
|
[x: string]: any;
|
17
17
|
[x: number]: any;
|
18
|
+
[x: symbol]: any;
|
18
19
|
} & {
|
19
20
|
theme?: any;
|
20
21
|
} & {
|
@@ -27,6 +28,7 @@ declare const _default: React.FC<{
|
|
27
28
|
}> | undefined;
|
28
29
|
} & Pick<{
|
29
30
|
color?: string | undefined;
|
31
|
+
property?: string | undefined;
|
30
32
|
maxWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
31
33
|
minWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
32
34
|
translate?: "yes" | "no" | undefined;
|
@@ -62,7 +64,6 @@ declare const _default: React.FC<{
|
|
62
64
|
datatype?: string | undefined;
|
63
65
|
inlist?: any;
|
64
66
|
prefix?: string | undefined;
|
65
|
-
property?: string | undefined;
|
66
67
|
resource?: string | undefined;
|
67
68
|
typeof?: string | undefined;
|
68
69
|
vocab?: string | undefined;
|
@@ -7,6 +7,7 @@ declare type InternalAutocompleteInputProps = {
|
|
7
7
|
declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
8
8
|
[x: string]: any;
|
9
9
|
[x: number]: any;
|
10
|
+
[x: symbol]: any;
|
10
11
|
} & {
|
11
12
|
theme?: any;
|
12
13
|
} & {
|
@@ -19,6 +20,7 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
|
|
19
20
|
}> | undefined;
|
20
21
|
} & Pick<{
|
21
22
|
color?: string | undefined;
|
23
|
+
property?: string | undefined;
|
22
24
|
maxWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
23
25
|
minWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
24
26
|
translate?: "yes" | "no" | undefined;
|
@@ -54,7 +56,6 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
|
|
54
56
|
datatype?: string | undefined;
|
55
57
|
inlist?: any;
|
56
58
|
prefix?: string | undefined;
|
57
|
-
property?: string | undefined;
|
58
59
|
resource?: string | undefined;
|
59
60
|
typeof?: string | undefined;
|
60
61
|
vocab?: string | undefined;
|
package/lib-esm/BaseStyles.js
CHANGED
@@ -3,28 +3,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
3
3
|
import React from 'react';
|
4
4
|
import styled, { createGlobalStyle } from 'styled-components';
|
5
5
|
import { COMMON, TYPOGRAPHY } from './constants';
|
6
|
-
const GlobalStyle = createGlobalStyle
|
7
|
-
* { box-sizing: border-box; }
|
8
|
-
body { margin: 0; }
|
9
|
-
table { border-collapse: collapse; }
|
10
|
-
|
11
|
-
[role="button"]:focus:not(:focus-visible):not(.focus-visible),
|
12
|
-
[role="tabpanel"][tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),
|
13
|
-
button:focus:not(:focus-visible):not(.focus-visible),
|
14
|
-
summary:focus:not(:focus-visible):not(.focus-visible),
|
15
|
-
a:focus:not(:focus-visible):not(.focus-visible) {
|
16
|
-
outline: none;
|
17
|
-
box-shadow: none;
|
18
|
-
}
|
19
|
-
|
20
|
-
[tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),
|
21
|
-
details-dialog:focus:not(:focus-visible):not(.focus-visible) {
|
22
|
-
outline: none;
|
23
|
-
}
|
24
|
-
`;
|
6
|
+
const GlobalStyle = createGlobalStyle(["*{box-sizing:border-box;}body{margin:0;}table{border-collapse:collapse;}[role=\"button\"]:focus:not(:focus-visible):not(.focus-visible),[role=\"tabpanel\"][tabindex=\"0\"]:focus:not(:focus-visible):not(.focus-visible),button:focus:not(:focus-visible):not(.focus-visible),summary:focus:not(:focus-visible):not(.focus-visible),a:focus:not(:focus-visible):not(.focus-visible){outline:none;box-shadow:none;}[tabindex=\"0\"]:focus:not(:focus-visible):not(.focus-visible),details-dialog:focus:not(:focus-visible):not(.focus-visible){outline:none;}"]);
|
25
7
|
const Base = styled.div.withConfig({
|
26
8
|
displayName: "BaseStyles__Base",
|
27
|
-
componentId: "qvuaww-0"
|
9
|
+
componentId: "sc-qvuaww-0"
|
28
10
|
})(["", ";", ";"], TYPOGRAPHY, COMMON);
|
29
11
|
|
30
12
|
function BaseStyles(props) {
|
package/lib-esm/BorderBox.js
CHANGED
package/lib-esm/Box.js
CHANGED
@@ -3,6 +3,6 @@ import { background, border, color, flexbox, grid, layout, position, shadow, spa
|
|
3
3
|
import sx from './sx';
|
4
4
|
const Box = styled.div.withConfig({
|
5
5
|
displayName: "Box",
|
6
|
-
componentId: "nv15kw-0"
|
6
|
+
componentId: "sc-nv15kw-0"
|
7
7
|
})(space, color, typography, layout, flexbox, grid, background, border, position, shadow, sx);
|
8
8
|
export default Box;
|
package/lib-esm/BranchName.js
CHANGED
@@ -4,5 +4,5 @@ import sx from './sx';
|
|
4
4
|
const BranchName = styled.a.withConfig({
|
5
5
|
displayName: "BranchName",
|
6
6
|
componentId: "sc-167ouzm-0"
|
7
|
-
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.fg
|
7
|
+
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";text-decoration:none;", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.accent.fg'), get('colors.accent.subtle'), get('radii.2'), sx);
|
8
8
|
export default BranchName;
|
package/lib-esm/Breadcrumbs.js
CHANGED
@@ -8,11 +8,11 @@ import sx from './sx';
|
|
8
8
|
const SELECTED_CLASS = 'selected';
|
9
9
|
const Wrapper = styled.li.withConfig({
|
10
10
|
displayName: "Breadcrumbs__Wrapper",
|
11
|
-
componentId: "hwwoo0-0"
|
11
|
+
componentId: "sc-hwwoo0-0"
|
12
12
|
})(["display:inline-block;white-space:nowrap;list-style:none;&::after{padding-right:0.5em;padding-left:0.5em;color:", ";font-size:", ";content:'/';}&:first-child{margin-left:0;}&:last-child{&::after{content:none;}}"], get('colors.fg.muted'), get('fontSizes.1'));
|
13
13
|
const BreadcrumbsBase = styled.nav.withConfig({
|
14
14
|
displayName: "Breadcrumbs__BreadcrumbsBase",
|
15
|
-
componentId: "hwwoo0-1"
|
15
|
+
componentId: "sc-hwwoo0-1"
|
16
16
|
})(["display:flex;justify-content:space-between;", ";"], sx);
|
17
17
|
|
18
18
|
function Breadcrumbs({
|
@@ -39,7 +39,7 @@ const BreadcrumbsItem = styled.a.attrs(props => ({
|
|
39
39
|
'aria-current': props.selected ? 'page' : null
|
40
40
|
})).withConfig({
|
41
41
|
displayName: "Breadcrumbs__BreadcrumbsItem",
|
42
|
-
componentId: "hwwoo0-2"
|
42
|
+
componentId: "sc-hwwoo0-2"
|
43
43
|
})(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", ";"], get('colors.accent.fg'), get('fontSizes.1'), get('colors.fg.default'), sx);
|
44
44
|
Breadcrumbs.displayName = 'Breadcrumbs';
|
45
45
|
BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
|
@@ -6,6 +6,7 @@ declare const Button: import("styled-components").StyledComponent<"button", any,
|
|
6
6
|
variant?: "small" | "medium" | "large" | undefined;
|
7
7
|
} & {
|
8
8
|
color?: string | undefined;
|
9
|
+
property?: string | undefined;
|
9
10
|
translate?: "yes" | "no" | undefined;
|
10
11
|
hidden?: boolean | undefined;
|
11
12
|
children?: import("react").ReactNode;
|
@@ -40,7 +41,6 @@ declare const Button: import("styled-components").StyledComponent<"button", any,
|
|
40
41
|
datatype?: string | undefined;
|
41
42
|
inlist?: any;
|
42
43
|
prefix?: string | undefined;
|
43
|
-
property?: string | undefined;
|
44
44
|
resource?: string | undefined;
|
45
45
|
typeof?: string | undefined;
|
46
46
|
vocab?: string | undefined;
|
@@ -269,8 +269,8 @@ declare const Button: import("styled-components").StyledComponent<"button", any,
|
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
271
|
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
272
|
-
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
273
272
|
disabled?: boolean | undefined;
|
273
|
+
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
274
274
|
autoFocus?: boolean | undefined;
|
275
275
|
formAction?: string | undefined;
|
276
276
|
formEncType?: string | undefined;
|
package/lib-esm/Button/Button.js
CHANGED
@@ -4,6 +4,6 @@ import sx from '../sx';
|
|
4
4
|
import ButtonBase from './ButtonBase';
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
|
-
componentId: "xjtz72-0"
|
7
|
+
componentId: "sc-xjtz72-0"
|
8
8
|
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), sx);
|
9
9
|
export default Button;
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { ComponentProps } from '../utils/types';
|
3
3
|
declare const ButtonClose: React.ForwardRefExoticComponent<Pick<{
|
4
4
|
color?: string | undefined;
|
5
|
+
property?: string | undefined;
|
5
6
|
translate?: "yes" | "no" | undefined;
|
6
7
|
hidden?: boolean | undefined;
|
7
8
|
children?: React.ReactNode;
|
@@ -36,7 +37,6 @@ declare const ButtonClose: React.ForwardRefExoticComponent<Pick<{
|
|
36
37
|
datatype?: string | undefined;
|
37
38
|
inlist?: any;
|
38
39
|
prefix?: string | undefined;
|
39
|
-
property?: string | undefined;
|
40
40
|
resource?: string | undefined;
|
41
41
|
typeof?: string | undefined;
|
42
42
|
vocab?: string | undefined;
|
@@ -274,6 +274,6 @@ declare const ButtonClose: React.ForwardRefExoticComponent<Pick<{
|
|
274
274
|
formTarget?: string | undefined;
|
275
275
|
} & {
|
276
276
|
theme?: any;
|
277
|
-
}, "
|
277
|
+
}, "theme" | "sx" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<HTMLButtonElement>>;
|
278
278
|
export declare type ButtonCloseProps = ComponentProps<typeof ButtonClose>;
|
279
279
|
export default ButtonClose;
|