@primer/components 0.0.0-2021113205755 → 0.0.0-2021113205954

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.
Files changed (81) hide show
  1. package/dist/browser.esm.js +2 -2
  2. package/dist/browser.esm.js.map +1 -1
  3. package/dist/browser.umd.js +2 -2
  4. package/dist/browser.umd.js.map +1 -1
  5. package/lib/Autocomplete/AutocompleteMenu.js +13 -6
  6. package/lib/Checkbox.d.ts +1 -1
  7. package/lib/index.d.ts +0 -3
  8. package/lib/index.js +0 -24
  9. package/lib-esm/Autocomplete/AutocompleteMenu.js +13 -3
  10. package/lib-esm/Checkbox.d.ts +1 -1
  11. package/lib-esm/index.d.ts +0 -3
  12. package/lib-esm/index.js +0 -3
  13. package/package.json +2 -2
  14. package/lib/CheckboxInputField.d.ts +0 -10
  15. package/lib/CheckboxInputField.js +0 -73
  16. package/lib/RadioInputField.d.ts +0 -8
  17. package/lib/RadioInputField.js +0 -82
  18. package/lib/TextInputField.d.ts +0 -583
  19. package/lib/TextInputField.js +0 -66
  20. package/lib/_InputCaption.d.ts +0 -13
  21. package/lib/_InputCaption.js +0 -26
  22. package/lib/_InputField/InputField.d.ts +0 -39
  23. package/lib/_InputField/InputField.js +0 -90
  24. package/lib/_InputField/InputFieldCaption.d.ts +0 -3
  25. package/lib/_InputField/InputFieldCaption.js +0 -30
  26. package/lib/_InputField/InputFieldLabel.d.ts +0 -9
  27. package/lib/_InputField/InputFieldLabel.js +0 -34
  28. package/lib/_InputField/InputFieldValidation.d.ts +0 -6
  29. package/lib/_InputField/InputFieldValidation.js +0 -17
  30. package/lib/_InputField/ToggleInputField.d.ts +0 -13
  31. package/lib/_InputField/ToggleInputField.js +0 -71
  32. package/lib/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
  33. package/lib/_InputField/ToggleInputLeadingVisual.js +0 -22
  34. package/lib/_InputField/ValidationAnimationContainer.d.ts +0 -6
  35. package/lib/_InputField/ValidationAnimationContainer.js +0 -48
  36. package/lib/_InputField/index.d.ts +0 -1
  37. package/lib/_InputField/index.js +0 -15
  38. package/lib/_InputField/slots.d.ts +0 -13
  39. package/lib/_InputField/slots.js +0 -17
  40. package/lib/_InputLabel.d.ts +0 -8
  41. package/lib/_InputLabel.js +0 -44
  42. package/lib/_InputValidation.d.ts +0 -8
  43. package/lib/_InputValidation.js +0 -56
  44. package/lib/_VisuallyHidden.d.ts +0 -6
  45. package/lib/_VisuallyHidden.js +0 -39
  46. package/lib/utils/types/FormValidationStatus.d.ts +0 -1
  47. package/lib/utils/types/FormValidationStatus.js +0 -1
  48. package/lib-esm/CheckboxInputField.d.ts +0 -10
  49. package/lib-esm/CheckboxInputField.js +0 -56
  50. package/lib-esm/RadioInputField.d.ts +0 -8
  51. package/lib-esm/RadioInputField.js +0 -65
  52. package/lib-esm/TextInputField.d.ts +0 -583
  53. package/lib-esm/TextInputField.js +0 -50
  54. package/lib-esm/_InputCaption.d.ts +0 -13
  55. package/lib-esm/_InputCaption.js +0 -15
  56. package/lib-esm/_InputField/InputField.d.ts +0 -39
  57. package/lib-esm/_InputField/InputField.js +0 -70
  58. package/lib-esm/_InputField/InputFieldCaption.d.ts +0 -3
  59. package/lib-esm/_InputField/InputFieldCaption.js +0 -18
  60. package/lib-esm/_InputField/InputFieldLabel.d.ts +0 -9
  61. package/lib-esm/_InputField/InputFieldLabel.js +0 -22
  62. package/lib-esm/_InputField/InputFieldValidation.d.ts +0 -6
  63. package/lib-esm/_InputField/InputFieldValidation.js +0 -7
  64. package/lib-esm/_InputField/ToggleInputField.d.ts +0 -13
  65. package/lib-esm/_InputField/ToggleInputField.js +0 -54
  66. package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
  67. package/lib-esm/_InputField/ToggleInputLeadingVisual.js +0 -11
  68. package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +0 -6
  69. package/lib-esm/_InputField/ValidationAnimationContainer.js +0 -33
  70. package/lib-esm/_InputField/index.d.ts +0 -1
  71. package/lib-esm/_InputField/index.js +0 -1
  72. package/lib-esm/_InputField/slots.d.ts +0 -13
  73. package/lib-esm/_InputField/slots.js +0 -5
  74. package/lib-esm/_InputLabel.d.ts +0 -8
  75. package/lib-esm/_InputLabel.js +0 -32
  76. package/lib-esm/_InputValidation.d.ts +0 -8
  77. package/lib-esm/_InputValidation.js +0 -43
  78. package/lib-esm/_VisuallyHidden.d.ts +0 -6
  79. package/lib-esm/_VisuallyHidden.js +0 -26
  80. package/lib-esm/utils/types/FormValidationStatus.d.ts +0 -1
  81. package/lib-esm/utils/types/FormValidationStatus.js +0 -1
