@indico-data/design-system 1.0.47 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +5 -0
  2. package/jest.config.js +15 -0
  3. package/lib/components/Accordion/Accordion.d.ts +1 -1
  4. package/lib/components/Accordion/Accordion.stories.d.ts +2 -2
  5. package/lib/components/Accordion/Accordion.styles.d.ts +1 -1
  6. package/lib/components/Icon/Icon.stories.d.ts +3 -4
  7. package/lib/components/Icon/indicons.d.ts +143 -125
  8. package/lib/components/Icon/storyHelpers.d.ts +3 -3
  9. package/lib/components/ListTable/Header/Header.d.ts +1 -1
  10. package/lib/components/ListTable/Header/Header.styles.d.ts +1 -1
  11. package/lib/components/ListTable/ListTable.d.ts +1 -1
  12. package/lib/components/ListTable/ListTable.stories.d.ts +1 -1
  13. package/lib/components/ListTable/ListTable.styles.d.ts +1 -1
  14. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.d.ts +15 -0
  15. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +22 -0
  16. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +544 -0
  17. package/lib/components/LoadingAwareContainer/index.d.ts +1 -0
  18. package/lib/components/Navigation/Drawer/Drawer.d.ts +15 -0
  19. package/lib/components/Navigation/Drawer/Drawer.stories.d.ts +6 -0
  20. package/lib/components/Navigation/Drawer/Drawer.styles.d.ts +7 -0
  21. package/lib/components/Navigation/Drawer/DrawerLinkList.d.ts +9 -0
  22. package/lib/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +273 -0
  23. package/lib/components/Navigation/Drawer/__mocks__/mocks.d.ts +3 -0
  24. package/lib/components/Navigation/Drawer/__tests__/Drawer.test.d.ts +1 -0
  25. package/lib/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +1 -0
  26. package/lib/components/Navigation/Drawer/constants.d.ts +3 -0
  27. package/lib/components/Navigation/Drawer/index.d.ts +1 -0
  28. package/lib/components/Navigation/Drawer/types.d.ts +7 -0
  29. package/lib/components/Navigation/index.d.ts +1 -0
  30. package/lib/components/Pagination/Pagination.d.ts +1 -2
  31. package/lib/components/Pagination/Pagination.styles.d.ts +1 -1
  32. package/lib/components/Wizard/Wizard.d.ts +48 -0
  33. package/lib/components/Wizard/Wizard.stories.d.ts +29 -0
  34. package/lib/components/Wizard/Wizard.styles.d.ts +815 -0
  35. package/lib/components/Wizard/index.d.ts +2 -0
  36. package/lib/components/WizardWithSidebar/WizardWithSidebar.d.ts +58 -0
  37. package/lib/components/WizardWithSidebar/WizardWithSidebar.stories.d.ts +46 -0
  38. package/lib/components/WizardWithSidebar/WizardWithSidebar.styles.d.ts +9 -0
  39. package/lib/components/WizardWithSidebar/index.d.ts +2 -0
  40. package/lib/components/basic-section/Section/Section.d.ts +1 -1
  41. package/lib/components/basic-section/Section/Section.stories.d.ts +1 -1
  42. package/lib/components/basic-section/Section/Section.styles.d.ts +1 -1
  43. package/lib/components/basic-section/SectionBlock/SectionBlock.d.ts +1 -1
  44. package/lib/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -1
  45. package/lib/components/basic-section/SectionBody/SectionBody.d.ts +1 -1
  46. package/lib/components/basic-section/SectionBody/SectionBody.stories.d.ts +1 -2
  47. package/lib/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -1
  48. package/lib/components/basic-section/SectionHeader/SectionHeader.d.ts +1 -1
  49. package/lib/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  50. package/lib/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -1
  51. package/lib/components/basic-section/SectionTable/SectionTable.d.ts +1 -2
  52. package/lib/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -1
  53. package/lib/components/buttons/Button/Button.styles.d.ts +1 -1
  54. package/lib/components/buttons/IconButton/IconButton.d.ts +4 -5
  55. package/lib/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  56. package/lib/components/buttons/IconButton/IconButton.styles.d.ts +5 -5
  57. package/lib/components/buttons/types.d.ts +2 -1
  58. package/lib/components/dropdowns/BorderSelect/BorderSelect.d.ts +1 -1
  59. package/lib/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +1 -1
  60. package/lib/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -2
  61. package/lib/components/dropdowns/Select/Select.d.ts +1 -1
  62. package/lib/components/dropdowns/Select/Select.stories.d.ts +1 -1
  63. package/lib/components/dropdowns/Select/Select.styles.d.ts +1 -1
  64. package/lib/components/dropdowns/utils.d.ts +1 -2
  65. package/lib/components/index.d.ts +6 -1
  66. package/lib/components/inputs/EditableInput/EditableInput.d.ts +1 -1
  67. package/lib/components/inputs/EditableInput/EditableInput.stories.d.ts +1 -2
  68. package/lib/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -1
  69. package/lib/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -1
  70. package/lib/components/inputs/SearchInput/SearchInput.d.ts +1 -1
  71. package/lib/components/inputs/SearchInput/SearchInput.stories.d.ts +1 -1
  72. package/lib/components/inputs/SearchInput/SearchInput.styles.d.ts +272 -5
  73. package/lib/components/inputs/TextInput/TextInput.styles.d.ts +2 -2
  74. package/lib/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -1
  75. package/lib/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +3 -3
  76. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.d.ts +10 -0
  77. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.d.ts +11 -0
  78. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +8 -0
  79. package/lib/components/loading-indicators/LoadingIndicator/index.d.ts +1 -0
  80. package/lib/components/loading-indicators/LoadingList/LoadingList.d.ts +1 -2
  81. package/lib/components/loading-indicators/LoadingList/LoadingList.stories.d.ts +1 -2
  82. package/lib/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -1
  83. package/lib/components/loading-indicators/PercentageRing/PercentageRing.d.ts +1 -2
  84. package/lib/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -1
  85. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.d.ts +1 -2
  86. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.stories.d.ts +1 -2
  87. package/lib/components/loading-indicators/index.d.ts +1 -0
  88. package/lib/components/modals/ConfirmModal/ConfirmModal.d.ts +17 -0
  89. package/lib/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +44 -0
  90. package/lib/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +273 -0
  91. package/lib/components/modals/ConfirmModal/index.d.ts +1 -0
  92. package/lib/components/modals/ModalBase/ModalBase.d.ts +27 -0
  93. package/lib/components/modals/ModalBase/ModalBase.stories.d.ts +9 -0
  94. package/lib/components/modals/ModalBase/ModalBase.styles.d.ts +6 -0
  95. package/lib/components/modals/ModalBase/index.d.ts +2 -0
  96. package/lib/components/modals/index.d.ts +2 -0
  97. package/lib/components/user-feedback/Shrug/Shrug.stories.d.ts +1 -1
  98. package/lib/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -1
  99. package/lib/index.d.ts +1293 -270
  100. package/lib/index.esm.js +4082 -622
  101. package/lib/index.esm.js.map +1 -1
  102. package/lib/index.js +4131 -661
  103. package/lib/index.js.map +1 -1
  104. package/lib/setupTests.d.ts +1 -0
  105. package/lib/styles/globals/index.d.ts +1 -2
  106. package/lib/tokens/colors.d.ts +7 -0
  107. package/lib/tokens/typography.d.ts +12 -0
  108. package/lib/types.d.ts +147 -125
  109. package/package.json +18 -3
  110. package/src/components/Icon/Icon.tsx +1 -0
  111. package/src/components/Icon/indicons.tsx +138 -15
  112. package/src/components/ListTable/ListTable.stories.tsx +1 -1
  113. package/src/components/LoadingAwareContainer/LoadingAwareContainer.stories.tsx +45 -0
  114. package/src/components/LoadingAwareContainer/LoadingAwareContainer.styles.ts +16 -0
  115. package/src/components/LoadingAwareContainer/LoadingAwareContainer.tsx +36 -0
  116. package/src/components/LoadingAwareContainer/index.ts +1 -0
  117. package/src/components/Navigation/Drawer/Drawer.stories.tsx +44 -0
  118. package/src/components/Navigation/Drawer/Drawer.styles.ts +75 -0
  119. package/src/components/Navigation/Drawer/Drawer.tsx +108 -0
  120. package/src/components/Navigation/Drawer/DrawerLinkList.styles.ts +66 -0
  121. package/src/components/Navigation/Drawer/DrawerLinkList.tsx +64 -0
  122. package/src/components/Navigation/Drawer/__mocks__/mocks.ts +49 -0
  123. package/src/components/Navigation/Drawer/__tests__/Drawer.test.tsx +175 -0
  124. package/src/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +66 -0
  125. package/src/components/Navigation/Drawer/index.ts +1 -0
  126. package/src/components/Navigation/Drawer/types.ts +8 -0
  127. package/src/components/Navigation/index.ts +1 -0
  128. package/src/components/Wizard/Wizard.stories.tsx +180 -0
  129. package/src/components/Wizard/Wizard.styles.ts +72 -0
  130. package/src/components/Wizard/Wizard.tsx +212 -0
  131. package/src/components/Wizard/index.ts +2 -0
  132. package/src/components/WizardWithSidebar/WizardWithSidebar.stories.tsx +143 -0
  133. package/src/components/WizardWithSidebar/WizardWithSidebar.styles.ts +123 -0
  134. package/src/components/WizardWithSidebar/WizardWithSidebar.tsx +261 -0
  135. package/src/components/WizardWithSidebar/index.ts +2 -0
  136. package/src/components/buttons/IconButton/IconButton.styles.ts +31 -0
  137. package/src/components/buttons/IconButton/IconButton.tsx +8 -6
  138. package/src/components/buttons/types.ts +2 -1
  139. package/src/components/index.ts +6 -0
  140. package/src/components/inputs/SearchInput/SearchInput.styles.ts +27 -41
  141. package/src/components/inputs/SearchInput/SearchInput.tsx +6 -4
  142. package/src/components/loading-indicators/CirclePulse/CirclePulse.styles.ts +7 -7
  143. package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +3 -3
  144. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.tsx +23 -0
  145. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.ts +81 -0
  146. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.tsx +61 -0
  147. package/src/components/loading-indicators/LoadingIndicator/index.ts +1 -0
  148. package/src/components/loading-indicators/index.ts +1 -0
  149. package/src/components/modals/ConfirmModal/ConfirmModal.stories.tsx +76 -0
  150. package/src/components/modals/ConfirmModal/ConfirmModal.styles.ts +30 -0
  151. package/src/components/modals/ConfirmModal/ConfirmModal.tsx +84 -0
  152. package/src/components/modals/ConfirmModal/index.ts +1 -0
  153. package/src/components/modals/ModalBase/ModalBase.stories.tsx +47 -0
  154. package/src/components/modals/ModalBase/ModalBase.styles.tsx +73 -0
  155. package/src/components/modals/ModalBase/ModalBase.tsx +72 -0
  156. package/src/components/modals/ModalBase/index.ts +2 -0
  157. package/src/components/modals/index.ts +2 -0
  158. package/src/index.ts +9 -0
  159. package/src/setupTests.ts +4 -0
  160. package/src/tokens/colors.ts +7 -0
  161. package/src/tokens/typography.ts +7 -1
  162. package/src/types.ts +8 -0
  163. package/tsconfig.json +1 -1
