@transferwise/components 0.0.0-experimental-45bc551 → 0.0.0-experimental-358e009

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.
Files changed (47) hide show
  1. package/build/main.css +77 -97
  2. package/build/prompt/InlinePrompt/InlinePrompt.js +10 -8
  3. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  4. package/build/prompt/InlinePrompt/InlinePrompt.mjs +11 -9
  5. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  6. package/build/styles/main.css +77 -97
  7. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +23 -2
  8. package/build/tabs/Tabs.js +14 -171
  9. package/build/tabs/Tabs.js.map +1 -1
  10. package/build/tabs/Tabs.mjs +16 -173
  11. package/build/tabs/Tabs.mjs.map +1 -1
  12. package/build/tabs/utils.js +0 -18
  13. package/build/tabs/utils.js.map +1 -1
  14. package/build/tabs/utils.mjs +1 -17
  15. package/build/tabs/utils.mjs.map +1 -1
  16. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +1 -1
  17. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  18. package/build/types/tabs/Tabs.d.ts +2 -24
  19. package/build/types/tabs/Tabs.d.ts.map +1 -1
  20. package/build/types/tabs/utils.d.ts +0 -2
  21. package/build/types/tabs/utils.d.ts.map +1 -1
  22. package/package.json +2 -3
  23. package/src/listItem/ListItem.spec.tsx +8 -6
  24. package/src/main.css +77 -97
  25. package/src/main.less +1 -2
  26. package/src/prompt/InlinePrompt/InlinePrompt.css +23 -2
  27. package/src/prompt/InlinePrompt/InlinePrompt.less +18 -3
  28. package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +6 -6
  29. package/src/prompt/InlinePrompt/InlinePrompt.tsx +7 -6
  30. package/src/tabs/Tabs.spec.tsx +0 -22
  31. package/src/tabs/Tabs.story.tsx +1 -45
  32. package/src/tabs/Tabs.tsx +23 -240
  33. package/src/tabs/utils.spec.ts +0 -58
  34. package/src/tabs/utils.ts +0 -20
  35. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +0 -45
  36. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +0 -1
  37. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +0 -43
  38. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +0 -1
  39. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +0 -41
  40. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +0 -30
  41. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +0 -1
  42. package/build/types/prompt/PrimitivePrompt/index.d.ts +0 -3
  43. package/build/types/prompt/PrimitivePrompt/index.d.ts.map +0 -1
  44. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +0 -41
  45. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +0 -37
  46. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +0 -70
  47. package/src/prompt/PrimitivePrompt/index.ts +0 -2
@@ -1,43 +1,31 @@
1
1
  import { Component } from 'react';
2
- import { Size, Width } from '../common';
2
+ import { Width } from '../common';
3
3
  import { Swipe } from './utils';
4
4
  export interface TabItem {
5
5
  title: string;
6
6
  content: React.ReactNode;
7
7
  disabled: boolean;
8
8
  }
9
- type TabsTransitionSpacing = 'default' | `${Size.EXTRA_SMALL | Size.SMALL | Size.MEDIUM | Size.LARGE}`;
10
9
  export interface TabsProps {
11
10
  tabs: TabItem[];
12
11
  selected: number;
13
12
  name: string;
14
- animatePanelsOnClick?: boolean;
15
13
  changeTabOnSwipe?: boolean;
16
14
  className?: string;
17
- transitionSpacing?: TabsTransitionSpacing;
18
15
  headerWidth?: `${Width}`;
19
- id?: string;
20
16
  onTabSelect: (index: number) => void;
21
17
  }
22
18
  interface TabsState {
23
19
  start: Swipe | null;
24
- translateX: number;
25
- translateFrom: number;
26
- translateTo: number;
27
20
  translateLineX: string | null;
28
- isAnimating: boolean;
29
21
  isSwiping: boolean;
30
22
  isScrolling: boolean;
31
- lastSwipeVelocity: number;
32
23
  fullWidthTabs: boolean;
33
- currentSwipe: Swipe[];
34
- selectedTabIndex: number;
35
24
  }
