@autoguru/overdrive 4.9.5 → 4.9.7
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/components/AutoSuggest/AutoSuggest.d.ts.map +1 -1
- package/dist/components/AutoSuggest/AutoSuggest.js +1 -1
- package/dist/components/TextInput/stories.js +38 -0
- package/dist/components/private/InputBase/NotchedBase.css.d.ts +4 -0
- package/dist/components/private/InputBase/NotchedBase.css.d.ts.map +1 -1
- package/dist/components/private/InputBase/NotchedBase.css.js +38 -1
- package/dist/components/private/InputBase/NotchedBase.d.ts +3 -0
- package/dist/components/private/InputBase/NotchedBase.d.ts.map +1 -1
- package/dist/components/private/InputBase/NotchedBase.js +23 -2
- package/dist/components/private/InputBase/withEnhancedInput.d.ts +2 -4
- package/dist/components/private/InputBase/withEnhancedInput.d.ts.map +1 -1
- package/dist/components/private/InputBase/withEnhancedInput.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSuggest.d.ts","sourceRoot":"","sources":["../../../lib/components/AutoSuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,wBAAwB,EAKxB,YAAY,EAEZ,GAAG,EAQH,MAAM,OAAO,CAAC;AAYf,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,MAAM,WAAW,gBAAgB,CAAC,WAAW;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,oBAAY,uBAAuB,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE;IAC1D,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACrC,SAAS,EAAE,OAA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vent(() => setIsFocused(false), incomingOnBlur),
|
|
145
145
|
...textInputProps,
|
|
146
146
|
};
|
|
147
|
-
return !inlineOptions && !isDesktop && showModal ? (React.createElement(AutoSuggestFullscreenInput, { ...props, isFocused: isFocused, inlineOptions: true, fieldIcon: fieldIcon, autoFocus: autoFocus, closeModal: closeModal })) : (React.createElement(AutoSuggestInput, { ref: inputRef, ...props, isFocused: isFocused, inlineOptions: inlineOptions, fieldIcon: fieldIcon, autoFocus: autoFocus, autoWidth: autoWidth }));
|
|
147
|
+
return !inlineOptions && !isDesktop && showModal ? (React.createElement(AutoSuggestFullscreenInput, { ...props, attach: "NONE", borderMerged: "NONE", isFocused: isFocused, inlineOptions: true, fieldIcon: fieldIcon, autoFocus: autoFocus, closeModal: closeModal })) : (React.createElement(AutoSuggestInput, { ref: inputRef, ...props, isFocused: isFocused, inlineOptions: inlineOptions, fieldIcon: fieldIcon, autoFocus: autoFocus, autoWidth: autoWidth }));
|
|
148
148
|
});
|
|
149
149
|
const AutoSuggestFullscreenInput = forwardRef(function AutoSuggestFullscreenInput({ closeModal, ...props }, ref) {
|
|
150
150
|
const [showPortal, setShowPortal] = useState(false);
|
|
@@ -121,6 +121,26 @@ const attachedAllProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
|
121
121
|
attach: 'ALL'
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
+
const mergedLeftProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
125
|
+
borderMerged: 'LEFT'
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const mergedTopProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
129
|
+
borderMerged: 'TOP'
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const mergedRightProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
133
|
+
borderMerged: 'RIGHT'
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const mergedBottomProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
137
|
+
borderMerged: 'BOTTOM'
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const mergedAllProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
141
|
+
borderMerged: 'ALL'
|
|
142
|
+
});
|
|
143
|
+
|
|
124
144
|
const withSuffixIconProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
125
145
|
suffixIcon: AccountEditIcon
|
|
126
146
|
});
|
|
@@ -202,6 +222,24 @@ attachedRight.argTypes = argTypes;
|
|
|
202
222
|
export const attachedBottom = Template.bind(attachedBottomProps);
|
|
203
223
|
attachedBottom.args = attachedBottomProps;
|
|
204
224
|
attachedBottom.argTypes = argTypes;
|
|
225
|
+
export const attachedAll = Template.bind(attachedAllProps);
|
|
226
|
+
attachedAll.args = attachedAllProps;
|
|
227
|
+
attachedAll.argTypes = argTypes;
|
|
228
|
+
export const mergedLeft = Template.bind(mergedLeftProps);
|
|
229
|
+
mergedLeft.args = mergedLeftProps;
|
|
230
|
+
mergedLeft.argTypes = argTypes;
|
|
231
|
+
export const mergedTop = Template.bind(mergedTopProps);
|
|
232
|
+
mergedTop.args = mergedTopProps;
|
|
233
|
+
mergedTop.argTypes = argTypes;
|
|
234
|
+
export const mergedRight = Template.bind(mergedRightProps);
|
|
235
|
+
mergedRight.args = mergedRightProps;
|
|
236
|
+
mergedRight.argTypes = argTypes;
|
|
237
|
+
export const mergedBottom = Template.bind(mergedBottomProps);
|
|
238
|
+
mergedBottom.args = mergedBottomProps;
|
|
239
|
+
mergedBottom.argTypes = argTypes;
|
|
240
|
+
export const mergedAll = Template.bind(mergedAllProps);
|
|
241
|
+
mergedAll.args = mergedAllProps;
|
|
242
|
+
mergedAll.argTypes = argTypes;
|
|
205
243
|
export const disabled = Template.bind(disabledProps);
|
|
206
244
|
disabled.args = disabledProps;
|
|
207
245
|
disabled.argTypes = argTypes;
|
|
@@ -13,6 +13,10 @@ export declare const bordersAttach: {
|
|
|
13
13
|
complete: Record<"NONE" | "LEFT" | "TOP" | "RIGHT" | "BOTTOM" | "ALL", string>;
|
|
14
14
|
flatCorners: Record<"TOP_LEFT" | "TOP_RIGHT" | "BOTTOM_RIGHT" | "BOTTOM_LEFT", string>;
|
|
15
15
|
};
|
|
16
|
+
export declare const bordersMerged: {
|
|
17
|
+
complete: Record<"NONE" | "LEFT" | "TOP" | "RIGHT" | "BOTTOM" | "ALL", string>;
|
|
18
|
+
flatCorners: Record<"TOP_LEFT" | "TOP_RIGHT" | "BOTTOM_RIGHT" | "BOTTOM_LEFT", string>;
|
|
19
|
+
};
|
|
16
20
|
export declare const placeholder: Record<"default" | "mutedLabelStyles", string>;
|
|
17
21
|
export declare const placeholderPlacement: any;
|
|
18
22
|
//# sourceMappingURL=NotchedBase.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAEf,CAAC;
|
|
1
|
+
{"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAEf,CAAC;AAeH,eAAO,MAAM,OAAO;;;;;;;;;CAuCnB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AACF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAWtB,CAAC;AA2BH,eAAO,MAAM,oBAAoB,KAiDhC,CAAC"}
|
|
@@ -3,8 +3,9 @@ import { themeContractVars as vars } from '../../../themes/theme.css';
|
|
|
3
3
|
export const root = style({
|
|
4
4
|
transition: `fill 0.2s ${vars.animation.easing.decelerate} 0s`,
|
|
5
5
|
});
|
|
6
|
+
const defaultBorderWidth = '1px';
|
|
6
7
|
const borderRegionDefaults = style({
|
|
7
|
-
borderWidth:
|
|
8
|
+
borderWidth: defaultBorderWidth,
|
|
8
9
|
borderStyle: 'solid',
|
|
9
10
|
display: 'inline-flex',
|
|
10
11
|
transition: `border-color 0.2s ${vars.animation.easing.decelerate} 0s`,
|
|
@@ -89,6 +90,42 @@ export const bordersAttach = {
|
|
|
89
90
|
},
|
|
90
91
|
}),
|
|
91
92
|
};
|
|
93
|
+
export const bordersMerged = {
|
|
94
|
+
complete: styleVariants({
|
|
95
|
+
NONE: {
|
|
96
|
+
borderWidth: defaultBorderWidth,
|
|
97
|
+
},
|
|
98
|
+
LEFT: {
|
|
99
|
+
borderLeftColor: 'transparent',
|
|
100
|
+
},
|
|
101
|
+
TOP: {
|
|
102
|
+
borderTopColor: 'transparent',
|
|
103
|
+
},
|
|
104
|
+
RIGHT: {
|
|
105
|
+
borderRightColor: 'transparent',
|
|
106
|
+
},
|
|
107
|
+
BOTTOM: {
|
|
108
|
+
borderBottomColor: 'transparent',
|
|
109
|
+
},
|
|
110
|
+
ALL: {
|
|
111
|
+
borderColor: 'transparent',
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
flatCorners: styleVariants({
|
|
115
|
+
TOP_LEFT: {
|
|
116
|
+
borderTopLeftRadius: 0,
|
|
117
|
+
},
|
|
118
|
+
TOP_RIGHT: {
|
|
119
|
+
borderTopRightRadius: 0,
|
|
120
|
+
},
|
|
121
|
+
BOTTOM_RIGHT: {
|
|
122
|
+
borderBottomRightRadius: 0,
|
|
123
|
+
},
|
|
124
|
+
BOTTOM_LEFT: {
|
|
125
|
+
borderBottomLeftRadius: 0,
|
|
126
|
+
},
|
|
127
|
+
}),
|
|
128
|
+
};
|
|
92
129
|
export const placeholder = styleVariants({
|
|
93
130
|
default: {
|
|
94
131
|
lineHeight: 1,
|
|
@@ -13,6 +13,9 @@ export interface Props {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
children?: ReactNode;
|
|
15
15
|
attach?: keyof typeof styles.bordersAttach['complete'];
|
|
16
|
+
borderMerged?: keyof typeof styles.bordersMerged['complete'];
|
|
17
|
+
isFocused?: boolean;
|
|
18
|
+
isHovered?: boolean;
|
|
16
19
|
}
|
|
17
20
|
export declare const NotchedBase: FunctionComponent<Props>;
|
|
18
21
|
//# sourceMappingURL=NotchedBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotchedBase.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EACN,iBAAiB,EACjB,SAAS,EAIT,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAM5C,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,OAAO,MAAM,CAAC,oBAAoB,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"NotchedBase.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EACN,iBAAiB,EACjB,SAAS,EAIT,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAM5C,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,OAAO,MAAM,CAAC,oBAAoB,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,KAAK,CAyLhD,CAAC"}
|
|
@@ -7,13 +7,14 @@ import * as styles from './NotchedBase.css';
|
|
|
7
7
|
const ACTIVE_SCALING_FACTOR = 0.7777;
|
|
8
8
|
const ACTIVE_PADDING_ADDED = 16;
|
|
9
9
|
const ROUGH_WIDTH_PER_CHARACTER = 10.2;
|
|
10
|
-
export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size, children, notch = true, borderColourClassName, placeholderColourClassName, className = '', attach = 'NONE', }) => {
|
|
10
|
+
export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size, children, notch = true, borderColourClassName, placeholderColourClassName, className = '', attach = 'NONE', borderMerged = 'NONE', isFocused = false, isHovered = false, }) => {
|
|
11
11
|
const labelStyles = useTextStyles({
|
|
12
12
|
noWrap: true,
|
|
13
13
|
size: '4',
|
|
14
14
|
});
|
|
15
15
|
const labelRef = useRef(null);
|
|
16
16
|
const [labelWidth, setLabelWidth] = useState(getNotchedComputedWidthForWidth(placeholder.length * ROUGH_WIDTH_PER_CHARACTER));
|
|
17
|
+
const shouldMerge = !isFocused && !isHovered;
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
if (labelRef.current) {
|
|
19
20
|
setLabelWidth(labelRef.current.offsetWidth);
|
|
@@ -21,7 +22,15 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
|
|
|
21
22
|
}, [placeholder]);
|
|
22
23
|
const notchedWidth = getNotchedComputedWidthForWidth(labelWidth);
|
|
23
24
|
return (React.createElement(Box, { position: "relative", width: "full", padding: "none", className: clsx(styles.root, !notch && [styles.borders.complete, borderColourClassName], className, {
|
|
24
|
-
[styles.
|
|
25
|
+
[styles.bordersMerged.complete.NONE]: !notch &&
|
|
26
|
+
shouldMerge &&
|
|
27
|
+
(!borderMerged || borderMerged === 'NONE'),
|
|
28
|
+
[styles.bordersMerged.complete.LEFT]: !notch && shouldMerge && borderMerged === 'LEFT',
|
|
29
|
+
[styles.bordersMerged.complete.TOP]: !notch && shouldMerge && borderMerged === 'TOP',
|
|
30
|
+
[styles.bordersMerged.complete.RIGHT]: !notch && shouldMerge && borderMerged === 'RIGHT',
|
|
31
|
+
[styles.bordersMerged.complete.BOTTOM]: !notch && shouldMerge && borderMerged === 'BOTTOM',
|
|
32
|
+
[styles.bordersMerged.complete.ALL]: !notch && shouldMerge && borderMerged === 'ALL',
|
|
33
|
+
[styles.bordersAttach.complete.NONE]: !notch && attach === 'NONE',
|
|
25
34
|
[styles.bordersAttach.complete.LEFT]: !notch && attach === 'LEFT',
|
|
26
35
|
[styles.bordersAttach.complete.RIGHT]: !notch && attach === 'RIGHT',
|
|
27
36
|
[styles.bordersAttach.complete.TOP]: !notch && attach === 'TOP',
|
|
@@ -33,6 +42,10 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
|
|
|
33
42
|
[styles.borders.root.disabled]: disabled,
|
|
34
43
|
}), pointerEvents: "none", position: "absolute", display: "flex", width: "full", height: "full", textAlign: "left" },
|
|
35
44
|
React.createElement("div", { className: clsx(styles.borders.leading, borderColourClassName, {
|
|
45
|
+
[styles.bordersMerged.complete.LEFT]: shouldMerge && borderMerged === 'LEFT',
|
|
46
|
+
[styles.bordersMerged.complete.TOP]: shouldMerge && borderMerged === 'TOP',
|
|
47
|
+
[styles.bordersMerged.complete.BOTTOM]: shouldMerge && borderMerged === 'BOTTOM',
|
|
48
|
+
[styles.bordersMerged.complete.ALL]: shouldMerge && borderMerged === 'ALL',
|
|
36
49
|
[styles.bordersAttach.flatCorners.TOP_LEFT]: attach === 'LEFT' ||
|
|
37
50
|
attach === 'TOP' ||
|
|
38
51
|
attach === 'ALL',
|
|
@@ -42,6 +55,10 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
|
|
|
42
55
|
}) }),
|
|
43
56
|
React.createElement("div", { className: clsx(styles.borders.middle, borderColourClassName), style: { width: isEmpty ? 0 : notchedWidth } },
|
|
44
57
|
React.createElement(Box, { ref: labelRef, is: "label", pointerEvents: "none", htmlFor: id, position: "absolute", display: "inline", margin: "none", padding: "none", className: clsx(styles.placeholder.default, placeholderColourClassName, labelStyles, {
|
|
58
|
+
[styles.bordersMerged.complete.TOP]: shouldMerge && borderMerged === 'TOP',
|
|
59
|
+
[styles.bordersMerged.complete.BOTTOM]: shouldMerge &&
|
|
60
|
+
borderMerged === 'BOTTOM',
|
|
61
|
+
[styles.bordersMerged.complete.ALL]: shouldMerge && borderMerged === 'ALL',
|
|
45
62
|
[styles.placeholder.mutedLabelStyles]: isEmpty || disabled,
|
|
46
63
|
[styles.placeholderPlacement[size].default]: isEmpty && !prefixed,
|
|
47
64
|
[styles.placeholderPlacement[size]
|
|
@@ -49,6 +66,10 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
|
|
|
49
66
|
[styles.placeholderPlacement[size].shifted]: !isEmpty,
|
|
50
67
|
}) }, placeholder)),
|
|
51
68
|
React.createElement("div", { className: clsx(styles.borders.trailing, borderColourClassName, borderColourClassName, {
|
|
69
|
+
[styles.bordersMerged.complete.RIGHT]: shouldMerge && borderMerged === 'RIGHT',
|
|
70
|
+
[styles.bordersMerged.complete.TOP]: shouldMerge && borderMerged === 'TOP',
|
|
71
|
+
[styles.bordersMerged.complete.BOTTOM]: shouldMerge && borderMerged === 'BOTTOM',
|
|
72
|
+
[styles.bordersMerged.complete.ALL]: shouldMerge && borderMerged === 'ALL',
|
|
52
73
|
[styles.bordersAttach.flatCorners.TOP_RIGHT]: attach === 'RIGHT' ||
|
|
53
74
|
attach === 'TOP' ||
|
|
54
75
|
attach === 'ALL',
|
|
@@ -13,7 +13,7 @@ export interface EventHandlers<PrimitiveElementType> {
|
|
|
13
13
|
onMouseLeave?: MouseEventHandler<PrimitiveElementType>;
|
|
14
14
|
onReset?(): void;
|
|
15
15
|
}
|
|
16
|
-
export interface EnhanceInputPrimitiveProps extends AriaAttributes, Pick<ComponentProps<typeof NotchedBase>, 'notch' | 'placeholder' | 'attach'> {
|
|
16
|
+
export interface EnhanceInputPrimitiveProps extends AriaAttributes, Pick<ComponentProps<typeof NotchedBase>, 'notch' | 'placeholder' | 'attach' | 'borderMerged' | 'isFocused'> {
|
|
17
17
|
name: string;
|
|
18
18
|
id?: string;
|
|
19
19
|
className?: string;
|
|
@@ -28,7 +28,6 @@ export interface EnhanceInputPrimitiveProps extends AriaAttributes, Pick<Compone
|
|
|
28
28
|
suffixIcon?: IconType;
|
|
29
29
|
wrapperRef?: Ref<HTMLDivElement>;
|
|
30
30
|
isLoading?: boolean;
|
|
31
|
-
isFocused?: boolean;
|
|
32
31
|
}
|
|
33
32
|
export interface ValidationProps {
|
|
34
33
|
isTouched?: boolean;
|
|
@@ -43,12 +42,11 @@ export declare type WrappedComponentProps<IncomingProps, PrimitiveElementType> =
|
|
|
43
42
|
ref: MutableRefObject<PrimitiveElementType>;
|
|
44
43
|
};
|
|
45
44
|
fieldIcon?: EnhanceInputPrimitiveProps['fieldIcon'];
|
|
46
|
-
isFocused?: boolean;
|
|
47
45
|
className?: boolean;
|
|
48
46
|
prefixed: boolean;
|
|
49
47
|
suffixed: boolean;
|
|
50
48
|
isLoading: boolean;
|
|
51
|
-
} & IncomingProps & Pick<ComponentProps<typeof NotchedBase>, 'attach'>;
|
|
49
|
+
} & IncomingProps & Pick<ComponentProps<typeof NotchedBase>, 'attach' | 'borderMerged' | 'isFocused'>;
|
|
52
50
|
interface EnhancedInputConfigs<ValueType = string> {
|
|
53
51
|
defaultValue?: ValueType;
|
|
54
52
|
withPrefixIcon?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withEnhancedInput.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/withEnhancedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,GAAG,EAGH,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAGlD,MAAM,WAAW,aAAa,CAAC,oBAAoB;IAClD,QAAQ,CAAC,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAEvD,OAAO,CAAC,IAAI,IAAI,CAAC;CACjB;AAGD,MAAM,WAAW,0BAChB,SAAQ,cAAc,EACrB,IAAI,CACH,cAAc,CAAC,OAAO,WAAW,CAAC,EAClC,OAAO,GAAG,aAAa,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"withEnhancedInput.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/withEnhancedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,GAAG,EAGH,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAGlD,MAAM,WAAW,aAAa,CAAC,oBAAoB;IAClD,QAAQ,CAAC,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAEvD,OAAO,CAAC,IAAI,IAAI,CAAC;CACjB;AAGD,MAAM,WAAW,0BAChB,SAAQ,cAAc,EACrB,IAAI,CACH,cAAc,CAAC,OAAO,WAAW,CAAC,EAClC,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,CACjE;I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pB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACnB,GAAG,aAAa,GAChB,IAAI,CACH,cAAc,CAAC,OAAO,WAAW,CAAC,EAClC,QAAQ,GAAG,cAAc,GAAG,WAAW,CACvC,CAAC;AAEH,UAAU,oBAAoB,CAAC,SAAS,GAAG,MAAM;IAChD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC5E;AAED,eAAO,MAAM,iBAAiB,sQAY1B,oBAAoB,+JA0PtB,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { HintText } from './HintText';
|
|
|
10
10
|
import * as inputStateStyles from './InputState.css';
|
|
11
11
|
import { NotchedBase } from './NotchedBase';
|
|
12
12
|
import * as styles from './withEnhancedInput.css';
|
|
13
|
-
export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', withPrefixIcon = true, withSuffixIcon = true, defaultValue, } = { primitiveType: 'text', defaultValue: void 0 }) => forwardRef(({ placeholder, name, id = name, hintText, disabled = false, className, isTouched, isValid, isLoading = false, notch = true, reserveHintSpace = false, size = 'medium', value: incomingValue = defaultValue || '', onChange: incomingOnChange, onReset, onMouseLeave, onMouseEnter, onBlur, onFocus, onKeyDown, prefixIcon, suffixIcon, wrapperRef, autoFocus, attach, ...rest }, ref) => {
|
|
13
|
+
export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', withPrefixIcon = true, withSuffixIcon = true, defaultValue, } = { primitiveType: 'text', defaultValue: void 0 }) => forwardRef(({ placeholder, name, id = name, hintText, disabled = false, className, isTouched, isValid, isLoading = false, notch = true, reserveHintSpace = false, size = 'medium', value: incomingValue = defaultValue || '', onChange: incomingOnChange, onReset, onMouseLeave, onMouseEnter, onBlur, onFocus, onKeyDown, prefixIcon, suffixIcon, wrapperRef, autoFocus, attach, borderMerged, ...rest }, ref) => {
|
|
14
14
|
invariant(!(prefixIcon && !withPrefixIcon), 'prefix icon is not supported for this component');
|
|
15
15
|
invariant(!(suffixIcon && !withSuffixIcon), 'suffix icon is not supported for this component');
|
|
16
16
|
const [value, onChange] = useInputControlledState(incomingValue, incomingOnChange);
|
|
@@ -83,7 +83,7 @@ export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', w
|
|
|
83
83
|
position: 'absolute',
|
|
84
84
|
});
|
|
85
85
|
return (React.createElement(Box, { width: "full", className: className, onMouseEnter: onMouseOver, onMouseLeave: onMouseOut },
|
|
86
|
-
React.createElement(NotchedBase, { id: id, prefixed: Boolean(prefixIcon), isEmpty: isEmpty, size: size, disabled: disabled, notch: notch, placeholder: placeholder, attach: attach, placeholderColourClassName: clsx({
|
|
86
|
+
React.createElement(NotchedBase, { id: id, prefixed: Boolean(prefixIcon), isEmpty: isEmpty, size: size, disabled: disabled, notch: notch, placeholder: placeholder, attach: attach, borderMerged: borderMerged, isFocused: isActive, isHovered: isHovered, placeholderColourClassName: clsx({
|
|
87
87
|
[derivedColours.colour]: !isEmpty,
|
|
88
88
|
}), borderColourClassName: derivedColours.borderColour },
|
|
89
89
|
React.createElement(Box, { ref: wrapperRef, className: styles.inputWrapperSize[size].root[primitiveType], width: "full", height: "full" },
|