@primer/components 0.0.0-2021919202426 → 0.0.0-2021920152952
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 -19
- package/codemods/deprecateUtilityComponents.js +1 -1
- package/dist/browser.esm.js +768 -879
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +773 -884
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +4 -4
- package/lib/ActionList/List.d.ts +1 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib/BaseStyles.js +1 -1
- package/lib/BorderBox.js +1 -1
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Caret.js +2 -2
- package/lib/DatePicker/DatePicker.d.ts +47 -0
- package/lib/DatePicker/DatePicker.js +76 -0
- package/lib/DatePicker/DatePickerAnchor.d.ts +10 -0
- package/lib/DatePicker/DatePickerAnchor.js +83 -0
- package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib/DatePicker/DatePickerPanel.js +38 -0
- package/lib/DatePicker/Day.d.ts +13 -0
- package/lib/DatePicker/Day.js +136 -0
- package/lib/DatePicker/Month.d.ts +9 -0
- package/lib/DatePicker/Month.js +97 -0
- package/lib/DatePicker/index.d.ts +2 -0
- package/lib/DatePicker/index.js +13 -0
- package/lib/DatePicker/useDatePicker.d.ts +51 -0
- package/lib/DatePicker/useDatePicker.js +133 -0
- package/lib/Dialog.js +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +31 -5
- package/lib/Flash.js +16 -16
- package/lib/Label.js +1 -1
- package/lib/Overlay.d.ts +0 -1
- package/lib/Overlay.js +1 -3
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib/StateLabel.js +19 -13
- package/lib/TextInput.d.ts +13 -5
- package/lib/TextInput.js +46 -4
- package/lib/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib/hooks/useOverlay.d.ts +1 -2
- package/lib/hooks/useOverlay.js +2 -4
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -36
- package/lib/theme-preval.js +3105 -375
- package/lib/utils/testing.d.ts +493 -50
- package/{lib-esm/utils/types/AriaRole.d.ts → lib/utils/types.d.ts} +13 -0
- package/lib/utils/{types/AriaRole.js → types.js} +0 -0
- package/lib-esm/ActionList/Item.js +4 -4
- package/lib-esm/ActionList/List.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib-esm/BaseStyles.js +1 -1
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/Caret.js +2 -2
- package/lib-esm/DatePicker/DatePicker.d.ts +47 -0
- package/lib-esm/DatePicker/DatePicker.js +57 -0
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +10 -0
- package/lib-esm/DatePicker/DatePickerAnchor.js +59 -0
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +20 -0
- package/lib-esm/DatePicker/Day.d.ts +13 -0
- package/lib-esm/DatePicker/Day.js +113 -0
- package/lib-esm/DatePicker/Month.d.ts +9 -0
- package/lib-esm/DatePicker/Month.js +74 -0
- package/lib-esm/DatePicker/index.d.ts +2 -0
- package/lib-esm/DatePicker/index.js +1 -0
- package/lib-esm/DatePicker/useDatePicker.d.ts +51 -0
- package/lib-esm/DatePicker/useDatePicker.js +114 -0
- package/lib-esm/Dialog.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +31 -3
- package/lib-esm/Flash.js +16 -16
- package/lib-esm/Label.js +1 -1
- package/lib-esm/Overlay.d.ts +0 -1
- package/lib-esm/Overlay.js +1 -3
- package/lib-esm/Pagination/Pagination.js +1 -1
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib-esm/StateLabel.js +19 -13
- package/lib-esm/TextInput.d.ts +13 -5
- package/lib-esm/TextInput.js +37 -4
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib-esm/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib-esm/hooks/useOverlay.d.ts +1 -2
- package/lib-esm/hooks/useOverlay.js +2 -4
- package/lib-esm/index.d.ts +0 -5
- package/lib-esm/index.js +0 -3
- package/lib-esm/theme-preval.js +3105 -375
- package/lib-esm/utils/testing.d.ts +493 -50
- package/{lib/utils/types/AriaRole.d.ts → lib-esm/utils/types.d.ts} +13 -0
- package/lib-esm/utils/{types/AriaRole.js → types.js} +0 -0
- package/package.json +4 -4
- package/lib/Autocomplete/Autocomplete.d.ts +0 -304
- package/lib/Autocomplete/Autocomplete.js +0 -145
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -292
- package/lib/Autocomplete/AutocompleteInput.js +0 -157
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -72
- package/lib/Autocomplete/AutocompleteMenu.js +0 -224
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -20
- package/lib/Autocomplete/AutocompleteOverlay.js +0 -80
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- package/lib/TextInputWithTokens.d.ts +0 -327
- package/lib/TextInputWithTokens.js +0 -298
- package/lib/Token/AvatarToken.d.ts +0 -7
- package/lib/Token/AvatarToken.js +0 -64
- package/lib/Token/IssueLabelToken.d.ts +0 -14
- package/lib/Token/IssueLabelToken.js +0 -144
- package/lib/Token/Token.d.ts +0 -15
- package/lib/Token/Token.js +0 -94
- package/lib/Token/TokenBase.d.ts +0 -31
- package/lib/Token/TokenBase.js +0 -108
- package/lib/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib/Token/_RemoveTokenButton.js +0 -77
- package/lib/Token/_TokenTextContainer.d.ts +0 -3
- package/lib/Token/_TokenTextContainer.js +0 -17
- package/lib/Token/index.d.ts +0 -3
- package/lib/Token/index.js +0 -31
- package/lib/_TextInputWrapper.d.ts +0 -10
- package/lib/_TextInputWrapper.js +0 -51
- package/lib/_UnstyledTextInput.d.ts +0 -2
- package/lib/_UnstyledTextInput.js +0 -20
- package/lib/behaviors/scrollIntoViewingArea.d.ts +0 -1
- package/lib/behaviors/scrollIntoViewingArea.js +0 -39
- package/lib/utils/types/ComponentProps.d.ts +0 -9
- package/lib/utils/types/ComponentProps.js +0 -1
- package/lib/utils/types/Flatten.d.ts +0 -4
- package/lib/utils/types/Flatten.js +0 -1
- package/lib/utils/types/MandateProps.d.ts +0 -3
- package/lib/utils/types/MandateProps.js +0 -1
- package/lib/utils/types/Merge.d.ts +0 -19
- package/lib/utils/types/Merge.js +0 -1
- package/lib/utils/types/index.d.ts +0 -5
- package/lib/utils/types/index.js +0 -70
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -304
- package/lib-esm/Autocomplete/Autocomplete.js +0 -123
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -292
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -138
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -72
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -205
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -20
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -62
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/index.js +0 -1
- package/lib-esm/TextInputWithTokens.d.ts +0 -327
- package/lib-esm/TextInputWithTokens.js +0 -272
- package/lib-esm/Token/AvatarToken.d.ts +0 -7
- package/lib-esm/Token/AvatarToken.js +0 -43
- package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
- package/lib-esm/Token/IssueLabelToken.js +0 -124
- package/lib-esm/Token/Token.d.ts +0 -15
- package/lib-esm/Token/Token.js +0 -73
- package/lib-esm/Token/TokenBase.d.ts +0 -31
- package/lib-esm/Token/TokenBase.js +0 -87
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib-esm/Token/_RemoveTokenButton.js +0 -60
- package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
- package/lib-esm/Token/_TokenTextContainer.js +0 -6
- package/lib-esm/Token/index.d.ts +0 -3
- package/lib-esm/Token/index.js +0 -3
- package/lib-esm/_TextInputWrapper.d.ts +0 -10
- package/lib-esm/_TextInputWrapper.js +0 -31
- package/lib-esm/_UnstyledTextInput.d.ts +0 -2
- package/lib-esm/_UnstyledTextInput.js +0 -7
- package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +0 -1
- package/lib-esm/behaviors/scrollIntoViewingArea.js +0 -30
- package/lib-esm/utils/types/ComponentProps.d.ts +0 -9
- package/lib-esm/utils/types/ComponentProps.js +0 -1
- package/lib-esm/utils/types/Flatten.d.ts +0 -4
- package/lib-esm/utils/types/Flatten.js +0 -1
- package/lib-esm/utils/types/MandateProps.d.ts +0 -3
- package/lib-esm/utils/types/MandateProps.js +0 -1
- package/lib-esm/utils/types/Merge.d.ts +0 -19
- package/lib-esm/utils/types/Merge.js +0 -1
- package/lib-esm/utils/types/index.d.ts +0 -5
- package/lib-esm/utils/types/index.js +0 -5
@@ -1,87 +0,0 @@
|
|
1
|
-
import styled from 'styled-components';
|
2
|
-
import { variant } from 'styled-system';
|
3
|
-
import { get } from '../constants';
|
4
|
-
import sx from '../sx';
|
5
|
-
export const tokenSizes = {
|
6
|
-
small: '16px',
|
7
|
-
medium: '20px',
|
8
|
-
large: '24px',
|
9
|
-
extralarge: '32px'
|
10
|
-
};
|
11
|
-
export const defaultTokenSize = 'medium';
|
12
|
-
export const isTokenInteractive = ({
|
13
|
-
as = 'span',
|
14
|
-
onClick,
|
15
|
-
onFocus,
|
16
|
-
tabIndex = -1
|
17
|
-
}) => Boolean(onFocus || onClick || tabIndex > -1 || ['a', 'button'].includes(as));
|
18
|
-
const variants = variant({
|
19
|
-
prop: 'size',
|
20
|
-
variants: {
|
21
|
-
small: {
|
22
|
-
fontSize: 0,
|
23
|
-
gap: 1,
|
24
|
-
height: tokenSizes.small,
|
25
|
-
// without setting lineHeight to match height, the "x" appears vertically mis-aligned
|
26
|
-
lineHeight: tokenSizes.small,
|
27
|
-
paddingLeft: 1,
|
28
|
-
paddingRight: 1,
|
29
|
-
// need to explicitly set padding top and bottom to "0" to override default `<button>` element styles
|
30
|
-
// without setting these, the "x" appears vertically mis-aligned
|
31
|
-
paddingTop: 0,
|
32
|
-
paddingBottom: 0
|
33
|
-
},
|
34
|
-
medium: {
|
35
|
-
fontSize: 0,
|
36
|
-
gap: 1,
|
37
|
-
height: tokenSizes.medium,
|
38
|
-
lineHeight: tokenSizes.medium,
|
39
|
-
paddingLeft: 2,
|
40
|
-
paddingRight: 2,
|
41
|
-
paddingTop: 0,
|
42
|
-
paddingBottom: 0
|
43
|
-
},
|
44
|
-
large: {
|
45
|
-
fontSize: 0,
|
46
|
-
gap: 2,
|
47
|
-
height: tokenSizes.large,
|
48
|
-
lineHeight: tokenSizes.large,
|
49
|
-
paddingLeft: 2,
|
50
|
-
paddingRight: 2,
|
51
|
-
paddingTop: 0,
|
52
|
-
paddingBottom: 0
|
53
|
-
},
|
54
|
-
extralarge: {
|
55
|
-
fontSize: 1,
|
56
|
-
gap: 2,
|
57
|
-
height: tokenSizes.extralarge,
|
58
|
-
lineHeight: tokenSizes.extralarge,
|
59
|
-
paddingLeft: 3,
|
60
|
-
paddingRight: 3,
|
61
|
-
paddingTop: 0,
|
62
|
-
paddingBottom: 0
|
63
|
-
}
|
64
|
-
}
|
65
|
-
});
|
66
|
-
const TokenBase = styled.span.attrs(({
|
67
|
-
text,
|
68
|
-
onRemove,
|
69
|
-
onKeyDown
|
70
|
-
}) => ({
|
71
|
-
onKeyDown: event => {
|
72
|
-
onKeyDown && onKeyDown(event);
|
73
|
-
|
74
|
-
if ((event.key === 'Backspace' || event.key === 'Delete') && onRemove) {
|
75
|
-
onRemove();
|
76
|
-
}
|
77
|
-
},
|
78
|
-
'aria-label': onRemove ? `${text}, press backspace or delete to remove` : undefined
|
79
|
-
})).withConfig({
|
80
|
-
displayName: "TokenBase",
|
81
|
-
componentId: "opajvp-0"
|
82
|
-
})(["align-items:center;border-radius:999px;cursor:", ";display:inline-flex;font-weight:", ";font-family:inherit;text-decoration:none;white-space:nowrap;", " ", ""], props => isTokenInteractive(props) ? 'pointer' : 'auto', get('fontWeights.bold'), variants, sx);
|
83
|
-
TokenBase.defaultProps = {
|
84
|
-
as: 'span',
|
85
|
-
size: defaultTokenSize
|
86
|
-
};
|
87
|
-
export default TokenBase;
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SxProp } from '../sx';
|
3
|
-
import { ComponentProps } from '../utils/types';
|
4
|
-
import { TokenSizeKeys } from './TokenBase';
|
5
|
-
interface TokenButtonProps {
|
6
|
-
borderOffset?: number;
|
7
|
-
size?: TokenSizeKeys;
|
8
|
-
isParentInteractive?: boolean;
|
9
|
-
}
|
10
|
-
declare const StyledTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps & SxProp, never>;
|
11
|
-
declare const RemoveTokenButton: React.FC<ComponentProps<typeof StyledTokenButton>>;
|
12
|
-
export default RemoveTokenButton;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
|
3
|
-
import React from 'react';
|
4
|
-
import { XIcon } from '@primer/octicons-react';
|
5
|
-
import styled from 'styled-components';
|
6
|
-
import { variant } from 'styled-system';
|
7
|
-
import { get } from '../constants';
|
8
|
-
import sx from '../sx';
|
9
|
-
import { tokenSizes, defaultTokenSize } from './TokenBase';
|
10
|
-
const variants = variant({
|
11
|
-
prop: 'size',
|
12
|
-
variants: {
|
13
|
-
small: {
|
14
|
-
height: tokenSizes.small,
|
15
|
-
width: tokenSizes.small
|
16
|
-
},
|
17
|
-
medium: {
|
18
|
-
height: tokenSizes.medium,
|
19
|
-
width: tokenSizes.medium
|
20
|
-
},
|
21
|
-
large: {
|
22
|
-
height: tokenSizes.large,
|
23
|
-
width: tokenSizes.large
|
24
|
-
},
|
25
|
-
extralarge: {
|
26
|
-
height: tokenSizes.extralarge,
|
27
|
-
width: tokenSizes.extralarge
|
28
|
-
}
|
29
|
-
}
|
30
|
-
});
|
31
|
-
|
32
|
-
const getTokenButtonIconSize = size => parseInt(tokenSizes[size || defaultTokenSize], 10) * 0.75;
|
33
|
-
|
34
|
-
const StyledTokenButton = styled.span.withConfig({
|
35
|
-
displayName: "_RemoveTokenButton__StyledTokenButton",
|
36
|
-
componentId: "sc-14lvcw1-0"
|
37
|
-
})(["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)`, get('colors.neutral.muted'), get('colors.neutral.subtle'), variants, sx);
|
38
|
-
|
39
|
-
const RemoveTokenButton = ({
|
40
|
-
'aria-label': ariaLabel,
|
41
|
-
isParentInteractive,
|
42
|
-
size,
|
43
|
-
...rest
|
44
|
-
}) => {
|
45
|
-
delete rest.children;
|
46
|
-
return /*#__PURE__*/React.createElement(StyledTokenButton, _extends({
|
47
|
-
as: isParentInteractive ? 'span' : 'button',
|
48
|
-
tabIndex: isParentInteractive ? -1 : undefined,
|
49
|
-
"aria-label": !isParentInteractive ? 'Remove token' : ariaLabel,
|
50
|
-
size: size
|
51
|
-
}, rest), /*#__PURE__*/React.createElement(XIcon, {
|
52
|
-
size: getTokenButtonIconSize(size)
|
53
|
-
}));
|
54
|
-
};
|
55
|
-
|
56
|
-
RemoveTokenButton.displayName = "RemoveTokenButton";
|
57
|
-
RemoveTokenButton.defaultProps = {
|
58
|
-
size: defaultTokenSize
|
59
|
-
};
|
60
|
-
export default RemoveTokenButton;
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import styled from 'styled-components';
|
2
|
-
const TokenTextContainer = styled('span').withConfig({
|
3
|
-
displayName: "_TokenTextContainer__TokenTextContainer",
|
4
|
-
componentId: "sc-4t2bev-0"
|
5
|
-
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:transparent;border:none;color:inherit;font:inherit;margin:0;overflow:visible;padding:0;width:auto;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;line-height:1;color:currentColor;text-decoration:none;&:is(a,button,[tabIndex='0']){cursor:pointer;&:after{content:'';position:absolute;left:0;top:0;right:0;bottom:0;}}"]);
|
6
|
-
export default TokenTextContainer;
|
package/lib-esm/Token/index.d.ts
DELETED
package/lib-esm/Token/index.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
|
2
|
-
import { SxProp } from './sx';
|
3
|
-
declare const TextInputWrapper: import("styled-components").StyledComponent<"span", any, {
|
4
|
-
disabled?: boolean | undefined;
|
5
|
-
hasIcon?: boolean | undefined;
|
6
|
-
block?: boolean | undefined;
|
7
|
-
contrast?: boolean | undefined;
|
8
|
-
variant?: "large" | "small" | undefined;
|
9
|
-
} & 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>;
|
10
|
-
export default TextInputWrapper;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import styled, { css } from 'styled-components';
|
2
|
-
import { maxWidth, minWidth, variant, width } from 'styled-system';
|
3
|
-
import { get } from './constants';
|
4
|
-
import sx from './sx';
|
5
|
-
const sizeVariants = variant({
|
6
|
-
variants: {
|
7
|
-
small: {
|
8
|
-
minHeight: '28px',
|
9
|
-
px: 2,
|
10
|
-
py: '3px',
|
11
|
-
fontSize: 0,
|
12
|
-
lineHeight: '20px'
|
13
|
-
},
|
14
|
-
large: {
|
15
|
-
px: 2,
|
16
|
-
py: '10px',
|
17
|
-
fontSize: 3
|
18
|
-
}
|
19
|
-
}
|
20
|
-
});
|
21
|
-
const TextInputWrapper = styled.span.withConfig({
|
22
|
-
displayName: "_TextInputWrapper__TextInputWrapper",
|
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:", ";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
|
-
if (props.hasIcon) {
|
26
|
-
return css(["padding:0;"]);
|
27
|
-
} else {
|
28
|
-
return css(["padding:6px 12px;"]);
|
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.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
|
-
export default TextInputWrapper;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import styled from 'styled-components';
|
2
|
-
import sx from './sx';
|
3
|
-
const UnstyledTextInput = styled.input.withConfig({
|
4
|
-
displayName: "_UnstyledTextInput__UnstyledTextInput",
|
5
|
-
componentId: "sc-1jgl33s-0"
|
6
|
-
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}", ";"], sx);
|
7
|
-
export default UnstyledTextInput;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const scrollIntoViewingArea: (child: HTMLElement, viewingArea: HTMLElement, direction?: 'horizontal' | 'vertical', startMargin?: number, endMargin?: number, behavior?: ScrollBehavior) => void;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
export const scrollIntoViewingArea = (child, viewingArea, direction = 'vertical', startMargin = 8, endMargin = 0, behavior = 'smooth') => {
|
2
|
-
const startSide = direction === 'vertical' ? 'top' : 'left';
|
3
|
-
const endSide = direction === 'vertical' ? 'bottom' : 'right';
|
4
|
-
const scrollSide = direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
5
|
-
const {
|
6
|
-
[startSide]: childStart,
|
7
|
-
[endSide]: childEnd
|
8
|
-
} = child.getBoundingClientRect();
|
9
|
-
const {
|
10
|
-
[startSide]: viewingAreaStart,
|
11
|
-
[endSide]: viewingAreaEnd
|
12
|
-
} = viewingArea.getBoundingClientRect();
|
13
|
-
const isChildStartAboveViewingArea = childStart < viewingAreaStart + endMargin;
|
14
|
-
const isChildBottomBelowViewingArea = childEnd > viewingAreaEnd - startMargin;
|
15
|
-
|
16
|
-
if (isChildStartAboveViewingArea) {
|
17
|
-
const scrollHeightToChildStart = childStart - viewingAreaStart + viewingArea[scrollSide];
|
18
|
-
viewingArea.scrollTo({
|
19
|
-
behavior,
|
20
|
-
[startSide]: scrollHeightToChildStart - endMargin
|
21
|
-
});
|
22
|
-
} else if (isChildBottomBelowViewingArea) {
|
23
|
-
const scrollHeightToChildBottom = childEnd - viewingAreaEnd + viewingArea[scrollSide];
|
24
|
-
viewingArea.scrollTo({
|
25
|
-
behavior,
|
26
|
-
[startSide]: scrollHeightToChildBottom + startMargin
|
27
|
-
});
|
28
|
-
} // either completely in view or outside viewing area on both ends, don't scroll
|
29
|
-
|
30
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
/**
|
3
|
-
* Extract a component's props
|
4
|
-
*
|
5
|
-
* Source: https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_usecase#wrappingmirroring-a-component
|
6
|
-
*
|
7
|
-
* @example ComponentProps<typeof MyComponent>
|
8
|
-
*/
|
9
|
-
export declare type ComponentProps<T> = T extends React.ComponentType<infer Props> ? Props extends object ? Props : never : never;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Given two object types A and B, return a type with all the properties of A that aren't also
|
3
|
-
* properties of B, and all the properties of B.
|
4
|
-
*
|
5
|
-
* Useful when we have a component that spreads a "rest" of its props on a subcomponent:
|
6
|
-
*
|
7
|
-
* ```ts
|
8
|
-
* interface OwnProps {
|
9
|
-
* foo: string
|
10
|
-
* }
|
11
|
-
*
|
12
|
-
* type MyComponentProps = Merge<SubcomponentProps, OwnProps>
|
13
|
-
* const MyComponent = ({foo, ...rest}: MyComponentProps) => {
|
14
|
-
* // ...
|
15
|
-
* return <SubComponent {...rest} />
|
16
|
-
* }
|
17
|
-
* ```
|
18
|
-
*/
|
19
|
-
export declare type Merge<A = {}, B = {}> = Omit<A, keyof B> & B;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|