@indico-data/design-system 2.2.0 → 2.3.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.
Files changed (122) 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 +105 -101
  10. package/lib/index.d.ts +1 -10
  11. package/lib/index.esm.css +105 -101
  12. package/lib/index.esm.js +1138 -3041
  13. package/lib/index.esm.js.map +1 -1
  14. package/lib/index.js +1135 -3039
  15. package/lib/index.js.map +1 -1
  16. package/lib/src/components/button/types.d.ts +0 -1
  17. package/lib/src/components/index.d.ts +1 -0
  18. package/lib/src/components/tables/table/LoadingComponent.d.ts +1 -0
  19. package/lib/src/components/tables/table/Table.d.ts +78 -0
  20. package/lib/src/components/tables/table/Table.stories.d.ts +6 -0
  21. package/lib/src/components/tables/table/index.d.ts +1 -0
  22. package/lib/src/components/tables/table/sampleData.d.ts +8 -0
  23. package/lib/src/index.d.ts +1 -1
  24. package/lib/src/legacy/components/Accordion/Accordion.stories.d.ts +9 -9
  25. package/lib/src/legacy/components/Accordion/Accordion.styles.d.ts +1 -2
  26. package/lib/src/legacy/components/ListTable/Header/Header.styles.d.ts +1 -2
  27. package/lib/src/legacy/components/ListTable/ListTable.stories.d.ts +7 -7
  28. package/lib/src/legacy/components/ListTable/ListTable.styles.d.ts +1 -2
  29. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +2 -2
  30. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +2 -3
  31. package/lib/src/legacy/components/Pagination/Pagination.styles.d.ts +1 -2
  32. package/lib/src/legacy/components/Toggle/Toggle.stories.d.ts +4 -4
  33. package/lib/src/legacy/components/Toggle/Toggle.styles.d.ts +1 -2
  34. package/lib/src/legacy/components/Tooltip/Tooltip.styles.d.ts +1 -2
  35. package/lib/src/legacy/components/basic-section/Section/Section.stories.d.ts +1 -2
  36. package/lib/src/legacy/components/basic-section/Section/Section.styles.d.ts +1 -2
  37. package/lib/src/legacy/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -2
  38. package/lib/src/legacy/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -2
  39. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  40. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -2
  41. package/lib/src/legacy/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -2
  42. package/lib/src/legacy/components/buttons/Button/Button.stories.d.ts +1 -1
  43. package/lib/src/legacy/components/buttons/Button/Button.styles.d.ts +1 -2
  44. package/lib/src/legacy/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  45. package/lib/src/legacy/components/buttons/IconButton/IconButton.styles.d.ts +4 -3
  46. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +8 -9
  47. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -3
  48. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.d.ts +5 -5
  49. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.stories.d.ts +7 -7
  50. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.styles.d.ts +3 -2
  51. package/lib/src/legacy/components/dropdowns/Select/Select.stories.d.ts +6 -7
  52. package/lib/src/legacy/components/dropdowns/Select/Select.styles.d.ts +1 -2
  53. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.d.ts +5 -5
  54. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.stories.d.ts +5 -6
  55. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.styles.d.ts +3 -2
  56. package/lib/src/legacy/components/index.d.ts +0 -1
  57. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.styles.d.ts +1 -2
  58. package/lib/src/legacy/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -2
  59. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +1 -2
  60. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.stories.d.ts +2 -2
  61. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -2
  62. package/lib/src/legacy/components/inputs/RadioButtons/RadioButtons.styles.d.ts +5 -6
  63. package/lib/src/legacy/components/inputs/RadioGroup/RadioGroup.styles.d.ts +1 -2
  64. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.stories.d.ts +8 -9
  65. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.styles.d.ts +1 -2
  66. package/lib/src/legacy/components/inputs/TextInput/TextInput.stories.d.ts +9 -9
  67. package/lib/src/legacy/components/inputs/TextInput/TextInput.styles.d.ts +2 -3
  68. package/lib/src/legacy/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -2
  69. package/lib/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +4 -5
  70. package/lib/src/legacy/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +4 -5
  71. package/lib/src/legacy/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -2
  72. package/lib/src/legacy/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -2
  73. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +5 -5
  74. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +1 -2
  75. package/lib/src/legacy/components/modals/ModalBase/ModalBase.styles.d.ts +1 -1
  76. package/lib/src/legacy/components/text-truncate/TextTruncate.styles.d.ts +1 -2
  77. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.stories.d.ts +11 -11
  78. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -2
  79. package/lib/src/legacy/styles/globals/buttons.d.ts +0 -1
  80. package/lib/src/legacy/styles/globals/forms.d.ts +0 -1
  81. package/lib/src/legacy/styles/globals/layout.d.ts +0 -1
  82. package/lib/src/legacy/styles/globals/lists.d.ts +0 -1
  83. package/lib/src/legacy/styles/globals/margin-padding.d.ts +0 -1
  84. package/lib/src/legacy/styles/globals/media.d.ts +0 -1
  85. package/lib/src/legacy/styles/globals/tables.d.ts +0 -1
  86. package/lib/src/legacy/styles/globals/typography.d.ts +0 -1
  87. package/lib/src/legacy/styles/globals/utility-classes.d.ts +0 -1
  88. package/lib/src/types.d.ts +0 -2
  89. package/package.json +4 -2
  90. package/src/components/index.ts +1 -0
  91. package/src/components/tables/table/LoadingComponent.tsx +5 -0
  92. package/src/components/tables/table/Table.mdx +15 -0
  93. package/src/components/tables/table/Table.scss +79 -0
  94. package/src/components/tables/table/Table.stories.tsx +547 -0
  95. package/src/components/tables/table/Table.tsx +112 -0
  96. package/src/components/tables/table/_variables.scss +19 -0
  97. package/src/components/tables/table/index.ts +1 -0
  98. package/src/components/tables/table/sampleData.ts +162 -0
  99. package/src/index.ts +0 -1
  100. package/src/legacy/components/index.ts +0 -1
  101. package/src/styles/index.scss +1 -2
  102. package/src/types.ts +0 -5
  103. package/lib/src/legacy/components/Navigation/Drawer/Drawer.d.ts +0 -16
  104. package/lib/src/legacy/components/Navigation/Drawer/Drawer.stories.d.ts +0 -6
  105. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.d.ts +0 -9
  106. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +0 -2
  107. package/lib/src/legacy/components/Navigation/Drawer/__mocks__/mocks.d.ts +0 -3
  108. package/lib/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +0 -1
  109. package/lib/src/legacy/components/Navigation/Drawer/index.d.ts +0 -1
  110. package/lib/src/legacy/components/Navigation/Drawer/types.d.ts +0 -7
  111. package/lib/src/legacy/components/Navigation/index.d.ts +0 -1
  112. package/src/legacy/components/Navigation/Drawer/Drawer.scss +0 -61
  113. package/src/legacy/components/Navigation/Drawer/Drawer.stories.tsx +0 -43
  114. package/src/legacy/components/Navigation/Drawer/Drawer.tsx +0 -107
  115. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.ts +0 -65
  116. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.tsx +0 -64
  117. package/src/legacy/components/Navigation/Drawer/__mocks__/mocks.ts +0 -49
  118. package/src/legacy/components/Navigation/Drawer/__tests__/Drawer.test.tsx +0 -180
  119. package/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +0 -66
  120. package/src/legacy/components/Navigation/Drawer/index.ts +0 -1
  121. package/src/legacy/components/Navigation/Drawer/types.ts +0 -8
  122. package/src/legacy/components/Navigation/index.ts +0 -1
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import DataTable, { TableColumn, Direction, Alignment } from 'react-data-table-component';
3
+ import { LoadingComponent } from './LoadingComponent';
4
+
5
+ type LocalDirection = 'auto' | 'ltr' | 'rtl';
6
+ type LocalAlignment = 'left' | 'right' | 'center';
7
+ interface TableProps {
8
+ columns: TableColumn<any>[];
9
+ data: Record<string, any>[];
10
+ responsive?: boolean;
11
+ direction?: LocalDirection;
12
+ subHeaderAlign?: LocalAlignment;
13
+ subHeaderWrap?: boolean;
14
+ pagination?: boolean;
15
+ selectableRows?: boolean;
16
+ keyField?: string;
17
+ title?: string | React.ReactNode;
18
+ striped?: boolean;
19
+ highlightOnHover?: boolean;
20
+ pointerOnHover?: boolean;
21
+ dense?: boolean;
22
+ persistTableHead?: boolean;
23
+ noDataComponent?: string | React.ReactNode;
24
+ isDisabled?: boolean;
25
+ onRowClicked?: (row: Record<string, any>, event: React.MouseEvent) => void;
26
+ onRowDoubleClicked?: (row: Record<string, any>, event: React.MouseEvent) => void;
27
+ onRowMouseEnter?: (row: Record<string, any>, event: React.MouseEvent) => void;
28
+ onRowMouseLeave?: (row: Record<string, any>, event: React.MouseEvent) => void;
29
+ defaultSortFieldId?: string | number;
30
+ defaultSortAsc?: boolean;
31
+ sortIcon?: React.ReactNode;
32
+ sortServer?: boolean;
33
+ sortFunction?: any;
34
+ onSort?: any;
35
+ selectableRowsVisibleOnly?: boolean;
36
+ selectableRowsHighlight?: boolean;
37
+ selectableRowsSingle?: boolean;
38
+ selectableRowsNoSelectAll?: boolean;
39
+ selectableRowsComponent?: any;
40
+ selectableRowsComponentProps?: Record<string, any>;
41
+ clearSelectedRows?: boolean;
42
+ selectableRowSelected?: (row: Record<string, any>) => boolean;
43
+ selectableRowDisabled?: (row: Record<string, any>) => boolean;
44
+ onSelectedRowsChange?: any;
45
+ expandableRows?: boolean;
46
+ expandableIcon?: any;
47
+ expandableRowsComponent?: any;
48
+ expandableRowDisabled?: any;
49
+ expandableRowExpanded?: any;
50
+ expandableRowsComponentProps?: Record<string, any>;
51
+ expandOnRowClicked?: boolean;
52
+ expandOnRowDoubleClicked?: boolean;
53
+ expandableRowsHideExpander?: boolean;
54
+ expandableInheritConditionalStyles?: boolean;
55
+ onRowExpandToggled?: any;
56
+
57
+ paginationServer?: boolean;
58
+ paginationServerOptions?: Record<string, any>;
59
+ paginationDefaultPage?: number;
60
+ paginationResetDefaultPage?: boolean;
61
+ paginationTotalRows?: number;
62
+ paginationPerPage?: number;
63
+ paginationRowsPerPageOptions?: number[];
64
+ paginationComponent?: any;
65
+ paginationComponentOptions?: Record<string, any>;
66
+ paginationIconFirstPage?: any;
67
+ paginationIconLastPage?: any;
68
+ paginationIconNext?: any;
69
+ paginationIconPrevious?: any;
70
+ onChangePage?: any;
71
+ onChangeRowsPerPage?: any;
72
+
73
+ actions?: any;
74
+ noHeader?: boolean;
75
+ fixedHeader?: boolean;
76
+ fixedHeaderScrollHeight?: string;
77
+ subHeader?: boolean;
78
+ subHeaderComponent?: any;
79
+
80
+ isLoading?: boolean;
81
+ }
82
+
83
+ export const Table = (props: TableProps) => {
84
+ const {
85
+ responsive = true,
86
+ direction = 'auto',
87
+ keyField = 'id',
88
+ striped = true,
89
+ noDataComponent = 'built-in',
90
+ isDisabled,
91
+ isLoading,
92
+ subHeaderAlign = 'left',
93
+ ...rest
94
+ } = props;
95
+ return (
96
+ <div className="table-wrapper">
97
+ <DataTable
98
+ responsive={responsive}
99
+ direction={direction as Direction}
100
+ subHeaderAlign={subHeaderAlign as Alignment}
101
+ keyField={keyField}
102
+ striped={striped}
103
+ className={`${striped ? 'pf__table--striped' : ''}`}
104
+ disabled={isDisabled}
105
+ noDataComponent={noDataComponent}
106
+ progressPending={isLoading}
107
+ progressComponent={<LoadingComponent />}
108
+ {...rest}
109
+ />
110
+ </div>
111
+ );
112
+ };
@@ -0,0 +1,19 @@
1
+ // Common Variables
2
+ :root,
3
+ :root [data-theme='light'],
4
+ :root [data-theme='dark'] {
5
+ --pf-table-font-color: var(--pf-gray-color);
6
+ --pf-table-stripe-color: var(--pf-gray-color-100);
7
+ }
8
+
9
+ // Light Theme Specific Variables
10
+ :root [data-theme='light'] {
11
+ --pf-table-background-color: var(--pf-white-color);
12
+ --pf-table-stripe-color: var(--pf-gray-color-100);
13
+ }
14
+
15
+ // Dark Theme Specific Variables
16
+ :root [data-theme='dark'] {
17
+ --pf-table-background-color: var(--pf-primary-color-700);
18
+ --pf-table-stripe-color: var(--pf-primary-color-400);
19
+ }
@@ -0,0 +1 @@
1
+ export { Table } from './table';
@@ -0,0 +1,162 @@
1
+ export const sampleData = [
2
+ {
3
+ name: 'Thalion',
4
+ class: 'Ranger',
5
+ age: 120,
6
+ weapon: 'Longbow',
7
+ backstory: 'Raised by wolves in the deep forests.',
8
+ favoriteMeal: 'Venison stew',
9
+ },
10
+ {
11
+ name: 'Brom',
12
+ class: 'Fighter',
13
+ age: 35,
14
+ weapon: 'Greatsword',
15
+ backstory: 'A former soldier seeking redemption.',
16
+ favoriteMeal: 'Roasted boar',
17
+ },
18
+ {
19
+ name: 'Elysia',
20
+ class: 'Cleric',
21
+ age: 60,
22
+ weapon: 'Mace',
23
+ backstory: 'A devoted follower of the goddess of life.',
24
+ favoriteMeal: 'Vegetable soup',
25
+ },
26
+ {
27
+ name: 'Faelar',
28
+ class: 'Rogue',
29
+ age: 80,
30
+ weapon: 'Dagger',
31
+ backstory: 'Grew up on the streets of a bustling city.',
32
+ favoriteMeal: 'Bread and cheese',
33
+ },
34
+ {
35
+ name: 'Maelis',
36
+ class: 'Wizard',
37
+ age: 200,
38
+ weapon: 'Staff',
39
+ backstory: 'A scholar obsessed with ancient magic.',
40
+ favoriteMeal: 'Mushroom stew',
41
+ },
42
+ {
43
+ name: 'Grimm',
44
+ class: 'Barbarian',
45
+ age: 40,
46
+ weapon: 'Battleaxe',
47
+ backstory: 'Hails from a tribe in the frozen north.',
48
+ favoriteMeal: 'Grilled salmon',
49
+ },
50
+ {
51
+ name: 'Seraphina',
52
+ class: 'Bard',
53
+ age: 25,
54
+ weapon: 'Rapier',
55
+ backstory: 'A wandering minstrel with a mysterious past.',
56
+ favoriteMeal: 'Apple pie',
57
+ },
58
+ {
59
+ name: 'Kael',
60
+ class: 'Druid',
61
+ age: 75,
62
+ weapon: 'Scimitar',
63
+ backstory: 'A guardian of the natural world.',
64
+ favoriteMeal: 'Berry tart',
65
+ },
66
+ {
67
+ name: 'Aria',
68
+ class: 'Paladin',
69
+ age: 30,
70
+ weapon: 'Longsword',
71
+ backstory: 'A knight on a divine mission.',
72
+ favoriteMeal: 'Roasted chicken',
73
+ },
74
+ {
75
+ name: 'Xan',
76
+ class: 'Warlock',
77
+ age: 45,
78
+ weapon: 'Pact Blade',
79
+ backstory: 'Made a pact with a powerful entity for magic.',
80
+ favoriteMeal: 'Stuffed peppers',
81
+ },
82
+ {
83
+ name: 'Lyra',
84
+ class: 'Sorcerer',
85
+ age: 28,
86
+ weapon: 'Dagger',
87
+ backstory: 'Born with innate magical abilities.',
88
+ favoriteMeal: 'Pancakes with syrup',
89
+ },
90
+ {
91
+ name: 'Thorn',
92
+ class: 'Monk',
93
+ age: 50,
94
+ weapon: 'Quarterstaff',
95
+ backstory: 'A hermit who seeks enlightenment.',
96
+ favoriteMeal: 'Rice and vegetables',
97
+ },
98
+ {
99
+ name: 'Cassia',
100
+ class: 'Ranger',
101
+ age: 32,
102
+ weapon: 'Shortbow',
103
+ backstory: 'A hunter with a keen eye.',
104
+ favoriteMeal: 'Roasted pheasant',
105
+ },
106
+ {
107
+ name: 'Darius',
108
+ class: 'Fighter',
109
+ age: 36,
110
+ weapon: 'Longsword',
111
+ backstory: 'A mercenary with a heart of gold.',
112
+ favoriteMeal: 'Beef stew',
113
+ },
114
+ {
115
+ name: 'Iris',
116
+ class: 'Cleric',
117
+ age: 60,
118
+ weapon: 'Warhammer',
119
+ backstory: 'A healer devoted to the god of light.',
120
+ favoriteMeal: 'Fresh bread and soup',
121
+ },
122
+ {
123
+ name: 'Fenrir',
124
+ class: 'Barbarian',
125
+ age: 42,
126
+ weapon: 'Greataxe',
127
+ backstory: 'A warrior from a distant land.',
128
+ favoriteMeal: 'Grilled steak',
129
+ },
130
+ {
131
+ name: 'Luna',
132
+ class: 'Druid',
133
+ age: 70,
134
+ weapon: 'Sickle',
135
+ backstory: 'A protector of the natural world.',
136
+ favoriteMeal: 'Fruit salad',
137
+ },
138
+ {
139
+ name: 'Orion',
140
+ class: 'Paladin',
141
+ age: 33,
142
+ weapon: 'Halberd',
143
+ backstory: 'A knight on a holy quest.',
144
+ favoriteMeal: 'Roasted lamb',
145
+ },
146
+ {
147
+ name: 'Astra',
148
+ class: 'Bard',
149
+ age: 26,
150
+ weapon: 'Lute',
151
+ backstory: 'A musician with a magical voice.',
152
+ favoriteMeal: 'Honey cake',
153
+ },
154
+ {
155
+ name: 'Zephyr',
156
+ class: 'Rogue',
157
+ age: 29,
158
+ weapon: 'Shortsword',
159
+ backstory: 'A thief with a quick hand.',
160
+ favoriteMeal: 'Fish and chips',
161
+ },
162
+ ];
package/src/index.ts CHANGED
@@ -24,7 +24,6 @@ export {
24
24
  CirclePulse,
25
25
  CircleSpinner,
26
26
  ConfirmModal,
27
- Drawer,
28
27
  DatePicker,
29
28
  EditableInput,
30
29
  IconButton,
@@ -29,7 +29,6 @@ export { Pagination } from './Pagination';
29
29
  export { Shrug } from './user-feedback';
30
30
  export { ConfirmModal, ModalBase } from './modals';
31
31
  export { LoadingAwareContainer } from './LoadingAwareContainer';
32
- export { Drawer } from './Navigation/Drawer';
33
32
  export { TextTruncate } from './text-truncate';
34
33
  export { Toggle } from './Toggle';
35
34
  export { Tooltip } from './Tooltip';
@@ -2,11 +2,10 @@
2
2
  @import 'variables/index.scss';
3
3
 
4
4
  // Components
5
- @import '../legacy/components/Navigation/Drawer/Drawer.scss';
6
5
  @import '../components/button/styles/Button.scss';
7
6
  @import '../components/icons/styles/Icon.scss';
7
+ @import '../components/tables/table/Table.scss';
8
8
 
9
- // Helper Classes
10
9
  @import 'typography';
11
10
  @import 'colors';
12
11
  @import 'borders';
package/src/types.ts CHANGED
@@ -8,10 +8,5 @@ export type PermafrostComponent = {
8
8
  export type ButtonVariant = 'default' | 'primary' | 'destructive';
9
9
  export type ButtonSize = 'normal' | 'large';
10
10
 
11
- // Component types -- TODO -- move to their own files
12
- import { ListItem } from './legacy/components/Navigation/Drawer/types';
13
-
14
- export type { ListItem };
15
-
16
11
  import { IconName } from '../build/generated/iconTypes';
17
12
  export type { IconName };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { IconName, PermafrostComponent } from '@/types';
3
- import { ListItem } from './types';
4
- import './Drawer.scss';
5
- type Props = PermafrostComponent & {
6
- style?: React.CSSProperties;
7
- logoText?: string;
8
- logoIcon?: IconName;
9
- headerComponent?: React.ReactNode;
10
- navigationItems?: ListItem[];
11
- footerItems?: ListItem[];
12
- expandedWidth?: string;
13
- collapsedWidth?: string;
14
- };
15
- export declare const Drawer: (props: Props) => import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Drawer } from '@/legacy/components/Navigation/Drawer';
3
- declare const meta: Meta<typeof Drawer>;
4
- export default meta;
5
- type Story = StoryObj<typeof Drawer>;
6
- export declare const Normal: Story;
@@ -1,9 +0,0 @@
1
- import { PermafrostComponent } from '@/types';
2
- import { ListItem } from './types';
3
- type Props = PermafrostComponent & {
4
- style?: object;
5
- listItems?: ListItem[];
6
- isOpen: boolean;
7
- };
8
- export declare const DrawerLinkList: (props: Props) => import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledDrawerLinkList: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -1,3 +0,0 @@
1
- import { ListItem } from '../types';
2
- export declare const navigationItems: ListItem[];
3
- export declare const footerItems: ListItem[];
@@ -1 +0,0 @@
1
- export { Drawer } from './Drawer';
@@ -1,7 +0,0 @@
1
- import { IconName } from '@/types';
2
- export type ListItem = {
3
- id: string;
4
- icon: IconName;
5
- label: string;
6
- path: string;
7
- };
@@ -1 +0,0 @@
1
- export { Drawer } from './Drawer';
@@ -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
- `;