@transferwise/components 0.0.0-experimental-5125346 → 0.0.0-experimental-3b84ee4
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/i18n/en.json +1 -0
- package/build/index.js +2442 -2335
- package/build/index.js.map +1 -1
- package/build/index.mjs +2444 -2338
- package/build/index.mjs.map +1 -1
- package/build/main.css +54 -65
- package/build/styles/main.css +54 -65
- package/build/styles/selectOption/SelectOption.css +42 -0
- package/build/styles/uploadInput/UploadInput.css +1 -18
- package/build/styles/uploadInput/uploadButton/UploadButton.css +0 -4
- package/build/styles/uploadInput/uploadItem/UploadItem.css +11 -43
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -2
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/selectOption/SelectOption.d.ts +21 -0
- package/build/types/selectOption/SelectOption.d.ts.map +1 -0
- package/build/types/selectOption/SelectOption.messages.d.ts +8 -0
- package/build/types/selectOption/SelectOption.messages.d.ts.map +1 -0
- package/build/types/selectOption/index.d.ts +3 -0
- package/build/types/selectOption/index.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/common/responsivePanel/ResponsivePanel.tsx +2 -0
- package/src/i18n/en.json +1 -0
- package/src/index.ts +2 -0
- package/src/inlineAlert/InlineAlert.tsx +1 -1
- package/src/main.css +54 -65
- package/src/main.less +1 -0
- package/src/selectOption/SelectOption.css +42 -0
- package/src/selectOption/SelectOption.less +40 -0
- package/src/selectOption/SelectOption.messages.ts +8 -0
- package/src/selectOption/SelectOption.spec.tsx +101 -0
- package/src/selectOption/SelectOption.story.tsx +230 -0
- package/src/selectOption/SelectOption.tsx +157 -0
- package/src/selectOption/index.ts +2 -0
- package/src/ssr.spec.js +1 -0
- package/src/uploadInput/UploadInput.css +1 -18
- package/src/uploadInput/UploadInput.less +1 -17
- package/src/uploadInput/UploadInput.tests.story.tsx +2 -13
- package/src/uploadInput/uploadButton/UploadButton.css +0 -4
- package/src/uploadInput/uploadButton/UploadButton.less +0 -5
- package/src/uploadInput/uploadItem/UploadItem.css +11 -43
- package/src/uploadInput/uploadItem/UploadItem.less +17 -61
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { Flag } from '@wise/art';
|
|
3
|
+
import SelectOption, {
|
|
4
|
+
SelectOptionProps,
|
|
5
|
+
SelectOptionValue,
|
|
6
|
+
SelectOptiopsSection,
|
|
7
|
+
} from './SelectOption';
|
|
8
|
+
import { Bank, BankTransfer, Beach, Briefcase, Card, Plane } from '@transferwise/icons';
|
|
9
|
+
import { Field } from '../field/Field';
|
|
10
|
+
import { lorem10 } from '../test-utils';
|
|
11
|
+
import Badge from '../badge';
|
|
12
|
+
import Avatar from '../avatar';
|
|
13
|
+
import { Sentiment } from '../common';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Option/SelectOption',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof SelectOption>;
|
|
20
|
+
|
|
21
|
+
type CustomData = { data?: string };
|
|
22
|
+
|
|
23
|
+
function cardPaymentMethod(index?: number): SelectOptionValue<CustomData> {
|
|
24
|
+
return {
|
|
25
|
+
media: <Card />,
|
|
26
|
+
title: `Credit card ${index}`,
|
|
27
|
+
content: (
|
|
28
|
+
<>
|
|
29
|
+
<div>Transfer the money to Wise using your bank account.</div>
|
|
30
|
+
<div>0.32 GBP in fees, should arrive in seconds</div>
|
|
31
|
+
</>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const recentPaymentMethods: SelectOptionValue<CustomData>[] = [
|
|
37
|
+
cardPaymentMethod(1),
|
|
38
|
+
cardPaymentMethod(2),
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const allOtherPaymentMethods: SelectOptionValue<CustomData>[] = [
|
|
42
|
+
{
|
|
43
|
+
media: <Flag code="gbp" />,
|
|
44
|
+
title: 'Wise GBP balance',
|
|
45
|
+
content: (
|
|
46
|
+
<>
|
|
47
|
+
<span>300 GBP available</span>
|
|
48
|
+
<span>0 GBP in fees, should arrive in seconds</span>
|
|
49
|
+
</>
|
|
50
|
+
),
|
|
51
|
+
disabled: true,
|
|
52
|
+
value: { data: lorem10 },
|
|
53
|
+
},
|
|
54
|
+
cardPaymentMethod(),
|
|
55
|
+
{
|
|
56
|
+
media: <Card />,
|
|
57
|
+
title: 'Debit card',
|
|
58
|
+
content: (
|
|
59
|
+
<>
|
|
60
|
+
<span>Send from your Visa or Mastercard.</span>
|
|
61
|
+
<span>0.74 GBP in fees, should arrive in seconds</span>
|
|
62
|
+
</>
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
media: <Bank />,
|
|
67
|
+
title: 'Swift Transfer',
|
|
68
|
+
content: (
|
|
69
|
+
<>
|
|
70
|
+
<span>Send money internationally. Your bank will charge you extra fees.</span>
|
|
71
|
+
<span>0.32 GBP in fees, should arrive by Thursday</span>
|
|
72
|
+
</>
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
media: <BankTransfer />,
|
|
77
|
+
title: 'Bank Transfer',
|
|
78
|
+
content: (
|
|
79
|
+
<>
|
|
80
|
+
<span>Transfer the money to Wise using your bank account.</span>
|
|
81
|
+
<span>0.32 GBP in fees, should arrive in seconds</span>
|
|
82
|
+
</>
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
media: <BankTransfer />,
|
|
87
|
+
title: 'Withdraw from your U.S. bank account (ACH)',
|
|
88
|
+
content: (
|
|
89
|
+
<>
|
|
90
|
+
<span>1.63 USD in total fees.</span>
|
|
91
|
+
<span>
|
|
92
|
+
Pay with ACH using the bank account you’ve connected to Wise. Should arrive in seconds.
|
|
93
|
+
</span>
|
|
94
|
+
</>
|
|
95
|
+
),
|
|
96
|
+
},
|
|
97
|
+
cardPaymentMethod(1),
|
|
98
|
+
cardPaymentMethod(2),
|
|
99
|
+
cardPaymentMethod(3),
|
|
100
|
+
cardPaymentMethod(4),
|
|
101
|
+
cardPaymentMethod(5),
|
|
102
|
+
cardPaymentMethod(6),
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const paymentMethods: SelectOptiopsSection<CustomData>[] = [
|
|
106
|
+
{
|
|
107
|
+
title: 'Recently used',
|
|
108
|
+
options: recentPaymentMethods,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
title: 'Payment methods',
|
|
112
|
+
options: allOtherPaymentMethods,
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
const balances: SelectOptiopsSection[] = [
|
|
117
|
+
{
|
|
118
|
+
title: 'Balances',
|
|
119
|
+
options: [
|
|
120
|
+
{
|
|
121
|
+
media: <Flag code="gbp" />,
|
|
122
|
+
title: 'Wise GBP balance',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
media: <Flag code="eur" />,
|
|
126
|
+
title: 'Wise EUR balance',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
title: 'Jars',
|
|
132
|
+
options: [
|
|
133
|
+
{
|
|
134
|
+
media: (
|
|
135
|
+
<Badge badge={<Flag code="usd" />} size="md">
|
|
136
|
+
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-pink)">
|
|
137
|
+
<Beach size="24" />
|
|
138
|
+
</Avatar>
|
|
139
|
+
</Badge>
|
|
140
|
+
),
|
|
141
|
+
title: 'Hawaii Holiday',
|
|
142
|
+
content: 'Wise USD jar',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
media: (
|
|
146
|
+
<Badge badge={<Flag code="aed" />} size="md">
|
|
147
|
+
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-yellow)">
|
|
148
|
+
<Briefcase size="24" />
|
|
149
|
+
</Avatar>
|
|
150
|
+
</Badge>
|
|
151
|
+
),
|
|
152
|
+
title: 'Emirates Business Trip',
|
|
153
|
+
content: 'Wise AED jar',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
media: (
|
|
157
|
+
<Badge badge={<Flag code="jpy" />} size="md">
|
|
158
|
+
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-blue)">
|
|
159
|
+
<Plane size="24" />
|
|
160
|
+
</Avatar>
|
|
161
|
+
</Badge>
|
|
162
|
+
),
|
|
163
|
+
title: 'Trip to Mars',
|
|
164
|
+
content: 'Wise Jpy jar',
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
export const Basic: Story = {
|
|
171
|
+
args: {
|
|
172
|
+
placeholder: { title: 'No balance selected' },
|
|
173
|
+
options: balances,
|
|
174
|
+
onChange: (value) => {
|
|
175
|
+
console.log('selected balance', value);
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
render: (args: SelectOptionProps) => {
|
|
179
|
+
return (
|
|
180
|
+
<div className="row">
|
|
181
|
+
<div className="col-md-8 col-md-offset-2">
|
|
182
|
+
<Field label="Balances">
|
|
183
|
+
<SelectOption {...args} />
|
|
184
|
+
</Field>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export const Error: Story = {
|
|
192
|
+
render: () => {
|
|
193
|
+
function onChange(value: SelectOptionValue<CustomData>): void {
|
|
194
|
+
console.log(value);
|
|
195
|
+
}
|
|
196
|
+
return (
|
|
197
|
+
<div className="row">
|
|
198
|
+
<div className="col-md-8 col-md-offset-2">
|
|
199
|
+
<Field
|
|
200
|
+
label={<>Payment method</>}
|
|
201
|
+
sentiment={Sentiment.NEGATIVE}
|
|
202
|
+
message="Just an example of validation message"
|
|
203
|
+
>
|
|
204
|
+
<SelectOption<CustomData>
|
|
205
|
+
aria-label="Choose one of payment methods"
|
|
206
|
+
placeholder={{ title: 'No method selected', actionLabel: 'Select' }}
|
|
207
|
+
options={paymentMethods}
|
|
208
|
+
onChange={onChange}
|
|
209
|
+
/>
|
|
210
|
+
</Field>
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
<div className="col-md-8 col-md-offset-2">
|
|
214
|
+
<Field
|
|
215
|
+
label={<>Payment method</>}
|
|
216
|
+
sentiment={Sentiment.NEGATIVE}
|
|
217
|
+
message="Example of disabled select option"
|
|
218
|
+
>
|
|
219
|
+
<SelectOption<CustomData>
|
|
220
|
+
disabled
|
|
221
|
+
placeholder={{ title: 'No method selected' }}
|
|
222
|
+
options={paymentMethods}
|
|
223
|
+
onChange={onChange}
|
|
224
|
+
/>
|
|
225
|
+
</Field>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import ActionButton, { ActionButtonProps } from '../actionButton';
|
|
3
|
+
import Chevron from '../chevron';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import Option from '../common/Option';
|
|
6
|
+
import type { OptionProps } from '../common/Option/Option';
|
|
7
|
+
import { Breakpoint, Position } from '../common';
|
|
8
|
+
import Section from '../section';
|
|
9
|
+
import Header from '../header';
|
|
10
|
+
import { HeaderProps } from '../header/Header';
|
|
11
|
+
import NavigationOption from '../navigationOption';
|
|
12
|
+
import NavigationOptionsList from '../navigationOptionsList';
|
|
13
|
+
import { useInputAttributes } from '../inputs/contexts';
|
|
14
|
+
import messages from './SelectOption.messages';
|
|
15
|
+
import { useIntl } from 'react-intl';
|
|
16
|
+
import ResponsivePanel from '../common/responsivePanel';
|
|
17
|
+
import { useScreenSize } from '../common/hooks/useScreenSize';
|
|
18
|
+
import { Plus } from '@transferwise/icons';
|
|
19
|
+
|
|
20
|
+
export type SelectOptiopsSection<T = unknown> = {
|
|
21
|
+
title?: HeaderProps['title'];
|
|
22
|
+
options: SelectOptionValue<T>[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type SelectOptionValue<T = unknown> = Pick<
|
|
26
|
+
OptionProps,
|
|
27
|
+
'media' | 'title' | 'content' | 'disabled'
|
|
28
|
+
> & {
|
|
29
|
+
value?: T;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type SelectOptionPlaceholder = Pick<OptionProps, 'media' | 'title' | 'content'> & {
|
|
33
|
+
actionLabel?: ActionButtonProps['children'];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type SelectOptionProps<T = unknown> = {
|
|
37
|
+
onChange: (selected: SelectOptionValue<T>) => void;
|
|
38
|
+
selected?: SelectOptionValue<T>;
|
|
39
|
+
options: SelectOptiopsSection<T>[];
|
|
40
|
+
placeholder: SelectOptionPlaceholder;
|
|
41
|
+
} & Omit<
|
|
42
|
+
OptionProps,
|
|
43
|
+
'as' | 'title' | 'media' | 'content' | 'onClick' | 'onChange' | 'showMediaAtAllSizes' | 'decision'
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
export default function SelectOption<T>({
|
|
47
|
+
selected: selectedValueProp = undefined,
|
|
48
|
+
options,
|
|
49
|
+
onChange,
|
|
50
|
+
placeholder,
|
|
51
|
+
disabled,
|
|
52
|
+
...props
|
|
53
|
+
}: SelectOptionProps<T>) {
|
|
54
|
+
const intl = useIntl();
|
|
55
|
+
const rootRef = useRef(null);
|
|
56
|
+
const [selected, setSelected] = useState(selectedValueProp);
|
|
57
|
+
const [showOptions, setShowOptions] = useState(false);
|
|
58
|
+
|
|
59
|
+
const hasSelected = selected !== undefined;
|
|
60
|
+
const isLargeScreen = useScreenSize(Breakpoint.SMALL);
|
|
61
|
+
|
|
62
|
+
const inputAttributes = useInputAttributes();
|
|
63
|
+
const ariaLabelledBy = props['aria-labelledby'] ?? inputAttributes?.['aria-labelledby'];
|
|
64
|
+
|
|
65
|
+
function handleOnClick(showOptionsStatus: boolean) {
|
|
66
|
+
return () => {
|
|
67
|
+
setShowOptions(showOptionsStatus);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleOnChange(data: SelectOptionValue<T>) {
|
|
72
|
+
return () => {
|
|
73
|
+
setShowOptions(false);
|
|
74
|
+
setSelected(data);
|
|
75
|
+
onChange(data);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function getOptions(isLargeScreen = false) {
|
|
80
|
+
return (
|
|
81
|
+
<div className={classNames({ 'np-select-option-list': isLargeScreen })}>
|
|
82
|
+
{options.map((optionsSection) => (
|
|
83
|
+
// eslint-disable-next-line react/jsx-key
|
|
84
|
+
<Section
|
|
85
|
+
className={classNames('np-select-option-section', { 'p-x-2 p-y-1': isLargeScreen })}
|
|
86
|
+
>
|
|
87
|
+
{optionsSection.title && <Header title={optionsSection.title} />}
|
|
88
|
+
<NavigationOptionsList>
|
|
89
|
+
{optionsSection.options.map((option) => {
|
|
90
|
+
return (
|
|
91
|
+
// eslint-disable-next-line react/jsx-key
|
|
92
|
+
<NavigationOption
|
|
93
|
+
isContainerAligned={!isLargeScreen}
|
|
94
|
+
showMediaCircle
|
|
95
|
+
showMediaAtAllSizes
|
|
96
|
+
onClick={handleOnChange(option)}
|
|
97
|
+
{...option}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
})}
|
|
101
|
+
</NavigationOptionsList>
|
|
102
|
+
</Section>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
<Option
|
|
111
|
+
ref={rootRef}
|
|
112
|
+
aria-haspopup="dialog"
|
|
113
|
+
aria-expanded={showOptions}
|
|
114
|
+
aria-labelledby={ariaLabelledBy}
|
|
115
|
+
showMediaAtAllSizes
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
decision={false}
|
|
118
|
+
media={hasSelected ? selected.media : placeholder.media ?? <Plus size={24} />}
|
|
119
|
+
title={(hasSelected ? selected : placeholder).title}
|
|
120
|
+
content={(hasSelected ? selected : placeholder).content}
|
|
121
|
+
className={classNames(
|
|
122
|
+
'np-select-option',
|
|
123
|
+
'clickable',
|
|
124
|
+
hasSelected ? 'np-select-option-selected' : 'np-select-option-placeholder',
|
|
125
|
+
props.className,
|
|
126
|
+
)}
|
|
127
|
+
button={
|
|
128
|
+
<button
|
|
129
|
+
type="button"
|
|
130
|
+
disabled={disabled}
|
|
131
|
+
className="btn-unstyled"
|
|
132
|
+
aria-label={hasSelected ? undefined : props['aria-label']}
|
|
133
|
+
onClick={handleOnClick(true)}
|
|
134
|
+
>
|
|
135
|
+
{hasSelected ? (
|
|
136
|
+
<Chevron />
|
|
137
|
+
) : (
|
|
138
|
+
<ActionButton>
|
|
139
|
+
{placeholder.actionLabel || intl.formatMessage(messages.actionLabel)}
|
|
140
|
+
</ActionButton>
|
|
141
|
+
)}
|
|
142
|
+
</button>
|
|
143
|
+
}
|
|
144
|
+
/>
|
|
145
|
+
<ResponsivePanel
|
|
146
|
+
anchorWidth
|
|
147
|
+
altAxis
|
|
148
|
+
anchorRef={rootRef}
|
|
149
|
+
open={showOptions}
|
|
150
|
+
position={Position.BOTTOM}
|
|
151
|
+
onClose={handleOnClick(false)}
|
|
152
|
+
>
|
|
153
|
+
{getOptions(isLargeScreen)}
|
|
154
|
+
</ResponsivePanel>
|
|
155
|
+
</>
|
|
156
|
+
);
|
|
157
|
+
}
|
package/src/ssr.spec.js
CHANGED
|
@@ -226,6 +226,7 @@ describe('Server side rendering', () => {
|
|
|
226
226
|
DateLookup: { value: new Date() },
|
|
227
227
|
Link: { size: 16 },
|
|
228
228
|
Tooltip: { children: <>yo</> },
|
|
229
|
+
SelectOption: { placeholder: { media: <img alt="img" /> } },
|
|
229
230
|
};
|
|
230
231
|
|
|
231
232
|
const { Provider } = exposedLibraryItems;
|
|
@@ -50,25 +50,8 @@
|
|
|
50
50
|
color: var(--color-sentiment-negative) !important;
|
|
51
51
|
}
|
|
52
52
|
.np-theme-personal .np-upload-input-errors {
|
|
53
|
-
list-style: none;
|
|
54
53
|
padding-left: 0;
|
|
55
|
-
|
|
56
|
-
.np-theme-personal .np-upload-input-errors li {
|
|
57
|
-
position: relative;
|
|
58
|
-
padding-left: 16px;
|
|
59
|
-
padding-left: var(--size-16);
|
|
60
|
-
}
|
|
61
|
-
@media (max-width: 320px) {
|
|
62
|
-
.np-theme-personal .np-upload-input-errors li {
|
|
63
|
-
padding-left: 32px;
|
|
64
|
-
padding-left: var(--size-32);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
.np-theme-personal .np-upload-input-errors li:before {
|
|
68
|
-
content: '•';
|
|
69
|
-
position: absolute;
|
|
70
|
-
display: block;
|
|
71
|
-
left: 0;
|
|
54
|
+
list-style-position: inside;
|
|
72
55
|
}
|
|
73
56
|
.np-theme-personal .np-upload-input .status-circle {
|
|
74
57
|
width: 24px;
|
|
@@ -59,24 +59,8 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
&-errors {
|
|
62
|
-
list-style: none;
|
|
63
62
|
padding-left: 0;
|
|
64
|
-
|
|
65
|
-
li {
|
|
66
|
-
position: relative;
|
|
67
|
-
padding-left: var(--size-16);
|
|
68
|
-
|
|
69
|
-
@media (--screen-400-zoom) {
|
|
70
|
-
padding-left: var(--size-32);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&:before {
|
|
74
|
-
content: '•';
|
|
75
|
-
position: absolute;
|
|
76
|
-
display: block;
|
|
77
|
-
left: 0;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
63
|
+
list-style-position: inside;
|
|
80
64
|
}
|
|
81
65
|
|
|
82
66
|
.status-circle {
|
|
@@ -125,24 +125,13 @@ WithFileErrors.args = {
|
|
|
125
125
|
id: 5,
|
|
126
126
|
filename: 'Error with multiple `string` errors passed in `array`.png',
|
|
127
127
|
status: Status.FAILED,
|
|
128
|
-
errors: [
|
|
129
|
-
'Error 1',
|
|
130
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
131
|
-
'Error 3',
|
|
132
|
-
],
|
|
128
|
+
errors: ['Error 1', 'Error 2', 'Error 3'],
|
|
133
129
|
},
|
|
134
130
|
{
|
|
135
131
|
id: 6,
|
|
136
132
|
filename: 'Error with multiple `obj` errors passed in `array`.png',
|
|
137
133
|
status: Status.FAILED,
|
|
138
|
-
errors: [
|
|
139
|
-
{ message: 'Error 1' },
|
|
140
|
-
{
|
|
141
|
-
message:
|
|
142
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
143
|
-
},
|
|
144
|
-
{ message: 'Error 3' },
|
|
145
|
-
],
|
|
134
|
+
errors: [{ message: 'Error 1' }, { message: 'Error 2' }, { message: 'Error 3' }],
|
|
146
135
|
},
|
|
147
136
|
],
|
|
148
137
|
multiple: true,
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
border-color: #c9cbce !important;
|
|
9
9
|
border-color: var(--color-interactive-secondary) !important;
|
|
10
10
|
}
|
|
11
|
-
.np-upload-button-container.droppable-dropping:before {
|
|
12
|
-
z-index: 2;
|
|
13
|
-
}
|
|
14
11
|
.np-upload-button-container input[type="file"] {
|
|
15
12
|
opacity: 0;
|
|
16
13
|
z-index: -1;
|
|
@@ -21,7 +18,6 @@
|
|
|
21
18
|
}
|
|
22
19
|
.np-upload-button {
|
|
23
20
|
width: 100%;
|
|
24
|
-
border-top: 1px solid transparent;
|
|
25
21
|
padding: 16px;
|
|
26
22
|
padding: var(--padding-small);
|
|
27
23
|
border-radius: 0;
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
&.droppable-dropping {
|
|
9
9
|
border-color: var(--color-interactive-secondary) !important;
|
|
10
|
-
|
|
11
|
-
&:before {
|
|
12
|
-
z-index: 2;
|
|
13
|
-
}
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
input[type="file"] {
|
|
@@ -26,7 +22,6 @@
|
|
|
26
22
|
|
|
27
23
|
.np-upload-button {
|
|
28
24
|
width: 100%;
|
|
29
|
-
border-top: 1px solid transparent;
|
|
30
25
|
padding: var(--padding-small);
|
|
31
26
|
border-radius: 0;
|
|
32
27
|
|
|
@@ -1,49 +1,30 @@
|
|
|
1
1
|
.np-upload-item {
|
|
2
2
|
border: 1px solid #c9cbce;
|
|
3
3
|
border: 1px solid var(--color-interactive-secondary);
|
|
4
|
-
position: relative;
|
|
5
4
|
}
|
|
6
|
-
.np-upload-item:first-child ~ div:
|
|
7
|
-
.np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
|
|
8
|
-
.np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
|
|
5
|
+
.np-upload-item:first-child ~ div:before {
|
|
9
6
|
display: block;
|
|
10
|
-
position:
|
|
7
|
+
position: relative;
|
|
11
8
|
height: 1px;
|
|
12
9
|
background-color: rgba(0,0,0,0.10196);
|
|
13
10
|
background-color: var(--color-border-neutral);
|
|
14
11
|
content: " ";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
width: calc(100% - 2 * 16px);
|
|
18
|
-
width: calc(100% - 2 * var(--size-16));
|
|
19
|
-
}
|
|
20
|
-
.np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
|
|
21
|
-
.np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
|
|
22
|
-
top: 0;
|
|
23
|
-
}
|
|
24
|
-
.np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
|
|
25
|
-
bottom: -1px;
|
|
12
|
+
margin: 0 16px;
|
|
13
|
+
margin: 0 var(--size-16);
|
|
26
14
|
}
|
|
27
15
|
.np-upload-item:first-child ~ div {
|
|
28
|
-
border-top:
|
|
29
|
-
}
|
|
30
|
-
.np-upload-item:not(:first-child) .np-upload-item--link:hover {
|
|
31
|
-
border-top-color: rgba(0,0,0,0.10196);
|
|
32
|
-
border-top-color: var(--color-border-neutral);
|
|
16
|
+
border-top: 0;
|
|
33
17
|
}
|
|
34
18
|
.np-upload-item:not(:last-child) {
|
|
35
19
|
border-bottom: 0;
|
|
36
20
|
}
|
|
37
|
-
.np-upload-item.np-upload-item__link:hover
|
|
38
|
-
.np-upload-
|
|
39
|
-
|
|
40
|
-
.np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
|
|
41
|
-
display: none;
|
|
21
|
+
.np-upload-item.np-upload-item__link:hover:before,
|
|
22
|
+
.np-upload-button-container:hover:before {
|
|
23
|
+
margin: 0 !important;
|
|
42
24
|
}
|
|
43
|
-
.np-upload-
|
|
44
|
-
.np-upload-button-container
|
|
45
|
-
|
|
46
|
-
width: 100% !important;
|
|
25
|
+
.np-upload-item.np-upload-item__link:hover + div:before,
|
|
26
|
+
.np-upload-button-container:hover + div:before {
|
|
27
|
+
margin: 0 !important;
|
|
47
28
|
}
|
|
48
29
|
.np-upload-button-container:has(:focus-visible) {
|
|
49
30
|
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
@@ -60,29 +41,17 @@
|
|
|
60
41
|
flex: 1;
|
|
61
42
|
-webkit-text-decoration: none;
|
|
62
43
|
text-decoration: none;
|
|
63
|
-
border-top: 1px solid transparent;
|
|
64
44
|
border-radius: inherit;
|
|
65
45
|
}
|
|
66
46
|
.np-upload-item__link a:focus-visible {
|
|
67
47
|
outline-offset: -2px;
|
|
68
48
|
}
|
|
69
|
-
.np-upload-item__link a:hover:before {
|
|
70
|
-
display: none !important;
|
|
71
|
-
}
|
|
72
|
-
.np-upload-item__link a:hover:after {
|
|
73
|
-
left: 0 !important;
|
|
74
|
-
width: 100% !important;
|
|
75
|
-
}
|
|
76
49
|
.np-upload-item__link a:hover,
|
|
77
50
|
.np-upload-item__link a:active {
|
|
78
51
|
-webkit-text-decoration: none;
|
|
79
52
|
text-decoration: none;
|
|
80
|
-
}
|
|
81
|
-
.np-upload-item__link a:hover .np-upload-button,
|
|
82
|
-
.np-upload-item__link a:active .np-upload-button {
|
|
83
53
|
background-color: rgba(134,167,189,0.10196);
|
|
84
54
|
background-color: var(--color-background-neutral);
|
|
85
|
-
border-radius: inherit;
|
|
86
55
|
}
|
|
87
56
|
.np-upload-item__body {
|
|
88
57
|
display: flex;
|
|
@@ -107,7 +76,6 @@
|
|
|
107
76
|
outline-offset: 0 !important;
|
|
108
77
|
background-color: rgba(134,167,189,0.10196);
|
|
109
78
|
background-color: var(--color-background-neutral);
|
|
110
|
-
border: none;
|
|
111
79
|
color: var(--color-interactive-primary);
|
|
112
80
|
right: 16px;
|
|
113
81
|
right: var(--size-16);
|