@toptal/picasso-outlined-input 1.1.5 → 2.0.0
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/dist-package/src/OutlinedInput/OutlinedInput.d.ts +1 -48
- package/dist-package/src/OutlinedInput/OutlinedInput.d.ts.map +1 -1
- package/dist-package/src/OutlinedInput/OutlinedInput.js +58 -35
- package/dist-package/src/OutlinedInput/OutlinedInput.js.map +1 -1
- package/dist-package/src/OutlinedInput/index.d.ts +2 -1
- package/dist-package/src/OutlinedInput/index.d.ts.map +1 -1
- package/dist-package/src/OutlinedInput/stylesInput.d.ts +24 -0
- package/dist-package/src/OutlinedInput/stylesInput.d.ts.map +1 -0
- package/dist-package/src/OutlinedInput/stylesInput.js +60 -0
- package/dist-package/src/OutlinedInput/stylesInput.js.map +1 -0
- package/dist-package/src/OutlinedInput/stylesRoot.d.ts +66 -0
- package/dist-package/src/OutlinedInput/stylesRoot.d.ts.map +1 -0
- package/dist-package/src/OutlinedInput/stylesRoot.js +142 -0
- package/dist-package/src/OutlinedInput/stylesRoot.js.map +1 -0
- package/dist-package/src/OutlinedInput/types.d.ts +62 -0
- package/dist-package/src/OutlinedInput/types.d.ts.map +1 -0
- package/dist-package/src/OutlinedInput/types.js +2 -0
- package/dist-package/src/OutlinedInput/types.js.map +1 -0
- package/dist-package/src/OutlinedInput/utils.d.ts +2 -0
- package/dist-package/src/OutlinedInput/utils.d.ts.map +1 -0
- package/dist-package/src/OutlinedInput/utils.js +2 -0
- package/dist-package/src/OutlinedInput/utils.js.map +1 -0
- package/package.json +10 -9
- package/src/OutlinedInput/OutlinedInput.tsx +95 -129
- package/src/OutlinedInput/index.ts +2 -1
- package/src/OutlinedInput/stylesInput.test.ts +152 -0
- package/src/OutlinedInput/stylesInput.ts +87 -0
- package/src/OutlinedInput/stylesRoot.test.ts +195 -0
- package/src/OutlinedInput/stylesRoot.ts +217 -0
- package/src/OutlinedInput/types.ts +87 -0
- package/src/OutlinedInput/utils.ts +2 -0
- package/dist-package/src/OutlinedInput/styles.d.ts +0 -4
- package/dist-package/src/OutlinedInput/styles.d.ts.map +0 -1
- package/dist-package/src/OutlinedInput/styles.js +0 -157
- package/dist-package/src/OutlinedInput/styles.js.map +0 -1
- package/dist-package/src/styles.d.ts +0 -2
- package/dist-package/src/styles.d.ts.map +0 -1
- package/dist-package/src/styles.js +0 -2
- package/dist-package/src/styles.js.map +0 -1
- package/src/OutlinedInput/styles.ts +0 -183
- package/src/styles.ts +0 -1
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
import type { ChangeEventHandler, ReactType, ReactNode, InputHTMLAttributes, MouseEvent } from 'react';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
import type { StandardProps, SizeType } from '@toptal/picasso-shared';
|
|
5
|
-
declare type ValueType = (string | number | boolean | object)[] | string | number | boolean | object;
|
|
6
|
-
export declare type Status = 'error' | 'success' | 'default';
|
|
7
|
-
export declare type BaseInputProps = InputBaseComponentProps & {
|
|
8
|
-
variant?: 'dark' | 'light';
|
|
9
|
-
};
|
|
10
|
-
export interface Props extends StandardProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'size' | 'color'> {
|
|
11
|
-
/** Width of the component */
|
|
12
|
-
width?: 'full' | 'shrink' | 'auto';
|
|
13
|
-
inputComponent?: ReactType<InputBaseComponentProps>;
|
|
14
|
-
inputProps?: BaseInputProps;
|
|
15
|
-
defaultValue?: ValueType;
|
|
16
|
-
value?: ValueType;
|
|
17
|
-
/** Whether `Input` should be rendered as `TextArea` or not */
|
|
18
|
-
multiline?: boolean;
|
|
19
|
-
/** If true, the input element will be focused during the first mount */
|
|
20
|
-
autoFocus?: boolean;
|
|
21
|
-
/** Specify rows amount for `TextArea` */
|
|
22
|
-
rows?: string | number;
|
|
23
|
-
rowsMax?: string | number;
|
|
24
|
-
/** Type attribute of the Input element. It should be a valid HTML5 input type */
|
|
25
|
-
type?: string;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated [FX-4715] Use the `status` prop instead to both support success and error states
|
|
28
|
-
* Indicate whether input is in error state
|
|
29
|
-
*/
|
|
30
|
-
error?: boolean;
|
|
31
|
-
/** Indicate input status */
|
|
32
|
-
status?: Status;
|
|
33
|
-
startAdornment?: ReactNode;
|
|
34
|
-
endAdornment?: ReactNode;
|
|
35
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
36
|
-
/** Component size */
|
|
37
|
-
size?: SizeType<'small' | 'medium' | 'large'>;
|
|
38
|
-
/** Whether to render reset icon when there is a value in the input */
|
|
39
|
-
enableReset?: boolean;
|
|
40
|
-
/** Callback invoked when reset button was clicked */
|
|
41
|
-
onResetClick?: (event: MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => void;
|
|
42
|
-
/** Ref of the input element */
|
|
43
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
44
|
-
testIds?: {
|
|
45
|
-
resetButton?: string;
|
|
46
|
-
validIcon?: string;
|
|
47
|
-
};
|
|
48
|
-
highlight?: 'autofill';
|
|
49
|
-
}
|
|
2
|
+
import type { Props } from './types';
|
|
50
3
|
declare const OutlinedInput: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
|
|
51
4
|
export default OutlinedInput;
|
|
52
5
|
//# sourceMappingURL=OutlinedInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutlinedInput.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/OutlinedInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OutlinedInput.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/OutlinedInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAmBtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAmDpC,QAAA,MAAM,aAAa,2EA0IjB,CAAA;AAWF,eAAe,aAAa,CAAA"}
|
|
@@ -9,28 +9,30 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef } from 'react';
|
|
13
|
-
import cx from 'classnames';
|
|
14
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
15
|
-
import { OutlinedInput as MUIOutlinedInput } from '@material-ui/core';
|
|
16
|
-
import capitalize from '@material-ui/core/utils/capitalize';
|
|
12
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
17
13
|
import { InputAdornment, InputValidIconAdornment, } from '@toptal/picasso-input-adornment';
|
|
18
14
|
import { ButtonCircular } from '@toptal/picasso-button';
|
|
19
15
|
import { CloseMinor16 } from '@toptal/picasso-icons';
|
|
20
16
|
import { noop, usePropDeprecationWarning } from '@toptal/picasso-utils';
|
|
21
17
|
import { useFieldsLayoutContext } from '@toptal/picasso-form';
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
import { Input } from '@mui/base/Input';
|
|
19
|
+
import { TextareaAutosize, } from '@mui/base/TextareaAutosize';
|
|
20
|
+
import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge';
|
|
21
|
+
import { getRootClassName } from './stylesRoot';
|
|
22
|
+
import { getInputClassName } from './stylesInput';
|
|
23
|
+
import { getRows } from './utils';
|
|
24
|
+
const ResetButton = ({ hasValue, onClick, testIds, }) => (React.createElement(InputAdornment, { "data-testid": testIds === null || testIds === void 0 ? void 0 : testIds.resetButton, position: 'end', className: twJoin('invisible', hasValue && 'peer-focus:visible peer-hover:visible') },
|
|
29
25
|
React.createElement(ButtonCircular, { tabIndex: -1, icon: React.createElement(CloseMinor16, null), variant: 'flat', role: 'reset', onClick: onClick, onMouseDown: (event) => event.preventDefault(), onFocus: (event) => event.stopPropagation() })));
|
|
26
|
+
const Textarea = forwardRef((_a, ref) => {
|
|
27
|
+
var {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
+
ownerState } = _a, rest = __rest(_a, ["ownerState"]);
|
|
30
|
+
return React.createElement(TextareaAutosize, Object.assign({ ref: ref }, rest));
|
|
31
|
+
});
|
|
30
32
|
const OutlinedInput = forwardRef(function OutlinedInput(props, ref) {
|
|
31
|
-
const { className, style, multiline, autoFocus, rows, rowsMax, width = 'auto', inputComponent, inputProps, defaultValue, value, type, error, status, startAdornment, endAdornment: userDefinedEndAdornment, onChange, size = 'medium', enableReset, disabled, onResetClick = noop, inputRef, testIds, highlight } = props, rest = __rest(props
|
|
33
|
+
const { className, style, multiline, multilineResizable, autoFocus, rows, rowsMax, width = 'auto', inputComponent, inputProps, defaultValue, value, type = 'text', error, status, startAdornment, endAdornment: userDefinedEndAdornment, onChange, size = 'medium', enableReset, disabled, onResetClick = noop, inputRef, testIds, highlight, classes } = props, rest = __rest(props
|
|
32
34
|
// TODO: [FX-4715]
|
|
33
|
-
, ["className", "style", "multiline", "autoFocus", "rows", "rowsMax", "width", "inputComponent", "inputProps", "defaultValue", "value", "type", "error", "status", "startAdornment", "endAdornment", "onChange", "size", "enableReset", "disabled", "onResetClick", "inputRef", "testIds", "highlight"]);
|
|
35
|
+
, ["className", "style", "multiline", "multilineResizable", "autoFocus", "rows", "rowsMax", "width", "inputComponent", "inputProps", "defaultValue", "value", "type", "error", "status", "startAdornment", "endAdornment", "onChange", "size", "enableReset", "disabled", "onResetClick", "inputRef", "testIds", "highlight", "classes"]);
|
|
34
36
|
// TODO: [FX-4715]
|
|
35
37
|
usePropDeprecationWarning({
|
|
36
38
|
props,
|
|
@@ -39,33 +41,54 @@ const OutlinedInput = forwardRef(function OutlinedInput(props, ref) {
|
|
|
39
41
|
description: 'Use the `status` prop instead. `error` is deprecated and will be removed in the next major release.',
|
|
40
42
|
});
|
|
41
43
|
const { layout } = useFieldsLayoutContext();
|
|
42
|
-
const classes = useStyles(props);
|
|
43
44
|
const isDark = (inputProps === null || inputProps === void 0 ? void 0 : inputProps.variant) === 'dark';
|
|
44
45
|
const shouldShowReset = enableReset && !disabled;
|
|
45
46
|
const hasEndAdornment = status === 'success' || shouldShowReset;
|
|
46
47
|
const endAdornment = hasEndAdornment ? (React.createElement(React.Fragment, null,
|
|
47
|
-
shouldShowReset && (React.createElement(ResetButton, {
|
|
48
|
+
shouldShowReset && (React.createElement(ResetButton, { hasValue: Boolean(value), onClick: onResetClick, testIds: testIds })),
|
|
48
49
|
!multiline && status === 'success' && (React.createElement(InputValidIconAdornment, { "data-testid": testIds === null || testIds === void 0 ? void 0 : testIds.validIcon })),
|
|
49
50
|
userDefinedEndAdornment)) : (userDefinedEndAdornment);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
const divRef = useRef(null);
|
|
52
|
+
useImperativeHandle(ref, () => divRef.current, []);
|
|
53
|
+
const isError = Boolean(status === 'error' || error);
|
|
54
|
+
const inputClassName = getInputClassName({
|
|
55
|
+
size,
|
|
56
|
+
disabled,
|
|
57
|
+
isDark,
|
|
58
|
+
multiline,
|
|
59
|
+
multilineResizable,
|
|
60
|
+
type,
|
|
61
|
+
inputProps,
|
|
62
|
+
});
|
|
63
|
+
const rootClassName = getRootClassName({
|
|
64
|
+
size,
|
|
65
|
+
width,
|
|
66
|
+
type,
|
|
67
|
+
layout,
|
|
68
|
+
isDark,
|
|
69
|
+
multiline,
|
|
70
|
+
highlight,
|
|
71
|
+
disabled,
|
|
72
|
+
className,
|
|
73
|
+
classes,
|
|
74
|
+
isError,
|
|
75
|
+
});
|
|
76
|
+
const multilineProps = multiline
|
|
77
|
+
? {
|
|
78
|
+
multiline: true,
|
|
79
|
+
// to keep the same behavior as in MUI@4
|
|
80
|
+
// rows: getRows(rows),
|
|
81
|
+
minRows: getRows(rows),
|
|
82
|
+
maxRows: getRows(rowsMax),
|
|
83
|
+
}
|
|
84
|
+
: {};
|
|
85
|
+
return (React.createElement(Input, Object.assign({}, rest, { slots: { input: inputComponent, textarea: Textarea }, slotProps: {
|
|
86
|
+
root: {
|
|
87
|
+
ref: divRef,
|
|
88
|
+
className: twMerge(rootClassName, classes === null || classes === void 0 ? void 0 : classes.root, className),
|
|
89
|
+
},
|
|
90
|
+
input: Object.assign(Object.assign({}, inputProps), { ref: inputRef, className: twMerge(inputClassName, classes === null || classes === void 0 ? void 0 : classes.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), type, 'aria-invalid': isError }),
|
|
91
|
+
}, style: style, error: isError, defaultValue: defaultValue, value: value, startAdornment: startAdornment, endAdornment: endAdornment, autoFocus: autoFocus, onChange: onChange, disabled: disabled }, multilineProps)));
|
|
69
92
|
});
|
|
70
93
|
OutlinedInput.defaultProps = {
|
|
71
94
|
width: 'auto',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutlinedInput.js","sourceRoot":"","sources":["../../../src/OutlinedInput/OutlinedInput.tsx"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"OutlinedInput.js","sourceRoot":"","sources":["../../../src/OutlinedInput/OutlinedInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,EACL,cAAc,EACd,uBAAuB,GACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,s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,UAAU,CAAE,SAAS,CACtB,EACD,IAAI,EACJ,cAAc,EAAE,OAAO,GACxB;SACF,EACD,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,IACd,cAAc,EAClB,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,aAAa,CAAC,YAAY,GAAG;IAC3B,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,SAAS;CAClB,CAAA;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAA;AAE3C,eAAe,aAAa,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OmitInternalProps } from '@toptal/picasso-shared';
|
|
2
|
-
import type { Props } from './
|
|
2
|
+
import type { Props } from './types';
|
|
3
3
|
export { default as OutlinedInput } from './OutlinedInput';
|
|
4
4
|
export declare type OutlinedInputProps = OmitInternalProps<Props>;
|
|
5
5
|
export * from './OutlinedInput';
|
|
6
|
+
export type { Status, BaseInputProps, InputProps, Size, Props } from './types';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,oBAAY,kBAAkB,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;AACzD,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Size, Props } from './types';
|
|
2
|
+
export declare const classesBySize: Record<Size, string>;
|
|
3
|
+
export declare const fontColorClasses: {
|
|
4
|
+
dark: string;
|
|
5
|
+
disabled: string[];
|
|
6
|
+
default: string;
|
|
7
|
+
timepicker: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const getFontColorClass: ({ isDark, disabled, type, inputPropsDisabled, }: {
|
|
10
|
+
isDark: boolean;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
inputPropsDisabled?: boolean | undefined;
|
|
14
|
+
}) => string | string[];
|
|
15
|
+
export declare const placeholderClasses: {
|
|
16
|
+
default: string[];
|
|
17
|
+
dark: string[];
|
|
18
|
+
};
|
|
19
|
+
export declare const inputClasses: string[];
|
|
20
|
+
export declare const getInputClassName: ({ size, disabled, isDark, multiline, multilineResizable, type, inputProps, }: Partial<Props> & {
|
|
21
|
+
isDark: boolean;
|
|
22
|
+
size: Size;
|
|
23
|
+
}) => (string | false | string[] | undefined)[];
|
|
24
|
+
//# sourceMappingURL=stylesInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesInput.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/stylesInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAI9C,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;CAU5B,CAAA;AAED,eAAO,MAAM,iBAAiB;YAMpB,OAAO;;;;uBAmBhB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;CAG9B,CAAA;AAED,eAAO,MAAM,YAAY,UAaxB,CAAA;AAED,eAAO,MAAM,iBAAiB;YAQA,OAAO;UAAQ,IAAI;+CAWhD,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const classesBySize = {
|
|
2
|
+
small: 'text-xxs leading-4',
|
|
3
|
+
medium: 'text-md leading-4',
|
|
4
|
+
large: 'text-lg leading-4',
|
|
5
|
+
};
|
|
6
|
+
export const fontColorClasses = {
|
|
7
|
+
dark: 'text-white',
|
|
8
|
+
disabled: [
|
|
9
|
+
'text-gray-600',
|
|
10
|
+
// On Safari the text gets a bit lighter as if it had some transparency applied to it
|
|
11
|
+
// We need this webkit-specific property to achieve the exact font color
|
|
12
|
+
'[&::-webkit-text-fill-color]:text-gray-600',
|
|
13
|
+
],
|
|
14
|
+
default: 'text-black',
|
|
15
|
+
timepicker: 'text-black',
|
|
16
|
+
};
|
|
17
|
+
export const getFontColorClass = ({ isDark, disabled, type, inputPropsDisabled, }) => {
|
|
18
|
+
if (isDark) {
|
|
19
|
+
return fontColorClasses.dark;
|
|
20
|
+
}
|
|
21
|
+
if (type === 'time' && inputPropsDisabled) {
|
|
22
|
+
// It's a special case for TimePicker
|
|
23
|
+
return fontColorClasses.timepicker;
|
|
24
|
+
}
|
|
25
|
+
if (disabled) {
|
|
26
|
+
return fontColorClasses.disabled;
|
|
27
|
+
}
|
|
28
|
+
return fontColorClasses.default;
|
|
29
|
+
};
|
|
30
|
+
export const placeholderClasses = {
|
|
31
|
+
default: ['[&::placeholder]:text-gray-600', '[&::placeholder]:opacity-100'],
|
|
32
|
+
dark: ['[&::placeholder]:text-white', '[&::placeholder]:opacity-[0.64]'],
|
|
33
|
+
};
|
|
34
|
+
export const inputClasses = [
|
|
35
|
+
'[&::-webkit-calendar-picker-indicator]:bg-none',
|
|
36
|
+
'bg-transparent',
|
|
37
|
+
'border-none',
|
|
38
|
+
'box-border',
|
|
39
|
+
'cursor-[inherit]',
|
|
40
|
+
'h-full',
|
|
41
|
+
'outline-none',
|
|
42
|
+
'p-0',
|
|
43
|
+
'peer',
|
|
44
|
+
'resize-none',
|
|
45
|
+
'resize-none',
|
|
46
|
+
'w-full',
|
|
47
|
+
];
|
|
48
|
+
export const getInputClassName = ({ size, disabled, isDark, multiline, multilineResizable, type, inputProps, }) => [
|
|
49
|
+
inputClasses,
|
|
50
|
+
classesBySize[size],
|
|
51
|
+
getFontColorClass({
|
|
52
|
+
isDark,
|
|
53
|
+
disabled,
|
|
54
|
+
type,
|
|
55
|
+
inputPropsDisabled: inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
56
|
+
}),
|
|
57
|
+
isDark ? placeholderClasses.dark : placeholderClasses.default,
|
|
58
|
+
multiline && multilineResizable && 'resize-y',
|
|
59
|
+
];
|
|
60
|
+
//# sourceMappingURL=stylesInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesInput.js","sourceRoot":"","sources":["../../../src/OutlinedInput/stylesInput.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAyB;IACjD,KAAK,EAAE,oBAAoB;IAC3B,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,mBAAmB;CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE;QACR,eAAe;QACf,qFAAqF;QACrF,wEAAwE;QACxE,4CAA4C;KACjC;IACb,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE,YAAY;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,kBA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Size, Props } from './types';
|
|
3
|
+
export declare const spacingBySize: Record<Size, string>;
|
|
4
|
+
export declare const heightClasses: {
|
|
5
|
+
readonly singleline: Record<"small" | "medium" | "large", string>;
|
|
6
|
+
readonly multiline: "h-auto";
|
|
7
|
+
};
|
|
8
|
+
export declare const fontColorClass: {
|
|
9
|
+
default: string;
|
|
10
|
+
disabled: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const cursorClass: {
|
|
13
|
+
default: string;
|
|
14
|
+
disabled: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const bgClasses: {
|
|
17
|
+
disabled: string;
|
|
18
|
+
dark: string;
|
|
19
|
+
highlight: string;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const widthClasses: Record<WidthType | FieldLayout, string>;
|
|
23
|
+
export declare const borderPseudoCoreClasses: string[];
|
|
24
|
+
export declare const borderPseudoClassesByState: {
|
|
25
|
+
borderColor: {
|
|
26
|
+
dark: string;
|
|
27
|
+
default: string[];
|
|
28
|
+
disabled: string;
|
|
29
|
+
error: string[];
|
|
30
|
+
hoverWithoutFocus: string;
|
|
31
|
+
};
|
|
32
|
+
border: {
|
|
33
|
+
dark: string;
|
|
34
|
+
default: string;
|
|
35
|
+
disabled: string;
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
shadow: {
|
|
39
|
+
dark: string;
|
|
40
|
+
default: string[];
|
|
41
|
+
disabled: string;
|
|
42
|
+
error: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare const rootBasicClasses: string[];
|
|
46
|
+
export declare const getHeightClasses: ({ size, multiline, }: {
|
|
47
|
+
size: Size;
|
|
48
|
+
multiline: boolean | undefined;
|
|
49
|
+
}) => string;
|
|
50
|
+
export declare const getWidthClasses: ({ width, layout, }: {
|
|
51
|
+
width: WidthType;
|
|
52
|
+
layout: FieldLayout;
|
|
53
|
+
}) => string;
|
|
54
|
+
export declare const getBackgroundColorClasses: ({ isDark, disabled, highlight, }: {
|
|
55
|
+
isDark: boolean;
|
|
56
|
+
disabled: boolean | undefined;
|
|
57
|
+
highlight: string | undefined;
|
|
58
|
+
}) => string;
|
|
59
|
+
export declare const getRootClassName: ({ size, width, type, layout, isDark, multiline, highlight, disabled, isError, }: Partial<Props> & {
|
|
60
|
+
isDark: boolean;
|
|
61
|
+
layout: FieldLayout;
|
|
62
|
+
isError: boolean;
|
|
63
|
+
size: Size;
|
|
64
|
+
width: WidthType;
|
|
65
|
+
}) => (string | false | (string | (string | string[])[])[])[];
|
|
66
|
+
//# sourceMappingURL=stylesRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesRoot.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/stylesRoot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAI9C,CAAA;AAED,eAAO,MAAM,aAAa;;;CAOhB,CAAA;AAEV,eAAO,MAAM,cAAc;;;CAG1B,CAAA;AAED,eAAO,MAAM,WAAW;;;CAGvB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;CAKrB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,GAAG,WAAW,EAAE,MAAM,CAMhE,CAAA;AAED,eAAO,MAAM,uBAAuB,UAcnC,CAAA;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;CAgCtC,CAAA;AAED,eAAO,MAAM,gBAAgB,UAU5B,CAAA;AAED,eAAO,MAAM,gBAAgB;UAIrB,IAAI;eACC,OAAO,GAAG,SAAS;YAC4C,CAAA;AAE5E,eAAO,MAAM,eAAe;WAInB,SAAS;YACR,WAAW;YAC0D,CAAA;AAE/E,eAAO,MAAM,yBAAyB;YAK5B,OAAO;cACL,OAAO,GAAG,SAAS;eAClB,MAAM,GAAG,SAAS;YAe9B,CAAA;AA6CD,eAAO,MAAM,gBAAgB;YAWnB,OAAO;YACP,WAAW;aACV,OAAO;UACV,IAAI;WACH,SAAS;6DAWjB,CAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const spacingBySize = {
|
|
2
|
+
small: 'py-1 px-[0.625rem]',
|
|
3
|
+
medium: 'p-2',
|
|
4
|
+
large: 'p-3',
|
|
5
|
+
};
|
|
6
|
+
export const heightClasses = {
|
|
7
|
+
singleline: {
|
|
8
|
+
small: 'h-6',
|
|
9
|
+
medium: 'h-8',
|
|
10
|
+
large: 'h-12',
|
|
11
|
+
},
|
|
12
|
+
multiline: 'h-auto',
|
|
13
|
+
};
|
|
14
|
+
export const fontColorClass = {
|
|
15
|
+
default: 'text-black',
|
|
16
|
+
disabled: 'text-gray-500',
|
|
17
|
+
};
|
|
18
|
+
export const cursorClass = {
|
|
19
|
+
default: 'cursor-[inherit]',
|
|
20
|
+
disabled: 'cursor-default',
|
|
21
|
+
};
|
|
22
|
+
export const bgClasses = {
|
|
23
|
+
disabled: 'bg-gray-100',
|
|
24
|
+
dark: 'bg-[#081237]',
|
|
25
|
+
highlight: 'bg-yellow-100/60',
|
|
26
|
+
default: 'bg-white',
|
|
27
|
+
};
|
|
28
|
+
export const widthClasses = {
|
|
29
|
+
full: 'w-full',
|
|
30
|
+
shrink: 'w-auto',
|
|
31
|
+
auto: 'w-[18.75rem]',
|
|
32
|
+
horizontal: 'w-full',
|
|
33
|
+
vertical: '',
|
|
34
|
+
};
|
|
35
|
+
export const borderPseudoCoreClasses = [
|
|
36
|
+
'after:content-[""]',
|
|
37
|
+
'after:inline-block',
|
|
38
|
+
'after:absolute',
|
|
39
|
+
'after:top-0',
|
|
40
|
+
'after:bottom-0',
|
|
41
|
+
'after:right-0',
|
|
42
|
+
'after:left-0',
|
|
43
|
+
'after:pointer-events-none',
|
|
44
|
+
'after:border-solid',
|
|
45
|
+
'after:rounded-sm',
|
|
46
|
+
];
|
|
47
|
+
export const borderPseudoClassesByState = {
|
|
48
|
+
borderColor: {
|
|
49
|
+
dark: '',
|
|
50
|
+
default: [
|
|
51
|
+
'after:border-gray-400',
|
|
52
|
+
'[&:has(input:focus)]:after:border-blue-500',
|
|
53
|
+
],
|
|
54
|
+
disabled: 'after:border-gray-200',
|
|
55
|
+
error: [
|
|
56
|
+
'after:border-red-500',
|
|
57
|
+
'[&:has(input:focus)]:after:border-red-500',
|
|
58
|
+
],
|
|
59
|
+
hoverWithoutFocus: 'hover:[&:not(:has(input:focus))]:after:border-gray-600',
|
|
60
|
+
},
|
|
61
|
+
border: {
|
|
62
|
+
dark: 'after:border-none',
|
|
63
|
+
default: 'after:border',
|
|
64
|
+
disabled: '',
|
|
65
|
+
error: '',
|
|
66
|
+
},
|
|
67
|
+
shadow: {
|
|
68
|
+
dark: '[&:has(input:focus)]:after:shadow-0',
|
|
69
|
+
default: [
|
|
70
|
+
'[&:has(input:focus)]:after:shadow-[0_0_0_3px]',
|
|
71
|
+
'[&:has(input:focus)]:after:shadow-blue-500/[.48]',
|
|
72
|
+
],
|
|
73
|
+
disabled: '',
|
|
74
|
+
error: [
|
|
75
|
+
'[&:has(input:focus)]:after:shadow-[0_0_0_3px]',
|
|
76
|
+
'[&:has(input:focus)]:after:shadow-red-500/[.48]',
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const rootBasicClasses = [
|
|
81
|
+
'relative',
|
|
82
|
+
'text-black',
|
|
83
|
+
'inline-flex',
|
|
84
|
+
'gap-y-1',
|
|
85
|
+
'gap-x-2',
|
|
86
|
+
'items-center',
|
|
87
|
+
'rounded-sm',
|
|
88
|
+
'[font-size:_unset]',
|
|
89
|
+
'hover:[&_.resetButtonDirty]:visible',
|
|
90
|
+
];
|
|
91
|
+
export const getHeightClasses = ({ size, multiline, }) => (multiline ? heightClasses.multiline : heightClasses.singleline[size]);
|
|
92
|
+
export const getWidthClasses = ({ width, layout, }) => (layout === 'horizontal' ? widthClasses.horizontal : widthClasses[width]);
|
|
93
|
+
export const getBackgroundColorClasses = ({ isDark, disabled, highlight, }) => {
|
|
94
|
+
if (disabled) {
|
|
95
|
+
return bgClasses.disabled;
|
|
96
|
+
}
|
|
97
|
+
if (isDark) {
|
|
98
|
+
return bgClasses.dark;
|
|
99
|
+
}
|
|
100
|
+
if (highlight === 'autofill') {
|
|
101
|
+
return bgClasses.highlight;
|
|
102
|
+
}
|
|
103
|
+
return bgClasses.default;
|
|
104
|
+
};
|
|
105
|
+
const getTextColorClass = (disabled) => disabled ? fontColorClass.disabled : fontColorClass.default;
|
|
106
|
+
const getCursorClass = (disabled) => disabled ? cursorClass.disabled : cursorClass.default;
|
|
107
|
+
const getClassForState = (state, { borderColor, border, shadow }) => {
|
|
108
|
+
return [
|
|
109
|
+
borderColor[state] || borderColor.default,
|
|
110
|
+
border[state] || border.default,
|
|
111
|
+
shadow[state] || shadow.default,
|
|
112
|
+
];
|
|
113
|
+
};
|
|
114
|
+
const borderPseudoElement = (conditions) => {
|
|
115
|
+
const { disabled, isDark, isError } = conditions;
|
|
116
|
+
const { borderColor } = borderPseudoClassesByState;
|
|
117
|
+
const primaryState = isError
|
|
118
|
+
? 'error'
|
|
119
|
+
: disabled
|
|
120
|
+
? 'disabled'
|
|
121
|
+
: isDark
|
|
122
|
+
? 'dark'
|
|
123
|
+
: 'default';
|
|
124
|
+
const hoverClass = !disabled && !isError ? borderColor.hoverWithoutFocus : '';
|
|
125
|
+
return [
|
|
126
|
+
borderPseudoCoreClasses,
|
|
127
|
+
getClassForState(primaryState, borderPseudoClassesByState),
|
|
128
|
+
hoverClass,
|
|
129
|
+
];
|
|
130
|
+
};
|
|
131
|
+
export const getRootClassName = ({ size, width, type, layout, isDark, multiline, highlight, disabled, isError, }) => [
|
|
132
|
+
rootBasicClasses,
|
|
133
|
+
spacingBySize[size],
|
|
134
|
+
getHeightClasses({ size, multiline }),
|
|
135
|
+
getWidthClasses({ width, layout }),
|
|
136
|
+
getBackgroundColorClasses({ isDark, disabled, highlight }),
|
|
137
|
+
borderPseudoElement({ isDark, disabled, isError }),
|
|
138
|
+
getTextColorClass(disabled),
|
|
139
|
+
getCursorClass(disabled),
|
|
140
|
+
type === 'hidden' && 'hidden',
|
|
141
|
+
];
|
|
142
|
+
//# sourceMappingURL=stylesRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesRoot.js","sourceRoot":"","sources":["../../../src/OutlinedInput/stylesRoot.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,aAAa,GAAyB;IACjD,KAAK,EAAE,oBAAoB;IAC3B,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;CACb,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE;QACV,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,MAAM;KACU;IACzB,SAAS,EAAE,QAAQ;CACX,CAAA;AAEV,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,eAAe;CAC1B,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,kBAAkB;IAC3B,QAAQ,EAAE,gBAAgB;CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,UAAU;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAA4C;IACnE,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,cAAc;IACpB,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,EAAE;CACb,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAA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T,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,SAAS,CAAA;IAEb,MAAM,UAAU,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAA;IAE7E,OAAO;QACL,uBAAuB;QACvB,gBAAgB,CAAC,YAAY,EAAE,0BAA0B,CAAC;QAC1D,UAAU;KACX,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,GAOR,EAAE,EAAE,CAAC;IACJ,gBAAgB;IAChB,aAAa,CAAC,IAAI,CAAC;IACnB,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1D,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAClD,iBAAiB,CAAC,QAAQ,CAAC;IAC3B,cAAc,CAAC,QAAQ,CAAC;IACxB,IAAI,KAAK,QAAQ,IAAI,QAAQ;CAC9B,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChangeEventHandler, ReactType, ReactNode, InputHTMLAttributes, MouseEvent } from 'react';
|
|
2
|
+
import type { SizeType, BaseProps } from '@toptal/picasso-shared';
|
|
3
|
+
import type { InputBaseComponentProps } from '@material-ui/core/InputBase';
|
|
4
|
+
export declare type WidthType = 'full' | 'shrink' | 'auto';
|
|
5
|
+
export declare type Size = SizeType<'small' | 'medium' | 'large'>;
|
|
6
|
+
export declare type ValueType = (string | number | boolean | object)[] | string | number | boolean | object;
|
|
7
|
+
export declare type Status = 'error' | 'success' | 'default';
|
|
8
|
+
export declare type BaseInputProps = InputBaseComponentProps & {
|
|
9
|
+
variant?: 'dark' | 'light';
|
|
10
|
+
};
|
|
11
|
+
export interface InputProps extends React.HTMLAttributes<HTMLInputElement>, BaseProps {
|
|
12
|
+
size?: number | 'small' | 'medium' | 'large';
|
|
13
|
+
multiple?: boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface Props extends BaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'size' | 'color'> {
|
|
16
|
+
/** Classes for input and root */
|
|
17
|
+
classes?: {
|
|
18
|
+
input?: string;
|
|
19
|
+
root?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Width of the component */
|
|
22
|
+
width?: WidthType;
|
|
23
|
+
inputComponent?: ReactType<InputBaseComponentProps>;
|
|
24
|
+
inputProps?: BaseInputProps;
|
|
25
|
+
defaultValue?: ValueType;
|
|
26
|
+
value?: ValueType;
|
|
27
|
+
/** Whether `Input` should be rendered as `TextArea` or not */
|
|
28
|
+
multiline?: boolean;
|
|
29
|
+
/** If true, `TextArea` would be resizable vertical */
|
|
30
|
+
multilineResizable?: boolean;
|
|
31
|
+
/** If true, the input element will be focused during the first mount */
|
|
32
|
+
autoFocus?: boolean;
|
|
33
|
+
/** Specify rows amount for `TextArea` */
|
|
34
|
+
rows?: string | number;
|
|
35
|
+
rowsMax?: string | number;
|
|
36
|
+
/** Type attribute of the Input element. It should be a valid HTML5 input type */
|
|
37
|
+
type?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated [FX-4715] Use the `status` prop instead to both support success and error states
|
|
40
|
+
* Indicate whether input is in error state
|
|
41
|
+
*/
|
|
42
|
+
error?: boolean;
|
|
43
|
+
/** Indicate input status */
|
|
44
|
+
status?: Status;
|
|
45
|
+
startAdornment?: ReactNode;
|
|
46
|
+
endAdornment?: ReactNode;
|
|
47
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
48
|
+
/** Component size */
|
|
49
|
+
size?: Size;
|
|
50
|
+
/** Whether to render reset icon when there is a value in the input */
|
|
51
|
+
enableReset?: boolean;
|
|
52
|
+
/** Callback invoked when reset button was clicked */
|
|
53
|
+
onResetClick?: (event: MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => void;
|
|
54
|
+
/** Ref of the input element */
|
|
55
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
56
|
+
testIds?: {
|
|
57
|
+
resetButton?: string;
|
|
58
|
+
validIcon?: string;
|
|
59
|
+
};
|
|
60
|
+
highlight?: 'autofill';
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,UAAU,EACX,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAE1E,oBAAY,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAElD,oBAAY,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;AAEzD,oBAAY,SAAS,GACjB,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,EAAE,GACtC,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,CAAA;AAEV,oBAAY,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEpD,oBAAY,cAAc,GAAG,uBAAuB,GAAG;IACrD,OAAO,CAAC,EAAE,MAAM,G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BAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC/C,qBAAqB;IACrB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,qDAAqD;IACrD,YAAY,CAAC,EAAE,CACb,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KACrD,IAAI,CAAA;IACT,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/OutlinedInput/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/OutlinedInput/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SAAU,MAAM,GAAG,MAAM,GAAG,SAAS,uBACI,CAAA"}
|