@primer/components 0.0.0-202111845030 → 0.0.0-202111885047

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 (148) 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 +17 -11
  6. package/lib/BranchName.js +1 -1
  7. package/lib/NewButton/button-base.d.ts +6 -0
  8. package/lib/NewButton/button-base.js +69 -0
  9. package/lib/NewButton/button-link.d.ts +27 -0
  10. package/lib/{ChoiceFieldset/ChoiceFieldLabel.js → NewButton/button-link.js} +14 -18
  11. package/lib/NewButton/button.d.ts +2 -11
  12. package/lib/NewButton/button.js +6 -283
  13. package/lib/NewButton/icon-button.d.ts +4 -0
  14. package/lib/NewButton/icon-button.js +57 -0
  15. package/lib/NewButton/index.d.ts +6 -11
  16. package/lib/NewButton/index.js +18 -0
  17. package/lib/NewButton/styles.d.ts +202 -0
  18. package/lib/NewButton/styles.js +248 -0
  19. package/lib/NewButton/types.d.ts +28 -8
  20. package/lib/NewButton/types.js +19 -1
  21. package/lib/index.d.ts +0 -4
  22. package/lib/index.js +0 -38
  23. package/lib-esm/Autocomplete/AutocompleteMenu.js +16 -7
  24. package/lib-esm/BranchName.js +1 -1
  25. package/lib-esm/NewButton/button-base.d.ts +6 -0
  26. package/lib-esm/NewButton/button-base.js +47 -0
  27. package/lib-esm/NewButton/button-link.d.ts +27 -0
  28. package/lib-esm/NewButton/button-link.js +15 -0
  29. package/lib-esm/NewButton/button.d.ts +2 -11
  30. package/lib-esm/NewButton/button.js +4 -275
  31. package/lib-esm/NewButton/icon-button.d.ts +4 -0
  32. package/lib-esm/NewButton/icon-button.js +35 -0
  33. package/lib-esm/NewButton/index.d.ts +6 -11
  34. package/lib-esm/NewButton/index.js +4 -1
  35. package/lib-esm/NewButton/styles.d.ts +202 -0
  36. package/lib-esm/NewButton/styles.js +229 -0
  37. package/lib-esm/NewButton/types.d.ts +28 -8
  38. package/lib-esm/NewButton/types.js +6 -1
  39. package/lib-esm/index.d.ts +0 -4
  40. package/lib-esm/index.js +0 -4
  41. package/package.json +2 -2
  42. package/lib/CheckboxInputField.d.ts +0 -11
  43. package/lib/CheckboxInputField.js +0 -73
  44. package/lib/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
  45. package/lib/ChoiceFieldset/ChoiceFieldCaption.js +0 -35
  46. package/lib/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
  47. package/lib/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
  48. package/lib/ChoiceFieldset/ChoiceFieldset.js +0 -93
  49. package/lib/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
  50. package/lib/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -29
  51. package/lib/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
  52. package/lib/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -44
  53. package/lib/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
  54. package/lib/ChoiceFieldset/ChoiceFieldsetList.js +0 -71
  55. package/lib/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
  56. package/lib/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -15
  57. package/lib/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
  58. package/lib/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -75
  59. package/lib/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
  60. package/lib/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -17
  61. package/lib/ChoiceFieldset/index.d.ts +0 -3
  62. package/lib/ChoiceFieldset/index.js +0 -23
  63. package/lib/RadioInputField.d.ts +0 -10
  64. package/lib/RadioInputField.js +0 -74
  65. package/lib/TextInputField.d.ts +0 -583
  66. package/lib/TextInputField.js +0 -66
  67. package/lib/_InputCaption.d.ts +0 -13
  68. package/lib/_InputCaption.js +0 -27
  69. package/lib/_InputField/InputField.d.ts +0 -39
  70. package/lib/_InputField/InputField.js +0 -88
  71. package/lib/_InputField/InputFieldCaption.d.ts +0 -3
  72. package/lib/_InputField/InputFieldCaption.js +0 -30
  73. package/lib/_InputField/InputFieldLabel.d.ts +0 -9
  74. package/lib/_InputField/InputFieldLabel.js +0 -34
  75. package/lib/_InputField/InputFieldValidation.d.ts +0 -6
  76. package/lib/_InputField/InputFieldValidation.js +0 -17
  77. package/lib/_InputField/ToggleInputField.d.ts +0 -13
  78. package/lib/_InputField/ToggleInputField.js +0 -75
  79. package/lib/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
  80. package/lib/_InputField/ToggleInputLeadingVisual.js +0 -22
  81. package/lib/_InputField/ValidationAnimationContainer.d.ts +0 -6
  82. package/lib/_InputField/ValidationAnimationContainer.js +0 -48
  83. package/lib/_InputField/index.d.ts +0 -1
  84. package/lib/_InputField/index.js +0 -15
  85. package/lib/_InputField/slots.d.ts +0 -13
  86. package/lib/_InputField/slots.js +0 -17
  87. package/lib/_InputLabel.d.ts +0 -8
  88. package/lib/_InputLabel.js +0 -45
  89. package/lib/_InputValidation.d.ts +0 -8
  90. package/lib/_InputValidation.js +0 -59
  91. package/lib/_VisuallyHidden.d.ts +0 -6
  92. package/lib/_VisuallyHidden.js +0 -39
  93. package/lib/utils/types/FormValidationStatus.d.ts +0 -1
  94. package/lib/utils/types/FormValidationStatus.js +0 -1
  95. package/lib-esm/CheckboxInputField.d.ts +0 -11
  96. package/lib-esm/CheckboxInputField.js +0 -56
  97. package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
  98. package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.js +0 -20
  99. package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
  100. package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.js +0 -20
  101. package/lib-esm/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
  102. package/lib-esm/ChoiceFieldset/ChoiceFieldset.js +0 -71
  103. package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
  104. package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -17
  105. package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
  106. package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -31
  107. package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
  108. package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.js +0 -55
  109. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
  110. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -5
  111. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
  112. package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -51
  113. package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
  114. package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -7
  115. package/lib-esm/ChoiceFieldset/index.d.ts +0 -3
  116. package/lib-esm/ChoiceFieldset/index.js +0 -2
  117. package/lib-esm/RadioInputField.d.ts +0 -10
  118. package/lib-esm/RadioInputField.js +0 -56
  119. package/lib-esm/TextInputField.d.ts +0 -583
  120. package/lib-esm/TextInputField.js +0 -50
  121. package/lib-esm/_InputCaption.d.ts +0 -13
  122. package/lib-esm/_InputCaption.js +0 -16
  123. package/lib-esm/_InputField/InputField.d.ts +0 -39
  124. package/lib-esm/_InputField/InputField.js +0 -69
  125. package/lib-esm/_InputField/InputFieldCaption.d.ts +0 -3
  126. package/lib-esm/_InputField/InputFieldCaption.js +0 -18
  127. package/lib-esm/_InputField/InputFieldLabel.d.ts +0 -9
  128. package/lib-esm/_InputField/InputFieldLabel.js +0 -22
  129. package/lib-esm/_InputField/InputFieldValidation.d.ts +0 -6
  130. package/lib-esm/_InputField/InputFieldValidation.js +0 -7
  131. package/lib-esm/_InputField/ToggleInputField.d.ts +0 -13
  132. package/lib-esm/_InputField/ToggleInputField.js +0 -58
  133. package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
  134. package/lib-esm/_InputField/ToggleInputLeadingVisual.js +0 -11
  135. package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +0 -6
  136. package/lib-esm/_InputField/ValidationAnimationContainer.js +0 -33
  137. package/lib-esm/_InputField/index.d.ts +0 -1
  138. package/lib-esm/_InputField/index.js +0 -1
  139. package/lib-esm/_InputField/slots.d.ts +0 -13
  140. package/lib-esm/_InputField/slots.js +0 -5
  141. package/lib-esm/_InputLabel.d.ts +0 -8
  142. package/lib-esm/_InputLabel.js +0 -33
  143. package/lib-esm/_InputValidation.d.ts +0 -8
  144. package/lib-esm/_InputValidation.js +0 -46
  145. package/lib-esm/_VisuallyHidden.d.ts +0 -6
  146. package/lib-esm/_VisuallyHidden.js +0 -26
  147. package/lib-esm/utils/types/FormValidationStatus.d.ts +0 -1
  148. package/lib-esm/utils/types/FormValidationStatus.js +0 -1
