@transferwise/components 0.0.0-experimental-f304e2c → 0.0.0-experimental-2fa5e3f
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/card/Card.js +20 -13
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +21 -14
- package/build/card/Card.mjs.map +1 -1
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +4 -8
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +4 -8
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/field/Field.js +3 -13
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +3 -13
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/en.json +1 -3
- package/build/i18n/en.json.js +1 -3
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -3
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +6 -4
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +6 -4
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/label/Label.js +1 -29
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +2 -30
- package/build/label/Label.mjs.map +1 -1
- package/build/main.css +8 -4
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +8 -0
- package/build/styles/main.css +8 -4
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/common/Option/Option.d.ts +2 -0
- package/build/types/common/Option/Option.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +2 -4
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +1 -10
- package/build/types/label/Label.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/card/Card.spec.tsx +35 -3
- package/src/card/Card.story.tsx +56 -40
- package/src/card/Card.tsx +32 -14
- package/src/common/Option/Option.tsx +2 -0
- package/src/dateInput/DateInput.tests.story.tsx +31 -7
- package/src/dateLookup/DateLookup.rtl.spec.tsx +1 -1
- package/src/dateLookup/dateTrigger/DateTrigger.css +8 -0
- package/src/dateLookup/dateTrigger/DateTrigger.less +8 -0
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +1 -1
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +4 -9
- package/src/field/Field.spec.tsx +3 -3
- package/src/field/Field.story.tsx +7 -106
- package/src/field/Field.tests.story.tsx +33 -0
- package/src/field/Field.tsx +6 -12
- package/src/i18n/en.json +1 -3
- package/src/index.ts +1 -1
- package/src/inlineAlert/InlineAlert.story.tsx +72 -8
- package/src/inlineAlert/InlineAlert.tsx +3 -5
- package/src/inputs/InputGroup.spec.tsx +1 -1
- package/src/inputs/SearchInput.spec.tsx +1 -1
- package/src/inputs/SelectInput.spec.tsx +1 -1
- package/src/label/Label.story.tsx +25 -19
- package/src/label/Label.tsx +2 -38
- package/src/main.css +8 -4
- package/src/main.less +0 -1
- package/src/moneyInput/MoneyInput.story.tsx +2 -0
- package/src/radioGroup/RadioGroup.rtl.spec.tsx +1 -1
- package/src/select/Select.rtl.spec.tsx +1 -1
- package/src/switch/Switch.spec.tsx +1 -1
- package/build/label/Label.messages.js +0 -15
- package/build/label/Label.messages.js.map +0 -1
- package/build/label/Label.messages.mjs +0 -13
- package/build/label/Label.messages.mjs.map +0 -1
- package/build/styles/field/Field.css +0 -4
- package/build/types/label/Label.messages.d.ts +0 -12
- package/build/types/label/Label.messages.d.ts.map +0 -1
- package/build/types/label/index.d.ts +0 -3
- package/build/types/label/index.d.ts.map +0 -1
- package/src/field/Field.css +0 -4
- package/src/field/Field.less +0 -5
- package/src/label/Label.messages.tsx +0 -12
- package/src/label/index.ts +0 -2
|
@@ -214,6 +214,6 @@ describe('SelectInput', () => {
|
|
|
214
214
|
<SelectInput items={[{ type: 'option', value: 'USD' }]} value="USD" />
|
|
215
215
|
</Field>,
|
|
216
216
|
);
|
|
217
|
-
expect(screen.getByLabelText(
|
|
217
|
+
expect(screen.getByLabelText('Currency')).toHaveAttribute('aria-haspopup');
|
|
218
218
|
});
|
|
219
219
|
});
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import Info from '../info/Info';
|
|
4
|
+
import { Input } from '../inputs/Input';
|
|
1
5
|
import { Label } from './Label';
|
|
2
6
|
|
|
3
7
|
export default {
|
|
4
8
|
component: Label,
|
|
5
9
|
title: 'Label',
|
|
6
|
-
tags: ['autodocs'],
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
export const Basic = () => {
|
|
13
|
+
const [value, setValue] = useState<string | undefined>('This is some text');
|
|
10
14
|
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</p>
|
|
18
|
-
|
|
19
|
-
<Label className="m-b-2">Text Input</Label>
|
|
20
|
-
|
|
21
|
-
<Label className="m-b-2">
|
|
22
|
-
<Label.Optional>Text Input</Label.Optional>
|
|
23
|
-
</Label>
|
|
15
|
+
<Label>
|
|
16
|
+
Phone number
|
|
17
|
+
<Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
|
|
18
|
+
</Label>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
export const WithInfo = () => {
|
|
23
|
+
const [value, setValue] = useState<string | undefined>('This is some text');
|
|
24
|
+
return (
|
|
25
|
+
<Label>
|
|
26
|
+
<span className="d-flex">
|
|
27
|
+
Phone number{' '}
|
|
28
|
+
<Info
|
|
29
|
+
content="This is some help in popover"
|
|
30
|
+
aria-label="The aria label"
|
|
31
|
+
className="m-l-1"
|
|
32
|
+
/>
|
|
33
|
+
</span>
|
|
34
|
+
<Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
|
|
35
|
+
</Label>
|
|
30
36
|
);
|
|
31
37
|
};
|
package/src/label/Label.tsx
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import messages from './Label.messages';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import Body from '../body';
|
|
5
|
-
import { CommonProps } from '../common';
|
|
6
|
-
import { PropsWithChildren } from 'react';
|
|
7
2
|
|
|
8
3
|
export type LabelProps = {
|
|
9
4
|
id?: string;
|
|
@@ -12,45 +7,14 @@ export type LabelProps = {
|
|
|
12
7
|
children?: React.ReactNode;
|
|
13
8
|
};
|
|
14
9
|
|
|
15
|
-
const Label = ({ id, htmlFor, className, children }: LabelProps) => {
|
|
10
|
+
export const Label = ({ id, htmlFor, className, children }: LabelProps) => {
|
|
16
11
|
return (
|
|
17
12
|
<label
|
|
18
13
|
id={id}
|
|
19
14
|
htmlFor={htmlFor}
|
|
20
|
-
className={clsx(
|
|
21
|
-
'np-label d-flex flex-column m-b-0 np-text-body-default-bold text-primary',
|
|
22
|
-
className,
|
|
23
|
-
)}
|
|
15
|
+
className={clsx('control-label d-flex flex-column gap-y-1 m-b-0', className)}
|
|
24
16
|
>
|
|
25
17
|
{children}
|
|
26
18
|
</label>
|
|
27
19
|
);
|
|
28
20
|
};
|
|
29
|
-
|
|
30
|
-
export type LabelOptionalProps = PropsWithChildren<CommonProps>;
|
|
31
|
-
|
|
32
|
-
const Optional = ({ children, className }: LabelOptionalProps) => {
|
|
33
|
-
const { formatMessage } = useIntl();
|
|
34
|
-
return (
|
|
35
|
-
<div>
|
|
36
|
-
{children}
|
|
37
|
-
<Body
|
|
38
|
-
as="span"
|
|
39
|
-
aria-label={formatMessage(messages.optionalAriaLabel)}
|
|
40
|
-
className={clsx('text-secondary', 'm-l-1', className)}
|
|
41
|
-
>
|
|
42
|
-
{formatMessage(messages.optionalLabel)}
|
|
43
|
-
</Body>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type LabelDescriptionProps = PropsWithChildren<CommonProps>;
|
|
49
|
-
|
|
50
|
-
const Description = ({ children, className }: LabelDescriptionProps) =>
|
|
51
|
-
children ? <Body className={clsx('text-secondary', className)}>{children}</Body> : null;
|
|
52
|
-
|
|
53
|
-
Label.Optional = Optional;
|
|
54
|
-
Label.Description = Description;
|
|
55
|
-
|
|
56
|
-
export { Label };
|
package/src/main.css
CHANGED
|
@@ -1719,10 +1719,18 @@ button.np-option {
|
|
|
1719
1719
|
white-space: nowrap;
|
|
1720
1720
|
width: 100%;
|
|
1721
1721
|
}
|
|
1722
|
+
.np-date-trigger .control-label {
|
|
1723
|
+
font-weight: 400;
|
|
1724
|
+
font-weight: var(--font-weight-regular);
|
|
1725
|
+
}
|
|
1722
1726
|
.np-theme-personal .np-date-trigger {
|
|
1723
1727
|
padding-left: 16px;
|
|
1724
1728
|
padding-left: var(--size-16);
|
|
1725
1729
|
}
|
|
1730
|
+
.np-theme-personal .np-date-trigger .control-label + span {
|
|
1731
|
+
font-weight: 400;
|
|
1732
|
+
font-weight: var(--font-weight-regular);
|
|
1733
|
+
}
|
|
1726
1734
|
.clear-btn {
|
|
1727
1735
|
transition: color 0.15s ease-in-out;
|
|
1728
1736
|
color: #c9cbce;
|
|
@@ -2377,10 +2385,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2377
2385
|
border-radius: 9999px !important;
|
|
2378
2386
|
border-radius: var(--radius-full) !important;
|
|
2379
2387
|
}
|
|
2380
|
-
.np-field-control {
|
|
2381
|
-
margin-top: 4px;
|
|
2382
|
-
margin-top: var(--size-4);
|
|
2383
|
-
}
|
|
2384
2388
|
.np-input-group {
|
|
2385
2389
|
display: inline-grid;
|
|
2386
2390
|
width: 100%;
|
package/src/main.less
CHANGED
|
@@ -4,6 +4,8 @@ import { Lock } from '@transferwise/icons';
|
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import MoneyInput, { CurrencyOptionItem } from '.';
|
|
7
|
+
import Provider from '../provider/Provider';
|
|
8
|
+
import translations from '../i18n';
|
|
7
9
|
|
|
8
10
|
export default {
|
|
9
11
|
component: MoneyInput,
|
|
@@ -12,6 +12,6 @@ describe('Select', () => {
|
|
|
12
12
|
<Select options={options} selected={options[0]} onChange={() => {}} />
|
|
13
13
|
</Field>,
|
|
14
14
|
);
|
|
15
|
-
expect(screen.getByLabelText(
|
|
15
|
+
expect(screen.getByLabelText('Currency')).toHaveTextContent('USD');
|
|
16
16
|
});
|
|
17
17
|
});
|
|
@@ -89,6 +89,6 @@ describe('Switch', () => {
|
|
|
89
89
|
<Switch checked onClick={props.onClick} />
|
|
90
90
|
</Field>,
|
|
91
91
|
);
|
|
92
|
-
expect(screen.getByLabelText(
|
|
92
|
+
expect(screen.getByLabelText('Dark mode')).toHaveAttribute('role', 'switch');
|
|
93
93
|
});
|
|
94
94
|
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var reactIntl = require('react-intl');
|
|
4
|
-
|
|
5
|
-
var messages = reactIntl.defineMessages({
|
|
6
|
-
optionalLabel: {
|
|
7
|
-
id: "neptune.Label.optional"
|
|
8
|
-
},
|
|
9
|
-
optionalAriaLabel: {
|
|
10
|
-
id: "neptune.aria.Label.optional"
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
module.exports = messages;
|
|
15
|
-
//# sourceMappingURL=Label.messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.messages.js","sources":["../../src/label/Label.messages.tsx"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n optionalLabel: {\n id: 'neptune.Label.optional',\n defaultMessage: '(Optional)',\n },\n optionalAriaLabel: {\n id: 'neptune.aria.Label.optional',\n defaultMessage: 'This field is optional',\n },\n});\n"],"names":["defineMessages","optionalLabel","id","optionalAriaLabel"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,aAAa,EAAE;IACbC,EAAE,EAAA,wBAAA;GAEH;AACDC,EAAAA,iBAAiB,EAAE;IACjBD,EAAE,EAAA,6BAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
var messages = defineMessages({
|
|
4
|
-
optionalLabel: {
|
|
5
|
-
id: "neptune.Label.optional"
|
|
6
|
-
},
|
|
7
|
-
optionalAriaLabel: {
|
|
8
|
-
id: "neptune.aria.Label.optional"
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export { messages as default };
|
|
13
|
-
//# sourceMappingURL=Label.messages.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.messages.mjs","sources":["../../src/label/Label.messages.tsx"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n optionalLabel: {\n id: 'neptune.Label.optional',\n defaultMessage: '(Optional)',\n },\n optionalAriaLabel: {\n id: 'neptune.aria.Label.optional',\n defaultMessage: 'This field is optional',\n },\n});\n"],"names":["defineMessages","optionalLabel","id","optionalAriaLabel"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,aAAa,EAAE;IACbC,EAAE,EAAA,wBAAA;GAEH;AACDC,EAAAA,iBAAiB,EAAE;IACjBD,EAAE,EAAA,6BAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.messages.d.ts","sourceRoot":"","sources":["../../../src/label/Label.messages.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,wBASG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/src/field/Field.css
DELETED
package/src/field/Field.less
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
export default defineMessages({
|
|
4
|
-
optionalLabel: {
|
|
5
|
-
id: 'neptune.Label.optional',
|
|
6
|
-
defaultMessage: '(Optional)',
|
|
7
|
-
},
|
|
8
|
-
optionalAriaLabel: {
|
|
9
|
-
id: 'neptune.aria.Label.optional',
|
|
10
|
-
defaultMessage: 'This field is optional',
|
|
11
|
-
},
|
|
12
|
-
});
|
package/src/label/index.ts
DELETED