@transferwise/components 0.0.0-experimental-69786e7 → 0.0.0-experimental-b6153fb
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/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/main.css +68 -60
- package/build/styles/inputs/Input.css +2 -28
- package/build/styles/inputs/TextArea.css +2 -28
- package/build/styles/item/Item.css +64 -0
- package/build/styles/main.css +68 -60
- package/build/styles/popover/Popover.css +2 -28
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/item/Item.d.ts +39 -0
- package/build/types/item/Item.d.ts.map +1 -0
- package/build/types/item/ItemAdditionalInfo.d.ts +9 -0
- package/build/types/item/ItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/item/ItemCheckbox.d.ts +4 -0
- package/build/types/item/ItemCheckbox.d.ts.map +1 -0
- package/build/types/item/ItemIconButton.d.ts +4 -0
- package/build/types/item/ItemIconButton.d.ts.map +1 -0
- package/build/types/item/ItemImage.d.ts +4 -0
- package/build/types/item/ItemImage.d.ts.map +1 -0
- package/build/types/item/ItemNavigation.d.ts +4 -0
- package/build/types/item/ItemNavigation.d.ts.map +1 -0
- package/build/types/item/index.d.ts +5 -0
- package/build/types/item/index.d.ts.map +1 -0
- package/build/types/test-utils/fake-data.d.ts +1 -0
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +2 -0
- package/src/inputs/Input.css +2 -28
- package/src/inputs/TextArea.css +2 -28
- package/src/item/Item.css +64 -0
- package/src/item/Item.less +64 -0
- package/src/item/Item.story.tsx +80 -0
- package/src/item/Item.tsx +163 -0
- package/src/item/ItemAdditionalInfo.tsx +31 -0
- package/src/item/ItemCheckbox.tsx +16 -0
- package/src/item/ItemIconButton.tsx +15 -0
- package/src/item/ItemImage.tsx +11 -0
- package/src/item/ItemNavigation.tsx +16 -0
- package/src/item/index.ts +4 -0
- package/src/main.css +68 -60
- package/src/main.less +1 -0
- package/src/popover/Popover.css +2 -28
- package/src/test-utils/fake-data.ts +3 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IconButtonProps } from '../iconButton';
|
|
2
|
+
export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'>;
|
|
3
|
+
export declare const IconButton: (props: ItemIconButtonProps) => import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ItemIconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemIconButton.d.ts","sourceRoot":"","sources":["../../../src/item/ItemIconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,eAAe,EAAE,MAAM,eAAe,CAAC;AAG3E,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;AAEvF,eAAO,MAAM,UAAU,UAAoB,mBAAmB,gCAQ7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemImage.d.ts","sourceRoot":"","sources":["../../../src/item/ItemImage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;AAE7D,eAAO,MAAM,KAAK,UAAoB,cAAc,gCAInD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from '../button/Button.types';
|
|
2
|
+
export type ItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
|
|
3
|
+
export declare const Navigation: ({ onClick }: ItemNavigationProps) => import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ItemNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemNavigation.d.ts","sourceRoot":"","sources":["../../../src/item/ItemNavigation.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,gBAAoC,mBAAmB,gCAQ7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AACjD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const lorem10 = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste, architecto?";
|
|
2
|
+
export declare const lorem20 = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum non explicabo doloribus rerum saepe ut beatae adipisci rem vero optio.";
|
|
2
3
|
export declare const lorem40 = "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Illo esse quod et iure deserunt facilis similique voluptatem reprehenderit mollitia inventore, ab voluptate dignissimos autem repellat accusamus perferendis sed pariatur tempore possimus ipsam praesentium ipsum? Nesciunt cumque repellendus impedit aliquam! Error?";
|
|
3
4
|
export declare const lorem100 = "Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ipsum quisquam fuga dolore veritatis assumenda rerum, non, sint aliquam, excepturi architecto temporibus quis? Quo, deleniti nobis, illo necessitatibus accusamus commodi error fuga culpa sequi, incidunt voluptatum tempore quisquam quos eos modi impedit sit! Eveniet libero optio assumenda rem accusantium quod quas, recusandae, incidunt mollitia harum dolorum. Dolor porro hic mollitia accusantium vel commodi, ipsam a suscipit iusto placeat numquam excepturi amet nostrum aliquid aperiam sequi deleniti asperiores fugit cumque ipsa voluptatem culpa non libero iste. Placeat rem dolore quisquam aperiam, eligendi facere quos minima totam a ut corporis culpa! Veniam, illo!";
|
|
4
5
|
export declare const lorem500 = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi commodi eos placeat aut quidem et error ex qui. Reprehenderit animi officiis magnam dicta, alias eligendi facilis sit fuga suscipit qui voluptatibus, quam harum beatae omnis sint sapiente dolorum cum officia dignissimos ab ipsa, deleniti voluptates exercitationem tempore! Fugit consequuntur ullam, similique tenetur corporis laborum sed sint, necessitatibus natus voluptatem, eius eveniet placeat quos quaerat officia officiis magni reprehenderit eaque! Dolorum odio iste vitae magnam, voluptatum pariatur unde, quod at adipisci reprehenderit dignissimos id modi quaerat rerum et dolorem. Rerum ratione beatae, repudiandae temporibus ipsam accusamus deserunt! Maiores, eos nisi laboriosam soluta rem minus expedita repudiandae accusamus aperiam rerum facere ducimus voluptas! Rerum fugit eum quasi. At sapiente quaerat, similique inventore quia magni cupiditate molestias odio voluptate quasi culpa ullam sit unde veritatis ut dicta ad nihil veniam accusamus eveniet vel placeat minus numquam nostrum! Delectus quas adipisci debitis cumque doloremque, nobis, obcaecati dolorem commodi possimus nesciunt vero? Excepturi saepe explicabo dolorem facere itaque optio, totam tempore earum culpa fugit ullam officia maiores dolores facilis voluptate consequuntur a voluptas, asperiores obcaecati voluptatem. Rerum suscipit quod nulla harum illum sequi praesentium tenetur neque architecto, molestias earum! Necessitatibus, ullam molestiae voluptas, esse dolorem officiis aut, inventore dolore provident beatae error nesciunt incidunt neque quam molestias iusto minus rem nam. Eum, provident id. Molestias vitae ex sequi veritatis totam minima labore quasi eligendi nemo, ipsa accusamus eaque quae maiores eum ipsam inventore illo voluptatem sapiente velit, quos aspernatur commodi quibusdam. A expedita, adipisci aut voluptatum repellat fugit saepe accusamus debitis, quis dolorem, incidunt corrupti magni? Inventore nulla fugit quisquam dolorum temporibus corporis error voluptates? Impedit possimus provident a vero exercitationem doloribus est voluptatibus distinctio, ipsum iste sit repellat sapiente tenetur deleniti ullam dolorem soluta accusantium! Ab, placeat rerum explicabo corporis impedit quam quos veritatis expedita hic veniam harum qui dolor neque! Laboriosam officiis, dignissimos corporis, ducimus iure nemo quisquam pariatur molestias repellat aliquam tempore impedit dolore tempora eaque accusamus fugiat facilis dolor sint laborum molestiae sapiente deserunt quasi obcaecati! Veniam, doloribus! Unde, fugiat odit sunt facere maiores nobis tempora, natus quam consectetur deleniti nesciunt perferendis aut praesentium. Libero, neque cumque beatae recusandae qui repudiandae sunt quod dolorum nemo voluptates et culpa temporibus perferendis est expedita vel laboriosam! Accusamus incidunt consectetur delectus voluptate sunt repudiandae deleniti ut consequuntur, facilis assumenda nostrum soluta unde repellat reiciendis ipsum quidem quam numquam optio voluptates eius. Molestias quibusdam assumenda earum atque ullam delectus explicabo recusandae quasi aperiam, est placeat? Officia molestiae accusamus rem placeat adipisci officiis harum vel. Neque sit qui alias magni illum! Ipsam, necessitatibus unde sit possimus ipsum quis neque voluptate reprehenderit tempore nobis quo sunt molestiae atque rerum similique natus minus eum? Maiores aspernatur ut ullam eos vitae aperiam odit deleniti eveniet delectus totam harum iste, blanditiis ab laboriosam mollitia. Esse incidunt odit voluptate minus cum molestiae reprehenderit minima voluptatibus id. Molestias aliquid repellendus dolores cupiditate, nemo reiciendis ad facilis quo est, a error culpa similique libero dolor labore! Facere laborum cupiditate iste laboriosam culpa consectetur.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-data.d.ts","sourceRoot":"","sources":["../../../src/test-utils/fake-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,gFAC2D,CAAC;AAEhF,eAAO,MAAM,OAAO,sUACiT,CAAC;AAEtU,eAAO,MAAM,QAAQ,+tBACysB,CAAC;AAE/tB,eAAO,MAAM,QAAQ,2uHACqtH,CAAC;AAE3uH,eAAO,MAAM,SAAS,28OACo7O,CAAC"}
|
|
1
|
+
{"version":3,"file":"fake-data.d.ts","sourceRoot":"","sources":["../../../src/test-utils/fake-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,gFAC2D,CAAC;AAEhF,eAAO,MAAM,OAAO,4IACuH,CAAC;AAE5I,eAAO,MAAM,OAAO,sUACiT,CAAC;AAEtU,eAAO,MAAM,QAAQ,+tBACysB,CAAC;AAE/tB,eAAO,MAAM,QAAQ,2uHACqtH,CAAC;AAE3uH,eAAO,MAAM,SAAS,28OACo7O,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-b6153fb",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@testing-library/jest-dom": "^6.4.6",
|
|
69
69
|
"@testing-library/react": "^16.0.0",
|
|
70
70
|
"@testing-library/user-event": "^14.5.2",
|
|
71
|
-
"@transferwise/icons": "^3.
|
|
71
|
+
"@transferwise/icons": "^3.21.0",
|
|
72
72
|
"@tsconfig/recommended": "^1.0.7",
|
|
73
73
|
"@types/babel__core": "^7.20.5",
|
|
74
74
|
"@types/commonmark": "^0.27.9",
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"rollup-preserve-directives": "^1.1.1",
|
|
96
96
|
"storybook": "^8.2.2",
|
|
97
97
|
"@transferwise/less-config": "3.1.1",
|
|
98
|
-
"@
|
|
98
|
+
"@wise/wds-configs": "0.0.0",
|
|
99
99
|
"@wise/components-theming": "1.6.2",
|
|
100
|
-
"@
|
|
100
|
+
"@transferwise/neptune-css": "14.24.3"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@transferwise/icons": "^3.
|
|
104
|
-
"@transferwise/neptune-css": "
|
|
103
|
+
"@transferwise/icons": "^3.21.0",
|
|
104
|
+
"@transferwise/neptune-css": "^14.24",
|
|
105
105
|
"@wise/art": "^2.16",
|
|
106
106
|
"@wise/components-theming": "^1.0.0",
|
|
107
107
|
"react": ">=18",
|
package/src/index.ts
CHANGED
|
@@ -109,6 +109,7 @@ export type {
|
|
|
109
109
|
TableCellStatus,
|
|
110
110
|
TableCellType,
|
|
111
111
|
} from './table';
|
|
112
|
+
export type { ItemProps, ItemAdditionalInfoProps, ItemCheckboxProps } from './item';
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
115
|
* Components
|
|
@@ -211,6 +212,7 @@ export { default as Typeahead } from './typeahead';
|
|
|
211
212
|
export { default as Upload } from './upload';
|
|
212
213
|
export { default as UploadInput } from './uploadInput';
|
|
213
214
|
export { default as Table } from './table';
|
|
215
|
+
export { default as Item } from './table';
|
|
214
216
|
|
|
215
217
|
/**
|
|
216
218
|
* Hooks
|
package/src/inputs/Input.css
CHANGED
|
@@ -71,6 +71,8 @@
|
|
|
71
71
|
line-height: 1.2;
|
|
72
72
|
line-height: var(--line-height-title);
|
|
73
73
|
letter-spacing: 0;
|
|
74
|
+
-webkit-hyphens: auto;
|
|
75
|
+
hyphens: auto;
|
|
74
76
|
margin-bottom: 0;
|
|
75
77
|
margin-bottom: initial;
|
|
76
78
|
font-size: 1.375rem;
|
|
@@ -81,34 +83,6 @@
|
|
|
81
83
|
line-height: 125%;
|
|
82
84
|
height: 72px !important;
|
|
83
85
|
height: var(--size-72) !important;
|
|
84
|
-
}@supports (hyphenate-limit-chars: 1) {
|
|
85
|
-
.np-form-control--size-lg {
|
|
86
|
-
-webkit-hyphens: auto;
|
|
87
|
-
hyphens: auto;
|
|
88
|
-
hyphenate-limit-chars: 7 3;
|
|
89
|
-
}
|
|
90
|
-
@media (min-width: 768px) {
|
|
91
|
-
.np-form-control--size-lg {
|
|
92
|
-
hyphenate-limit-chars: 8 3;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
@media (min-width: 992px) {
|
|
96
|
-
.np-form-control--size-lg {
|
|
97
|
-
hyphenate-limit-chars: 10 4 3;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
101
|
-
.np-form-control--size-lg {
|
|
102
|
-
-webkit-hyphens: auto;
|
|
103
|
-
hyphens: auto;
|
|
104
|
-
-webkit-hyphenate-limit-before: 3;
|
|
105
|
-
-webkit-hyphenate-limit-after: 3;
|
|
106
|
-
}
|
|
107
|
-
@media (min-width: 992px) {
|
|
108
|
-
.np-form-control--size-lg {
|
|
109
|
-
-webkit-hyphenate-limit-before: 4;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
86
|
}.np-form-control--size-lg + p,
|
|
113
87
|
.np-form-control--size-lg + ul:not(.list-unstyled),
|
|
114
88
|
.np-form-control--size-lg + ol:not(.list-unstyled) {
|
package/src/inputs/TextArea.css
CHANGED
|
@@ -71,6 +71,8 @@
|
|
|
71
71
|
line-height: 1.2;
|
|
72
72
|
line-height: var(--line-height-title);
|
|
73
73
|
letter-spacing: 0;
|
|
74
|
+
-webkit-hyphens: auto;
|
|
75
|
+
hyphens: auto;
|
|
74
76
|
margin-bottom: 0;
|
|
75
77
|
margin-bottom: initial;
|
|
76
78
|
font-size: 1.375rem;
|
|
@@ -81,34 +83,6 @@
|
|
|
81
83
|
line-height: 125%;
|
|
82
84
|
height: 72px !important;
|
|
83
85
|
height: var(--size-72) !important;
|
|
84
|
-
}@supports (hyphenate-limit-chars: 1) {
|
|
85
|
-
.np-form-control--size-lg {
|
|
86
|
-
-webkit-hyphens: auto;
|
|
87
|
-
hyphens: auto;
|
|
88
|
-
hyphenate-limit-chars: 7 3;
|
|
89
|
-
}
|
|
90
|
-
@media (min-width: 768px) {
|
|
91
|
-
.np-form-control--size-lg {
|
|
92
|
-
hyphenate-limit-chars: 8 3;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
@media (min-width: 992px) {
|
|
96
|
-
.np-form-control--size-lg {
|
|
97
|
-
hyphenate-limit-chars: 10 4 3;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
101
|
-
.np-form-control--size-lg {
|
|
102
|
-
-webkit-hyphens: auto;
|
|
103
|
-
hyphens: auto;
|
|
104
|
-
-webkit-hyphenate-limit-before: 3;
|
|
105
|
-
-webkit-hyphenate-limit-after: 3;
|
|
106
|
-
}
|
|
107
|
-
@media (min-width: 992px) {
|
|
108
|
-
.np-form-control--size-lg {
|
|
109
|
-
-webkit-hyphenate-limit-before: 4;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
86
|
}.np-form-control--size-lg + p,
|
|
113
87
|
.np-form-control--size-lg + ul:not(.list-unstyled),
|
|
114
88
|
.np-form-control--size-lg + ol:not(.list-unstyled) {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.np-item {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
padding: var(--size-16);
|
|
4
|
+
border-radius: 24px;
|
|
5
|
+
border-radius: var(--radius-large);
|
|
6
|
+
background-color: #ffffff;
|
|
7
|
+
background-color: var(--color-background-screen);
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: 16px;
|
|
10
|
+
gap: var(--size-16);
|
|
11
|
+
align-items: center;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
.np-item:hover {
|
|
16
|
+
background-color: var(--color-background-screen-hover);
|
|
17
|
+
}
|
|
18
|
+
.np-item:active {
|
|
19
|
+
background-color: var(--color-background-screen-active);
|
|
20
|
+
}
|
|
21
|
+
.np-item-media {
|
|
22
|
+
flex: 0 0 auto;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
}
|
|
25
|
+
.np-item-title {
|
|
26
|
+
color: #37517e;
|
|
27
|
+
color: var(--color-content-primary);
|
|
28
|
+
}
|
|
29
|
+
.np-item-additional-info {
|
|
30
|
+
color: #768e9c;
|
|
31
|
+
color: var(--color-content-tertiary);
|
|
32
|
+
}
|
|
33
|
+
.np-item-value {
|
|
34
|
+
flex: 0 0 auto;
|
|
35
|
+
}
|
|
36
|
+
.np-item-control {
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
}
|
|
39
|
+
.np-item-spotlight-active {
|
|
40
|
+
background-color: rgba(134,167,189,0.10196);
|
|
41
|
+
background-color: var(--color-background-neutral);
|
|
42
|
+
}
|
|
43
|
+
.np-item-spotlight-active:hover {
|
|
44
|
+
background-color: var(--color-background-neutral-hover);
|
|
45
|
+
}
|
|
46
|
+
.np-item-spotlight-active:active {
|
|
47
|
+
background-color: var(--color-background-neutral-active);
|
|
48
|
+
}
|
|
49
|
+
.np-item-spotlight-inactive {
|
|
50
|
+
background-color: rgba(134, 167, 189, 0.025);
|
|
51
|
+
border: 1px dashed rgba(0,0,0,0.10196);
|
|
52
|
+
border: 1px dashed var(--color-border-neutral);
|
|
53
|
+
}
|
|
54
|
+
@supports (color: color-mix(in lch, red, blue)) {
|
|
55
|
+
.np-item-spotlight-inactive {
|
|
56
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.np-item-spotlight-inactive:hover {
|
|
60
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
61
|
+
}
|
|
62
|
+
.np-item-spotlight-inactive:active {
|
|
63
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
64
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.np-item {
|
|
2
|
+
padding: var(--size-16);
|
|
3
|
+
border-radius: var(--radius-large);
|
|
4
|
+
background-color: var(--color-background-screen);
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: var(--size-16);
|
|
7
|
+
align-items: center;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
&:hover {
|
|
12
|
+
background-color: var(--color-background-screen-hover);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:active {
|
|
16
|
+
background-color: var(--color-background-screen-active);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-media {
|
|
20
|
+
flex: 0 0 auto;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-title {
|
|
25
|
+
color: var(--color-content-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&-additional-info {
|
|
29
|
+
color: var(--color-content-tertiary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&-value {
|
|
33
|
+
flex: 0 0 auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&-control {
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-spotlight {
|
|
41
|
+
&-active {
|
|
42
|
+
background-color: var(--color-background-neutral);
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: var(--color-background-neutral-hover);
|
|
46
|
+
}
|
|
47
|
+
&:active {
|
|
48
|
+
background-color: var(--color-background-neutral-active);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&-inactive {
|
|
53
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
54
|
+
border: 1px dashed var(--color-border-neutral);
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
58
|
+
}
|
|
59
|
+
&:active {
|
|
60
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Item, { Props as ItemProps } from './Item';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { lorem10, lorem20, lorem40 } from '../test-utils';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Item,
|
|
8
|
+
title: 'Content/Item',
|
|
9
|
+
} satisfies Meta<ItemProps>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<ItemProps>;
|
|
12
|
+
|
|
13
|
+
// TODO: delete this story later when we have more peace of the List Item puzzle
|
|
14
|
+
export const TempPlayground: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<div>
|
|
17
|
+
<Item
|
|
18
|
+
title="Test title"
|
|
19
|
+
subtitle="Test subtitle"
|
|
20
|
+
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
21
|
+
/>
|
|
22
|
+
<Item
|
|
23
|
+
title="Test title"
|
|
24
|
+
subtitle={lorem10}
|
|
25
|
+
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
26
|
+
/>
|
|
27
|
+
<Item
|
|
28
|
+
title="Test title"
|
|
29
|
+
subtitle={lorem10}
|
|
30
|
+
valueTitle="100 GBP"
|
|
31
|
+
valueSubtitle="100 USD"
|
|
32
|
+
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
33
|
+
/>
|
|
34
|
+
<Item
|
|
35
|
+
title="Test title"
|
|
36
|
+
subtitle="Test subtitle"
|
|
37
|
+
additionalInfo={
|
|
38
|
+
<Item.AdditionalInfo
|
|
39
|
+
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
40
|
+
>
|
|
41
|
+
{lorem10}
|
|
42
|
+
</Item.AdditionalInfo>
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
<Item
|
|
46
|
+
title="Test title"
|
|
47
|
+
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const ItemRadio: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<div>
|
|
56
|
+
{/* Basic */}
|
|
57
|
+
{/* with additional info */}
|
|
58
|
+
{/* with prompt */}
|
|
59
|
+
{/* Disabled */}
|
|
60
|
+
{/* Spotlight */}
|
|
61
|
+
{/* Active */}
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const ItemButton: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<div>
|
|
69
|
+
{/* Basic */}
|
|
70
|
+
{/* with additional info */}
|
|
71
|
+
{/* with prompt */}
|
|
72
|
+
{/* partially interactive */}
|
|
73
|
+
{/* Disabled */}
|
|
74
|
+
{/* Spotlight */}
|
|
75
|
+
{/* Active */}
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// add intaces with dark mode
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createContext, ReactNode, useId, useMemo, useState } from 'react';
|
|
2
|
+
import { Typography } from '../common';
|
|
3
|
+
import Body from '../body';
|
|
4
|
+
import { Image } from './ItemImage';
|
|
5
|
+
import { AdditionalInfo } from './ItemAdditionalInfo';
|
|
6
|
+
import { IconButton } from './ItemIconButton';
|
|
7
|
+
import { Checkbox } from './ItemCheckbox';
|
|
8
|
+
import { Navigation } from './ItemNavigation';
|
|
9
|
+
import { clsx } from 'clsx';
|
|
10
|
+
|
|
11
|
+
export type ItemTypes =
|
|
12
|
+
| 'none'
|
|
13
|
+
| 'navigation'
|
|
14
|
+
| 'radio'
|
|
15
|
+
| 'checkbox'
|
|
16
|
+
| 'switch'
|
|
17
|
+
| 'button'
|
|
18
|
+
| 'icon-button';
|
|
19
|
+
|
|
20
|
+
export type Props = {
|
|
21
|
+
as?: 'li' | 'div' | 'span';
|
|
22
|
+
inverted?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
partialInteractivity?: boolean;
|
|
25
|
+
spotlight?: 'active' | 'inactive';
|
|
26
|
+
title: ReactNode;
|
|
27
|
+
subtitle?: ReactNode;
|
|
28
|
+
additionalInfo?: ReactNode;
|
|
29
|
+
valueTitle?: ReactNode;
|
|
30
|
+
valueSubtitle?: ReactNode;
|
|
31
|
+
media?: ReactNode;
|
|
32
|
+
control?: ReactNode;
|
|
33
|
+
prompt?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type ItemContextData = {
|
|
37
|
+
setControlType: (type: ItemTypes) => void;
|
|
38
|
+
ids: {
|
|
39
|
+
label: string;
|
|
40
|
+
additionalInfo: string;
|
|
41
|
+
value: string;
|
|
42
|
+
control: string;
|
|
43
|
+
prompt: string;
|
|
44
|
+
};
|
|
45
|
+
props: Pick<Props, 'as' | 'disabled' | 'inverted'>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// @ts-expect-error for now let's mock it with `null` value
|
|
49
|
+
// but actually by default we should specify `setControlType('none')`
|
|
50
|
+
export const ItemContext = createContext<ItemContextData>(null);
|
|
51
|
+
|
|
52
|
+
export const Item = ({
|
|
53
|
+
as: View = 'li',
|
|
54
|
+
title,
|
|
55
|
+
subtitle,
|
|
56
|
+
additionalInfo,
|
|
57
|
+
prompt,
|
|
58
|
+
inverted,
|
|
59
|
+
media,
|
|
60
|
+
spotlight = undefined,
|
|
61
|
+
valueTitle,
|
|
62
|
+
valueSubtitle,
|
|
63
|
+
control,
|
|
64
|
+
disabled,
|
|
65
|
+
}: Props) => {
|
|
66
|
+
/*
|
|
67
|
+
const returnType = (): ReactNode => {
|
|
68
|
+
switch (type) {
|
|
69
|
+
case 'Navigation':
|
|
70
|
+
return <Chevron orientation={Position.RIGHT} disabled />;
|
|
71
|
+
case 'Radio':
|
|
72
|
+
return <RadioButton name="Hello" checked />;
|
|
73
|
+
case 'Checkbox':
|
|
74
|
+
return <CheckboxButton name="Hello" checked />;
|
|
75
|
+
case 'Switch':
|
|
76
|
+
return <Switch onClick={() => console.log('clicked')} />;
|
|
77
|
+
case 'Button':
|
|
78
|
+
return <Button v2>Hello</Button>;
|
|
79
|
+
case 'IconButton':
|
|
80
|
+
return (
|
|
81
|
+
<IconButton size={40} priority="minimal">
|
|
82
|
+
<InfoCircle />
|
|
83
|
+
</IconButton>
|
|
84
|
+
);
|
|
85
|
+
case 'NonInteractive':
|
|
86
|
+
default:
|
|
87
|
+
return <></>;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
*/
|
|
91
|
+
const idPrefix = useId();
|
|
92
|
+
|
|
93
|
+
const [controlType, setControlType] = useState<ItemTypes>();
|
|
94
|
+
const ids = {
|
|
95
|
+
label: `${idPrefix}_label`,
|
|
96
|
+
value: `${idPrefix}_value`,
|
|
97
|
+
control: `${idPrefix}_control`,
|
|
98
|
+
prompt: `${idPrefix}_prompt`,
|
|
99
|
+
additionalInfo: `${idPrefix}_additional-info`,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const itemCtx = useMemo(
|
|
103
|
+
() => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
|
|
104
|
+
[],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<ItemContext.Provider value={itemCtx}>
|
|
109
|
+
<View
|
|
110
|
+
className={clsx('np-item', `np-item-${controlType}`, {
|
|
111
|
+
[`np-item-spotlight-${spotlight}`]: !!spotlight,
|
|
112
|
+
})}
|
|
113
|
+
aria-describedby={[ids.additionalInfo].join(' ')}
|
|
114
|
+
>
|
|
115
|
+
{media && <div className="np-item-media">{media}</div>}
|
|
116
|
+
|
|
117
|
+
{/* Title + Subtitle + Values + Additional Info - Group */}
|
|
118
|
+
<div>
|
|
119
|
+
{/* Title + Subtitle + Values - Group */}
|
|
120
|
+
<div className="d-flex justify-content-between">
|
|
121
|
+
<span>
|
|
122
|
+
{/* @ts-expect-error div can have role and aria-lavel props */}
|
|
123
|
+
<Body
|
|
124
|
+
type={Typography.BODY_LARGE_BOLD}
|
|
125
|
+
className="np-item-title"
|
|
126
|
+
// for a11y this needs to be a header but for SEO it shouldn't be `h*` tag
|
|
127
|
+
// so we enable header semantics via `role` and `aria-level` attrs
|
|
128
|
+
role="heading"
|
|
129
|
+
aria-level="4"
|
|
130
|
+
>
|
|
131
|
+
{title}
|
|
132
|
+
</Body>
|
|
133
|
+
<Body className="np-item-subtitle">{subtitle}</Body>
|
|
134
|
+
</span>
|
|
135
|
+
{(valueTitle || valueSubtitle) && (
|
|
136
|
+
<span id={ids.value} className="np-item-value">
|
|
137
|
+
<Body type={Typography.BODY_LARGE_BOLD} className="np-item-title-value">
|
|
138
|
+
{valueTitle}
|
|
139
|
+
</Body>
|
|
140
|
+
<Body className="np-item-subtitle-value">{valueSubtitle}</Body>
|
|
141
|
+
</span>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
{/* Additional Info and Prompt here */}
|
|
146
|
+
{Boolean(subtitle) && additionalInfo}
|
|
147
|
+
</div>
|
|
148
|
+
<Body className="np-item-control">{control}</Body>
|
|
149
|
+
{prompt}
|
|
150
|
+
</View>
|
|
151
|
+
</ItemContext.Provider>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/* eslint-disable functional/immutable-data */
|
|
156
|
+
Item.Image = Image;
|
|
157
|
+
Item.AdditionalInfo = AdditionalInfo;
|
|
158
|
+
Item.Checkbox = Checkbox;
|
|
159
|
+
Item.IconButton = IconButton;
|
|
160
|
+
Item.Navigation = Navigation;
|
|
161
|
+
/* eslint-enable functional/immutable-data */
|
|
162
|
+
|
|
163
|
+
export default Item;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PropsWithChildren, useContext } from 'react';
|
|
2
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
3
|
+
import Body from '../body';
|
|
4
|
+
import Link, { LinkProps } from '../link';
|
|
5
|
+
import { Typography } from '../common';
|
|
6
|
+
|
|
7
|
+
export type ItemAdditionalInfoProps = PropsWithChildren<{
|
|
8
|
+
action?: Pick<LinkProps, 'href' | 'onClick' | 'target'> & { label?: string };
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export const AdditionalInfo = function ({ children, action }: ItemAdditionalInfoProps) {
|
|
12
|
+
const { ids } = useContext<ItemContextData>(ItemContext);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Body
|
|
16
|
+
type={Typography.BODY_DEFAULT}
|
|
17
|
+
id={ids.additionalInfo}
|
|
18
|
+
className="np-item-additional-info"
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
{action ? (
|
|
22
|
+
<>
|
|
23
|
+
{' '}
|
|
24
|
+
<Link href={action.href} target={action.target} onClick={action.onClick}>
|
|
25
|
+
{action.label}
|
|
26
|
+
</Link>
|
|
27
|
+
</>
|
|
28
|
+
) : null}
|
|
29
|
+
</Body>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import CheckboxButton from '../checkboxButton';
|
|
3
|
+
import { CheckboxButtonProps } from '../checkboxButton/CheckboxButton';
|
|
4
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
5
|
+
|
|
6
|
+
export type ItemCheckboxProps = Pick<CheckboxButtonProps, 'checked' | 'indeterminate' | 'onChange'>;
|
|
7
|
+
|
|
8
|
+
export const Checkbox = function (props: ItemCheckboxProps) {
|
|
9
|
+
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setControlType('checkbox');
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return <CheckboxButton disabled={baseItemProps.disabled} {...props} />;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { default as IconButtonComp, IconButtonProps } from '../iconButton';
|
|
3
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
4
|
+
|
|
5
|
+
export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'>;
|
|
6
|
+
|
|
7
|
+
export const IconButton = function (props: ItemIconButtonProps) {
|
|
8
|
+
const { setControlType } = useContext<ItemContextData>(ItemContext);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setControlType('icon-button');
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
return <IconButtonComp {...props} size={32} />;
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import Item, { ItemContext, ItemContextData } from './Item';
|
|
3
|
+
import { default as Img, ImageProps } from '../image/Image';
|
|
4
|
+
|
|
5
|
+
export type ItemImageProps = Pick<ImageProps, 'src' | 'alt'>;
|
|
6
|
+
|
|
7
|
+
export const Image = function (props: ItemImageProps) {
|
|
8
|
+
const { ids, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
9
|
+
|
|
10
|
+
return <Img {...props} />;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChevronRight, BillSplit as Disabled } from '@transferwise/icons';
|
|
2
|
+
import { ButtonProps } from '../button/Button.types';
|
|
3
|
+
import Item, { ItemContext, ItemContextData } from './Item';
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
|
|
7
|
+
|
|
8
|
+
export const Navigation = function Navigation({ onClick }: ItemNavigationProps) {
|
|
9
|
+
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setControlType('navigation');
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return baseItemProps?.disabled ? <Disabled size={24} /> : <ChevronRight size={24} />;
|
|
16
|
+
};
|