@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
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import { useForceUpdate } from './use-force-update';
3
+ /** createSlots is a factory that can create a
4
+ * typesafe Slots + Slot pair to use in a component definition
5
+ * For example: ActionList.Item uses createSlots to get a Slots wrapper
6
+ * + Slot component that is used by LeadingVisual, Description
7
+ */
8
+
9
+ const createSlots = slotNames => {
10
+ const SlotsContext = /*#__PURE__*/React.createContext({
11
+ registerSlot: () => null,
12
+ unregisterSlot: () => null,
13
+ context: {}
14
+ });
15
+ /** Slots uses a Double render strategy inspired by [reach-ui/descendants](https://github.com/reach/reach-ui/tree/develop/packages/descendants)
16
+ * Slot registers themself with the Slots parent.
17
+ * When all the children have mounted = registered themselves in slot,
18
+ * we re-render the parent component to render with slots
19
+ */
20
+
21
+ const Slots = ({
22
+ context,
23
+ children
24
+ }) => {
25
+ // initialise slots
26
+ const slotsDefinition = {};
27
+ slotNames.map(name => slotsDefinition[name] = null);
28
+ const slotsRef = React.useRef(slotsDefinition);
29
+ const rerenderWithSlots = useForceUpdate();
30
+ const [isMounted, setIsMounted] = React.useState(false); // fires after all the effects in children
31
+
32
+ React.useEffect(() => {
33
+ rerenderWithSlots();
34
+ setIsMounted(true);
35
+ }, [rerenderWithSlots]);
36
+ const registerSlot = React.useCallback((name, contents) => {
37
+ slotsRef.current[name] = contents; // don't render until the component mounts = all slots are registered
38
+
39
+ if (isMounted) rerenderWithSlots();
40
+ }, [isMounted, rerenderWithSlots]); // Slot can be removed from the tree as well,
41
+ // we need to unregister them from the slot
42
+
43
+ const unregisterSlot = React.useCallback(name => {
44
+ slotsRef.current[name] = null;
45
+ rerenderWithSlots();
46
+ }, [rerenderWithSlots]);
47
+ /**
48
+ * Slots uses a render prop API so abstract the
49
+ * implementation detail of using a context provider.
50
+ */
51
+
52
+ const slots = slotsRef.current;
53
+ return /*#__PURE__*/React.createElement(SlotsContext.Provider, {
54
+ value: {
55
+ registerSlot,
56
+ unregisterSlot,
57
+ context
58
+ }
59
+ }, children(slots));
60
+ };
61
+
62
+ const Slot = ({
63
+ name,
64
+ children
65
+ }) => {
66
+ const {
67
+ registerSlot,
68
+ unregisterSlot,
69
+ context
70
+ } = React.useContext(SlotsContext);
71
+ React.useEffect(() => {
72
+ registerSlot(name, typeof children === 'function' ? children(context) : children);
73
+ return () => unregisterSlot(name);
74
+ }, [name, children, registerSlot, unregisterSlot, context]);
75
+ return null;
76
+ };
77
+
78
+ return {
79
+ Slots,
80
+ Slot
81
+ };
82
+ };
83
+
84
+ export default createSlots;
@@ -53,7 +53,7 @@ export declare function render(component: React.ReactElement, theme?: {
53
53
  xlarge: string;
54
54
  };
55
55
  space: string[];
56
- colorSchemes: Record<"dark" | "light" | "light_protanopia" | "dark_dimmed" | "dark_high_contrast" | "dark_protanopia", Record<"colors" | "shadows", Partial<{
56
+ colorSchemes: Record<"light" | "light_protanopia" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_protanopia", Record<"colors" | "shadows", Partial<{
57
57
  canvasDefaultTransparent: string;
58
58
  marketingIcon: {
59
59
  primary: string;
@@ -0,0 +1 @@
1
+ export declare const useForceUpdate: () => () => void;
@@ -0,0 +1,6 @@
1
+ // Inspired from reach-ui: https://github.com/reach/reach-ui/blob/develop/packages/utils/src/use-force-update.ts
2
+ import React from 'react';
3
+ export const useForceUpdate = () => {
4
+ const [, rerender] = React.useState({});
5
+ return React.useCallback(() => rerender({}), []);
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-20219256296",
3
+ "version": "0.0.0-2021926103714",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -1,18 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { IconProps } from '@primer/octicons-react';
3
- import { FontSizeProps } from 'styled-system';
4
- import { SxProp } from '../sx';
5
- declare type Variant = 'default' | 'primary' | 'invisible' | 'block' | 'danger';
6
- export declare type ButtonProps = {
7
- children: ReactNode;
8
- variant: Variant;
9
- size: 'small' | 'medium' | 'large';
10
- icon?: React.FunctionComponent<IconProps>;
11
- } & SxProp & FontSizeProps;
12
- declare const Button: {
13
- ({ children, icon: Icon, ...props }: ButtonProps): JSX.Element;
14
- Visual: ({ children, sx }: {
15
- children: React.ReactNode;
16
- } & SxProp) => JSX.Element;
17
- };
18
- export default Button;
@@ -1,275 +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 _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _styledSystem = require("styled-system");
13
-
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
- var _sx = _interopRequireDefault(require("../sx"));
17
-
18
- var _constants = require("../constants");
19
-
20
- var _ButtonStyles = _interopRequireDefault(require("../Button/ButtonStyles"));
21
-
22
- var _visual = _interopRequireDefault(require("./visual"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- 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); }
27
-
28
- const sizes = (0, _styledSystem.variant)({
29
- prop: 'size',
30
- variants: {
31
- small: {
32
- p: '4px 12px',
33
- fontSize: 0
34
- },
35
- medium: {
36
- fontSize: 1
37
- },
38
- large: {
39
- fontSize: 2,
40
- p: '10px 20px'
41
- }
42
- }
43
- });
44
-
45
- const getVariantStyles = (theme, variant = 'default') => {
46
- const style = {
47
- default: `
48
- padding: 5px 16px;
49
- color: ${(0, _constants.get)('colors.btn.text')({
50
- theme
51
- })};
52
- background-color: ${(0, _constants.get)('colors.btn.bg')({
53
- theme
54
- })};
55
- border-width: 1px;
56
- border-style: solid;
57
- border-color: ${(0, _constants.get)('colors.btn.border')({
58
- theme
59
- })};
60
- box-shadow: ${((0, _constants.get)('shadows.btn.shadow')({
61
- theme
62
- }), (0, _constants.get)('shadows.btn.insetShadow')({
63
- theme
64
- }))};
65
- &:hover {
66
- background-color: ${(0, _constants.get)('colors.btn.hoverBg')({
67
- theme
68
- })};
69
- }
70
- // focus must come before :active so that the active box shadow overrides
71
- &:focus {
72
- box-shadow: ${(0, _constants.get)('shadows.btn.focusShadow')({
73
- theme
74
- })};
75
- }
76
- &:active {
77
- background-color: ${(0, _constants.get)('colors.btn.selectedBg')({
78
- theme
79
- })};
80
- box-shadow: ${(0, _constants.get)('shadows.btn.shadowActive')({
81
- theme
82
- })};
83
- }
84
- &:disabled {
85
- color: ${(0, _constants.get)('colors.primer.fg.disabled')({
86
- theme
87
- })};
88
- }
89
- `,
90
- primary: `
91
- padding: 5px 16px;
92
- color: ${(0, _constants.get)('colors.btn.primary.text')({
93
- theme
94
- })};
95
- background-color: ${(0, _constants.get)('colors.btn.primary.bg')({
96
- theme
97
- })};
98
- border-width: 1px;
99
- border-style: solid;
100
- border-color: ${(0, _constants.get)('colors.border.subtle')({
101
- theme
102
- })};
103
- box-shadow: ${(0, _constants.get)('shadows.btn.primary.shadow')({
104
- theme
105
- })};
106
-
107
- &:hover {
108
- color: ${(0, _constants.get)('colors.btn.primary.hoverText')({
109
- theme
110
- })};
111
- background-color: ${(0, _constants.get)('colors.btn.primary.hoverBg')({
112
- theme
113
- })};
114
- }
115
- // focus must come before :active so that the active box shadow overrides
116
- &:focus {
117
- box-shadow: ${(0, _constants.get)('shadows.btn.primary.focusShadow')({
118
- theme
119
- })};
120
- }
121
-
122
- &:active {
123
- background-color: ${(0, _constants.get)('colors.btn.primary.selectedBg')({
124
- theme
125
- })};
126
- box-shadow: ${(0, _constants.get)('shadows.btn.primary.selectedShadow')({
127
- theme
128
- })};
129
- }
130
-
131
- &:disabled {
132
- color: ${(0, _constants.get)('colors.btn.primary.disabledText')({
133
- theme
134
- })};
135
- background-color: ${(0, _constants.get)('colors.btn.primary.disabledBg')({
136
- theme
137
- })};
138
- }`,
139
- danger: `
140
- padding: 5px 16px;
141
- color: ${(0, _constants.get)('colors.btn.danger.text')({
142
- theme
143
- })};
144
- border: 1px solid ${(0, _constants.get)('colors.btn.border')({
145
- theme
146
- })};
147
- background-color: ${(0, _constants.get)('colors.btn.bg')({
148
- theme
149
- })};
150
- box-shadow: ${(0, _constants.get)('shadows.btn.shadow')({
151
- theme
152
- })};
153
-
154
- &:hover {
155
- color: ${(0, _constants.get)('colors.btn.danger.hoverText')({
156
- theme
157
- })};
158
- background-color: ${(0, _constants.get)('colors.btn.danger.hoverBg')({
159
- theme
160
- })};
161
- border-color: ${(0, _constants.get)('colors.btn.danger.hoverBorder')({
162
- theme
163
- })};
164
- box-shadow: ${(0, _constants.get)('shadows.btn.danger.hoverShadow')({
165
- theme
166
- })};
167
- }
168
- // focus must come before :active so that the active box shadow overrides
169
- &:focus {
170
- border-color: ${(0, _constants.get)('colors.btn.danger.focusBorder')({
171
- theme
172
- })};
173
- box-shadow: ${(0, _constants.get)('shadows.btn.danger.focusShadow')({
174
- theme
175
- })};
176
- }
177
-
178
- &:active {
179
- color: ${(0, _constants.get)('colors.btn.danger.selectedText')({
180
- theme
181
- })};
182
- background-color: ${(0, _constants.get)('colors.btn.danger.selectedBg')({
183
- theme
184
- })};
185
- box-shadow: ${(0, _constants.get)('shadows.btn.danger.selectedShadow')({
186
- theme
187
- })};
188
- border-color: ${(0, _constants.get)('colors.btn.danger.selectedBorder')({
189
- theme
190
- })};
191
- }
192
-
193
- &:disabled {
194
- color: ${(0, _constants.get)('colors.btn.danger.disabledText')({
195
- theme
196
- })};
197
- background-color: ${(0, _constants.get)('colors.btn.danger.disabledBg')({
198
- theme
199
- })};
200
- border-color: ${(0, _constants.get)('colors.btn.danger.disabledBorder')({
201
- theme
202
- })};
203
- }
204
- `,
205
- invisible: `
206
- padding: 6px 16px;
207
- color: ${(0, _constants.get)('colors.accent.fg')({
208
- theme
209
- })};
210
- background-color: transparent;
211
- border: 0;
212
- border-radius: ${(0, _constants.get)('radii.2')({
213
- theme
214
- })};
215
- box-shadow: none;
216
-
217
- &:disabled {
218
- color: ${(0, _constants.get)('colors.primer.fg.disabled')({
219
- theme
220
- })};
221
- }
222
- &:focus {
223
- box-shadow: ${(0, _constants.get)('shadows.btn.focusShadow')({
224
- theme
225
- })};
226
- }
227
- &:hover {
228
- background-color: ${(0, _constants.get)('colors.btn.hoverBg')({
229
- theme
230
- })};
231
- }
232
- &:active {
233
- background-color: ${(0, _constants.get)('colors.btn.selectedBg')({
234
- theme
235
- })};
236
- }
237
- `,
238
- block: ``
239
- };
240
- return style[variant];
241
- };
242
-
243
- const ButtonBase = _styledComponents.default.button.withConfig({
244
- displayName: "button__ButtonBase",
245
- componentId: "sc-15k5iqk-0"
246
- })(["", " ", " ", " ", " ", " ", ""], _ButtonStyles.default, props => getVariantStyles(props.theme, props.variant), sizes, props => props.iconOnly ? `padding: 4px 6px;` : '', _sx.default, _styledSystem.fontSize);
247
-
248
- const Button = ({
249
- children,
250
- icon: Icon,
251
- ...props
252
- }) => {
253
- let iconOnly = false;
254
-
255
- if (!children) {
256
- iconOnly = true;
257
- }
258
-
259
- let iconWrapStyles = {
260
- display: 'inline-block',
261
- ...(!iconOnly ? {
262
- pr: 3
263
- } : {})
264
- };
265
- return /*#__PURE__*/_react.default.createElement(ButtonBase, _extends({}, props, {
266
- iconOnly: iconOnly
267
- }), Icon && /*#__PURE__*/_react.default.createElement(_Box.default, {
268
- sx: iconWrapStyles
269
- }, /*#__PURE__*/_react.default.createElement(Icon, null)), children);
270
- };
271
-
272
- Button.displayName = "Button";
273
- Button.Visual = _visual.default;
274
- var _default = Button;
275
- exports.default = _default;
@@ -1,4 +0,0 @@
1
- export default Button;
2
- export { ButtonProps };
3
- import Button from "./button";
4
- import { ButtonProps } from "./button";
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ButtonProps", {
7
- enumerable: true,
8
- get: function () {
9
- return _button.ButtonProps;
10
- }
11
- });
12
- exports.default = void 0;
13
-
14
- var _button = _interopRequireWildcard(require("./button"));
15
-
16
- 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); }
17
-
18
- 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; }
19
-
20
- var _default = _button.default;
21
- exports.default = _default;
@@ -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,28 +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 _Box = _interopRequireDefault(require("../Box"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const Visual = ({
15
- children,
16
- sx
17
- }) => {
18
- return /*#__PURE__*/_react.default.createElement(_Box.default, {
19
- sx: {
20
- display: 'inline-block',
21
- ...sx
22
- }
23
- }, children);
24
- };
25
-
26
- Visual.displayName = "Visual";
27
- var _default = Visual;
28
- exports.default = _default;
@@ -1,18 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { IconProps } from '@primer/octicons-react';
3
- import { FontSizeProps } from 'styled-system';
4
- import { SxProp } from '../sx';
5
- declare type Variant = 'default' | 'primary' | 'invisible' | 'block' | 'danger';
6
- export declare type ButtonProps = {
7
- children: ReactNode;
8
- variant: Variant;
9
- size: 'small' | 'medium' | 'large';
10
- icon?: React.FunctionComponent<IconProps>;
11
- } & SxProp & FontSizeProps;
12
- declare const Button: {
13
- ({ children, icon: Icon, ...props }: ButtonProps): JSX.Element;
14
- Visual: ({ children, sx }: {
15
- children: React.ReactNode;
16
- } & SxProp) => JSX.Element;
17
- };
18
- export default Button;