@@ -0,0 +1,61 @@
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 { RandomLoadingMessage } from '@/components';
6
+ import { PermafrostComponent } from '@/types';
7
+ import { COLORS } from '@/tokens';
8
+
9
+ import { StyledLoadingIndicator, StyledMessageLoadingIndicator } from './LoadingIndicator.styles';
10
+
11
+ type Props = PermafrostComponent & {
12
+ color?: string;
13
+ overallSize?: string | number;
14
+ rippleSize?: string | number;
15
+ showRandomMessage?: boolean;
16
+ };
17
+
18
+ export function LoadingIndicator(props: Props): React.ReactElement {
19
+ const {
20
+ className,
21
+ color,
22
+ id,
23
+ overallSize = '200px',
24
+ rippleSize = '76px',
25
+ showRandomMessage,
26
+ } = props;
27
+
28
+ const loadingIndicator = () => {
29
+ return (
30
+ <StyledLoadingIndicator
31
+ aria-hidden={true}
32
+ className={className}
33
+ data-cy={props['data-cy']}
34
+ id={id}
35
+ overallsize={returnSizeString(overallSize)}
36
+ ripplesize={returnSizeString(rippleSize)}
37
+ style={color ? { color } : { color: COLORS.curiousBlue }}
38
+ />
39
+ );
40
+ };
41
+
42
+ if (showRandomMessage) {
43
+ return (
44
+ <StyledMessageLoadingIndicator overallsize={returnSizeString(overallSize)}>
45
+ {loadingIndicator()}
46
+
47
+ <RandomLoadingMessage />
48
+ </StyledMessageLoadingIndicator>
49
+ );
50
+ }
51
+
52
+ return loadingIndicator();
53
+ }
54
+
55
+ function returnSizeString(size: string | number): string {
56
+ if (typeof size === 'number') {
57
+ return `${size}px`;
58
+ }
59
+
60
+ return size;
61
+ }
@@ -0,0 +1 @@
1
+ export { LoadingIndicator } from './LoadingIndicator';
@@ -4,3 +4,4 @@ export { CirclePulse } from './CirclePulse';
4
4
  export { RandomLoadingMessage } from './RandomLoadingMessage';
