@indico-data/design-system 2.45.6 → 2.47.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/lib/components/badge/Badge.d.ts +2 -0
- package/lib/components/badge/Badge.stories.d.ts +7 -0
- package/lib/components/badge/__tests__/Badge.test.d.ts +1 -0
- package/lib/components/badge/index.d.ts +1 -0
- package/lib/components/badge/types.d.ts +7 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/menu/Menu.d.ts +2 -1
- package/lib/components/modal/Modal.d.ts +2 -0
- package/lib/components/modal/Modal.stories.d.ts +7 -0
- package/lib/components/modal/__tests__/Modal.test.d.ts +1 -0
- package/lib/components/modal/index.d.ts +1 -0
- package/lib/components/modal/types.d.ts +15 -0
- package/lib/index.css +142 -0
- package/lib/index.d.ts +39 -49
- package/lib/index.esm.css +142 -0
- package/lib/index.esm.js +11224 -11378
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +11223 -11377
- package/lib/index.js.map +1 -1
- package/lib/legacy/components/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/components/badge/Badge.mdx +36 -0
- package/src/components/badge/Badge.stories.tsx +109 -0
- package/src/components/badge/Badge.tsx +18 -0
- package/src/components/badge/__tests__/Badge.test.tsx +17 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/badge/styles/Badge.scss +61 -0
- package/src/components/badge/types.ts +8 -0
- package/src/components/card/Card.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/components/menu/Menu.tsx +3 -2
- package/src/components/modal/Modal.mdx +111 -0
- package/src/components/modal/Modal.stories.tsx +275 -0
- package/src/components/modal/Modal.tsx +61 -0
- package/src/components/modal/__tests__/Modal.test.tsx +60 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/modal/styles/Modal.scss +100 -0
- package/src/components/modal/types.ts +15 -0
- package/src/index.ts +3 -9
- package/src/legacy/components/index.ts +0 -1
- package/src/setup/setupIcons.ts +2 -0
- package/src/styles/index.scss +2 -0
- package/lib/legacy/components/modals/ConfirmModal/ConfirmModal.d.ts +0 -17
- package/lib/legacy/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +0 -44
- package/lib/legacy/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +0 -1
- package/lib/legacy/components/modals/ConfirmModal/index.d.ts +0 -1
- package/lib/legacy/components/modals/ModalBase/ModalBase.d.ts +0 -26
- package/lib/legacy/components/modals/ModalBase/ModalBase.stories.d.ts +0 -9
- package/lib/legacy/components/modals/ModalBase/ModalBase.styles.d.ts +0 -4
- package/lib/legacy/components/modals/ModalBase/index.d.ts +0 -2
- package/lib/legacy/components/modals/index.d.ts +0 -2
- package/src/legacy/components/modals/ConfirmModal/ConfirmModal.stories.tsx +0 -76
- package/src/legacy/components/modals/ConfirmModal/ConfirmModal.styles.ts +0 -27
- package/src/legacy/components/modals/ConfirmModal/ConfirmModal.tsx +0 -79
- package/src/legacy/components/modals/ConfirmModal/index.ts +0 -1
- package/src/legacy/components/modals/ModalBase/ModalBase.stories.tsx +0 -45
- package/src/legacy/components/modals/ModalBase/ModalBase.styles.tsx +0 -72
- package/src/legacy/components/modals/ModalBase/ModalBase.tsx +0 -79
- package/src/legacy/components/modals/ModalBase/index.ts +0 -2
- package/src/legacy/components/modals/index.ts +0 -2
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactModal from 'react-modal';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
|
|
5
|
-
// see: https://github.com/reactjs/react-modal/issues/603
|
|
6
|
-
function ModalAdapter(props: any): React.ReactElement {
|
|
7
|
-
const { className } = props;
|
|
8
|
-
const contentClassName = `${className}__content`;
|
|
9
|
-
const overlayClassName = `${className}__overlay`;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<ReactModal
|
|
13
|
-
{...props}
|
|
14
|
-
portalClassName={className}
|
|
15
|
-
className={contentClassName}
|
|
16
|
-
overlayClassName={overlayClassName}
|
|
17
|
-
closeTimeoutMS={120}
|
|
18
|
-
appElement={document.getElementById(props.node || 'root')}
|
|
19
|
-
>
|
|
20
|
-
<div className="modal-content">{props.children}</div>
|
|
21
|
-
</ReactModal>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const StyledModalBase = styled(ModalAdapter)`
|
|
26
|
-
.modal-content {
|
|
27
|
-
background-color: var(--pf-primary-color-600);
|
|
28
|
-
padding: var(--pf-padding-4);
|
|
29
|
-
border-radius: var(--pf-rounded-lg);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.${(props) => props.className}__content {
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 70px;
|
|
35
|
-
left: 50%;
|
|
36
|
-
transform: translateX(-50%);
|
|
37
|
-
|
|
38
|
-
overflow: visible;
|
|
39
|
-
padding: 0;
|
|
40
|
-
|
|
41
|
-
border-radius: 4px;
|
|
42
|
-
outline: none;
|
|
43
|
-
|
|
44
|
-
width: ${(props) => (props.maxWidth ? '100%' : 'auto')};
|
|
45
|
-
max-width: ${(props) => props.maxWidth || 'none'};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.${(props) => props.className}__overlay {
|
|
49
|
-
z-index: 900;
|
|
50
|
-
position: absolute;
|
|
51
|
-
top: 0;
|
|
52
|
-
left: 0;
|
|
53
|
-
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.ReactModal__Overlay {
|
|
59
|
-
opacity: 0;
|
|
60
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
61
|
-
transition: opacity 120ms ease-in-out;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.ReactModal__Overlay--after-open {
|
|
65
|
-
opacity: 1;
|
|
66
|
-
position: fixed;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ReactModal__Overlay--before-close {
|
|
70
|
-
opacity: 0;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// TODO: This component's migration was fast-tracked for Insights. Assess for potential refactor and documentation.
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import type { PermafrostComponent } from '../../../../types';
|
|
6
|
-
|
|
7
|
-
import { StyledModalBase } from './ModalBase.styles';
|
|
8
|
-
|
|
9
|
-
export type ModalBaseProps = PermafrostComponent & {
|
|
10
|
-
children: React.ReactNode | React.ReactNode[];
|
|
11
|
-
clickToDismiss?(): void;
|
|
12
|
-
describedBy?: string;
|
|
13
|
-
node?: string;
|
|
14
|
-
open: boolean;
|
|
15
|
-
preventEscDismiss?: boolean;
|
|
16
|
-
preventReturnFocus?: boolean;
|
|
17
|
-
maxWidth?: string;
|
|
18
|
-
} & ({ labelElement: string } | { labelText: string });
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Base modal component, powered by [react-modal](http://reactcommunity.org/react-modal/#usage)
|
|
22
|
-
*
|
|
23
|
-
* (Also see `ModalAdapter` in the styles file)
|
|
24
|
-
*
|
|
25
|
-
* Accessible element label must be included either as a string passed to `labelText`, or
|
|
26
|
-
* the id of one of the children passed to `labelElement`. If a description is available,
|
|
27
|
-
* pass that element’s id to the `describedBy` prop.
|
|
28
|
-
*/
|
|
29
|
-
export function ModalBase(props: ModalBaseProps) {
|
|
30
|
-
const {
|
|
31
|
-
children,
|
|
32
|
-
className,
|
|
33
|
-
clickToDismiss,
|
|
34
|
-
describedBy,
|
|
35
|
-
id,
|
|
36
|
-
node,
|
|
37
|
-
open,
|
|
38
|
-
preventEscDismiss,
|
|
39
|
-
preventReturnFocus,
|
|
40
|
-
maxWidth,
|
|
41
|
-
} = props;
|
|
42
|
-
|
|
43
|
-
const ariaProps = {} as { labelledby?: string; describedby?: string };
|
|
44
|
-
|
|
45
|
-
if ('labelElement' in props) {
|
|
46
|
-
ariaProps['labelledby'] = props.labelElement;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (describedBy) {
|
|
50
|
-
ariaProps['describedby'] = describedBy;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Try to render modal within the theme-root, otherwise attach to the root
|
|
54
|
-
const parentSelector = () => {
|
|
55
|
-
const themeRoot = document.getElementById('theme-root');
|
|
56
|
-
const root = document.getElementById('root');
|
|
57
|
-
return themeRoot || root || document.body;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<StyledModalBase
|
|
62
|
-
ariaHideApp={false}
|
|
63
|
-
data-cy={props['data-cy']}
|
|
64
|
-
aria={ariaProps}
|
|
65
|
-
className={className || 'baseModal'}
|
|
66
|
-
contentLabel={'labelText' in props ? props.labelText : null}
|
|
67
|
-
id={id}
|
|
68
|
-
isOpen={open}
|
|
69
|
-
node={node}
|
|
70
|
-
onRequestClose={clickToDismiss}
|
|
71
|
-
parentSelector={parentSelector}
|
|
72
|
-
shouldCloseOnEsc={!preventEscDismiss}
|
|
73
|
-
shouldReturnFocusAfterClose={!preventReturnFocus}
|
|
74
|
-
maxWidth={maxWidth}
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</StyledModalBase>
|
|
78
|
-
);
|
|
79
|
-
}
|