@primer/components 0.0.0-20219256296 → 0.0.0-2021926103714

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 (134) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/browser.esm.js +615 -615
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +176 -176
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList2/Description.d.ts +6 -0
  7. package/lib/ActionList2/Description.js +53 -0
  8. package/lib/ActionList2/Divider.d.ts +8 -0
  9. package/lib/ActionList2/Divider.js +42 -0
  10. package/lib/ActionList2/Group.d.ts +8 -0
  11. package/lib/ActionList2/Group.js +39 -0
  12. package/lib/ActionList2/Header.d.ts +26 -0
  13. package/lib/ActionList2/Header.js +55 -0
  14. package/lib/ActionList2/Item.d.ts +49 -0
  15. package/lib/ActionList2/Item.js +190 -0
  16. package/lib/ActionList2/List.d.ts +11 -0
  17. package/lib/ActionList2/List.js +53 -0
  18. package/lib/ActionList2/Selection.d.ts +5 -0
  19. package/lib/ActionList2/Selection.js +67 -0
  20. package/lib/ActionList2/Visuals.d.ts +11 -0
  21. package/lib/ActionList2/Visuals.js +90 -0
  22. package/lib/ActionList2/hacks.d.ts +30 -0
  23. package/lib/ActionList2/hacks.js +38 -0
  24. package/lib/ActionList2/index.d.ts +26 -0
  25. package/lib/ActionList2/index.js +36 -0
  26. package/lib/Autocomplete/Autocomplete.d.ts +9 -9
  27. package/lib/Autocomplete/AutocompleteInput.d.ts +9 -9
  28. package/lib/Button/Button.d.ts +11 -11
  29. package/lib/Button/ButtonBase.d.ts +1 -1
  30. package/lib/Button/ButtonClose.d.ts +29 -29
  31. package/lib/Button/ButtonDanger.d.ts +11 -11
  32. package/lib/Button/ButtonInvisible.d.ts +11 -11
  33. package/lib/Button/ButtonOutline.d.ts +11 -11
  34. package/lib/Button/ButtonPrimary.d.ts +11 -11
  35. package/lib/Button/ButtonStyles.js +1 -1
  36. package/lib/CircleBadge.d.ts +2 -2
  37. package/lib/CircleOcticon.d.ts +33 -33
  38. package/lib/Dialog.d.ts +35 -35
  39. package/lib/Dropdown.d.ts +110 -110
  40. package/lib/DropdownMenu/DropdownButton.d.ts +30 -30
  41. package/lib/FilterList.d.ts +26 -26
  42. package/lib/Label.d.ts +1 -1
  43. package/lib/Position.d.ts +4 -4
  44. package/lib/ProgressBar.d.ts +1 -1
  45. package/lib/SelectMenu/SelectMenu.d.ts +149 -149
  46. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  47. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  48. package/lib/TextInputWithTokens.d.ts +9 -9
  49. package/lib/Timeline.d.ts +33 -33
  50. package/lib/Token/AvatarToken.d.ts +1 -1
  51. package/lib/Token/IssueLabelToken.d.ts +1 -1
  52. package/lib/Token/Token.d.ts +1 -1
  53. package/lib/_TextInputWrapper.d.ts +1 -1
  54. package/lib/constants.js +1 -3
  55. package/lib/index.d.ts +1 -0
  56. package/lib/index.js +8 -0
  57. package/lib/sx.d.ts +2 -0
  58. package/lib/sx.js +8 -0
  59. package/lib/utils/create-slots.d.ts +17 -0
  60. package/lib/utils/create-slots.js +105 -0
  61. package/lib/utils/testing.d.ts +1 -1
  62. package/lib/utils/use-force-update.d.ts +1 -0
  63. package/lib/utils/use-force-update.js +19 -0
  64. package/lib-esm/ActionList2/Description.d.ts +6 -0
  65. package/lib-esm/ActionList2/Description.js +37 -0
  66. package/lib-esm/ActionList2/Divider.d.ts +8 -0
  67. package/lib-esm/ActionList2/Divider.js +30 -0
  68. package/lib-esm/ActionList2/Group.d.ts +8 -0
  69. package/lib-esm/ActionList2/Group.js +29 -0
  70. package/lib-esm/ActionList2/Header.d.ts +26 -0
  71. package/lib-esm/ActionList2/Header.js +45 -0
  72. package/lib-esm/ActionList2/Item.d.ts +49 -0
  73. package/lib-esm/ActionList2/Item.js +183 -0
  74. package/lib-esm/ActionList2/List.d.ts +11 -0
  75. package/lib-esm/ActionList2/List.js +35 -0
  76. package/lib-esm/ActionList2/Selection.d.ts +5 -0
  77. package/lib-esm/ActionList2/Selection.js +50 -0
  78. package/lib-esm/ActionList2/Visuals.d.ts +11 -0
  79. package/lib-esm/ActionList2/Visuals.js +68 -0
  80. package/lib-esm/ActionList2/hacks.d.ts +30 -0
  81. package/lib-esm/ActionList2/hacks.js +30 -0
  82. package/lib-esm/ActionList2/index.d.ts +26 -0
  83. package/lib-esm/ActionList2/index.js +23 -0
  84. package/lib-esm/Autocomplete/Autocomplete.d.ts +9 -9
  85. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +9 -9
  86. package/lib-esm/Button/Button.d.ts +11 -11
  87. package/lib-esm/Button/ButtonBase.d.ts +1 -1
  88. package/lib-esm/Button/ButtonClose.d.ts +29 -29
  89. package/lib-esm/Button/ButtonDanger.d.ts +11 -11
  90. package/lib-esm/Button/ButtonInvisible.d.ts +11 -11
  91. package/lib-esm/Button/ButtonOutline.d.ts +11 -11
  92. package/lib-esm/Button/ButtonPrimary.d.ts +11 -11
  93. package/lib-esm/Button/ButtonStyles.js +1 -1
  94. package/lib-esm/CircleBadge.d.ts +2 -2
  95. package/lib-esm/CircleOcticon.d.ts +33 -33
  96. package/lib-esm/Dialog.d.ts +35 -35
  97. package/lib-esm/Dropdown.d.ts +110 -110
  98. package/lib-esm/DropdownMenu/DropdownButton.d.ts +30 -30
  99. package/lib-esm/FilterList.d.ts +26 -26
  100. package/lib-esm/Label.d.ts +1 -1
  101. package/lib-esm/Position.d.ts +4 -4
  102. package/lib-esm/ProgressBar.d.ts +1 -1
  103. package/lib-esm/SelectMenu/SelectMenu.d.ts +149 -149
  104. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  105. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  106. package/lib-esm/TextInputWithTokens.d.ts +9 -9
  107. package/lib-esm/Timeline.d.ts +33 -33
  108. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  109. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  110. package/lib-esm/Token/Token.d.ts +1 -1
  111. package/lib-esm/_TextInputWrapper.d.ts +1 -1
  112. package/lib-esm/constants.js +1 -3
  113. package/lib-esm/index.d.ts +1 -0
  114. package/lib-esm/index.js +1 -0
  115. package/lib-esm/sx.d.ts +2 -0
  116. package/lib-esm/sx.js +3 -1
  117. package/lib-esm/utils/create-slots.d.ts +17 -0
  118. package/lib-esm/utils/create-slots.js +84 -0
  119. package/lib-esm/utils/testing.d.ts +1 -1
  120. package/lib-esm/utils/use-force-update.d.ts +1 -0
  121. package/lib-esm/utils/use-force-update.js +6 -0
  122. package/package.json +1 -1
  123. package/lib/NewButton/button.d.ts +0 -18
  124. package/lib/NewButton/button.js +0 -275
  125. package/lib/NewButton/index.d.ts +0 -4
  126. package/lib/NewButton/index.js +0 -21
  127. package/lib/NewButton/visual.d.ts +0 -6
  128. package/lib/NewButton/visual.js +0 -28
  129. package/lib-esm/NewButton/button.d.ts +0 -18
  130. package/lib-esm/NewButton/button.js +0 -257
  131. package/lib-esm/NewButton/index.d.ts +0 -4
  132. package/lib-esm/NewButton/index.js +0 -3
  133. package/lib-esm/NewButton/visual.d.ts +0 -6
  134. package/lib-esm/NewButton/visual.js +0 -17
