@hlf-fe/pulmo-ui 1.0.1 → 1.1.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/README.md +21 -54
- package/dist/components/buttons/button/button.js +1 -1
- package/dist/components/buttons/button/button.stories.js +6 -1
- package/dist/components/buttons/loading-button/loading-button.d.ts +14 -0
- package/dist/components/buttons/loading-button/loading-button.js +26 -0
- package/dist/components/buttons/loading-button/loading-button.stories.d.ts +7 -0
- package/dist/components/buttons/loading-button/loading-button.stories.js +23 -0
- package/dist/components/buttons/text-button/text-button.d.ts +20 -0
- package/dist/components/buttons/text-button/text-button.js +61 -0
- package/dist/components/buttons/text-button/text-button.stories.d.ts +6 -0
- package/dist/components/buttons/text-button/text-button.stories.js +16 -0
- package/dist/components/decorator/decorator.d.ts +7 -0
- package/dist/components/decorator/decorator.js +13 -0
- package/dist/components/feedback/alert/alert.d.ts +17 -0
- package/dist/components/feedback/alert/alert.js +68 -0
- package/dist/components/feedback/alert/alert.stories.d.ts +6 -0
- package/dist/components/feedback/alert/alert.stories.js +23 -0
- package/dist/components/icons/chevron-left-icon/chevron-left-icon.d.ts +7 -0
- package/dist/components/icons/chevron-left-icon/chevron-left-icon.js +3 -0
- package/dist/components/icons/chevron-left-icon/chevron-left-icon.stories.d.ts +6 -0
- package/dist/components/icons/chevron-left-icon/chevron-left-icon.stories.js +14 -0
- package/dist/components/icons/chevron-right-icon/chevron-right-icon.d.ts +7 -0
- package/dist/components/icons/chevron-right-icon/chevron-right-icon.js +3 -0
- package/dist/components/icons/chevron-right-icon/chevron-right-icon.stories.d.ts +6 -0
- package/dist/components/icons/chevron-right-icon/chevron-right-icon.stories.js +14 -0
- package/dist/components/icons/close-icon/close-icon.d.ts +12 -0
- package/dist/components/icons/close-icon/close-icon.js +9 -0
- package/dist/components/icons/close-icon/close-icon.stories.d.ts +6 -0
- package/dist/components/icons/close-icon/close-icon.stories.js +16 -0
- package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.d.ts +3 -0
- package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.js +3 -0
- package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.stories.d.ts +6 -0
- package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.stories.js +16 -0
- package/dist/components/icons/loading-spinner/loading-spinner.d.ts +20 -0
- package/dist/components/icons/loading-spinner/loading-spinner.js +32 -0
- package/dist/components/icons/loading-spinner/loading-spinner.stories.d.ts +6 -0
- package/dist/components/icons/loading-spinner/loading-spinner.stories.js +18 -0
- package/dist/components/icons/search-icon/search-icon.d.ts +5 -0
- package/dist/components/icons/search-icon/search-icon.js +3 -0
- package/dist/components/icons/search-icon/search-icon.stories.d.ts +6 -0
- package/dist/components/icons/search-icon/search-icon.stories.js +18 -0
- package/dist/components/icons/toggable-chevron/toggable-chevron.d.ts +12 -0
- package/dist/components/icons/toggable-chevron/toggable-chevron.js +20 -0
- package/dist/components/icons/toggable-chevron/toggable-chevron.stories.d.ts +7 -0
- package/dist/components/icons/toggable-chevron/toggable-chevron.stories.js +21 -0
- package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.d.ts +6 -0
- package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.js +13 -0
- package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.stories.d.ts +7 -0
- package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.stories.js +21 -0
- package/dist/components/icons/warning-icon/warning-icon.d.ts +3 -0
- package/dist/components/icons/warning-icon/warning-icon.js +3 -0
- package/dist/components/icons/warning-icon/warning-icon.stories.d.ts +6 -0
- package/dist/components/icons/warning-icon/warning-icon.stories.js +16 -0
- package/dist/components/inputs/dropdown/dropdown-list-item.d.ts +6 -0
- package/dist/components/inputs/dropdown/dropdown-list-item.js +33 -0
- package/dist/components/inputs/dropdown/dropdown.d.ts +13 -0
- package/dist/components/inputs/dropdown/dropdown.js +109 -0
- package/dist/components/inputs/dropdown/dropdown.stories.d.ts +7 -0
- package/dist/components/inputs/dropdown/dropdown.stories.js +84 -0
- package/dist/components/inputs/form-error/form-error.d.ts +11 -0
- package/dist/components/inputs/form-error/form-error.js +16 -0
- package/dist/components/inputs/form-error/form-error.stories.d.ts +6 -0
- package/dist/components/inputs/form-error/form-error.stories.js +22 -0
- package/dist/components/inputs/form-label/form-label.d.ts +7 -0
- package/dist/components/inputs/form-label/form-label.js +12 -0
- package/dist/components/inputs/form-label/form-label.stories.d.ts +6 -0
- package/dist/components/inputs/form-label/form-label.stories.js +16 -0
- package/dist/components/inputs/text-field/text-field.d.ts +32 -0
- package/dist/components/inputs/text-field/text-field.js +65 -0
- package/dist/components/inputs/text-field/text-field.stories.d.ts +11 -0
- package/dist/components/inputs/text-field/text-field.stories.js +51 -0
- package/dist/components/layout/accordion/accordion.d.ts +13 -0
- package/dist/components/layout/accordion/accordion.js +115 -0
- package/dist/components/layout/accordion/accordion.stories.d.ts +6 -0
- package/dist/components/layout/accordion/accordion.stories.js +14 -0
- package/dist/components/layout/container/container.d.ts +10 -0
- package/dist/components/layout/container/container.js +19 -0
- package/dist/components/layout/container/container.stories.d.ts +9 -0
- package/dist/components/layout/container/container.stories.js +47 -0
- package/dist/components/layout/image/image.d.ts +22 -0
- package/dist/components/layout/image/image.js +27 -0
- package/dist/components/layout/image/image.stories.d.ts +6 -0
- package/dist/components/layout/image/image.stories.js +33 -0
- package/dist/components/modules/email-signup-form/email-signup-form.d.ts +16 -0
- package/dist/components/modules/email-signup-form/email-signup-form.js +63 -0
- package/dist/components/modules/email-signup-form/email-signup-form.stories.d.ts +9 -0
- package/dist/components/modules/email-signup-form/email-signup-form.stories.js +51 -0
- package/dist/components/modules/entry-list/entry-list.d.ts +27 -0
- package/dist/components/modules/entry-list/entry-list.js +54 -0
- package/dist/components/modules/entry-list/entry-list.stories.d.ts +6 -0
- package/dist/components/modules/entry-list/entry-list.stories.js +14 -0
- package/dist/components/navigation/pagination/pagination.d.ts +12 -0
- package/dist/components/navigation/pagination/pagination.js +114 -0
- package/dist/components/navigation/pagination/pagination.stories.d.ts +6 -0
- package/dist/components/navigation/pagination/pagination.stories.js +21 -0
- package/dist/constants/general.d.ts +4 -0
- package/dist/constants/general.js +5 -0
- package/dist/hoc/withDefaultTheme.d.ts +1 -1
- package/dist/hoc/withDefaultTheme.js +4 -8
- package/dist/index.d.ts +40 -2
- package/dist/index.js +42 -2
- package/dist/styles/mixins.js +8 -4
- package/dist/styles/theme.d.ts +11 -9
- package/dist/styles/theme.js +12 -11
- package/package.json +78 -67
- package/dist/App.d.ts +0 -3
- package/dist/App.js +0 -10
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -6
- package/dist/stories/Button.d.ts +0 -14
- package/dist/stories/Button.js +0 -20
- package/dist/stories/Button.stories.d.ts +0 -23
- package/dist/stories/Button.stories.js +0 -44
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.js +0 -4
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.js +0 -26
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.js +0 -7
- package/dist/stories/Page.stories.d.ts +0 -12
- package/dist/stories/Page.stories.js +0 -24
- package/dist/styles/styles/mixins/theme-mixins.d.ts +0 -5
- package/dist/styles/styles/mixins/theme-mixins.js +0 -37
- package/dist/styles/styles/mixins/units.d.ts +0 -3
- package/dist/styles/styles/mixins/units.js +0 -3
- package/dist/styles/styles/mixins.d.ts +0 -48
- package/dist/styles/styles/mixins.js +0 -336
- package/dist/styles/styles/theme.d.ts +0 -135
- package/dist/styles/styles/theme.js +0 -77
- package/dist/styles/types.d.ts +0 -3
- package/dist/styles/types.js +0 -1
- package/dist/styles/withDefaultTheme.d.ts +0 -1
- package/dist/styles/withDefaultTheme.js +0 -12
package/README.md
CHANGED
|
@@ -1,54 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
23
|
-
],
|
|
24
|
-
languageOptions: {
|
|
25
|
-
// other options...
|
|
26
|
-
parserOptions: {
|
|
27
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
28
|
-
tsconfigRootDir: import.meta.dirname,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
// eslint.config.js
|
|
38
|
-
import reactX from 'eslint-plugin-react-x'
|
|
39
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
40
|
-
|
|
41
|
-
export default tseslint.config({
|
|
42
|
-
plugins: {
|
|
43
|
-
// Add the react-x and react-dom plugins
|
|
44
|
-
'react-x': reactX,
|
|
45
|
-
'react-dom': reactDom,
|
|
46
|
-
},
|
|
47
|
-
rules: {
|
|
48
|
-
// other rules...
|
|
49
|
-
// Enable its recommended typescript rules
|
|
50
|
-
...reactX.configs['recommended-typescript'].rules,
|
|
51
|
-
...reactDom.configs.recommended.rules,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
```
|
|
1
|
+
## Link the library to a local project
|
|
2
|
+
|
|
3
|
+
1. In the root directory of the component library, run:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm link
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
2. In your project's root (the consumer of the library), run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm link @hlf-fe/pulmo-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
3. Verify the link in your consumer project's root:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm ls @hlf-fe/pulmo-ui
|
|
19
|
+
|
|
20
|
+
output: @hlf-fe/pulmo-ui@x.x.x -> /local/path/to/lib
|
|
21
|
+
```
|
|
@@ -33,7 +33,7 @@ const StyledButton = styled.button `
|
|
|
33
33
|
text-decoration: none;
|
|
34
34
|
color: ${({ theme, inverted }) => (inverted ? theme.red : theme.white)};
|
|
35
35
|
width: ${({ fullWidthMobile }) => (fullWidthMobile ? "100%" : "fit-content")};
|
|
36
|
-
background-color: ${({ theme, inverted }) => inverted ? theme.white : theme.
|
|
36
|
+
background-color: ${({ theme, inverted }) => inverted ? theme.white : theme.red};
|
|
37
37
|
line-height: 2.5;
|
|
38
38
|
border-radius: ${rem(5)};
|
|
39
39
|
border-color: ${({ theme, inverted }) => inverted ? theme.red : "transparent"};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Button } from "./button";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
2
4
|
const meta = {
|
|
3
|
-
title: "
|
|
5
|
+
title: "Buttons/Button",
|
|
4
6
|
component: Button,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
5
10
|
};
|
|
6
11
|
export default meta;
|
|
7
12
|
export const Default = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLProps, ReactNode } from "react";
|
|
2
|
+
export type LoadingButtonProps = HTMLProps<HTMLButtonElement> & {
|
|
3
|
+
type?: "button" | "reset" | "submit";
|
|
4
|
+
loading: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
btnSize?: "s" | "m" | "l";
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
fullWidthMobile?: boolean;
|
|
9
|
+
dataTest?: string;
|
|
10
|
+
inverted?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const LoadingButton: ({ type, children, onClick, loading, disabled, className, btnSize, fullWidth, fullWidthMobile, dataTest, inverted, }: LoadingButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../../components/buttons/button/button";
|
|
3
|
+
import { LoadingSpinner } from "../../../components/icons/loading-spinner/loading-spinner";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { rem } from "../../../styles/units";
|
|
6
|
+
import { COLORS } from "../../../styles/theme";
|
|
7
|
+
export const LoadingButton = ({ type = "submit", children, onClick = () => { }, loading = false, disabled = false, className, btnSize, fullWidth, fullWidthMobile, dataTest, inverted = false, }) => {
|
|
8
|
+
return (_jsxs(Container, { className: className, children: [_jsx(Button, { dataTest: dataTest, type: type, children: children, onClick: onClick, disabled: disabled, btnSize: btnSize, fullWidthMobile: fullWidthMobile, fullWidth: fullWidth, inverted: inverted }), loading && (_jsx(LoadingSpinnerContainer, { children: _jsx(LoadingSpinner, { color: COLORS?.white }) }))] }));
|
|
9
|
+
};
|
|
10
|
+
const Container = styled.div `
|
|
11
|
+
position: relative;
|
|
12
|
+
width: fit-content;
|
|
13
|
+
`;
|
|
14
|
+
const LoadingSpinnerContainer = styled.div `
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
background: ${({ theme }) => theme.red};
|
|
24
|
+
z-index: 1;
|
|
25
|
+
border-radius: ${rem(5)};
|
|
26
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { LoadingButton } from "./loading-button";
|
|
3
|
+
declare const meta: Meta<typeof LoadingButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof LoadingButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingButton } from "./loading-button";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Buttons/LoadingButton",
|
|
6
|
+
component: LoadingButton,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
btnSize: "m",
|
|
15
|
+
children: "Button Text",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const Loading = {
|
|
19
|
+
args: {
|
|
20
|
+
children: "Button Text",
|
|
21
|
+
loading: true,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TextButtonProps = {
|
|
2
|
+
type?: "button" | "reset" | "submit";
|
|
3
|
+
text?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
icon?: string;
|
|
7
|
+
dataTest?: string;
|
|
8
|
+
to?: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
onMouseEnter?: () => void;
|
|
14
|
+
onMouseLeave?: () => void;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
export type StyledTextButtonProps = {
|
|
18
|
+
icon?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const TextButton: ({ type, onClick, onMouseEnter, onMouseLeave, className, disabled, dataTest, children, to, href, target, tabIndex, }: TextButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { rem } from "../../../styles/units";
|
|
4
|
+
import { Link } from "gatsby";
|
|
5
|
+
export const TextButton = ({ type = "button", onClick, onMouseEnter, onMouseLeave, className, disabled, dataTest, children, to, href, target, tabIndex, }) => {
|
|
6
|
+
const commonProps = {
|
|
7
|
+
className,
|
|
8
|
+
onClick,
|
|
9
|
+
onMouseEnter,
|
|
10
|
+
onMouseLeave,
|
|
11
|
+
"data-test": dataTest,
|
|
12
|
+
tabIndex,
|
|
13
|
+
};
|
|
14
|
+
const asElement = to ? Link : href ? "a" : "button";
|
|
15
|
+
return (_jsx(StyledTextButton, { as: asElement, ...commonProps, ...(to ? { to } : {}), ...(href
|
|
16
|
+
? {
|
|
17
|
+
href,
|
|
18
|
+
target,
|
|
19
|
+
rel: target === "_blank" ? "noopener noreferrer" : undefined,
|
|
20
|
+
}
|
|
21
|
+
: {}), ...(!to && !href ? { type, disabled } : {}), children: children }));
|
|
22
|
+
};
|
|
23
|
+
const StyledTextButton = styled.button `
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
font-size: ${rem(16)};
|
|
29
|
+
width: fit-content;
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
line-height: 1.75;
|
|
33
|
+
border: none;
|
|
34
|
+
padding: 0;
|
|
35
|
+
|
|
36
|
+
${({ theme }) => css `
|
|
37
|
+
color: ${theme.red};
|
|
38
|
+
font-family: ${theme.valueBold};
|
|
39
|
+
|
|
40
|
+
&:hover,
|
|
41
|
+
:active,
|
|
42
|
+
:focus-visible {
|
|
43
|
+
&:not(:disabled) {
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
color: ${theme.redHover};
|
|
46
|
+
svg {
|
|
47
|
+
path {
|
|
48
|
+
fill: ${theme.redHover};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`};
|
|
54
|
+
|
|
55
|
+
&:disabled {
|
|
56
|
+
color: ${({ theme }) => theme?.blackLight};
|
|
57
|
+
&:hover {
|
|
58
|
+
text-decoration: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextButton } from "./text-button";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Buttons/TextButton",
|
|
6
|
+
component: TextButton,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
children: "Button Text",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
export const Decorator = ({ children, maxWidth = "100%" }) => {
|
|
4
|
+
return _jsx(Container, { maxWidth: maxWidth, children: children });
|
|
5
|
+
};
|
|
6
|
+
const Container = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
height: 100vh;
|
|
11
|
+
max-width: ${({ maxWidth }) => maxWidth};
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { INFO, ERROR, WARNING, SUCCESS } from "../../../constants/general";
|
|
3
|
+
export type AlertProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
color?: string;
|
|
9
|
+
dismissable?: boolean;
|
|
10
|
+
severity?: typeof INFO | typeof WARNING | typeof ERROR | typeof SUCCESS;
|
|
11
|
+
};
|
|
12
|
+
export type StyledAlertprops = {
|
|
13
|
+
color?: string;
|
|
14
|
+
severity?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const Alert: ({ children, className, severity, onClick, open, color, dismissable, }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const AlertText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { CloseIconCircle } from "../../../components/icons/close-icon/close-icon";
|
|
4
|
+
import { ExclamationMarkIcon } from "../../../components/icons/exclamation-mark-icon/exclamation-mark-icon";
|
|
5
|
+
import { WarningIcon } from "../../../components/icons/warning-icon/warning-icon";
|
|
6
|
+
import { INFO, ERROR, WARNING, SUCCESS } from "../../../constants/general";
|
|
7
|
+
import { alertTheme } from "../../../styles/mixins";
|
|
8
|
+
import { rem } from "../../../styles/units";
|
|
9
|
+
import styled from "styled-components";
|
|
10
|
+
export const Alert = ({ children, className, severity, onClick, open, color, dismissable, }) => {
|
|
11
|
+
const [show, setShow] = useState(true);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (open)
|
|
14
|
+
setShow(true);
|
|
15
|
+
}, [open]);
|
|
16
|
+
const handleClick = () => {
|
|
17
|
+
if (onClick)
|
|
18
|
+
onClick();
|
|
19
|
+
setShow(false);
|
|
20
|
+
};
|
|
21
|
+
if (show) {
|
|
22
|
+
return (_jsxs(Container, { "data-test": `alert-container${severity ? `-${severity}` : ""}`, className: className, color: color, severity: severity, children: [severity === INFO && _jsx(ExclamationMarkIcon, {}), severity === ERROR && _jsx(WarningIcon, {}), _jsx(ContentWrapper, { children: children }), dismissable && (_jsx(CloseButton, { "data-test": "alert-close-cta", onClick: handleClick, children: _jsx(StyledCloseIcon, {}) }))] }));
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
const Container = styled.div `
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
gap: ${rem(4)};
|
|
30
|
+
|
|
31
|
+
${({ severity }) => {
|
|
32
|
+
switch (severity) {
|
|
33
|
+
case ERROR:
|
|
34
|
+
return alertTheme.error;
|
|
35
|
+
case WARNING:
|
|
36
|
+
return alertTheme.warning;
|
|
37
|
+
case INFO:
|
|
38
|
+
return alertTheme.info;
|
|
39
|
+
case SUCCESS:
|
|
40
|
+
return alertTheme.success;
|
|
41
|
+
default:
|
|
42
|
+
return alertTheme.default;
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
|
|
46
|
+
background-color: ${({ color }) => color ?? ""};
|
|
47
|
+
border-radius: ${rem(4)};
|
|
48
|
+
padding: ${rem(10)} ${rem(15)};
|
|
49
|
+
`;
|
|
50
|
+
const ContentWrapper = styled.div `
|
|
51
|
+
flex: 1;
|
|
52
|
+
align-self: center;
|
|
53
|
+
`;
|
|
54
|
+
const CloseButton = styled.button `
|
|
55
|
+
align-self: flex-start;
|
|
56
|
+
border: none;
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
padding: 0 0 0 ${rem(20)};
|
|
59
|
+
`;
|
|
60
|
+
const StyledCloseIcon = styled(CloseIconCircle) `
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
`;
|
|
63
|
+
export const AlertText = styled.p `
|
|
64
|
+
font-size: ${rem(14)};
|
|
65
|
+
line-height: normal;
|
|
66
|
+
margin: 0;
|
|
67
|
+
padding: 0;
|
|
68
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from "./alert";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Feedback/Alert",
|
|
6
|
+
component: Alert,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
children: _jsx("p", { children: " Alert Content here " }),
|
|
15
|
+
dismissable: true,
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
severity: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: ["error", "warning", "info", "success"],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { COLORS } from "../../../styles/theme";
|
|
3
|
+
export const ChevronLeftIcon = ({ className, color = COLORS.blackLight, width = 16, height = 16, }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 16 16", className: className, children: _jsx("path", { fill: color, fillRule: "nonzero", d: "M6.707 8l5.293-5.293a1 1 0 1 0-1.414-1.414l-6 6a1 1 0 0 0 0 1.414l6 6a1 1 0 0 0 1.414-1.414L6.707 8z" }) }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChevronLeftIcon } from "./chevron-left-icon";
|
|
3
|
+
declare const meta: Meta<typeof ChevronLeftIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChevronLeftIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon } from "./chevron-left-icon";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Icons/ChevronLeftIcon",
|
|
6
|
+
component: ChevronLeftIcon,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {},
|
|
14
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { COLORS } from "../../../styles/theme";
|
|
3
|
+
export const ChevronRightIcon = ({ className, color = COLORS.blackLight, width = 16, height = 16, }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 16 16", className: className, children: _jsx("path", { fill: color, fillRule: "nonzero", d: "M9.293 8L4 13.293a1 1 0 1 0 1.414 1.414l6-6a1 1 0 0 0 0-1.414l-6-6A1 1 0 1 0 4 2.707L9.293 8z" }) }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChevronRightIcon } from "./chevron-right-icon";
|
|
3
|
+
declare const meta: Meta<typeof ChevronRightIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChevronRightIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon } from "./chevron-right-icon";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Icons/ChevronRightIcon",
|
|
6
|
+
component: ChevronRightIcon,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {},
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CloseIconProps = {
|
|
2
|
+
className?: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const CloseIcon: ({ className, color }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const CloseIconCircle: ({ className }: CloseIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const CloseIconCircleAlt: ({ className, color, }: {
|
|
10
|
+
className?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { COLORS } from "../../../styles/theme";
|
|
4
|
+
export const CloseIcon = ({ className = "", color = COLORS.blackLight }) => (_jsx("svg", { className: className, height: "10", viewBox: "0 0 10 10", "aria-label": "close/reset", width: "10", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "m348.612899 99.2097046.094208.0831886 3.292893 3.2921068 3.292893-3.2921068c.390525-.3905243 1.023689-.3905243 1.414214 0 .360484.360484.388213.9277148.083188 1.3200058l-.083188.094208-3.292107 3.292893 3.292107 3.292893c.390524.390525.390524 1.023689 0 1.414214-.360484.360484-.927715.388213-1.320006.083188l-.094208-.083188-3.292893-3.292107-3.292893 3.292107c-.390525.390524-1.023689.390524-1.414214 0-.360484-.360484-.388213-.927715-.083188-1.320006l.083188-.094208 3.292107-3.292893-3.292107-3.292893c-.390524-.390525-.390524-1.0236895 0-1.4142138.360484-.3604839.927715-.3882135 1.320006-.0831886z", fill: color, transform: "translate(-347 -99)" }) }));
|
|
5
|
+
export const CloseIconCircle = ({ className }) => (_jsx("svg", { height: "24", viewBox: "0 0 24 24", width: "24", xmlns: "http://www.w3.org/2000/svg", "aria-label": "Close/reset", className: className, children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("rect", { height: "23", opacity: ".296", rx: "11.5", stroke: "#333", width: "23", x: ".5", y: ".5" }), _jsx("path", { d: "m8.61289944 7.20970461.09420734.08318861 3.29289322 3.29210678 3.2928932-3.29210678c.3905243-.39052429 1.0236893-.39052429 1.4142136 0 .3604839.36048396.3882135.92771502.0831886 1.32000622l-.0831886.09420734-3.2921068 3.29289322 3.2921068 3.2928932c.3905243.3905243.3905243 1.0236893 0 1.4142136-.360484.3604839-.927715.3882135-1.3200062.0831886l-.0942074-.0831886-3.2928932-3.2921068-3.29289322 3.2921068c-.39052429.3905243-1.02368927.3905243-1.41421356 0-.36048396-.360484-.3882135-.927715-.08318861-1.3200062l.08318861-.0942074 3.29210678-3.2928932-3.29210678-3.29289322c-.39052429-.39052429-.39052429-1.02368927 0-1.41421356.36048396-.36048396.92771502-.3882135 1.32000622-.08318861z", fill: "#333", fillRule: "nonzero" })] }) }));
|
|
6
|
+
export const CloseIconCircleAlt = ({ className = "", color = COLORS.blackLight, }) => {
|
|
7
|
+
return (_jsx(SVG, { className: className, width: 24, height: 24, xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M12 0c3.205 0 6.219 1.248 8.485 3.515A11.921 11.921 0 0 1 24 12c0 3.205-1.248 6.219-3.515 8.485A11.921 11.921 0 0 1 12 24a11.921 11.921 0 0 1-8.485-3.515A11.921 11.921 0 0 1 0 12c0-3.205 1.248-6.219 3.515-8.485A11.922 11.922 0 0 1 12 0Zm0 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2ZM8.707 7.293 12 10.585l3.293-3.292a1 1 0 0 1 1.414 1.414L13.415 12l3.292 3.293a1 1 0 0 1-1.414 1.414L12 13.415l-3.293 3.292a1 1 0 0 1-1.414-1.414L10.585 12 7.293 8.707a1 1 0 1 1 1.414-1.414Z", fill: color, fillRule: "nonzero" }) }));
|
|
8
|
+
};
|
|
9
|
+
const SVG = styled.svg ``;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CloseIcon } from "./close-icon";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Icons/CloseIcon",
|
|
6
|
+
component: CloseIcon,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
color: "#333",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { COLORS } from "../../../styles/theme";
|
|
3
|
+
export const ExclamationMarkIcon = ({ color = COLORS.blueNavy }) => (_jsx("svg", { width: "32px", height: "32px", viewBox: "0 0 32 32", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: _jsx("g", { stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: _jsx("g", { transform: "translate(-912.000000, -824.000000)", children: _jsx("g", { transform: "translate(904.000000, 819.000000)", children: _jsxs("g", { transform: "translate(8.000000, 5.000000)", children: [_jsx("rect", { fill: "#838383", opacity: "0", x: "0", y: "0", width: "32", height: "32" }), _jsx("path", { d: "M16,4 C19.2053125,4 22.2187656,5.24823438 24.4852656,7.51473437 C26.7517656,9.7811875 28,12.7946875 28,16 C28,19.2053125 26.7517656,22.2187656 24.4852656,24.4852656 C22.2187656,26.7517656 19.2053125,28 16,28 C12.7946875,28 9.7811875,26.7517656 7.51473437,24.4852656 C5.24823438,22.2187656 4,19.2053125 4,16 C4,12.7946875 5.24823437,9.7811875 7.51473437,7.51473437 C9.78123438,5.24828125 12.7946875,4 16,4 Z M16,6 C10.4860135,6 6,10.4860135 6,16 C6,21.5139865 10.4860135,26 16,26 C21.5139865,26 26,21.5139865 26,16 C26,10.4860135 21.5139865,6 16,6 Z M16.000243,20 C16.5527003,20 17,20.4477177 17,20.9999089 C17,21.5521001 16.5527003,22 16.000243,22 C15.4482717,22 15,21.5521001 15,20.9999089 C15,20.4477177 15.4482717,20 16.000243,20 Z M16,9 C16.5522847,9 17,9.44771525 17,10 L17,18 C17,18.5522847 16.5522847,19 16,19 C15.4477153,19 15,18.5522847 15,18 L15,10 C15,9.44771525 15.4477153,9 16,9 Z", fill: color, fillRule: "nonzero" })] }) }) }) }) }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ExclamationMarkIcon } from "./exclamation-mark-icon";
|
|
3
|
+
declare const meta: Meta<typeof ExclamationMarkIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ExclamationMarkIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ExclamationMarkIcon } from "./exclamation-mark-icon";
|
|
3
|
+
import { Decorator } from "../../../components/decorator/decorator";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Icons/ExclamationMarkIcon",
|
|
6
|
+
component: ExclamationMarkIcon,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
color: "#333",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type LoadingSpinnerSizes = "s" | "m" | "l";
|
|
2
|
+
export type LoadingSpinnerProps = {
|
|
3
|
+
color?: string;
|
|
4
|
+
size?: LoadingSpinnerSizes;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export type StyledLoadingSpinnerProps = {
|
|
8
|
+
size: LoadingSpinnerSizes;
|
|
9
|
+
width: {
|
|
10
|
+
s: string;
|
|
11
|
+
m: string;
|
|
12
|
+
l: string;
|
|
13
|
+
};
|
|
14
|
+
padding: {
|
|
15
|
+
s: string;
|
|
16
|
+
m: string;
|
|
17
|
+
l: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const LoadingSpinner: ({ color, className, size, }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
|