@primer/components 31.0.0-rc.f601fc1f → 31.0.2-rc.1e80de40
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.
- package/.github/workflows/check_for_changeset.yml +25 -0
- package/CHANGELOG.md +14 -2
- package/dist/browser.esm.js +40 -37
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +34 -31
- package/dist/browser.umd.js.map +1 -1
- package/docs/content/Autocomplete.mdx +51 -21
- package/lib/ActionList/Item.js +3 -3
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/TextInputWithTokens.js +17 -10
- package/lib/Token/Token.js +13 -2
- package/lib/Token/TokenBase.js +0 -4
- package/lib/Token/_RemoveTokenButton.js +15 -2
- package/lib/_TextInputWrapper.js +1 -1
- package/lib/stories/Autocomplete.stories.js +67 -56
- package/lib/stories/Button.stories.js +12 -1
- package/lib/stories/useAnchoredPosition.stories.js +1 -1
- package/lib-esm/ActionList/Item.js +3 -3
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/Pagination/Pagination.js +1 -1
- package/lib-esm/TextInputWithTokens.js +17 -10
- package/lib-esm/Token/Token.js +13 -2
- package/lib-esm/Token/TokenBase.js +0 -4
- package/lib-esm/Token/_RemoveTokenButton.js +11 -2
- package/lib-esm/_TextInputWrapper.js +1 -1
- package/lib-esm/stories/Autocomplete.stories.js +67 -56
- package/lib-esm/stories/Button.stories.js +8 -0
- package/lib-esm/stories/useAnchoredPosition.stories.js +1 -1
- package/package-lock.json +6090 -7003
- package/package.json +6 -6
- package/src/ActionList/Item.tsx +3 -3
- package/src/Button/Button.tsx +1 -1
- package/src/Button/ButtonTableList.tsx +1 -1
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/TextInputWithTokens.tsx +49 -40
- package/src/Token/Token.tsx +16 -2
- package/src/Token/TokenBase.tsx +0 -5
- package/src/Token/_RemoveTokenButton.tsx +15 -2
- package/src/_TextInputWrapper.tsx +1 -1
- package/src/__tests__/Pagination/__snapshots__/Pagination.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/AnchoredOverlay.test.tsx.snap +3 -3
- package/src/__tests__/__snapshots__/Button.test.tsx.snap +3 -3
- package/src/__tests__/__snapshots__/ConfirmationDialog.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/Dropdown.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/DropdownMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/SelectMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/SelectPanel.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/TextInputWithTokens.test.tsx.snap +3374 -3166
- package/src/__tests__/__snapshots__/Token.test.tsx.snap +31 -24
- package/src/stories/Autocomplete.stories.tsx +142 -59
- package/src/stories/Button.stories.tsx +4 -0
- package/src/stories/useAnchoredPosition.stories.tsx +13 -1
- package/stats.html +1 -1
@@ -12,9 +12,9 @@ The `Autocomplete` components are used to render a text input that allows a user
|
|
12
12
|
|
13
13
|
```jsx live
|
14
14
|
<>
|
15
|
-
<
|
15
|
+
<Text fontWeight="bold" fontSize={1} as="label" display="block" htmlFor="autocompleteInput" id="autocompleteLabel">
|
16
16
|
Pick a branch
|
17
|
-
</
|
17
|
+
</Text>
|
18
18
|
<Autocomplete>
|
19
19
|
<Autocomplete.Input id="autocompleteInput-basic" />
|
20
20
|
<Autocomplete.Overlay>
|
@@ -85,9 +85,16 @@ const CustomTextInputExample = () => {
|
|
85
85
|
|
86
86
|
return (
|
87
87
|
<>
|
88
|
-
<
|
88
|
+
<Text
|
89
|
+
fontWeight="bold"
|
90
|
+
fontSize={1}
|
91
|
+
as="label"
|
92
|
+
display="block"
|
93
|
+
htmlFor="autocompleteInput-customInput"
|
94
|
+
id="autocompleteLabel-customInput"
|
95
|
+
>
|
89
96
|
Pick options
|
90
|
-
</
|
97
|
+
</Text>
|
91
98
|
<Autocomplete>
|
92
99
|
<Autocomplete.Input
|
93
100
|
as={TextInputWithTokens}
|
@@ -134,9 +141,16 @@ Most `Autocomplete` implementations will use the `Autocomplete.Overlay` componen
|
|
134
141
|
|
135
142
|
```jsx live
|
136
143
|
<>
|
137
|
-
<
|
144
|
+
<Text
|
145
|
+
fontWeight="bold"
|
146
|
+
fontSize={1}
|
147
|
+
as="label"
|
148
|
+
display="block"
|
149
|
+
htmlFor="autocompleteInput-withoutOverlay"
|
150
|
+
id="autocompleteLabel-withoutOverlay"
|
151
|
+
>
|
138
152
|
Pick a branch
|
139
|
-
</
|
153
|
+
</Text>
|
140
154
|
<Autocomplete>
|
141
155
|
<Autocomplete.Input id="autocompleteInput-withoutOverlay" />
|
142
156
|
<Autocomplete.Menu
|
@@ -227,21 +241,23 @@ const CustomRenderedItemExample = () => {
|
|
227
241
|
|
228
242
|
return (
|
229
243
|
<>
|
230
|
-
<
|
244
|
+
<Text
|
245
|
+
fontWeight="bold"
|
246
|
+
fontSize={1}
|
231
247
|
as="label"
|
232
248
|
display="block"
|
233
|
-
htmlFor="autocompleteInput-
|
234
|
-
id="autocompleteLabel-
|
249
|
+
htmlFor="autocompleteInput-issueLabels"
|
250
|
+
id="autocompleteLabel-issueLabels"
|
235
251
|
>
|
236
|
-
|
237
|
-
</
|
252
|
+
Pick labels
|
253
|
+
</Text>
|
238
254
|
<Autocomplete>
|
239
255
|
<Autocomplete.Input
|
240
256
|
as={TextInputWithTokens}
|
241
257
|
tokens={tokens}
|
242
258
|
tokenComponent={IssueLabelToken}
|
243
259
|
onTokenRemove={onTokenRemove}
|
244
|
-
id="autocompleteInput-
|
260
|
+
id="autocompleteInput-issueLabels"
|
245
261
|
/>
|
246
262
|
<Autocomplete.Overlay>
|
247
263
|
<Autocomplete.Menu
|
@@ -262,7 +278,7 @@ const CustomRenderedItemExample = () => {
|
|
262
278
|
selectedItemIds={selectedItemIds}
|
263
279
|
onSelectedChange={onSelectedChange}
|
264
280
|
selectionVariant="multiple"
|
265
|
-
aria-labelledby="autocompleteLabel-
|
281
|
+
aria-labelledby="autocompleteLabel-issueLabels"
|
266
282
|
/>
|
267
283
|
</Autocomplete.Overlay>
|
268
284
|
</Autocomplete>
|
@@ -297,11 +313,18 @@ const CustomSortAfterMenuClose = () => {
|
|
297
313
|
|
298
314
|
return (
|
299
315
|
<>
|
300
|
-
<
|
316
|
+
<Text
|
317
|
+
fontWeight="bold"
|
318
|
+
fontSize={1}
|
319
|
+
as="label"
|
320
|
+
display="block"
|
321
|
+
htmlFor="autocompleteInput-sortAfterClose"
|
322
|
+
id="autocompleteLabel-sortAfterClose"
|
323
|
+
>
|
301
324
|
Pick branches
|
302
|
-
</
|
325
|
+
</Text>
|
303
326
|
<Autocomplete>
|
304
|
-
<Autocomplete.Input id="autocompleteInput" />
|
327
|
+
<Autocomplete.Input id="autocompleteInput-sortAfterClose" />
|
305
328
|
<Autocomplete.Overlay>
|
306
329
|
<Autocomplete.Menu
|
307
330
|
items={[
|
@@ -315,7 +338,7 @@ const CustomSortAfterMenuClose = () => {
|
|
315
338
|
{text: 'visual-design-tweaks', id: 7}
|
316
339
|
]}
|
317
340
|
selectedItemIds={selectedItemIds}
|
318
|
-
aria-labelledby="autocompleteLabel"
|
341
|
+
aria-labelledby="autocompleteLabel-sortAfterClose"
|
319
342
|
onSelectedChange={onSelectedChange}
|
320
343
|
sortOnCloseFn={customSortFn}
|
321
344
|
selectionVariant="multiple"
|
@@ -347,11 +370,18 @@ const CustomSearchFilter = () => {
|
|
347
370
|
|
348
371
|
return (
|
349
372
|
<>
|
350
|
-
<
|
373
|
+
<Text
|
374
|
+
fontWeight="bold"
|
375
|
+
fontSize={1}
|
376
|
+
as="label"
|
377
|
+
display="block"
|
378
|
+
htmlFor="autocompleteInput-customFilter"
|
379
|
+
id="autocompleteLabel-customFilter"
|
380
|
+
>
|
351
381
|
Pick a branch
|
352
|
-
</
|
382
|
+
</Text>
|
353
383
|
<Autocomplete>
|
354
|
-
<Autocomplete.Input id="autocompleteInput" onChange={handleChange} />
|
384
|
+
<Autocomplete.Input id="autocompleteInput-customFilter" onChange={handleChange} />
|
355
385
|
<Autocomplete.Overlay>
|
356
386
|
<Autocomplete.Menu
|
357
387
|
items={[
|
@@ -365,7 +395,7 @@ const CustomSearchFilter = () => {
|
|
365
395
|
{text: 'visual-design-tweaks', id: 7}
|
366
396
|
]}
|
367
397
|
selectedItemIds={[]}
|
368
|
-
aria-labelledby="autocompleteLabel"
|
398
|
+
aria-labelledby="autocompleteLabel-customFilter"
|
369
399
|
filterFn={customFilterFn}
|
370
400
|
/>
|
371
401
|
</Autocomplete.Overlay>
|
package/lib/ActionList/Item.js
CHANGED
@@ -71,9 +71,9 @@ const customItemThemes = {
|
|
71
71
|
const getItemVariant = (variant = 'default', disabled) => {
|
72
72
|
if (disabled) {
|
73
73
|
return {
|
74
|
-
color: (0, _constants.get)('colors.fg.
|
75
|
-
iconColor: (0, _constants.get)('colors.fg.
|
76
|
-
annotationColor: (0, _constants.get)('colors.fg.
|
74
|
+
color: (0, _constants.get)('colors.primer.fg.disabled'),
|
75
|
+
iconColor: (0, _constants.get)('colors.primer.fg.disabled'),
|
76
|
+
annotationColor: (0, _constants.get)('colors.primer.fg.disabled'),
|
77
77
|
hoverCursor: 'default'
|
78
78
|
};
|
79
79
|
}
|
package/lib/Button/Button.js
CHANGED
@@ -22,6 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
22
22
|
const Button = (0, _styledComponents.default)(_ButtonBase.default).withConfig({
|
23
23
|
displayName: "Button",
|
24
24
|
componentId: "xjtz72-0"
|
25
|
-
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], (0, _constants.get)('colors.btn.text'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), (0, _constants.get)('shadows.btn.shadow'), (0, _constants.get)('shadows.btn.insetShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.hoverBorder'), (0, _constants.get)('colors.btn.focusBorder'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.selectedBg'), (0, _constants.get)('shadows.btn.shadowActive'), (0, _constants.get)('colors.fg.
|
25
|
+
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], (0, _constants.get)('colors.btn.text'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), (0, _constants.get)('shadows.btn.shadow'), (0, _constants.get)('shadows.btn.insetShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.hoverBorder'), (0, _constants.get)('colors.btn.focusBorder'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.selectedBg'), (0, _constants.get)('shadows.btn.shadowActive'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), _ButtonBase.buttonSystemProps, _sx.default);
|
26
26
|
var _default = Button;
|
27
27
|
exports.default = _default;
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
16
16
|
const ButtonTableList = _styledComponents.default.summary.withConfig({
|
17
17
|
displayName: "ButtonTableList",
|
18
18
|
componentId: "sc-1m4q8ia-0"
|
19
|
-
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:
|
19
|
+
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:", ";cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('space.1'), _constants.COMMON, _constants.TYPOGRAPHY, _constants.LAYOUT, _sx.default);
|
20
20
|
|
21
21
|
var _default = ButtonTableList;
|
22
22
|
exports.default = _default;
|
@@ -24,7 +24,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
24
24
|
const Page = _styledComponents.default.a.withConfig({
|
25
25
|
displayName: "Pagination__Page",
|
26
26
|
componentId: "b80nss-0"
|
27
|
-
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], (0, _constants.get)('colors.fg.default'), (0, _constants.get)('space.1'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('colors.fg.
|
27
|
+
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], (0, _constants.get)('colors.fg.default'), (0, _constants.get)('space.1'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('space.1'), (0, _constants.get)('space.1'), _constants.COMMON);
|
28
28
|
|
29
29
|
function usePaginationPages({
|
30
30
|
theme,
|
@@ -175,15 +175,7 @@ function TextInputWithTokensInnerComponent({
|
|
175
175
|
minWidth: minWidthProp,
|
176
176
|
maxWidth: maxWidthProp,
|
177
177
|
variant: variantProp,
|
178
|
-
|
179
|
-
sx: {
|
180
|
-
alignItems: 'center',
|
181
|
-
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
182
|
-
gap: '0.25rem',
|
183
|
-
'> *': {
|
184
|
-
flexShrink: 0
|
185
|
-
},
|
186
|
-
...(block ? {
|
178
|
+
sx: { ...(block ? {
|
187
179
|
display: 'flex',
|
188
180
|
width: '100%'
|
189
181
|
} : {}),
|
@@ -196,6 +188,21 @@ function TextInputWithTokensInnerComponent({
|
|
196
188
|
} : {}),
|
197
189
|
...sxProp
|
198
190
|
}
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
192
|
+
ref: containerRef,
|
193
|
+
display: "flex",
|
194
|
+
sx: {
|
195
|
+
alignItems: 'center',
|
196
|
+
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
197
|
+
marginLeft: '-0.25rem',
|
198
|
+
marginBottom: '-0.25rem',
|
199
|
+
flexGrow: 1,
|
200
|
+
'> *': {
|
201
|
+
flexShrink: 0,
|
202
|
+
marginLeft: '0.25rem',
|
203
|
+
marginBottom: '0.25rem'
|
204
|
+
}
|
205
|
+
}
|
199
206
|
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
200
207
|
sx: {
|
201
208
|
order: 1,
|
@@ -227,7 +234,7 @@ function TextInputWithTokensInnerComponent({
|
|
227
234
|
hideRemoveButton: hideTokenRemoveButtons,
|
228
235
|
size: size,
|
229
236
|
tabIndex: 0
|
230
|
-
}, tokenRest))) : null);
|
237
|
+
}, tokenRest))) : null));
|
231
238
|
}
|
232
239
|
|
233
240
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|
package/lib/Token/Token.js
CHANGED
@@ -39,7 +39,16 @@ const DefaultTokenStyled = (0, _styledComponents.default)(_TokenBase.default).wi
|
|
39
39
|
const LeadingVisualContainer = (0, _styledComponents.default)('span').withConfig({
|
40
40
|
displayName: "Token__LeadingVisualContainer",
|
41
41
|
componentId: "sc-1dg52pw-1"
|
42
|
-
})(["flex-shrink:0;line-height:0;"]
|
42
|
+
})(["flex-shrink:0;line-height:0;", ""], props => {
|
43
|
+
switch (props.size) {
|
44
|
+
case 'large':
|
45
|
+
case 'extralarge':
|
46
|
+
return (0, _styledComponents.css)(["margin-right:", ";"], (0, _constants.get)('space.2'));
|
47
|
+
|
48
|
+
default:
|
49
|
+
return (0, _styledComponents.css)(["margin-right:", ";"], (0, _constants.get)('space.1'));
|
50
|
+
}
|
51
|
+
});
|
43
52
|
const Token = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
44
53
|
const {
|
45
54
|
as,
|
@@ -74,7 +83,9 @@ const Token = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
|
74
83
|
isTokenInteractive: (0, _TokenBase.isTokenInteractive)(props)
|
75
84
|
}, !hasMultipleActionTargets ? interactiveTokenProps : {}, rest, {
|
76
85
|
ref: forwardedRef
|
77
|
-
}), LeadingVisual ? /*#__PURE__*/_react.default.createElement(LeadingVisualContainer,
|
86
|
+
}), LeadingVisual ? /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, {
|
87
|
+
size: size
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(LeadingVisual, null)) : null, /*#__PURE__*/_react.default.createElement(_TokenTextContainer.default, hasMultipleActionTargets ? interactiveTokenProps : {}, text), !hideRemoveButton && onRemove ? /*#__PURE__*/_react.default.createElement(_RemoveTokenButton.default, {
|
78
89
|
borderOffset: tokenBorderWidthPx,
|
79
90
|
onClick: onRemoveClick,
|
80
91
|
size: size,
|
package/lib/Token/TokenBase.js
CHANGED
@@ -38,7 +38,6 @@ const variants = (0, _styledSystem.variant)({
|
|
38
38
|
variants: {
|
39
39
|
small: {
|
40
40
|
fontSize: 0,
|
41
|
-
gap: 1,
|
42
41
|
height: tokenSizes.small,
|
43
42
|
// without setting lineHeight to match height, the "x" appears vertically mis-aligned
|
44
43
|
lineHeight: tokenSizes.small,
|
@@ -51,7 +50,6 @@ const variants = (0, _styledSystem.variant)({
|
|
51
50
|
},
|
52
51
|
medium: {
|
53
52
|
fontSize: 0,
|
54
|
-
gap: 1,
|
55
53
|
height: tokenSizes.medium,
|
56
54
|
lineHeight: tokenSizes.medium,
|
57
55
|
paddingLeft: 2,
|
@@ -61,7 +59,6 @@ const variants = (0, _styledSystem.variant)({
|
|
61
59
|
},
|
62
60
|
large: {
|
63
61
|
fontSize: 0,
|
64
|
-
gap: 2,
|
65
62
|
height: tokenSizes.large,
|
66
63
|
lineHeight: tokenSizes.large,
|
67
64
|
paddingLeft: 2,
|
@@ -71,7 +68,6 @@ const variants = (0, _styledSystem.variant)({
|
|
71
68
|
},
|
72
69
|
extralarge: {
|
73
70
|
fontSize: 1,
|
74
|
-
gap: 2,
|
75
71
|
height: tokenSizes.extralarge,
|
76
72
|
lineHeight: tokenSizes.extralarge,
|
77
73
|
paddingLeft: 3,
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
10
10
|
var _octiconsReact = require("@primer/octicons-react");
|
11
11
|
|
12
|
-
var _styledComponents =
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
13
13
|
|
14
14
|
var _styledSystem = require("styled-system");
|
15
15
|
|
@@ -19,6 +19,10 @@ var _sx = _interopRequireDefault(require("../sx"));
|
|
19
19
|
|
20
20
|
var _TokenBase = require("./TokenBase");
|
21
21
|
|
22
|
+
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); }
|
23
|
+
|
24
|
+
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; }
|
25
|
+
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
27
|
|
24
28
|
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); }
|
@@ -50,7 +54,16 @@ const getTokenButtonIconSize = size => parseInt(_TokenBase.tokenSizes[size || _T
|
|
50
54
|
const StyledTokenButton = _styledComponents.default.span.withConfig({
|
51
55
|
displayName: "_RemoveTokenButton__StyledTokenButton",
|
52
56
|
componentId: "sc-14lvcw1-0"
|
53
|
-
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px
|
57
|
+
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px;", " &:hover,&:focus{background-color:", ";}&:active{background-color:", ";}", " ", ""], props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`, props => {
|
58
|
+
switch (props.size) {
|
59
|
+
case 'large':
|
60
|
+
case 'extralarge':
|
61
|
+
return (0, _styledComponents.css)(["margin-left:", ";"], (0, _constants.get)('space.2'));
|
62
|
+
|
63
|
+
default:
|
64
|
+
return (0, _styledComponents.css)(["margin-left:", ";"], (0, _constants.get)('space.1'));
|
65
|
+
}
|
66
|
+
}, (0, _constants.get)('colors.neutral.muted'), (0, _constants.get)('colors.neutral.subtle'), variants, _sx.default);
|
54
67
|
|
55
68
|
const RemoveTokenButton = ({
|
56
69
|
'aria-label': ariaLabel,
|
package/lib/_TextInputWrapper.js
CHANGED
@@ -45,7 +45,7 @@ const TextInputWrapper = _styledComponents.default.span.withConfig({
|
|
45
45
|
} else {
|
46
46
|
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
47
47
|
}
|
48
|
-
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.fg.
|
48
|
+
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('colors.input.disabledBg'), (0, _constants.get)('colors.border.default')), props => props.block && (0, _styledComponents.css)(["display:block;width:100%;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeVariants, _sx.default);
|
49
49
|
|
50
50
|
var _default = TextInputWrapper;
|
51
51
|
exports.default = _default;
|