@transferwise/components 0.0.0-experimental-e9893fb → 0.0.0-experimental-9773c7e
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/main.css +21 -19
- package/build/styles/item/Item.css +21 -19
- package/build/styles/main.css +21 -19
- package/build/types/common/commonProps.d.ts.map +1 -1
- package/build/types/item/Item.d.ts +1 -1
- package/build/types/item/prompt/Prompt.d.ts +6 -4
- package/build/types/item/prompt/Prompt.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/commonProps.ts +0 -1
- package/src/item/Item.css +21 -19
- package/src/item/Item.less +7 -12
- package/src/item/Item.tsx +1 -1
- package/src/item/prompt/Prompt.spec.tsx +77 -0
- package/src/item/prompt/Prompt.story.tsx +39 -7
- package/src/item/prompt/Prompt.tsx +18 -10
- package/src/main.css +21 -19
- package/build/types/item/prompt/index.d.ts +0 -3
- package/build/types/item/prompt/index.d.ts.map +0 -1
- package/src/item/prompt/index.ts +0 -2
package/build/main.css
CHANGED
|
@@ -2698,22 +2698,22 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2698
2698
|
border-radius: var(--radius-small);
|
|
2699
2699
|
word-break: break-word;
|
|
2700
2700
|
word-wrap: break-word;
|
|
2701
|
-
-webkit-hyphens: auto;
|
|
2702
|
-
hyphens: auto;
|
|
2703
|
-
cursor: default;
|
|
2704
2701
|
}
|
|
2705
2702
|
.np-item-prompt .np-prompt-icon {
|
|
2706
|
-
padding-right:
|
|
2707
|
-
padding-
|
|
2708
|
-
padding-
|
|
2709
|
-
|
|
2710
|
-
|
|
2703
|
+
padding-right: calc(12px / 2);
|
|
2704
|
+
padding-right: calc(var(--size-12) / 2);
|
|
2705
|
+
padding-top: calc(4px - 1);
|
|
2706
|
+
padding-top: calc(var(--size-4) - 1);
|
|
2707
|
+
padding-bottom: calc(4px - 1);
|
|
2708
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
2709
|
+
}
|
|
2710
|
+
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
2711
|
+
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
2711
2712
|
color: var(--color-sentiment-positive-primary);
|
|
2712
2713
|
}
|
|
2713
2714
|
.np-item-prompt a {
|
|
2714
2715
|
text-underline-offset: calc(4px / 2);
|
|
2715
2716
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
2716
|
-
display: inline;
|
|
2717
2717
|
}
|
|
2718
2718
|
.np-item-prompt.np-prompt-interactive {
|
|
2719
2719
|
-webkit-text-decoration: none;
|
|
@@ -2721,10 +2721,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2721
|
cursor: pointer;
|
|
2722
2722
|
border: none;
|
|
2723
2723
|
}
|
|
2724
|
-
.np-item-prompt.np-prompt-interactive .np-prompt-text {
|
|
2725
|
-
font-weight: 400;
|
|
2726
|
-
font-weight: var(--font-weight-regular);
|
|
2727
|
-
}
|
|
2728
2724
|
.np-item-prompt.negative {
|
|
2729
2725
|
background-color: var(--color-sentiment-negative-secondary);
|
|
2730
2726
|
color: var(--color-sentiment-negative-primary);
|
|
@@ -2745,28 +2741,34 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2745
2741
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
2746
2742
|
}
|
|
2747
2743
|
.np-item-prompt.positive,
|
|
2748
|
-
.np-item-prompt.discount
|
|
2744
|
+
.np-item-prompt.discount,
|
|
2745
|
+
.np-item-prompt.savings {
|
|
2749
2746
|
background-color: var(--color-sentiment-positive-secondary);
|
|
2750
2747
|
color: var(--color-sentiment-positive-primary);
|
|
2751
2748
|
}
|
|
2752
2749
|
.np-item-prompt.positive a,
|
|
2753
|
-
.np-item-prompt.discount a
|
|
2750
|
+
.np-item-prompt.discount a,
|
|
2751
|
+
.np-item-prompt.savings a {
|
|
2754
2752
|
color: var(--color-sentiment-positive-primary);
|
|
2755
2753
|
}
|
|
2756
2754
|
.np-item-prompt.positive a:hover,
|
|
2757
|
-
.np-item-prompt.discount a:hover
|
|
2755
|
+
.np-item-prompt.discount a:hover,
|
|
2756
|
+
.np-item-prompt.savings a:hover {
|
|
2758
2757
|
color: var(--color-sentiment-positive-primary-hover);
|
|
2759
2758
|
}
|
|
2760
2759
|
.np-item-prompt.positive a:active,
|
|
2761
|
-
.np-item-prompt.discount a:active
|
|
2760
|
+
.np-item-prompt.discount a:active,
|
|
2761
|
+
.np-item-prompt.savings a:active {
|
|
2762
2762
|
color: var(--color-sentiment-positive-primary-active);
|
|
2763
2763
|
}
|
|
2764
2764
|
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
2765
|
-
.np-prompt-interactive.np-item-prompt.discount:hover
|
|
2765
|
+
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
2766
|
+
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
2766
2767
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
2767
2768
|
}
|
|
2768
2769
|
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
2769
|
-
.np-prompt-interactive.np-item-prompt.discount:active
|
|
2770
|
+
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
2771
|
+
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
2770
2772
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
2771
2773
|
}
|
|
2772
2774
|
.np-item-prompt.neutral {
|
|
@@ -76,22 +76,22 @@
|
|
|
76
76
|
border-radius: var(--radius-small);
|
|
77
77
|
word-break: break-word;
|
|
78
78
|
word-wrap: break-word;
|
|
79
|
-
-webkit-hyphens: auto;
|
|
80
|
-
hyphens: auto;
|
|
81
|
-
cursor: default;
|
|
82
79
|
}
|
|
83
80
|
.np-item-prompt .np-prompt-icon {
|
|
84
|
-
padding-right:
|
|
85
|
-
padding-
|
|
86
|
-
padding-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
padding-right: calc(12px / 2);
|
|
82
|
+
padding-right: calc(var(--size-12) / 2);
|
|
83
|
+
padding-top: calc(4px - 1);
|
|
84
|
+
padding-top: calc(var(--size-4) - 1);
|
|
85
|
+
padding-bottom: calc(4px - 1);
|
|
86
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
87
|
+
}
|
|
88
|
+
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
89
|
+
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
89
90
|
color: var(--color-sentiment-positive-primary);
|
|
90
91
|
}
|
|
91
92
|
.np-item-prompt a {
|
|
92
93
|
text-underline-offset: calc(4px / 2);
|
|
93
94
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
94
|
-
display: inline;
|
|
95
95
|
}
|
|
96
96
|
.np-item-prompt.np-prompt-interactive {
|
|
97
97
|
-webkit-text-decoration: none;
|
|
@@ -99,10 +99,6 @@
|
|
|
99
99
|
cursor: pointer;
|
|
100
100
|
border: none;
|
|
101
101
|
}
|
|
102
|
-
.np-item-prompt.np-prompt-interactive .np-prompt-text {
|
|
103
|
-
font-weight: 400;
|
|
104
|
-
font-weight: var(--font-weight-regular);
|
|
105
|
-
}
|
|
106
102
|
.np-item-prompt.negative {
|
|
107
103
|
background-color: var(--color-sentiment-negative-secondary);
|
|
108
104
|
color: var(--color-sentiment-negative-primary);
|
|
@@ -123,28 +119,34 @@
|
|
|
123
119
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
124
120
|
}
|
|
125
121
|
.np-item-prompt.positive,
|
|
126
|
-
.np-item-prompt.discount
|
|
122
|
+
.np-item-prompt.discount,
|
|
123
|
+
.np-item-prompt.savings {
|
|
127
124
|
background-color: var(--color-sentiment-positive-secondary);
|
|
128
125
|
color: var(--color-sentiment-positive-primary);
|
|
129
126
|
}
|
|
130
127
|
.np-item-prompt.positive a,
|
|
131
|
-
.np-item-prompt.discount a
|
|
128
|
+
.np-item-prompt.discount a,
|
|
129
|
+
.np-item-prompt.savings a {
|
|
132
130
|
color: var(--color-sentiment-positive-primary);
|
|
133
131
|
}
|
|
134
132
|
.np-item-prompt.positive a:hover,
|
|
135
|
-
.np-item-prompt.discount a:hover
|
|
133
|
+
.np-item-prompt.discount a:hover,
|
|
134
|
+
.np-item-prompt.savings a:hover {
|
|
136
135
|
color: var(--color-sentiment-positive-primary-hover);
|
|
137
136
|
}
|
|
138
137
|
.np-item-prompt.positive a:active,
|
|
139
|
-
.np-item-prompt.discount a:active
|
|
138
|
+
.np-item-prompt.discount a:active,
|
|
139
|
+
.np-item-prompt.savings a:active {
|
|
140
140
|
color: var(--color-sentiment-positive-primary-active);
|
|
141
141
|
}
|
|
142
142
|
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
143
|
-
.np-prompt-interactive.np-item-prompt.discount:hover
|
|
143
|
+
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
144
|
+
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
144
145
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
145
146
|
}
|
|
146
147
|
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
147
|
-
.np-prompt-interactive.np-item-prompt.discount:active
|
|
148
|
+
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
149
|
+
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
148
150
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
149
151
|
}
|
|
150
152
|
.np-item-prompt.neutral {
|
package/build/styles/main.css
CHANGED
|
@@ -2698,22 +2698,22 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2698
2698
|
border-radius: var(--radius-small);
|
|
2699
2699
|
word-break: break-word;
|
|
2700
2700
|
word-wrap: break-word;
|
|
2701
|
-
-webkit-hyphens: auto;
|
|
2702
|
-
hyphens: auto;
|
|
2703
|
-
cursor: default;
|
|
2704
2701
|
}
|
|
2705
2702
|
.np-item-prompt .np-prompt-icon {
|
|
2706
|
-
padding-right:
|
|
2707
|
-
padding-
|
|
2708
|
-
padding-
|
|
2709
|
-
|
|
2710
|
-
|
|
2703
|
+
padding-right: calc(12px / 2);
|
|
2704
|
+
padding-right: calc(var(--size-12) / 2);
|
|
2705
|
+
padding-top: calc(4px - 1);
|
|
2706
|
+
padding-top: calc(var(--size-4) - 1);
|
|
2707
|
+
padding-bottom: calc(4px - 1);
|
|
2708
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
2709
|
+
}
|
|
2710
|
+
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
2711
|
+
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
2711
2712
|
color: var(--color-sentiment-positive-primary);
|
|
2712
2713
|
}
|
|
2713
2714
|
.np-item-prompt a {
|
|
2714
2715
|
text-underline-offset: calc(4px / 2);
|
|
2715
2716
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
2716
|
-
display: inline;
|
|
2717
2717
|
}
|
|
2718
2718
|
.np-item-prompt.np-prompt-interactive {
|
|
2719
2719
|
-webkit-text-decoration: none;
|
|
@@ -2721,10 +2721,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2721
|
cursor: pointer;
|
|
2722
2722
|
border: none;
|
|
2723
2723
|
}
|
|
2724
|
-
.np-item-prompt.np-prompt-interactive .np-prompt-text {
|
|
2725
|
-
font-weight: 400;
|
|
2726
|
-
font-weight: var(--font-weight-regular);
|
|
2727
|
-
}
|
|
2728
2724
|
.np-item-prompt.negative {
|
|
2729
2725
|
background-color: var(--color-sentiment-negative-secondary);
|
|
2730
2726
|
color: var(--color-sentiment-negative-primary);
|
|
@@ -2745,28 +2741,34 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2745
2741
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
2746
2742
|
}
|
|
2747
2743
|
.np-item-prompt.positive,
|
|
2748
|
-
.np-item-prompt.discount
|
|
2744
|
+
.np-item-prompt.discount,
|
|
2745
|
+
.np-item-prompt.savings {
|
|
2749
2746
|
background-color: var(--color-sentiment-positive-secondary);
|
|
2750
2747
|
color: var(--color-sentiment-positive-primary);
|
|
2751
2748
|
}
|
|
2752
2749
|
.np-item-prompt.positive a,
|
|
2753
|
-
.np-item-prompt.discount a
|
|
2750
|
+
.np-item-prompt.discount a,
|
|
2751
|
+
.np-item-prompt.savings a {
|
|
2754
2752
|
color: var(--color-sentiment-positive-primary);
|
|
2755
2753
|
}
|
|
2756
2754
|
.np-item-prompt.positive a:hover,
|
|
2757
|
-
.np-item-prompt.discount a:hover
|
|
2755
|
+
.np-item-prompt.discount a:hover,
|
|
2756
|
+
.np-item-prompt.savings a:hover {
|
|
2758
2757
|
color: var(--color-sentiment-positive-primary-hover);
|
|
2759
2758
|
}
|
|
2760
2759
|
.np-item-prompt.positive a:active,
|
|
2761
|
-
.np-item-prompt.discount a:active
|
|
2760
|
+
.np-item-prompt.discount a:active,
|
|
2761
|
+
.np-item-prompt.savings a:active {
|
|
2762
2762
|
color: var(--color-sentiment-positive-primary-active);
|
|
2763
2763
|
}
|
|
2764
2764
|
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
2765
|
-
.np-prompt-interactive.np-item-prompt.discount:hover
|
|
2765
|
+
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
2766
|
+
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
2766
2767
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
2767
2768
|
}
|
|
2768
2769
|
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
2769
|
-
.np-prompt-interactive.np-item-prompt.discount:active
|
|
2770
|
+
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
2771
|
+
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
2770
2772
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
2771
2773
|
}
|
|
2772
2774
|
.np-item-prompt.neutral {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonProps.d.ts","sourceRoot":"","sources":["../../../src/common/commonProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;
|
|
1
|
+
{"version":3,"file":"commonProps.d.ts","sourceRoot":"","sources":["../../../src/common/commonProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC;IACzC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC"}
|
|
@@ -34,7 +34,7 @@ export declare const Item: {
|
|
|
34
34
|
Checkbox: (props: import("./ItemCheckbox").ItemCheckboxProps) => import("react").JSX.Element;
|
|
35
35
|
IconButton: (props: import("./ItemIconButton").ItemIconButtonProps) => import("react").JSX.Element;
|
|
36
36
|
Navigation: ({ onClick }: import("./ItemNavigation").ItemNavigationProps) => import("react").JSX.Element;
|
|
37
|
-
Prompt: ({ type, children, action }: import("./prompt").ItemPromptProps) => import("react").JSX.Element;
|
|
37
|
+
Prompt: ({ type, children, action }: import("./prompt/Prompt").ItemPromptProps) => import("react").JSX.Element;
|
|
38
38
|
};
|
|
39
39
|
export default Item;
|
|
40
40
|
//# sourceMappingURL=Item.d.ts.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Sentiment } from '../../common';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkProps } from '../../link';
|
|
3
3
|
export type ItemPromptProps = {
|
|
4
|
-
type: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}` | 'discount';
|
|
5
|
-
children
|
|
6
|
-
action?: Pick<
|
|
4
|
+
type: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}` | 'discount' | 'savings';
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
action?: Pick<LinkProps, 'href' | 'target' | 'onClick'> & {
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
};
|
|
7
9
|
};
|
|
8
10
|
export declare const ItemPrompt: ({ type, children, action }: ItemPromptProps) => import("react").JSX.Element;
|
|
9
11
|
export default ItemPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/item/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/item/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EACA,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,GACpF,UAAU,GACV,SAAS,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrF,CAAC;AAEF,eAAO,MAAM,UAAU,+BAAgC,eAAe,gCAyBrE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
package/src/item/Item.css
CHANGED
|
@@ -76,22 +76,22 @@
|
|
|
76
76
|
border-radius: var(--radius-small);
|
|
77
77
|
word-break: break-word;
|
|
78
78
|
word-wrap: break-word;
|
|
79
|
-
-webkit-hyphens: auto;
|
|
80
|
-
hyphens: auto;
|
|
81
|
-
cursor: default;
|
|
82
79
|
}
|
|
83
80
|
.np-item-prompt .np-prompt-icon {
|
|
84
|
-
padding-right:
|
|
85
|
-
padding-
|
|
86
|
-
padding-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
padding-right: calc(12px / 2);
|
|
82
|
+
padding-right: calc(var(--size-12) / 2);
|
|
83
|
+
padding-top: calc(4px - 1);
|
|
84
|
+
padding-top: calc(var(--size-4) - 1);
|
|
85
|
+
padding-bottom: calc(4px - 1);
|
|
86
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
87
|
+
}
|
|
88
|
+
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
89
|
+
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
89
90
|
color: var(--color-sentiment-positive-primary);
|
|
90
91
|
}
|
|
91
92
|
.np-item-prompt a {
|
|
92
93
|
text-underline-offset: calc(4px / 2);
|
|
93
94
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
94
|
-
display: inline;
|
|
95
95
|
}
|
|
96
96
|
.np-item-prompt.np-prompt-interactive {
|
|
97
97
|
-webkit-text-decoration: none;
|
|
@@ -99,10 +99,6 @@
|
|
|
99
99
|
cursor: pointer;
|
|
100
100
|
border: none;
|
|
101
101
|
}
|
|
102
|
-
.np-item-prompt.np-prompt-interactive .np-prompt-text {
|
|
103
|
-
font-weight: 400;
|
|
104
|
-
font-weight: var(--font-weight-regular);
|
|
105
|
-
}
|
|
106
102
|
.np-item-prompt.negative {
|
|
107
103
|
background-color: var(--color-sentiment-negative-secondary);
|
|
108
104
|
color: var(--color-sentiment-negative-primary);
|
|
@@ -123,28 +119,34 @@
|
|
|
123
119
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
124
120
|
}
|
|
125
121
|
.np-item-prompt.positive,
|
|
126
|
-
.np-item-prompt.discount
|
|
122
|
+
.np-item-prompt.discount,
|
|
123
|
+
.np-item-prompt.savings {
|
|
127
124
|
background-color: var(--color-sentiment-positive-secondary);
|
|
128
125
|
color: var(--color-sentiment-positive-primary);
|
|
129
126
|
}
|
|
130
127
|
.np-item-prompt.positive a,
|
|
131
|
-
.np-item-prompt.discount a
|
|
128
|
+
.np-item-prompt.discount a,
|
|
129
|
+
.np-item-prompt.savings a {
|
|
132
130
|
color: var(--color-sentiment-positive-primary);
|
|
133
131
|
}
|
|
134
132
|
.np-item-prompt.positive a:hover,
|
|
135
|
-
.np-item-prompt.discount a:hover
|
|
133
|
+
.np-item-prompt.discount a:hover,
|
|
134
|
+
.np-item-prompt.savings a:hover {
|
|
136
135
|
color: var(--color-sentiment-positive-primary-hover);
|
|
137
136
|
}
|
|
138
137
|
.np-item-prompt.positive a:active,
|
|
139
|
-
.np-item-prompt.discount a:active
|
|
138
|
+
.np-item-prompt.discount a:active,
|
|
139
|
+
.np-item-prompt.savings a:active {
|
|
140
140
|
color: var(--color-sentiment-positive-primary-active);
|
|
141
141
|
}
|
|
142
142
|
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
143
|
-
.np-prompt-interactive.np-item-prompt.discount:hover
|
|
143
|
+
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
144
|
+
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
144
145
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
145
146
|
}
|
|
146
147
|
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
147
|
-
.np-prompt-interactive.np-item-prompt.discount:active
|
|
148
|
+
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
149
|
+
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
148
150
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
149
151
|
}
|
|
150
152
|
.np-item-prompt.neutral {
|
package/src/item/Item.less
CHANGED
|
@@ -71,32 +71,26 @@
|
|
|
71
71
|
border-radius: var(--radius-small);
|
|
72
72
|
word-break: break-word;
|
|
73
73
|
overflow-wrap: break-word;
|
|
74
|
-
hyphens: auto;
|
|
75
|
-
cursor: default;
|
|
76
74
|
|
|
77
75
|
.np-prompt-icon {
|
|
78
|
-
padding-right:
|
|
79
|
-
padding-top:
|
|
80
|
-
padding-bottom:
|
|
76
|
+
padding-right: calc(var(--size-12) / 2);
|
|
77
|
+
padding-top: calc(var(--size-4) - 1);
|
|
78
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
81
79
|
|
|
82
|
-
.tw-icon-tags
|
|
80
|
+
.tw-icon-tags,
|
|
81
|
+
.tw-icon-confetti {
|
|
83
82
|
color: var(--color-sentiment-positive-primary);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
a {
|
|
88
87
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
89
|
-
display: inline;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
&.np-prompt-interactive {
|
|
93
91
|
text-decoration: none;
|
|
94
92
|
cursor: pointer;
|
|
95
93
|
border: none;
|
|
96
|
-
|
|
97
|
-
.np-prompt-text {
|
|
98
|
-
font-weight: var(--font-weight-regular);
|
|
99
|
-
}
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
&.negative {
|
|
@@ -121,7 +115,8 @@
|
|
|
121
115
|
}
|
|
122
116
|
}
|
|
123
117
|
&.positive,
|
|
124
|
-
&.discount
|
|
118
|
+
&.discount,
|
|
119
|
+
&.savings {
|
|
125
120
|
background-color: var(--color-sentiment-positive-secondary);
|
|
126
121
|
color: var(--color-sentiment-positive-primary);
|
|
127
122
|
a {
|
package/src/item/Item.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { IconButton } from './ItemIconButton';
|
|
|
7
7
|
import { Checkbox } from './ItemCheckbox';
|
|
8
8
|
import { Navigation } from './ItemNavigation';
|
|
9
9
|
import { clsx } from 'clsx';
|
|
10
|
-
import Prompt from './prompt';
|
|
10
|
+
import Prompt from './prompt/Prompt';
|
|
11
11
|
|
|
12
12
|
export type ItemTypes =
|
|
13
13
|
| 'none'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { render, screen, mockMatchMedia } from '../../test-utils';
|
|
2
|
+
import { ItemPrompt } from './Prompt';
|
|
3
|
+
import { Sentiment } from '../../common';
|
|
4
|
+
|
|
5
|
+
mockMatchMedia();
|
|
6
|
+
|
|
7
|
+
describe('ItemPrompt', () => {
|
|
8
|
+
it('renders the aria-label when provided', () => {
|
|
9
|
+
const ariaLabel = 'Test aria-label';
|
|
10
|
+
render(
|
|
11
|
+
<ItemPrompt
|
|
12
|
+
type={Sentiment.POSITIVE}
|
|
13
|
+
action={{ 'aria-label': ariaLabel, href: 'https://example.com' }}
|
|
14
|
+
>
|
|
15
|
+
Positive prompt
|
|
16
|
+
</ItemPrompt>,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
expect(screen.getByLabelText(ariaLabel)).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('applies the interactive class when href is provided', () => {
|
|
23
|
+
render(
|
|
24
|
+
<ItemPrompt
|
|
25
|
+
type={Sentiment.POSITIVE}
|
|
26
|
+
action={{ href: 'https://example.com', 'aria-label': 'Interactive link' }}
|
|
27
|
+
>
|
|
28
|
+
Interactive link
|
|
29
|
+
</ItemPrompt>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(screen.getByRole('link')).toHaveClass('np-prompt-interactive');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('applies the interactive class when onClick is provided', () => {
|
|
36
|
+
render(
|
|
37
|
+
<ItemPrompt
|
|
38
|
+
type={Sentiment.POSITIVE}
|
|
39
|
+
action={{ onClick: jest.fn(), 'aria-label': 'Interactive button' }}
|
|
40
|
+
>
|
|
41
|
+
Interactive button
|
|
42
|
+
</ItemPrompt>,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(screen.getByRole('button')).toHaveClass('np-prompt-interactive');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('does not apply the interactive class when no action is provided', () => {
|
|
49
|
+
render(<ItemPrompt type={Sentiment.POSITIVE}>Non-interactive prompt</ItemPrompt>);
|
|
50
|
+
|
|
51
|
+
expect(screen.getByText('Non-interactive prompt')).not.toHaveClass('np-prompt-interactive');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('renders the children content', () => {
|
|
55
|
+
render(<ItemPrompt type={Sentiment.POSITIVE}>This is a child prompt</ItemPrompt>);
|
|
56
|
+
|
|
57
|
+
expect(screen.getByText('This is a child prompt')).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('spreads additional props to the wrapper element', () => {
|
|
61
|
+
render(
|
|
62
|
+
<ItemPrompt
|
|
63
|
+
type={Sentiment.POSITIVE}
|
|
64
|
+
action={{
|
|
65
|
+
href: 'https://example.com',
|
|
66
|
+
target: '_blank',
|
|
67
|
+
'aria-label': 'Custom props prompt',
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
Custom props prompt
|
|
71
|
+
</ItemPrompt>,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const link = screen.getByRole('link');
|
|
75
|
+
expect(link).toHaveAttribute('target', '_blank');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -12,6 +12,18 @@ export default {
|
|
|
12
12
|
children: 'You have done a terrible thing',
|
|
13
13
|
},
|
|
14
14
|
argTypes: {
|
|
15
|
+
type: {
|
|
16
|
+
options: [
|
|
17
|
+
Sentiment.POSITIVE,
|
|
18
|
+
Sentiment.NEGATIVE,
|
|
19
|
+
Sentiment.NEUTRAL,
|
|
20
|
+
Sentiment.WARNING,
|
|
21
|
+
'discount',
|
|
22
|
+
'savings',
|
|
23
|
+
],
|
|
24
|
+
control: { type: 'radio' },
|
|
25
|
+
description: 'The type of prompt to display',
|
|
26
|
+
},
|
|
15
27
|
action: {
|
|
16
28
|
table: {
|
|
17
29
|
disable: true,
|
|
@@ -29,24 +41,39 @@ export default {
|
|
|
29
41
|
|
|
30
42
|
type CustomStory = StoryObj<
|
|
31
43
|
ItemPromptProps & {
|
|
32
|
-
|
|
33
|
-
makeTheWholeThingClickable?: boolean;
|
|
44
|
+
interactivity?: 'none' | 'full-anchor' | 'full-button' | 'link';
|
|
34
45
|
}
|
|
35
46
|
>;
|
|
36
47
|
|
|
37
48
|
export const Basic: CustomStory = {
|
|
38
49
|
args: {
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
interactivity: 'none',
|
|
51
|
+
},
|
|
52
|
+
argTypes: {
|
|
53
|
+
interactivity: {
|
|
54
|
+
options: ['none', 'full-button', 'full-anchor', 'link'],
|
|
55
|
+
control: { type: 'radio' },
|
|
56
|
+
description: 'The type of interactivity to display',
|
|
57
|
+
},
|
|
41
58
|
},
|
|
42
|
-
render: ({
|
|
59
|
+
render: ({ interactivity, ...args }) => {
|
|
43
60
|
return (
|
|
44
61
|
<div>
|
|
45
62
|
<ItemPrompt
|
|
46
63
|
type={args.type}
|
|
47
|
-
action={
|
|
64
|
+
action={
|
|
65
|
+
interactivity === 'full-anchor'
|
|
66
|
+
? { href: 'wise.com' }
|
|
67
|
+
: interactivity === 'full-button'
|
|
68
|
+
? {
|
|
69
|
+
onClick: () => {
|
|
70
|
+
console.log('clicked');
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
: undefined
|
|
74
|
+
}
|
|
48
75
|
>
|
|
49
|
-
{args.children} {
|
|
76
|
+
{args.children} {interactivity === 'link' && <Link href="www.wise.com">with a link</Link>}
|
|
50
77
|
</ItemPrompt>
|
|
51
78
|
</div>
|
|
52
79
|
);
|
|
@@ -81,6 +108,11 @@ export const Variants = () => {
|
|
|
81
108
|
Discount prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
82
109
|
</ItemPrompt>
|
|
83
110
|
</div>
|
|
111
|
+
<div className="m-b-2">
|
|
112
|
+
<ItemPrompt type="savings">
|
|
113
|
+
Savings prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
114
|
+
</ItemPrompt>
|
|
115
|
+
</div>
|
|
84
116
|
<div className="m-b-2">
|
|
85
117
|
<ItemPrompt
|
|
86
118
|
type="discount"
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import { Tags } from '@transferwise/icons';
|
|
1
|
+
import { Confetti, Tags } from '@transferwise/icons';
|
|
2
2
|
import { Sentiment } from '../../common';
|
|
3
3
|
import StatusIcon from '../../statusIcon';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
|
-
import {
|
|
5
|
+
import { LinkProps } from '../../link';
|
|
6
|
+
import Body from '../../body';
|
|
6
7
|
|
|
7
8
|
export type ItemPromptProps = {
|
|
8
9
|
type:
|
|
9
10
|
| `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
|
|
10
|
-
| 'discount'
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
| 'discount'
|
|
12
|
+
| 'savings';
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
action?: Pick<LinkProps, 'href' | 'target' | 'onClick'> & { 'aria-label'?: string };
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
|
|
16
18
|
const Wrapper = action?.href ? 'a' : action?.onClick ? 'button' : 'span';
|
|
17
19
|
|
|
20
|
+
const icon =
|
|
21
|
+
type === 'discount' ? (
|
|
22
|
+
<Tags size={16} />
|
|
23
|
+
) : type === 'savings' ? (
|
|
24
|
+
<Confetti size={16} />
|
|
25
|
+
) : (
|
|
26
|
+
<StatusIcon size={16} sentiment={type} />
|
|
27
|
+
);
|
|
28
|
+
|
|
18
29
|
return (
|
|
19
30
|
<Wrapper
|
|
20
|
-
aria-label={action?.['aria-label']}
|
|
21
31
|
className={clsx(
|
|
22
32
|
'np-item-prompt',
|
|
23
33
|
type,
|
|
@@ -25,10 +35,8 @@ export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
|
|
|
25
35
|
)}
|
|
26
36
|
{...(action ?? {})}
|
|
27
37
|
>
|
|
28
|
-
<div className="np-prompt-icon">
|
|
29
|
-
|
|
30
|
-
</div>
|
|
31
|
-
<div className="np-prompt-text">{children}</div>
|
|
38
|
+
<div className="np-prompt-icon">{icon}</div>
|
|
39
|
+
<Body>{children}</Body>
|
|
32
40
|
</Wrapper>
|
|
33
41
|
);
|
|
34
42
|
};
|
package/src/main.css
CHANGED
|
@@ -2698,22 +2698,22 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2698
2698
|
border-radius: var(--radius-small);
|
|
2699
2699
|
word-break: break-word;
|
|
2700
2700
|
word-wrap: break-word;
|
|
2701
|
-
-webkit-hyphens: auto;
|
|
2702
|
-
hyphens: auto;
|
|
2703
|
-
cursor: default;
|
|
2704
2701
|
}
|
|
2705
2702
|
.np-item-prompt .np-prompt-icon {
|
|
2706
|
-
padding-right:
|
|
2707
|
-
padding-
|
|
2708
|
-
padding-
|
|
2709
|
-
|
|
2710
|
-
|
|
2703
|
+
padding-right: calc(12px / 2);
|
|
2704
|
+
padding-right: calc(var(--size-12) / 2);
|
|
2705
|
+
padding-top: calc(4px - 1);
|
|
2706
|
+
padding-top: calc(var(--size-4) - 1);
|
|
2707
|
+
padding-bottom: calc(4px - 1);
|
|
2708
|
+
padding-bottom: calc(var(--size-4) - 1);
|
|
2709
|
+
}
|
|
2710
|
+
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
2711
|
+
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
2711
2712
|
color: var(--color-sentiment-positive-primary);
|
|
2712
2713
|
}
|
|
2713
2714
|
.np-item-prompt a {
|
|
2714
2715
|
text-underline-offset: calc(4px / 2);
|
|
2715
2716
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
2716
|
-
display: inline;
|
|
2717
2717
|
}
|
|
2718
2718
|
.np-item-prompt.np-prompt-interactive {
|
|
2719
2719
|
-webkit-text-decoration: none;
|
|
@@ -2721,10 +2721,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2721
|
cursor: pointer;
|
|
2722
2722
|
border: none;
|
|
2723
2723
|
}
|
|
2724
|
-
.np-item-prompt.np-prompt-interactive .np-prompt-text {
|
|
2725
|
-
font-weight: 400;
|
|
2726
|
-
font-weight: var(--font-weight-regular);
|
|
2727
|
-
}
|
|
2728
2724
|
.np-item-prompt.negative {
|
|
2729
2725
|
background-color: var(--color-sentiment-negative-secondary);
|
|
2730
2726
|
color: var(--color-sentiment-negative-primary);
|
|
@@ -2745,28 +2741,34 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2745
2741
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
2746
2742
|
}
|
|
2747
2743
|
.np-item-prompt.positive,
|
|
2748
|
-
.np-item-prompt.discount
|
|
2744
|
+
.np-item-prompt.discount,
|
|
2745
|
+
.np-item-prompt.savings {
|
|
2749
2746
|
background-color: var(--color-sentiment-positive-secondary);
|
|
2750
2747
|
color: var(--color-sentiment-positive-primary);
|
|
2751
2748
|
}
|
|
2752
2749
|
.np-item-prompt.positive a,
|
|
2753
|
-
.np-item-prompt.discount a
|
|
2750
|
+
.np-item-prompt.discount a,
|
|
2751
|
+
.np-item-prompt.savings a {
|
|
2754
2752
|
color: var(--color-sentiment-positive-primary);
|
|
2755
2753
|
}
|
|
2756
2754
|
.np-item-prompt.positive a:hover,
|
|
2757
|
-
.np-item-prompt.discount a:hover
|
|
2755
|
+
.np-item-prompt.discount a:hover,
|
|
2756
|
+
.np-item-prompt.savings a:hover {
|
|
2758
2757
|
color: var(--color-sentiment-positive-primary-hover);
|
|
2759
2758
|
}
|
|
2760
2759
|
.np-item-prompt.positive a:active,
|
|
2761
|
-
.np-item-prompt.discount a:active
|
|
2760
|
+
.np-item-prompt.discount a:active,
|
|
2761
|
+
.np-item-prompt.savings a:active {
|
|
2762
2762
|
color: var(--color-sentiment-positive-primary-active);
|
|
2763
2763
|
}
|
|
2764
2764
|
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
2765
|
-
.np-prompt-interactive.np-item-prompt.discount:hover
|
|
2765
|
+
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
2766
|
+
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
2766
2767
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
2767
2768
|
}
|
|
2768
2769
|
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
2769
|
-
.np-prompt-interactive.np-item-prompt.discount:active
|
|
2770
|
+
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
2771
|
+
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
2770
2772
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
2771
2773
|
}
|
|
2772
2774
|
.np-item-prompt.neutral {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/item/prompt/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
package/src/item/prompt/index.ts
DELETED