@primer/components 0.0.0-2021111193153 → 0.0.0-202111121740

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 (171) hide show
  1. package/CHANGELOG.md +2 -12
  2. package/dist/browser.esm.js +605 -587
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +222 -204
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList2/Divider.d.ts +2 -3
  7. package/lib/ActionList2/Divider.js +5 -10
  8. package/lib/ActionList2/Item.js +5 -21
  9. package/lib/ActionList2/List.js +1 -11
  10. package/lib/ActionList2/Selection.js +0 -11
  11. package/lib/ActionList2/index.d.ts +2 -1
  12. package/lib/Autocomplete/AutocompleteMenu.js +6 -13
  13. package/lib/Avatar.d.ts +2 -1
  14. package/lib/Avatar.js +1 -1
  15. package/lib/BranchName.d.ts +2 -1
  16. package/lib/BranchName.js +1 -1
  17. package/lib/Checkbox.d.ts +1 -1
  18. package/lib/CheckboxInputField.d.ts +11 -0
  19. package/lib/CheckboxInputField.js +73 -0
  20. package/lib/ChoiceFieldset/ChoiceFieldCaption.d.ts +3 -0
  21. package/lib/ChoiceFieldset/ChoiceFieldCaption.js +35 -0
  22. package/lib/ChoiceFieldset/ChoiceFieldLabel.d.ts +3 -0
  23. package/lib/ChoiceFieldset/ChoiceFieldLabel.js +35 -0
  24. package/lib/ChoiceFieldset/ChoiceFieldset.d.ts +63 -0
  25. package/lib/ChoiceFieldset/ChoiceFieldset.js +95 -0
  26. package/lib/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +3 -0
  27. package/lib/ChoiceFieldset/ChoiceFieldsetDescription.js +29 -0
  28. package/lib/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +6 -0
  29. package/lib/ChoiceFieldset/ChoiceFieldsetLegend.js +44 -0
  30. package/lib/ChoiceFieldset/ChoiceFieldsetList.d.ts +6 -0
  31. package/lib/ChoiceFieldset/ChoiceFieldsetList.js +80 -0
  32. package/lib/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +18 -0
  33. package/lib/ChoiceFieldset/ChoiceFieldsetListContext.js +15 -0
  34. package/lib/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +25 -0
  35. package/lib/ChoiceFieldset/ChoiceFieldsetListItem.js +74 -0
  36. package/lib/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +6 -0
  37. package/lib/ChoiceFieldset/ChoiceFieldsetValidation.js +17 -0
  38. package/lib/ChoiceFieldset/index.d.ts +3 -0
  39. package/lib/ChoiceFieldset/index.js +23 -0
  40. package/lib/Details.d.ts +2 -1
  41. package/lib/Details.js +3 -1
  42. package/lib/Dropdown.d.ts +66 -2
  43. package/lib/Heading.d.ts +2 -1
  44. package/lib/Heading.js +6 -1
  45. package/lib/ProgressBar.d.ts +11 -16
  46. package/lib/ProgressBar.js +10 -6
  47. package/lib/RadioInputField.d.ts +9 -0
  48. package/lib/RadioInputField.js +82 -0
  49. package/lib/Spinner.d.ts +2 -1
  50. package/lib/Spinner.js +3 -1
  51. package/lib/TextInputField.d.ts +581 -0
  52. package/lib/TextInputField.js +66 -0
  53. package/lib/_InputCaption.d.ts +13 -0
  54. package/lib/_InputCaption.js +27 -0
  55. package/lib/_InputField/InputField.d.ts +39 -0
  56. package/lib/_InputField/InputField.js +90 -0
  57. package/lib/_InputField/InputFieldCaption.d.ts +3 -0
  58. package/lib/_InputField/InputFieldCaption.js +30 -0
  59. package/lib/_InputField/InputFieldLabel.d.ts +9 -0
  60. package/lib/_InputField/InputFieldLabel.js +34 -0
  61. package/lib/_InputField/InputFieldValidation.d.ts +6 -0
  62. package/lib/{ActionList2/MenuContext.js → _InputField/InputFieldValidation.js} +6 -4
  63. package/lib/_InputField/ToggleInputField.d.ts +13 -0
  64. package/lib/_InputField/ToggleInputField.js +71 -0
  65. package/lib/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
  66. package/lib/_InputField/ToggleInputLeadingVisual.js +22 -0
  67. package/lib/_InputField/ValidationAnimationContainer.d.ts +6 -0
  68. package/lib/_InputField/ValidationAnimationContainer.js +48 -0
  69. package/lib/_InputField/index.d.ts +1 -0
  70. package/lib/_InputField/index.js +15 -0
  71. package/lib/_InputField/slots.d.ts +13 -0
  72. package/lib/_InputField/slots.js +17 -0
  73. package/lib/_InputLabel.d.ts +8 -0
  74. package/lib/_InputLabel.js +44 -0
  75. package/lib/_InputValidation.d.ts +8 -0
  76. package/lib/_InputValidation.js +56 -0
  77. package/lib/_VisuallyHidden.d.ts +6 -0
  78. package/lib/_VisuallyHidden.js +39 -0
  79. package/lib/drafts.d.ts +0 -1
  80. package/lib/drafts.js +0 -13
  81. package/lib/index.d.ts +4 -0
  82. package/lib/index.js +38 -0
  83. package/lib/utils/types/FormValidationStatus.d.ts +1 -0
  84. package/lib/utils/types/FormValidationStatus.js +1 -0
  85. package/lib-esm/ActionList2/Divider.d.ts +2 -3
  86. package/lib-esm/ActionList2/Divider.js +5 -8
  87. package/lib-esm/ActionList2/Item.js +5 -19
  88. package/lib-esm/ActionList2/List.js +1 -9
  89. package/lib-esm/ActionList2/Selection.js +0 -9
  90. package/lib-esm/ActionList2/index.d.ts +2 -1
  91. package/lib-esm/Autocomplete/AutocompleteMenu.js +3 -13
  92. package/lib-esm/Avatar.d.ts +2 -1
  93. package/lib-esm/Avatar.js +2 -2
  94. package/lib-esm/BranchName.d.ts +2 -1
  95. package/lib-esm/BranchName.js +2 -2
  96. package/lib-esm/Checkbox.d.ts +1 -1
  97. package/lib-esm/CheckboxInputField.d.ts +11 -0
  98. package/lib-esm/CheckboxInputField.js +56 -0
  99. package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.d.ts +3 -0
  100. package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.js +20 -0
  101. package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.d.ts +3 -0
  102. package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.js +20 -0
  103. package/lib-esm/ChoiceFieldset/ChoiceFieldset.d.ts +63 -0
  104. package/lib-esm/ChoiceFieldset/ChoiceFieldset.js +72 -0
  105. package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +3 -0
  106. package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.js +17 -0
  107. package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +6 -0
  108. package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.js +31 -0
  109. package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.d.ts +6 -0
  110. package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.js +63 -0
  111. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +18 -0
  112. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.js +5 -0
  113. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +25 -0
  114. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.js +50 -0
  115. package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +6 -0
  116. package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.js +7 -0
  117. package/lib-esm/ChoiceFieldset/index.d.ts +3 -0
  118. package/lib-esm/ChoiceFieldset/index.js +2 -0
  119. package/lib-esm/Details.d.ts +2 -1
  120. package/lib-esm/Details.js +2 -1
  121. package/lib-esm/Dropdown.d.ts +66 -2
  122. package/lib-esm/Heading.d.ts +2 -1
  123. package/lib-esm/Heading.js +6 -2
  124. package/lib-esm/ProgressBar.d.ts +11 -16
  125. package/lib-esm/ProgressBar.js +11 -7
  126. package/lib-esm/RadioInputField.d.ts +9 -0
  127. package/lib-esm/RadioInputField.js +65 -0
  128. package/lib-esm/Spinner.d.ts +2 -1
  129. package/lib-esm/Spinner.js +2 -1
  130. package/lib-esm/TextInputField.d.ts +581 -0
  131. package/lib-esm/TextInputField.js +50 -0
  132. package/lib-esm/_InputCaption.d.ts +13 -0
  133. package/lib-esm/_InputCaption.js +16 -0
  134. package/lib-esm/_InputField/InputField.d.ts +39 -0
  135. package/lib-esm/_InputField/InputField.js +70 -0
  136. package/lib-esm/_InputField/InputFieldCaption.d.ts +3 -0
  137. package/lib-esm/_InputField/InputFieldCaption.js +18 -0
  138. package/lib-esm/_InputField/InputFieldLabel.d.ts +9 -0
  139. package/lib-esm/_InputField/InputFieldLabel.js +22 -0
  140. package/lib-esm/_InputField/InputFieldValidation.d.ts +6 -0
  141. package/lib-esm/_InputField/InputFieldValidation.js +7 -0
  142. package/lib-esm/_InputField/ToggleInputField.d.ts +13 -0
  143. package/lib-esm/_InputField/ToggleInputField.js +54 -0
  144. package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +3 -0
  145. package/lib-esm/_InputField/ToggleInputLeadingVisual.js +11 -0
  146. package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +6 -0
  147. package/lib-esm/_InputField/ValidationAnimationContainer.js +33 -0
  148. package/lib-esm/_InputField/index.d.ts +1 -0
  149. package/lib-esm/_InputField/index.js +1 -0
  150. package/lib-esm/_InputField/slots.d.ts +13 -0
  151. package/lib-esm/_InputField/slots.js +5 -0
  152. package/lib-esm/_InputLabel.d.ts +8 -0
  153. package/lib-esm/_InputLabel.js +32 -0
  154. package/lib-esm/_InputValidation.d.ts +8 -0
  155. package/lib-esm/_InputValidation.js +43 -0
  156. package/lib-esm/_VisuallyHidden.d.ts +6 -0
  157. package/lib-esm/_VisuallyHidden.js +26 -0
  158. package/lib-esm/drafts.d.ts +0 -1
  159. package/lib-esm/drafts.js +1 -2
  160. package/lib-esm/index.d.ts +4 -0
  161. package/lib-esm/index.js +4 -0
  162. package/lib-esm/utils/types/FormValidationStatus.d.ts +1 -0
  163. package/lib-esm/utils/types/FormValidationStatus.js +1 -0
  164. package/package.json +2 -2
  165. package/lib/ActionList2/MenuContext.d.ts +0 -10
  166. package/lib/ActionMenu2.d.ts +0 -310
  167. package/lib/ActionMenu2.js +0 -91
  168. package/lib-esm/ActionList2/MenuContext.d.ts +0 -10
  169. package/lib-esm/ActionList2/MenuContext.js +0 -3
  170. package/lib-esm/ActionMenu2.d.ts +0 -310
  171. package/lib-esm/ActionMenu2.js +0 -67
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ToggleInputFieldProps } from './_InputField/ToggleInputField';
3
+ declare const _default: React.FC<ToggleInputFieldProps> & {
4
+ Input: React.FC<React.HTMLProps<HTMLInputElement>>;
5
+ Caption: React.FC<{}>;
6
+ Label: React.FC<import("./_InputField/InputFieldLabel").Props>;
7
+ LeadingVisual: React.FC<{}>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,65 @@
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 InputField from './_InputField/InputField';
5
+ import { Slot } from './_InputField/slots';
6
+ import ToggleInputField from './_InputField/ToggleInputField';
7
+ import ToggleInputLeadingVisual from './_InputField/ToggleInputLeadingVisual'; // TODO: use Primer's checkbox input once it's available
8
+ // https://github.com/github/primer/issues/489
9
+
10
+ const RadioInput = props => {
11
+ return /*#__PURE__*/React.createElement("input", _extends({
12
+ type: "radio"
13
+ }, props));
14
+ };
15
+
16
+ RadioInput.displayName = "RadioInput";
17
+
18
+ // pulling out `id`, `disabled`, and `required` because those should come from the parent TextInputField component
19
+ const Input = ({
20
+ id: idProp,
21
+ required: requiredProp,
22
+ disabled: disabledProp,
23
+ ...rest
24
+ }) => {
25
+ if (idProp) {
26
+ // eslint-disable-next-line no-console
27
+ console.warn("instead of passing the 'id' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
28
+ }
29
+
30
+ if (disabledProp) {
31
+ // eslint-disable-next-line no-console
32
+ console.warn("instead of passing the 'disabled' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
33
+ }
34
+
35
+ if (requiredProp) {
36
+ // eslint-disable-next-line no-console
37
+ console.warn("instead of passing the 'required' prop directly to <TextInputField.Input>, it should be passed to the parent component, <TextInputField>");
38
+ }
39
+
40
+ return /*#__PURE__*/React.createElement(Slot, {
41
+ name: "Input"
42
+ }, ({
43
+ disabled,
44
+ id,
45
+ required,
46
+ captionId
47
+ }) => /*#__PURE__*/React.createElement(RadioInput, _extends({
48
+ "aria-describedby": captionId,
49
+ id: id,
50
+ required: required,
51
+ disabled: disabled
52
+ }, rest)));
53
+ };
54
+
55
+ Input.displayName = "Input";
56
+
57
+ const RadioInputField = props => /*#__PURE__*/React.createElement(ToggleInputField, props);
58
+
59
+ RadioInputField.displayName = "RadioInputField";
60
+ export default Object.assign(RadioInputField, {
61
+ Input,
62
+ Caption: InputField.Caption,
63
+ Label: InputField.Label,
64
+ LeadingVisual: ToggleInputLeadingVisual
65
+ });
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { SystemCommonProps } from './constants';
2
3
  import { SxProp } from './sx';
3
4
  import { ComponentProps } from './utils/types';
4
5
  declare const sizeMap: {
@@ -11,6 +12,6 @@ export interface SpinnerInternalProps {
11
12
  size?: keyof typeof sizeMap;
12
13
  }
13
14
  declare function Spinner({ size: sizeKey, ...props }: SpinnerInternalProps): JSX.Element;
14
- declare const StyledSpinner: import("styled-components").StyledComponent<typeof Spinner, any, SxProp, never>;
15
+ declare const StyledSpinner: import("styled-components").StyledComponent<typeof Spinner, any, SystemCommonProps & SxProp, never>;
15
16
  export declare type SpinnerProps = ComponentProps<typeof StyledSpinner>;
16
17
  export default StyledSpinner;
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
5
+ import { COMMON } from './constants';
5
6
  import sx from './sx';
6
7
  const sizeMap = {
7
8
  small: '16px',
@@ -40,6 +41,6 @@ Spinner.displayName = "Spinner";
40
41
  const StyledSpinner = styled(Spinner).withConfig({
41
42
  displayName: "Spinner__StyledSpinner",
42
43
  componentId: "sc-14tspit-0"
43
- })(["@keyframes rotate-keyframes{100%{transform:rotate(360deg);}}animation:rotate-keyframes 1s linear infinite;", ""], sx);
44
+ })(["@keyframes rotate-keyframes{100%{transform:rotate(360deg);}}animation:rotate-keyframes 1s linear infinite;", " ", ""], COMMON, sx);
44
45
  StyledSpinner.displayName = 'Spinner';
45
46
  export default StyledSpinner;