@@ -21,10 +21,6 @@ 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
-
28
24
  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); }
29
25
 
30
26
  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; }
@@ -186,8 +182,19 @@ function AutocompleteMenu(props) {
186
182
  setSelectedItemLength(selectedItemIds.length);
187
183
  }
188
184
  }, [selectedItemIds, setSelectedItemLength]);
189
- return /*#__PURE__*/_react.default.createElement(_VisuallyHidden.default, {
190
- isVisible: showMenu
185
+ return /*#__PURE__*/_react.default.createElement(_.Box, {
186
+ sx: !showMenu ? {
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
+ } : {}
191
198
  }, loading ? /*#__PURE__*/_react.default.createElement(_.Box, {
192
199
  p: 3,
193
200
  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> | "validationStatus" | "indeterminate"> & React.RefAttributes<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/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/index.js CHANGED
@@ -267,12 +267,6 @@ Object.defineProperty(exports, "CircleOcticon", {
267
267
  return _CircleOcticon.default;
268
268
  }
269
269
  });
270
- Object.defineProperty(exports, "CheckboxInputField", {
271
- enumerable: true,
272
- get: function () {
273
- return _CheckboxInputField.default;
274
- }
275
- });
276
270
  Object.defineProperty(exports, "CounterLabel", {
277
271
  enumerable: true,
278
272
  get: function () {
@@ -399,12 +393,6 @@ Object.defineProperty(exports, "ProgressBar", {
399
393
  return _ProgressBar.default;
400
394
  }
401
395
  });
402
- Object.defineProperty(exports, "RadioInputField", {
403
- enumerable: true,
404
- get: function () {
405
- return _RadioInputField.default;
406
- }
407
- });
408
396
  Object.defineProperty(exports, "SelectMenu", {
409
397
  enumerable: true,
410
398
  get: function () {
@@ -453,12 +441,6 @@ Object.defineProperty(exports, "TextInput", {
453
441
  return _TextInput.default;
454
442
  }
455
443
  });
456
- Object.defineProperty(exports, "TextInputField", {
457
- enumerable: true,
458
- get: function () {
459
- return _TextInputField.default;
460
- }
461
- });
462
444
  Object.defineProperty(exports, "TextInputWithTokens", {
463
445
  enumerable: true,
464
446
  get: function () {
@@ -590,8 +572,6 @@ var _CircleBadge = _interopRequireDefault(require("./CircleBadge"));
590
572
 
591
573
  var _CircleOcticon = _interopRequireDefault(require("./CircleOcticon"));
592
574
 
593
- var _CheckboxInputField = _interopRequireDefault(require("./CheckboxInputField"));
594
-
595
575
  var _CounterLabel = _interopRequireDefault(require("./CounterLabel"));
596
576
 
597
577
  var _Details = _interopRequireDefault(require("./Details"));
@@ -632,8 +612,6 @@ var _Popover = _interopRequireDefault(require("./Popover"));
632
612
 
633
613
  var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
634
614
 
635
- var _RadioInputField = _interopRequireDefault(require("./RadioInputField"));
636
-
637
615
  var _SelectMenu = _interopRequireDefault(require("./SelectMenu"));
638
616
 
639
617
  var _SideNav = _interopRequireDefault(require("./SideNav"));
@@ -650,8 +628,6 @@ var _TabNav = _interopRequireDefault(require("./TabNav"));
650
628
 
651
629
  var _TextInput = _interopRequireDefault(require("./TextInput"));
652
630
 
653
- var _TextInputField = _interopRequireDefault(require("./TextInputField"));
654
-
655
631
  var _TextInputWithTokens = _interopRequireDefault(require("./TextInputWithTokens"));
656
632
 
657
633
  var _Text = _interopRequireDefault(require("./Text"));
@@ -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(VisuallyHidden, {
169
- isVisible: showMenu
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",
@@ -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> | "validationStatus" | "indeterminate"> & React.RefAttributes<HTMLInputElement>>;
28
+ declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "indeterminate" | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
29
29
  export default Checkbox;
@@ -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-2021113205755",
3
+ "version": "0.0.0-2021113205954",
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.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;
@@ -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;
@@ -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;