@indico-data/design-system 1.0.1
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/.babelrc +27 -0
- package/.eslintignore +6 -0
- package/.eslintrc.js +63 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +3 -0
- package/.prettierrc +6 -0
- package/.stackblitzrc +4 -0
- package/.storybook/indico-data-logo.svg +1 -0
- package/.storybook/main.ts +36 -0
- package/.storybook/preview-head.html +19 -0
- package/.storybook/preview.ts +24 -0
- package/.storybook/themes.js +24 -0
- package/.yarn/releases/yarn-classic.cjs +179386 -0
- package/.yarnrc.yml +1 -0
- package/README.md +30 -0
- package/package.json +79 -0
- package/src/components/Accordion/Accordion.stories.tsx +47 -0
- package/src/components/Accordion/Accordion.styles.ts +35 -0
- package/src/components/Accordion/Accordion.tsx +30 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +60 -0
- package/src/components/Icon/Icon.tsx +75 -0
- package/src/components/Icon/faIcons.tsx +168 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Icon/indicons.tsx +699 -0
- package/src/components/Icon/storyHelpers.tsx +87 -0
- package/src/components/ListTable/Header/Header.styles.ts +62 -0
- package/src/components/ListTable/Header/Header.tsx +67 -0
- package/src/components/ListTable/Header/index.ts +1 -0
- package/src/components/ListTable/ListTable.stories.tsx +301 -0
- package/src/components/ListTable/ListTable.styles.ts +76 -0
- package/src/components/ListTable/ListTable.tsx +135 -0
- package/src/components/ListTable/index.ts +1 -0
- package/src/components/ListTable/mock-data/index.ts +1 -0
- package/src/components/ListTable/mock-data/mock-data.ts +291 -0
- package/src/components/Pagination/Pagination.stories.tsx +45 -0
- package/src/components/Pagination/Pagination.styles.ts +51 -0
- package/src/components/Pagination/Pagination.tsx +118 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/basic-section/Section/Section.stories.tsx +14 -0
- package/src/components/basic-section/Section/Section.styles.ts +8 -0
- package/src/components/basic-section/Section/Section.tsx +30 -0
- package/src/components/basic-section/Section/index.ts +1 -0
- package/src/components/basic-section/SectionBlock/SectionBlock.styles.ts +15 -0
- package/src/components/basic-section/SectionBlock/SectionBlock.tsx +37 -0
- package/src/components/basic-section/SectionBlock/index.ts +1 -0
- package/src/components/basic-section/SectionBody/SectionBody.stories.tsx +16 -0
- package/src/components/basic-section/SectionBody/SectionBody.styles.ts +18 -0
- package/src/components/basic-section/SectionBody/SectionBody.tsx +30 -0
- package/src/components/basic-section/SectionBody/index.ts +1 -0
- package/src/components/basic-section/SectionHeader/SectionHeader.stories.tsx +17 -0
- package/src/components/basic-section/SectionHeader/SectionHeader.styles.ts +5 -0
- package/src/components/basic-section/SectionHeader/SectionHeader.tsx +35 -0
- package/src/components/basic-section/SectionHeader/index.ts +1 -0
- package/src/components/basic-section/SectionTable/SectionTable.styles.ts +237 -0
- package/src/components/basic-section/SectionTable/SectionTable.tsx +229 -0
- package/src/components/basic-section/SectionTable/index.ts +1 -0
- package/src/components/basic-section/index.ts +5 -0
- package/src/components/buttons/Button/Button.stories.tsx +80 -0
- package/src/components/buttons/Button/Button.styles.ts +99 -0
- package/src/components/buttons/Button/Button.tsx +74 -0
- package/src/components/buttons/Button/index.ts +1 -0
- package/src/components/buttons/IconButton/IconButton.stories.tsx +96 -0
- package/src/components/buttons/IconButton/IconButton.styles.ts +78 -0
- package/src/components/buttons/IconButton/IconButton.tsx +109 -0
- package/src/components/buttons/IconButton/index.ts +1 -0
- package/src/components/buttons/commonStyles.ts +108 -0
- package/src/components/buttons/index.ts +2 -0
- package/src/components/buttons/types.ts +2 -0
- package/src/components/dropdowns/BorderSelect/BorderSelect.stories.tsx +22 -0
- package/src/components/dropdowns/BorderSelect/BorderSelect.styles.ts +73 -0
- package/src/components/dropdowns/BorderSelect/BorderSelect.tsx +85 -0
- package/src/components/dropdowns/BorderSelect/index.ts +1 -0
- package/src/components/dropdowns/MultiCombobox/MultiCombobox.stories.tsx +146 -0
- package/src/components/dropdowns/MultiCombobox/MultiCombobox.styles.ts +89 -0
- package/src/components/dropdowns/MultiCombobox/MultiCombobox.tsx +123 -0
- package/src/components/dropdowns/MultiCombobox/index.ts +1 -0
- package/src/components/dropdowns/Select/Select.stories.tsx +54 -0
- package/src/components/dropdowns/Select/Select.styles.ts +73 -0
- package/src/components/dropdowns/Select/Select.tsx +69 -0
- package/src/components/dropdowns/Select/index.ts +1 -0
- package/src/components/dropdowns/SingleCombobox/SingleCombobox.stories.tsx +61 -0
- package/src/components/dropdowns/SingleCombobox/SingleCombobox.styles.ts +56 -0
- package/src/components/dropdowns/SingleCombobox/SingleCombobox.tsx +103 -0
- package/src/components/dropdowns/SingleCombobox/index.ts +1 -0
- package/src/components/dropdowns/commonStyles.ts +65 -0
- package/src/components/dropdowns/index.ts +4 -0
- package/src/components/dropdowns/types.ts +45 -0
- package/src/components/dropdowns/useCombobox.ts +32 -0
- package/src/components/dropdowns/utils.tsx +25 -0
- package/src/components/index.ts +9 -0
- package/src/components/inputs/EditableInput/EditableInput.stories.tsx +26 -0
- package/src/components/inputs/EditableInput/EditableInput.styles.ts +21 -0
- package/src/components/inputs/EditableInput/EditableInput.tsx +103 -0
- package/src/components/inputs/EditableInput/index.ts +1 -0
- package/src/components/inputs/NumberInput/NumberInput.stories.tsx +72 -0
- package/src/components/inputs/NumberInput/NumberInput.styles.ts +66 -0
- package/src/components/inputs/NumberInput/NumberInput.tsx +153 -0
- package/src/components/inputs/NumberInput/index.ts +1 -0
- package/src/components/inputs/SearchInput/SearchInput.stories.tsx +17 -0
- package/src/components/inputs/SearchInput/SearchInput.styles.ts +25 -0
- package/src/components/inputs/SearchInput/SearchInput.tsx +47 -0
- package/src/components/inputs/SearchInput/index.ts +1 -0
- package/src/components/inputs/TextInput/TextInput.stories.tsx +104 -0
- package/src/components/inputs/TextInput/TextInput.styles.ts +74 -0
- package/src/components/inputs/TextInput/TextInput.tsx +116 -0
- package/src/components/inputs/TextInput/index.ts +1 -0
- package/src/components/inputs/index.ts +4 -0
- package/src/components/inputs/inputsCommon.styles.ts +61 -0
- package/src/components/loading-indicators/BarSpinner/BarSpinner.stories.tsx +14 -0
- package/src/components/loading-indicators/BarSpinner/BarSpinner.styles.ts +53 -0
- package/src/components/loading-indicators/BarSpinner/BarSpinner.tsx +21 -0
- package/src/components/loading-indicators/BarSpinner/index.ts +1 -0
- package/src/components/loading-indicators/CirclePulse/CirclePulse.stories.tsx +22 -0
- package/src/components/loading-indicators/CirclePulse/CirclePulse.styles.ts +81 -0
- package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +61 -0
- package/src/components/loading-indicators/CirclePulse/index.ts +1 -0
- package/src/components/loading-indicators/CircleSpinner/CircleSpinner.stories.tsx +16 -0
- package/src/components/loading-indicators/CircleSpinner/CircleSpinner.tsx +37 -0
- package/src/components/loading-indicators/CircleSpinner/index.ts +1 -0
- package/src/components/loading-indicators/LoadingList/LoadingList.stories.tsx +14 -0
- package/src/components/loading-indicators/LoadingList/LoadingList.styles.ts +42 -0
- package/src/components/loading-indicators/LoadingList/LoadingList.tsx +9 -0
- package/src/components/loading-indicators/LoadingList/index.ts +1 -0
- package/src/components/loading-indicators/PercentageRing/PercentageRing.stories.tsx +18 -0
- package/src/components/loading-indicators/PercentageRing/PercentageRing.styles.ts +27 -0
- package/src/components/loading-indicators/PercentageRing/PercentageRing.tsx +76 -0
- package/src/components/loading-indicators/PercentageRing/index.ts +1 -0
- package/src/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.stories.tsx +16 -0
- package/src/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.tsx +18 -0
- package/src/components/loading-indicators/RandomLoadingMessage/index.ts +1 -0
- package/src/components/loading-indicators/RandomLoadingMessage/random-messages.js +67 -0
- package/src/components/loading-indicators/index.ts +6 -0
- package/src/components/user-feedback/Shrug/Shrug.stories.tsx +38 -0
- package/src/components/user-feedback/Shrug/Shrug.styles.ts +23 -0
- package/src/components/user-feedback/Shrug/Shrug.tsx +44 -0
- package/src/components/user-feedback/Shrug/index.ts +1 -0
- package/src/components/user-feedback/index.ts +1 -0
- package/src/index.tsx +18 -0
- package/src/styles/globals/buttons.ts +154 -0
- package/src/styles/globals/forms.ts +103 -0
- package/src/styles/globals/index.tsx +25 -0
- package/src/styles/globals/layout.ts +25 -0
- package/src/styles/globals/lists.ts +23 -0
- package/src/styles/globals/margin-padding.ts +33 -0
- package/src/styles/globals/media.ts +13 -0
- package/src/styles/globals/tables.ts +34 -0
- package/src/styles/globals/typography.ts +95 -0
- package/src/styles/globals/utility-classes.ts +76 -0
- package/src/tokens/animation.ts +6 -0
- package/src/tokens/breakpoints.ts +11 -0
- package/src/tokens/colors.ts +279 -0
- package/src/tokens/index.ts +20 -0
- package/src/tokens/margin.ts +5 -0
- package/src/tokens/numbers.js +41 -0
- package/src/tokens/padding.ts +5 -0
- package/src/tokens/spacings.ts +5 -0
- package/src/tokens/typography.ts +37 -0
- package/src/types.ts +6 -0
- package/tsconfig.json +13 -0
- package/webpack.config.js +35 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { COLORS, TYPOGRAPHY } from '@/tokens';
|
|
5
|
+
|
|
6
|
+
import { Icon, IconName } from './Icon';
|
|
7
|
+
|
|
8
|
+
interface IconGroupProps {
|
|
9
|
+
groupObject: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function IconGroup(props: IconGroupProps): React.ReactElement {
|
|
13
|
+
const { groupObject } = props;
|
|
14
|
+
|
|
15
|
+
const swatch = (iconName: string): React.ReactChild => {
|
|
16
|
+
return (
|
|
17
|
+
<li key={iconName}>
|
|
18
|
+
<figure>
|
|
19
|
+
<Icon name={iconName as IconName} />
|
|
20
|
+
|
|
21
|
+
<figcaption>{iconName}</figcaption>
|
|
22
|
+
</figure>
|
|
23
|
+
</li>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<IconGroupContainer>{Object.keys(groupObject).map((key) => swatch(key))}</IconGroupContainer>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const svgSize = '5ch';
|
|
33
|
+
|
|
34
|
+
export const IconContainer = styled.span`
|
|
35
|
+
color: ${COLORS.defaultFontColor};
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export const IconGroupContainer = styled.ul`
|
|
39
|
+
color: ${process.env.STORYBOOK_THEME === 'light' ? 'currentColor' : COLORS.defaultFontColor};
|
|
40
|
+
|
|
41
|
+
list-style: none;
|
|
42
|
+
margin-top: 2em;
|
|
43
|
+
padding-left: 0;
|
|
44
|
+
|
|
45
|
+
font-family: ${TYPOGRAPHY.fontFamily.base};
|
|
46
|
+
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
|
49
|
+
grid-column-gap: 1em;
|
|
50
|
+
grid-row-gap: 1em;
|
|
51
|
+
|
|
52
|
+
li {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
|
|
57
|
+
figure {
|
|
58
|
+
margin-left: 0;
|
|
59
|
+
margin-right: 0;
|
|
60
|
+
text-align: center;
|
|
61
|
+
|
|
62
|
+
svg {
|
|
63
|
+
height: ${svgSize};
|
|
64
|
+
width: ${svgSize};
|
|
65
|
+
margin-bottom: 1em;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const SpecifiedSizeContainer = styled.div`
|
|
72
|
+
color: ${COLORS.defaultFontColor};
|
|
73
|
+
|
|
74
|
+
width: 50vw;
|
|
75
|
+
font-size: 2em;
|
|
76
|
+
|
|
77
|
+
display: grid;
|
|
78
|
+
grid-template-columns: 1fr 5fr;
|
|
79
|
+
column-gap: 2em;
|
|
80
|
+
row-gap: 2em;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-items: center;
|
|
83
|
+
|
|
84
|
+
code {
|
|
85
|
+
justify-self: start;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '@/tokens';
|
|
4
|
+
|
|
5
|
+
export const StyledHeader = styled.header`
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-height: 42px;
|
|
10
|
+
margin-bottom: 12px;
|
|
11
|
+
|
|
12
|
+
.title {
|
|
13
|
+
font-size: 22px;
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.count {
|
|
18
|
+
font-size: 18px;
|
|
19
|
+
margin: 4px 0 0 10px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.title-container,
|
|
23
|
+
.controls-container,
|
|
24
|
+
.sort-by {
|
|
25
|
+
display: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sort-by {
|
|
29
|
+
margin-left: 10px;
|
|
30
|
+
|
|
31
|
+
label,
|
|
32
|
+
.button-sort-direction,
|
|
33
|
+
.button-sort-direction:focus {
|
|
34
|
+
color: ${COLORS.lightFontColor};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
label {
|
|
38
|
+
font-weight: normal;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button-sort-direction {
|
|
42
|
+
margin-left: 10px;
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
position: relative;
|
|
46
|
+
bottom: 3px;
|
|
47
|
+
transition: 0.3s transform ease-in-out;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.select-container {
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
|
|
55
|
+
.selectCaret {
|
|
56
|
+
color: ${COLORS.defaultFontColor};
|
|
57
|
+
height: 16px;
|
|
58
|
+
width: 16px;
|
|
59
|
+
margin: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { numberUtils } from '@indico-data/utils';
|
|
6
|
+
|
|
7
|
+
import { BorderSelect, Button, Icon } from '@/components';
|
|
8
|
+
|
|
9
|
+
import { StyledHeader } from './Header.styles';
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
title: string;
|
|
13
|
+
headerComponent?: React.ReactNode;
|
|
14
|
+
sortBy?: {
|
|
15
|
+
value: string;
|
|
16
|
+
items: { name: string; value: string }[];
|
|
17
|
+
descending: boolean;
|
|
18
|
+
updateDescending: () => void;
|
|
19
|
+
onSort: (value: string) => void;
|
|
20
|
+
};
|
|
21
|
+
aggregateCount?: number;
|
|
22
|
+
selectProps?: { 'data-cy': string };
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Header = (props: Props) => {
|
|
26
|
+
const { title, headerComponent, sortBy, aggregateCount } = props;
|
|
27
|
+
return (
|
|
28
|
+
<StyledHeader>
|
|
29
|
+
<div className="title-container">
|
|
30
|
+
<h2 className="title">{title}</h2>
|
|
31
|
+
<span className="count">
|
|
32
|
+
{aggregateCount ? numberUtils.numberWithCommas(aggregateCount) : null}
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="controls-container">
|
|
36
|
+
{headerComponent ? <div className="header-component">{headerComponent}</div> : null}
|
|
37
|
+
{sortBy ? (
|
|
38
|
+
<div className="sort-by">
|
|
39
|
+
<BorderSelect
|
|
40
|
+
label="Sort By"
|
|
41
|
+
value={sortBy.value}
|
|
42
|
+
options={sortBy.items}
|
|
43
|
+
onChange={(e) => {
|
|
44
|
+
sortBy.onSort(e.target.value);
|
|
45
|
+
}}
|
|
46
|
+
horizontal
|
|
47
|
+
{...props.selectProps}
|
|
48
|
+
/>
|
|
49
|
+
<Button
|
|
50
|
+
data-cy="dataset--sort-by-btn"
|
|
51
|
+
onClick={() => sortBy.updateDescending()}
|
|
52
|
+
variant="no-style"
|
|
53
|
+
className="button-sort-direction"
|
|
54
|
+
>
|
|
55
|
+
<Icon
|
|
56
|
+
name="fa-arrow-down"
|
|
57
|
+
ariaLabel="descending"
|
|
58
|
+
size={[16]}
|
|
59
|
+
style={{ transform: sortBy.descending ? '' : 'rotate(180deg)' }}
|
|
60
|
+
/>
|
|
61
|
+
</Button>
|
|
62
|
+
</div>
|
|
63
|
+
) : null}
|
|
64
|
+
</div>
|
|
65
|
+
</StyledHeader>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Header } from './Header';
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button, Icon } from '@/components';
|
|
5
|
+
|
|
6
|
+
import { ListTable } from './ListTable';
|
|
7
|
+
import { mockUserHeaders, mockDocProcHeaders, mockAllUsers, mockDocProcReport } from './mock-data';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
component: ListTable,
|
|
11
|
+
title: 'ListTable',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
} satisfies Meta<typeof ListTable>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof ListTable>;
|
|
17
|
+
|
|
18
|
+
//Generate List Headers
|
|
19
|
+
const createdUserHeader = (
|
|
20
|
+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 3fr 3fr 2fr 250px' }}>
|
|
21
|
+
{mockUserHeaders.map((h, i) => (
|
|
22
|
+
<div className="label" key={`${h.name}-${i}`}>
|
|
23
|
+
{h.name}
|
|
24
|
+
</div>
|
|
25
|
+
))}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
const createdDocProcHeader = (
|
|
29
|
+
<div style={{ display: 'grid', gridTemplateColumns: '2fr 3fr 2fr 170px' }}>
|
|
30
|
+
{mockDocProcHeaders.map((h, i) => (
|
|
31
|
+
<div className="label" key={`${h.name}-${i}`}>
|
|
32
|
+
{h.name}
|
|
33
|
+
</div>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
//Generate List Items
|
|
39
|
+
const createdListItems = mockAllUsers.users.map((u) => (
|
|
40
|
+
<div
|
|
41
|
+
key={`${u.name}-${u.id}`}
|
|
42
|
+
style={{ display: 'grid', gridTemplateColumns: '1fr 3fr 3fr 2fr 250px', alignItems: 'center' }}
|
|
43
|
+
>
|
|
44
|
+
<div>{u.id}</div>
|
|
45
|
+
<div>{u.name}</div>
|
|
46
|
+
<div>{u.email}</div>
|
|
47
|
+
<div>{u.registeredAt}</div>
|
|
48
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
49
|
+
<button style={{ display: 'flex', alignItems: 'center', marginLeft: '10px' }}>
|
|
50
|
+
<Icon name="key" style={{ marginRight: '5px' }} />
|
|
51
|
+
Reset Link
|
|
52
|
+
</button>
|
|
53
|
+
<button style={{ display: 'flex', alignItems: 'center', marginLeft: '10px' }}>
|
|
54
|
+
<Icon name="fa-cog" style={{ marginRight: '5px' }} />
|
|
55
|
+
Settings
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
));
|
|
60
|
+
const createdDocProcItems = mockDocProcReport.reports.map((u) => (
|
|
61
|
+
<div
|
|
62
|
+
key={`${u.name}-${u.createdOn}`}
|
|
63
|
+
style={{ display: 'grid', gridTemplateColumns: '2fr 3fr 2fr 170px', alignItems: 'center' }}
|
|
64
|
+
>
|
|
65
|
+
<div>{u.createdOn}</div>
|
|
66
|
+
<div>{u.name}</div>
|
|
67
|
+
<div>{u.status}</div>
|
|
68
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
69
|
+
<button
|
|
70
|
+
style={{ display: 'flex', alignItems: 'center', marginLeft: '10px', maxHeight: '35px' }}
|
|
71
|
+
>
|
|
72
|
+
<Icon name="fa-file-download" style={{ marginRight: '5px' }} />
|
|
73
|
+
Secure Download
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
));
|
|
78
|
+
|
|
79
|
+
function StoryRender(props) {
|
|
80
|
+
const [sortValue, setSortValue] = useState<string>(props?.sortBy?.value);
|
|
81
|
+
const [arrowDesc, setArrowDesc] = useState<boolean>(props?.sortBy?.descending);
|
|
82
|
+
|
|
83
|
+
const setArgs: any = {
|
|
84
|
+
...props,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
props.sortBy
|
|
88
|
+
? (setArgs.sortBy = {
|
|
89
|
+
value: sortValue,
|
|
90
|
+
items: props.sortBy.items,
|
|
91
|
+
descending: arrowDesc,
|
|
92
|
+
updateDescending: () => setArrowDesc(!arrowDesc),
|
|
93
|
+
onSort: (value: string) => setSortValue(value),
|
|
94
|
+
})
|
|
95
|
+
: null;
|
|
96
|
+
|
|
97
|
+
return <ListTable {...setArgs} />;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const Base: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
title: 'User Accounts',
|
|
103
|
+
listHeader: createdUserHeader,
|
|
104
|
+
listItems: createdListItems,
|
|
105
|
+
pagination: {
|
|
106
|
+
pageInfo: mockAllUsers.pageInfo,
|
|
107
|
+
limit: 20,
|
|
108
|
+
currentPage: 1,
|
|
109
|
+
getPage: () => console.info('Get Page'),
|
|
110
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
111
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
render: (args) => {
|
|
115
|
+
return <StoryRender {...args} />;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const WithSortBy: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
title: 'Sort By',
|
|
122
|
+
sortBy: {
|
|
123
|
+
value: 'REGISTERED_AT',
|
|
124
|
+
items: mockUserHeaders,
|
|
125
|
+
descending: true,
|
|
126
|
+
updateDescending: () => '',
|
|
127
|
+
onSort: () => '',
|
|
128
|
+
},
|
|
129
|
+
listHeader: createdUserHeader,
|
|
130
|
+
listItems: createdListItems,
|
|
131
|
+
pagination: {
|
|
132
|
+
pageInfo: mockAllUsers.pageInfo,
|
|
133
|
+
limit: 20,
|
|
134
|
+
currentPage: 1,
|
|
135
|
+
getPage: () => console.info('Get Page'),
|
|
136
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
137
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
render: (args) => {
|
|
141
|
+
return <StoryRender {...args} />;
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const WithSubTitle: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
title: 'Sub-Title',
|
|
148
|
+
subTitle: (
|
|
149
|
+
<div style={{ display: 'flex' }}>
|
|
150
|
+
<p>
|
|
151
|
+
Create Document Processing Report to see which documents have been processed by Indico for
|
|
152
|
+
dates selected for a maximum of 60 days. The report also includes information for when the
|
|
153
|
+
processing occurred, which Workflows those documents were processed by, and how many pages
|
|
154
|
+
each document has in a downloadable CSV.
|
|
155
|
+
</p>
|
|
156
|
+
<Button
|
|
157
|
+
variant="primary"
|
|
158
|
+
style={{ marginLeft: '60px', height: '40px' }}
|
|
159
|
+
onClick={() => console.info('Clicked')}
|
|
160
|
+
>
|
|
161
|
+
<Icon name="plus" style={{ marginRight: '8px' }} />
|
|
162
|
+
Generate Export
|
|
163
|
+
</Button>
|
|
164
|
+
</div>
|
|
165
|
+
),
|
|
166
|
+
sortBy: {
|
|
167
|
+
value: 'REGISTERED_AT',
|
|
168
|
+
items: mockDocProcHeaders,
|
|
169
|
+
descending: true,
|
|
170
|
+
updateDescending: () => '',
|
|
171
|
+
onSort: () => '',
|
|
172
|
+
},
|
|
173
|
+
listHeader: createdDocProcHeader,
|
|
174
|
+
listItems: createdDocProcItems,
|
|
175
|
+
pagination: {
|
|
176
|
+
pageInfo: mockDocProcReport.pageInfo,
|
|
177
|
+
limit: 5,
|
|
178
|
+
currentPage: 1,
|
|
179
|
+
getPage: () => console.info('Get Page'),
|
|
180
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
181
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
render: (args) => {
|
|
185
|
+
return <StoryRender {...args} />;
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const WithAccordion: Story = {
|
|
190
|
+
args: {
|
|
191
|
+
title: 'Accordion',
|
|
192
|
+
accordion: true,
|
|
193
|
+
sortBy: {
|
|
194
|
+
value: 'REGISTERED_AT',
|
|
195
|
+
items: mockUserHeaders,
|
|
196
|
+
descending: true,
|
|
197
|
+
updateDescending: () => '',
|
|
198
|
+
onSort: () => '',
|
|
199
|
+
},
|
|
200
|
+
listHeader: createdUserHeader,
|
|
201
|
+
listItems: createdListItems,
|
|
202
|
+
pagination: {
|
|
203
|
+
pageInfo: mockDocProcReport.pageInfo,
|
|
204
|
+
limit: 20,
|
|
205
|
+
currentPage: 1,
|
|
206
|
+
getPage: () => console.info('Get Page'),
|
|
207
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
208
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
render: (args) => {
|
|
212
|
+
return <StoryRender {...args} />;
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const WithHeaderComponent: Story = {
|
|
217
|
+
args: {
|
|
218
|
+
title: 'Header Component',
|
|
219
|
+
headerComponent: (
|
|
220
|
+
<div style={{ padding: '6px 0' }}>
|
|
221
|
+
<h2>CUSTOM HEADER HTML</h2>
|
|
222
|
+
</div>
|
|
223
|
+
),
|
|
224
|
+
listHeader: createdDocProcHeader,
|
|
225
|
+
listItems: createdDocProcItems,
|
|
226
|
+
pagination: {
|
|
227
|
+
pageInfo: mockDocProcReport.pageInfo,
|
|
228
|
+
limit: 5,
|
|
229
|
+
currentPage: 1,
|
|
230
|
+
getPage: () => console.info('Get Page'),
|
|
231
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
232
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
render: (args) => {
|
|
236
|
+
return <StoryRender {...args} />;
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const WithEverything: Story = {
|
|
241
|
+
args: {
|
|
242
|
+
title: 'All The Things',
|
|
243
|
+
accordion: true,
|
|
244
|
+
subTitle: (
|
|
245
|
+
<div style={{ display: 'flex' }}>
|
|
246
|
+
<p>
|
|
247
|
+
Create Document Processing Report to see which documents have been processed by Indico for
|
|
248
|
+
dates selected for a maximum of 60 days. The report also includes information for when the
|
|
249
|
+
processing occurred, which Workflows those documents were processed by, and how many pages
|
|
250
|
+
each document has in a downloadable CSV.
|
|
251
|
+
</p>
|
|
252
|
+
<Button
|
|
253
|
+
variant="primary"
|
|
254
|
+
style={{ marginLeft: '60px', maxHeight: '40px' }}
|
|
255
|
+
onClick={() => console.info('Clicked')}
|
|
256
|
+
>
|
|
257
|
+
<Icon name="plus" style={{ marginRight: '8px' }} />
|
|
258
|
+
Generate Export
|
|
259
|
+
</Button>
|
|
260
|
+
</div>
|
|
261
|
+
),
|
|
262
|
+
sortBy: {
|
|
263
|
+
value: 'REGISTERED_AT',
|
|
264
|
+
items: mockDocProcHeaders,
|
|
265
|
+
descending: true,
|
|
266
|
+
updateDescending: () => '',
|
|
267
|
+
onSort: () => '',
|
|
268
|
+
},
|
|
269
|
+
listHeader: createdDocProcHeader,
|
|
270
|
+
listItems: createdDocProcItems,
|
|
271
|
+
pagination: {
|
|
272
|
+
pageInfo: mockDocProcReport.pageInfo,
|
|
273
|
+
limit: 5,
|
|
274
|
+
currentPage: 1,
|
|
275
|
+
getPage: () => console.info('Get Page'),
|
|
276
|
+
getPreviousPage: () => console.info('Get Previous Page'),
|
|
277
|
+
getNextPage: () => console.info('Get Next Page'),
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
render: (args) => {
|
|
281
|
+
return <StoryRender {...args} />;
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const Loading: Story = {
|
|
286
|
+
args: {
|
|
287
|
+
title: 'User Accounts',
|
|
288
|
+
listHeader: createdUserHeader,
|
|
289
|
+
listItems: createdListItems,
|
|
290
|
+
loading: true,
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const Error: Story = {
|
|
295
|
+
args: {
|
|
296
|
+
title: 'User Accounts',
|
|
297
|
+
listHeader: createdUserHeader,
|
|
298
|
+
listItems: createdListItems,
|
|
299
|
+
error: true,
|
|
300
|
+
},
|
|
301
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '@/tokens';
|
|
4
|
+
|
|
5
|
+
export const StyledListTable = styled.div`
|
|
6
|
+
.list {
|
|
7
|
+
.list-header-container,
|
|
8
|
+
.list-container .list-item {
|
|
9
|
+
border-bottom: solid ${COLORS.blueBayoux} 1px;
|
|
10
|
+
padding: 0 20px 10px 20px;
|
|
11
|
+
margin-bottom: 10px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.list-header-container {
|
|
15
|
+
border-bottom-color: ${COLORS.baliHai};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.list-container .list-item {
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
|
|
21
|
+
& > * div {
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sub-title {
|
|
30
|
+
margin-bottom: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
summary,
|
|
34
|
+
summary h2 {
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
summary .header-container {
|
|
39
|
+
svg {
|
|
40
|
+
margin-top: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.header-component div {
|
|
44
|
+
padding: 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
summary .title-container {
|
|
49
|
+
margin-bottom: 2px;
|
|
50
|
+
|
|
51
|
+
.title {
|
|
52
|
+
align-items: flex-start;
|
|
53
|
+
|
|
54
|
+
h2 {
|
|
55
|
+
margin-left: 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.count {
|
|
60
|
+
color: ${COLORS.defaultFontColor};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
summary .sort-by .button-sort-direction svg {
|
|
65
|
+
bottom: 5px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.content {
|
|
69
|
+
margin-top: 0 !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.error-shrug {
|
|
73
|
+
margin: 0 20px;
|
|
74
|
+
background-color: ${COLORS.oxfordBlue};
|
|
75
|
+
}
|
|
76
|
+
`;
|