@transferwise/components 0.0.0-experimental-bfa3811 → 0.0.0-experimental-db49ba8
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/build/Chips/Chip/Chip.js +4 -11
- package/build/Chips/Chip/Chip.js.map +1 -1
- package/build/Chips/Chip/Chip.mjs +4 -11
- package/build/Chips/Chip/Chip.mjs.map +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.js +1 -0
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.js.map +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.mjs +1 -0
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/FlowNavigation/FlowNavigation.js +2 -1
- package/build/FlowNavigation/FlowNavigation.js.map +1 -1
- package/build/FlowNavigation/FlowNavigation.mjs +2 -1
- package/build/FlowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/Typeahead/Typeahead.js +4 -17
- package/build/Typeahead/Typeahead.js.map +1 -1
- package/build/Typeahead/Typeahead.mjs +4 -17
- package/build/Typeahead/Typeahead.mjs.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js +0 -2
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs +0 -2
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/main.css +7 -3
- package/build/styles/FlowNavigation/AnimatedLabel/AnimatedLabel.css +1 -0
- package/build/styles/FlowNavigation/FlowNavigation.css +6 -0
- package/build/styles/Typeahead/Typeahead.css +0 -3
- package/build/styles/main.css +7 -3
- package/build/types/Chips/Chip/Chip.d.ts +1 -3
- package/build/types/Chips/Chip/Chip.d.ts.map +1 -1
- package/build/types/FlowNavigation/AnimatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/Typeahead/Typeahead.d.ts +0 -2
- package/build/types/Typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts +1 -1
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Chips/Chip/Chip.tsx +3 -11
- package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.css +1 -0
- package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.less +1 -0
- package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.tsx +5 -0
- package/src/FlowNavigation/FlowNavigation.css +6 -0
- package/src/FlowNavigation/FlowNavigation.less +7 -0
- package/src/FlowNavigation/FlowNavigation.tsx +2 -2
- package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +25 -0
- package/src/Typeahead/Typeahead.css +0 -3
- package/src/Typeahead/Typeahead.less +0 -4
- package/src/Typeahead/Typeahead.test.tsx +0 -73
- package/src/Typeahead/Typeahead.tsx +3 -18
- package/src/Typeahead/TypeaheadInput/TypeaheadInput.tsx +1 -6
- package/src/Typeahead/_stories/Typeahead.story.tsx +0 -1
- package/src/Typeahead/_stories/Typeahead.test.story.tsx +0 -41
- package/src/main.css +7 -3
- package/src/Chips/Chip/Chip.test.tsx +0 -34
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
border-block-end: 1px solid #0000001a;
|
|
26
26
|
border-block-end: 1px solid var(--color-border-neutral);
|
|
27
27
|
}
|
|
28
|
+
.np-flow-navigation__left {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
flex: 1;
|
|
32
|
+
min-inline-size: 0;
|
|
33
|
+
}
|
|
28
34
|
.np-flow-navigation__content {
|
|
29
35
|
inline-size: 100%;
|
|
30
36
|
min-inline-size: 320px;
|
package/build/styles/main.css
CHANGED
|
@@ -22987,6 +22987,7 @@ button.np-option {
|
|
|
22987
22987
|
overflow: hidden;
|
|
22988
22988
|
position: relative;
|
|
22989
22989
|
padding-block-start: 1px;
|
|
22990
|
+
min-inline-size: 0;
|
|
22990
22991
|
}
|
|
22991
22992
|
.np-animated-label > * {
|
|
22992
22993
|
block-size: 0;
|
|
@@ -23041,6 +23042,12 @@ button.np-option {
|
|
|
23041
23042
|
border-block-end: 1px solid #0000001a;
|
|
23042
23043
|
border-block-end: 1px solid var(--color-border-neutral);
|
|
23043
23044
|
}
|
|
23045
|
+
.np-flow-navigation__left {
|
|
23046
|
+
display: flex;
|
|
23047
|
+
align-items: center;
|
|
23048
|
+
flex: 1;
|
|
23049
|
+
min-inline-size: 0;
|
|
23050
|
+
}
|
|
23044
23051
|
.np-flow-navigation__content {
|
|
23045
23052
|
inline-size: 100%;
|
|
23046
23053
|
min-inline-size: 320px;
|
|
@@ -27578,9 +27585,6 @@ button.np-link {
|
|
|
27578
27585
|
cursor: text;
|
|
27579
27586
|
display: flex;
|
|
27580
27587
|
}
|
|
27581
|
-
.typeahead--multiple .input-group.disabled .typeahead__input-container {
|
|
27582
|
-
cursor: not-allowed;
|
|
27583
|
-
}
|
|
27584
27588
|
.typeahead--multiple .sizer {
|
|
27585
27589
|
white-space: pre;
|
|
27586
27590
|
position: absolute;
|
|
@@ -6,12 +6,10 @@ export type ChipProps<T extends ChipValue = ChipValue> = {
|
|
|
6
6
|
onRemove?: () => void;
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
onKeyPress?: () => void;
|
|
9
|
-
/** @default false */
|
|
10
|
-
disabled?: boolean;
|
|
11
9
|
closeButton?: AriaLabelProperty;
|
|
12
10
|
'aria-checked'?: boolean;
|
|
13
11
|
role?: string;
|
|
14
12
|
} & AriaLabelProperty & CommonProps;
|
|
15
|
-
declare const Chip: <T extends ChipValue = ChipValue>({ label, value, onRemove, onClick, onKeyPress,
|
|
13
|
+
declare const Chip: <T extends ChipValue = ChipValue>({ label, value, onRemove, onClick, onKeyPress, className, "aria-label": ariaLabel, "aria-checked": ariaChecked, role, closeButton, }: ChipProps<T>) => import("react").JSX.Element;
|
|
16
14
|
export default Chip;
|
|
17
15
|
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/Chips/Chip/Chip.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAc,MAAM,cAAc,CAAC;AAG1E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI;IACvD,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/Chips/Chip/Chip.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAc,MAAM,cAAc,CAAC;AAG1E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI;IACvD,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,iBAAiB,GACnB,WAAW,CAAC;AAEd,QAAA,MAAM,IAAI,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,sIAW5C,SAAS,CAAC,CAAC,CAAC,gCA8Cd,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/FlowNavigation/AnimatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAOlD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,GAAI,mCAAmC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/FlowNavigation/AnimatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAOlD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,GAAI,mCAAmC,kBAAkB,gCAqG3E,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -32,8 +32,6 @@ export interface TypeaheadProps<T> extends Partial<WrappedComponentProps> {
|
|
|
32
32
|
chipSeparators?: readonly string[];
|
|
33
33
|
/** @default true */
|
|
34
34
|
clearable?: boolean;
|
|
35
|
-
/** @default false */
|
|
36
|
-
disabled?: boolean;
|
|
37
35
|
footer?: ReactNode;
|
|
38
36
|
/** @default [] */
|
|
39
37
|
initialValue?: readonly TypeaheadOption<T>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../../src/Typeahead/Typeahead.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,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|
12
12
|
onPaste: React.ClipboardEventHandler<HTMLInputElement>;
|
|
13
13
|
renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;
|
|
14
14
|
ariaActivedescendant?: string;
|
|
15
|
-
} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | '
|
|
15
|
+
} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;
|
|
16
16
|
type TypeaheadInputState = {
|
|
17
17
|
inputWidth: number;
|
|
18
18
|
keyboardFocusedOptionIndex: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.d.ts","sourceRoot":"","sources":["../../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM/D,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACrD,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACnE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,GAAG,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iC;IACzC,QAAQ,4CAA+B;gBAE3B,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAQzC,iBAAiB;IAUjB,kBAAkB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAMxD,gBAAgB,aAMd;IAEF,WAAW,GAAI,OAAO,OAAO,iCA6C3B;IAEF,MAAM;CAiCP"}
|
package/package.json
CHANGED
package/src/Chips/Chip/Chip.tsx
CHANGED
|
@@ -13,8 +13,6 @@ export type ChipProps<T extends ChipValue = ChipValue> = {
|
|
|
13
13
|
onRemove?: () => void;
|
|
14
14
|
onClick?: () => void;
|
|
15
15
|
onKeyPress?: () => void;
|
|
16
|
-
/** @default false */
|
|
17
|
-
disabled?: boolean;
|
|
18
16
|
closeButton?: AriaLabelProperty;
|
|
19
17
|
'aria-checked'?: boolean;
|
|
20
18
|
role?: string;
|
|
@@ -27,7 +25,6 @@ const Chip = <T extends ChipValue = ChipValue>({
|
|
|
27
25
|
onRemove,
|
|
28
26
|
onClick,
|
|
29
27
|
onKeyPress,
|
|
30
|
-
disabled = false,
|
|
31
28
|
className = undefined,
|
|
32
29
|
'aria-label': ariaLabel,
|
|
33
30
|
'aria-checked': ariaChecked,
|
|
@@ -35,10 +32,8 @@ const Chip = <T extends ChipValue = ChipValue>({
|
|
|
35
32
|
closeButton,
|
|
36
33
|
}: ChipProps<T>) => {
|
|
37
34
|
const isActionable = onClick || onKeyPress;
|
|
38
|
-
const isInteractive = isActionable && !disabled;
|
|
39
35
|
const defaultRole = isActionable ? 'button' : undefined;
|
|
40
|
-
const
|
|
41
|
-
const tabIndex = isInteractive ? 0 : -1;
|
|
36
|
+
const tabIndex = isActionable ? 0 : -1;
|
|
42
37
|
|
|
43
38
|
const closeButtonReference = useRef<HTMLButtonElement>(null);
|
|
44
39
|
const previousCloseButtonShown = useRef<boolean | undefined>(undefined);
|
|
@@ -52,21 +47,19 @@ const Chip = <T extends ChipValue = ChipValue>({
|
|
|
52
47
|
return (
|
|
53
48
|
<div
|
|
54
49
|
key={value}
|
|
55
|
-
role={
|
|
50
|
+
role={role ?? defaultRole}
|
|
56
51
|
tabIndex={tabIndex}
|
|
57
52
|
aria-label={ariaLabel}
|
|
58
53
|
aria-checked={ariaChecked}
|
|
59
|
-
aria-disabled={chipRole && disabled ? true : undefined}
|
|
60
54
|
className={clsx(
|
|
61
55
|
'np-chip',
|
|
62
56
|
'd-flex',
|
|
63
57
|
'align-items-center',
|
|
64
58
|
'justify-content-between',
|
|
65
59
|
onRemove ? 'np-chip--removable' : '',
|
|
66
|
-
{ disabled },
|
|
67
60
|
className,
|
|
68
61
|
)}
|
|
69
|
-
{...(
|
|
62
|
+
{...(isActionable && { onClick, onKeyPress })}
|
|
70
63
|
>
|
|
71
64
|
<Body aria-hidden={!!onRemove} type={Typography.BODY_DEFAULT_BOLD}>
|
|
72
65
|
{label}
|
|
@@ -78,7 +71,6 @@ const Chip = <T extends ChipValue = ChipValue>({
|
|
|
78
71
|
aria-label={closeButton?.['aria-label']}
|
|
79
72
|
size="sm"
|
|
80
73
|
filled
|
|
81
|
-
isDisabled={disabled}
|
|
82
74
|
onClick={onRemove}
|
|
83
75
|
/>
|
|
84
76
|
) : null}
|
|
@@ -37,6 +37,11 @@ const AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) =>
|
|
|
37
37
|
aria-haspopup="menu"
|
|
38
38
|
aria-controls={overlayId}
|
|
39
39
|
aria-expanded={showSteps}
|
|
40
|
+
title={
|
|
41
|
+
typeof steps[activeLabel]?.label === 'string'
|
|
42
|
+
? steps[activeLabel].label
|
|
43
|
+
: undefined
|
|
44
|
+
}
|
|
40
45
|
className={clsx(
|
|
41
46
|
'np-animated-label',
|
|
42
47
|
'btn-unstyled',
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
border-block-end: 1px solid #0000001a;
|
|
26
26
|
border-block-end: 1px solid var(--color-border-neutral);
|
|
27
27
|
}
|
|
28
|
+
.np-flow-navigation__left {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
flex: 1;
|
|
32
|
+
min-inline-size: 0;
|
|
33
|
+
}
|
|
28
34
|
.np-flow-navigation__content {
|
|
29
35
|
inline-size: 100%;
|
|
30
36
|
min-inline-size: 320px;
|
|
@@ -76,7 +76,7 @@ const FlowNavigation = ({
|
|
|
76
76
|
},
|
|
77
77
|
)}
|
|
78
78
|
leftContent={
|
|
79
|
-
|
|
79
|
+
<div className="np-flow-navigation__left">
|
|
80
80
|
{!screenSm && displayGoBack ? (
|
|
81
81
|
<IconButton
|
|
82
82
|
size={40}
|
|
@@ -93,7 +93,7 @@ const FlowNavigation = ({
|
|
|
93
93
|
{!screenSm && !done && hasSteps && (
|
|
94
94
|
<AnimatedLabel className="m-x-1" steps={steps} activeLabel={activeStep} />
|
|
95
95
|
)}
|
|
96
|
-
|
|
96
|
+
</div>
|
|
97
97
|
}
|
|
98
98
|
rightContent={
|
|
99
99
|
<div className="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg">
|
|
@@ -127,3 +127,28 @@ export const CriticalBannerMobile: Story = {
|
|
|
127
127
|
),
|
|
128
128
|
...withVariantConfig(['mobile']),
|
|
129
129
|
};
|
|
130
|
+
|
|
131
|
+
const LongLabelGerman: Story = {
|
|
132
|
+
render: () => (
|
|
133
|
+
<FlowNavigation
|
|
134
|
+
{...baseProps}
|
|
135
|
+
steps={[
|
|
136
|
+
{ label: 'Überweisungsbetrag', hoverLabel: '100 EUR', onClick: noop },
|
|
137
|
+
{ label: 'Zahlungsempfänger', hoverLabel: 'Max Mustermann', onClick: noop },
|
|
138
|
+
{
|
|
139
|
+
label: 'Zahlungsempfängerbestätigung',
|
|
140
|
+
hoverLabel: 'IBAN DE89370400440532013000',
|
|
141
|
+
onClick: noop,
|
|
142
|
+
},
|
|
143
|
+
{ label: 'Zusammenfassung', hoverLabel: 'Alles korrekt', onClick: noop },
|
|
144
|
+
{ label: 'Bezahlen', hoverLabel: 'Jetzt bezahlen', onClick: noop },
|
|
145
|
+
]}
|
|
146
|
+
activeStep={2}
|
|
147
|
+
/>
|
|
148
|
+
),
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const LongLabelGermanMobile: Story = {
|
|
152
|
+
...LongLabelGerman,
|
|
153
|
+
...withVariantConfig(['mobile'], LongLabelGerman),
|
|
154
|
+
};
|
|
@@ -256,77 +256,4 @@ describe('Typeahead', () => {
|
|
|
256
256
|
expect.arrayContaining([{ label: 'foo' }, { label: 'bar' }]),
|
|
257
257
|
);
|
|
258
258
|
});
|
|
259
|
-
|
|
260
|
-
describe('when disabled', () => {
|
|
261
|
-
it('disables the input', () => {
|
|
262
|
-
render(<Typeahead id="test" name="test" options={[]} disabled onChange={() => {}} />);
|
|
263
|
-
expect(screen.getByRole('combobox')).toBeDisabled();
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it('does not show the clear button when there is a value', () => {
|
|
267
|
-
render(
|
|
268
|
-
<Typeahead
|
|
269
|
-
id="test"
|
|
270
|
-
name="test"
|
|
271
|
-
options={[]}
|
|
272
|
-
initialValue={[{ label: 'Chip' }]}
|
|
273
|
-
disabled
|
|
274
|
-
onChange={() => {}}
|
|
275
|
-
/>,
|
|
276
|
-
);
|
|
277
|
-
expect(screen.queryByRole('button', { name: /clear/i })).not.toBeInTheDocument();
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('keeps chips but does not let them be removed', () => {
|
|
281
|
-
render(
|
|
282
|
-
<Typeahead
|
|
283
|
-
id="test"
|
|
284
|
-
name="test"
|
|
285
|
-
options={[]}
|
|
286
|
-
multiple
|
|
287
|
-
initialValue={[{ label: 'Chip' }]}
|
|
288
|
-
disabled
|
|
289
|
-
onChange={() => {}}
|
|
290
|
-
/>,
|
|
291
|
-
);
|
|
292
|
-
expect(screen.getByText('Chip').closest('.np-chip')).toHaveClass('disabled');
|
|
293
|
-
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('does not open the suggestions when the input is clicked', async () => {
|
|
297
|
-
render(
|
|
298
|
-
<Typeahead
|
|
299
|
-
id="test"
|
|
300
|
-
name="test"
|
|
301
|
-
options={[{ label: 'Option 1' }]}
|
|
302
|
-
minQueryLength={0}
|
|
303
|
-
disabled
|
|
304
|
-
onChange={() => {}}
|
|
305
|
-
/>,
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
await userEvent.click(screen.getByRole('combobox'));
|
|
309
|
-
|
|
310
|
-
expect(screen.getByRole('combobox')).toHaveAttribute('aria-expanded', 'false');
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
it('closes the open menu when it becomes disabled', async () => {
|
|
314
|
-
const onChange = jest.fn();
|
|
315
|
-
const props = {
|
|
316
|
-
id: 'test',
|
|
317
|
-
name: 'test',
|
|
318
|
-
options: [],
|
|
319
|
-
allowNew: true,
|
|
320
|
-
minQueryLength: 0,
|
|
321
|
-
onChange,
|
|
322
|
-
};
|
|
323
|
-
const { rerender } = render(<Typeahead {...props} />);
|
|
324
|
-
|
|
325
|
-
await userEvent.type(screen.getByRole('combobox'), 'New thing');
|
|
326
|
-
rerender(<Typeahead {...props} disabled />);
|
|
327
|
-
await userEvent.click(document.body);
|
|
328
|
-
|
|
329
|
-
expect(onChange).not.toHaveBeenCalled();
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
259
|
});
|
|
@@ -61,8 +61,6 @@ export interface TypeaheadProps<T> extends Partial<WrappedComponentProps> {
|
|
|
61
61
|
chipSeparators?: readonly string[];
|
|
62
62
|
/** @default true */
|
|
63
63
|
clearable?: boolean;
|
|
64
|
-
/** @default false */
|
|
65
|
-
disabled?: boolean;
|
|
66
64
|
footer?: ReactNode;
|
|
67
65
|
/** @default [] */
|
|
68
66
|
initialValue?: readonly TypeaheadOption<T>[];
|
|
@@ -114,7 +112,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
114
112
|
autoFocus: false,
|
|
115
113
|
chipSeparators: [],
|
|
116
114
|
clearable: true,
|
|
117
|
-
disabled: false,
|
|
118
115
|
initialValue: [],
|
|
119
116
|
inputAutoComplete: 'new-password',
|
|
120
117
|
minQueryLength: DEFAULT_MIN_QUERY_LENGTH,
|
|
@@ -163,12 +160,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
163
160
|
}
|
|
164
161
|
}
|
|
165
162
|
|
|
166
|
-
componentDidUpdate(previousProps: TypeaheadPropsWithInputAttributes<T>) {
|
|
167
|
-
if (this.props.disabled && !previousProps.disabled) {
|
|
168
|
-
this.hideMenu();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
163
|
componentWillUnmount() {
|
|
173
164
|
this.handleSearchDebounced.cancel();
|
|
174
165
|
}
|
|
@@ -407,7 +398,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
407
398
|
};
|
|
408
399
|
|
|
409
400
|
renderChip = (option: TypeaheadOption<T>, idx: number): ReactNode => {
|
|
410
|
-
const { disabled } = this.props;
|
|
411
401
|
const valid = this.props.validateChip?.(option);
|
|
412
402
|
|
|
413
403
|
return (
|
|
@@ -418,8 +408,7 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
418
408
|
'has-error': !valid,
|
|
419
409
|
'np-chip--valid': valid,
|
|
420
410
|
})}
|
|
421
|
-
|
|
422
|
-
onRemove={disabled ? undefined : () => this.removeChip(option)}
|
|
411
|
+
onRemove={() => this.removeChip(option)}
|
|
423
412
|
/>
|
|
424
413
|
);
|
|
425
414
|
};
|
|
@@ -497,7 +486,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
497
486
|
addon,
|
|
498
487
|
name,
|
|
499
488
|
clearable,
|
|
500
|
-
disabled,
|
|
501
489
|
allowNew,
|
|
502
490
|
footer,
|
|
503
491
|
showSuggestions,
|
|
@@ -513,10 +501,9 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
513
501
|
|
|
514
502
|
const { errorState, query, selected, optionsShown, keyboardFocusedOptionIndex } = this.state;
|
|
515
503
|
|
|
516
|
-
const clearButton =
|
|
504
|
+
const clearButton = clearable && (query || selected.length > 0);
|
|
517
505
|
|
|
518
|
-
const dropdownOpen =
|
|
519
|
-
!disabled && optionsShown && showSuggestions && query.length >= minQueryLength;
|
|
506
|
+
const dropdownOpen = optionsShown && showSuggestions && query.length >= minQueryLength;
|
|
520
507
|
|
|
521
508
|
const menu = this.renderMenu({
|
|
522
509
|
footer,
|
|
@@ -569,7 +556,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
569
556
|
<div
|
|
570
557
|
className={clsx(`input-group input-group-${size}`, {
|
|
571
558
|
'input-group--has-error': hasError,
|
|
572
|
-
disabled,
|
|
573
559
|
})}
|
|
574
560
|
>
|
|
575
561
|
{addon && <span className="input-group-addon input-group-addon--search">{addon}</span>}
|
|
@@ -577,7 +563,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
|
|
|
577
563
|
<TypeaheadInput
|
|
578
564
|
{...{
|
|
579
565
|
autoFocus,
|
|
580
|
-
disabled,
|
|
581
566
|
multiple,
|
|
582
567
|
dropdownOpen,
|
|
583
568
|
placeholder,
|
|
@@ -23,10 +23,7 @@ export type TypeaheadInputProps<T> = {
|
|
|
23
23
|
onPaste: React.ClipboardEventHandler<HTMLInputElement>;
|
|
24
24
|
renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;
|
|
25
25
|
ariaActivedescendant?: string;
|
|
26
|
-
} & Pick<
|
|
27
|
-
TypeaheadProps<T>,
|
|
28
|
-
'id' | 'name' | 'autoFocus' | 'disabled' | 'multiple' | 'placeholder' | 'maxHeight'
|
|
29
|
-
>;
|
|
26
|
+
} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;
|
|
30
27
|
|
|
31
28
|
type TypeaheadInputState = {
|
|
32
29
|
inputWidth: number;
|
|
@@ -76,7 +73,6 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
76
73
|
const {
|
|
77
74
|
typeaheadId,
|
|
78
75
|
autoFocus,
|
|
79
|
-
disabled,
|
|
80
76
|
multiple,
|
|
81
77
|
name,
|
|
82
78
|
dropdownOpen,
|
|
@@ -102,7 +98,6 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
102
98
|
id={`input-${typeaheadId}`}
|
|
103
99
|
aria-activedescendant={ariaActivedescendant}
|
|
104
100
|
autoFocus={autoFocus}
|
|
105
|
-
disabled={disabled}
|
|
106
101
|
placeholder={hasPlaceholder ? placeholder : ''}
|
|
107
102
|
aria-autocomplete="list"
|
|
108
103
|
aria-expanded={dropdownOpen}
|
|
@@ -3,7 +3,6 @@ import { Search as SearchIcon } from '@transferwise/icons';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import Button from '../../Button';
|
|
6
|
-
import Field from '../../Field/Field';
|
|
7
6
|
import Modal from '../../Modal';
|
|
8
7
|
import Typeahead from '../Typeahead';
|
|
9
8
|
|
|
@@ -18,46 +17,6 @@ const meta: Meta<typeof Typeahead> = {
|
|
|
18
17
|
};
|
|
19
18
|
export default meta;
|
|
20
19
|
|
|
21
|
-
export const Disabled: Story = {
|
|
22
|
-
render: () => (
|
|
23
|
-
<div className="d-flex flex-column">
|
|
24
|
-
<Field id="typeahead-disabled-empty" label="Empty">
|
|
25
|
-
<Typeahead
|
|
26
|
-
id="typeahead-disabled-empty"
|
|
27
|
-
name="typeahead-disabled-empty"
|
|
28
|
-
disabled
|
|
29
|
-
placeholder="Search currencies"
|
|
30
|
-
addon={<SearchIcon size={24} />}
|
|
31
|
-
options={[]}
|
|
32
|
-
onChange={() => {}}
|
|
33
|
-
/>
|
|
34
|
-
</Field>
|
|
35
|
-
<Field id="typeahead-disabled-value" label="With a value">
|
|
36
|
-
<Typeahead
|
|
37
|
-
id="typeahead-disabled-value"
|
|
38
|
-
name="typeahead-disabled-value"
|
|
39
|
-
disabled
|
|
40
|
-
addon={<SearchIcon size={24} />}
|
|
41
|
-
initialValue={[{ label: 'British pound' }]}
|
|
42
|
-
options={[]}
|
|
43
|
-
onChange={() => {}}
|
|
44
|
-
/>
|
|
45
|
-
</Field>
|
|
46
|
-
<Field id="typeahead-disabled-chips" label="With chips">
|
|
47
|
-
<Typeahead
|
|
48
|
-
id="typeahead-disabled-chips"
|
|
49
|
-
name="typeahead-disabled-chips"
|
|
50
|
-
disabled
|
|
51
|
-
multiple
|
|
52
|
-
initialValue={[{ label: 'British pound' }, { label: 'Euro' }]}
|
|
53
|
-
options={[]}
|
|
54
|
-
onChange={() => {}}
|
|
55
|
-
/>
|
|
56
|
-
</Field>
|
|
57
|
-
</div>
|
|
58
|
-
),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
20
|
export const AutoFocusInModal: Story = {
|
|
62
21
|
parameters: {
|
|
63
22
|
docs: {
|
package/src/main.css
CHANGED
|
@@ -22987,6 +22987,7 @@ button.np-option {
|
|
|
22987
22987
|
overflow: hidden;
|
|
22988
22988
|
position: relative;
|
|
22989
22989
|
padding-block-start: 1px;
|
|
22990
|
+
min-inline-size: 0;
|
|
22990
22991
|
}
|
|
22991
22992
|
.np-animated-label > * {
|
|
22992
22993
|
block-size: 0;
|
|
@@ -23041,6 +23042,12 @@ button.np-option {
|
|
|
23041
23042
|
border-block-end: 1px solid #0000001a;
|
|
23042
23043
|
border-block-end: 1px solid var(--color-border-neutral);
|
|
23043
23044
|
}
|
|
23045
|
+
.np-flow-navigation__left {
|
|
23046
|
+
display: flex;
|
|
23047
|
+
align-items: center;
|
|
23048
|
+
flex: 1;
|
|
23049
|
+
min-inline-size: 0;
|
|
23050
|
+
}
|
|
23044
23051
|
.np-flow-navigation__content {
|
|
23045
23052
|
inline-size: 100%;
|
|
23046
23053
|
min-inline-size: 320px;
|
|
@@ -27578,9 +27585,6 @@ button.np-link {
|
|
|
27578
27585
|
cursor: text;
|
|
27579
27586
|
display: flex;
|
|
27580
27587
|
}
|
|
27581
|
-
.typeahead--multiple .input-group.disabled .typeahead__input-container {
|
|
27582
|
-
cursor: not-allowed;
|
|
27583
|
-
}
|
|
27584
27588
|
.typeahead--multiple .sizer {
|
|
27585
27589
|
white-space: pre;
|
|
27586
27590
|
position: absolute;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { render, screen, userEvent } from '../../test-utils';
|
|
2
|
-
|
|
3
|
-
import Chip from './Chip';
|
|
4
|
-
|
|
5
|
-
describe('Chip', () => {
|
|
6
|
-
it('calls onClick when clicked', async () => {
|
|
7
|
-
const onClick = jest.fn();
|
|
8
|
-
render(<Chip label="Accounting" onClick={onClick} />);
|
|
9
|
-
|
|
10
|
-
await userEvent.click(screen.getByRole('button', { name: 'Accounting' }));
|
|
11
|
-
|
|
12
|
-
expect(onClick).toHaveBeenCalled();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('when disabled', () => {
|
|
16
|
-
it('does not call onClick when clicked', async () => {
|
|
17
|
-
const onClick = jest.fn();
|
|
18
|
-
render(<Chip label="Accounting" disabled onClick={onClick} />);
|
|
19
|
-
|
|
20
|
-
await userEvent.click(screen.getByRole('button', { name: 'Accounting' }));
|
|
21
|
-
|
|
22
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('marks an actionable chip as disabled and takes it out of the tab order', () => {
|
|
26
|
-
render(<Chip label="Accounting" disabled onClick={() => {}} />);
|
|
27
|
-
|
|
28
|
-
const chip = screen.getByRole('button', { name: 'Accounting' });
|
|
29
|
-
expect(chip).toHaveAttribute('aria-disabled', 'true');
|
|
30
|
-
expect(chip).toHaveAttribute('tabindex', '-1');
|
|
31
|
-
expect(chip).toHaveClass('disabled');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|