@transferwise/components 0.0.0-experimental-c54e90a → 0.0.0-experimental-e611dd1

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 (123) hide show
  1. package/build/common/hooks/useResizeObserver.js +3 -3
  2. package/build/common/hooks/useResizeObserver.js.map +1 -1
  3. package/build/common/hooks/useResizeObserver.mjs +3 -3
  4. package/build/common/hooks/useResizeObserver.mjs.map +1 -1
  5. package/build/field/Field.js +2 -3
  6. package/build/field/Field.js.map +1 -1
  7. package/build/field/Field.mjs +2 -3
  8. package/build/field/Field.mjs.map +1 -1
  9. package/build/i18n/en.json +0 -2
  10. package/build/i18n/en.json.js +0 -2
  11. package/build/i18n/en.json.js.map +1 -1
  12. package/build/i18n/en.json.mjs +0 -2
  13. package/build/i18n/en.json.mjs.map +1 -1
  14. package/build/index.js +0 -2
  15. package/build/index.js.map +1 -1
  16. package/build/index.mjs +0 -1
  17. package/build/index.mjs.map +1 -1
  18. package/build/listItem/Prompt/ListItemPrompt.js +2 -3
  19. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  20. package/build/listItem/Prompt/ListItemPrompt.mjs +2 -3
  21. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  22. package/build/main.css +29 -192
  23. package/build/prompt/ActionPrompt/ActionPrompt.js +40 -8
  24. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  25. package/build/prompt/ActionPrompt/ActionPrompt.mjs +40 -8
  26. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  27. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +4 -11
  28. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  29. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +4 -11
  30. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  31. package/build/styles/main.css +29 -192
  32. package/build/table/Table.js +5 -5
  33. package/build/table/Table.js.map +1 -1
  34. package/build/table/Table.mjs +5 -5
  35. package/build/table/Table.mjs.map +1 -1
  36. package/build/typeahead/Typeahead.js +2 -3
  37. package/build/typeahead/Typeahead.js.map +1 -1
  38. package/build/typeahead/Typeahead.mjs +2 -3
  39. package/build/typeahead/Typeahead.mjs.map +1 -1
  40. package/build/types/common/hooks/useResizeObserver.d.ts +1 -1
  41. package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
  42. package/build/types/index.d.ts +2 -2
  43. package/build/types/index.d.ts.map +1 -1
  44. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +11 -2
  45. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  46. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +3 -35
  47. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  48. package/build/types/prompt/index.d.ts +0 -2
  49. package/build/types/prompt/index.d.ts.map +1 -1
  50. package/build/types/test-utils/index.d.ts +0 -4
  51. package/build/types/test-utils/index.d.ts.map +1 -1
  52. package/package.json +2 -2
  53. package/src/common/bottomSheet/BottomSheet.test.story.tsx +6 -5
  54. package/src/common/hooks/useResizeObserver.ts +2 -3
  55. package/src/i18n/en.json +0 -2
  56. package/src/index.ts +2 -2
  57. package/src/main.css +29 -192
  58. package/src/main.less +1 -3
  59. package/src/prompt/ActionPrompt/ActionPrompt.tsx +62 -9
  60. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +40 -56
  61. package/src/prompt/index.ts +0 -4
  62. package/src/sentimentSurface/SentimentSurface.story.tsx +17 -43
  63. package/src/table/Table.story.tsx +1 -1
  64. package/src/table/Table.tsx +5 -5
  65. package/build/common/hooks/useContainerSize.js +0 -30
  66. package/build/common/hooks/useContainerSize.js.map +0 -1
  67. package/build/common/hooks/useContainerSize.mjs +0 -28
  68. package/build/common/hooks/useContainerSize.mjs.map +0 -1
  69. package/build/prompt/CriticalBanner/CriticalBanner.js +0 -142
  70. package/build/prompt/CriticalBanner/CriticalBanner.js.map +0 -1
  71. package/build/prompt/CriticalBanner/CriticalBanner.mjs +0 -140
  72. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +0 -1
  73. package/build/prompt/CriticalBanner/helpers.js +0 -29
  74. package/build/prompt/CriticalBanner/helpers.js.map +0 -1
  75. package/build/prompt/CriticalBanner/helpers.mjs +0 -26
  76. package/build/prompt/CriticalBanner/helpers.mjs.map +0 -1
  77. package/build/prompt/common/Expander/Expander.js +0 -35
  78. package/build/prompt/common/Expander/Expander.js.map +0 -1
  79. package/build/prompt/common/Expander/Expander.messages.js +0 -17
  80. package/build/prompt/common/Expander/Expander.messages.js.map +0 -1
  81. package/build/prompt/common/Expander/Expander.messages.mjs +0 -13
  82. package/build/prompt/common/Expander/Expander.messages.mjs.map +0 -1
  83. package/build/prompt/common/Expander/Expander.mjs +0 -33
  84. package/build/prompt/common/Expander/Expander.mjs.map +0 -1
  85. package/build/prompt/helpers/promptMedia.js +0 -52
  86. package/build/prompt/helpers/promptMedia.js.map +0 -1
  87. package/build/prompt/helpers/promptMedia.mjs +0 -50
  88. package/build/prompt/helpers/promptMedia.mjs.map +0 -1
  89. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +0 -132
  90. package/build/styles/prompt/CriticalBanner/CriticalBanner.vars.css +0 -0
  91. package/build/styles/prompt/common/Expander/Expander.css +0 -8
  92. package/build/types/common/hooks/useContainerSize.d.ts +0 -14
  93. package/build/types/common/hooks/useContainerSize.d.ts.map +0 -1
  94. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +0 -39
  95. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +0 -1
  96. package/build/types/prompt/CriticalBanner/helpers.d.ts +0 -18
  97. package/build/types/prompt/CriticalBanner/helpers.d.ts.map +0 -1
  98. package/build/types/prompt/CriticalBanner/index.d.ts +0 -3
  99. package/build/types/prompt/CriticalBanner/index.d.ts.map +0 -1
  100. package/build/types/prompt/common/Expander/Expander.d.ts +0 -20
  101. package/build/types/prompt/common/Expander/Expander.d.ts.map +0 -1
  102. package/build/types/prompt/common/Expander/Expander.messages.d.ts +0 -14
  103. package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +0 -1
  104. package/build/types/prompt/helpers/promptMedia.d.ts +0 -22
  105. package/build/types/prompt/helpers/promptMedia.d.ts.map +0 -1
  106. package/src/common/hooks/useContainerSize.test.tsx +0 -121
  107. package/src/common/hooks/useContainerSize.ts +0 -32
  108. package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +0 -113
  109. package/src/prompt/CriticalBanner/CriticalBanner.css +0 -132
  110. package/src/prompt/CriticalBanner/CriticalBanner.less +0 -153
  111. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +0 -635
  112. package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +0 -422
  113. package/src/prompt/CriticalBanner/CriticalBanner.tsx +0 -178
  114. package/src/prompt/CriticalBanner/CriticalBanner.vars.css +0 -0
  115. package/src/prompt/CriticalBanner/CriticalBanner.vars.less +0 -6
  116. package/src/prompt/CriticalBanner/helpers.ts +0 -39
  117. package/src/prompt/CriticalBanner/index.ts +0 -2
  118. package/src/prompt/common/Expander/Expander.css +0 -8
  119. package/src/prompt/common/Expander/Expander.less +0 -9
  120. package/src/prompt/common/Expander/Expander.messages.ts +0 -14
  121. package/src/prompt/common/Expander/Expander.test.tsx +0 -167
  122. package/src/prompt/common/Expander/Expander.tsx +0 -83
  123. package/src/prompt/helpers/promptMedia.tsx +0 -79
