uikit-react-public 0.39.0 → 0.40.0
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/dist/components/Accordion/Accordion.Heading.d.ts +2 -1
- package/dist/components/Accordion/Accordion.d.ts +8 -2
- package/dist/components/Accordion/Accordion.stories.d.ts +2 -2
- package/dist/components/Alert/Alert.d.ts +2 -2
- package/dist/components/Alert/Alert.stories.d.ts +2 -2
- package/dist/components/Alert/AlertMessage.d.ts +1 -1
- package/dist/components/Alert/AlertTitle.d.ts +1 -1
- package/dist/components/ErrorDialog/ErrorDialog.d.ts +26 -0
- package/dist/components/ErrorDialog/ErrorDialog.stories.d.ts +14 -0
- package/dist/components/ErrorDialog/__tests__/ErrorDialog.test.d.ts +1 -0
- package/dist/components/ErrorDialog/index.d.ts +2 -0
- package/dist/components/Field/HelperText.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +6648 -6322
- package/lib/components/Accordion/Accordion.Heading.tsx +24 -8
- package/lib/components/Accordion/Accordion.Panel.tsx +7 -4
- package/lib/components/Accordion/Accordion.stories.tsx +8 -8
- package/lib/components/Accordion/Accordion.tsx +17 -23
- package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +14 -14
- package/lib/components/Alert/Alert.tsx +0 -1
- package/lib/components/Alert/AlertMessage.tsx +10 -14
- package/lib/components/Alert/AlertTitle.tsx +11 -8
- package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +29 -14
- package/lib/components/AppHeader/AppHeader.tsx +0 -1
- package/lib/components/AppHeader/__tests__/__snapshots__/AppHeader.test.tsx.snap +1 -1
- package/lib/components/AppMenu/AppMenu.tsx +2 -9
- package/lib/components/AppMenu/AppMenuItem.tsx +6 -2
- package/lib/components/AppMenu/__tests__/__snapshots__/AppMenu.test.tsx.snap +6 -6
- package/lib/components/Breadcrumbs/Breadcrumbs.tsx +0 -4
- package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +10 -10
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +85 -85
- package/lib/components/Calendar/subcomponents/Day.tsx +7 -3
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +2 -2
- package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +6 -3
- package/lib/components/Dialog/BaseDialog.tsx +6 -2
- package/lib/components/ErrorDialog/ErrorDialog.stories.tsx +85 -0
- package/lib/components/ErrorDialog/ErrorDialog.tsx +433 -0
- package/lib/components/ErrorDialog/__tests__/ErrorDialog.test.tsx +145 -0
- package/lib/components/ErrorDialog/index.tsx +2 -0
- package/lib/components/Field/HelperText.tsx +9 -10
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +25 -25
- package/lib/components/FooterNew/__tests__/__snapshots__/Footer.test.tsx.snap +28 -28
- package/lib/components/Header/Header.tsx +6 -3
- package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +4 -4
- package/lib/components/HeaderNew/Header.tsx +0 -1
- package/lib/components/HeaderNew/__tests__/__snapshots__/Header.test.tsx.snap +2 -2
- package/lib/components/Input/Input.tsx +6 -3
- package/lib/components/Input/__tests__/__snapshots__/Input.test.tsx.snap +4 -4
- package/lib/components/Label/Label.tsx +7 -7
- package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +7 -7
- package/lib/components/Link/BaseLink.tsx +8 -16
- package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +2 -2
- package/lib/components/Menu/Menu.tsx +0 -4
- package/lib/components/Menu/MenuItem.tsx +7 -5
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +2 -2
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +2 -2
- package/lib/components/Select/subcomponents/CustomOption.tsx +6 -3
- package/lib/components/Select/subcomponents/CustomSelect.tsx +6 -2
- package/lib/components/Select/subcomponents/NativeSelect.tsx +6 -3
- package/lib/components/Select/subcomponents/VisibleField.tsx +6 -1
- package/lib/components/Sidebar/Sidebar.tsx +0 -1
- package/lib/components/Sidebar/__tests__/__snapshots__/Sidebar.test.tsx.snap +2 -2
- package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +2 -2
- package/lib/components/Textarea/Textarea.tsx +6 -3
- package/lib/components/Textarea/__tests__/__snapshots__/Textarea.test.tsx.snap +4 -4
- package/lib/components/Timepicker/Timepicker.tsx +6 -2
- package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +2 -2
- package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +6 -3
- package/lib/components/index.ts +3 -0
- package/package.json +1 -1
|
@@ -3,23 +3,27 @@ import { css, cx } from '@emotion/css';
|
|
|
3
3
|
import useTheme from '../../theme/useTheme';
|
|
4
4
|
import Icon from '../Icon/Icon';
|
|
5
5
|
import { useAccordionContext } from './Accordion';
|
|
6
|
+
import Heading, { HeadingProps } from '../Heading';
|
|
6
7
|
|
|
7
8
|
export const NAME = 'ucl-uikit-accordion__heading';
|
|
8
9
|
export const ICON_NAME = 'ucl-uikit-accordion__heading__icon';
|
|
9
10
|
|
|
10
11
|
export interface AccordionHeadingProps extends HTMLAttributes<HTMLElement> {
|
|
11
|
-
as?:
|
|
12
|
+
as?: HeadingProps['as'];
|
|
12
13
|
testId?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
16
17
|
children,
|
|
17
|
-
as
|
|
18
|
+
as,
|
|
18
19
|
testId = NAME,
|
|
19
20
|
className,
|
|
20
21
|
}) => {
|
|
21
22
|
const [theme] = useTheme();
|
|
22
23
|
const { isOpen, toggleAccordion, disabled, size } = useAccordionContext();
|
|
24
|
+
const isLarge = size === 'large';
|
|
25
|
+
const headingLevel = isLarge ? 'md' : 'xs';
|
|
26
|
+
const headingElement = as ?? (isLarge ? 'h4' : 'h6');
|
|
23
27
|
|
|
24
28
|
const handleKeyDown: React.KeyboardEventHandler<HTMLElement> = (e) => {
|
|
25
29
|
if (disabled) return;
|
|
@@ -37,7 +41,6 @@ const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
|
37
41
|
padding: ${theme.padding.p16};
|
|
38
42
|
background-color: ${theme.colour.fill.inverse};
|
|
39
43
|
cursor: pointer;
|
|
40
|
-
font-weight: ${theme.font.weight.bold};
|
|
41
44
|
transition: background-color 0.15s ease;
|
|
42
45
|
margin: 0;
|
|
43
46
|
border: none;
|
|
@@ -55,6 +58,16 @@ const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
|
55
58
|
color: ${theme.colour.icon.default};
|
|
56
59
|
}
|
|
57
60
|
}
|
|
61
|
+
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
background-color: ${theme.colour.fill.inverse};
|
|
64
|
+
box-shadow: ${theme.boxShadow.focus};
|
|
65
|
+
z-index: 1;
|
|
66
|
+
|
|
67
|
+
[class*='${ICON_NAME}'] {
|
|
68
|
+
color: ${theme.colour.icon.brand};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
58
71
|
`;
|
|
59
72
|
|
|
60
73
|
const disabledStyle = css`
|
|
@@ -75,7 +88,7 @@ const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
|
75
88
|
const iconBaseStyle = css`
|
|
76
89
|
transform: rotate(${isOpen ? '180deg' : '0deg'});
|
|
77
90
|
transition: transform 0.15s ease;
|
|
78
|
-
color: ${theme.colour.icon.
|
|
91
|
+
color: ${theme.colour.icon.default};
|
|
79
92
|
`;
|
|
80
93
|
|
|
81
94
|
const iconDisabledStyle = css`
|
|
@@ -85,9 +98,12 @@ const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
|
85
98
|
const iconStyle = cx(ICON_NAME, iconBaseStyle, disabled && iconDisabledStyle);
|
|
86
99
|
|
|
87
100
|
return (
|
|
88
|
-
<
|
|
101
|
+
<Heading
|
|
102
|
+
level={headingLevel}
|
|
103
|
+
as={headingElement}
|
|
104
|
+
noMargins
|
|
89
105
|
className={headingStyle}
|
|
90
|
-
|
|
106
|
+
testId={testId}
|
|
91
107
|
onKeyDown={handleKeyDown}
|
|
92
108
|
onClick={!disabled ? toggleAccordion : undefined}
|
|
93
109
|
role='button'
|
|
@@ -96,10 +112,10 @@ const AccordionHeading: React.FC<AccordionHeadingProps> = ({
|
|
|
96
112
|
>
|
|
97
113
|
{children}
|
|
98
114
|
<Icon.ChevronDown
|
|
99
|
-
size={
|
|
115
|
+
size={24}
|
|
100
116
|
className={iconStyle}
|
|
101
117
|
/>
|
|
102
|
-
</
|
|
118
|
+
</Heading>
|
|
103
119
|
);
|
|
104
120
|
};
|
|
105
121
|
|
|
@@ -2,6 +2,7 @@ import React, { HTMLAttributes } from 'react';
|
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import useTheme from '../../theme/useTheme';
|
|
4
4
|
import { useAccordionContext } from './Accordion';
|
|
5
|
+
import Paragraph from '../Paragraph';
|
|
5
6
|
|
|
6
7
|
export const NAME = 'ucl-uikit-accordion__panel';
|
|
7
8
|
|
|
@@ -29,7 +30,6 @@ const AccordionPanel: React.FC<AccordionPanelProps> = ({
|
|
|
29
30
|
min-width: 0;
|
|
30
31
|
flex-shrink: 1;
|
|
31
32
|
padding: ${theme.padding.p16};
|
|
32
|
-
font-weight: ${theme.font.weight.regular};
|
|
33
33
|
box-sizing: border-box;
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
overflow-wrap: break-word;
|
|
@@ -39,12 +39,15 @@ const AccordionPanel: React.FC<AccordionPanelProps> = ({
|
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<
|
|
42
|
+
<Paragraph
|
|
43
|
+
as='div'
|
|
44
|
+
level='md'
|
|
45
|
+
noMargins
|
|
43
46
|
className={panelStyle}
|
|
44
|
-
|
|
47
|
+
testId={testId}
|
|
45
48
|
>
|
|
46
49
|
{children}
|
|
47
|
-
</
|
|
50
|
+
</Paragraph>
|
|
48
51
|
);
|
|
49
52
|
};
|
|
50
53
|
|
|
@@ -9,7 +9,7 @@ const meta = {
|
|
|
9
9
|
},
|
|
10
10
|
argTypes: {
|
|
11
11
|
size: {
|
|
12
|
-
options: ['
|
|
12
|
+
options: ['default', 'large'],
|
|
13
13
|
control: { type: 'select' },
|
|
14
14
|
type: 'string',
|
|
15
15
|
},
|
|
@@ -33,7 +33,7 @@ const meta = {
|
|
|
33
33
|
args: {
|
|
34
34
|
isOpen: false,
|
|
35
35
|
disabled: false,
|
|
36
|
-
size: '
|
|
36
|
+
size: 'default',
|
|
37
37
|
},
|
|
38
38
|
tags: ['autodocs'],
|
|
39
39
|
} satisfies Meta<typeof Accordion>;
|
|
@@ -46,7 +46,7 @@ export const Default: Story = {
|
|
|
46
46
|
args: {
|
|
47
47
|
isOpen: false,
|
|
48
48
|
disabled: false,
|
|
49
|
-
size: '
|
|
49
|
+
size: 'default',
|
|
50
50
|
},
|
|
51
51
|
render: (args) => (
|
|
52
52
|
<Accordion {...args}>
|
|
@@ -60,7 +60,7 @@ export const Disabled: Story = {
|
|
|
60
60
|
args: {
|
|
61
61
|
isOpen: false,
|
|
62
62
|
disabled: true,
|
|
63
|
-
size: '
|
|
63
|
+
size: 'default',
|
|
64
64
|
},
|
|
65
65
|
render: (args) => (
|
|
66
66
|
<Accordion {...args}>
|
|
@@ -70,11 +70,11 @@ export const Disabled: Story = {
|
|
|
70
70
|
),
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
export const
|
|
73
|
+
export const LargeSize: Story = {
|
|
74
74
|
args: {
|
|
75
75
|
isOpen: false,
|
|
76
76
|
disabled: false,
|
|
77
|
-
size: '
|
|
77
|
+
size: 'large',
|
|
78
78
|
},
|
|
79
79
|
render: (args) => (
|
|
80
80
|
<Accordion {...args}>
|
|
@@ -88,7 +88,7 @@ export const CustomHeadingElement: Story = {
|
|
|
88
88
|
args: {
|
|
89
89
|
isOpen: false,
|
|
90
90
|
disabled: false,
|
|
91
|
-
size: '
|
|
91
|
+
size: 'large',
|
|
92
92
|
},
|
|
93
93
|
render: (args) => (
|
|
94
94
|
<Accordion {...args}>
|
|
@@ -104,7 +104,7 @@ export const MultipleAccordions: Story = {
|
|
|
104
104
|
args: {
|
|
105
105
|
isOpen: false,
|
|
106
106
|
disabled: false,
|
|
107
|
-
size: '
|
|
107
|
+
size: 'default',
|
|
108
108
|
},
|
|
109
109
|
render: (args) => (
|
|
110
110
|
<div style={{ width: '100%', maxWidth: 660 }}>
|
|
@@ -11,11 +11,21 @@ import useTheme from '../../theme/useTheme';
|
|
|
11
11
|
|
|
12
12
|
export const NAME = 'ucl-uikit-accordion';
|
|
13
13
|
|
|
14
|
+
export type AccordionSize =
|
|
15
|
+
| 'default'
|
|
16
|
+
| 'large'
|
|
17
|
+
/** @deprecated Use `default` instead. */
|
|
18
|
+
| 'small'
|
|
19
|
+
/** @deprecated Use `large` instead. */
|
|
20
|
+
| 'medium';
|
|
21
|
+
|
|
22
|
+
type NormalizedAccordionSize = Exclude<AccordionSize, 'small' | 'medium'>;
|
|
23
|
+
|
|
14
24
|
interface AccordionContextProps {
|
|
15
25
|
isOpen: boolean;
|
|
16
26
|
toggleAccordion: () => void;
|
|
17
27
|
disabled: boolean;
|
|
18
|
-
size:
|
|
28
|
+
size: NormalizedAccordionSize;
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
const AccordionContext = createContext<AccordionContextProps | undefined>(
|
|
@@ -34,7 +44,7 @@ export const useAccordionContext = () => {
|
|
|
34
44
|
|
|
35
45
|
export interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
46
|
testId?: string;
|
|
37
|
-
size?:
|
|
47
|
+
size?: AccordionSize;
|
|
38
48
|
disabled?: boolean;
|
|
39
49
|
isOpen?: boolean;
|
|
40
50
|
}
|
|
@@ -43,7 +53,7 @@ const Accordion: React.FC<AccordionProps> & {
|
|
|
43
53
|
Heading: typeof AccordionHeading;
|
|
44
54
|
Panel: typeof AccordionPanel;
|
|
45
55
|
} = ({
|
|
46
|
-
size = '
|
|
56
|
+
size = 'default',
|
|
47
57
|
disabled = false,
|
|
48
58
|
isOpen = false,
|
|
49
59
|
children,
|
|
@@ -52,6 +62,8 @@ const Accordion: React.FC<AccordionProps> & {
|
|
|
52
62
|
}) => {
|
|
53
63
|
const [open, setOpen] = useState(isOpen);
|
|
54
64
|
const [theme] = useTheme();
|
|
65
|
+
const normalizedSize: NormalizedAccordionSize =
|
|
66
|
+
size === 'small' ? 'default' : size === 'medium' ? 'large' : size;
|
|
55
67
|
|
|
56
68
|
const toggleAccordion = () => {
|
|
57
69
|
if (!disabled) {
|
|
@@ -67,34 +79,16 @@ const Accordion: React.FC<AccordionProps> & {
|
|
|
67
79
|
border: 1px solid ${theme.colour.border.default};
|
|
68
80
|
background-color: ${theme.colour.surface.default};
|
|
69
81
|
color: ${theme.colour.text.default};
|
|
70
|
-
font-family: ${theme.font.family.primary};
|
|
71
|
-
font-size: ${theme.font.size.f16};
|
|
72
82
|
flex-shrink: 1;
|
|
73
83
|
`;
|
|
74
84
|
|
|
75
|
-
const sizeSmallStyle = css`
|
|
76
|
-
font-size: ${theme.font.size.f16};
|
|
77
|
-
line-height: ${theme.height.h24};
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
const sizeMediumStyle = css`
|
|
81
|
-
font-size: ${theme.font.size.f20};
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
85
|
const disabledStyle = css`
|
|
85
86
|
pointer-events: none;
|
|
86
87
|
background-color: ${theme.colour.fill.inverse};
|
|
87
88
|
color: ${theme.colour.text.disabled};
|
|
88
89
|
`;
|
|
89
90
|
|
|
90
|
-
const style = cx(
|
|
91
|
-
NAME,
|
|
92
|
-
baseStyle,
|
|
93
|
-
size === 'small' && sizeSmallStyle,
|
|
94
|
-
size === 'medium' && sizeMediumStyle,
|
|
95
|
-
disabled && disabledStyle,
|
|
96
|
-
className
|
|
97
|
-
);
|
|
91
|
+
const style = cx(NAME, baseStyle, disabled && disabledStyle, className);
|
|
98
92
|
|
|
99
93
|
return (
|
|
100
94
|
<AccordionContext.Provider
|
|
@@ -102,7 +96,7 @@ const Accordion: React.FC<AccordionProps> & {
|
|
|
102
96
|
isOpen: open,
|
|
103
97
|
toggleAccordion,
|
|
104
98
|
disabled,
|
|
105
|
-
size,
|
|
99
|
+
size: normalizedSize,
|
|
106
100
|
}}
|
|
107
101
|
>
|
|
108
102
|
<div
|
|
@@ -3,71 +3,71 @@
|
|
|
3
3
|
exports[`Accordion > snapshot: no props 1`] = `
|
|
4
4
|
<div
|
|
5
5
|
aria-disabled="false"
|
|
6
|
-
class="ucl-uikit-accordion css-
|
|
6
|
+
class="ucl-uikit-accordion css-cn49eu"
|
|
7
7
|
data-testid="ucl-uikit-accordion"
|
|
8
8
|
>
|
|
9
|
-
<
|
|
9
|
+
<h6
|
|
10
10
|
aria-expanded="false"
|
|
11
|
-
class="ucl-uikit-accordion__heading css-
|
|
11
|
+
class="ucl-uikit-heading ucl-uikit-accordion__heading css-db8j7j"
|
|
12
12
|
data-testid="ucl-uikit-accordion__heading"
|
|
13
13
|
role="button"
|
|
14
14
|
tabindex="0"
|
|
15
15
|
>
|
|
16
16
|
Heading
|
|
17
17
|
<svg
|
|
18
|
-
class="ucl-uikit-icon ucl-uikit-accordion__heading__icon css-
|
|
18
|
+
class="ucl-uikit-icon ucl-uikit-accordion__heading__icon css-2eekj2"
|
|
19
19
|
data-testid="ucl-uikit-icon"
|
|
20
20
|
fill="none"
|
|
21
21
|
focusable="false"
|
|
22
|
-
height="
|
|
22
|
+
height="24"
|
|
23
23
|
stroke="currentColor"
|
|
24
24
|
stroke-linecap="round"
|
|
25
25
|
stroke-linejoin="round"
|
|
26
26
|
stroke-width="2"
|
|
27
27
|
viewBox="0 0 24 24"
|
|
28
|
-
width="
|
|
28
|
+
width="24"
|
|
29
29
|
xmlns="http://www.w3.org/2000/svg"
|
|
30
30
|
>
|
|
31
31
|
<path
|
|
32
32
|
d="m6 9 6 6 6-6"
|
|
33
33
|
/>
|
|
34
34
|
</svg>
|
|
35
|
-
</
|
|
35
|
+
</h6>
|
|
36
36
|
</div>
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
exports[`Accordion > snapshot: testId prop 1`] = `
|
|
40
40
|
<div
|
|
41
41
|
aria-disabled="false"
|
|
42
|
-
class="ucl-uikit-accordion css-
|
|
42
|
+
class="ucl-uikit-accordion css-cn49eu"
|
|
43
43
|
data-testid="abc"
|
|
44
44
|
>
|
|
45
|
-
<
|
|
45
|
+
<h6
|
|
46
46
|
aria-expanded="false"
|
|
47
|
-
class="ucl-uikit-accordion__heading css-
|
|
47
|
+
class="ucl-uikit-heading ucl-uikit-accordion__heading css-db8j7j"
|
|
48
48
|
data-testid="ucl-uikit-accordion__heading"
|
|
49
49
|
role="button"
|
|
50
50
|
tabindex="0"
|
|
51
51
|
>
|
|
52
52
|
Heading
|
|
53
53
|
<svg
|
|
54
|
-
class="ucl-uikit-icon ucl-uikit-accordion__heading__icon css-
|
|
54
|
+
class="ucl-uikit-icon ucl-uikit-accordion__heading__icon css-2eekj2"
|
|
55
55
|
data-testid="ucl-uikit-icon"
|
|
56
56
|
fill="none"
|
|
57
57
|
focusable="false"
|
|
58
|
-
height="
|
|
58
|
+
height="24"
|
|
59
59
|
stroke="currentColor"
|
|
60
60
|
stroke-linecap="round"
|
|
61
61
|
stroke-linejoin="round"
|
|
62
62
|
stroke-width="2"
|
|
63
63
|
viewBox="0 0 24 24"
|
|
64
|
-
width="
|
|
64
|
+
width="24"
|
|
65
65
|
xmlns="http://www.w3.org/2000/svg"
|
|
66
66
|
>
|
|
67
67
|
<path
|
|
68
68
|
d="m6 9 6 6 6-6"
|
|
69
69
|
/>
|
|
70
70
|
</svg>
|
|
71
|
-
</
|
|
71
|
+
</h6>
|
|
72
72
|
</div>
|
|
73
73
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useTheme } from '../../theme';
|
|
1
|
+
import { cx } from '@emotion/css';
|
|
3
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
+
import Paragraph from '../Paragraph';
|
|
4
4
|
|
|
5
5
|
export const NAME = 'ucl-uikit-alert__message';
|
|
6
6
|
|
|
@@ -12,24 +12,20 @@ const AlertMessage = ({
|
|
|
12
12
|
testId = NAME,
|
|
13
13
|
className,
|
|
14
14
|
children,
|
|
15
|
+
...props
|
|
15
16
|
}: AlertMessageProps) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const messageStyles = css`
|
|
19
|
-
font-size: ${theme.font.size.f16};
|
|
20
|
-
color: ${theme.colour.text.default};
|
|
21
|
-
margin: 0;
|
|
22
|
-
line-height: 1.5;
|
|
23
|
-
`;
|
|
24
|
-
const style = cx(messageStyles, NAME, className);
|
|
17
|
+
const style = cx(NAME, className);
|
|
25
18
|
|
|
26
19
|
return (
|
|
27
|
-
<
|
|
20
|
+
<Paragraph
|
|
21
|
+
level='md'
|
|
22
|
+
noMargins
|
|
23
|
+
testId={testId}
|
|
28
24
|
className={style}
|
|
29
|
-
|
|
25
|
+
{...props}
|
|
30
26
|
>
|
|
31
27
|
{children}
|
|
32
|
-
</
|
|
28
|
+
</Paragraph>
|
|
33
29
|
);
|
|
34
30
|
};
|
|
35
31
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { css } from '@emotion/css';
|
|
1
|
+
import { css, cx } from '@emotion/css';
|
|
2
2
|
import { useTheme } from '../../theme';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
|
+
import Text from '../Text';
|
|
4
5
|
|
|
5
6
|
export const NAME = 'ucl-uikit-alert__title';
|
|
6
7
|
|
|
@@ -8,23 +9,25 @@ export interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
|
8
9
|
testId?: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
const AlertTitle = ({
|
|
12
|
+
const AlertTitle = ({
|
|
13
|
+
children,
|
|
14
|
+
testId = NAME,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: AlertTitleProps) => {
|
|
12
18
|
const [theme] = useTheme();
|
|
13
19
|
|
|
14
20
|
const titleStyles = css`
|
|
15
21
|
margin: 0 0 ${theme.margin.m8} 0;
|
|
16
|
-
font-family: ${theme.font.family.primary};
|
|
17
|
-
font-size: ${theme.font.size.f16};
|
|
18
|
-
font-weight: 700;
|
|
19
|
-
color: ${theme.colour.text.default};
|
|
20
22
|
`;
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
25
|
<h3
|
|
24
|
-
className={titleStyles}
|
|
26
|
+
className={cx(NAME, titleStyles, className)}
|
|
25
27
|
data-test-id={testId}
|
|
28
|
+
{...props}
|
|
26
29
|
>
|
|
27
|
-
{children}
|
|
30
|
+
<Text level='md-semibold'>{children}</Text>
|
|
28
31
|
</h3>
|
|
29
32
|
);
|
|
30
33
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Alert > snapshot: type=error 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
class="ucl-uikit-alert css-
|
|
5
|
+
class="ucl-uikit-alert css-1eemwvm"
|
|
6
6
|
data-testid="ucl-uikit-alert"
|
|
7
7
|
role="alert"
|
|
8
8
|
>
|
|
@@ -32,13 +32,18 @@ exports[`Alert > snapshot: type=error 1`] = `
|
|
|
32
32
|
</svg>
|
|
33
33
|
<div>
|
|
34
34
|
<h3
|
|
35
|
-
class="css-
|
|
35
|
+
class="ucl-uikit-alert__title css-mm5n7t"
|
|
36
36
|
data-test-id="ucl-uikit-alert__title"
|
|
37
37
|
>
|
|
38
|
-
|
|
38
|
+
<span
|
|
39
|
+
class="ucl-uikit-text css-1w35ze4"
|
|
40
|
+
data-testid="ucl-uikit-text"
|
|
41
|
+
>
|
|
42
|
+
Error Alert
|
|
43
|
+
</span>
|
|
39
44
|
</h3>
|
|
40
45
|
<p
|
|
41
|
-
class="
|
|
46
|
+
class="ucl-uikit-paragrah ucl-uikit-alert__message css-1dosm7d"
|
|
42
47
|
data-testid="ucl-uikit-alert__message"
|
|
43
48
|
>
|
|
44
49
|
The operation failed.
|
|
@@ -49,7 +54,7 @@ exports[`Alert > snapshot: type=error 1`] = `
|
|
|
49
54
|
|
|
50
55
|
exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
51
56
|
<div
|
|
52
|
-
class="ucl-uikit-alert css-
|
|
57
|
+
class="ucl-uikit-alert css-1d2q0wf"
|
|
53
58
|
data-testid="ucl-uikit-alert"
|
|
54
59
|
role="alert"
|
|
55
60
|
>
|
|
@@ -79,7 +84,7 @@ exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
|
79
84
|
</svg>
|
|
80
85
|
<div>
|
|
81
86
|
<p
|
|
82
|
-
class="
|
|
87
|
+
class="ucl-uikit-paragrah ucl-uikit-alert__message css-1dosm7d"
|
|
83
88
|
data-testid="ucl-uikit-alert__message"
|
|
84
89
|
>
|
|
85
90
|
This is an informational alert.
|
|
@@ -90,7 +95,7 @@ exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
|
90
95
|
|
|
91
96
|
exports[`Alert > snapshot: type=success 1`] = `
|
|
92
97
|
<div
|
|
93
|
-
class="ucl-uikit-alert css-
|
|
98
|
+
class="ucl-uikit-alert css-1p0xqd2"
|
|
94
99
|
data-testid="ucl-uikit-alert"
|
|
95
100
|
role="alert"
|
|
96
101
|
>
|
|
@@ -118,13 +123,18 @@ exports[`Alert > snapshot: type=success 1`] = `
|
|
|
118
123
|
</svg>
|
|
119
124
|
<div>
|
|
120
125
|
<h3
|
|
121
|
-
class="css-
|
|
126
|
+
class="ucl-uikit-alert__title css-mm5n7t"
|
|
122
127
|
data-test-id="ucl-uikit-alert__title"
|
|
123
128
|
>
|
|
124
|
-
|
|
129
|
+
<span
|
|
130
|
+
class="ucl-uikit-text css-1w35ze4"
|
|
131
|
+
data-testid="ucl-uikit-text"
|
|
132
|
+
>
|
|
133
|
+
Success
|
|
134
|
+
</span>
|
|
125
135
|
</h3>
|
|
126
136
|
<p
|
|
127
|
-
class="
|
|
137
|
+
class="ucl-uikit-paragrah ucl-uikit-alert__message css-1dosm7d"
|
|
128
138
|
data-testid="ucl-uikit-alert__message"
|
|
129
139
|
>
|
|
130
140
|
Your operation completed successfully.
|
|
@@ -135,7 +145,7 @@ exports[`Alert > snapshot: type=success 1`] = `
|
|
|
135
145
|
|
|
136
146
|
exports[`Alert > snapshot: type=warning 1`] = `
|
|
137
147
|
<div
|
|
138
|
-
class="ucl-uikit-alert css-
|
|
148
|
+
class="ucl-uikit-alert css-1ks795a"
|
|
139
149
|
data-testid="ucl-uikit-alert"
|
|
140
150
|
role="alert"
|
|
141
151
|
>
|
|
@@ -160,13 +170,18 @@ exports[`Alert > snapshot: type=warning 1`] = `
|
|
|
160
170
|
</svg>
|
|
161
171
|
<div>
|
|
162
172
|
<h3
|
|
163
|
-
class="css-
|
|
173
|
+
class="ucl-uikit-alert__title css-mm5n7t"
|
|
164
174
|
data-test-id="ucl-uikit-alert__title"
|
|
165
175
|
>
|
|
166
|
-
|
|
176
|
+
<span
|
|
177
|
+
class="ucl-uikit-text css-1w35ze4"
|
|
178
|
+
data-testid="ucl-uikit-text"
|
|
179
|
+
>
|
|
180
|
+
Warning
|
|
181
|
+
</span>
|
|
167
182
|
</h3>
|
|
168
183
|
<p
|
|
169
|
-
class="
|
|
184
|
+
class="ucl-uikit-paragrah ucl-uikit-alert__message css-1dosm7d"
|
|
170
185
|
data-testid="ucl-uikit-alert__message"
|
|
171
186
|
>
|
|
172
187
|
This operation may have unintended consequences.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
|
-
import { useTheme } from '../../theme';
|
|
4
3
|
import AppMenuProvider from './AppMenu.context';
|
|
5
4
|
import AppMenuContent from './AppMenuContent';
|
|
6
5
|
import AppMenuItem from './AppMenuItem';
|
|
@@ -9,8 +8,7 @@ import AppMenuTrigger from './AppMenuTrigger';
|
|
|
9
8
|
|
|
10
9
|
export const NAME = 'ucl-app-menu';
|
|
11
10
|
|
|
12
|
-
export interface AppMenuProps
|
|
13
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
export interface AppMenuProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
12
|
testId?: string;
|
|
15
13
|
defaultOpen?: boolean;
|
|
16
14
|
}
|
|
@@ -22,11 +20,8 @@ const AppMenu = ({
|
|
|
22
20
|
className,
|
|
23
21
|
...props
|
|
24
22
|
}: AppMenuProps) => {
|
|
25
|
-
const [theme] = useTheme();
|
|
26
|
-
|
|
27
23
|
const baseStyle = css`
|
|
28
24
|
position: relative;
|
|
29
|
-
font-family: ${theme.font.family.primary};
|
|
30
25
|
`;
|
|
31
26
|
|
|
32
27
|
const style = cx(NAME, baseStyle, className);
|
|
@@ -37,9 +32,7 @@ const AppMenu = ({
|
|
|
37
32
|
data-testid={testId}
|
|
38
33
|
{...props}
|
|
39
34
|
>
|
|
40
|
-
<AppMenuProvider defaultOpen={defaultOpen}>
|
|
41
|
-
{children}
|
|
42
|
-
</AppMenuProvider>
|
|
35
|
+
<AppMenuProvider defaultOpen={defaultOpen}>{children}</AppMenuProvider>
|
|
43
36
|
</div>
|
|
44
37
|
);
|
|
45
38
|
};
|
|
@@ -37,6 +37,7 @@ const AppMenuItem: React.FC<AppMenuItemProps> = ({
|
|
|
37
37
|
return window.location.pathname === internalLink;
|
|
38
38
|
return false;
|
|
39
39
|
}, [isActive, internalLink]);
|
|
40
|
+
const { mdSemibold } = theme.typography.body;
|
|
40
41
|
|
|
41
42
|
const handleClick = (e: React.MouseEvent<Element, MouseEvent>) => {
|
|
42
43
|
if (isCurrent) {
|
|
@@ -53,8 +54,11 @@ const AppMenuItem: React.FC<AppMenuItemProps> = ({
|
|
|
53
54
|
padding: 0 16px;
|
|
54
55
|
display: flex;
|
|
55
56
|
align-items: center;
|
|
56
|
-
font-family: ${
|
|
57
|
-
font-
|
|
57
|
+
font-family: ${mdSemibold.fontFamily};
|
|
58
|
+
font-feature-settings: ${mdSemibold.fontSettings};
|
|
59
|
+
font-size: ${mdSemibold.fontSize}px;
|
|
60
|
+
font-weight: ${mdSemibold.fontWeight};
|
|
61
|
+
line-height: ${mdSemibold.lineHeight}%;
|
|
58
62
|
color: ${theme.colour.text.secondary};
|
|
59
63
|
`;
|
|
60
64
|
|