@transferwise/components 0.0.0-experimental-70cb6d1 → 0.0.0-experimental-8bfed24
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/field/Field.js +5 -4
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +5 -4
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +5 -4
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +5 -4
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +107 -51
- package/build/moneyInput/MoneyInput.js +12 -28
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +14 -30
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/moneyInput/currencyFormatting.js +2 -8
- package/build/moneyInput/currencyFormatting.js.map +1 -1
- package/build/moneyInput/currencyFormatting.mjs +4 -5
- package/build/moneyInput/currencyFormatting.mjs.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +145 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +143 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -0
- package/build/prompt/CriticalBanner/helpers.js +29 -0
- package/build/prompt/CriticalBanner/helpers.js.map +1 -0
- package/build/prompt/CriticalBanner/helpers.mjs +26 -0
- package/build/prompt/CriticalBanner/helpers.mjs.map +1 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/prompt/common/Expander/Expander.js +47 -0
- package/build/prompt/common/Expander/Expander.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.js +17 -0
- package/build/prompt/common/Expander/Expander.messages.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.mjs +13 -0
- package/build/prompt/common/Expander/Expander.messages.mjs.map +1 -0
- package/build/prompt/common/Expander/Expander.mjs +44 -0
- package/build/prompt/common/Expander/Expander.mjs.map +1 -0
- package/build/prompt/helpers/promptMedia.js +52 -0
- package/build/prompt/helpers/promptMedia.js.map +1 -0
- package/build/prompt/helpers/promptMedia.mjs +50 -0
- package/build/prompt/helpers/promptMedia.mjs.map +1 -0
- package/build/styles/css/neptune.css +22 -22
- package/build/styles/less/neptune-tokens.less +4 -4
- package/build/styles/main.css +107 -51
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/build/styles/prompt/common/Expander/Expander.css +8 -0
- package/build/styles/props/neptune-tokens.css +2 -2
- package/build/styles/styles/less/neptune.css +22 -22
- package/build/typeahead/Typeahead.js +5 -4
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +5 -4
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -6
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/moneyInput/currencyFormatting.d.ts +3 -4
- package/build/types/moneyInput/currencyFormatting.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +2 -11
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +40 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts +18 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/index.d.ts +3 -0
- package/build/types/prompt/CriticalBanner/index.d.ts.map +1 -0
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +8 -3
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/build/types/prompt/common/Expander/Expander.d.ts +20 -0
- package/build/types/prompt/common/Expander/Expander.d.ts.map +1 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts +14 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +1 -0
- package/build/types/prompt/helpers/promptMedia.d.ts +22 -0
- package/build/types/prompt/helpers/promptMedia.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +2 -0
- package/build/types/prompt/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +4 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/i18n/en.json +2 -0
- package/src/index.ts +2 -2
- package/src/main.css +107 -51
- package/src/main.less +3 -1
- package/src/moneyInput/MoneyInput.story.tsx +1 -10
- package/src/moneyInput/MoneyInput.test.story.tsx +1 -141
- package/src/moneyInput/MoneyInput.test.tsx +0 -45
- package/src/moneyInput/MoneyInput.tsx +3 -27
- package/src/moneyInput/currencyFormatting.ts +5 -11
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -62
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +131 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +45 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +645 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +304 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +185 -0
- package/src/prompt/CriticalBanner/helpers.ts +39 -0
- package/src/prompt/CriticalBanner/index.ts +2 -0
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +9 -2
- package/src/prompt/common/Expander/Expander.css +8 -0
- package/src/prompt/common/Expander/Expander.less +9 -0
- package/src/prompt/common/Expander/Expander.messages.ts +14 -0
- package/src/prompt/common/Expander/Expander.test.tsx +167 -0
- package/src/prompt/common/Expander/Expander.tsx +83 -0
- package/src/prompt/helpers/promptMedia.tsx +79 -0
- package/src/prompt/index.ts +4 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +43 -17
- package/src/styles/less/neptune.css +22 -22
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { renderHook, act, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
|
|
4
|
+
import { useExpanderState, shouldShowWhenExpanded, ExpanderToggle } from './Expander';
|
|
5
|
+
import { mockMatchMedia, render } from '../../../test-utils';
|
|
6
|
+
|
|
7
|
+
mockMatchMedia();
|
|
8
|
+
|
|
9
|
+
describe('useExpanderState', () => {
|
|
10
|
+
it('initializes with default expanded state (true)', () => {
|
|
11
|
+
const { result } = renderHook(() => useExpanderState());
|
|
12
|
+
|
|
13
|
+
expect(result.current.expanded).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('initializes with custom expanded state', () => {
|
|
17
|
+
const { result } = renderHook(() => useExpanderState(false));
|
|
18
|
+
|
|
19
|
+
expect(result.current.expanded).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('toggles expanded state', () => {
|
|
23
|
+
const { result } = renderHook(() => useExpanderState(true));
|
|
24
|
+
|
|
25
|
+
expect(result.current.expanded).toBe(true);
|
|
26
|
+
|
|
27
|
+
act(() => {
|
|
28
|
+
result.current.toggle();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(result.current.expanded).toBe(false);
|
|
32
|
+
|
|
33
|
+
act(() => {
|
|
34
|
+
result.current.toggle();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
expect(result.current.expanded).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('sets expanded state programmatically', () => {
|
|
41
|
+
const { result } = renderHook(() => useExpanderState(true));
|
|
42
|
+
|
|
43
|
+
act(() => {
|
|
44
|
+
result.current.setExpanded(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect(result.current.expanded).toBe(false);
|
|
48
|
+
|
|
49
|
+
act(() => {
|
|
50
|
+
result.current.setExpanded(true);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(result.current.expanded).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('memoizes toggle callback', () => {
|
|
57
|
+
const { result, rerender } = renderHook(() => useExpanderState(true));
|
|
58
|
+
|
|
59
|
+
const firstToggle = result.current.toggle;
|
|
60
|
+
|
|
61
|
+
rerender();
|
|
62
|
+
|
|
63
|
+
expect(result.current.toggle).toBe(firstToggle);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('shouldShowWhenExpanded', () => {
|
|
68
|
+
it('returns false when hasContent is false', () => {
|
|
69
|
+
expect(shouldShowWhenExpanded({ expanded: true, hasContent: false })).toBe(false);
|
|
70
|
+
expect(shouldShowWhenExpanded({ expanded: false, hasContent: false })).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('returns true when expanded and hasContent are true', () => {
|
|
74
|
+
expect(shouldShowWhenExpanded({ expanded: true, hasContent: true })).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('returns false when collapsed but hasContent is true', () => {
|
|
78
|
+
expect(shouldShowWhenExpanded({ expanded: false, hasContent: true })).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('returns true when alwaysShow is true and hasContent is true, regardless of expanded', () => {
|
|
82
|
+
expect(shouldShowWhenExpanded({ expanded: true, hasContent: true, alwaysShow: true })).toBe(
|
|
83
|
+
true,
|
|
84
|
+
);
|
|
85
|
+
expect(shouldShowWhenExpanded({ expanded: false, hasContent: true, alwaysShow: true })).toBe(
|
|
86
|
+
true,
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('returns false when alwaysShow is true but hasContent is false', () => {
|
|
91
|
+
expect(shouldShowWhenExpanded({ expanded: true, hasContent: false, alwaysShow: true })).toBe(
|
|
92
|
+
false,
|
|
93
|
+
);
|
|
94
|
+
expect(shouldShowWhenExpanded({ expanded: false, hasContent: false, alwaysShow: true })).toBe(
|
|
95
|
+
false,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('ExpanderToggle', () => {
|
|
101
|
+
it('renders with correct aria-label when expanded', () => {
|
|
102
|
+
render(<ExpanderToggle expanded onToggle={jest.fn()} />);
|
|
103
|
+
|
|
104
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Collapse');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('renders with correct aria-label when collapsed', () => {
|
|
108
|
+
render(<ExpanderToggle expanded={false} onToggle={jest.fn()} />);
|
|
109
|
+
|
|
110
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Expand');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('renders with custom labels', () => {
|
|
114
|
+
const { rerender } = render(<ExpanderToggle expanded onToggle={jest.fn()} />);
|
|
115
|
+
|
|
116
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Collapse');
|
|
117
|
+
|
|
118
|
+
rerender(<ExpanderToggle expanded={false} onToggle={jest.fn()} />);
|
|
119
|
+
|
|
120
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Expand');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('sets aria-expanded attribute correctly', () => {
|
|
124
|
+
const { rerender } = render(<ExpanderToggle expanded onToggle={jest.fn()} />);
|
|
125
|
+
|
|
126
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
|
|
127
|
+
|
|
128
|
+
rerender(<ExpanderToggle expanded={false} onToggle={jest.fn()} />);
|
|
129
|
+
|
|
130
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'false');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('calls onToggle when clicked', async () => {
|
|
134
|
+
const user = userEvent.setup();
|
|
135
|
+
const onToggle = jest.fn();
|
|
136
|
+
|
|
137
|
+
render(<ExpanderToggle expanded onToggle={onToggle} />);
|
|
138
|
+
|
|
139
|
+
await user.click(screen.getByRole('button'));
|
|
140
|
+
|
|
141
|
+
expect(onToggle).toHaveBeenCalledTimes(1);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('applies custom className', () => {
|
|
145
|
+
render(<ExpanderToggle expanded className="custom-class" onToggle={jest.fn()} />);
|
|
146
|
+
|
|
147
|
+
expect(screen.getByRole('button')).toHaveClass('custom-class');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('applies base class and collapsed class correctly', () => {
|
|
151
|
+
const { rerender } = render(<ExpanderToggle expanded onToggle={jest.fn()} />);
|
|
152
|
+
|
|
153
|
+
expect(screen.getByRole('button')).toHaveClass('wds-expander-toggle');
|
|
154
|
+
expect(screen.getByRole('button')).not.toHaveClass('wds-expander-toggle--collapsed');
|
|
155
|
+
|
|
156
|
+
rerender(<ExpanderToggle expanded={false} onToggle={jest.fn()} />);
|
|
157
|
+
|
|
158
|
+
expect(screen.getByRole('button')).toHaveClass('wds-expander-toggle');
|
|
159
|
+
expect(screen.getByRole('button')).toHaveClass('wds-expander-toggle--collapsed');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('applies data-testid attribute', () => {
|
|
163
|
+
render(<ExpanderToggle expanded data-testid="expander-toggle" onToggle={jest.fn()} />);
|
|
164
|
+
|
|
165
|
+
expect(screen.getByTestId('expander-toggle')).toBeInTheDocument();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { ChevronUp } from '@transferwise/icons';
|
|
4
|
+
import IconButton from '../../../iconButton';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import messages from './Expander.messages';
|
|
7
|
+
|
|
8
|
+
export type ExpanderState = {
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
setExpanded: (expanded: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// Hook for managing expander state
|
|
15
|
+
export function useExpanderState(initialExpanded = true): ExpanderState {
|
|
16
|
+
const [expanded, setExpanded] = useState(initialExpanded);
|
|
17
|
+
|
|
18
|
+
const toggle = useCallback(() => {
|
|
19
|
+
setExpanded((prev) => !prev);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
expanded,
|
|
24
|
+
toggle,
|
|
25
|
+
setExpanded,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Helper for conditional rendering based on expanded state
|
|
30
|
+
export function shouldShowWhenExpanded({
|
|
31
|
+
expanded,
|
|
32
|
+
hasContent,
|
|
33
|
+
alwaysShow = false,
|
|
34
|
+
}: {
|
|
35
|
+
expanded: boolean;
|
|
36
|
+
hasContent: boolean;
|
|
37
|
+
alwaysShow?: boolean;
|
|
38
|
+
}): boolean {
|
|
39
|
+
if (alwaysShow) {
|
|
40
|
+
return hasContent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return expanded && hasContent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ExpanderToggleProps = {
|
|
47
|
+
expanded: boolean;
|
|
48
|
+
onToggle?: () => void;
|
|
49
|
+
size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
50
|
+
className?: string;
|
|
51
|
+
'data-testid'?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Reusable toggle button component
|
|
55
|
+
export const ExpanderToggle = ({
|
|
56
|
+
expanded,
|
|
57
|
+
onToggle,
|
|
58
|
+
size = 24,
|
|
59
|
+
className,
|
|
60
|
+
'data-testid': testId,
|
|
61
|
+
}: ExpanderToggleProps) => {
|
|
62
|
+
const intl = useIntl();
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<IconButton
|
|
66
|
+
size={size}
|
|
67
|
+
priority="secondary"
|
|
68
|
+
aria-label={intl.formatMessage(
|
|
69
|
+
expanded ? messages.collapseAriaLabel : messages.expandAriaLabel,
|
|
70
|
+
)}
|
|
71
|
+
aria-expanded={expanded}
|
|
72
|
+
className={clsx(
|
|
73
|
+
'wds-expander-toggle',
|
|
74
|
+
{ 'wds-expander-toggle--collapsed': !expanded },
|
|
75
|
+
className,
|
|
76
|
+
)}
|
|
77
|
+
data-testid={testId}
|
|
78
|
+
onClick={onToggle}
|
|
79
|
+
>
|
|
80
|
+
<ChevronUp />
|
|
81
|
+
</IconButton>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GiftBox } from '@transferwise/icons';
|
|
3
|
+
|
|
4
|
+
import AvatarView, { AvatarViewProps } from '../../avatarView';
|
|
5
|
+
import Image from '../../image';
|
|
6
|
+
import StatusIcon from '../../statusIcon';
|
|
7
|
+
import { BadgeAssetsProps } from '../../badge';
|
|
8
|
+
import { PrimitivePromptProps } from '../PrimitivePrompt';
|
|
9
|
+
|
|
10
|
+
export type PromptMedia = {
|
|
11
|
+
imgSrc?: string;
|
|
12
|
+
avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
|
|
13
|
+
asset?: AvatarViewProps['children'];
|
|
14
|
+
badge?: Pick<BadgeAssetsProps, 'flagCode'>;
|
|
15
|
+
};
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
'aria-hidden'?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type RenderPromptMediaOptions = {
|
|
21
|
+
media: PromptMedia;
|
|
22
|
+
sentiment: PrimitivePromptProps['sentiment'];
|
|
23
|
+
mediaId: string;
|
|
24
|
+
imgClassName: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function renderPromptMedia({
|
|
28
|
+
media,
|
|
29
|
+
sentiment,
|
|
30
|
+
mediaId,
|
|
31
|
+
imgClassName,
|
|
32
|
+
}: RenderPromptMediaOptions): ReactNode {
|
|
33
|
+
if (media?.imgSrc) {
|
|
34
|
+
return (
|
|
35
|
+
<Image
|
|
36
|
+
id={mediaId}
|
|
37
|
+
src={media.imgSrc}
|
|
38
|
+
className={imgClassName}
|
|
39
|
+
alt={media['aria-label'] ?? ''}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (media?.avatar) {
|
|
44
|
+
const badge = media.avatar.badge
|
|
45
|
+
? media.avatar.badge
|
|
46
|
+
: sentiment === 'proposition'
|
|
47
|
+
? {}
|
|
48
|
+
: { status: sentiment };
|
|
49
|
+
return (
|
|
50
|
+
<AvatarView
|
|
51
|
+
{...media.avatar}
|
|
52
|
+
badge={badge}
|
|
53
|
+
aria-label={media['aria-label']}
|
|
54
|
+
aria-hidden={media['aria-hidden']}
|
|
55
|
+
id={mediaId}
|
|
56
|
+
size={48}
|
|
57
|
+
>
|
|
58
|
+
{media.avatar.asset}
|
|
59
|
+
</AvatarView>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return sentiment === 'proposition' ? (
|
|
63
|
+
<AvatarView
|
|
64
|
+
id={mediaId}
|
|
65
|
+
size={48}
|
|
66
|
+
aria-label={media['aria-label']}
|
|
67
|
+
aria-hidden={media['aria-hidden']}
|
|
68
|
+
>
|
|
69
|
+
<GiftBox />
|
|
70
|
+
</AvatarView>
|
|
71
|
+
) : (
|
|
72
|
+
<StatusIcon
|
|
73
|
+
id={mediaId}
|
|
74
|
+
size={48}
|
|
75
|
+
sentiment={sentiment}
|
|
76
|
+
iconLabel={media['aria-hidden'] ? null : media['aria-label']}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
package/src/prompt/index.ts
CHANGED
|
@@ -12,3 +12,7 @@ export { ActionPrompt } from './ActionPrompt';
|
|
|
12
12
|
// InfoPrompt
|
|
13
13
|
export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './InfoPrompt';
|
|
14
14
|
export { InfoPrompt } from './InfoPrompt';
|
|
15
|
+
|
|
16
|
+
// CriticalBanner
|
|
17
|
+
export type { CriticalBannerProps } from './CriticalBanner';
|
|
18
|
+
export { CriticalBanner } from './CriticalBanner';
|
|
@@ -202,18 +202,26 @@ const TokenSwatch = ({ token }: { token: string }) => (
|
|
|
202
202
|
export const EmphasisLevels: Story = {
|
|
203
203
|
render: (args) => (
|
|
204
204
|
<>
|
|
205
|
-
|
|
206
|
-
<div
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
{sentiments.map((sentiment) => (
|
|
206
|
+
<div key={sentiment}>
|
|
207
|
+
<SentimentSurface
|
|
208
|
+
key={`${sentiment}-base`}
|
|
209
|
+
{...args}
|
|
210
|
+
sentiment={sentiment}
|
|
211
|
+
emphasis="base"
|
|
212
|
+
>
|
|
213
|
+
<div className="p-a-2 text-capitalize">{sentiment} - Base emphasis</div>
|
|
214
|
+
</SentimentSurface>
|
|
215
|
+
<SentimentSurface
|
|
216
|
+
key={`${sentiment}-elevated`}
|
|
217
|
+
{...args}
|
|
218
|
+
sentiment={sentiment}
|
|
219
|
+
emphasis="elevated"
|
|
220
|
+
>
|
|
221
|
+
<div className="p-a-2 text-capitalize">{sentiment} - Elevated emphasis</div>
|
|
222
|
+
</SentimentSurface>
|
|
223
|
+
</div>
|
|
224
|
+
))}
|
|
217
225
|
</>
|
|
218
226
|
),
|
|
219
227
|
parameters: {
|
|
@@ -369,8 +377,8 @@ export const SentimentAwareComponents: Story = {
|
|
|
369
377
|
{STATUS_NEGATIVE}
|
|
370
378
|
</div>
|
|
371
379
|
|
|
372
|
-
<Header level="group" title="Success sentiment surface" />
|
|
373
|
-
<SentimentSurface sentiment="success">
|
|
380
|
+
<Header level="group" title="Success sentiment surface - Base emphasis" />
|
|
381
|
+
<SentimentSurface sentiment="success" emphasis="base">
|
|
374
382
|
<div className="p-a-2 m-b-2 sentimentAwareComponent">
|
|
375
383
|
{BODY}
|
|
376
384
|
{AVATAR_SUCCESS}
|
|
@@ -378,8 +386,26 @@ export const SentimentAwareComponents: Story = {
|
|
|
378
386
|
</div>
|
|
379
387
|
</SentimentSurface>
|
|
380
388
|
|
|
381
|
-
<Header level="group" title="
|
|
382
|
-
<SentimentSurface sentiment="
|
|
389
|
+
<Header level="group" title="Success sentiment surface - Elevated emphasis" />
|
|
390
|
+
<SentimentSurface sentiment="success" emphasis="elevated">
|
|
391
|
+
<div className="p-a-2 m-b-2 sentimentAwareComponent">
|
|
392
|
+
{BODY}
|
|
393
|
+
{AVATAR_SUCCESS}
|
|
394
|
+
{STATUS_SUCCESS}
|
|
395
|
+
</div>
|
|
396
|
+
</SentimentSurface>
|
|
397
|
+
|
|
398
|
+
<Header level="group" title="Negative sentiment surface - Base emphasis" />
|
|
399
|
+
<SentimentSurface sentiment="negative" emphasis="base">
|
|
400
|
+
<div className="p-a-2 m-b-2 sentimentAwareComponent">
|
|
401
|
+
{BODY}
|
|
402
|
+
{AVATAR_NEGATIVE}
|
|
403
|
+
{STATUS_NEGATIVE}
|
|
404
|
+
</div>
|
|
405
|
+
</SentimentSurface>
|
|
406
|
+
|
|
407
|
+
<Header level="group" title="Negative sentiment surface - Elevated emphasis" />
|
|
408
|
+
<SentimentSurface sentiment="negative" emphasis="elevated">
|
|
383
409
|
<div className="p-a-2 m-b-2 sentimentAwareComponent">
|
|
384
410
|
{BODY}
|
|
385
411
|
{AVATAR_NEGATIVE}
|
|
@@ -427,7 +453,7 @@ function CustomCard({ children, className }: { className?: string; children: Rea
|
|
|
427
453
|
|
|
428
454
|
export const CustomComponents: Story = {
|
|
429
455
|
tags: ['!autodocs', '!dev'],
|
|
430
|
-
render: (
|
|
456
|
+
render: () => (
|
|
431
457
|
<>
|
|
432
458
|
<style>{`
|
|
433
459
|
.custom-card {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Do not edit directly
|
|
3
|
-
* Generated on
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Do not edit directly
|
|
146
|
-
* Generated on
|
|
145
|
+
* Do not edit directly
|
|
146
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
147
147
|
*/
|
|
148
148
|
|
|
149
149
|
.np-theme-personal {
|
|
@@ -391,8 +391,8 @@
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
/**
|
|
394
|
-
* Do not edit directly
|
|
395
|
-
* Generated on
|
|
394
|
+
* Do not edit directly
|
|
395
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
396
396
|
*/
|
|
397
397
|
|
|
398
398
|
.np-theme-personal--forest-green {
|
|
@@ -640,8 +640,8 @@
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
/**
|
|
643
|
-
* Do not edit directly
|
|
644
|
-
* Generated on
|
|
643
|
+
* Do not edit directly
|
|
644
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
645
645
|
*/
|
|
646
646
|
|
|
647
647
|
.np-theme-personal--bright-green {
|
|
@@ -889,8 +889,8 @@
|
|
|
889
889
|
}
|
|
890
890
|
|
|
891
891
|
/**
|
|
892
|
-
* Do not edit directly
|
|
893
|
-
* Generated on
|
|
892
|
+
* Do not edit directly
|
|
893
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
894
894
|
*/
|
|
895
895
|
|
|
896
896
|
.np-theme-personal--dark {
|
|
@@ -1138,8 +1138,8 @@
|
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
1140
|
/**
|
|
1141
|
-
* Do not edit directly
|
|
1142
|
-
* Generated on
|
|
1141
|
+
* Do not edit directly
|
|
1142
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1143
1143
|
*/
|
|
1144
1144
|
|
|
1145
1145
|
.np-theme-platform {
|
|
@@ -1321,8 +1321,8 @@
|
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
1323
|
/**
|
|
1324
|
-
* Do not edit directly
|
|
1325
|
-
* Generated on
|
|
1324
|
+
* Do not edit directly
|
|
1325
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1326
1326
|
*/
|
|
1327
1327
|
|
|
1328
1328
|
.np-theme-platform--forest-green {
|
|
@@ -1504,8 +1504,8 @@
|
|
|
1504
1504
|
}
|
|
1505
1505
|
|
|
1506
1506
|
/**
|
|
1507
|
-
* Do not edit directly
|
|
1508
|
-
* Generated on
|
|
1507
|
+
* Do not edit directly
|
|
1508
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1509
1509
|
*/
|
|
1510
1510
|
|
|
1511
1511
|
.np-theme-business {
|
|
@@ -1688,8 +1688,8 @@
|
|
|
1688
1688
|
}
|
|
1689
1689
|
|
|
1690
1690
|
/**
|
|
1691
|
-
* Do not edit directly
|
|
1692
|
-
* Generated on
|
|
1691
|
+
* Do not edit directly
|
|
1692
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1693
1693
|
*/
|
|
1694
1694
|
|
|
1695
1695
|
.np-theme-business--dark {
|
|
@@ -1872,8 +1872,8 @@
|
|
|
1872
1872
|
}
|
|
1873
1873
|
|
|
1874
1874
|
/**
|
|
1875
|
-
* Do not edit directly
|
|
1876
|
-
* Generated on
|
|
1875
|
+
* Do not edit directly
|
|
1876
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1877
1877
|
*/
|
|
1878
1878
|
|
|
1879
1879
|
.np-theme-business--forest-green {
|
|
@@ -2056,8 +2056,8 @@
|
|
|
2056
2056
|
}
|
|
2057
2057
|
|
|
2058
2058
|
/**
|
|
2059
|
-
* Do not edit directly
|
|
2060
|
-
* Generated on
|
|
2059
|
+
* Do not edit directly
|
|
2060
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
2061
2061
|
*/
|
|
2062
2062
|
|
|
2063
2063
|
.np-theme-business--bright-green {
|