36
25
  export default class Tabs extends Component<TabsProps, TabsState> {
37
26
  props: TabsProps & Required<Pick<TabsProps, keyof typeof Tabs.defaultProps>>;
38
27
  static defaultProps: {
39
28
  changeTabOnSwipe: true;
40
- transitionSpacing: "default";
41
29
  headerWidth: Width.BLOCK;
42
30
  };
43
31
  containerReference: import("react").RefObject<HTMLDivElement>;
@@ -45,10 +33,9 @@ export default class Tabs extends Component<TabsProps, TabsState> {
45
33
  container: HTMLDivElement | null;
46
34
  containerWidth: number;
47
35
  tabRefs: (HTMLLIElement | null)[];
48
- get filteredTabsLength(): number;
49
36
  get MAX_INDEX(): number;
50
37
  componentDidMount(): void;
51
- componentDidUpdate(previousProps: TabsProps, previousState: TabsState): void;
38
+ componentDidUpdate(previousProps: TabsProps): void;
52
39
  componentWillUnmount(): void;
53
40
  handleResize: () => void;
54
41
  setContainerRefAndWidth: (node: HTMLDivElement | null) => void;
@@ -60,17 +47,8 @@ export default class Tabs extends Component<TabsProps, TabsState> {
60
47
  getTabLineWidth: () => string;
61
48
  getTabToSelect: (selected: number, start: Swipe, end: Swipe) => number;
62
49
  swipedOverHalfOfContainer: (difference: number) => boolean;
63
- calculateApplicableDragDifference: ({ currentSelected, nextSelected, start, end, }: {
64
- currentSelected: number;
65
- nextSelected: number;
66
- start: Swipe;
67
- end: Swipe;
68
- }) => number | false;
69
50
  switchTab: (index: number) => void;
70
- getTabIndexWithoutDisabledTabs(index: number): number;
71
- animateToTab: (index: number, instant?: boolean) => void;
72
51
  animateLine: (index: number) => void;
73
- animatePanel: (index: number, instant?: boolean) => void;
74
52
  disableScroll: (event: Event) => void;
75
53
  handleTabClick: (index: number) => () => void;
76
54
  onKeyDown: (index: number) => (event: React.KeyboardEvent<HTMLLIElement>) => void;
@@ -1 +1 @@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AAa,GAAI,OAAO,KAAK,UAM3B;IAEF,cAAc,GAAI,OAAO,MAAM,gBAE7B;IAEF,SAAS,GAAI,OAAO,MAAM,MAAM,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,UAIvE;IAEF,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CASvD;IAEF,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAgCtD;IAEF,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CA6BrD;IAEF,MAAM;CAgFP"}
@@ -8,6 +8,4 @@ export declare const getSwipeDifference: (start: Swipe, end: Swipe, axis?: "x" |
8
8
  export declare const swipedLeftToRight: (start: Swipe, end: Swipe) => boolean;
9
9
  export declare const swipedRightToLeft: (start: Swipe, end: Swipe) => boolean;
10
10
  export declare const swipeShouldChangeTab: (start: Swipe, end: Swipe) => boolean;
11
- export declare function getVelocity(coords: Swipe[]): number;
12
- export declare const getElasticDragDifference: (difference: number) => number;
13
11
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tabs/utils.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,WAIxD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,EAAE,OAAM,GAAG,GAAG,GAAS,WAEjF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAEzD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAEzD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAK5D,CAAC;AAEF,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,UAU1C;AAOD,eAAO,MAAM,wBAAwB,GAAI,YAAY,MAAM,WACmB,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tabs/utils.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,WAIxD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,EAAE,OAAM,GAAG,GAAG,GAAS,WAEjF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAEzD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAEzD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,YAK5D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-45bc551",
3
+ "version": "0.0.0-experimental-358e009",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -85,8 +85,8 @@
85
85
  "storybook": "^10.3.0-alpha.0",
86
86
  "storybook-addon-tag-badges": "^3.0.4",
87
87
  "storybook-addon-test-codegen": "^3.0.1",
88
- "@transferwise/neptune-css": "14.26.1",
89
88
  "@transferwise/less-config": "3.1.2",
89
+ "@transferwise/neptune-css": "14.26.1",
90
90
  "@wise/components-theming": "1.10.1",
91
91
  "@wise/wds-configs": "0.0.0"
92
92
  },
@@ -107,7 +107,6 @@
107
107
  "@popperjs/core": "^2.11.8",
108
108
  "@react-aria/focus": "^3.21.3",
109
109
  "@react-aria/overlays": "^3.31.0",
110
- "@react-spring/web": "~10.0.3",
111
110
  "@transferwise/formatting": "^2.13.4",
112
111
  "@transferwise/neptune-validation": "^3.3.1",
113
112
  "clsx": "^2.1.1",
@@ -1526,9 +1526,10 @@ describe('ListItem', () => {
1526
1526
  );
1527
1527
  expect(screen.queryByText(prompt)).not.toBeInTheDocument();
1528
1528
  expect(screen.getByText(disabledPromptMessage)).toBeInTheDocument();
1529
- expect(
1530
- screen.getByTestId('InlinePrompt_Muted').parentNode?.parentNode?.parentNode,
1531
- ).toHaveAttribute('id', expect.stringMatching(/_prompt$/));
1529
+ expect(screen.getByTestId('InlinePrompt_Muted').parentNode?.parentNode).toHaveAttribute(
1530
+ 'id',
1531
+ expect.stringMatching(/_prompt$/),
1532
+ );
1532
1533
  });
1533
1534
 
1534
1535
  it('should render muted prompt if disabled and disabledPromptMessage are set', () => {
@@ -1536,9 +1537,10 @@ describe('ListItem', () => {
1536
1537
  <ListItem title="Test Title" disabled disabledPromptMessage={disabledPromptMessage} />,
1537
1538
  );
1538
1539
  expect(screen.getByText(disabledPromptMessage)).toBeInTheDocument();
1539
- expect(
1540
- screen.getByTestId('InlinePrompt_Muted').parentNode?.parentNode?.parentNode,
1541
- ).toHaveAttribute('id', expect.stringMatching(/_prompt$/));
1540
+ expect(screen.getByTestId('InlinePrompt_Muted').parentNode?.parentNode).toHaveAttribute(
1541
+ 'id',
1542
+ expect.stringMatching(/_prompt$/),
1543
+ );
1542
1544
  });
1543
1545
  });
1544
1546
  });
