@indico-data/design-system 2.2.0 → 2.3.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.
Files changed (161) hide show
  1. package/.yarn/sdks/eslint/bin/eslint.js +8 -1
  2. package/.yarn/sdks/eslint/package.json +1 -1
  3. package/.yarn/sdks/prettier/bin/prettier.cjs +8 -1
  4. package/.yarn/sdks/prettier/index.cjs +8 -1
  5. package/.yarn/sdks/typescript/bin/tsc +8 -1
  6. package/.yarn/sdks/typescript/bin/tsserver +8 -1
  7. package/.yarn/sdks/typescript/package.json +1 -1
  8. package/.yarnrc.yml +1 -0
  9. package/lib/index.css +141 -101
  10. package/lib/index.d.ts +973 -14
  11. package/lib/index.esm.css +141 -101
  12. package/lib/index.esm.js +25974 -27484
  13. package/lib/index.esm.js.map +1 -1
  14. package/lib/index.js +26265 -27775
  15. package/lib/index.js.map +1 -1
  16. package/lib/src/components/button/Button.stories.d.ts +1 -1
  17. package/lib/src/components/button/types.d.ts +0 -1
  18. package/lib/src/components/grid/col/Col.stories.d.ts +1 -2
  19. package/lib/src/components/grid/container/Container.stories.d.ts +1 -1
  20. package/lib/src/components/grid/row/Row.stories.d.ts +1 -1
  21. package/lib/src/components/index.d.ts +1 -0
  22. package/lib/src/components/table/LoadingComponent.d.ts +1 -0
  23. package/lib/src/components/table/Table.d.ts +78 -0
  24. package/lib/src/components/table/Table.stories.d.ts +6 -0
  25. package/lib/src/components/table/index.d.ts +1 -0
  26. package/lib/src/components/table/sampleData.d.ts +8 -0
  27. package/lib/src/index.d.ts +2 -1
  28. package/lib/src/legacy/components/Accordion/Accordion.stories.d.ts +9 -9
  29. package/lib/src/legacy/components/Accordion/Accordion.styles.d.ts +1 -2
  30. package/lib/src/legacy/components/ListTable/Header/Header.styles.d.ts +1 -2
  31. package/lib/src/legacy/components/ListTable/ListTable.stories.d.ts +7 -7
  32. package/lib/src/legacy/components/ListTable/ListTable.styles.d.ts +1 -2
  33. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +2 -2
  34. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +2 -3
  35. package/lib/src/legacy/components/Pagination/Pagination.styles.d.ts +1 -2
  36. package/lib/src/legacy/components/Toggle/Toggle.d.ts +1 -2
  37. package/lib/src/legacy/components/Toggle/Toggle.stories.d.ts +4 -4
  38. package/lib/src/legacy/components/Toggle/Toggle.styles.d.ts +1 -2
  39. package/lib/src/legacy/components/Tooltip/Tooltip.styles.d.ts +1 -2
  40. package/lib/src/legacy/components/basic-section/Section/Section.stories.d.ts +1 -2
  41. package/lib/src/legacy/components/basic-section/Section/Section.styles.d.ts +1 -2
  42. package/lib/src/legacy/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -2
  43. package/lib/src/legacy/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -2
  44. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  45. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -2
  46. package/lib/src/legacy/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -2
  47. package/lib/src/legacy/components/buttons/Button/Button.stories.d.ts +1 -1
  48. package/lib/src/legacy/components/buttons/Button/Button.styles.d.ts +1 -2
  49. package/lib/src/legacy/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  50. package/lib/src/legacy/components/buttons/IconButton/IconButton.styles.d.ts +4 -3
  51. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +8 -9
  52. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -3
  53. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.d.ts +5 -5
  54. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.stories.d.ts +7 -7
  55. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.styles.d.ts +3 -2
  56. package/lib/src/legacy/components/dropdowns/Select/Select.stories.d.ts +6 -7
  57. package/lib/src/legacy/components/dropdowns/Select/Select.styles.d.ts +1 -2
  58. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.d.ts +5 -5
  59. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.stories.d.ts +5 -6
  60. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.styles.d.ts +3 -2
  61. package/lib/src/legacy/components/index.d.ts +0 -1
  62. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.styles.d.ts +1 -2
  63. package/lib/src/legacy/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -2
  64. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.d.ts +1 -2
  65. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +1 -2
  66. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.stories.d.ts +2 -2
  67. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -2
  68. package/lib/src/legacy/components/inputs/RadioButtons/RadioButtons.styles.d.ts +5 -6
  69. package/lib/src/legacy/components/inputs/RadioGroup/RadioGroup.styles.d.ts +1 -2
  70. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.stories.d.ts +8 -9
  71. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.styles.d.ts +1 -2
  72. package/lib/src/legacy/components/inputs/TextInput/TextInput.stories.d.ts +9 -9
  73. package/lib/src/legacy/components/inputs/TextInput/TextInput.styles.d.ts +2 -3
  74. package/lib/src/legacy/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -2
  75. package/lib/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +4 -5
  76. package/lib/src/legacy/components/loading-indicators/CircleSpinner/CircleSpinner.d.ts +1 -2
  77. package/lib/src/legacy/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +4 -5
  78. package/lib/src/legacy/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -2
  79. package/lib/src/legacy/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -2
  80. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +5 -5
  81. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +1 -2
  82. package/lib/src/legacy/components/modals/ModalBase/ModalBase.styles.d.ts +1 -1
  83. package/lib/src/legacy/components/text-truncate/TextTruncate.styles.d.ts +1 -2
  84. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.stories.d.ts +11 -11
  85. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -2
  86. package/lib/src/legacy/styles/globals/buttons.d.ts +0 -1
  87. package/lib/src/legacy/styles/globals/forms.d.ts +0 -1
  88. package/lib/src/legacy/styles/globals/layout.d.ts +0 -1
  89. package/lib/src/legacy/styles/globals/lists.d.ts +0 -1
  90. package/lib/src/legacy/styles/globals/margin-padding.d.ts +0 -1
  91. package/lib/src/legacy/styles/globals/media.d.ts +0 -1
  92. package/lib/src/legacy/styles/globals/tables.d.ts +0 -1
  93. package/lib/src/legacy/styles/globals/typography.d.ts +0 -1
  94. package/lib/src/legacy/styles/globals/utility-classes.d.ts +0 -1
  95. package/lib/src/types.d.ts +2 -2
  96. package/package.json +4 -2
  97. package/rollup.config.mjs +1 -1
  98. package/src/components/button/Button.mdx +1 -1
  99. package/src/components/button/Button.stories.tsx +8 -8
  100. package/src/components/button/Button.tsx +1 -1
  101. package/src/components/grid/GridSystem.mdx +0 -1
  102. package/src/components/grid/col/Col.stories.tsx +1 -2
  103. package/src/components/grid/container/Container.mdx +0 -1
  104. package/src/components/grid/container/Container.stories.tsx +1 -3
  105. package/src/components/grid/row/Row.mdx +0 -1
  106. package/src/components/grid/row/Row.stories.tsx +1 -3
  107. package/src/components/icons/Icon.mdx +1 -1
  108. package/src/components/icons/Icon.stories.tsx +2 -3
  109. package/src/components/index.ts +1 -0
  110. package/src/components/table/LoadingComponent.tsx +5 -0
  111. package/src/components/table/Table.mdx +15 -0
  112. package/src/components/table/Table.stories.tsx +547 -0
  113. package/src/components/table/Table.tsx +112 -0
  114. package/src/components/table/index.ts +1 -0
  115. package/src/components/table/sampleData.ts +162 -0
  116. package/src/components/table/styles/Table.scss +79 -0
  117. package/src/components/table/styles/_variables.scss +19 -0
  118. package/src/index.ts +1 -1
  119. package/src/legacy/components/Accordion/Accordion.tsx +1 -1
  120. package/src/legacy/components/ListTable/Header/Header.tsx +2 -4
  121. package/src/legacy/components/ListTable/ListTable.stories.tsx +1 -1
  122. package/src/legacy/components/Toggle/Toggle.tsx +2 -3
  123. package/src/legacy/components/Tooltip/Tooltip.tsx +2 -1
  124. package/src/legacy/components/basic-section/SectionTable/SectionTable.tsx +1 -1
  125. package/src/legacy/components/buttons/IconButton/IconButton.tsx +1 -1
  126. package/src/legacy/components/dropdowns/BorderSelect/BorderSelect.tsx +1 -1
  127. package/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.tsx +1 -1
  128. package/src/legacy/components/dropdowns/Select/Select.tsx +1 -1
  129. package/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.tsx +1 -1
  130. package/src/legacy/components/index.ts +0 -1
  131. package/src/legacy/components/inputs/EditableInput/EditableInput.tsx +1 -1
  132. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +2 -3
  133. package/src/legacy/components/inputs/NumberInput/NumberInput.tsx +1 -1
  134. package/src/legacy/components/inputs/SearchInput/SearchInput.stories.tsx +3 -3
  135. package/src/legacy/components/inputs/SearchInput/SearchInput.tsx +1 -1
  136. package/src/legacy/components/loading-indicators/CircleSpinner/CircleSpinner.tsx +2 -3
  137. package/src/legacy/components/user-feedback/Shrug/Shrug.tsx +1 -1
  138. package/src/styles/index.scss +2 -2
  139. package/src/types.ts +3 -5
  140. package/webpack.config.js +13 -6
  141. package/lib/src/legacy/components/Navigation/Drawer/Drawer.d.ts +0 -16
  142. package/lib/src/legacy/components/Navigation/Drawer/Drawer.stories.d.ts +0 -6
  143. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.d.ts +0 -9
  144. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +0 -2
  145. package/lib/src/legacy/components/Navigation/Drawer/__mocks__/mocks.d.ts +0 -3
  146. package/lib/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +0 -1
  147. package/lib/src/legacy/components/Navigation/Drawer/index.d.ts +0 -1
  148. package/lib/src/legacy/components/Navigation/Drawer/types.d.ts +0 -7
  149. package/lib/src/legacy/components/Navigation/index.d.ts +0 -1
  150. package/src/legacy/components/Navigation/Drawer/Drawer.scss +0 -61
  151. package/src/legacy/components/Navigation/Drawer/Drawer.stories.tsx +0 -43
  152. package/src/legacy/components/Navigation/Drawer/Drawer.tsx +0 -107
  153. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.ts +0 -65
  154. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.tsx +0 -64
  155. package/src/legacy/components/Navigation/Drawer/__mocks__/mocks.ts +0 -49
  156. package/src/legacy/components/Navigation/Drawer/__tests__/Drawer.test.tsx +0 -180
  157. package/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +0 -66
  158. package/src/legacy/components/Navigation/Drawer/index.ts +0 -1
  159. package/src/legacy/components/Navigation/Drawer/types.ts +0 -8
  160. package/src/legacy/components/Navigation/index.ts +0 -1
  161. /package/src/components/grid/{Grid.scss → styles/Grid.scss} +0 -0
