@transferwise/components 0.0.0-experimental-492a9d3 → 0.0.0-experimental-44a3fcb

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-492a9d3",
3
+ "version": "0.0.0-experimental-44a3fcb",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -79,11 +79,11 @@
79
79
  "storybook": "^7.4.5",
80
80
  "@transferwise/less-config": "3.1.0",
81
81
  "@wise/components-theming": "0.8.4",
82
- "@transferwise/neptune-css": "0.0.0-experimental-492a9d3"
82
+ "@transferwise/neptune-css": "14.9.3"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@transferwise/icons": "^3.7.0",
86
- "@transferwise/neptune-css": "0.0.0-experimental-492a9d3",
86
+ "@transferwise/neptune-css": "^14.9.3",
87
87
  "@wise/art": "^2.7.0",
88
88
  "@wise/components-theming": "^0.8.4",
89
89
  "react": ">=16.14",
@@ -1,4 +1,5 @@
1
1
  @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
2
3
  }.np-accordion-item {
3
4
  display: block;
4
5
  width: 100%;
@@ -1,4 +1,5 @@
1
1
  @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
2
3
  }.tw-avatar {
3
4
  position: relative;
4
5
  border-radius: 50%;
@@ -38,6 +39,7 @@
38
39
  max-width: 100%;
39
40
  }.tw-avatar.tw-avatar--initials,
40
41
  .tw-avatar.tw-avatar--emoji {
42
+ font-family: Arial, sans-serif;
41
43
  font-weight: 600;
42
44
  font-weight: var(--font-weight-semi-bold);
43
45
  }.tw-avatar.tw-avatar--initials,
package/src/card/Card.css CHANGED
@@ -44,6 +44,13 @@
44
44
  [dir="rtl"] .np-card__button {
45
45
  text-align: right;
46
46
  }
47
+ .np-theme-personal .np-card__button:focus {
48
+ outline: none;
49
+ }
50
+ .np-theme-personal .np-card__button:focus-visible {
51
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
52
+ outline-offset: var(--ring-outline-offset);
53
+ }
47
54
  .np-card__content {
48
55
  padding: 24px 16px;
49
56
  padding: var(--size-24) var(--size-16);
@@ -13,9 +13,19 @@
13
13
  max-width: 1164px;
14
14
  }
15
15
  .np-flow-navigation__stepper {
16
- padding-bottom: 0px !important;
17
- padding-left: 0px !important;
18
- padding-right: 0px !important;
16
+ padding-bottom: 0 !important;
17
+ }
18
+ [dir="rtl"] .np-flow-navigation__stepper {
19
+ padding-right: 0 !important;
20
+ }
21
+ html:not([dir="rtl"]) .np-flow-navigation__stepper {
22
+ padding-left: 0 !important;
23
+ }
24
+ [dir="rtl"] .np-flow-navigation__stepper {
25
+ padding-left: 0 !important;
26
+ }
27
+ html:not([dir="rtl"]) .np-flow-navigation__stepper {
28
+ padding-right: 0 !important;
19
29
  }
20
30
  .np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps {
21
31
  display: none;
@@ -27,11 +37,23 @@
27
37
  height: auto;
28
38
  }
29
39
  .np-flow-navigation--sm .np-flow-navigation__stepper {
40
+ min-height: 56px;
41
+ }
42
+ [dir="rtl"] .np-flow-navigation--sm .np-flow-navigation__stepper {
43
+ padding-right: 24px !important;
44
+ padding-right: var(--size-24) !important;
45
+ }
46
+ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
30
47
  padding-left: 24px !important;
31
48
  padding-left: var(--size-24) !important;
49
+ }
50
+ [dir="rtl"] .np-flow-navigation--sm .np-flow-navigation__stepper {
51
+ padding-left: 24px !important;
52
+ padding-left: var(--size-24) !important;
53
+ }
54
+ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
32
55
  padding-right: 24px !important;
33
56
  padding-right: var(--size-24) !important;
34
- min-height: 56px;
35
57
  }
36
58
  .np-flow-navigation--lg .np-flow-navigation__stepper {
37
59
  max-width: 562px;
@@ -1,4 +1,5 @@
1
1
  @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
2
3
  }.np-form-control {
3
4
  --ring-width: 1px;
4
5
  --ring-color: var(--color-interactive-secondary);
@@ -1,4 +1,5 @@
1
1
  @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
2
3
  }.np-form-control {
3
4
  --ring-width: 1px;
4
5
  --ring-color: var(--color-interactive-secondary);
package/src/main.css CHANGED
@@ -74,7 +74,9 @@ div.critical-comms .critical-comms-body {
74
74
  flex-wrap: wrap;
75
75
  }
76
76
  }