package/src/main.css CHANGED
@@ -920,6 +920,83 @@
920
920
  .np-theme-personal .tw-avatar--outlined:not(.disabled):not(:disabled):hover {
921
921
  border-color: var(--color-interactive-primary-hover);
922
922
  }
923
+ .wds-inline-prompt {
924
+ display: inline-flex;
925
+ text-align: left;
926
+ padding-top: calc(8px / 2);
927
+ padding-top: calc(var(--padding-x-small) / 2);
928
+ padding-bottom: calc(8px / 2);
929
+ padding-bottom: calc(var(--padding-x-small) / 2);
930
+ padding-left: calc(8px - 1px);
931
+ padding-left: calc(var(--padding-x-small) - 1px);
932
+ padding-right: 8px;
933
+ padding-right: var(--padding-x-small);
934
+ border-radius: 10px;
935
+ border-radius: var(--radius-small);
936
+ word-break: break-word;
937
+ word-wrap: break-word;
938
+ }
939
+ .wds-inline-prompt:has(a),
940
+ .wds-inline-prompt:has(button) {
941
+ position: relative;
942
+ z-index: 1;
943
+ }
944
+ .wds-inline-prompt:has(a):hover,
945
+ .wds-inline-prompt:has(button):hover {
946
+ background-color: var(--color-sentiment-background-surface-hover);
947
+ }
948
+ .wds-inline-prompt:has(a):active,
949
+ .wds-inline-prompt:has(button):active {
950
+ background-color: var(--color-sentiment-background-surface-active);
951
+ }
952
+ .wds-inline-prompt--full-width {
953
+ width: 100%;
954
+ }
955
+ .wds-inline-prompt--muted {
956
+ opacity: 0.93;
957
+ filter: grayscale(1);
958
+ }
959
+ .wds-inline-prompt a,
960
+ .wds-inline-prompt button {
961
+ color: var(--color-sentiment-content-primary);
962
+ text-underline-offset: calc(4px / 2);
963
+ text-underline-offset: calc(var(--size-4) / 2);
964
+ }
965
+ .wds-inline-prompt a:hover,
966
+ .wds-inline-prompt button:hover {
967
+ color: var(--color-sentiment-content-primary-hover);
968
+ }
969
+ .wds-inline-prompt a:active,
970
+ .wds-inline-prompt button:active {
971
+ color: var(--color-sentiment-content-primary-active);
972
+ }
973
+ .wds-inline-prompt a:first-of-type:before,
974
+ .wds-inline-prompt button:first-of-type:before {
975
+ content: "";
976
+ position: absolute;
977
+ inset: 0;
978
+ }
979
+ .wds-inline-prompt__media-wrapper {
980
+ padding-right: calc(12px / 2);
981
+ padding-right: calc(var(--size-12) / 2);
982
+ padding-top: calc(4px - 1px);
983
+ padding-top: calc(var(--size-4) - 1px);
984
+ padding-bottom: calc(4px - 1px);
985
+ padding-bottom: calc(var(--size-4) - 1px);
986
+ }
987
+ .wds-inline-prompt__media-wrapper .tw-icon-tags,
988
+ .wds-inline-prompt__media-wrapper .tw-icon-confetti {
989
+ color: var(--color-sentiment-content-primary);
990
+ }
991
+ .wds-inline-prompt .wds-inline-prompt-process-indicator {
992
+ width: 16px;
993
+ width: var(--size-16);
994
+ height: 16px;
995
+ height: var(--size-16);
996
+ }
997
+ .wds-inline-prompt .wds-inline-prompt-process-indicator .process-circle {
998
+ stroke: currentColor;
999
+ }
923
1000
  .np-dot {
924
1001
  --np-dot-size: 14px;
925
1002
  position: relative;
@@ -5335,103 +5412,6 @@ html:not([dir="rtl"]) .np-navigation-option {
5335
5412
  .np-CardGroup .np-Card.np-Card--promoCard {
5336
5413
  max-width: 100%;
5337
5414
  }
5338
- .wds-prompt {
5339
- border-radius: 10px;
5340
- border-radius: var(--radius-small);
5341
- display: flex;
5342
- word-wrap: break-word;
5343
- padding: 8px;
5344
- padding: var(--Prompt-padding, var(--padding-x-small));
5345
- text-align: left;
5346
- word-break: break-word;
5347
- }
5348
- .wds-prompt__content-wrapper {
5349
- display: grid;
5350
- grid-gap: 16px;
5351
- grid-gap: var(--Prompt-gap, var(--size-16));
5352
- gap: 16px;
5353
- gap: var(--Prompt-gap, var(--size-16));
5354
- grid-template-columns: auto 1fr;
5355
- width: 100%;
5356
- }
5357
- .wds-prompt__media-wrapper {
5358
- align-self: flex-start;
5359
- padding-top: calc(4px - 1px);
5360
- padding-top: calc(var(--size-4) - 1px);
5361
- }
5362
- .wds-prompt__media-wrapper .tw-icon-tags,
5363
- .wds-prompt__media-wrapper .tw-icon-confetti {
5364
- color: var(--color-sentiment-content-primary);
5365
- }
5366
- .wds-prompt__actions-wrapper {
5367
- display: flex;
5368
- flex-wrap: wrap;
5369
- gap: 8px;
5370
- gap: var(--Prompt-actions-gap, var(--size-8));
5371
- grid-column-start: 2;
5372
- }
5373
- @media (max-width: 991px) {
5374
- .wds-prompt__actions-wrapper {
5375
- grid-column: span 2;
5376
- width: 100%;
5377
- }
5378
- }
5379
- .wds-inline-prompt {
5380
- --Prompt-gap: calc(var(--size-12) / 2);
5381
- --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
5382
- display: inline-flex;
5383
- border-radius: 10px;
5384
- border-radius: var(--radius-small);
5385
- }
5386
- .wds-inline-prompt:has(a),
5387
- .wds-inline-prompt:has(button) {
5388
- position: relative;
5389
- z-index: 1;
5390
- }
5391
- .wds-inline-prompt:has(a):hover,
5392
- .wds-inline-prompt:has(button):hover {
5393
- background-color: var(--color-sentiment-background-surface-hover);
5394
- }
5395
- .wds-inline-prompt:has(a):active,
5396
- .wds-inline-prompt:has(button):active {
5397
- background-color: var(--color-sentiment-background-surface-active);
5398
- }
5399
- .wds-inline-prompt--full-width {
5400
- width: 100%;
5401
- }
5402
- .wds-inline-prompt--muted {
5403
- opacity: 0.93;
5404
- filter: grayscale(1);
5405
- }
5406
- .wds-inline-prompt a,
5407
- .wds-inline-prompt button {
5408
- color: var(--color-sentiment-content-primary);
5409
- text-underline-offset: calc(4px / 2);
5410
- text-underline-offset: calc(var(--size-4) / 2);
5411
- }
5412
- .wds-inline-prompt a:hover,
5413
- .wds-inline-prompt button:hover {
5414
- color: var(--color-sentiment-content-primary-hover);
5415
- }
5416
- .wds-inline-prompt a:active,
5417
- .wds-inline-prompt button:active {
5418
- color: var(--color-sentiment-content-primary-active);
5419
- }
5420
- .wds-inline-prompt a:first-of-type:before,
5421
- .wds-inline-prompt button:first-of-type:before {
5422
- content: "";
5423
- position: absolute;
5424
- inset: 0;
5425
- }
5426
- .wds-inline-prompt .wds-inline-prompt-process-indicator {
5427
- width: 16px;
5428
- width: var(--size-16);
5429
- height: 16px;
5430
- height: var(--size-16);
5431
- }
5432
- .wds-inline-prompt .wds-inline-prompt-process-indicator .process-circle {
5433
- stroke: currentColor;
5434
- }
5435
5415
  .wds-radio-group .np-radio:last-child label {
5436
5416
  margin-bottom: 0;
5437
5417
  }
package/src/main.less CHANGED
@@ -6,6 +6,7 @@
6
6
  @import "./actionOption/ActionOption.less";
7
7
  @import "./alert/Alert.less";
8
8
  @import "./avatar/Avatar.less";
9
+ @import "./prompt/InlinePrompt/InlinePrompt.less";
9
10
  @import "./avatarView/AvatarView.less";
10
11
  @import "./avatarLayout/AvatarLayout.less";
11
12
  @import "./iconButton/IconButton.less";
@@ -60,8 +61,6 @@
60
61
  @import "./phoneNumberInput/PhoneNumberInput.less";
61
62
  @import "./popover/Popover.less";
62
63
  @import "./promoCard/PromoCard.less";
63
- @import "./prompt/PrimitivePrompt/PrimitivePrompt.less";
64
- @import "./prompt/InlinePrompt/InlinePrompt.less";
65
64
  @import "./radioGroup/RadioGroup.less";
66
65
  @import "./section/Section.less";
67
66
  @import "./slidingPanel/SlidingPanel.less";
@@ -1,9 +1,18 @@
1
1
  .wds-inline-prompt {
2
- --Prompt-gap: calc(var(--size-12) / 2);
3
- --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
4
2
  display: inline-flex;
3
+ text-align: left;
4
+ padding-top: calc(8px / 2);
5
+ padding-top: calc(var(--padding-x-small) / 2);
6
+ padding-bottom: calc(8px / 2);
7
+ padding-bottom: calc(var(--padding-x-small) / 2);
8
+ padding-left: calc(8px - 1px);
9
+ padding-left: calc(var(--padding-x-small) - 1px);
10
+ padding-right: 8px;
11
+ padding-right: var(--padding-x-small);
5
12
  border-radius: 10px;
6
13
  border-radius: var(--radius-small);
14
+ word-break: break-word;
15
+ word-wrap: break-word;
7
16
  }
8
17
  .wds-inline-prompt:has(a),
9
18
  .wds-inline-prompt:has(button) {
@@ -45,6 +54,18 @@
45
54
  position: absolute;
46
55
  inset: 0;
47
56
  }
57
+ .wds-inline-prompt__media-wrapper {
58
+ padding-right: calc(12px / 2);
59
+ padding-right: calc(var(--size-12) / 2);
60
+ padding-top: calc(4px - 1px);
61
+ padding-top: calc(var(--size-4) - 1px);
62
+ padding-bottom: calc(4px - 1px);
63
+ padding-bottom: calc(var(--size-4) - 1px);
64
+ }
65
+ .wds-inline-prompt__media-wrapper .tw-icon-tags,
66
+ .wds-inline-prompt__media-wrapper .tw-icon-confetti {
67
+ color: var(--color-sentiment-content-primary);
68
+ }
48
69
  .wds-inline-prompt .wds-inline-prompt-process-indicator {
49
70
  width: 16px;
50
71
  width: var(--size-16);
@@ -1,9 +1,13 @@
1
1
  .wds-inline-prompt {
2
- --Prompt-gap: calc(var(--size-12) / 2);
3
- --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
4
-
5
2
  display: inline-flex;
3
+ text-align: left;
4
+ padding-top: calc(var(--padding-x-small) / 2);
5
+ padding-bottom: calc(var(--padding-x-small) / 2);
6
+ padding-left: calc(var(--padding-x-small) - 1px);
7
+ padding-right: var(--padding-x-small);
6
8
  border-radius: var(--radius-small);
9
+ word-break: break-word;
10
+ overflow-wrap: break-word;
7
11
 
8
12
  &:has(a),
9
13
  &:has(button) {
@@ -50,6 +54,17 @@
50
54
  }
51
55
  }
52
56
 
57
+ &__media-wrapper {
58
+ padding-right: calc(var(--size-12) / 2);
59
+ padding-top: calc(var(--size-4) - 1px);
60
+ padding-bottom: calc(var(--size-4) - 1px);
61
+
62
+ .tw-icon-tags,
63
+ .tw-icon-confetti {
64
+ color: var(--color-sentiment-content-primary);
65
+ }
66
+ }
67
+
53
68
  .wds-inline-prompt-process-indicator {
54
69
  width: var(--size-16);
55
70
  height: var(--size-16);
@@ -32,8 +32,8 @@ describe('InlinePrompt', () => {
32
32
  describe(sentiment, () => {
33
33
  it('should apply correct styles', () => {
34
34
  render(<InlinePrompt {...defaultProps} sentiment={sentiment} />);
35
- expect(screen.getByText('Prompt message').parentElement?.parentElement).toHaveClass(
36
- `wds-prompt--${sentiment === Sentiment.POSITIVE ? 'success' : sentiment}`,
35
+ expect(screen.getByText('Prompt message').parentElement).toHaveClass(
36
+ `wds-inline-prompt--${sentiment}`,
37
37
  );
38
38
  });
39
39
 
@@ -47,7 +47,7 @@ describe('InlinePrompt', () => {
47
47
  describe('muted state', () => {
48
48
  it('should render icon and apply css', () => {
49
49
  render(<InlinePrompt {...defaultProps} muted sentiment={sentiment} />);
50
- expect(screen.getByText('Prompt message').parentElement?.parentElement).toHaveClass(
50
+ expect(screen.getByText('Prompt message').parentElement).toHaveClass(
51
51
  'wds-inline-prompt--muted',
52
52
  );
53
53
  expect(screen.getByTestId('InlinePrompt_Muted')).toBeInTheDocument();
@@ -63,7 +63,7 @@ describe('InlinePrompt', () => {
63
63
  describe('loading state', () => {
64
64
  it('should render icon and apply css', () => {
65
65
  render(<InlinePrompt {...defaultProps} sentiment={sentiment} loading />);
66
- expect(screen.getByText('Prompt message').parentElement?.parentElement).toHaveClass(
66
+ expect(screen.getByText('Prompt message').parentElement).toHaveClass(
67
67
  'wds-inline-prompt--loading',
68
68
  );
69
69
  expect(screen.getByTestId('InlinePrompt_ProcessIndicator')).toBeInTheDocument();
@@ -134,7 +134,7 @@ describe('InlinePrompt', () => {
134
134
  );
135
135
  const el = screen.getByTestId('prompt');
136
136
  // The component should have both the original class and the SentimentSurface class
137
- expect(el).toHaveClass('wds-prompt--success');
137
+ expect(el).toHaveClass('wds-inline-prompt--positive');
138
138
  expect(el).toHaveClass('wds-sentiment-surface');
139
139
  });
140
140
 
@@ -143,7 +143,7 @@ describe('InlinePrompt', () => {
143
143
  <InlinePrompt {...defaultProps} sentiment={Sentiment.NEGATIVE} data-testid="prompt" />,
144
144
  );
145
145
  const el = screen.getByTestId('prompt');
146
- expect(el).toHaveClass('wds-prompt--negative');
146
+ expect(el).toHaveClass('wds-inline-prompt--negative');
147
147
  expect(el).toHaveClass('wds-sentiment-surface');
148
148
  });
149
149
  });
@@ -4,7 +4,7 @@ import ProcessIndicator from '../../processIndicator';
4
4
  import StatusIcon from '../../statusIcon';
5
5
  import { clsx } from 'clsx';
6
6
  import Body from '../../body';
7
- import { PrimitivePrompt } from '../PrimitivePrompt';
7
+ import SentimentSurface from '../../sentimentSurface';
8
8
 
9
9
  export type InlinePromptProps = {
10
10
  /**
@@ -60,7 +60,7 @@ export const InlinePrompt = ({
60
60
  mediaLabel,
61
61
  width = 'auto',
62
62
  'data-testid': dataTestId,
63
- ...restProps
63
+ ...rest
64
64
  }: InlinePromptProps) => {
65
65
  const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;
66
66
 
@@ -87,12 +87,12 @@ export const InlinePrompt = ({
87
87
  };
88
88
 
89
89
  return (
90
- <PrimitivePrompt
90
+ <SentimentSurface
91
91
  sentiment={surfaceSentiment}
92
- media={renderMedia()}
93
92
  data-testid={dataTestId}
94
93
  className={clsx(
95
94
  'wds-inline-prompt',
95
+ `wds-inline-prompt--${sentiment}`,
96
96
  {
97
97
  'wds-inline-prompt--full-width': width === 'full',
98
98
  'wds-inline-prompt--muted': muted,
@@ -100,9 +100,10 @@ export const InlinePrompt = ({
100
100
  },
101
101
  className,
102
102
  )}
103
- {...restProps}
103
+ {...rest}
104
104
  >
105
+ <div className="wds-inline-prompt__media-wrapper">{renderMedia()}</div>
105
106
  <Body>{children}</Body>
106
- </PrimitivePrompt>
107
+ </SentimentSurface>
107
108
  );
108
109
  };
@@ -1,4 +1,3 @@
1
- import { Globals } from '@react-spring/web';
2
1
  import { render, screen, userEvent } from '../test-utils';
3
2
  import Tabs, { TabsProps } from './Tabs';
4
3
 
@@ -18,21 +17,13 @@ function generateTabs(tabsStatus = defaultTabsStatus) {
18
17
  }));
19
18
  }
20
19
 
21
- beforeAll(() => {
22
- Globals.assign({
23
- skipAnimation: true,
24
- });
25
- });
26
-
27
20
  describe('Tabs', () => {
28
21
  const initialProps: TabsProps = {
29
- animatePanelsOnClick: true,
30
22
  tabs: generateTabs(),
31
23
  changeTabOnSwipe: true,
32
24
  name: 'testName',
33
25
  headerWidth: 'block',
34
26
  selected: 0,
35
- transitionSpacing: 'default',
36
27
  onTabSelect: jest.fn(),
37
28
  className: 'custom-class-name',
38
29
  };
@@ -65,19 +56,6 @@ describe('Tabs', () => {
65
56
  expect(screen.getByRole('tabpanel')).toHaveAttribute('id', controlsTarget);
66
57
  });
67
58
 
68
- describe('transitionSpacing', () => {
69
- test.each([
70
- ['default', '100%'],
71
- ['xs', '8px'],
72
- ['sm', '16px'],
73
- ['md', '24px'],
74
- ['lg', '32px'],
75
- ] as const)('should respect `%s`', (input, width) => {
76
- render(<Tabs {...initialProps} transitionSpacing={input} />);
77
- expect(screen.getByRole('tabpanel').nextSibling).toHaveStyle({ width });
78
- });
79
- });
80
-
81
59
  it('should render correct number of tabs', () => {
82
60
  render(<Tabs {...initialProps} />);
83
61
  expect(screen.getAllByRole('tab')).toHaveLength(defaultTabsStatus.length);
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
 
3
- import { Size, Width } from '../common';
3
+ import { Width } from '../common';
4
4
 
5
5
  import Tabs from './Tabs';
6
6
 
@@ -15,7 +15,6 @@ export const Basic = () => {
15
15
  <Tabs
16
16
  className="tabs-custom-class"
17
17
  name="tabs-docs"
18
- transitionSpacing={Size.MEDIUM}
19
18
  tabs={[
20
19
  {
21
20
  title: 'Title 1',
@@ -44,7 +43,6 @@ export const Basic = () => {
44
43
  },
45
44
  ]}
46
45
  selected={selected}
47
- animatePanelsOnClick
48
46
  onTabSelect={(index) => setSelected(index)}
49
47
  />
50
48
  );
@@ -56,7 +54,6 @@ export const AutoTabHeaderWidth = () => {
56
54
  <Tabs
57
55
  className="tabs-custom-class"
58
56
  name="tabs-docs"
59
- transitionSpacing={Size.MEDIUM}
60
57
  headerWidth={Width.AUTO}
61
58
  tabs={[
62
59
  {
@@ -92,44 +89,3 @@ export const AutoTabHeaderWidth = () => {
92
89
  />
93
90
  );
94
91
  };
95
-
96
- export const NoPanelAnimation = () => {
97
- const [selected, setSelected] = useState(0);
98
- return (
99
- <Tabs
100
- animatePanelsOnClick={false}
101
- className="tabs-custom-class"
102
- name="tabs-docs"
103
- transitionSpacing={Size.MEDIUM}
104
- tabs={[
105
- {
106
- title: 'Title 1',
107
- disabled: false,
108
- content: (
109
- <div className="p-a-2">
110
- Lorem ipsum dolor, sit amet consectetur adipisicing elit. Cum totam debitis similique
111
- </div>
112
- ),
113
- },
114
- {
115
- title: 'Title 2',
116
- disabled: false,
117
- content: (
118
- <div className="p-a-2">Lorem ipsum dolor, sit amet consectetur adipisicing elit.</div>
119
- ),
120
- },
121
- {
122
- title: 'Title 3',
123
- disabled: true,
124
- content: (
125
- <div className="p-a-2">
126
- Lorem ipsum dolor, sit amet consectetur adipisicing elit. Cum totam debitis similique
127
- </div>
128
- ),
129
- },
130
- ]}
131
- selected={selected}
132
- onTabSelect={(index) => setSelected(index)}
133
- />
134
- );
135
- };