@primer/components 0.0.0-202191914226 → 0.0.0-2021919184749
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/CHANGELOG.md +3 -1
- package/dist/browser.esm.js +605 -604
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +179 -178
- package/dist/browser.umd.js.map +1 -1
- 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.d.ts +4 -0
- package/lib/TextInputWithTokens.js +61 -8
- package/lib/_TextInputWrapper.js +2 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -8
- 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.d.ts +4 -0
- package/lib-esm/TextInputWithTokens.js +61 -9
- package/lib-esm/_TextInputWrapper.js +2 -2
- package/lib-esm/index.d.ts +0 -1
- package/lib-esm/index.js +0 -1
- package/package.json +1 -1
- package/lib/ActionList2/Description.d.ts +0 -5
- package/lib/ActionList2/Description.js +0 -45
- package/lib/ActionList2/Divider.d.ts +0 -8
- package/lib/ActionList2/Divider.js +0 -42
- package/lib/ActionList2/Group.d.ts +0 -8
- package/lib/ActionList2/Group.js +0 -39
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -52
- package/lib/ActionList2/Item.js +0 -171
- package/lib/ActionList2/List.d.ts +0 -18
- package/lib/ActionList2/List.js +0 -52
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -67
- package/lib/ActionList2/Visuals.d.ts +0 -12
- package/lib/ActionList2/Visuals.js +0 -87
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -26
- package/lib/ActionList2/index.js +0 -36
- package/lib/utils/create-slots.d.ts +0 -15
- package/lib/utils/create-slots.js +0 -101
- package/lib/utils/use-force-update.d.ts +0 -1
- package/lib/utils/use-force-update.js +0 -19
- package/lib-esm/ActionList2/Description.d.ts +0 -5
- package/lib-esm/ActionList2/Description.js +0 -30
- package/lib-esm/ActionList2/Divider.d.ts +0 -8
- package/lib-esm/ActionList2/Divider.js +0 -30
- package/lib-esm/ActionList2/Group.d.ts +0 -8
- package/lib-esm/ActionList2/Group.js +0 -29
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -52
- package/lib-esm/ActionList2/Item.js +0 -172
- package/lib-esm/ActionList2/List.d.ts +0 -18
- package/lib-esm/ActionList2/List.js +0 -42
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -50
- package/lib-esm/ActionList2/Visuals.d.ts +0 -12
- package/lib-esm/ActionList2/Visuals.js +0 -66
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -26
- package/lib-esm/ActionList2/index.js +0 -23
- package/lib-esm/utils/create-slots.d.ts +0 -15
- package/lib-esm/utils/create-slots.js +0 -80
- package/lib-esm/utils/use-force-update.d.ts +0 -1
- package/lib-esm/utils/use-force-update.js +0 -6
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,
|
@@ -32,6 +32,10 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
32
32
|
* Whether the remove buttons should be rendered in the tokens
|
33
33
|
*/
|
34
34
|
hideTokenRemoveButtons?: boolean | undefined;
|
35
|
+
/**
|
36
|
+
* The number of tokens to display before truncating
|
37
|
+
*/
|
38
|
+
visibleTokenCount?: number | undefined;
|
35
39
|
} & Pick<Omit<Pick<{
|
36
40
|
[x: string]: any;
|
37
41
|
[x: number]: any;
|
@@ -25,6 +25,8 @@ var _TextInputWrapper = _interopRequireDefault(require("./_TextInputWrapper"));
|
|
25
25
|
|
26
26
|
var _Box = _interopRequireDefault(require("./Box"));
|
27
27
|
|
28
|
+
var _Text = _interopRequireDefault(require("./Text"));
|
29
|
+
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
31
|
|
30
32
|
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); }
|
@@ -33,7 +35,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
33
35
|
|
34
36
|
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); }
|
35
37
|
|
36
|
-
|
38
|
+
const overflowCountFontSizeMap = {
|
39
|
+
small: 0,
|
40
|
+
medium: 1,
|
41
|
+
large: 1,
|
42
|
+
extralarge: 2
|
43
|
+
}; // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
44
|
+
|
37
45
|
function TextInputWithTokensInnerComponent({
|
38
46
|
icon: IconComponent,
|
39
47
|
contrast,
|
@@ -53,9 +61,11 @@ function TextInputWithTokensInnerComponent({
|
|
53
61
|
minWidth: minWidthProp,
|
54
62
|
maxWidth: maxWidthProp,
|
55
63
|
variant: variantProp,
|
64
|
+
visibleTokenCount,
|
56
65
|
...rest
|
57
66
|
}, externalRef) {
|
58
67
|
const {
|
68
|
+
onBlur,
|
59
69
|
onFocus,
|
60
70
|
onKeyDown,
|
61
71
|
...inputPropsRest
|
@@ -64,6 +74,7 @@ function TextInputWithTokensInnerComponent({
|
|
64
74
|
const localInputRef = (0, _react.useRef)(null);
|
65
75
|
const combinedInputRef = (0, _useCombinedRefs.useCombinedRefs)(localInputRef, ref);
|
66
76
|
const [selectedTokenIndex, setSelectedTokenIndex] = (0, _react.useState)();
|
77
|
+
const [tokensAreTruncated, setTokensAreTruncated] = (0, _react.useState)(Boolean(visibleTokenCount));
|
67
78
|
const {
|
68
79
|
containerRef
|
69
80
|
} = (0, _useFocusZone.useFocusZone)({
|
@@ -113,20 +124,45 @@ function TextInputWithTokensInnerComponent({
|
|
113
124
|
};
|
114
125
|
|
115
126
|
const handleTokenBlur = () => {
|
116
|
-
setSelectedTokenIndex(undefined);
|
127
|
+
setSelectedTokenIndex(undefined); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
128
|
+
// this prevents the tokens from hiding when the user is moving focus between tokens,
|
129
|
+
// but still hides the tokens when the user blurs the token by tabbing out or clicking somewhere else on the page
|
130
|
+
|
131
|
+
setTimeout(() => {
|
132
|
+
var _containerRef$current3;
|
133
|
+
|
134
|
+
if (!((_containerRef$current3 = containerRef.current) !== null && _containerRef$current3 !== void 0 && _containerRef$current3.contains(document.activeElement))) {
|
135
|
+
setTokensAreTruncated(true);
|
136
|
+
}
|
137
|
+
}, 0);
|
117
138
|
};
|
118
139
|
|
119
|
-
const handleTokenKeyUp =
|
120
|
-
if (
|
140
|
+
const handleTokenKeyUp = event => {
|
141
|
+
if (event.key === 'Escape') {
|
121
142
|
var _ref$current;
|
122
143
|
|
123
144
|
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
124
145
|
}
|
125
146
|
};
|
126
147
|
|
127
|
-
const handleInputFocus =
|
128
|
-
onFocus && onFocus(
|
148
|
+
const handleInputFocus = event => {
|
149
|
+
onFocus && onFocus(event);
|
129
150
|
setSelectedTokenIndex(undefined);
|
151
|
+
setTokensAreTruncated(false);
|
152
|
+
};
|
153
|
+
|
154
|
+
const handleInputBlur = event => {
|
155
|
+
onBlur && onBlur(event); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
156
|
+
// this prevents the tokens from hiding when the user is moving focus from the input to a token,
|
157
|
+
// but still hides the tokens when the user blurs the input by tabbing out or clicking somewhere else on the page
|
158
|
+
|
159
|
+
setTimeout(() => {
|
160
|
+
var _containerRef$current4;
|
161
|
+
|
162
|
+
if (!((_containerRef$current4 = containerRef.current) !== null && _containerRef$current4 !== void 0 && _containerRef$current4.contains(document.activeElement))) {
|
163
|
+
setTokensAreTruncated(true);
|
164
|
+
}
|
165
|
+
}, 0);
|
130
166
|
};
|
131
167
|
|
132
168
|
const handleInputKeyDown = e => {
|
@@ -164,6 +200,17 @@ function TextInputWithTokensInnerComponent({
|
|
164
200
|
}
|
165
201
|
};
|
166
202
|
|
203
|
+
const focusInput = () => {
|
204
|
+
var _combinedInputRef$cur;
|
205
|
+
|
206
|
+
(_combinedInputRef$cur = combinedInputRef.current) === null || _combinedInputRef$cur === void 0 ? void 0 : _combinedInputRef$cur.focus();
|
207
|
+
};
|
208
|
+
|
209
|
+
const preventTokenClickPropagation = event => {
|
210
|
+
event.stopPropagation();
|
211
|
+
};
|
212
|
+
|
213
|
+
const visibleTokens = tokensAreTruncated ? tokens.slice(0, visibleTokenCount) : tokens;
|
167
214
|
return /*#__PURE__*/_react.default.createElement(_TextInputWrapper.default, {
|
168
215
|
block: block,
|
169
216
|
className: className,
|
@@ -176,6 +223,7 @@ function TextInputWithTokensInnerComponent({
|
|
176
223
|
maxWidth: maxWidthProp,
|
177
224
|
variant: variantProp,
|
178
225
|
ref: containerRef,
|
226
|
+
onClick: focusInput,
|
179
227
|
sx: {
|
180
228
|
alignItems: 'center',
|
181
229
|
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
@@ -207,12 +255,13 @@ function TextInputWithTokensInnerComponent({
|
|
207
255
|
ref: combinedInputRef,
|
208
256
|
disabled: disabled,
|
209
257
|
onFocus: handleInputFocus,
|
258
|
+
onBlur: handleInputBlur,
|
210
259
|
onKeyDown: handleInputKeyDown,
|
211
260
|
type: "text",
|
212
261
|
sx: {
|
213
262
|
height: '100%'
|
214
263
|
}
|
215
|
-
}, inputPropsRest))),
|
264
|
+
}, inputPropsRest))), TokenComponent ? visibleTokens.map(({
|
216
265
|
id,
|
217
266
|
...tokenRest
|
218
267
|
}, i) => /*#__PURE__*/_react.default.createElement(TokenComponent, _extends({
|
@@ -220,6 +269,7 @@ function TextInputWithTokensInnerComponent({
|
|
220
269
|
onFocus: handleTokenFocus(i),
|
221
270
|
onBlur: handleTokenBlur,
|
222
271
|
onKeyUp: handleTokenKeyUp,
|
272
|
+
onClick: preventTokenClickPropagation,
|
223
273
|
isSelected: selectedTokenIndex === i,
|
224
274
|
onRemove: () => {
|
225
275
|
handleTokenRemove(id);
|
@@ -227,7 +277,10 @@ function TextInputWithTokensInnerComponent({
|
|
227
277
|
hideRemoveButton: hideTokenRemoveButtons,
|
228
278
|
size: size,
|
229
279
|
tabIndex: 0
|
230
|
-
}, tokenRest))) : null
|
280
|
+
}, tokenRest))) : null, tokensAreTruncated ? /*#__PURE__*/_react.default.createElement(_Text.default, {
|
281
|
+
color: "fg.muted",
|
282
|
+
fontSize: size && overflowCountFontSizeMap[size]
|
283
|
+
}, "+", tokens.length - visibleTokens.length) : null);
|
231
284
|
}
|
232
285
|
|
233
286
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|
package/lib/_TextInputWrapper.js
CHANGED
@@ -39,13 +39,13 @@ const sizeVariants = (0, _styledSystem.variant)({
|
|
39
39
|
const TextInputWrapper = _styledComponents.default.span.withConfig({
|
40
40
|
displayName: "_TextInputWrapper__TextInputWrapper",
|
41
41
|
componentId: "sc-5vfcis-0"
|
42
|
-
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.2'), (0, _constants.get)('shadows.primer.shadow.inset'), props => {
|
42
|
+
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";cursor:text;", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.2'), (0, _constants.get)('shadows.primer.shadow.inset'), props => {
|
43
43
|
if (props.hasIcon) {
|
44
44
|
return (0, _styledComponents.css)(["padding:0;"]);
|
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;
|
package/lib/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib/index.js
CHANGED
@@ -147,12 +147,6 @@ Object.defineProperty(exports, "ActionList", {
|
|
147
147
|
return _ActionList.ActionList;
|
148
148
|
}
|
149
149
|
});
|
150
|
-
Object.defineProperty(exports, "ActionList2", {
|
151
|
-
enumerable: true,
|
152
|
-
get: function () {
|
153
|
-
return _ActionList2.ActionList;
|
154
|
-
}
|
155
|
-
});
|
156
150
|
Object.defineProperty(exports, "ActionMenu", {
|
157
151
|
enumerable: true,
|
158
152
|
get: function () {
|
@@ -542,8 +536,6 @@ var _ConfirmationDialog = require("./Dialog/ConfirmationDialog");
|
|
542
536
|
|
543
537
|
var _ActionList = require("./ActionList");
|
544
538
|
|
545
|
-
var _ActionList2 = require("./ActionList2");
|
546
|
-
|
547
539
|
var _ActionMenu = require("./ActionMenu");
|
548
540
|
|
549
541
|
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
@@ -48,9 +48,9 @@ const customItemThemes = {
|
|
48
48
|
const getItemVariant = (variant = 'default', disabled) => {
|
49
49
|
if (disabled) {
|
50
50
|
return {
|
51
|
-
color: get('colors.fg.
|
52
|
-
iconColor: get('colors.fg.
|
53
|
-
annotationColor: get('colors.fg.
|
51
|
+
color: get('colors.primer.fg.disabled'),
|
52
|
+
iconColor: get('colors.primer.fg.disabled'),
|
53
|
+
annotationColor: get('colors.primer.fg.disabled'),
|
54
54
|
hoverCursor: 'default'
|
55
55
|
};
|
56
56
|
}
|
package/lib-esm/Button/Button.js
CHANGED
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
7
|
componentId: "xjtz72-0"
|
8
|
-
})(["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:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.fg.
|
8
|
+
})(["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:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
|
9
9
|
export default Button;
|
@@ -4,5 +4,5 @@ import sx from '../sx';
|
|
4
4
|
const ButtonTableList = styled.summary.withConfig({
|
5
5
|
displayName: "ButtonTableList",
|
6
6
|
componentId: "sc-1m4q8ia-0"
|
7
|
-
})(["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:
|
7
|
+
})(["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;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.muted'), get('colors.primer.fg.disabled'), get('space.1'), COMMON, TYPOGRAPHY, LAYOUT, sx);
|
8
8
|
export default ButtonTableList;
|
@@ -9,7 +9,7 @@ import { buildComponentData, buildPaginationModel } from './model';
|
|
9
9
|
const Page = styled.a.withConfig({
|
10
10
|
displayName: "Pagination__Page",
|
11
11
|
componentId: "b80nss-0"
|
12
|
-
})(["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 );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.fg.
|
12
|
+
})(["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 );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'), COMMON);
|
13
13
|
|
14
14
|
function usePaginationPages({
|
15
15
|
theme,
|
@@ -32,6 +32,10 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
32
32
|
* Whether the remove buttons should be rendered in the tokens
|
33
33
|
*/
|
34
34
|
hideTokenRemoveButtons?: boolean | undefined;
|
35
|
+
/**
|
36
|
+
* The number of tokens to display before truncating
|
37
|
+
*/
|
38
|
+
visibleTokenCount?: number | undefined;
|
35
39
|
} & Pick<Omit<Pick<{
|
36
40
|
[x: string]: any;
|
37
41
|
[x: number]: any;
|
@@ -9,9 +9,16 @@ import Token from './Token/Token';
|
|
9
9
|
import { useProvidedRefOrCreate } from './hooks';
|
10
10
|
import UnstyledTextInput from './_UnstyledTextInput';
|
11
11
|
import TextInputWrapper from './_TextInputWrapper';
|
12
|
-
import Box from './Box';
|
12
|
+
import Box from './Box';
|
13
|
+
import Text from './Text'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14
|
+
|
15
|
+
const overflowCountFontSizeMap = {
|
16
|
+
small: 0,
|
17
|
+
medium: 1,
|
18
|
+
large: 1,
|
19
|
+
extralarge: 2
|
20
|
+
}; // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
13
21
|
|
14
|
-
// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
15
22
|
function TextInputWithTokensInnerComponent({
|
16
23
|
icon: IconComponent,
|
17
24
|
contrast,
|
@@ -31,9 +38,11 @@ function TextInputWithTokensInnerComponent({
|
|
31
38
|
minWidth: minWidthProp,
|
32
39
|
maxWidth: maxWidthProp,
|
33
40
|
variant: variantProp,
|
41
|
+
visibleTokenCount,
|
34
42
|
...rest
|
35
43
|
}, externalRef) {
|
36
44
|
const {
|
45
|
+
onBlur,
|
37
46
|
onFocus,
|
38
47
|
onKeyDown,
|
39
48
|
...inputPropsRest
|
@@ -42,6 +51,7 @@ function TextInputWithTokensInnerComponent({
|
|
42
51
|
const localInputRef = useRef(null);
|
43
52
|
const combinedInputRef = useCombinedRefs(localInputRef, ref);
|
44
53
|
const [selectedTokenIndex, setSelectedTokenIndex] = useState();
|
54
|
+
const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
|
45
55
|
const {
|
46
56
|
containerRef
|
47
57
|
} = useFocusZone({
|
@@ -91,20 +101,45 @@ function TextInputWithTokensInnerComponent({
|
|
91
101
|
};
|
92
102
|
|
93
103
|
const handleTokenBlur = () => {
|
94
|
-
setSelectedTokenIndex(undefined);
|
104
|
+
setSelectedTokenIndex(undefined); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
105
|
+
// this prevents the tokens from hiding when the user is moving focus between tokens,
|
106
|
+
// but still hides the tokens when the user blurs the token by tabbing out or clicking somewhere else on the page
|
107
|
+
|
108
|
+
setTimeout(() => {
|
109
|
+
var _containerRef$current3;
|
110
|
+
|
111
|
+
if (!((_containerRef$current3 = containerRef.current) !== null && _containerRef$current3 !== void 0 && _containerRef$current3.contains(document.activeElement))) {
|
112
|
+
setTokensAreTruncated(true);
|
113
|
+
}
|
114
|
+
}, 0);
|
95
115
|
};
|
96
116
|
|
97
|
-
const handleTokenKeyUp =
|
98
|
-
if (
|
117
|
+
const handleTokenKeyUp = event => {
|
118
|
+
if (event.key === 'Escape') {
|
99
119
|
var _ref$current;
|
100
120
|
|
101
121
|
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
102
122
|
}
|
103
123
|
};
|
104
124
|
|
105
|
-
const handleInputFocus =
|
106
|
-
onFocus && onFocus(
|
125
|
+
const handleInputFocus = event => {
|
126
|
+
onFocus && onFocus(event);
|
107
127
|
setSelectedTokenIndex(undefined);
|
128
|
+
setTokensAreTruncated(false);
|
129
|
+
};
|
130
|
+
|
131
|
+
const handleInputBlur = event => {
|
132
|
+
onBlur && onBlur(event); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
133
|
+
// this prevents the tokens from hiding when the user is moving focus from the input to a token,
|
134
|
+
// but still hides the tokens when the user blurs the input by tabbing out or clicking somewhere else on the page
|
135
|
+
|
136
|
+
setTimeout(() => {
|
137
|
+
var _containerRef$current4;
|
138
|
+
|
139
|
+
if (!((_containerRef$current4 = containerRef.current) !== null && _containerRef$current4 !== void 0 && _containerRef$current4.contains(document.activeElement))) {
|
140
|
+
setTokensAreTruncated(true);
|
141
|
+
}
|
142
|
+
}, 0);
|
108
143
|
};
|
109
144
|
|
110
145
|
const handleInputKeyDown = e => {
|
@@ -142,6 +177,17 @@ function TextInputWithTokensInnerComponent({
|
|
142
177
|
}
|
143
178
|
};
|
144
179
|
|
180
|
+
const focusInput = () => {
|
181
|
+
var _combinedInputRef$cur;
|
182
|
+
|
183
|
+
(_combinedInputRef$cur = combinedInputRef.current) === null || _combinedInputRef$cur === void 0 ? void 0 : _combinedInputRef$cur.focus();
|
184
|
+
};
|
185
|
+
|
186
|
+
const preventTokenClickPropagation = event => {
|
187
|
+
event.stopPropagation();
|
188
|
+
};
|
189
|
+
|
190
|
+
const visibleTokens = tokensAreTruncated ? tokens.slice(0, visibleTokenCount) : tokens;
|
145
191
|
return /*#__PURE__*/React.createElement(TextInputWrapper, {
|
146
192
|
block: block,
|
147
193
|
className: className,
|
@@ -154,6 +200,7 @@ function TextInputWithTokensInnerComponent({
|
|
154
200
|
maxWidth: maxWidthProp,
|
155
201
|
variant: variantProp,
|
156
202
|
ref: containerRef,
|
203
|
+
onClick: focusInput,
|
157
204
|
sx: {
|
158
205
|
alignItems: 'center',
|
159
206
|
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
@@ -185,12 +232,13 @@ function TextInputWithTokensInnerComponent({
|
|
185
232
|
ref: combinedInputRef,
|
186
233
|
disabled: disabled,
|
187
234
|
onFocus: handleInputFocus,
|
235
|
+
onBlur: handleInputBlur,
|
188
236
|
onKeyDown: handleInputKeyDown,
|
189
237
|
type: "text",
|
190
238
|
sx: {
|
191
239
|
height: '100%'
|
192
240
|
}
|
193
|
-
}, inputPropsRest))),
|
241
|
+
}, inputPropsRest))), TokenComponent ? visibleTokens.map(({
|
194
242
|
id,
|
195
243
|
...tokenRest
|
196
244
|
}, i) => /*#__PURE__*/React.createElement(TokenComponent, _extends({
|
@@ -198,6 +246,7 @@ function TextInputWithTokensInnerComponent({
|
|
198
246
|
onFocus: handleTokenFocus(i),
|
199
247
|
onBlur: handleTokenBlur,
|
200
248
|
onKeyUp: handleTokenKeyUp,
|
249
|
+
onClick: preventTokenClickPropagation,
|
201
250
|
isSelected: selectedTokenIndex === i,
|
202
251
|
onRemove: () => {
|
203
252
|
handleTokenRemove(id);
|
@@ -205,7 +254,10 @@ function TextInputWithTokensInnerComponent({
|
|
205
254
|
hideRemoveButton: hideTokenRemoveButtons,
|
206
255
|
size: size,
|
207
256
|
tabIndex: 0
|
208
|
-
}, tokenRest))) : null
|
257
|
+
}, tokenRest))) : null, tokensAreTruncated ? /*#__PURE__*/React.createElement(Text, {
|
258
|
+
color: "fg.muted",
|
259
|
+
fontSize: size && overflowCountFontSizeMap[size]
|
260
|
+
}, "+", tokens.length - visibleTokens.length) : null);
|
209
261
|
}
|
210
262
|
|
211
263
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|
@@ -21,11 +21,11 @@ const sizeVariants = variant({
|
|
21
21
|
const TextInputWrapper = styled.span.withConfig({
|
22
22
|
displayName: "_TextInputWrapper__TextInputWrapper",
|
23
23
|
componentId: "sc-5vfcis-0"
|
24
|
-
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
|
24
|
+
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";cursor:text;", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
|
25
25
|
if (props.hasIcon) {
|
26
26
|
return css(["padding:0;"]);
|
27
27
|
} else {
|
28
28
|
return css(["padding:6px 12px;"]);
|
29
29
|
}
|
30
|
-
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.
|
30
|
+
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.primer.fg.disabled'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx);
|
31
31
|
export default TextInputWrapper;
|
package/lib-esm/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib-esm/index.js
CHANGED
@@ -18,7 +18,6 @@ export { useOverlay } from './hooks/useOverlay';
|
|
18
18
|
export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
|
19
19
|
|
20
20
|
export { ActionList } from './ActionList';
|
21
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
22
21
|
export { ActionMenu } from './ActionMenu';
|
23
22
|
export { default as Autocomplete } from './Autocomplete';
|
24
23
|
export { default as Avatar } from './Avatar';
|
package/package.json
CHANGED
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Description = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _Truncate = _interopRequireDefault(require("../Truncate"));
|
13
|
-
|
14
|
-
var _Item = require("./Item");
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
const Description = ({
|
19
|
-
variant = 'inline',
|
20
|
-
...props
|
21
|
-
}) => {
|
22
|
-
const styles = {
|
23
|
-
color: 'fg.muted',
|
24
|
-
fontSize: 0,
|
25
|
-
lineHeight: '16px',
|
26
|
-
flexGrow: 1,
|
27
|
-
flexBasis: 0,
|
28
|
-
minWidth: 0,
|
29
|
-
marginLeft: variant === 'block' ? 0 : 2
|
30
|
-
};
|
31
|
-
return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
|
32
|
-
name: variant === 'block' ? 'BlockDescription' : 'InlineDescription'
|
33
|
-
}, variant === 'block' ? /*#__PURE__*/_react.default.createElement(_Box.default, {
|
34
|
-
as: "span",
|
35
|
-
sx: styles
|
36
|
-
}, props.children) : /*#__PURE__*/_react.default.createElement(_Truncate.default, {
|
37
|
-
sx: styles,
|
38
|
-
title: props.children,
|
39
|
-
inline: true,
|
40
|
-
maxWidth: "100%"
|
41
|
-
}, props.children));
|
42
|
-
};
|
43
|
-
|
44
|
-
exports.Description = Description;
|
45
|
-
Description.displayName = "Description";
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Divider = Divider;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _constants = require("../constants");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
18
|
-
*/
|
19
|
-
function Divider() {
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, {
|
21
|
-
as: "hr",
|
22
|
-
sx: {
|
23
|
-
border: 'none',
|
24
|
-
// override browser styles
|
25
|
-
height: 1,
|
26
|
-
backgroundColor: 'border.muted',
|
27
|
-
marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
|
28
|
-
marginBottom: 2
|
29
|
-
},
|
30
|
-
"data-component": "ActionList.Divider"
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
Divider.displayName = "Divider";
|
35
|
-
|
36
|
-
/**
|
37
|
-
* `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
|
38
|
-
* so it can be used inline in an `ActionList`’s `items` prop.
|
39
|
-
* In other words, `items={[ActionList.Divider]}` is supported as a concise
|
40
|
-
* alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
|
41
|
-
*/
|
42
|
-
Divider.renderItem = Divider;
|