77
- .tw-date-lookup-calendar > tbody > tr > td.weekend button {line-height: 1.5;line-height: var(--line-height-body);
77
+ .tw-date-lookup-calendar > tbody > tr > td.weekend button {
78
+ font-weight: 400;
79
+ font-weight: var(--font-weight-regular);line-height: 1.5;line-height: var(--line-height-body);
78
80
  }
79
81
  .tw-date-lookup-calendar > tbody > tr > td.weekend button {
80
82
  font-size: 1rem;
@@ -86,6 +88,8 @@ div.critical-comms .critical-comms-body {
86
88
  }
87
89
  @media (min-width: 768px) {
88
90
  }
91
+ @media (min-width: 768px) {
92
+ }
89
93
  .np-accordion-item {
90
94
  display: block;
91
95
  width: 100%;
@@ -254,6 +258,7 @@ div.critical-comms .critical-comms-body {
254
258
  }
255
259
  .tw-avatar.tw-avatar--initials,
256
260
  .tw-avatar.tw-avatar--emoji {
261
+ font-family: Arial, sans-serif;
257
262
  font-weight: 600;
258
263
  font-weight: var(--font-weight-semi-bold);
259
264
  }
@@ -592,6 +597,13 @@ div.critical-comms .critical-comms-body {
592
597
  [dir="rtl"] .np-card__button {
593
598
  text-align: right;
594
599
  }
600
+ .np-theme-personal .np-card__button:focus {
601
+ outline: none;
602
+ }
603
+ .np-theme-personal .np-card__button:focus-visible {
604
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
605
+ outline-offset: var(--ring-outline-offset);
606
+ }
595
607
  .np-card__content {
596
608
  padding: 24px 16px;
597
609
  padding: var(--size-24) var(--size-16);
@@ -2030,9 +2042,19 @@ button.np-option {
2030
2042
  max-width: 1164px;
2031
2043
  }
2032
2044
  .np-flow-navigation__stepper {
2033
- padding-bottom: 0px !important;
2034
- padding-left: 0px !important;
2035
- padding-right: 0px !important;
2045
+ padding-bottom: 0 !important;
2046
+ }
2047
+ [dir="rtl"] .np-flow-navigation__stepper {
2048
+ padding-right: 0 !important;
2049
+ }
2050
+ html:not([dir="rtl"]) .np-flow-navigation__stepper {
2051
+ padding-left: 0 !important;
2052
+ }
2053
+ [dir="rtl"] .np-flow-navigation__stepper {
2054
+ padding-left: 0 !important;
2055
+ }
2056
+ html:not([dir="rtl"]) .np-flow-navigation__stepper {
2057
+ padding-right: 0 !important;
2036
2058
  }
2037
2059
  .np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps {
2038
2060
  display: none;
@@ -2044,11 +2066,23 @@ button.np-option {
2044
2066
  height: auto;
2045
2067
  }
2046
2068
  .np-flow-navigation--sm .np-flow-navigation__stepper {
2069
+ min-height: 56px;
2070
+ }
2071
+ [dir="rtl"] .np-flow-navigation--sm .np-flow-navigation__stepper {
2072
+ padding-right: 24px !important;
2073
+ padding-right: var(--size-24) !important;
2074
+ }
2075
+ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2047
2076
  padding-left: 24px !important;
2048
2077
  padding-left: var(--size-24) !important;
2078
+ }
2079
+ [dir="rtl"] .np-flow-navigation--sm .np-flow-navigation__stepper {
2080
+ padding-left: 24px !important;
2081
+ padding-left: var(--size-24) !important;
2082
+ }
2083
+ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2049
2084
  padding-right: 24px !important;
2050
2085
  padding-right: var(--size-24) !important;
2051
- min-height: 56px;
2052
2086
  }
2053
2087
  .np-flow-navigation--lg .np-flow-navigation__stepper {
2054
2088
  max-width: 562px;
@@ -3964,6 +3998,7 @@ html:not([dir="rtl"]) .np-navigation-option {
3964
3998
  z-index: 1060;
3965
3999
  }
3966
4000
  [dir="rtl"] .snackbar {
4001
+ right: 0;
3967
4002
  left: auto;
3968
4003
  left: initial;
3969
4004
  }
@@ -4605,6 +4640,104 @@ html:not([dir="rtl"]) .np-navigation-option {
4605
4640
  .np-theme-personal .np-dropdown-menu .np-dropdown-item--focused {
4606
4641
  box-shadow: inset 0 0 0 2px var(--color-interactive-primary);
4607
4642
  }
4643
+ .segmented-control {
4644
+ box-sizing: border-box;
4645
+ --segment-highlight-width: 0;
4646
+ --segment-highlight-x: var(--size-4);
4647
+ }
4648
+ .segmented-control__segments {
4649
+ display: inline-flex;
4650
+ position: relative;
4651
+ justify-content: center;
4652
+ align-items: center;
4653
+ background: rgba(134,167,189,0.10196);
4654
+ background: var(--color-background-neutral);
4655
+ padding: 4px;
4656
+ padding: var(--size-4);
4657
+ border-radius: 24px;
4658
+ border-radius: var(--size-24);
4659
+ width: 100%;
4660
+ transition: outline 300ms;
4661
+ outline: 2px solid transparent;
4662
+ }
4663
+ .segmented-control--input:has(:focus-visible) > .segmented-control__segments::after {
4664
+ outline: 2px solid var(--color-interactive-primary);
4665
+ }
4666
+ .segmented-control__segments::after {
4667
+ content: "";
4668
+ background: #ffffff;
4669
+ background: var(--color-background-screen);
4670
+ width: var(--segment-highlight-width);
4671
+ position: absolute;
4672
+ top: 4px;
4673
+ top: var(--size-4);
4674
+ bottom: 4px;
4675
+ bottom: var(--size-4);
4676
+ left: var(--segment-highlight-x);
4677
+ z-index: 0;
4678
+ border-radius: 24px;
4679
+ border-radius: var(--size-24);
4680
+ transition: left 300ms;
4681
+ }
4682
+ .segmented-control__segments--no-animate::after {
4683
+ transition: none !important;
4684
+ }
4685
+ .segmented-control__segment {
4686
+ position: relative;
4687
+ flex: 1 1 100%;
4688
+ align-items: center;
4689
+ text-align: center;
4690
+ vertical-align: middle;
4691
+ min-height: 40px;
4692
+ min-height: var(--size-40);
4693
+ line-height: 40px;
4694
+ line-height: var(--size-40);
4695
+ margin: 0;
4696
+ border-radius: 24px;
4697
+ border-radius: var(--size-24);
4698
+ z-index: 1;
4699
+ cursor: pointer;
4700
+ transition: font-weight 300ms, background 300ms;
4701
+ }
4702
+ .segmented-control__segment:hover {
4703
+ background: rgba(0,0,0,0.10196);
4704
+ background: var(--color-background-overlay);
4705
+ }
4706
+ .segmented-control__radio-input {
4707
+ position: fixed;
4708
+ opacity: 0;
4709
+ pointer-events: none;
4710
+ }
4711
+ .segmented-control__button {
4712
+ background: none;
4713
+ -webkit-appearance: none;
4714
+ -moz-appearance: none;
4715
+ appearance: none;
4716
+ border: none;
4717
+ outline: none;
4718
+ width: 100%;
4719
+ height: 100%;
4720
+ font: inherit;
4721
+ padding: none;
4722
+ outline: 2px solid transparent;
4723
+ }
4724
+ .segmented-control__button:focus {
4725
+ outline-offset: 0px;
4726
+ }
4727
+ .segmented-control__button:focus-visible {
4728
+ outline-color: var(--color-interactive-primary);
4729
+ }
4730
+ .segmented-control__selected-segment:hover {
4731
+ background: transparent;
4732
+ }
4733
+ .segmented-control__selected-segment {
4734
+ font-weight: 800;
4735
+ font-weight: var(--font-weight-bold);
4736
+ }
4737
+ .segmented-control__label-text {
4738
+ white-space: nowrap;
4739
+ color: var(--color-interactive-primary);
4740
+ }
4608
4741
  .np-summary {
4609
4742
  min-width: 280px;
4610
4743
  }
@@ -4913,6 +5046,10 @@ html:not([dir="rtl"]) .np-navigation-option {
4913
5046
  width: 100%;
4914
5047
  }
4915
5048
  .np-tile__description {
5049
+ color: #5d7079;
5050
+ color: var(--color-content-secondary);
5051
+ margin-top: 12px;
5052
+ margin-top: var(--size-12);
4916
5053
  display: inline-block;
4917
5054
  }
4918
5055
  .np-tile--small.np-decision__tile--fixed-width {
package/src/main.less CHANGED
@@ -53,6 +53,7 @@
53
53
  @import "./statusIcon/StatusIcon.less";
54
54
  @import "./stepper/Stepper.less";
55
55
  @import "./select/Select.less";
56
+ @import "./segmentedControl/SegmentedControl.less";
56
57
  @import "./summary/Summary.less";
57
58
  @import "./switch/Switch.less";
58
59
  @import "./tabs/Tabs.less";
@@ -1,4 +1,5 @@
1
1
  @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
2
3
  }.np-theme-personal .np-popover__container {
3
4
  border-radius: 16px;
4
5
  border-radius: var(--radius-medium);
@@ -0,0 +1,98 @@
1
+ .segmented-control {
2
+ box-sizing: border-box;
3
+ --segment-highlight-width: 0;
4
+ --segment-highlight-x: var(--size-4);
5
+ }
6
+ .segmented-control__segments {
7
+ display: inline-flex;
8
+ position: relative;
9
+ justify-content: center;
10
+ align-items: center;
11
+ background: rgba(134,167,189,0.10196);
12
+ background: var(--color-background-neutral);
13
+ padding: 4px;
14
+ padding: var(--size-4);
15
+ border-radius: 24px;
16
+ border-radius: var(--size-24);
17
+ width: 100%;
18
+ transition: outline 300ms;
19
+ outline: 2px solid transparent;
20
+ }
21
+ .segmented-control--input:has(:focus-visible) > .segmented-control__segments::after {
22
+ outline: 2px solid var(--color-interactive-primary);
23
+ }
24
+ .segmented-control__segments::after {
25
+ content: "";
26
+ background: #ffffff;
27
+ background: var(--color-background-screen);
28
+ width: var(--segment-highlight-width);
29
+ position: absolute;
30
+ top: 4px;
31
+ top: var(--size-4);
32
+ bottom: 4px;
33
+ bottom: var(--size-4);
34
+ left: var(--segment-highlight-x);
35
+ z-index: 0;
36
+ border-radius: 24px;
37
+ border-radius: var(--size-24);
38
+ transition: left 300ms;
39
+ }
40
+ .segmented-control__segments--no-animate::after {
41
+ transition: none !important;
42
+ }
43
+ .segmented-control__segment {
44
+ position: relative;
45
+ flex: 1 1 100%;
46
+ align-items: center;
47
+ text-align: center;
48
+ vertical-align: middle;
49
+ min-height: 40px;
50
+ min-height: var(--size-40);
51
+ line-height: 40px;
52
+ line-height: var(--size-40);
53
+ margin: 0;
54
+ border-radius: 24px;
55
+ border-radius: var(--size-24);
56
+ z-index: 1;
57
+ cursor: pointer;
58
+ transition: font-weight 300ms, background 300ms;
59
+ }
60
+ .segmented-control__segment:hover {
61
+ background: rgba(0,0,0,0.10196);
62
+ background: var(--color-background-overlay);
63
+ }
64
+ .segmented-control__radio-input {
65
+ position: fixed;
66
+ opacity: 0;
67
+ pointer-events: none;
68
+ }
69
+ .segmented-control__button {
70
+ background: none;
71
+ -webkit-appearance: none;
72
+ -moz-appearance: none;
73
+ appearance: none;
74
+ border: none;
75
+ outline: none;
76
+ width: 100%;
77
+ height: 100%;
78
+ font: inherit;
79
+ padding: none;
80
+ outline: 2px solid transparent;
81
+ }
82
+ .segmented-control__button:focus {
83
+ outline-offset: 0px;
84
+ }
85
+ .segmented-control__button:focus-visible {
86
+ outline-color: var(--color-interactive-primary);
87
+ }
88
+ .segmented-control__selected-segment:hover {
89
+ background: transparent;
90
+ }
91
+ .segmented-control__selected-segment {
92
+ font-weight: 800;
93
+ font-weight: var(--font-weight-bold);
94
+ }
95
+ .segmented-control__label-text {
96
+ white-space: nowrap;
97
+ color: var(--color-interactive-primary);
98
+ }
@@ -0,0 +1,97 @@
1
+ .segmented-control {
2
+ box-sizing: border-box;
3
+ --segment-highlight-width: 0;
4
+ --segment-highlight-x: var(--size-4);
5
+ }
6
+
7
+ .segmented-control__segments {
8
+ display: inline-flex;
9
+ position: relative;
10
+ justify-content: center;
11
+ align-items: center;
12
+ background: var(--color-background-neutral);
13
+ padding: var(--size-4);
14
+ border-radius: var(--size-24);
15
+ width: 100%;
16
+ transition: outline 300ms;
17
+ outline: 2px solid transparent;
18
+ }
19
+
20
+ .segmented-control--input:has(:focus-visible) > .segmented-control__segments::after {
21
+ outline: 2px solid var(--color-interactive-primary);
22
+ }
23
+
24
+ .segmented-control__segments::after {
25
+ content: "";
26
+ background: var(--color-background-screen);
27
+ width: var(--segment-highlight-width);
28
+ position: absolute;
29
+ top: var(--size-4);
30
+ bottom: var(--size-4);
31
+ left: var(--segment-highlight-x);
32
+ z-index: 0;
33
+ border-radius: var(--size-24);
34
+ transition: left 300ms;
35
+ }
36
+
37
+ .segmented-control__segments--no-animate::after {
38
+ transition: none !important;
39
+ }
40
+
41
+ .segmented-control__segment {
42
+ position: relative;
43
+ flex: 1 1 100%;
44
+ align-items: center;
45
+ text-align: center;
46
+ vertical-align: middle;
47
+ min-height: var(--size-40);
48
+ line-height: var(--size-40);
49
+ margin: 0;
50
+ border-radius: var(--size-24);
51
+ z-index: 1;
52
+ cursor: pointer;
53
+ transition: font-weight 300ms, background 300ms;
54
+ }
55
+
56
+ .segmented-control__segment:hover {
57
+ background: var(--color-background-overlay);
58
+ }
59
+
60
+ .segmented-control__radio-input {
61
+ position: fixed;
62
+ opacity: 0;
63
+ pointer-events: none;
64
+ }
65
+
66
+ .segmented-control__button {
67
+ background: none;
68
+ appearance: none;
69
+ border: none;
70
+ outline: none;
71
+ width: 100%;
72
+ height: 100%;
73
+ font: inherit;
74
+ padding: none;
75
+ outline: 2px solid transparent;
76
+ }
77
+
78
+ .segmented-control__button:focus {
79
+ outline-offset: 0px;
80
+ }
81
+
82
+ .segmented-control__button:focus-visible {
83
+ outline-color: var(--color-interactive-primary);
84
+ }
85
+
86
+ .segmented-control__selected-segment:hover {
87
+ background: transparent;
88
+ }
89
+
90
+ .segmented-control__selected-segment {
91
+ font-weight: var(--font-weight-bold);
92
+ }
93
+
94
+ .segmented-control__label-text {
95
+ white-space: nowrap;
96
+ color: var(--color-interactive-primary);
97
+ }
@@ -0,0 +1,50 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import React from 'react';
3
+
4
+ import { SegmentedControl } from './SegmentedControl';
5
+
6
+ export default {
7
+ component: SegmentedControl,
8
+ title: 'Forms/SegmentedControl',
9
+ };
10
+
11
+ const segments = [
12
+ { label: 'Cupcakes', value: 'cupcakes' },
13
+ { label: 'Sponge cake', value: 'spongecake' },
14
+ { label: 'Carrot cake', value: 'carrotcake' },
15
+ ];
16
+
17
+ const Template: StoryFn = (args) => {
18
+ const [selectedValue, setSelectedValue] = React.useState(segments[0].value);
19
+
20
+ return (
21
+ <div className="p-a-2">
22
+ <SegmentedControl
23
+ name="aRadioGroupName"
24
+ segments={segments}
25
+ {...(args.type === 'navigation'
26
+ ? { type: 'navigation', controls: 'aControlId' }
27
+ : { type: 'input' })}
28
+ defaultValue={selectedValue}
29
+ onChange={setSelectedValue}
30
+ />
31
+ <div className="m-a-2" id="aControlId">
32
+ <p>Selected value: {selectedValue}</p>
33
+ </div>
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export const SegmentedControlDefault = {
39
+ render: Template,
40
+ args: {
41
+ type: 'input',
42
+ },
43
+ };
44
+
45
+ export const SegmentedControlNav = {
46
+ render: Template,
47
+ args: {
48
+ type: 'navigation',
49
+ },
50
+ };