@@ -1 +0,0 @@
1
- {"version":3,"file":"Expander.messages.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/common/Expander/Expander.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,wBAWG"}
@@ -1,22 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { AvatarViewProps } from '../../avatarView';
3
- import { BadgeAssetsProps } from '../../badge';
4
- import { PrimitivePromptProps } from '../PrimitivePrompt';
5
- export type PromptMedia = {
6
- imgSrc?: string;
7
- avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
8
- asset?: AvatarViewProps['children'];
9
- badge?: Pick<BadgeAssetsProps, 'flagCode'>;
10
- };
11
- 'aria-label'?: string;
12
- 'aria-hidden'?: boolean;
13
- };
14
- type RenderPromptMediaOptions = {
15
- media: PromptMedia;
16
- sentiment: PrimitivePromptProps['sentiment'];
17
- mediaId: string;
18
- imgClassName: string;
19
- };
20
- export declare function renderPromptMedia({ media, sentiment, mediaId, imgClassName, }: RenderPromptMediaOptions): ReactNode;
21
- export {};
22
- //# sourceMappingURL=promptMedia.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptMedia.d.ts","sourceRoot":"","sources":["../../../../src/prompt/helpers/promptMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC,GAAG;QACzE,KAAK,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACpC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;KAC5C,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,wBAAwB,GAAG,SAAS,CA+CtC"}
@@ -1,121 +0,0 @@
1
- import React, { act } from 'react';
2
- import { render, screen } from '@testing-library/react';
3
-
4
- import { mockResizeObserver } from '../../test-utils/window-mock';
5
-
6
- import { useContainerSize } from './useContainerSize';
7
-
8
- mockResizeObserver();
9
-
10
- describe('useContainerSize', () => {
11
- let resizeObserverCallback: ResizeObserverCallback | null = null;
12
-
13
- beforeEach(() => {
14
- resizeObserverCallback = null;
15
-
16
- // Capture the ResizeObserver callback for testing
17
- const OriginalResizeObserver = global.ResizeObserver;
18
- global.ResizeObserver = jest.fn().mockImplementation((callback: ResizeObserverCallback) => {
19
- resizeObserverCallback = callback;
20
- const instance = new OriginalResizeObserver(callback);
21
- return instance;
22
- }) as unknown as typeof ResizeObserver;
23
- });
24
-
25
- // Helper to create a test component
26
- function TestComponent({
27
- breakpoint,
28
- onStateChange,
29
- }: {
30
- breakpoint: number;
31
- onStateChange: (state: boolean) => void;
32
- }) {
33
- const [ref, isAboveBreakpoint] = useContainerSize(breakpoint);
34
-
35
- // Call the callback whenever state changes
36
- React.useEffect(() => {
37
- onStateChange(isAboveBreakpoint);
38
- }, [isAboveBreakpoint, onStateChange]);
39
-
40
- return (
41
- <div ref={ref} data-testid="container">
42
- Test
43
- </div>
44
- );
45
- }
46
-
47
- // Helper to simulate container resize
48
- function simulateResize(width: number, options?: { noBorderBoxSize?: boolean }) {
49
- const container = screen.getByTestId('container');
50
-
51
- act(() => {
52
- if (resizeObserverCallback) {
53
- const entry = {
54
- target: container,
55
- borderBoxSize: options?.noBorderBoxSize
56
- ? undefined
57
- : [{ inlineSize: width, blockSize: 100 }],
58
- contentRect: {
59
- width,
60
- height: 100,
61
- x: 0,
62
- y: 0,
63
- top: 0,
64
- right: width,
65
- bottom: 100,
66
- left: 0,
67
- toJSON: () => ({}),
68
- },
69
- contentBoxSize: [{ inlineSize: width, blockSize: 100 }],
70
- devicePixelContentBoxSize: [{ inlineSize: width, blockSize: 100 }],
71
- } as ResizeObserverEntry;
72
-
73
- resizeObserverCallback([entry], {} as ResizeObserver);
74
- }
75
- });
76
- }
77
-
78
- it('returns initial state as false', () => {
79
- const onStateChange = jest.fn();
80
- render(<TestComponent breakpoint={480} onStateChange={onStateChange} />);
81
-
82
- // Initial call with false
83
- expect(onStateChange).toHaveBeenCalledWith(false);
84
- });
85
-
86
- it('updates to true when container width is above breakpoint', () => {
87
- const onStateChange = jest.fn();
88
- render(<TestComponent breakpoint={480} onStateChange={onStateChange} />);
89
-
90
- simulateResize(600);
91
- expect(onStateChange).toHaveBeenCalledWith(true);
92
- });
93
-
94
- it('remains false when container width is below breakpoint', () => {
95
- const onStateChange = jest.fn();
96
- render(<TestComponent breakpoint={480} onStateChange={onStateChange} />);
97
-
98
- simulateResize(400);
99
- expect(onStateChange).toHaveBeenCalledWith(false);
100
- expect(onStateChange).not.toHaveBeenCalledWith(true);
101
- });
102
-
103
- it('returns true when container width equals breakpoint', () => {
104
- const onStateChange = jest.fn();
105
- render(<TestComponent breakpoint={480} onStateChange={onStateChange} />);
106
-
107
- simulateResize(480);
108
- expect(onStateChange).toHaveBeenCalledWith(true);
109
- });
110
-
111
- it('updates state when container crosses breakpoint from below to above', () => {
112
- const onStateChange = jest.fn();
113
- render(<TestComponent breakpoint={480} onStateChange={onStateChange} />);
114
-
115
- simulateResize(400);
116
- expect(onStateChange).toHaveBeenCalledWith(false);
117
-
118
- simulateResize(600);
119
- expect(onStateChange).toHaveBeenCalledWith(true);
120
- });
121
- });
@@ -1,32 +0,0 @@
1
- import { useRef, useState } from 'react';
2
-
3
- import { useResizeObserver } from './useResizeObserver';
4
-
5
- /**
6
- * Hook that returns a ref and a boolean indicating if the container
7
- * has a width >= the specified breakpoint.
8
- *
9
- * Useful for synchronizing React state with CSS container queries.
10
- *
11
- * Uses content-box measurements to match CSS container query behavior
12
- * (excludes padding and border).
13
- *
14
- * @param breakpoint - Minimum width in pixels
15
- * @returns [ref, isAboveBreakpoint] tuple
16
- */
17
- export function useContainerSize(breakpoint: number): [React.RefObject<HTMLDivElement>, boolean] {
18
- const ref = useRef<HTMLDivElement>(null);
19
- const [isAboveBreakpoint, setIsAboveBreakpoint] = useState(false);
20
-
21
- useResizeObserver(
22
- ref,
23
- (entry) => {
24
- // Use contentRect.width to match CSS container query box model (content-box)
25
- const inlineSize = entry.contentRect.width;
26
- setIsAboveBreakpoint(inlineSize >= breakpoint);
27
- },
28
- 'content-box',
29
- );
30
-
31
- return [ref, isAboveBreakpoint];
32
- }
@@ -1,113 +0,0 @@
1
- import { Meta, Source, Canvas } from '@storybook/addon-docs/blocks';
2
- import * as CriticalBannerStories from './CriticalBanner.story';
3
-
4
- <Meta title="Prompts/CriticalBanner/Accessibility" tags={['new']} />
5
-
6
- # Accessibility
7
-
8
- Under the hood, `CriticalBanner` is marked as `role="region"` for a section of content that users might want to navigate to directly.
9
-
10
- By default, it's labelled by the `title` and described by the `description`.
11
-
12
- ## Announcement Behavior
13
-
14
- `CriticalBanner` is designed for critical messages that require immediate attention. It always uses **`aria-live="assertive"`** to immediately interrupt and announce changes to screen readers.
15
-
16
- Unlike `InfoPrompt` which offers configurable politeness levels, `CriticalBanner` is always assertive because it communicates critical, time-sensitive information that users must be aware of immediately.
17
-
18
- ### What Gets Announced
19
-
20
- The component intelligently announces only **visible content**, respecting the collapsed/expanded state:
21
-
22
- - **Collapsed with title**: Announces title only (description is hidden)
23
- - **Collapsed without title**: Announces description only (visible up to 2 lines)
24
- - **Expanded**: Announces title, description, and action button labels (all visible)
25
-
26
- <Source
27
- dark
28
- code={`
29
- // Collapsed with title - announces: "Your account requires verification"
30
- <CriticalBanner
31
- title="Your account requires verification"
32
- description="Please verify your identity to continue"
33
- action={{ label: "Verify now", onClick: handleVerify }}
34
- expanded={false}
35
- onToggle={handleToggle}
36
- />
37
-
38
- // Expanded - announces: "Your account requires verification | Please verify your identity to continue | Verify now | Learn more"
39
-
40
- <CriticalBanner
41
- title="Your account requires verification"
42
- description="Please verify your identity to continue"
43
- action={{ label: 'Verify now', onClick: handleVerify }}
44
- actionSecondary={{ label: 'Learn more', onClick: handleLearnMore }}
45
- expanded={true}
46
- onToggle={handleToggle}
47
- />
48
-
49
- // Collapsed without title - announces: "Your verification is pending..."
50
-
51
- <CriticalBanner
52
- description="Your verification is pending. We'll notify you once complete."
53
- expanded={false}
54
- onToggle={handleToggle}
55
- />
56
- `}
57
- />
58
-
59
- ### When Announcements Trigger
60
-
61
- Screen readers announce the banner content whenever:
62
-
63
- - The banner first appears in the DOM
64
- - The user toggles between collapsed and expanded states
65
- - The content (title, description, or action labels) changes
66
-
67
- ## Media
68
-
69
- Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
70
-
71
- <Source
72
- dark
73
- code={`
74
- import { Bank, AlertCircle } from '@transferwise/icons';
75
-
76
- <CriticalBanner
77
- title="Bank connection required"
78
- description="Connect your bank account to continue"
79
- media={{ avatar: { asset: <Bank title="Bank account" /> } }}
80
- action={{ label: 'Connect now', onClick: handleConnect }}
81
- expanded={false}
82
- onToggle={handleToggle}
83
- />
84
-
85
- <CriticalBanner
86
- title="Verification required"
87
- description="We need to verify your identity"
88
- media={{ avatar: { asset: <AlertCircle title="Alert" /> } }}
89
- action={{ label: "Start verification", onClick: handleVerify }}
90
- expanded={false}
91
- onToggle={handleToggle}
92
- />
93
- `}
94
- />
95
-
96
- Alternatively, you can use `media['aria-label']` to provide a label for custom images:
97
-
98
- <Source
99
- dark
100
- code={`
101
- <CriticalBanner
102
- title="Card blocked"
103
- description="Your card has been blocked for security reasons"
104
- media={{
105
- imgSrc: '/wise-card.svg',
106
- 'aria-label': 'Wise debit card'
107
- }}
108
- action={{ label: "Unblock card", onClick: handleUnblock }}
109
- expanded={false}
110
- onToggle={handleToggle}
111
- />
112
- `}
113
- />
@@ -1,132 +0,0 @@
1
- .wds-critical-banner {
2
- --Prompt-padding: var(--size-16);
3
- --Prompt-actions-gap: var(--size-8);
4
- --Prompt-gap: var(--size-10) var(--size-16);
5
- --Prompt-border-radius: 0;
6
- container-type: inline-size;
7
- --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
8
- --critical-banner-duration: 150ms;
9
- /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
10
- actions only go full-width below mobile-max token (container query) */
11
- }
12
- .wds-critical-banner--media-image {
13
- width: 48px;
14
- width: var(--size-48);
15
- height: 48px;
16
- height: var(--size-48);
17
- -o-object-fit: contain;
18
- object-fit: contain;
19
- }
20
- .wds-critical-banner__title {
21
- display: -webkit-box;
22
- -webkit-line-clamp: 8;
23
- line-clamp: 8;
24
- -webkit-box-orient: vertical;
25
- max-height: 192px;
26
- overflow: hidden;
27
- transition: max-height var(--critical-banner-duration) var(--critical-banner-easing);
28
- }
29
- .wds-critical-banner--collapsed .wds-critical-banner__title {
30
- -webkit-line-clamp: 2;
31
- line-clamp: 2;
32
- max-height: 48px;
33
- }
34
- .wds-critical-banner__description {
35
- max-height: 30vh;
36
- opacity: 1;
37
- overflow: hidden;
38
- transition: max-height var(--critical-banner-duration) var(--critical-banner-easing), opacity var(--critical-banner-duration) var(--critical-banner-easing);
39
- }
40
- .wds-critical-banner--collapsed .wds-critical-banner__description--with-title {
41
- max-height: 0;
42
- opacity: 0;
43
- }
44
- .wds-critical-banner--collapsed .wds-critical-banner__description:not(.wds-critical-banner__description--with-title) {
45
- display: -webkit-box;
46
- -webkit-line-clamp: 2;
47
- line-clamp: 2;
48
- -webkit-box-orient: vertical;
49
- overflow: hidden;
50
- }
51
- .wds-critical-banner .wds-prompt__content-wrapper {
52
- grid-template-columns: auto 1fr auto;
53
- align-items: flex-start;
54
- transition: row-gap var(--critical-banner-duration) var(--critical-banner-easing);
55
- }
56
- .wds-critical-banner--collapsed .wds-prompt__content-wrapper {
57
- row-gap: 0;
58
- }
59
- .wds-critical-banner__text-wrapper {
60
- position: relative;
61
- display: flex;
62
- flex-direction: column;
63
- justify-content: center;
64
- min-width: 0;
65
- max-width: 480px;
66
- height: 100%;
67
- padding-top: 3px;
68
- }
69
- @media (max-width: 320px) {
70
- .wds-critical-banner__text-wrapper {
71
- padding-top: 0;
72
- }
73
- }
74
- @container (--screen-400-zoom) {
75
- .wds-critical-banner__text-wrapper {
76
- padding-top: 0px;
77
- }
78
- }
79
- .wds-critical-banner--collapsed .wds-critical-banner__title,
80
- .wds-critical-banner--collapsed .wds-critical-banner__description {
81
- transform: translateY(0);
82
- }
83
- .wds-critical-banner__toggle {
84
- flex-shrink: 0;
85
- transition: transform var(--critical-banner-duration) var(--critical-banner-easing);
86
- }
87
- .wds-critical-banner__toggle--collapsed {
88
- transform: rotate(180deg);
89
- }
90
- @container (min-width: 768px) {
91
- .wds-critical-banner__toggle {
92
- display: none;
93
- }
94
- }
95
- .wds-critical-banner .wds-prompt__actions-wrapper {
96
- grid-column-start: 2;
97
- grid-column-end: 3;
98
- max-height: 200px;
99
- opacity: 1;
100
- overflow: visible;
101
- }
102
- @container (max-width: 600px) {
103
- .wds-critical-banner .wds-prompt__actions-wrapper {
104
- grid-column: span 3;
105
- width: 100%;
106
- }
107
- .wds-critical-banner .wds-prompt__actions-wrapper .wds-Button {
108
- flex: 1 1 100%;
109
- width: 100%;
110
- }
111
- }
112
- .wds-critical-banner--collapsed .wds-prompt__actions-wrapper {
113
- max-height: 0;
114
- opacity: 0;
115
- overflow: hidden;
116
- pointer-events: none;
117
- }
118
- @container (max-width: 600px) {
119
- .wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
120
- flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
121
- min-width: -moz-fit-content;
122
- min-width: fit-content;
123
- }
124
- }
125
- @media (prefers-reduced-motion: reduce) {
126
- .wds-critical-banner__description,
127
- .wds-critical-banner__title,
128
- .wds-critical-banner .wds-prompt__content-wrapper,
129
- .wds-critical-banner__toggle {
130
- transition: none !important;
131
- }
132
- }
@@ -1,153 +0,0 @@
1
- @import (reference) "./CriticalBanner.vars.less";
2
-
3
- .wds-critical-banner {
4
- --Prompt-padding: var(--size-16);
5
- --Prompt-actions-gap: var(--size-8);
6
- --Prompt-gap: var(--size-10) var(--size-16);
7
- --Prompt-border-radius: 0;
8
- container-type: inline-size;
9
-
10
- // Animation variables
11
- --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
12
- --critical-banner-duration: 150ms;
13
-
14
- &--media-image {
15
- width: var(--size-48);
16
- height: var(--size-48);
17
- object-fit: contain;
18
- }
19
-
20
- &__title {
21
- display: -webkit-box;
22
- -webkit-line-clamp: 8;
23
- line-clamp: 8;
24
- -webkit-box-orient: vertical;
25
- max-height: 192px; // ~8 lines (24px line-height × 8) - balanced for common cases
26
- overflow: hidden;
27
- transition: max-height var(--critical-banner-duration) var(--critical-banner-easing);
28
- }
29
-
30
- &--collapsed &__title {
31
- -webkit-line-clamp: 2;
32
- line-clamp: 2;
33
- max-height: 48px; // ~2 lines (24px line-height × 2)
34
- }
35
-
36
- &__description {
37
- max-height: 30vh;
38
- opacity: 1;
39
- overflow: hidden;
40
- transition:
41
- max-height var(--critical-banner-duration) var(--critical-banner-easing),
42
- opacity var(--critical-banner-duration) var(--critical-banner-easing);
43
- }
44
-
45
- &--collapsed &__description--with-title {
46
- max-height: 0;
47
- opacity: 0;
48
- }
49
-
50
- // When collapsed WITHOUT a title: show 2 lines
51
- &--collapsed &__description:not(&__description--with-title) {
52
- display: -webkit-box;
53
- -webkit-line-clamp: 2;
54
- line-clamp: 2;
55
- -webkit-box-orient: vertical;
56
- overflow: hidden;
57
- }
58
-
59
- .wds-prompt__content-wrapper {
60
- grid-template-columns: auto 1fr auto;
61
- align-items: flex-start;
62
- transition: row-gap var(--critical-banner-duration) var(--critical-banner-easing);
63
- }
64
-
65
- &--collapsed .wds-prompt__content-wrapper {
66
- row-gap: 0;
67
- }
68
-
69
- &__text-wrapper {
70
- position: relative;
71
- display: flex;
72
- flex-direction: column;
73
- justify-content: center;
74
- min-width: 0;
75
- max-width: 480px;
76
- height: 100%;
77
-
78
- // Padding prevents text shifting when collapsing/expanding layout shift
79
- padding-top: 3px;
80
-
81
- @media (--screen-400-zoom) {
82
- padding-top: 0;
83
- }
84
-
85
- @container (--screen-400-zoom) {
86
- padding-top: 0px;
87
- }
88
- }
89
-
90
- &--collapsed &__title,
91
- &--collapsed &__description {
92
- transform: translateY(0);
93
- }
94
-
95
- &__toggle {
96
- flex-shrink: 0;
97
- transition: transform var(--critical-banner-duration) var(--critical-banner-easing);
98
-
99
- &--collapsed {
100
- transform: rotate(180deg);
101
- }
102
-
103
- @container (min-width: @wds-critical-banner-collapsible-max) {
104
- display: none;
105
- }
106
- }
107
-
108
- /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
109
- actions only go full-width below mobile-max token (container query) */
110
- .wds-prompt__actions-wrapper {
111
- grid-column-start: 2;
112
- grid-column-end: 3;
113
- max-height: 200px;
114
- opacity: 1;
115
- overflow: visible;
116
-
117
- @container (max-width: @wds-critical-banner-action-wrapper-max) {
118
- grid-column: span 3;
119
- width: 100%;
120
-
121
- .wds-Button {
122
- flex: 1 1 100%;
123
- width: 100%;
124
- }
125
- }
126
- }
127
-
128
- &--collapsed .wds-prompt__actions-wrapper {
129
- max-height: 0;
130
- opacity: 0;
131
- overflow: hidden;
132
- pointer-events: none;
133
- }
134
-
135
- &--with-two-actions .wds-prompt__actions-wrapper {
136
- @container (max-width: @wds-critical-banner-action-wrapper-max) {
137
- .wds-Button {
138
- flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
139
- min-width: fit-content;
140
- }
141
- }
142
- }
143
- }
144
-
145
- // Reduced motion support
146
- @media (prefers-reduced-motion: reduce) {
147
- .wds-critical-banner__description,
148
- .wds-critical-banner__title,
149
- .wds-critical-banner .wds-prompt__content-wrapper,
150
- .wds-critical-banner__toggle {
151
- transition: none !important;
152
- }
153
- }