@@ -0,0 +1,202 @@
1
+ import { VariantType } from './types';
2
+ import { Theme } from '../ThemeProvider';
3
+ export declare const TEXT_ROW_HEIGHT = "20px";
4
+ export declare const getVariantStyles: (variant?: VariantType, theme?: Theme | undefined) => {
5
+ color: string;
6
+ backgroundColor: string;
7
+ boxShadow: string;
8
+ '&:hover:not([disabled])': {
9
+ backgroundColor: string;
10
+ };
11
+ '&:focus:not([disabled])': {
12
+ boxShadow: string;
13
+ };
14
+ '&:active:not([disabled])': {
15
+ backgroundColor: string;
16
+ boxShadow: string;
17
+ };
18
+ '&:disabled': {
19
+ color: string;
20
+ backgroundColor: string;
21
+ };
22
+ } | {
23
+ color: string;
24
+ backgroundColor: string;
25
+ borderColor: string;
26
+ boxShadow: string;
27
+ '&:hover:not([disabled])': {
28
+ color: string;
29
+ backgroundColor: string;
30
+ };
31
+ '&:focus:not([disabled])': {
32
+ boxShadow: string;
33
+ };
34
+ '&:active:not([disabled])': {
35
+ backgroundColor: string;
36
+ boxShadow: string;
37
+ };
38
+ '&:disabled': {
39
+ color: string;
40
+ backgroundColor: string;
41
+ };
42
+ '[data-component="ButtonCounter"]': {
43
+ backgroundColor: string;
44
+ color: string;
45
+ };
46
+ } | {
47
+ color: string;
48
+ backgroundColor: string;
49
+ boxShadow: string;
50
+ '&:hover:not([disabled])': {
51
+ color: string;
52
+ backgroundColor: string;
53
+ borderColor: string;
54
+ boxShadow: string;
55
+ '[data-component="ButtonCounter"]': {
56
+ backgroundColor: string;
57
+ color: string;
58
+ };
59
+ };
60
+ '&:focus:not([disabled])': {
61
+ borderColor: string;
62
+ boxShadow: string;
63
+ };
64
+ '&:active:not([disabled])': {
65
+ color: string;
66
+ backgroundColor: string;
67
+ boxShadow: string;
68
+ borderColor: string;
69
+ };
70
+ '&:disabled': {
71
+ color: string;
72
+ backgroundColor: string;
73
+ borderColor: string;
74
+ '[data-component="ButtonCounter"]': {
75
+ backgroundColor: string;
76
+ };
77
+ };
78
+ '[data-component="ButtonCounter"]': {
79
+ color: string;
80
+ backgroundColor: string;
81
+ };
82
+ } | {
83
+ color: string;
84
+ backgroundColor: string;
85
+ border: string;
86
+ boxShadow: string;
87
+ '&:hover:not([disabled])': {
88
+ backgroundColor: string;
89
+ };
90
+ '&:focus:not([disabled])': {
91
+ boxShadow: string;
92
+ };
93
+ '&:active:not([disabled])': {
94
+ backgroundColor: string;
95
+ };
96
+ '&:disabled': {
97
+ color: string;
98
+ };
99
+ } | {
100
+ color: string;
101
+ boxShadow: string;
102
+ '&:hover': {
103
+ color: string;
104
+ backgroundColor: string;
105
+ borderColor: string;
106
+ boxShadow: string;
107
+ '[data-component="ButtonCounter"]': {
108
+ backgroundColor: string;
109
+ color: string;
110
+ };
111
+ };
112
+ '&:focus': {
113
+ borderColor: string;
114
+ boxShadow: string;
115
+ };
116
+ '&:active:not([disabled])': {
117
+ color: string;
118
+ backgroundColor: string;
119
+ boxShadow: string;
120
+ borderColor: string;
121
+ };
122
+ '&:disabled': {
123
+ color: string;
124
+ backgroundColor: string;
125
+ borderColor: string;
126
+ '[data-component="ButtonCounter"]': {
127
+ backgroundColor: string;
128
+ };
129
+ };
130
+ '[data-component="ButtonCounter"]': {
131
+ backgroundColor: string;
132
+ color: string;
133
+ };
134
+ };
135
+ export declare const getSizeStyles: (size: string | undefined, variant: VariantType | undefined, iconOnly: boolean) => {
136
+ paddingY: string;
137
+ paddingX: string;
138
+ fontSize: number;
139
+ '[data-component="ButtonCounter"]': {
140
+ fontSize: number;
141
+ };
142
+ };
143
+ export declare const getBaseStyles: (theme?: Theme | undefined) => {
144
+ borderRadius: string;
145
+ border: string;
146
+ borderColor: any;
147
+ fontWeight: string;
148
+ lineHeight: string;
149
+ whiteSpace: string;
150
+ verticalAlign: string;
151
+ cursor: string;
152
+ appearance: string;
153
+ userSelect: string;
154
+ textDecoration: string;
155
+ textAlign: string;
156
+ '&:focus': {
157
+ outline: string;
158
+ };
159
+ '&:disabled': {
160
+ cursor: string;
161
+ };
162
+ '&:disabled svg': {
163
+ opacity: string;
164
+ };
165
+ };
166
+ export declare const getButtonStyles: (theme?: Theme | undefined) => {
167
+ display: string;
168
+ gridTemplateAreas: string;
169
+ '& > :not(:last-child)': {
170
+ mr: string;
171
+ };
172
+ '[data-component="leadingIcon"]': {
173
+ gridArea: string;
174
+ };
175
+ '[data-component="text"]': {
176
+ gridArea: string;
177
+ };
178
+ '[data-component="trailingIcon"]': {
179
+ gridArea: string;
180
+ };
181
+ borderRadius: string;
182
+ border: string;
183
+ borderColor: any;
184
+ fontWeight: string;
185
+ lineHeight: string;
186
+ whiteSpace: string;
187
+ verticalAlign: string;
188
+ cursor: string;
189
+ appearance: string;
190
+ userSelect: string;
191
+ textDecoration: string;
192
+ textAlign: string;
193
+ '&:focus': {
194
+ outline: string;
195
+ };
196
+ '&:disabled': {
197
+ cursor: string;
198
+ };
199
+ '&:disabled svg': {
200
+ opacity: string;
201
+ };
202
+ };
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getButtonStyles = exports.getBaseStyles = exports.getSizeStyles = exports.getVariantStyles = exports.TEXT_ROW_HEIGHT = void 0;
7
+ const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
8
+
9
+ exports.TEXT_ROW_HEIGHT = TEXT_ROW_HEIGHT;
10
+
11
+ const getVariantStyles = (variant = 'default', theme) => {
12
+ const style = {
13
+ default: {
14
+ color: 'btn.text',
15
+ backgroundColor: 'btn.bg',
16
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}, ${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.insetShadow}`,
17
+ '&:hover:not([disabled])': {
18
+ backgroundColor: 'btn.hoverBg'
19
+ },
20
+ // focus must come before :active so that the active box shadow overrides
21
+ '&:focus:not([disabled])': {
22
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
23
+ },
24
+ '&:active:not([disabled])': {
25
+ backgroundColor: 'btn.selectedBg',
26
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadowActive}`
27
+ },
28
+ '&:disabled': {
29
+ color: 'primer.fg.disabled',
30
+ backgroundColor: 'btn.disabledBg'
31
+ }
32
+ },
33
+ primary: {
34
+ color: 'btn.primary.text',
35
+ backgroundColor: 'btn.primary.bg',
36
+ borderColor: 'border.subtle',
37
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.shadow}`,
38
+ '&:hover:not([disabled])': {
39
+ color: 'btn.primary.hoverText',
40
+ backgroundColor: 'btn.primary.hoverBg'
41
+ },
42
+ // focus must come before :active so that the active box shadow overrides
43
+ '&:focus:not([disabled])': {
44
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.focusShadow}`
45
+ },
46
+ '&:active:not([disabled])': {
47
+ backgroundColor: 'btn.primary.selectedBg',
48
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.selectedShadow}`
49
+ },
50
+ '&:disabled': {
51
+ color: 'btn.primary.disabledText',
52
+ backgroundColor: 'btn.primary.disabledBg'
53
+ },
54
+ '[data-component="ButtonCounter"]': {
55
+ backgroundColor: 'btn.primary.counterBg',
56
+ color: 'btn.primary.text'
57
+ }
58
+ },
59
+ danger: {
60
+ color: 'btn.danger.text',
61
+ backgroundColor: 'btn.bg',
62
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
63
+ '&:hover:not([disabled])': {
64
+ color: 'btn.danger.hoverText',
65
+ backgroundColor: 'btn.danger.hoverBg',
66
+ borderColor: 'btn.danger.hoverBorder',
67
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.hoverShadow}`,
68
+ '[data-component="ButtonCounter"]': {
69
+ backgroundColor: 'btn.danger.hoverCounterBg',
70
+ color: 'btn.danger.hoverText'
71
+ }
72
+ },
73
+ // focus must come before :active so that the active box shadow overrides
74
+ '&:focus:not([disabled])': {
75
+ borderColor: 'btn.danger.focusBorder',
76
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.focusShadow}`
77
+ },
78
+ '&:active:not([disabled])': {
79
+ color: 'btn.danger.selectedText',
80
+ backgroundColor: 'btn.danger.selectedBg',
81
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.selectedShadow}`,
82
+ borderColor: 'btn.danger.selectedBorder'
83
+ },
84
+ '&:disabled': {
85
+ color: 'btn.danger.disabledText',
86
+ backgroundColor: 'btn.danger.disabledBg',
87
+ borderColor: 'btn.danger.disabledBorder',
88
+ '[data-component="ButtonCounter"]': {
89
+ backgroundColor: 'btn.danger.disabledCounterBg'
90
+ }
91
+ },
92
+ '[data-component="ButtonCounter"]': {
93
+ color: 'btn.danger.text',
94
+ backgroundColor: 'btn.danger.counterBg'
95
+ }
96
+ },
97
+ invisible: {
98
+ color: 'accent.fg',
99
+ backgroundColor: 'transparent',
100
+ border: '0',
101
+ boxShadow: 'none',
102
+ '&:hover:not([disabled])': {
103
+ backgroundColor: 'btn.hoverBg'
104
+ },
105
+ // focus must come before :active so that the active box shadow overrides
106
+ '&:focus:not([disabled])': {
107
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
108
+ },
109
+ '&:active:not([disabled])': {
110
+ backgroundColor: 'btn.selectedBg'
111
+ },
112
+ '&:disabled': {
113
+ color: 'primer.fg.disabled'
114
+ }
115
+ },
116
+ outline: {
117
+ color: 'btn.outline.text',
118
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
119
+ '&:hover': {
120
+ color: 'btn.outline.hoverText',
121
+ backgroundColor: 'btn.outline.hoverBg',
122
+ borderColor: 'outline.hoverBorder',
123
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.hoverShadow}`,
124
+ '[data-component="ButtonCounter"]': {
125
+ backgroundColor: 'btn.outline.hoverCounterBg',
126
+ color: 'btn.outline.hoverText'
127
+ }
128
+ },
129
+ // focus must come before :active so that the active box shadow overrides
130
+ '&:focus': {
131
+ borderColor: 'btn.outline.focusBorder',
132
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.focusShadow}`
133
+ },
134
+ '&:active:not([disabled])': {
135
+ color: 'btn.outline.selectedText',
136
+ backgroundColor: 'btn.outline.selectedBg',
137
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.selectedShadow}`,
138
+ borderColor: 'btn.outline.selectedBorder'
139
+ },
140
+ '&:disabled': {
141
+ color: 'btn.outline.disabledText',
142
+ backgroundColor: 'btn.outline.disabledBg',
143
+ borderColor: 'btn.border',
144
+ '[data-component="ButtonCounter"]': {
145
+ backgroundColor: 'btn.outline.disabledCounterBg'
146
+ }
147
+ },
148
+ '[data-component="ButtonCounter"]': {
149
+ backgroundColor: 'btn.outline.counterBg',
150
+ color: 'btn.outline.text'
151
+ }
152
+ }
153
+ };
154
+ return style[variant];
155
+ };
156
+
157
+ exports.getVariantStyles = getVariantStyles;
158
+
159
+ const getSizeStyles = (size = 'medium', variant = 'default', iconOnly) => {
160
+ let paddingY, paddingX, fontSize;
161
+
162
+ switch (size) {
163
+ case 'small':
164
+ paddingY = 3;
165
+ paddingX = 12;
166
+ fontSize = 0;
167
+ break;
168
+
169
+ case 'large':
170
+ paddingY = 9;
171
+ paddingX = 20;
172
+ fontSize = 2;
173
+ break;
174
+
175
+ case 'medium':
176
+ default:
177
+ paddingY = 5;
178
+ paddingX = 16;
179
+ fontSize = 1;
180
+ }
181
+
182
+ if (iconOnly) {
183
+ paddingX = paddingY + 2;
184
+ }
185
+
186
+ if (variant === 'invisible') {
187
+ paddingY = paddingY + 1;
188
+ }
189
+
190
+ return {
191
+ paddingY: `${paddingY}px`,
192
+ paddingX: `${paddingX}px`,
193
+ fontSize,
194
+ '[data-component="ButtonCounter"]': {
195
+ fontSize
196
+ }
197
+ };
198
+ };
199
+
200
+ exports.getSizeStyles = getSizeStyles;
201
+
202
+ const getBaseStyles = theme => ({
203
+ borderRadius: '2',
204
+ border: '1px solid',
205
+ borderColor: theme === null || theme === void 0 ? void 0 : theme.colors.btn.border,
206
+ fontWeight: 'bold',
207
+ lineHeight: TEXT_ROW_HEIGHT,
208
+ whiteSpace: 'nowrap',
209
+ verticalAlign: 'middle',
210
+ cursor: 'pointer',
211
+ appearance: 'none',
212
+ userSelect: 'none',
213
+ textDecoration: 'none',
214
+ textAlign: 'center',
215
+ '&:focus': {
216
+ outline: 'none'
217
+ },
218
+ '&:disabled': {
219
+ cursor: 'default'
220
+ },
221
+ '&:disabled svg': {
222
+ opacity: '0.6'
223
+ }
224
+ });
225
+
226
+ exports.getBaseStyles = getBaseStyles;
227
+
228
+ const getButtonStyles = theme => {
229
+ const styles = { ...getBaseStyles(theme),
230
+ display: 'grid',
231
+ gridTemplateAreas: '"leadingIcon text trailingIcon"',
232
+ '& > :not(:last-child)': {
233
+ mr: '2'
234
+ },
235
+ '[data-component="leadingIcon"]': {
236
+ gridArea: 'leadingIcon'
237
+ },
238
+ '[data-component="text"]': {
239
+ gridArea: 'text'
240
+ },
241
+ '[data-component="trailingIcon"]': {
242
+ gridArea: 'trailingIcon'
243
+ }
244
+ };
245
+ return styles;
246
+ };
247
+
248
+ exports.getButtonStyles = getButtonStyles;
@@ -1,9 +1,11 @@
1
- import React, { HTMLAttributes } from 'react';
1
+ import React, { HTMLAttributes, ComponentPropsWithRef } from 'react';
2
2
  import { IconProps } from '@primer/octicons-react';
3
3
  import { SxProp } from '../sx';
4
+ export declare const StyledButton: import("styled-components").StyledComponent<"button", any, SxProp, never>;
4
5
  export declare type VariantType = 'default' | 'primary' | 'invisible' | 'danger' | 'outline';
5
6
  export declare type Size = 'small' | 'medium' | 'large';
6
- export declare type ButtonProps = {
7
+ declare type StyledButtonProps = ComponentPropsWithRef<typeof StyledButton>;
8
+ export declare type ButtonBaseProps = {
7
9
  /**
8
10
  * Determine's the styles on a button one of 'default' | 'primary' | 'invisible' | 'danger'
9
11
  */
@@ -13,9 +15,11 @@ export declare type ButtonProps = {
13
15
  */
14
16
  size?: Size;
15
17
  /**
16
- * This is to be used if it is an icon-only button. Will make text visually hidden
18
+ * Items that are disabled can not be clicked, selected, or navigated through.
17
19
  */
18
- icon?: React.FunctionComponent<IconProps>;
20
+ disabled?: boolean;
21
+ } & SxProp & HTMLAttributes<HTMLButtonElement> & StyledButtonProps;
22
+ export declare type ButtonProps = {
19
23
  /**
20
24
  * The leading icon comes before button content
21
25
  */
@@ -24,9 +28,25 @@ export declare type ButtonProps = {
24
28
  * The trailing icon comes after button content
25
29
  */
26
30
  trailingIcon?: React.FunctionComponent<IconProps>;
31
+ children: React.ReactNode;
32
+ } & ButtonBaseProps;
33
+ export declare type IconButtonProps = {
27
34
  /**
28
- * Items that are disabled can not be clicked, selected, or navigated through.
35
+ * This is to be used if it is an icon-only button. Will make text visually hidden
29
36
  */
30
- disabled?: boolean;
31
- children: React.ReactNode;
32
- } & SxProp & HTMLAttributes<HTMLButtonElement>;
37
+ icon: React.FunctionComponent<IconProps>;
38
+ iconLabel: string;
39
+ } & ButtonBaseProps;
40
+ export declare type LinkButtonProps = {
41
+ underline?: boolean;
42
+ download?: string;
43
+ href?: string;
44
+ hrefLang?: string;
45
+ media?: string;
46
+ ping?: string;
47
+ rel?: string;
48
+ target?: string;
49
+ type?: string;
50
+ referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
51
+ };
52
+ export {};
@@ -1 +1,19 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledButton = void 0;
7
+
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+
10
+ var _sx = _interopRequireDefault(require("../sx"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const StyledButton = _styledComponents.default.button.withConfig({
15
+ displayName: "types__StyledButton",
16
+ componentId: "sc-1sm8kx1-0"
17
+ })(_sx.default);
18
+
19
+ exports.StyledButton = StyledButton;
package/lib/index.d.ts CHANGED
@@ -48,8 +48,6 @@ export { default as CircleBadge } from './CircleBadge';
48
48
  export type { CircleBadgeProps, CircleBadgeIconProps } from './CircleBadge';
49
49
  export { default as CircleOcticon } from './CircleOcticon';
50
50
  export type { CircleOcticonProps } from './CircleOcticon';
51
- export { default as CheckboxInputField } from './CheckboxInputField';
52
- export { default as ChoiceFieldset, Item } from './ChoiceFieldset';
53
51
  export { default as CounterLabel } from './CounterLabel';
54
52
  export type { CounterLabelProps } from './CounterLabel';
55
53
  export { default as Details } from './Details';
@@ -90,7 +88,6 @@ export { default as Popover } from './Popover';
90
88
  export type { PopoverProps, PopoverContentProps } from './Popover';
91
89
  export { default as ProgressBar } from './ProgressBar';
92
90
  export type { ProgressBarProps } from './ProgressBar';
93
- export { default as RadioInputField } from './RadioInputField';
94
91
  export { default as SelectMenu } from './SelectMenu';
95
92
  export type { SelectMenuProps, SelectMenuDividerProps, SelectMenuFilterProps, SelectMenuFooterProps, SelectMenuItemProps, SelectMenuListProps, SelectMenuModalProps, SelectMenuTabsProps, SelectMenuHeaderProps, SelectMenuTabProps, SelectMenuTabPanelProps, SelectMenuLoadingAnimationProps } from './SelectMenu';
96
93
  export { default as SideNav } from './SideNav';
@@ -107,7 +104,6 @@ export { default as TabNav } from './TabNav';
107
104
  export type { TabNavProps, TabNavLinkProps } from './TabNav';
108
105
  export { default as TextInput } from './TextInput';
109
106
  export type { TextInputProps } from './TextInput';
110
- export { default as TextInputField } from './TextInputField';
111
107
  export { default as TextInputWithTokens } from './TextInputWithTokens';
112
108
  export type { TextInputWithTokensProps } from './TextInputWithTokens';
113
109
  export { default as Text } from './Text';
package/lib/index.js CHANGED
@@ -273,24 +273,6 @@ Object.defineProperty(exports, "CircleOcticon", {
273
273
  return _CircleOcticon.default;
274
274
  }
275
275
  });
276
- Object.defineProperty(exports, "CheckboxInputField", {
277
- enumerable: true,
278
- get: function () {
279
- return _CheckboxInputField.default;
280
- }
281
- });
282
- Object.defineProperty(exports, "ChoiceFieldset", {
283
- enumerable: true,
284
- get: function () {
285
- return _ChoiceFieldset.default;
286
- }
287
- });
288
- Object.defineProperty(exports, "Item", {
289
- enumerable: true,
290
- get: function () {
291
- return _ChoiceFieldset.Item;
292
- }
293
- });
294
276
  Object.defineProperty(exports, "CounterLabel", {
295
277
  enumerable: true,
296
278
  get: function () {
@@ -417,12 +399,6 @@ Object.defineProperty(exports, "ProgressBar", {
417
399
  return _ProgressBar.default;
418
400
  }
419
401
  });
420
- Object.defineProperty(exports, "RadioInputField", {
421
- enumerable: true,
422
- get: function () {
423
- return _RadioInputField.default;
424
- }
425
- });
426
402
  Object.defineProperty(exports, "SelectMenu", {
427
403
  enumerable: true,
428
404
  get: function () {
@@ -471,12 +447,6 @@ Object.defineProperty(exports, "TextInput", {
471
447
  return _TextInput.default;
472
448
  }
473
449
  });
474
- Object.defineProperty(exports, "TextInputField", {
475
- enumerable: true,
476
- get: function () {
477
- return _TextInputField.default;
478
- }
479
- });
480
450
  Object.defineProperty(exports, "TextInputWithTokens", {
481
451
  enumerable: true,
482
452
  get: function () {
@@ -610,10 +580,6 @@ var _CircleBadge = _interopRequireDefault(require("./CircleBadge"));
610
580
 
611
581
  var _CircleOcticon = _interopRequireDefault(require("./CircleOcticon"));
612
582
 
613
- var _CheckboxInputField = _interopRequireDefault(require("./CheckboxInputField"));
614
-
615
- var _ChoiceFieldset = _interopRequireWildcard(require("./ChoiceFieldset"));
616
-
617
583
  var _CounterLabel = _interopRequireDefault(require("./CounterLabel"));
618
584
 
619
585
  var _Details = _interopRequireDefault(require("./Details"));
@@ -654,8 +620,6 @@ var _Popover = _interopRequireDefault(require("./Popover"));
654
620
 
655
621
  var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
656
622
 
657
- var _RadioInputField = _interopRequireDefault(require("./RadioInputField"));
658
-
659
623
  var _SelectMenu = _interopRequireDefault(require("./SelectMenu"));
660
624
 
661
625
  var _SideNav = _interopRequireDefault(require("./SideNav"));
@@ -672,8 +636,6 @@ var _TabNav = _interopRequireDefault(require("./TabNav"));
672
636
 
673
637
  var _TextInput = _interopRequireDefault(require("./TextInput"));
674
638
 
675
- var _TextInputField = _interopRequireDefault(require("./TextInputField"));
676
-
677
639
  var _TextInputWithTokens = _interopRequireDefault(require("./TextInputWithTokens"));
678
640
 
679
641
  var _Text = _interopRequireDefault(require("./Text"));
@@ -4,9 +4,8 @@ import { useFocusZone } from '../hooks/useFocusZone';
4
4
  import { Box, Spinner } from '../';
5
5
  import { AutocompleteContext } from './AutocompleteContext';
6
6
  import { PlusIcon } from '@primer/octicons-react';
7
+ import { uniqueId } from '../utils/uniqueId';
7
8
  import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
8
- import VisuallyHidden from '../_VisuallyHidden';
9
- import { useSSRSafeId } from '@react-aria/ssr';
10
9
 
11
10
  const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
12
11
 
@@ -73,7 +72,6 @@ function AutocompleteMenu(props) {
73
72
  const [sortedItemIds, setSortedItemIds] = useState(items.map(({
74
73
  id: itemId
75
74
  }) => itemId));
76
- const generatedUniqueId = useSSRSafeId(id);
77
75
  const selectableItems = useMemo(() => items.map(selectableItem => {
78
76
  return { ...selectableItem,
79
77
  role: 'option',
@@ -109,7 +107,7 @@ function AutocompleteMenu(props) {
109
107
  onAction: item => {
110
108
  // TODO: make it possible to pass a leadingVisual when using `addNewItem`
111
109
  addNewItem.handleAddItem({ ...item,
112
- id: item.id || generatedUniqueId,
110
+ id: item.id || uniqueId(),
113
111
  leadingVisual: undefined
114
112
  });
115
113
 
@@ -118,7 +116,7 @@ function AutocompleteMenu(props) {
118
116
  setAutocompleteSuggestion('');
119
117
  }
120
118
  }
121
- }] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue, generatedUniqueId]);
119
+ }] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue]);
122
120
  useFocusZone({
123
121
  containerRef: listContainerRef,
124
122
  focusOutBehavior: 'wrap',
@@ -166,8 +164,19 @@ function AutocompleteMenu(props) {
166
164
  setSelectedItemLength(selectedItemIds.length);
167
165
  }
168
166
  }, [selectedItemIds, setSelectedItemLength]);
169
- return /*#__PURE__*/React.createElement(VisuallyHidden, {
170
- 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
+ } : {}
171
180
  }, loading ? /*#__PURE__*/React.createElement(Box, {
172
181
  p: 3,
173
182
  display: "flex",