@primer/components 0.0.0-20219266052 → 0.0.0-202192711181

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 +48 -0
  15. package/lib/ActionList2/Item.js +205 -0
  16. package/lib/ActionList2/List.d.ts +12 -0
  17. package/lib/ActionList2/List.js +55 -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 +48 -0
  73. package/lib-esm/ActionList2/Item.js +198 -0
  74. package/lib-esm/ActionList2/List.d.ts +12 -0
  75. package/lib-esm/ActionList2/List.js +37 -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 -24
  124. package/lib/NewButton/button.js +0 -292
  125. package/lib/NewButton/counter.d.ts +0 -6
  126. package/lib/NewButton/counter.js +0 -33
  127. package/lib/NewButton/index.d.ts +0 -4
  128. package/lib/NewButton/index.js +0 -21
  129. package/lib-esm/NewButton/button.d.ts +0 -24
  130. package/lib-esm/NewButton/button.js +0 -268
  131. package/lib-esm/NewButton/counter.d.ts +0 -6
  132. package/lib-esm/NewButton/counter.js +0 -21
  133. package/lib-esm/NewButton/index.d.ts +0 -4
  134. package/lib-esm/NewButton/index.js +0 -3
@@ -1,268 +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, { forwardRef } from 'react';
4
- import { TriangleDownIcon } from '@primer/octicons-react';
5
- import Box from '../Box';
6
- import { fontSize, variant } from 'styled-system';
7
- import styled from 'styled-components';
8
- import sx from '../sx';
9
- import { get } from '../constants';
10
- import buttonBaseStyles from '../Button/ButtonStyles';
11
- import Counter from './counter';
12
- const sizes = variant({
13
- prop: 'size',
14
- variants: {
15
- small: {
16
- p: '4px 12px',
17
- fontSize: 0
18
- },
19
- medium: {
20
- fontSize: 1
21
- },
22
- large: {
23
- fontSize: 2,
24
- p: '10px 20px'
25
- }
26
- }
27
- });
28
-
29
- const getVariantStyles = (theme, variant = 'default') => {
30
- const style = {
31
- default: `
32
- padding: 5px 16px;
33
- color: ${get('colors.btn.text')({
34
- theme
35
- })};
36
- background-color: ${get('colors.btn.bg')({
37
- theme
38
- })};
39
- border-width: 1px;
40
- border-style: solid;
41
- border-color: ${get('colors.btn.border')({
42
- theme
43
- })};
44
- box-shadow: ${(get('shadows.btn.shadow')({
45
- theme
46
- }), get('shadows.btn.insetShadow')({
47
- theme
48
- }))};
49
- &:hover {
50
- background-color: ${get('colors.btn.hoverBg')({
51
- theme
52
- })};
53
- }
54
- // focus must come before :active so that the active box shadow overrides
55
- &:focus {
56
- box-shadow: ${get('shadows.btn.focusShadow')({
57
- theme
58
- })};
59
- }
60
- &:active {
61
- background-color: ${get('colors.btn.selectedBg')({
62
- theme
63
- })};
64
- box-shadow: ${get('shadows.btn.shadowActive')({
65
- theme
66
- })};
67
- }
68
- &:disabled {
69
- color: ${get('colors.primer.fg.disabled')({
70
- theme
71
- })};
72
- }
73
- `,
74
- primary: `
75
- padding: 5px 16px;
76
- color: ${get('colors.btn.primary.text')({
77
- theme
78
- })};
79
- background-color: ${get('colors.btn.primary.bg')({
80
- theme
81
- })};
82
- border-width: 1px;
83
- border-style: solid;
84
- border-color: ${get('colors.border.subtle')({
85
- theme
86
- })};
87
- box-shadow: ${get('shadows.btn.primary.shadow')({
88
- theme
89
- })};
90
-
91
- &:hover {
92
- color: ${get('colors.btn.primary.hoverText')({
93
- theme
94
- })};
95
- background-color: ${get('colors.btn.primary.hoverBg')({
96
- theme
97
- })};
98
- }
99
- // focus must come before :active so that the active box shadow overrides
100
- &:focus {
101
- box-shadow: ${get('shadows.btn.primary.focusShadow')({
102
- theme
103
- })};
104
- }
105
-
106
- &:active {
107
- background-color: ${get('colors.btn.primary.selectedBg')({
108
- theme
109
- })};
110
- box-shadow: ${get('shadows.btn.primary.selectedShadow')({
111
- theme
112
- })};
113
- }
114
-
115
- &:disabled {
116
- color: ${get('colors.btn.primary.disabledText')({
117
- theme
118
- })};
119
- background-color: ${get('colors.btn.primary.disabledBg')({
120
- theme
121
- })};
122
- }`,
123
- danger: `
124
- padding: 5px 16px;
125
- color: ${get('colors.btn.danger.text')({
126
- theme
127
- })};
128
- border: 1px solid ${get('colors.btn.border')({
129
- theme
130
- })};
131
- background-color: ${get('colors.btn.bg')({
132
- theme
133
- })};
134
- box-shadow: ${get('shadows.btn.shadow')({
135
- theme
136
- })};
137
-
138
- &:hover {
139
- color: ${get('colors.btn.danger.hoverText')({
140
- theme
141
- })};
142
- background-color: ${get('colors.btn.danger.hoverBg')({
143
- theme
144
- })};
145
- border-color: ${get('colors.btn.danger.hoverBorder')({
146
- theme
147
- })};
148
- box-shadow: ${get('shadows.btn.danger.hoverShadow')({
149
- theme
150
- })};
151
- }
152
- // focus must come before :active so that the active box shadow overrides
153
- &:focus {
154
- border-color: ${get('colors.btn.danger.focusBorder')({
155
- theme
156
- })};
157
- box-shadow: ${get('shadows.btn.danger.focusShadow')({
158
- theme
159
- })};
160
- }
161
-
162
- &:active {
163
- color: ${get('colors.btn.danger.selectedText')({
164
- theme
165
- })};
166
- background-color: ${get('colors.btn.danger.selectedBg')({
167
- theme
168
- })};
169
- box-shadow: ${get('shadows.btn.danger.selectedShadow')({
170
- theme
171
- })};
172
- border-color: ${get('colors.btn.danger.selectedBorder')({
173
- theme
174
- })};
175
- }
176
-
177
- &:disabled {
178
- color: ${get('colors.btn.danger.disabledText')({
179
- theme
180
- })};
181
- background-color: ${get('colors.btn.danger.disabledBg')({
182
- theme
183
- })};
184
- border-color: ${get('colors.btn.danger.disabledBorder')({
185
- theme
186
- })};
187
- }
188
- `,
189
- invisible: `
190
- padding: 6px 16px;
191
- color: ${get('colors.accent.fg')({
192
- theme
193
- })};
194
- background-color: transparent;
195
- border: 0;
196
- border-radius: ${get('radii.2')({
197
- theme
198
- })};
199
- box-shadow: none;
200
-
201
- &:disabled {
202
- color: ${get('colors.primer.fg.disabled')({
203
- theme
204
- })};
205
- }
206
- &:focus {
207
- box-shadow: ${get('shadows.btn.focusShadow')({
208
- theme
209
- })};
210
- }
211
- &:hover {
212
- background-color: ${get('colors.btn.hoverBg')({
213
- theme
214
- })};
215
- }
216
- &:active {
217
- background-color: ${get('colors.btn.selectedBg')({
218
- theme
219
- })};
220
- }
221
- `
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
- const Button = /*#__PURE__*/forwardRef(({
231
- icon: Icon,
232
- caret,
233
- children,
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
- "aria-hidden": !iconOnly
253
- }, /*#__PURE__*/React.createElement(Icon, null)), children, caret && /*#__PURE__*/React.createElement(Box, {
254
- sx: {
255
- display: 'inline-block',
256
- pl: 3
257
- },
258
- "aria-hidden": true
259
- }, /*#__PURE__*/React.createElement(TriangleDownIcon, null)));
260
- });
261
- Button.displayName = 'Button';
262
- Button.defaultProps = {
263
- size: 'medium'
264
- };
265
- const NewButton = Object.assign(Button, {
266
- Counter
267
- });
268
- export default NewButton;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare type CounterProps = {
3
- count: number;
4
- };
5
- declare const Counter: ({ count }: CounterProps) => JSX.Element;
6
- export default Counter;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import Box from '../Box';
3
- const styles = {
4
- display: 'inline-block',
5
- padding: '0px 6px',
6
- backgroundColor: 'neutral.muted',
7
- borderRadius: '50%',
8
- marginLeft: '8px'
9
- };
10
-
11
- const Counter = ({
12
- count
13
- }) => {
14
- // get this to announce new count. How? Change aria property for every render? or aria-live?
15
- return /*#__PURE__*/React.createElement(Box, {
16
- sx: styles
17
- }, count);
18
- };
19
-
20
- Counter.displayName = "Counter";
21
- export default Counter;
@@ -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 };