5
5
  export { PercentageRing } from './PercentageRing';
6
6
  export { LoadingList } from './LoadingList';
7
+ export { LoadingIndicator } from './LoadingIndicator';
@@ -0,0 +1,76 @@
1
+ import React, { useState } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { ConfirmModal } from './ConfirmModal';
5
+
6
+ const meta = {
7
+ component: ConfirmModal,
8
+ title: 'Modals/ConfirmModal',
9
+ args: {
10
+ title: 'Im sorry, Dave. Im afraid I cant do that.',
11
+ message: 'This mission is too important for me to allow you to jeopardize it.',
12
+ confirmText: 'I dont know what youre talking about, Hal.',
13
+ rejectText: 'I dont know what youre talking about, Hal.',
14
+ },
15
+ argTypes: {
16
+ open: { control: { disable: true } },
17
+ className: { control: { disable: true } },
18
+ describedBy: { control: { disable: true } },
19
+ modalNode: { control: { disable: true } },
20
+ width: { control: { disable: true } },
21
+ },
22
+ } satisfies Meta<typeof ConfirmModal>;
23
+
24
+ export default meta;
25
+ type Story = StoryObj<typeof ConfirmModal>;
26
+
27
+ function StoryRender(props: any) {
28
+ const [isOpen, setIsOpen] = useState<boolean>(props.open);
29
+
30
+ const handleOpen = () => {
31
+ setIsOpen(true);
32
+ };
33
+
34
+ const handleClose = () => {
35
+ setIsOpen(false);
36
+ };
37
+
38
+ return (
39
+ <>
40
+ <button type="button" onClick={handleOpen}>
41
+ Open the pod bay doors, HAL.
42
+ </button>
43
+
44
+ <ConfirmModal {...props} open={isOpen} responseHandler={handleClose} />
45
+ </>
46
+ );
47
+ }
48
+
49
+ export const Base: Story = {
50
+ args: {
51
+ processing: false,
52
+ },
53
+ render: (args) => {
54
+ return <StoryRender {...args} />;
55
+ },
56
+ };
57
+
58
+ export const Open: Story = {
59
+ args: {
60
+ open: true,
61
+ processing: false,
62
+ },
63
+ render: (args) => {
64
+ return <StoryRender {...args} />;
65
+ },
66
+ };
67
+
68
+ export const processing: Story = {
69
+ args: {
70
+ open: true,
71
+ processing: true,
72
+ },
73
+ render: (args) => {
74
+ return <StoryRender {...args} />;
75
+ },
76
+ };
@@ -0,0 +1,30 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { COLORS, TYPOGRAPHY } from '@/tokens';
4
+
5
+ export const StyledConfirmModal = styled.div`
6
+ padding: 20px;
7
+
8
+ .title {
9
+ margin: 30px 16px;
10
+ font-size: ${TYPOGRAPHY.fontSize.display};
11
+ text-align: center;
12
+ color: ${COLORS.lightFontColor};
13
+ }
14
+
15
+ .message {
16
+ text-align: center;
17
+ padding-bottom: 16px;
18
+ }
19
+
20
+ .actions {
21
+ text-align: center;
22
+ padding-bottom: 40px;
23
+
24
+ button {
25
+ min-width: 300px;
26
+ display: block;
27
+ margin: 16px auto 0;
28
+ }
29
+ }
30
+ `;
@@ -0,0 +1,84 @@
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 { v4 as uuid } from 'uuid';
6
+
7
+ import { Button, LoadingAwareContainer, ModalBase } from '@/components';
8
+ import { ModalBaseProps } from '../ModalBase';
9
+ import { PermafrostComponent } from '@/types';
10
+
11
+ import { StyledConfirmModal } from './ConfirmModal.styles';
12
+
13
+ type Props = PermafrostComponent &
14
+ Pick<ModalBaseProps, 'open'> & {
15
+ describedBy?: string;
16
+ clickOutsideHandler(e?: React.SyntheticEvent): void;
17
+ confirmText?: string;
18
+ message?: string | React.ReactNode;
19
+ modalNode?: string;
20
+ processing?: boolean;
21
+ rejectText?: string;
22
+ responseHandler(response: boolean, event: React.SyntheticEvent): void;
23
+ title?: string | React.ReactNode;
24
+ width?: number;
25
+ };
26
+
27
+ export function ConfirmModal(props: Props) {
28
+ const id = uuid();
29
+ const {
30
+ className,
31
+ clickOutsideHandler,
32
+ confirmText,
33
+ describedBy,
34
+ message,
35
+ modalNode,
36
+ open,
37
+ processing,
38
+ rejectText,
39
+ responseHandler,
40
+ title,
41
+ width,
42
+ } = props;
43
+
44
+ return (
45
+ <ModalBase
46
+ className={className}
47
+ clickToDismiss={clickOutsideHandler}
48
+ data-cy={props['data-cy']}
49
+ describedBy={describedBy}
50
+ id={props.id}
51
+ labelElement={id}
52
+ node={modalNode}
53
+ open={open}
54
+ >
55
+ <StyledConfirmModal style={{ width: width || 555 }}>
56
+ {title && (
57
+ <div id={id} className="title">
58
+ {title || 'Please confirm'}
59
+ </div>
60
+ )}
61
+
62
+ {message && <div className="message">{message}</div>}
63
+
64
+ <LoadingAwareContainer isLoading={processing} className="actions">
65
+ <Button
66
+ variant="cta"
67
+ className="confirm"
68
+ onClick={(event) => responseHandler(true, event)}
69
+ >
70
+ {confirmText || 'Yes'}
71
+ </Button>
72
+
73
+ <Button
74
+ variant="normal"
75
+ className="reject"
76
+ onClick={(event) => responseHandler(false, event)}
77
+ >
78
+ {rejectText || 'No'}
79
+ </Button>
80
+ </LoadingAwareContainer>
81
+ </StyledConfirmModal>
82
+ </ModalBase>
83
+ );
84
+ }
@@ -0,0 +1 @@
1
+ export { ConfirmModal } from './ConfirmModal';
@@ -0,0 +1,47 @@
1
+ import React, { useState } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { ModalBase } from './ModalBase';
5
+
6
+ const meta = {
7
+ component: ModalBase,
8
+ title: 'Modals/ModalBase',
9
+ } satisfies Meta<typeof ModalBase>;
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof ModalBase>;
13
+
14
+ function StoryRender(props: any) {
15
+ const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);
16
+
17
+ const handleOpen = () => {
18
+ setIsOpen(true);
19
+ };
20
+
21
+ const handleClose = () => {
22
+ setIsOpen(false);
23
+ };
24
+
25
+ return (
26
+ <>
27
+ <button type="button" onClick={handleOpen}>
28
+ open modal
29
+ </button>
30
+
31
+ <ModalBase {...props} open={isOpen} clickToDismiss={handleClose}>
32
+ <p>
33
+ There is nothing to this modal at all. It is completely up to you to style its contents.
34
+ </p>
35
+ </ModalBase>
36
+ </>
37
+ );
38
+ }
39
+
40
+ export const Base: Story = {
41
+ args: {
42
+ labelText: 'my modal',
43
+ },
44
+ render: (args) => {
45
+ return <StoryRender {...args} />;
46
+ },
47
+ };
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import ReactModal from 'react-modal';
3
+ import styled from 'styled-components';
4
+
5
+ import { COLORS } from '@/tokens';
6
+ import { colorUtils } from '@indico-data/utils';
7
+
8
+ // see: https://github.com/reactjs/react-modal/issues/603
9
+ function ModalAdapter(props: any): React.ReactElement {
10
+ const { className } = props;
11
+ const contentClassName = `${className}__content`;
12
+ const overlayClassName = `${className}__overlay`;
13
+
14
+ return (
15
+ <ReactModal
16
+ {...props}
17
+ portalClassName={className}
18
+ className={contentClassName}
19
+ overlayClassName={overlayClassName}
20
+ closeTimeoutMS={120}
21
+ appElement={document.getElementById(props.node || 'root')}
22
+ >
23
+ {props.children}
24
+ </ReactModal>
25
+ );
26
+ }
27
+
28
+ export const StyledModalBase = styled(ModalAdapter)`
29
+ .${(props) => props.className}__content {
30
+ position: absolute;
31
+ top: 70px;
32
+ left: 50%;
33
+ transform: translateX(-50%);
34
+
35
+ overflow: visible;
36
+ padding: 0;
37
+
38
+ border-radius: 4px;
39
+ background-color: ${COLORS.clay};
40
+ border: solid 1px ${COLORS.oxfordBlue};
41
+ outline: none;
42
+
43
+ width: ${(props) => (props.maxWidth ? '100%' : 'auto')};
44
+ max-width: ${(props) => props.maxWidth || 'none'};
45
+ }
46
+
47
+ .${(props) => props.className}__overlay {
48
+ z-index: 900;
49
+ position: absolute;
50
+ top: 0;
51
+ left: 0;
52
+
53
+ width: 100%;
54
+ height: 100%;
55
+
56
+ background-color: ${colorUtils.hexToRgb(COLORS.mirage, 0.95)};
57
+ }
58
+
59
+ .ReactModal__Overlay {
60
+ opacity: 0;
61
+
62
+ transition: opacity 120ms ease-in-out;
63
+ }
64
+
65
+ .ReactModal__Overlay--after-open {
66
+ opacity: 1;
67
+ position: fixed;
68
+ }
69
+
70
+ .ReactModal__Overlay--before-close {
71
+ opacity: 0;
72
+ }
73
+ `;
@@ -0,0 +1,72 @@
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 { 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
+ /** a selector representing the desired parent; defaults to `#root` */
14
+ node?: string;
15
+ open: boolean;
16
+ preventEscDismiss?: boolean;
17
+ preventReturnFocus?: boolean;
18
+ maxWidth?: string;
19
+ } & ({ labelElement: string } | { labelText: string });
20
+
21
+ /**
22
+ * Base modal component, powered by [react-modal](http://reactcommunity.org/react-modal/#usage)
23
+ *
24
+ * (Also see `ModalAdapter` in the styles file)
25
+ *
26
+ * Accessible element label must be included either as a string passed to `labelText`, or
27
+ * the id of one of the children passed to `labelElement`. If a description is available,
28
+ * pass that element’s id to the `describedBy` prop.
29
+ */
30
+ export function ModalBase(props: ModalBaseProps) {
31
+ const {
32
+ children,
33
+ className,
34
+ clickToDismiss,
35
+ describedBy,
36
+ id,
37
+ node,
38
+ open,
39
+ preventEscDismiss,
40
+ preventReturnFocus,
41
+ maxWidth,
42
+ } = props;
43
+
44
+ const ariaProps = {} as { labelledby?: string; describedby?: string };
45
+
46
+ if ('labelElement' in props) {
47
+ ariaProps['labelledby'] = props.labelElement;
48
+ }
49
+
50
+ if (describedBy) {
51
+ ariaProps['describedby'] = describedBy;
52
+ }
53
+
54
+ return (
55
+ <StyledModalBase
56
+ ariaHideApp={false}
57
+ data-cy={props['data-cy']}
58
+ aria={ariaProps}
59
+ className={className || 'baseModal'}
60
+ contentLabel={'labelText' in props ? props.labelText : null}
61
+ id={id}
62
+ isOpen={open}
63
+ node={node}
64
+ onRequestClose={clickToDismiss}
65
+ shouldCloseOnEsc={!preventEscDismiss}
66
+ shouldReturnFocusAfterClose={!preventReturnFocus}
67
+ maxWidth={maxWidth}
68
+ >
69
+ {children}
70
+ </StyledModalBase>
71
+ );
72
+ }
@@ -0,0 +1,2 @@
1
+ export { ModalBase } from './ModalBase';
2
+ export type { ModalBaseProps } from './ModalBase';
@@ -0,0 +1,2 @@
1
+ export { ConfirmModal } from './ConfirmModal';
2
+ export { ModalBase } from './ModalBase';
package/src/index.ts CHANGED
@@ -22,11 +22,15 @@ export {
22
22
  Button,
23
23
  CirclePulse,
24
24
  CircleSpinner,
25
+ ConfirmModal,
26
+ Drawer,
25
27
  EditableInput,
26
28
  Icon,
27
29
  IconButton,
28
30
  ListTable,
31
+ LoadingAwareContainer,
29
32
  LoadingList,
33
+ ModalBase,
30
34
  MultiCombobox,
31
35
  NumberInput,
32
36
  Pagination,
@@ -42,4 +46,9 @@ export {
42
46
  Shrug,
43
47
  SingleCombobox,
44
48
  TextInput,
49
+ Wizard,
50
+ WizardCard,
51
+ WizardSection,
52
+ StyledWizard,
53
+ WizardWithSidebar,
45
54
  } from './components';
@@ -0,0 +1,4 @@
1
+ import '@testing-library/jest-dom';
2
+ import { configure } from '@testing-library/react';
3
+
4
+ configure({ testIdAttribute: 'data-testid' });
@@ -1,5 +1,6 @@
1
1
  export const allColors = {
2
2
  akaroa: '#cbc98f',
3
+ alizarin: '#E72326',
3
4
  amber: '#f4c401',
4
5
  amethyst: '#8e57b3',
5
6
  aqua: '#10e4fe',
@@ -33,17 +34,20 @@ export const allColors = {
33
34
  crimson: '#e53126',
34
35
  curiousBlue: '#178ee0',
35
36
  cyan: '#0cf',
37
+ daisyBush: '#431B92',
36
38
  darkFontColor: '#0d151d',
37
39
  darkGray: '#333',
38
40
  darkPurple: '#6f3eae',
39
41
  darkRed: '#b30000',
40
42
  defaultFontColor: '#bbbfc5',
41
43
  dodgerBlue: '#1774ff',
44
+ dusty: '#999999',
42
45
  eagleGreen: '#005557',
43
46
  ebony: '#101a26',
44
47
  eggplant: '#7a0074',
45
48
  electricGreen: '#00ff0a',
46
49
  emerald: '#09c199',
50
+ endeavor: '#0055B9',
47
51
  espresso: '#5a3627',
48
52
  fieldPromptError: '#fd9693',
49
53
  fieldPromptInfo: '#00bfff',
@@ -55,6 +59,7 @@ export const allColors = {
55
59
  green: '#4caf50',
56
60
  harlequin: '#20cb00',
57
61
  harvestGold: '#e6c079',
62
+ hawkes: '#DCEAFD',
58
63
  hemlock: '#626740',
59
64
  imperial: '#4b0134',
60
65
  iron: '#d9dee0',
@@ -100,12 +105,14 @@ export const allColors = {
100
105
  seaGreen: '#0b8a51',
101
106
  seance: '#7f1f82',
102
107
  shiraz: '#c61021',
108
+ silverChalice: '#aaaaaa',
103
109
  sinopia: '#D14200',
104
110
  slaaneshGrey: '#dbd5e6',
105
111
  tangerine: '#ff9900',
106
112
  teal: '#008285',
107
113
  toast: '#997862',
108
114
  trueBlue: '#066CC6',
115
+ tundora: '#444444',
109
116
  turquoise: '#00b5b6',
110
117
  vermilion: '#b95555',
111
118
  viking: '#59cfe0',
@@ -28,10 +28,16 @@ export const spacing = {
28
28
  third: `${lineHeight.base / 3}em`,
29
29
  };
30
30
 
31
+ export const weight = {
32
+ light: 300,
33
+ regular: 400,
34
+ semibold: 500,
35
+ bold: 600,
36
+ };
31
37
  export const ellipsis = css`
32
38
  overflow: hidden;
33
39
  white-space: nowrap;
34
40
  text-overflow: ellipsis;
35
41
  `;
36
42
 
37
- export const typography = { fontFamily, fontSize, lineHeight, spacing, ellipsis };
43
+ export const typography = { fontFamily, fontSize, lineHeight, spacing, ellipsis, weight };
package/src/types.ts CHANGED
@@ -14,3 +14,11 @@ export type PermafrostComponent = {
14
14
  'data-cy'?: string;
15
15
  'data-testid'?: string;
16
16
  };
17
+
18
+ export type ButtonVariant = 'default' | 'primary' | 'destructive';
19
+ export type ButtonSize = 'normal' | 'large';
20
+
21
+ // Component types -- TODO -- move to their own files
22
+ import { ListItem } from './components/Navigation/Drawer/types';
23
+
24
+ export type { ListItem };
package/tsconfig.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "resolveJsonModule": true,
17
17
  "isolatedModules": true,
18
18
  "noEmit": true,
19
- "jsx": "react",
19
+ "jsx": "react-jsx",
20
20
  "baseUrl": "./",
21
21
  "paths": {
22
22
  "@/*": ["src/*"]