@primer/components 0.0.0-202198182351 → 0.0.0-20219819465
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 +1 -1
- package/dist/browser.esm.js +295 -294
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +369 -368
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib/Autocomplete/Autocomplete.d.ts +40 -0
- package/lib/Autocomplete/Autocomplete.js +68 -0
- package/lib/Autocomplete/AutocompleteContext.d.ts +17 -0
- package/lib/Autocomplete/AutocompleteContext.js +11 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +9 -0
- package/lib/Autocomplete/AutocompleteInput.js +150 -0
- package/lib/Autocomplete/AutocompleteMenu.d.ts +71 -0
- package/lib/Autocomplete/AutocompleteMenu.js +223 -0
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +17 -0
- package/lib/Autocomplete/AutocompleteOverlay.js +74 -0
- package/lib/Autocomplete/index.d.ts +2 -0
- package/lib/Autocomplete/index.js +15 -0
- package/lib/FilteredActionList/FilteredActionList.js +5 -31
- package/lib/Overlay.d.ts +2 -1
- package/lib/Overlay.js +10 -5
- package/lib/TextInput.d.ts +4 -12
- package/lib/TextInput.js +4 -46
- package/lib/TextInputWithTokens.d.ts +323 -0
- package/lib/TextInputWithTokens.js +244 -0
- package/lib/_TextInputWrapper.d.ts +10 -0
- package/lib/_TextInputWrapper.js +51 -0
- package/lib/_UnstyledTextInput.d.ts +2 -0
- package/lib/_UnstyledTextInput.js +20 -0
- package/lib/hooks/useOpenAndCloseFocus.d.ts +2 -1
- package/lib/hooks/useOpenAndCloseFocus.js +7 -2
- package/lib/hooks/useOverlay.d.ts +2 -1
- package/lib/hooks/useOverlay.js +4 -2
- package/lib/index.d.ts +3 -0
- package/lib/index.js +16 -0
- package/lib/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib/utils/scrollIntoViewingArea.js +39 -0
- package/lib/utils/types/MandateProps.d.ts +3 -0
- package/lib/utils/types/MandateProps.js +1 -0
- package/lib/utils/types/index.d.ts +1 -0
- package/lib/utils/types/index.js +13 -0
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib-esm/Autocomplete/Autocomplete.d.ts +40 -0
- package/lib-esm/Autocomplete/Autocomplete.js +47 -0
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +17 -0
- package/lib-esm/Autocomplete/AutocompleteContext.js +2 -0
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +9 -0
- package/lib-esm/Autocomplete/AutocompleteInput.js +131 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +71 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.js +204 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +17 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +56 -0
- package/lib-esm/Autocomplete/index.d.ts +2 -0
- package/lib-esm/Autocomplete/index.js +1 -0
- package/lib-esm/FilteredActionList/FilteredActionList.js +3 -31
- package/lib-esm/Overlay.d.ts +2 -1
- package/lib-esm/Overlay.js +8 -5
- package/lib-esm/TextInput.d.ts +4 -12
- package/lib-esm/TextInput.js +4 -37
- package/lib-esm/TextInputWithTokens.d.ts +323 -0
- package/lib-esm/TextInputWithTokens.js +219 -0
- package/lib-esm/_TextInputWrapper.d.ts +10 -0
- package/lib-esm/_TextInputWrapper.js +31 -0
- package/lib-esm/_UnstyledTextInput.d.ts +2 -0
- package/lib-esm/_UnstyledTextInput.js +7 -0
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +2 -1
- package/lib-esm/hooks/useOpenAndCloseFocus.js +7 -2
- package/lib-esm/hooks/useOverlay.d.ts +2 -1
- package/lib-esm/hooks/useOverlay.js +4 -2
- package/lib-esm/index.d.ts +3 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib-esm/utils/scrollIntoViewingArea.js +30 -0
- package/lib-esm/utils/types/MandateProps.d.ts +3 -0
- package/lib-esm/utils/types/MandateProps.js +1 -0
- package/lib-esm/utils/types/index.d.ts +1 -0
- package/lib-esm/utils/types/index.js +2 -1
- package/package.json +1 -1
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _hooks = require("../hooks");
|
11
|
+
|
12
|
+
var _Overlay = _interopRequireDefault(require("../Overlay"));
|
13
|
+
|
14
|
+
var _AutocompleteContext = require("./AutocompleteContext");
|
15
|
+
|
16
|
+
var _useCombinedRefs = require("../hooks/useCombinedRefs");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
+
|
20
|
+
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); }
|
21
|
+
|
22
|
+
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; }
|
23
|
+
|
24
|
+
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); }
|
25
|
+
|
26
|
+
// TODO: consider making 'aria-labelledby' required
|
27
|
+
const AutocompleteOverlay = ({
|
28
|
+
menuAnchorRef,
|
29
|
+
overlayProps,
|
30
|
+
children
|
31
|
+
}) => {
|
32
|
+
const {
|
33
|
+
inputRef,
|
34
|
+
scrollContainerRef,
|
35
|
+
selectedItemLength,
|
36
|
+
setShowMenu,
|
37
|
+
showMenu = false
|
38
|
+
} = (0, _react.useContext)(_AutocompleteContext.AutocompleteContext);
|
39
|
+
const {
|
40
|
+
floatingElementRef,
|
41
|
+
position
|
42
|
+
} = (0, _hooks.useAnchoredPosition)({
|
43
|
+
side: 'outside-bottom',
|
44
|
+
align: 'start',
|
45
|
+
anchorElementRef: menuAnchorRef ? menuAnchorRef : inputRef
|
46
|
+
}, [showMenu, selectedItemLength]);
|
47
|
+
const combinedOverlayRef = (0, _useCombinedRefs.useCombinedRefs)(scrollContainerRef, floatingElementRef);
|
48
|
+
const closeOptionList = (0, _react.useCallback)(() => {
|
49
|
+
setShowMenu && setShowMenu(false);
|
50
|
+
}, [setShowMenu]);
|
51
|
+
|
52
|
+
if (typeof window === 'undefined') {
|
53
|
+
return null;
|
54
|
+
}
|
55
|
+
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_Overlay.default, _extends({
|
57
|
+
returnFocusRef: inputRef,
|
58
|
+
preventFocusOnOpen: true,
|
59
|
+
onClickOutside: closeOptionList,
|
60
|
+
onEscape: closeOptionList,
|
61
|
+
ref: combinedOverlayRef,
|
62
|
+
top: position === null || position === void 0 ? void 0 : position.top,
|
63
|
+
left: position === null || position === void 0 ? void 0 : position.left,
|
64
|
+
visibility: showMenu ? 'visible' : 'hidden',
|
65
|
+
sx: {
|
66
|
+
overflow: 'auto'
|
67
|
+
}
|
68
|
+
}, overlayProps), children);
|
69
|
+
};
|
70
|
+
|
71
|
+
AutocompleteOverlay.displayName = "AutocompleteOverlay";
|
72
|
+
AutocompleteOverlay.displayName = 'AutocompleteOverlay';
|
73
|
+
var _default = AutocompleteOverlay;
|
74
|
+
exports.default = _default;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "default", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _Autocomplete.default;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
14
|
+
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -7,6 +7,8 @@ exports.FilteredActionList = FilteredActionList;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
+
var _ssr = require("@react-aria/ssr");
|
11
|
+
|
10
12
|
var _TextInput = _interopRequireDefault(require("../TextInput"));
|
11
13
|
|
12
14
|
var _Box = _interopRequireDefault(require("../Box"));
|
@@ -27,7 +29,7 @@ var _useProvidedRefOrCreate = require("../hooks/useProvidedRefOrCreate");
|
|
27
29
|
|
28
30
|
var _useScrollFlash = _interopRequireDefault(require("../hooks/useScrollFlash"));
|
29
31
|
|
30
|
-
var
|
32
|
+
var _scrollIntoViewingArea = require("../utils/scrollIntoViewingArea");
|
31
33
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
35
|
|
@@ -37,34 +39,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
37
39
|
|
38
40
|
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); }
|
39
41
|
|
40
|
-
function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
|
41
|
-
const {
|
42
|
-
top: childTop,
|
43
|
-
bottom: childBottom
|
44
|
-
} = child.getBoundingClientRect();
|
45
|
-
const {
|
46
|
-
top: containerTop,
|
47
|
-
bottom: containerBottom
|
48
|
-
} = container.getBoundingClientRect();
|
49
|
-
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
50
|
-
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
51
|
-
|
52
|
-
if (isChildTopAboveViewingArea) {
|
53
|
-
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
54
|
-
container.scrollTo({
|
55
|
-
behavior,
|
56
|
-
top: scrollHeightToChildTop - margin
|
57
|
-
});
|
58
|
-
} else if (isChildBottomBelowViewingArea) {
|
59
|
-
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
60
|
-
container.scrollTo({
|
61
|
-
behavior,
|
62
|
-
top: scrollHeightToChildBottom + margin
|
63
|
-
});
|
64
|
-
} // either completely in view or outside viewing area on both ends, don't scroll
|
65
|
-
|
66
|
-
}
|
67
|
-
|
68
42
|
const StyledHeader = _styledComponents.default.div.withConfig({
|
69
43
|
displayName: "FilteredActionList__StyledHeader",
|
70
44
|
componentId: "yg3jkv-0"
|
@@ -112,7 +86,7 @@ function FilteredActionList({
|
|
112
86
|
activeDescendantRef.current = current;
|
113
87
|
|
114
88
|
if (current && scrollContainerRef.current && directlyActivated) {
|
115
|
-
scrollIntoViewingArea(current, scrollContainerRef.current);
|
89
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
|
116
90
|
}
|
117
91
|
}
|
118
92
|
}, [// List ref isn't set while loading. Need to re-bind focus zone when it changes
|
@@ -120,7 +94,7 @@ function FilteredActionList({
|
|
120
94
|
(0, _react.useEffect)(() => {
|
121
95
|
// if items changed, we want to instantly move active descendant into view
|
122
96
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
123
|
-
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
97
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
|
124
98
|
}
|
125
99
|
}, [items]);
|
126
100
|
(0, _useScrollFlash.default)(scrollContainerRef);
|
package/lib/Overlay.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { ComponentProps } from './utils/types';
|
|
4
4
|
import { TouchOrMouseEvent } from './hooks';
|
5
5
|
import { SxProp } from './sx';
|
6
6
|
import { AnchorSide } from './behaviors/anchoredPosition';
|
7
|
-
declare type StyledOverlayProps = {
|
7
|
+
export declare type StyledOverlayProps = {
|
8
8
|
width?: keyof typeof widthMap;
|
9
9
|
height?: keyof typeof heightMap;
|
10
10
|
maxHeight?: keyof Omit<typeof heightMap, 'auto' | 'initial'>;
|
@@ -40,6 +40,7 @@ export declare type OverlayProps = {
|
|
40
40
|
top: number;
|
41
41
|
left: number;
|
42
42
|
portalContainerName?: string;
|
43
|
+
preventFocusOnOpen?: boolean;
|
43
44
|
} & Omit<ComponentProps<typeof StyledOverlay>, 'visibility' | keyof SystemPositionProps>;
|
44
45
|
/**
|
45
46
|
* An `Overlay` is a flexible floating surface, used to display transient content such as menus,
|
package/lib/Overlay.js
CHANGED
@@ -113,6 +113,7 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
113
113
|
left,
|
114
114
|
anchorSide,
|
115
115
|
portalContainerName,
|
116
|
+
preventFocusOnOpen,
|
116
117
|
...rest
|
117
118
|
}, forwardedRef) => {
|
118
119
|
const overlayRef = (0, _react.useRef)(null);
|
@@ -128,7 +129,8 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
128
129
|
onEscape,
|
129
130
|
ignoreClickRefs,
|
130
131
|
onClickOutside,
|
131
|
-
initialFocusRef
|
132
|
+
initialFocusRef,
|
133
|
+
preventFocusOnOpen
|
132
134
|
});
|
133
135
|
(0, _react.useEffect)(() => {
|
134
136
|
var _combinedRef$current;
|
@@ -157,9 +159,8 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
157
159
|
easing: slideAnimationEasing
|
158
160
|
});
|
159
161
|
}, [anchorSide, slideAnimationDistance, slideAnimationEasing, visibility]);
|
160
|
-
|
161
|
-
|
162
|
-
}, /*#__PURE__*/_react.default.createElement(StyledOverlay, _extends({
|
162
|
+
|
163
|
+
const styledOverlay = /*#__PURE__*/_react.default.createElement(StyledOverlay, _extends({
|
163
164
|
height: height,
|
164
165
|
role: role
|
165
166
|
}, rest, {
|
@@ -170,7 +171,11 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
170
171
|
...rest.style,
|
171
172
|
'--styled-overlay-visibility': visibility
|
172
173
|
}
|
173
|
-
}))
|
174
|
+
}));
|
175
|
+
|
176
|
+
return /*#__PURE__*/_react.default.createElement(_Portal.default, {
|
177
|
+
containerName: portalContainerName
|
178
|
+
}, styledOverlay);
|
174
179
|
});
|
175
180
|
|
176
181
|
Overlay.defaultProps = {
|
package/lib/TextInput.d.ts
CHANGED
@@ -1,22 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
|
3
|
-
import { SxProp } from './sx';
|
4
2
|
import { ComponentProps, Merge } from './utils/types';
|
5
|
-
|
6
|
-
|
7
|
-
disabled?: boolean | undefined;
|
8
|
-
hasIcon?: boolean | undefined;
|
9
|
-
block?: boolean | undefined;
|
10
|
-
contrast?: boolean | undefined;
|
11
|
-
variant?: "large" | "small" | undefined;
|
12
|
-
} & WidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>> & MinWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>> & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
3
|
+
import UnstyledTextInput from './_UnstyledTextInput';
|
4
|
+
import TextInputWrapper from './_TextInputWrapper';
|
13
5
|
declare type NonPassthroughProps = {
|
14
6
|
className?: string;
|
15
7
|
icon?: React.ComponentType<{
|
16
8
|
className?: string;
|
17
9
|
}>;
|
18
|
-
} & Pick<ComponentProps<typeof
|
19
|
-
declare type TextInputInternalProps = Merge<React.ComponentPropsWithoutRef<typeof
|
10
|
+
} & Pick<ComponentProps<typeof TextInputWrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
|
11
|
+
declare type TextInputInternalProps = Merge<React.ComponentPropsWithoutRef<typeof UnstyledTextInput>, NonPassthroughProps>;
|
20
12
|
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
21
13
|
export declare type TextInputProps = ComponentProps<typeof TextInput>;
|
22
14
|
export default TextInput;
|
package/lib/TextInput.js
CHANGED
@@ -9,56 +9,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _UnstyledTextInput = _interopRequireDefault(require("./_UnstyledTextInput"));
|
13
13
|
|
14
|
-
var
|
15
|
-
|
16
|
-
var _constants = require("./constants");
|
17
|
-
|
18
|
-
var _sx = _interopRequireDefault(require("./sx"));
|
19
|
-
|
20
|
-
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); }
|
21
|
-
|
22
|
-
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; }
|
14
|
+
var _TextInputWrapper = _interopRequireDefault(require("./_TextInputWrapper"));
|
23
15
|
|
24
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
17
|
|
26
18
|
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
19
|
|
28
|
-
const sizeVariants = (0, _styledSystem.variant)({
|
29
|
-
variants: {
|
30
|
-
small: {
|
31
|
-
minHeight: '28px',
|
32
|
-
px: 2,
|
33
|
-
py: '3px',
|
34
|
-
fontSize: 0,
|
35
|
-
lineHeight: '20px'
|
36
|
-
},
|
37
|
-
large: {
|
38
|
-
px: 2,
|
39
|
-
py: '10px',
|
40
|
-
fontSize: 3
|
41
|
-
}
|
42
|
-
}
|
43
|
-
});
|
44
|
-
|
45
|
-
const Input = _styledComponents.default.input.withConfig({
|
46
|
-
displayName: "TextInput__Input",
|
47
|
-
componentId: "sc-1apmpmt-0"
|
48
|
-
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
|
49
|
-
|
50
|
-
const Wrapper = _styledComponents.default.span.withConfig({
|
51
|
-
displayName: "TextInput__Wrapper",
|
52
|
-
componentId: "sc-1apmpmt-1"
|
53
|
-
})(["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 => {
|
54
|
-
if (props.hasIcon) {
|
55
|
-
return (0, _styledComponents.css)(["padding:0;"]);
|
56
|
-
} else {
|
57
|
-
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
58
|
-
}
|
59
|
-
}, (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.muted'), (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); // Props that are not passed through to Input:
|
60
|
-
|
61
|
-
|
62
20
|
// using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
|
63
21
|
const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
64
22
|
icon: IconComponent,
|
@@ -76,7 +34,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
76
34
|
}, ref) => {
|
77
35
|
// this class is necessary to style FilterSearch, plz no touchy!
|
78
36
|
const wrapperClasses = (0, _classnames.default)(className, 'TextInput-wrapper');
|
79
|
-
return /*#__PURE__*/_react.default.createElement(
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_TextInputWrapper.default, {
|
80
38
|
block: block,
|
81
39
|
className: wrapperClasses,
|
82
40
|
contrast: contrast,
|
@@ -90,7 +48,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
90
48
|
variant: variantProp
|
91
49
|
}, IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, {
|
92
50
|
className: "TextInput-icon"
|
93
|
-
}), /*#__PURE__*/_react.default.createElement(
|
51
|
+
}), /*#__PURE__*/_react.default.createElement(_UnstyledTextInput.default, _extends({
|
94
52
|
ref: ref,
|
95
53
|
disabled: disabled
|
96
54
|
}, inputProps)));
|