@primer/components 0.0.0-202111321290 → 0.0.0-202111613539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.esm.js +2 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList2/{MenuContext.d.ts → ActionListContainerContext.d.ts} +3 -3
- package/lib/ActionList2/{MenuContext.js → ActionListContainerContext.js} +3 -3
- package/lib/ActionList2/Item.js +4 -6
- package/lib/ActionList2/List.js +2 -2
- package/lib/ActionList2/Selection.js +4 -4
- package/lib/ActionMenu2.d.ts +13 -9
- package/lib/ActionMenu2.js +63 -29
- package/lib/Autocomplete/AutocompleteMenu.js +13 -6
- package/lib/Checkbox.d.ts +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +9 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -24
- 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 +4 -6
- package/lib-esm/ActionList2/List.js +2 -2
- package/lib-esm/ActionList2/Selection.js +4 -4
- package/lib-esm/ActionMenu2.d.ts +13 -9
- package/lib-esm/ActionMenu2.js +60 -27
- package/lib-esm/Autocomplete/AutocompleteMenu.js +13 -3
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +2 -1
- package/lib-esm/index.d.ts +0 -3
- package/lib-esm/index.js +0 -3
- package/package.json +2 -2
- package/lib/CheckboxInputField.d.ts +0 -10
- package/lib/CheckboxInputField.js +0 -73
- package/lib/RadioInputField.d.ts +0 -8
- package/lib/RadioInputField.js +0 -82
- package/lib/TextInputField.d.ts +0 -583
- package/lib/TextInputField.js +0 -66
- package/lib/_InputCaption.d.ts +0 -13
- package/lib/_InputCaption.js +0 -26
- package/lib/_InputField/InputField.d.ts +0 -39
- package/lib/_InputField/InputField.js +0 -90
- package/lib/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib/_InputField/InputFieldCaption.js +0 -30
- package/lib/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib/_InputField/InputFieldLabel.js +0 -34
- package/lib/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib/_InputField/InputFieldValidation.js +0 -17
- package/lib/_InputField/ToggleInputField.d.ts +0 -13
- package/lib/_InputField/ToggleInputField.js +0 -71
- package/lib/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib/_InputField/ToggleInputLeadingVisual.js +0 -22
- package/lib/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib/_InputField/ValidationAnimationContainer.js +0 -48
- package/lib/_InputField/index.d.ts +0 -1
- package/lib/_InputField/index.js +0 -15
- package/lib/_InputField/slots.d.ts +0 -13
- package/lib/_InputField/slots.js +0 -17
- package/lib/_InputLabel.d.ts +0 -8
- package/lib/_InputLabel.js +0 -44
- package/lib/_InputValidation.d.ts +0 -8
- package/lib/_InputValidation.js +0 -56
- package/lib/_VisuallyHidden.d.ts +0 -6
- package/lib/_VisuallyHidden.js +0 -39
- package/lib/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib/utils/types/FormValidationStatus.js +0 -1
- package/lib-esm/CheckboxInputField.d.ts +0 -10
- package/lib-esm/CheckboxInputField.js +0 -56
- package/lib-esm/RadioInputField.d.ts +0 -8
- package/lib-esm/RadioInputField.js +0 -65
- package/lib-esm/TextInputField.d.ts +0 -583
- package/lib-esm/TextInputField.js +0 -50
- package/lib-esm/_InputCaption.d.ts +0 -13
- package/lib-esm/_InputCaption.js +0 -15
- package/lib-esm/_InputField/InputField.d.ts +0 -39
- package/lib-esm/_InputField/InputField.js +0 -70
- package/lib-esm/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib-esm/_InputField/InputFieldCaption.js +0 -18
- package/lib-esm/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib-esm/_InputField/InputFieldLabel.js +0 -22
- package/lib-esm/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib-esm/_InputField/InputFieldValidation.js +0 -7
- package/lib-esm/_InputField/ToggleInputField.d.ts +0 -13
- package/lib-esm/_InputField/ToggleInputField.js +0 -54
- package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib-esm/_InputField/ToggleInputLeadingVisual.js +0 -11
- package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib-esm/_InputField/ValidationAnimationContainer.js +0 -33
- package/lib-esm/_InputField/index.d.ts +0 -1
- package/lib-esm/_InputField/index.js +0 -1
- package/lib-esm/_InputField/slots.d.ts +0 -13
- package/lib-esm/_InputField/slots.js +0 -5
- package/lib-esm/_InputLabel.d.ts +0 -8
- package/lib-esm/_InputLabel.js +0 -32
- package/lib-esm/_InputValidation.d.ts +0 -8
- package/lib-esm/_InputValidation.js +0 -43
- package/lib-esm/_VisuallyHidden.d.ts +0 -6
- package/lib-esm/_VisuallyHidden.js +0 -26
- package/lib-esm/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib-esm/utils/types/FormValidationStatus.js +0 -1
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
|
});
|
@@ -6,7 +6,6 @@ import { AutocompleteContext } from './AutocompleteContext';
|
|
6
6
|
import { PlusIcon } from '@primer/octicons-react';
|
7
7
|
import { uniqueId } from '../utils/uniqueId';
|
8
8
|
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
9
|
-
import VisuallyHidden from '../_VisuallyHidden';
|
10
9
|
|
11
10
|
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
12
11
|
|
@@ -165,8 +164,19 @@ function AutocompleteMenu(props) {
|
|
165
164
|
setSelectedItemLength(selectedItemIds.length);
|
166
165
|
}
|
167
166
|
}, [selectedItemIds, setSelectedItemLength]);
|
168
|
-
return /*#__PURE__*/React.createElement(
|
169
|
-
|
167
|
+
return /*#__PURE__*/React.createElement(Box, {
|
168
|
+
sx: !showMenu ? {
|
169
|
+
// visually hides this label for sighted users
|
170
|
+
position: 'absolute',
|
171
|
+
width: '1px',
|
172
|
+
height: '1px',
|
173
|
+
padding: '0',
|
174
|
+
margin: '-1px',
|
175
|
+
overflow: 'hidden',
|
176
|
+
clip: 'rect(0, 0, 0, 0)',
|
177
|
+
whiteSpace: 'nowrap',
|
178
|
+
borderWidth: '0'
|
179
|
+
} : {}
|
170
180
|
}, loading ? /*#__PURE__*/React.createElement(Box, {
|
171
181
|
p: 3,
|
172
182
|
display: "flex",
|
package/lib-esm/Checkbox.d.ts
CHANGED
@@ -25,5 +25,5 @@ export declare type CheckboxProps = {
|
|
25
25
|
/**
|
26
26
|
* An accessible, native checkbox component
|
27
27
|
*/
|
28
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "
|
28
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "indeterminate" | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
|
29
29
|
export default Checkbox;
|
package/lib-esm/hooks/index.d.ts
CHANGED
@@ -9,3 +9,4 @@ export { useAnchoredPosition } from './useAnchoredPosition';
|
|
9
9
|
export { useOverlay } from './useOverlay';
|
10
10
|
export type { UseOverlaySettings } from './useOverlay';
|
11
11
|
export { useRenderForcingRef } from './useRenderForcingRef';
|
12
|
+
export { useProvidedStateOrCreate } from './useProvidedStateOrCreate';
|
package/lib-esm/hooks/index.js
CHANGED
@@ -4,4 +4,5 @@ export { useOnEscapePress } from './useOnEscapePress';
|
|
4
4
|
export { useOpenAndCloseFocus } from './useOpenAndCloseFocus';
|
5
5
|
export { useAnchoredPosition } from './useAnchoredPosition';
|
6
6
|
export { useOverlay } from './useOverlay';
|
7
|
-
export { useRenderForcingRef } from './useRenderForcingRef';
|
7
|
+
export { useRenderForcingRef } from './useRenderForcingRef';
|
8
|
+
export { useProvidedStateOrCreate } from './useProvidedStateOrCreate';
|
package/lib-esm/index.d.ts
CHANGED
@@ -46,7 +46,6 @@ export { default as CircleBadge } from './CircleBadge';
|
|
46
46
|
export type { CircleBadgeProps, CircleBadgeIconProps } from './CircleBadge';
|
47
47
|
export { default as CircleOcticon } from './CircleOcticon';
|
48
48
|
export type { CircleOcticonProps } from './CircleOcticon';
|
49
|
-
export { default as CheckboxInputField } from './CheckboxInputField';
|
50
49
|
export { default as CounterLabel } from './CounterLabel';
|
51
50
|
export type { CounterLabelProps } from './CounterLabel';
|
52
51
|
export { default as Details } from './Details';
|
@@ -87,7 +86,6 @@ export { default as Popover } from './Popover';
|
|
87
86
|
export type { PopoverProps, PopoverContentProps } from './Popover';
|
88
87
|
export { default as ProgressBar } from './ProgressBar';
|
89
88
|
export type { ProgressBarProps } from './ProgressBar';
|
90
|
-
export { default as RadioInputField } from './RadioInputField';
|
91
89
|
export { default as SelectMenu } from './SelectMenu';
|
92
90
|
export type { SelectMenuProps, SelectMenuDividerProps, SelectMenuFilterProps, SelectMenuFooterProps, SelectMenuItemProps, SelectMenuListProps, SelectMenuModalProps, SelectMenuTabsProps, SelectMenuHeaderProps, SelectMenuTabProps, SelectMenuTabPanelProps, SelectMenuLoadingAnimationProps } from './SelectMenu';
|
93
91
|
export { default as SideNav } from './SideNav';
|
@@ -104,7 +102,6 @@ export { default as TabNav } from './TabNav';
|
|
104
102
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
105
103
|
export { default as TextInput } from './TextInput';
|
106
104
|
export type { TextInputProps } from './TextInput';
|
107
|
-
export { default as TextInputField } from './TextInputField';
|
108
105
|
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
109
106
|
export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
110
107
|
export { default as Text } from './Text';
|
package/lib-esm/index.js
CHANGED
@@ -30,7 +30,6 @@ export { NewButton } from './NewButton';
|
|
30
30
|
export { default as Caret } from './Caret';
|
31
31
|
export { default as CircleBadge } from './CircleBadge';
|
32
32
|
export { default as CircleOcticon } from './CircleOcticon';
|
33
|
-
export { default as CheckboxInputField } from './CheckboxInputField';
|
34
33
|
export { default as CounterLabel } from './CounterLabel';
|
35
34
|
export { default as Details } from './Details';
|
36
35
|
export { default as Dialog } from './Dialog';
|
@@ -56,7 +55,6 @@ export { default as Popover } from './Popover';
|
|
56
55
|
// export {default as Portal, registerPortalRoot} from './Portal'
|
57
56
|
// export type {PortalProps} from './Portal'
|
58
57
|
export { default as ProgressBar } from './ProgressBar';
|
59
|
-
export { default as RadioInputField } from './RadioInputField';
|
60
58
|
export { default as SelectMenu } from './SelectMenu';
|
61
59
|
export { default as SideNav } from './SideNav';
|
62
60
|
export { default as Spinner } from './Spinner';
|
@@ -65,7 +63,6 @@ export { default as StyledOcticon } from './StyledOcticon';
|
|
65
63
|
export { default as SubNav } from './SubNav';
|
66
64
|
export { default as TabNav } from './TabNav';
|
67
65
|
export { default as TextInput } from './TextInput';
|
68
|
-
export { default as TextInputField } from './TextInputField';
|
69
66
|
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
70
67
|
export { default as Text } from './Text';
|
71
68
|
export { default as Timeline } from './Timeline';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-202111613539",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"author": "GitHub, Inc.",
|
44
44
|
"license": "MIT",
|
45
45
|
"dependencies": {
|
46
|
-
"@primer/octicons-react": "16.1.
|
46
|
+
"@primer/octicons-react": "^16.1.0",
|
47
47
|
"@primer/primitives": "7.1.1",
|
48
48
|
"@radix-ui/react-polymorphic": "0.0.14",
|
49
49
|
"@react-aria/ssr": "3.1.0",
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
declare const _default: React.FC<import("./_InputField/ToggleInputField").Props> & {
|
3
|
-
Input: React.FC<Omit<React.HTMLProps<HTMLInputElement>, "ref"> & {
|
4
|
-
ref?: React.Ref<HTMLInputElement> | undefined;
|
5
|
-
}>;
|
6
|
-
Caption: React.FC<{}>;
|
7
|
-
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
8
|
-
LeadingVisual: React.FC<{}>;
|
9
|
-
};
|
10
|
-
export default _default;
|
@@ -1,73 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _ = require(".");
|
11
|
-
|
12
|
-
var _InputField = _interopRequireDefault(require("./_InputField/InputField"));
|
13
|
-
|
14
|
-
var _slots = require("./_InputField/slots");
|
15
|
-
|
16
|
-
var _ToggleInputField = _interopRequireDefault(require("./_InputField/ToggleInputField"));
|
17
|
-
|
18
|
-
var _ToggleInputLeadingVisual = _interopRequireDefault(require("./_InputField/ToggleInputLeadingVisual"));
|
19
|
-
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
-
|
24
|
-
const Input = ({
|
25
|
-
id: idProp,
|
26
|
-
required: requiredProp,
|
27
|
-
disabled: disabledProp,
|
28
|
-
...rest
|
29
|
-
}) => {
|
30
|
-
if (idProp) {
|
31
|
-
// eslint-disable-next-line no-console
|
32
|
-
console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
33
|
-
}
|
34
|
-
|
35
|
-
if (disabledProp) {
|
36
|
-
// eslint-disable-next-line no-console
|
37
|
-
console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
38
|
-
}
|
39
|
-
|
40
|
-
if (requiredProp) {
|
41
|
-
// eslint-disable-next-line no-console
|
42
|
-
console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
43
|
-
}
|
44
|
-
|
45
|
-
return /*#__PURE__*/_react.default.createElement(_slots.Slot, {
|
46
|
-
name: "Input"
|
47
|
-
}, ({
|
48
|
-
disabled,
|
49
|
-
id,
|
50
|
-
required,
|
51
|
-
captionId
|
52
|
-
}) => /*#__PURE__*/_react.default.createElement(_.Checkbox, _extends({
|
53
|
-
"aria-describedby": captionId,
|
54
|
-
id: id,
|
55
|
-
required: required,
|
56
|
-
disabled: disabled
|
57
|
-
}, rest)));
|
58
|
-
};
|
59
|
-
|
60
|
-
Input.displayName = "Input";
|
61
|
-
|
62
|
-
const CheckboxInputField = props => /*#__PURE__*/_react.default.createElement(_ToggleInputField.default, props);
|
63
|
-
|
64
|
-
CheckboxInputField.displayName = "CheckboxInputField";
|
65
|
-
|
66
|
-
var _default = Object.assign(CheckboxInputField, {
|
67
|
-
Input,
|
68
|
-
Caption: _InputField.default.Caption,
|
69
|
-
Label: _InputField.default.Label,
|
70
|
-
LeadingVisual: _ToggleInputLeadingVisual.default
|
71
|
-
});
|
72
|
-
|
73
|
-
exports.default = _default;
|
package/lib/RadioInputField.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
declare const _default: React.FC<import("./_InputField/ToggleInputField").Props> & {
|
3
|
-
Input: React.FC<React.HTMLProps<HTMLInputElement>>;
|
4
|
-
Caption: React.FC<{}>;
|
5
|
-
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
6
|
-
LeadingVisual: React.FC<{}>;
|
7
|
-
};
|
8
|
-
export default _default;
|
package/lib/RadioInputField.js
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _InputField = _interopRequireDefault(require("./_InputField/InputField"));
|
11
|
-
|
12
|
-
var _slots = require("./_InputField/slots");
|
13
|
-
|
14
|
-
var _ToggleInputField = _interopRequireDefault(require("./_InputField/ToggleInputField"));
|
15
|
-
|
16
|
-
var _ToggleInputLeadingVisual = _interopRequireDefault(require("./_InputField/ToggleInputLeadingVisual"));
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
21
|
-
|
22
|
-
// TODO: use Primer's checkbox input once it's available
|
23
|
-
// https://github.com/github/primer/issues/489
|
24
|
-
const RadioInput = props => {
|
25
|
-
return /*#__PURE__*/_react.default.createElement("input", _extends({
|
26
|
-
type: "radio"
|
27
|
-
}, props));
|
28
|
-
};
|
29
|
-
|
30
|
-
RadioInput.displayName = "RadioInput";
|
31
|
-
|
32
|
-
// pulling out `id`, `disabled`, and `required` because those should come from the parent TextInputField component
|
33
|
-
const Input = ({
|
34
|
-
id: idProp,
|
35
|
-
required: requiredProp,
|
36
|
-
disabled: disabledProp,
|
37
|
-
...rest
|
38
|
-
}) => {
|
39
|
-
if (idProp) {
|
40
|
-
// eslint-disable-next-line no-console
|
41
|
-
console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
42
|
-
}
|
43
|
-
|
44
|
-
if (disabledProp) {
|
45
|
-
// eslint-disable-next-line no-console
|
46
|
-
console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
47
|
-
}
|
48
|
-
|
49
|
-
if (requiredProp) {
|
50
|
-
// eslint-disable-next-line no-console
|
51
|
-
console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
52
|
-
}
|
53
|
-
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_slots.Slot, {
|
55
|
-
name: "Input"
|
56
|
-
}, ({
|
57
|
-
disabled,
|
58
|
-
id,
|
59
|
-
required,
|
60
|
-
captionId
|
61
|
-
}) => /*#__PURE__*/_react.default.createElement(RadioInput, _extends({
|
62
|
-
"aria-describedby": captionId,
|
63
|
-
id: id,
|
64
|
-
required: required,
|
65
|
-
disabled: disabled
|
66
|
-
}, rest)));
|
67
|
-
};
|
68
|
-
|
69
|
-
Input.displayName = "Input";
|
70
|
-
|
71
|
-
const RadioInputField = props => /*#__PURE__*/_react.default.createElement(_ToggleInputField.default, props);
|
72
|
-
|
73
|
-
RadioInputField.displayName = "RadioInputField";
|
74
|
-
|
75
|
-
var _default = Object.assign(RadioInputField, {
|
76
|
-
Input,
|
77
|
-
Caption: _InputField.default.Caption,
|
78
|
-
Label: _InputField.default.Label,
|
79
|
-
LeadingVisual: _ToggleInputLeadingVisual.default
|
80
|
-
});
|
81
|
-
|
82
|
-
exports.default = _default;
|