@@ -1,61 +0,0 @@
1
-
2
- @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
3
-
4
- .pf__drawer__wrapper {
5
- color: #444444;
6
- background-color: white;
7
- box-sizing: border-box;
8
- height: 100vh;
9
- padding: 30px 4px 10px 4px;
10
- transition: width 0.2s ease-in-out;
11
- box-shadow: 5px 0 10px rgba(0, 0, 0, 0.3);
12
- overflow: hidden;
13
- width: 100%;
14
-
15
- .pf__drawer__header__logo-text {
16
- font-family: 'Poppins', sans-serif;
17
- font-weight: 600;
18
- }
19
-
20
- a:link {
21
- color: #444444;
22
- }
23
-
24
- a {
25
- color: #444444;
26
- text-decoration: none;
27
- }
28
-
29
-
30
- .pf__drawer__header {
31
- margin-bottom: 30px;
32
- color: black;
33
- display: flex;
34
- align-items: center;
35
- padding-left: 10px;
36
- white-space: nowrap;
37
-
38
- .pf__drawer__header__text {
39
- overflow: hidden;
40
- transition: opacity 0.2s ease-in-out;
41
- }
42
-
43
- span {
44
- display: flex;
45
- align-items: center;
46
- }
47
-
48
- p {
49
- font-size: 20px;
50
- margin: 0 0 0 12px;
51
- }
52
- }
53
-
54
- .pf__drawer__content {
55
- height: calc(100% - 42px);
56
- display: flex;
57
- flex-direction: column;
58
- justify-content: space-between;
59
- padding-bottom: 10px;
60
- }
61
- }
@@ -1,43 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { Drawer } from '@/legacy/components/Navigation/Drawer';
4
- import React from 'react';
5
- import { footerItems, navigationItems } from './__mocks__/mocks';
6
- import { MemoryRouter } from 'react-router-dom';
7
-
8
- const meta: Meta<typeof Drawer> = {
9
- component: Drawer,
10
- tags: ['autodocs'],
11
- title: 'legacy/Navigation/Drawer',
12
- decorators: [
13
- (Story) => (
14
- <MemoryRouter initialEntries={['/']}>
15
- <div style={{ width: '100%', display: 'flex', height: '800px' }}>
16
- <div style={{ width: '50px', position: 'relative' }}>
17
- <div style={{ position: 'absolute' }}>
18
- <Story />
19
- </div>
20
- </div>
21
- <div style={{ width: '100%', height: '60px' }}>
22
- This text is to help illustrate the ability to expand the drawer over content without
23
- shifting it in any way. Simply add a position relative div and place this in a position
24
- absolute div.
25
- </div>
26
- </div>
27
- </MemoryRouter>
28
- ),
29
- ],
30
- };
31
-
32
- export default meta;
33
-
34
- type Story = StoryObj<typeof Drawer>;
35
-
36
- export const Normal: Story = {
37
- args: {
38
- logoText: 'INDICO INSIGHTS',
39
- logoIcon: 'indico-o',
40
- navigationItems: navigationItems,
41
- footerItems: footerItems,
42
- },
43
- };
@@ -1,107 +0,0 @@
1
- /*
2
- ## TODO
3
- -Documentation
4
- -Split header block to its own component.
5
- -Add support for horizontal lines between list items.
6
- -Use variables for styles
7
- -Add toggle options other than mouseover
8
- -Add easy color support
9
- -Add documentation
10
- -Icons should ideally have a size enum
11
- -Combine headerComponent, logoText and logoIcon props into one prop and functionality
12
- */
13
- import React from 'react';
14
- import { IconName, PermafrostComponent } from '@/types';
15
- import { Icon } from '@/components/icons';
16
- import { DrawerLinkList } from './DrawerLinkList';
17
- import { ListItem } from './types';
18
- import './Drawer.scss';
19
-
20
- type Props = PermafrostComponent & {
21
- style?: React.CSSProperties;
22
- logoText?: string;
23
- logoIcon?: IconName;
24
- headerComponent?: React.ReactNode;
25
- navigationItems?: ListItem[];
26
- footerItems?: ListItem[];
27
- expandedWidth?: string;
28
- collapsedWidth?: string;
29
- };
30
-
31
- export const Drawer = (props: Props) => {
32
- const {
33
- id,
34
- style = {},
35
- logoText,
36
- logoIcon,
37
- navigationItems,
38
- footerItems,
39
- headerComponent,
40
- expandedWidth = '245px',
41
- collapsedWidth = '50px',
42
- ...restOfProps
43
- } = props;
44
-
45
- const [isOpen, setIsOpen] = React.useState(false);
46
- const handleMouseOver = () => {
47
- setIsOpen(true);
48
- };
49
-
50
- const handleMouseOut = () => {
51
- setIsOpen(false);
52
- };
53
-
54
- const currentWidth = isOpen ? expandedWidth : collapsedWidth;
55
-
56
- return (
57
- <div
58
- id={id}
59
- data-cy={props['data-cy']}
60
- data-testid={props['data-testid']}
61
- style={{
62
- ...style,
63
- }}
64
- {...restOfProps}
65
- onMouseOver={handleMouseOver}
66
- onMouseOut={handleMouseOut}
67
- aria-expanded={isOpen}
68
- >
69
- <div
70
- className={'pf__drawer__wrapper'}
71
- style={{
72
- width: currentWidth,
73
- }}
74
- >
75
- <div className="pf__drawer__header">
76
- {headerComponent ? (
77
- headerComponent
78
- ) : (
79
- <span>
80
- {logoIcon ? <Icon name={logoIcon} size="lg" data-testid="logo-icon" /> : null}
81
- <p
82
- data-testid="logo-text"
83
- className="pf__drawer__header__logo-text"
84
- aria-hidden={!isOpen}
85
- >
86
- {logoText}
87
- </p>
88
- </span>
89
- )}
90
- </div>
91
- <div className="pf__drawer__content">
92
- {navigationItems?.length ? (
93
- <div className="pf__drawer__navigation" data-testid="drawer-navigation">
94
- <DrawerLinkList isOpen={isOpen} listItems={navigationItems} />
95
- </div>
96
- ) : null}
97
-
98
- {footerItems?.length ? (
99
- <div className="pf__drawer__footer" data-testid="drawer-footer">
100
- <DrawerLinkList isOpen={isOpen} listItems={footerItems} />
101
- </div>
102
- ) : null}
103
- </div>
104
- </div>
105
- </div>
106
- );
107
- };
@@ -1,65 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const StyledDrawerLinkList = styled.div`
4
- .drawer__list {
5
- white-space: nowrap;
6
-
7
- .drawer__list__item {
8
- box-sizing: border-box;
9
- margin-bottom: 10px;
10
- font-weight: 500;
11
- font-size: 16px;
12
- display: flex;
13
- align-items: center;
14
- padding-top: 12px;
15
- padding-bottom: 10px;
16
-
17
- &:last-child {
18
- margin-bottom: 0;
19
- }
20
-
21
- &:hover {
22
- color: #6833d0;
23
- background-color: #efebf7;
24
-
25
- a,
26
- &:active {
27
- color: #6833d0;
28
- }
29
- }
30
-
31
- &--active {
32
- color: white;
33
- background-color: #6833d0;
34
- border-radius: 4px;
35
-
36
- a,
37
- &:active {
38
- color: white;
39
- }
40
- }
41
-
42
- .drawer__list__item__link {
43
- font-size: 16px;
44
- display: flex;
45
- align-items: center;
46
-
47
- .drawer__list__item__icon {
48
- width: 22px;
49
- height: 22px;
50
- margin-right: 12px;
51
- margin-left: 10px;
52
- }
53
-
54
- .drawer__list__item__label {
55
- opacity: 1;
56
- }
57
-
58
- .drawer__list__item__label--hidden {
59
- opacity: 0;
60
- transition: all 0.3s ease-out;
61
- }
62
- }
63
- }
64
- }
65
- `;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import classNames from 'classnames';
3
- import { PermafrostComponent } from '@/types';
4
- import { StyledDrawerLinkList } from './DrawerLinkList.styles';
5
- import { Icon } from '@/components/icons';
6
- import { ListItem } from './types';
7
- import { NavLink } from 'react-router-dom';
8
-
9
- type Props = PermafrostComponent & {
10
- style?: object;
11
- listItems?: ListItem[];
12
- isOpen: boolean;
13
- };
14
-
15
- export const DrawerLinkList = (props: Props) => {
16
- const { className, style = {}, id, listItems, isOpen, ...restOfProps } = props;
17
-
18
- return (
19
- <StyledDrawerLinkList
20
- id={id}
21
- data-cy={props['data-cy']}
22
- data-testid={props['data-testid']}
23
- style={style}
24
- {...restOfProps}
25
- className={classNames('drawer__content__list', className)}
26
- >
27
- {listItems && (
28
- <ul className="drawer__list">
29
- {listItems.map((item) => (
30
- <NavLink
31
- key={item.id}
32
- to={item.path}
33
- className={({ isActive, isPending }) => {
34
- return classNames(
35
- 'drawer__list__item',
36
- { 'drawer__list__item--active': isActive },
37
- { 'drawer__list__item--pending': isPending },
38
- );
39
- }}
40
- role="link"
41
- aria-label={item.label}
42
- data-testid={`link-list-item-${item.label}`}
43
- >
44
- <li className="drawer__list__item__link">
45
- <span className={`drawer__list__item__icon`}>
46
- <Icon size="lg" name={item.icon} ariaLabel={`${item.label} icon`} />
47
- </span>
48
- <span
49
- className={`drawer__list__item__label ${
50
- !isOpen ? 'drawer__list__item__label--hidden' : ''
51
- }`}
52
- aria-hidden={!isOpen}
53
- data-testid="list-item-label"
54
- >
55
- {item.label}
56
- </span>
57
- </li>
58
- </NavLink>
59
- ))}
60
- </ul>
61
- )}
62
- </StyledDrawerLinkList>
63
- );
64
- };
@@ -1,49 +0,0 @@
1
- import { ListItem } from '../types';
2
-
3
- export const navigationItems: ListItem[] = [
4
- {
5
- id: '1',
6
- icon: 'search-thin',
7
- label: 'Search',
8
- path: '/iframe.html',
9
- },
10
- {
11
- id: '4',
12
- icon: 'libraries',
13
- label: 'Libraries',
14
- path: '/',
15
- },
16
- {
17
- id: '2',
18
- icon: 'collection',
19
- label: 'Collections',
20
- path: '/profile',
21
- },
22
- {
23
- id: '3',
24
- icon: 'compare',
25
- label: 'Compare',
26
- path: '/settings',
27
- },
28
- ];
29
-
30
- export const footerItems: ListItem[] = [
31
- {
32
- id: 'foter-1',
33
- icon: 'circle-help',
34
- label: 'Help',
35
- path: '/search',
36
- },
37
- {
38
- id: '4f',
39
- icon: 'cog',
40
- label: 'Settings',
41
- path: '/',
42
- },
43
- {
44
- id: '42',
45
- icon: 'logout',
46
- label: 'Sign Out',
47
- path: '/profile',
48
- },
49
- ];
@@ -1,180 +0,0 @@
1
- it('should render correctly', () => {
2
- // Pending
3
- expect(true).toBe(true);
4
- });
5
-
6
- // import React from 'react';
7
- // import { render, screen } from '@testing-library/react';
8
- // import userEvent from '@testing-library/user-event';
9
- // import { Drawer } from '../Drawer';
10
- // import { navigationItems, footerItems } from '../__mocks__/mocks';
11
- // import { MemoryRouter } from 'react-router-dom';
12
-
13
- // let navDrawer: HTMLElement;
14
-
15
- // describe('Drawer', () => {
16
- // describe('expanded interactions', () => {
17
- // beforeEach(() => {
18
- // render(
19
- // <MemoryRouter>
20
- // <Drawer
21
- // logoIcon={'indico-o'}
22
- // logoText={'INDICO INSIGHTS'}
23
- // navigationItems={navigationItems}
24
- // footerItems={footerItems}
25
- // $expandedWidth="300"
26
- // $collapsedWidth="45"
27
- // data-testid="navigation__drawer"
28
- // />
29
- // ,
30
- // </MemoryRouter>,
31
- // );
32
- // navDrawer = screen.getByTestId('navigation__drawer');
33
- // });
34
-
35
- // it('opens the drawer when the mouse is over the drawer', async () => {
36
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
37
-
38
- // await userEvent.hover(navDrawer);
39
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
40
- // });
41
-
42
- // it('closes the drawer when the mouse is over the drawer and then leaves the drawer', async () => {
43
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
44
- // await userEvent.hover(navDrawer);
45
-
46
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
47
- // await userEvent.unhover(navDrawer);
48
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
49
- // });
50
- // });
51
-
52
- // describe('styling', () => {
53
- // beforeEach(() => {
54
- // render(
55
- // <MemoryRouter>
56
- // <Drawer
57
- // logoIcon={'indico-o'}
58
- // logoText={'INDICO INSIGHTS'}
59
- // navigationItems={navigationItems}
60
- // footerItems={footerItems}
61
- // $expandedWidth="400"
62
- // $collapsedWidth="45"
63
- // data-testid="navigation__drawer"
64
- // />
65
- // ,
66
- // </MemoryRouter>,
67
- // );
68
- // navDrawer = screen.getByTestId('navigation__drawer');
69
- // });
70
-
71
- // it('applies the drawer--open class to the component when the drawer is open', async () => {
72
- // expect(navDrawer).toHaveClass('drawer--closed');
73
- // await userEvent.hover(navDrawer);
74
-
75
- // expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
76
- // expect(navDrawer).toHaveClass('drawer--open');
77
- // });
78
-
79
- // it('applies the drawer--closed class to the component when the drawer is closed', async () => {
80
- // expect(navDrawer).toHaveClass('drawer--closed');
81
- // await userEvent.hover(navDrawer);
82
-
83
- // expect(navDrawer).toHaveClass('drawer--open');
84
- // await userEvent.unhover(navDrawer);
85
- // expect(navDrawer).toHaveClass('drawer--closed');
86
- // });
87
-
88
- // it('sets the drawer width to the min width value passed in as a prop when drawer is closed', () => {
89
- // expect(navDrawer).toHaveClass('drawer--closed');
90
- // expect(navDrawer).toHaveStyle({ width: '45px' });
91
- // });
92
-
93
- // it('sets the drawer width to the max width value passed in as a prop when drawer is open', async () => {
94
- // await userEvent.hover(navDrawer);
95
-
96
- // expect(navDrawer).toHaveClass('drawer--open');
97
- // expect(navDrawer).toHaveStyle({ width: '400px' });
98
- // });
99
- // });
100
-
101
- // describe('Logo and Header Display', () => {
102
- // it('displays the header component when one is provided', () => {
103
- // render(
104
- // <MemoryRouter>
105
- // <Drawer
106
- // navigationItems={navigationItems}
107
- // footerItems={footerItems}
108
- // data-testid="navigation__drawer"
109
- // $expandedWidth="400"
110
- // $collapsedWidth="45"
111
- // headerComponent={<div>Header Component</div>}
112
- // />
113
- // ,
114
- // </MemoryRouter>,
115
- // );
116
-
117
- // navDrawer = screen.getByTestId('navigation__drawer');
118
-
119
- // expect(screen.getByText('Header Component')).toBeInTheDocument();
120
- // });
121
- // it('displays the logo icon and text when no header component is provided', async () => {
122
- // render(
123
- // <MemoryRouter>
124
- // <Drawer
125
- // logoIcon={'indico-o'}
126
- // logoText={'INDICO INSIGHTS'}
127
- // navigationItems={navigationItems}
128
- // footerItems={footerItems}
129
- // data-testid="navigation__drawer"
130
- // />
131
- // ,
132
- // </MemoryRouter>,
133
- // );
134
- // navDrawer = screen.getByTestId('navigation__drawer');
135
-
136
- // await userEvent.hover(navDrawer);
137
- // const logoIcon = screen.getByTestId('logo-icon');
138
- // const logoText = screen.getByText('INDICO INSIGHTS');
139
-
140
- // expect(logoIcon).toBeInTheDocument();
141
- // expect(logoText).toBeInTheDocument();
142
- // expect(logoText).toHaveAttribute('aria-hidden', 'false');
143
- // expect(logoText).toBeVisible();
144
- // expect(logoIcon).toBeVisible();
145
- // });
146
- // });
147
- // describe('Conditional Rendering Of Lists', () => {
148
- // it('does not display nav or footer lists if props are empty', () => {
149
- // render(
150
- // <MemoryRouter>
151
- // <Drawer navigationItems={[]} footerItems={[]} data-testid="navigation__drawer" />,
152
- // </MemoryRouter>,
153
- // );
154
-
155
- // const nav = screen.queryByTestId('drawer-navigation');
156
- // const footer = screen.queryByTestId('drawer-footer');
157
-
158
- // expect(nav).not.toBeInTheDocument();
159
- // expect(footer).not.toBeInTheDocument();
160
- // });
161
- // it('displays nav and footer lists if props are not empty', () => {
162
- // render(
163
- // <MemoryRouter>
164
- // <Drawer
165
- // navigationItems={navigationItems}
166
- // footerItems={footerItems}
167
- // data-testid="navigation__drawer"
168
- // />
169
- // ,
170
- // </MemoryRouter>,
171
- // );
172
-
173
- // const nav = screen.getByTestId('drawer-navigation');
174
- // const footer = screen.getByTestId('drawer-footer');
175
-
176
- // expect(nav).toBeInTheDocument();
177
- // expect(footer).toBeInTheDocument();
178
- // });
179
- // });
180
- // });
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { DrawerLinkList } from '../DrawerLinkList';
4
- import { navigationItems } from '../__mocks__/mocks';
5
- import { MemoryRouter } from 'react-router-dom';
6
-
7
- describe('DrawerLinkList', () => {
8
- describe('expanded interactions', () => {
9
- it('it renders the correct number of items in the list', () => {
10
- render(
11
- <MemoryRouter>
12
- <DrawerLinkList isOpen={true} listItems={navigationItems} />
13
- </MemoryRouter>,
14
- );
15
-
16
- const list = screen.getAllByRole('listitem');
17
- expect(list).toHaveLength(navigationItems.length);
18
- });
19
-
20
- // NOTE, the default path for the purpose of this test is `/` which matches the prop value.
21
- it('hides the label when isOpen is false', () => {
22
- render(
23
- <MemoryRouter>
24
- <DrawerLinkList isOpen={false} listItems={navigationItems} />
25
- </MemoryRouter>,
26
- );
27
-
28
- const items = screen.queryAllByTestId('list-item-label');
29
- items.map((item) => {
30
- expect(item).not.toBeVisible();
31
- });
32
- });
33
- it('shows the label when isOpen is true', () => {
34
- render(
35
- <MemoryRouter>
36
- <DrawerLinkList isOpen={true} listItems={navigationItems} />
37
- </MemoryRouter>,
38
- );
39
-
40
- const items = screen.queryAllByTestId('list-item-label');
41
- items.map((item) => {
42
- expect(item).toBeVisible();
43
- });
44
- });
45
- it('sets active class on handleActiveLink match', () => {
46
- render(
47
- <MemoryRouter>
48
- <DrawerLinkList isOpen={true} listItems={navigationItems} />
49
- </MemoryRouter>,
50
- );
51
-
52
- const lineItem = screen.getByTestId('link-list-item-Libraries');
53
- expect(lineItem).toHaveClass('drawer__list__item--active');
54
- });
55
- it('does not render a list when no items are passed to the component', () => {
56
- render(
57
- <MemoryRouter>
58
- <DrawerLinkList isOpen={true} listItems={[]} />
59
- </MemoryRouter>,
60
- );
61
-
62
- const list = screen.queryAllByRole('listitem');
63
- expect(list).toHaveLength(0);
64
- });
65
- });
66
- });
@@ -1 +0,0 @@
1
- export { Drawer } from './Drawer';
@@ -1,8 +0,0 @@
1
- import { IconName } from '@/types';
2
-
3
- export type ListItem = {
4
- id: string;
5
- icon: IconName;
6
- label: string;
7
- path: string;
8
- };
@@ -1 +0,0 @@
1
- export { Drawer } from './Drawer';