@primer/components 0.0.0-20211030143938 → 0.0.0-20211030163410
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 +8 -2
- package/dist/browser.esm.js +586 -582
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +204 -200
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +2 -2
- package/lib/Autocomplete/AutocompleteMenu.js +6 -13
- package/lib/Checkbox.d.ts +1 -1
- package/lib/CheckboxInputField.d.ts +11 -0
- package/lib/CheckboxInputField.js +74 -0
- package/lib/RadioInputField.d.ts +9 -0
- package/lib/RadioInputField.js +83 -0
- package/lib/TextInputField.d.ts +581 -0
- package/lib/TextInputField.js +66 -0
- package/lib/_InputCaption.d.ts +6 -0
- package/lib/_InputCaption.js +23 -0
- package/lib/_InputField/InputField.d.ts +39 -0
- package/lib/_InputField/InputField.js +90 -0
- package/lib/_InputField/InputFieldCaption.d.ts +3 -0
- package/lib/_InputField/InputFieldCaption.js +28 -0
- package/lib/_InputField/InputFieldLabel.d.ts +9 -0
- package/lib/_InputField/InputFieldLabel.js +34 -0
- package/lib/_InputField/InputFieldValidation.d.ts +6 -0
- package/lib/_InputField/InputFieldValidation.js +17 -0
- package/lib/_InputField/ToggleInputField.d.ts +13 -0
- package/lib/_InputField/ToggleInputField.js +71 -0
- package/lib/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
- package/lib/_InputField/ToggleInputLeadingVisual.js +22 -0
- package/lib/_InputField/ValidationAnimationContainer.d.ts +6 -0
- package/lib/_InputField/ValidationAnimationContainer.js +48 -0
- package/lib/_InputField/index.d.ts +1 -0
- package/lib/_InputField/index.js +15 -0
- package/lib/_InputField/slots.d.ts +13 -0
- package/lib/_InputField/slots.js +17 -0
- package/lib/_InputLabel.d.ts +8 -0
- package/lib/_InputLabel.js +44 -0
- package/lib/_InputValidation.d.ts +8 -0
- package/lib/_InputValidation.js +56 -0
- package/lib/_VisuallyHidden.d.ts +6 -0
- package/lib/_VisuallyHidden.js +39 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +24 -0
- package/lib/utils/types/FormValidationStatus.d.ts +1 -0
- package/lib/utils/types/FormValidationStatus.js +1 -0
- package/lib-esm/ActionList/Item.js +2 -2
- package/lib-esm/Autocomplete/AutocompleteMenu.js +3 -13
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/CheckboxInputField.d.ts +11 -0
- package/lib-esm/CheckboxInputField.js +57 -0
- package/lib-esm/RadioInputField.d.ts +9 -0
- package/lib-esm/RadioInputField.js +66 -0
- package/lib-esm/TextInputField.d.ts +581 -0
- package/lib-esm/TextInputField.js +50 -0
- package/lib-esm/_InputCaption.d.ts +6 -0
- package/lib-esm/_InputCaption.js +12 -0
- package/lib-esm/_InputField/InputField.d.ts +39 -0
- package/lib-esm/_InputField/InputField.js +70 -0
- package/lib-esm/_InputField/InputFieldCaption.d.ts +3 -0
- package/lib-esm/_InputField/InputFieldCaption.js +16 -0
- package/lib-esm/_InputField/InputFieldLabel.d.ts +9 -0
- package/lib-esm/_InputField/InputFieldLabel.js +22 -0
- package/lib-esm/_InputField/InputFieldValidation.d.ts +6 -0
- package/lib-esm/_InputField/InputFieldValidation.js +7 -0
- package/lib-esm/_InputField/ToggleInputField.d.ts +13 -0
- package/lib-esm/_InputField/ToggleInputField.js +54 -0
- package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
- package/lib-esm/_InputField/ToggleInputLeadingVisual.js +11 -0
- package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +6 -0
- package/lib-esm/_InputField/ValidationAnimationContainer.js +33 -0
- package/lib-esm/_InputField/index.d.ts +1 -0
- package/lib-esm/_InputField/index.js +1 -0
- package/lib-esm/_InputField/slots.d.ts +13 -0
- package/lib-esm/_InputField/slots.js +5 -0
- package/lib-esm/_InputLabel.d.ts +8 -0
- package/lib-esm/_InputLabel.js +32 -0
- package/lib-esm/_InputValidation.d.ts +8 -0
- package/lib-esm/_InputValidation.js +43 -0
- package/lib-esm/_VisuallyHidden.d.ts +6 -0
- package/lib-esm/_VisuallyHidden.js +26 -0
- package/lib-esm/index.d.ts +3 -0
- package/lib-esm/index.js +3 -0
- package/lib-esm/utils/types/FormValidationStatus.d.ts +1 -0
- package/lib-esm/utils/types/FormValidationStatus.js +1 -0
- package/package.json +2 -2
package/lib/ActionList/Item.js
CHANGED
@@ -122,7 +122,7 @@ exports.TextContainer = TextContainer;
|
|
122
122
|
const BaseVisualContainer = _styledComponents.default.div.withConfig({
|
123
123
|
displayName: "Item__BaseVisualContainer",
|
124
124
|
componentId: "jqpvy8-4"
|
125
|
-
})(["height:20px;width:", ";margin-right:", ";display:flex;justify-content:center;align-items:center;"], (0, _constants.get)('space.3'), (0, _constants.get)('space.2'));
|
125
|
+
})(["height:20px;width:", ";margin-right:", ";display:flex;justify-content:center;align-items:center;flex-shrink:0;"], (0, _constants.get)('space.3'), (0, _constants.get)('space.2'));
|
126
126
|
|
127
127
|
const ColoredVisualContainer = (0, _styledComponents.default)(BaseVisualContainer).withConfig({
|
128
128
|
displayName: "Item__ColoredVisualContainer",
|
@@ -134,7 +134,7 @@ const ColoredVisualContainer = (0, _styledComponents.default)(BaseVisualContaine
|
|
134
134
|
const LeadingVisualContainer = (0, _styledComponents.default)(ColoredVisualContainer).withConfig({
|
135
135
|
displayName: "Item__LeadingVisualContainer",
|
136
136
|
componentId: "jqpvy8-6"
|
137
|
-
})(["
|
137
|
+
})(["display:flex;flex-direction:column;justify-content:center;"]);
|
138
138
|
const TrailingContent = (0, _styledComponents.default)(ColoredVisualContainer).withConfig({
|
139
139
|
displayName: "Item__TrailingContent",
|
140
140
|
componentId: "jqpvy8-7"
|
@@ -21,6 +21,10 @@ var _uniqueId = require("../utils/uniqueId");
|
|
21
21
|
|
22
22
|
var _scrollIntoViewingArea = require("../behaviors/scrollIntoViewingArea");
|
23
23
|
|
24
|
+
var _VisuallyHidden = _interopRequireDefault(require("../_VisuallyHidden"));
|
25
|
+
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
|
+
|
24
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
29
|
|
26
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -182,19 +186,8 @@ function AutocompleteMenu(props) {
|
|
182
186
|
setSelectedItemLength(selectedItemIds.length);
|
183
187
|
}
|
184
188
|
}, [selectedItemIds, setSelectedItemLength]);
|
185
|
-
return /*#__PURE__*/_react.default.createElement(
|
186
|
-
|
187
|
-
// visually hides this label for sighted users
|
188
|
-
position: 'absolute',
|
189
|
-
width: '1px',
|
190
|
-
height: '1px',
|
191
|
-
padding: '0',
|
192
|
-
margin: '-1px',
|
193
|
-
overflow: 'hidden',
|
194
|
-
clip: 'rect(0, 0, 0, 0)',
|
195
|
-
whiteSpace: 'nowrap',
|
196
|
-
borderWidth: '0'
|
197
|
-
} : {}
|
189
|
+
return /*#__PURE__*/_react.default.createElement(_VisuallyHidden.default, {
|
190
|
+
isVisible: showMenu
|
198
191
|
}, loading ? /*#__PURE__*/_react.default.createElement(_.Box, {
|
199
192
|
p: 3,
|
200
193
|
display: "flex",
|
package/lib/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> | "validationStatus" | "indeterminate"> & React.RefAttributes<HTMLInputElement>>;
|
29
29
|
export default Checkbox;
|
@@ -0,0 +1,11 @@
|
|
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
|
+
Validation: React.FC<import("./_InputField/InputFieldValidation").InputFieldValidationProps>;
|
9
|
+
LeadingVisual: React.FC<{}>;
|
10
|
+
};
|
11
|
+
export default _default;
|
@@ -0,0 +1,74 @@
|
|
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
|
+
Validation: _InputField.default.Validation,
|
71
|
+
LeadingVisual: _ToggleInputLeadingVisual.default
|
72
|
+
});
|
73
|
+
|
74
|
+
exports.default = _default;
|
@@ -0,0 +1,9 @@
|
|
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
|
+
Validation: React.FC<import("./_InputField/InputFieldValidation").InputFieldValidationProps>;
|
7
|
+
LeadingVisual: React.FC<{}>;
|
8
|
+
};
|
9
|
+
export default _default;
|
@@ -0,0 +1,83 @@
|
|
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
|
+
Validation: _InputField.default.Validation,
|
80
|
+
LeadingVisual: _ToggleInputLeadingVisual.default
|
81
|
+
});
|
82
|
+
|
83
|
+
exports.default = _default;
|