@primer/components 0.0.0-2021116181214 → 0.0.0-2021116201150
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/Item.js +6 -4
- package/lib/ActionList2/List.js +2 -2
- package/lib/ActionList2/{ActionListContainerContext.d.ts → MenuContext.d.ts} +3 -3
- package/lib/ActionList2/{ActionListContainerContext.js → MenuContext.js} +3 -3
- package/lib/ActionList2/Selection.js +4 -4
- package/lib/ActionMenu2.d.ts +9 -13
- package/lib/ActionMenu2.js +29 -63
- package/lib/Autocomplete/AutocompleteMenu.js +13 -6
- package/lib/Checkbox.d.ts +1 -1
- package/lib/hooks/index.d.ts +0 -1
- package/lib/hooks/index.js +1 -9
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -46
- package/lib-esm/ActionList2/Item.js +6 -4
- package/lib-esm/ActionList2/List.js +2 -2
- package/lib-esm/ActionList2/{ActionListContainerContext.d.ts → MenuContext.d.ts} +3 -3
- package/lib-esm/ActionList2/{ActionListContainerContext.js → MenuContext.js} +1 -1
- package/lib-esm/ActionList2/Selection.js +4 -4
- package/lib-esm/ActionMenu2.d.ts +9 -13
- package/lib-esm/ActionMenu2.js +27 -60
- package/lib-esm/Autocomplete/AutocompleteMenu.js +13 -3
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/hooks/index.d.ts +0 -1
- package/lib-esm/hooks/index.js +1 -2
- package/lib-esm/index.d.ts +0 -6
- package/lib-esm/index.js +0 -5
- package/package.json +2 -2
- package/lib/CheckboxInputField.d.ts +0 -11
- package/lib/CheckboxInputField.js +0 -73
- package/lib/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldCaption.js +0 -35
- package/lib/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldLabel.js +0 -35
- package/lib/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
- package/lib/ChoiceFieldset/ChoiceFieldset.js +0 -95
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -29
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -44
- package/lib/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
- package/lib/ChoiceFieldset/ChoiceFieldsetList.js +0 -69
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -15
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -75
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -17
- package/lib/ChoiceFieldset/index.d.ts +0 -3
- package/lib/ChoiceFieldset/index.js +0 -23
- package/lib/Radio.d.ts +0 -38
- package/lib/Radio.js +0 -55
- package/lib/RadioInputField.d.ts +0 -10
- package/lib/RadioInputField.js +0 -74
- 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 -27
- 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 -11
- package/lib-esm/CheckboxInputField.js +0 -56
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.js +0 -20
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.js +0 -20
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.js +0 -72
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -17
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -31
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.js +0 -52
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -5
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -51
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -7
- package/lib-esm/ChoiceFieldset/index.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/index.js +0 -2
- package/lib-esm/Radio.d.ts +0 -38
- package/lib-esm/Radio.js +0 -40
- package/lib-esm/RadioInputField.d.ts +0 -10
- package/lib-esm/RadioInputField.js +0 -56
- 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 -16
- 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/Radio.d.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import React, { InputHTMLAttributes } from 'react';
|
2
|
-
import { SxProp } from './sx';
|
3
|
-
export declare type RadioProps = {
|
4
|
-
/**
|
5
|
-
* A unique value that is never shown to the user.
|
6
|
-
* Used during form submission and to identify which radio button in a group is selected
|
7
|
-
*/
|
8
|
-
value: string;
|
9
|
-
/**
|
10
|
-
* Name attribute of the input element. Required for grouping radio inputs
|
11
|
-
*/
|
12
|
-
name: string;
|
13
|
-
/**
|
14
|
-
* Apply inactive visual appearance to the radio button
|
15
|
-
*/
|
16
|
-
disabled?: boolean;
|
17
|
-
/**
|
18
|
-
* Indicates whether the radio button is selected
|
19
|
-
*/
|
20
|
-
checked?: boolean;
|
21
|
-
/**
|
22
|
-
* Forward a ref to the underlying input element
|
23
|
-
*/
|
24
|
-
ref?: React.RefObject<HTMLInputElement>;
|
25
|
-
/**
|
26
|
-
* Indicates whether the radio button must be checked before the form can be submitted
|
27
|
-
*/
|
28
|
-
required?: boolean;
|
29
|
-
/**
|
30
|
-
* Indicates whether the radio button validation state is non-standard
|
31
|
-
*/
|
32
|
-
validationStatus?: 'error' | 'success';
|
33
|
-
} & InputHTMLAttributes<HTMLInputElement> & SxProp;
|
34
|
-
/**
|
35
|
-
* An accessible, native radio component for selecting one option from a list.
|
36
|
-
*/
|
37
|
-
declare const Radio: React.ForwardRefExoticComponent<Pick<RadioProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
|
38
|
-
export default Radio;
|
package/lib-esm/Radio.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
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); }
|
2
|
-
|
3
|
-
import styled from 'styled-components';
|
4
|
-
import React from 'react';
|
5
|
-
import sx from './sx';
|
6
|
-
const StyledRadio = styled.input.withConfig({
|
7
|
-
displayName: "Radio__StyledRadio",
|
8
|
-
componentId: "sc-1ak1fjg-0"
|
9
|
-
})(["cursor:pointer;", " ", ""], props => props.disabled && `cursor: not-allowed;`, sx);
|
10
|
-
/**
|
11
|
-
* An accessible, native radio component for selecting one option from a list.
|
12
|
-
*/
|
13
|
-
|
14
|
-
const Radio = /*#__PURE__*/React.forwardRef(({
|
15
|
-
checked,
|
16
|
-
disabled,
|
17
|
-
sx: sxProp,
|
18
|
-
required,
|
19
|
-
validationStatus,
|
20
|
-
value,
|
21
|
-
name,
|
22
|
-
...rest
|
23
|
-
}, ref) => {
|
24
|
-
return /*#__PURE__*/React.createElement(StyledRadio, _extends({
|
25
|
-
type: "radio",
|
26
|
-
value: value,
|
27
|
-
name: name,
|
28
|
-
ref: ref,
|
29
|
-
disabled: disabled,
|
30
|
-
"aria-disabled": disabled ? 'true' : 'false',
|
31
|
-
checked: checked,
|
32
|
-
"aria-checked": checked ? 'true' : 'false',
|
33
|
-
required: required,
|
34
|
-
"aria-required": required ? 'true' : 'false',
|
35
|
-
"aria-invalid": validationStatus === 'error' ? 'true' : 'false',
|
36
|
-
sx: sxProp
|
37
|
-
}, rest));
|
38
|
-
});
|
39
|
-
Radio.displayName = 'Radio';
|
40
|
-
export default Radio;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RadioProps } from '.';
|
3
|
-
import { ToggleInputFieldProps } from './_InputField/ToggleInputField';
|
4
|
-
declare const _default: React.FC<ToggleInputFieldProps> & {
|
5
|
-
Input: React.FC<RadioProps>;
|
6
|
-
Caption: React.FC<{}>;
|
7
|
-
Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
|
8
|
-
LeadingVisual: React.FC<{}>;
|
9
|
-
};
|
10
|
-
export default _default;
|
@@ -1,56 +0,0 @@
|
|
1
|
-
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); }
|
2
|
-
|
3
|
-
import React from 'react';
|
4
|
-
import { Radio } from '.';
|
5
|
-
import InputField from './_InputField/InputField';
|
6
|
-
import { Slot } from './_InputField/slots';
|
7
|
-
import ToggleInputField from './_InputField/ToggleInputField';
|
8
|
-
import ToggleInputLeadingVisual from './_InputField/ToggleInputLeadingVisual'; // pulling out `id`, `disabled`, and `required` because those should come from the parent TextInputField component
|
9
|
-
|
10
|
-
const Input = ({
|
11
|
-
id: idProp,
|
12
|
-
required: requiredProp,
|
13
|
-
disabled: disabledProp,
|
14
|
-
...rest
|
15
|
-
}) => {
|
16
|
-
if (idProp) {
|
17
|
-
// eslint-disable-next-line no-console
|
18
|
-
console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
19
|
-
}
|
20
|
-
|
21
|
-
if (disabledProp) {
|
22
|
-
// eslint-disable-next-line no-console
|
23
|
-
console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
24
|
-
}
|
25
|
-
|
26
|
-
if (requiredProp) {
|
27
|
-
// eslint-disable-next-line no-console
|
28
|
-
console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
|
29
|
-
}
|
30
|
-
|
31
|
-
return /*#__PURE__*/React.createElement(Slot, {
|
32
|
-
name: "Input"
|
33
|
-
}, ({
|
34
|
-
disabled,
|
35
|
-
id,
|
36
|
-
required,
|
37
|
-
captionId
|
38
|
-
}) => /*#__PURE__*/React.createElement(Radio, _extends({
|
39
|
-
"aria-describedby": captionId,
|
40
|
-
id: id,
|
41
|
-
required: required,
|
42
|
-
disabled: disabled
|
43
|
-
}, rest)));
|
44
|
-
};
|
45
|
-
|
46
|
-
Input.displayName = "Input";
|
47
|
-
|
48
|
-
const RadioInputField = props => /*#__PURE__*/React.createElement(ToggleInputField, props);
|
49
|
-
|
50
|
-
RadioInputField.displayName = "RadioInputField";
|
51
|
-
export default Object.assign(RadioInputField, {
|
52
|
-
Input,
|
53
|
-
Caption: InputField.Caption,
|
54
|
-
Label: InputField.Label,
|
55
|
-
LeadingVisual: ToggleInputLeadingVisual
|
56
|
-
});
|