@@ -1,257 +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 Box from '../Box';
5
- import { fontSize, variant } from 'styled-system';
6
- import styled from 'styled-components';
7
- import sx from '../sx';
8
- import { get } from '../constants';
9
- import buttonBaseStyles from '../Button/ButtonStyles';
10
- import Visual from './visual';
11
- const sizes = variant({
12
- prop: 'size',
13
- variants: {
14
- small: {
15
- p: '4px 12px',
16
- fontSize: 0
17
- },
18
- medium: {
19
- fontSize: 1
20
- },
21
- large: {
22
- fontSize: 2,
23
- p: '10px 20px'
24
- }
25
- }
26
- });
27
-
28
- const getVariantStyles = (theme, variant = 'default') => {
29
- const style = {
30
- default: `
31
- padding: 5px 16px;
32
- color: ${get('colors.btn.text')({
33
- theme
34
- })};
35
- background-color: ${get('colors.btn.bg')({
36
- theme
37
- })};
38
- border-width: 1px;
39
- border-style: solid;
40
- border-color: ${get('colors.btn.border')({
41
- theme
42
- })};
43
- box-shadow: ${(get('shadows.btn.shadow')({
44
- theme
45
- }), get('shadows.btn.insetShadow')({
46
- theme
47
- }))};
48
- &:hover {
49
- background-color: ${get('colors.btn.hoverBg')({
50
- theme
51
- })};
52
- }
53
- // focus must come before :active so that the active box shadow overrides
54
- &:focus {
55
- box-shadow: ${get('shadows.btn.focusShadow')({
56
- theme
57
- })};
58
- }
59
- &:active {
60
- background-color: ${get('colors.btn.selectedBg')({
61
- theme
62
- })};
63
- box-shadow: ${get('shadows.btn.shadowActive')({
64
- theme
65
- })};
66
- }
67
- &:disabled {
68
- color: ${get('colors.primer.fg.disabled')({
69
- theme
70
- })};
71
- }
72
- `,
73
- primary: `
74
- padding: 5px 16px;
75
- color: ${get('colors.btn.primary.text')({
76
- theme
77
- })};
78
- background-color: ${get('colors.btn.primary.bg')({
79
- theme
80
- })};
81
- border-width: 1px;
82
- border-style: solid;
83
- border-color: ${get('colors.border.subtle')({
84
- theme
85
- })};
86
- box-shadow: ${get('shadows.btn.primary.shadow')({
87
- theme
88
- })};
89
-
90
- &:hover {
91
- color: ${get('colors.btn.primary.hoverText')({
92
- theme
93
- })};
94
- background-color: ${get('colors.btn.primary.hoverBg')({
95
- theme
96
- })};
97
- }
98
- // focus must come before :active so that the active box shadow overrides
99
- &:focus {
100
- box-shadow: ${get('shadows.btn.primary.focusShadow')({
101
- theme
102
- })};
103
- }
104
-
105
- &:active {
106
- background-color: ${get('colors.btn.primary.selectedBg')({
107
- theme
108
- })};
109
- box-shadow: ${get('shadows.btn.primary.selectedShadow')({
110
- theme
111
- })};
112
- }
113
-
114
- &:disabled {
115
- color: ${get('colors.btn.primary.disabledText')({
116
- theme
117
- })};
118
- background-color: ${get('colors.btn.primary.disabledBg')({
119
- theme
120
- })};
121
- }`,
122
- danger: `
123
- padding: 5px 16px;
124
- color: ${get('colors.btn.danger.text')({
125
- theme
126
- })};
127
- border: 1px solid ${get('colors.btn.border')({
128
- theme
129
- })};
130
- background-color: ${get('colors.btn.bg')({
131
- theme
132
- })};
133
- box-shadow: ${get('shadows.btn.shadow')({
134
- theme
135
- })};
136
-
137
- &:hover {
138
- color: ${get('colors.btn.danger.hoverText')({
139
- theme
140
- })};
141
- background-color: ${get('colors.btn.danger.hoverBg')({
142
- theme
143
- })};
144
- border-color: ${get('colors.btn.danger.hoverBorder')({
145
- theme
146
- })};
147
- box-shadow: ${get('shadows.btn.danger.hoverShadow')({
148
- theme
149
- })};
150
- }
151
- // focus must come before :active so that the active box shadow overrides
152
- &:focus {
153
- border-color: ${get('colors.btn.danger.focusBorder')({
154
- theme
155
- })};
156
- box-shadow: ${get('shadows.btn.danger.focusShadow')({
157
- theme
158
- })};
159
- }
160
-
161
- &:active {
162
- color: ${get('colors.btn.danger.selectedText')({
163
- theme
164
- })};
165
- background-color: ${get('colors.btn.danger.selectedBg')({
166
- theme
167
- })};
168
- box-shadow: ${get('shadows.btn.danger.selectedShadow')({
169
- theme
170
- })};
171
- border-color: ${get('colors.btn.danger.selectedBorder')({
172
- theme
173
- })};
174
- }
175
-
176
- &:disabled {
177
- color: ${get('colors.btn.danger.disabledText')({
178
- theme
179
- })};
180
- background-color: ${get('colors.btn.danger.disabledBg')({
181
- theme
182
- })};
183
- border-color: ${get('colors.btn.danger.disabledBorder')({
184
- theme
185
- })};
186
- }
187
- `,
188
- invisible: `
189
- padding: 6px 16px;
190
- color: ${get('colors.accent.fg')({
191
- theme
192
- })};
193
- background-color: transparent;
194
- border: 0;
195
- border-radius: ${get('radii.2')({
196
- theme
197
- })};
198
- box-shadow: none;
199
-
200
- &:disabled {
201
- color: ${get('colors.primer.fg.disabled')({
202
- theme
203
- })};
204
- }
205
- &:focus {
206
- box-shadow: ${get('shadows.btn.focusShadow')({
207
- theme
208
- })};
209
- }
210
- &:hover {
211
- background-color: ${get('colors.btn.hoverBg')({
212
- theme
213
- })};
214
- }
215
- &:active {
216
- background-color: ${get('colors.btn.selectedBg')({
217
- theme
218
- })};
219
- }
220
- `,
221
- block: ``
222
- };
223
- return style[variant];
224
- };
225
-
226
- const ButtonBase = styled.button.withConfig({
227
- displayName: "button__ButtonBase",
228
- componentId: "sc-15k5iqk-0"
229
- })(["", " ", " ", " ", " ", " ", ""], buttonBaseStyles, props => getVariantStyles(props.theme, props.variant), sizes, props => props.iconOnly ? `padding: 4px 6px;` : '', sx, fontSize);
230
-
231
- const Button = ({
232
- children,
233
- icon: Icon,
234
- ...props
235
- }) => {
236
- let iconOnly = false;
237
-
238
- if (!children) {
239
- iconOnly = true;
240
- }
241
-
242
- let iconWrapStyles = {
243
- display: 'inline-block',
244
- ...(!iconOnly ? {
245
- pr: 3
246
- } : {})
247
- };
248
- return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, props, {
249
- iconOnly: iconOnly
250
- }), Icon && /*#__PURE__*/React.createElement(Box, {
251
- sx: iconWrapStyles
252
- }, /*#__PURE__*/React.createElement(Icon, null)), children);
253
- };
254
-
255
- Button.displayName = "Button";
256
- Button.Visual = Visual;
257
- export default Button;
@@ -1,4 +0,0 @@
1
- export default Button;
2
- export { ButtonProps };
3
- import Button from "./button";
4
- import { ButtonProps } from "./button";
@@ -1,3 +0,0 @@
1
- import Button, { ButtonProps } from './button';
2
- export default Button;
3
- export { ButtonProps };
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { SxProp } from '../sx';
3
- declare const Visual: ({ children, sx }: {
4
- children: ReactNode;
5
- } & SxProp) => JSX.Element;
6
- export default Visual;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import Box from '../Box';
3
-
4
- const Visual = ({
5
- children,
6
- sx
7
- }) => {
8
- return /*#__PURE__*/React.createElement(Box, {
9
- sx: {
10
- display: 'inline-block',
11
- ...sx
12
- }
13
- }, children);
14
- };
15
-
16
- Visual.displayName = "Visual";
17
- export default Visual;