@qoretechnologies/reqore 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tests.json +1 -1
- package/.eslintrc.js +0 -40
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
- package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
- package/.github/workflows/beta_release.yml +0 -100
- package/.github/workflows/tests.yml +0 -84
- package/.gitpod.yml +0 -11
- package/.jest-test-results.json +0 -1
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -0
- package/__tests__/breadcrumbs.test.tsx +0 -75
- package/__tests__/button.test.tsx +0 -218
- package/__tests__/checkbox.test.tsx +0 -45
- package/__tests__/collection.test.tsx +0 -243
- package/__tests__/containers/paging.test.tsx +0 -138
- package/__tests__/control_group.test.tsx +0 -32
- package/__tests__/drawer.test.tsx +0 -140
- package/__tests__/dropdown.test.tsx +0 -381
- package/__tests__/effect.test.tsx +0 -70
- package/__tests__/heading.test.tsx +0 -58
- package/__tests__/helpers/colors.test.tsx +0 -18
- package/__tests__/helpers/table.test.tsx +0 -67
- package/__tests__/hooks/useLatestZIndex.test.tsx +0 -10
- package/__tests__/hooks/useReqorePaging.test.tsx +0 -271
- package/__tests__/hooks/useTheme.test.tsx +0 -31
- package/__tests__/icon.test.tsx +0 -53
- package/__tests__/input.test.tsx +0 -482
- package/__tests__/layout.test.tsx +0 -37
- package/__tests__/menu.test.tsx +0 -65
- package/__tests__/messages.test.tsx +0 -79
- package/__tests__/modal.test.tsx +0 -204
- package/__tests__/multiselect.test.tsx +0 -458
- package/__tests__/navbar.test.tsx +0 -31
- package/__tests__/notifications.test.tsx +0 -178
- package/__tests__/pagination.test.tsx +0 -437
- package/__tests__/panel.test.tsx +0 -243
- package/__tests__/popover.test.tsx +0 -282
- package/__tests__/radiogroup.test.tsx +0 -47
- package/__tests__/setup.js +0 -8
- package/__tests__/stories/Collection.stories.tsx +0 -0
- package/__tests__/table.test.tsx +0 -647
- package/__tests__/tabs.test.tsx +0 -321
- package/__tests__/tag.test.tsx +0 -160
- package/__tests__/textarea.test.tsx +0 -467
- package/__tests__/timeAgo.test.tsx +0 -27
- package/__tests__/tree.test.tsx +0 -58
- package/build-storybook.log +0 -491
- package/chromatic.config.json +0 -1
- package/icons.ts +0 -1
- package/migration-storybook.log +0 -56
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol-small.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Breadcrumbs/index.tsx +0 -254
- package/src/components/Breadcrumbs/item.tsx +0 -44
- package/src/components/Button/index.tsx +0 -633
- package/src/components/Checkbox/index.tsx +0 -388
- package/src/components/Collection/index.tsx +0 -426
- package/src/components/Collection/item.tsx +0 -267
- package/src/components/Columns/column.tsx +0 -27
- package/src/components/Columns/index.tsx +0 -41
- package/src/components/Comment/index.tsx +0 -141
- package/src/components/CommentFeed/index.tsx +0 -34
- package/src/components/Content/index.tsx +0 -34
- package/src/components/Content/wrapper.tsx +0 -36
- package/src/components/ControlGroup/index.tsx +0 -523
- package/src/components/DatePicker/index.tsx +0 -347
- package/src/components/Drawer/backdrop.tsx +0 -54
- package/src/components/Drawer/index.tsx +0 -365
- package/src/components/Dropdown/index.tsx +0 -153
- package/src/components/Dropdown/item.tsx +0 -33
- package/src/components/Dropdown/list.tsx +0 -222
- package/src/components/Effect/index.tsx +0 -464
- package/src/components/ExportModal/index.tsx +0 -99
- package/src/components/Header/index.tsx +0 -81
- package/src/components/Icon/index.tsx +0 -184
- package/src/components/Input/index.tsx +0 -295
- package/src/components/InputClearButton/index.tsx +0 -59
- package/src/components/InternalPopover/index.tsx +0 -303
- package/src/components/KeyValueTable/index.tsx +0 -192
- package/src/components/Label/index.tsx +0 -10
- package/src/components/Layout/content.tsx +0 -31
- package/src/components/Layout/index.tsx +0 -55
- package/src/components/Menu/divider.tsx +0 -92
- package/src/components/Menu/index.tsx +0 -141
- package/src/components/Menu/item.tsx +0 -137
- package/src/components/Menu/section.tsx +0 -81
- package/src/components/Message/index.tsx +0 -220
- package/src/components/Modal/index.tsx +0 -26
- package/src/components/MultiSelect/index.tsx +0 -288
- package/src/components/Navbar/divider.tsx +0 -50
- package/src/components/Navbar/group.tsx +0 -53
- package/src/components/Navbar/index.tsx +0 -82
- package/src/components/Navbar/item.tsx +0 -92
- package/src/components/Notifications/index.tsx +0 -57
- package/src/components/Notifications/notification.tsx +0 -362
- package/src/components/Paging/index.tsx +0 -321
- package/src/components/Panel/LabelEditor.tsx +0 -67
- package/src/components/Panel/NonResponsiveActions.tsx +0 -79
- package/src/components/Panel/__screenshots__/linux/panel-SomePanel.png +0 -0
- package/src/components/Panel/index.tsx +0 -912
- package/src/components/Panel/panel.screenshot.tsx +0 -29
- package/src/components/Paragraph/index.tsx +0 -43
- package/src/components/Popover/index.tsx +0 -68
- package/src/components/RadioGroup/index.tsx +0 -71
- package/src/components/Slider/index.tsx +0 -358
- package/src/components/Spacer/index.tsx +0 -142
- package/src/components/Spinner/index.tsx +0 -74
- package/src/components/Table/body.tsx +0 -109
- package/src/components/Table/cell.tsx +0 -136
- package/src/components/Table/header.tsx +0 -236
- package/src/components/Table/headerCell.tsx +0 -203
- package/src/components/Table/helpers.ts +0 -308
- package/src/components/Table/index.tsx +0 -797
- package/src/components/Table/row.tsx +0 -288
- package/src/components/Table/value.tsx +0 -28
- package/src/components/Tabs/content.tsx +0 -68
- package/src/components/Tabs/index.tsx +0 -124
- package/src/components/Tabs/item.tsx +0 -198
- package/src/components/Tabs/list.tsx +0 -381
- package/src/components/Tag/group.tsx +0 -73
- package/src/components/Tag/index.tsx +0 -463
- package/src/components/Textarea/index.tsx +0 -277
- package/src/components/TimeAgo/index.tsx +0 -15
- package/src/components/Tree/index.tsx +0 -271
- package/src/constants/animations.ts +0 -9
- package/src/constants/colors.ts +0 -13
- package/src/constants/paging.ts +0 -93
- package/src/constants/sizes.ts +0 -185
- package/src/constants/theme.ts +0 -122
- package/src/containers/Paging.tsx +0 -136
- package/src/containers/PopoverProvider.tsx +0 -124
- package/src/containers/ReqoreProvider.tsx +0 -289
- package/src/containers/ThemeProvider.tsx +0 -12
- package/src/containers/UIProvider.tsx +0 -101
- package/src/context/PopoverContext.tsx +0 -11
- package/src/context/ReqoreContext.tsx +0 -47
- package/src/context/ThemeContext.tsx +0 -4
- package/src/helpers/animations.ts +0 -13
- package/src/helpers/colors.ts +0 -335
- package/src/helpers/time.ts +0 -21
- package/src/helpers/utils.ts +0 -152
- package/src/hooks/useAutoFocus.ts +0 -106
- package/src/hooks/useCloneThroughFragments.ts +0 -39
- package/src/hooks/useCombinedRefs.ts +0 -26
- package/src/hooks/useLatestZIndex.ts +0 -13
- package/src/hooks/useOutsideClick.ts +0 -29
- package/src/hooks/usePaging.ts +0 -128
- package/src/hooks/usePopover.tsx +0 -220
- package/src/hooks/useQueryWithDelay.ts +0 -30
- package/src/hooks/useReqore.ts +0 -12
- package/src/hooks/useReqoreContext.ts +0 -16
- package/src/hooks/useReqoreEffect.ts +0 -49
- package/src/hooks/useTextareaAutoSize.ts +0 -22
- package/src/hooks/useTheme.ts +0 -48
- package/src/hooks/useTooltip.ts +0 -40
- package/src/hooks/useWhyDidYouUpdate.ts +0 -32
- package/src/icons.json +0 -2295
- package/src/index.tsx +0 -80
- package/src/mock/breadcrumbs.ts +0 -146
- package/src/mock/collectionData.tsx +0 -380
- package/src/mock/data.json +0 -11000
- package/src/mock/icons.ts +0 -32
- package/src/mock/menu.ts +0 -93
- package/src/mock/multiSelect.ts +0 -71
- package/src/mock/object.json +0 -317
- package/src/mock/styleMock.js +0 -1
- package/src/mock/tableData.ts +0 -64
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -27
- package/src/stories/Button/Button.stories.tsx +0 -405
- package/src/stories/Checkbox/Checkbox.stories.tsx +0 -75
- package/src/stories/Collection/Collection.stories.tsx +0 -317
- package/src/stories/Columns/Columns.stories.tsx +0 -158
- package/src/stories/Comment/Comment.stories.tsx +0 -136
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +0 -399
- package/src/stories/DatePicker/DatePicker.stories.tsx +0 -348
- package/src/stories/Drawer/Drawer.stories.tsx +0 -294
- package/src/stories/Dropdown/Dropdown.stories.tsx +0 -375
- package/src/stories/Dropdown/DropdownTests.stories.tsx +0 -111
- package/src/stories/ExportModal/ExportModal.stories.tsx +0 -18
- package/src/stories/Header/Header.stories.tsx +0 -108
- package/src/stories/Icon/Icon.stories.tsx +0 -162
- package/src/stories/Input/Input.stories.tsx +0 -220
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +0 -346
- package/src/stories/Label/Label.stories.tsx +0 -33
- package/src/stories/Menu/Menu.stories.tsx +0 -367
- package/src/stories/Message/Message.stories.tsx +0 -167
- package/src/stories/Modal/Manager.stories.tsx +0 -192
- package/src/stories/Modal/Modal.stories.tsx +0 -252
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +0 -140
- package/src/stories/Navbar/Navbar.stories.tsx +0 -119
- package/src/stories/Notifications/Interactive.stories.tsx +0 -117
- package/src/stories/Notifications/Notification.stories.tsx +0 -216
- package/src/stories/Notifications/Notifications.stories.tsx +0 -81
- package/src/stories/Paging/Paging.stories.tsx +0 -255
- package/src/stories/Panel/Panel.stories.tsx +0 -753
- package/src/stories/Paragraph/Paragraph.stories.tsx +0 -108
- package/src/stories/Popover/Popover.stories.tsx +0 -510
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +0 -212
- package/src/stories/Slider/Slider.stories.tsx +0 -173
- package/src/stories/Spacer/Spacer.stories.tsx +0 -100
- package/src/stories/Spinner/Spinner.stories.tsx +0 -82
- package/src/stories/Table/Table.stories.tsx +0 -571
- package/src/stories/Tabs/Tabs.stories.tsx +0 -346
- package/src/stories/Tag/Tag.stories.tsx +0 -381
- package/src/stories/Tag/TagGroup.stories.tsx +0 -307
- package/src/stories/TextArea/TextArea.stories.tsx +0 -287
- package/src/stories/TextArea/TextAreaTests.stories.tsx +0 -108
- package/src/stories/Tree/Tree.stories.tsx +0 -124
- package/src/stories/Wrapper.tsx +0 -13
- package/src/stories/utils/args.ts +0 -151
- package/src/stories/utils.ts +0 -39
- package/src/styles.ts +0 -124
- package/src/types/global.ts +0 -211
- package/src/types/icons.ts +0 -2272
- package/tsconfig.prod.json +0 -26
package/src/constants/sizes.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
export type TSizes = 'tiny' | 'small' | 'normal' | 'big' | 'huge';
|
|
2
|
-
export type TWeights = 'soft' | 'normal' | 'heavy';
|
|
3
|
-
|
|
4
|
-
export const ReqoreSizes = {
|
|
5
|
-
TINY: 'tiny',
|
|
6
|
-
SMALL: 'small',
|
|
7
|
-
NORMAL: 'normal',
|
|
8
|
-
BIG: 'big',
|
|
9
|
-
HUGE: 'huge',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const SIZES = ['tiny', 'small', 'normal', 'big', 'huge'] as const;
|
|
13
|
-
|
|
14
|
-
export const SIZE_TO_MODIFIER = {
|
|
15
|
-
tiny: 0.6,
|
|
16
|
-
small: 0.8,
|
|
17
|
-
normal: 1,
|
|
18
|
-
big: 1.2,
|
|
19
|
-
huge: 1.4,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const LINE_SIZE_TO_NUMBER = {
|
|
23
|
-
none: 0,
|
|
24
|
-
tiny: 1,
|
|
25
|
-
small: 1,
|
|
26
|
-
normal: 1.5,
|
|
27
|
-
big: 2,
|
|
28
|
-
huge: 3,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const SIZE_TO_NUMBER = {
|
|
32
|
-
none: 0,
|
|
33
|
-
tiny: 1,
|
|
34
|
-
small: 2,
|
|
35
|
-
normal: 3,
|
|
36
|
-
big: 4,
|
|
37
|
-
huge: 5,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const NUMBER_TO_SIZE = {
|
|
41
|
-
1: 'tiny',
|
|
42
|
-
2: 'small',
|
|
43
|
-
3: 'normal',
|
|
44
|
-
4: 'big',
|
|
45
|
-
5: 'huge',
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const HEADER_SIZE_TO_NUMBER = {
|
|
49
|
-
tiny: 5,
|
|
50
|
-
small: 4,
|
|
51
|
-
normal: 3,
|
|
52
|
-
big: 2,
|
|
53
|
-
huge: 1,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const SIZE_TO_PX = {
|
|
57
|
-
tiny: 18,
|
|
58
|
-
small: 24,
|
|
59
|
-
normal: 30,
|
|
60
|
-
big: 40,
|
|
61
|
-
huge: 50,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const BADGE_SIZE_TO_PX = {
|
|
65
|
-
tiny: 14,
|
|
66
|
-
small: 20,
|
|
67
|
-
normal: 26,
|
|
68
|
-
big: 32,
|
|
69
|
-
huge: 38,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const TABS_SIZE_TO_PX = {
|
|
73
|
-
tiny: 20,
|
|
74
|
-
small: 30,
|
|
75
|
-
normal: 40,
|
|
76
|
-
big: 50,
|
|
77
|
-
huge: 60,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const TABLE_SIZE_TO_PX = {
|
|
81
|
-
tiny: 20,
|
|
82
|
-
small: 30,
|
|
83
|
-
normal: 40,
|
|
84
|
-
big: 50,
|
|
85
|
-
huge: 60,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const TABS_PADDING_TO_PX = {
|
|
89
|
-
tiny: 5,
|
|
90
|
-
small: 5,
|
|
91
|
-
normal: 5,
|
|
92
|
-
big: 5,
|
|
93
|
-
huge: 5,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const MARGIN_FROM_SIZE = {
|
|
97
|
-
tiny: 0,
|
|
98
|
-
small: 0,
|
|
99
|
-
normal: 10,
|
|
100
|
-
big: 20,
|
|
101
|
-
huge: 30,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const TEXT_FROM_SIZE = {
|
|
105
|
-
tiny: 9,
|
|
106
|
-
small: 12,
|
|
107
|
-
normal: 15,
|
|
108
|
-
big: 18,
|
|
109
|
-
huge: 21,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const CONTROL_TEXT_FROM_SIZE = {
|
|
113
|
-
tiny: 7,
|
|
114
|
-
small: 10,
|
|
115
|
-
normal: 13,
|
|
116
|
-
big: 16,
|
|
117
|
-
huge: 19,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const ICON_FROM_SIZE = {
|
|
121
|
-
tiny: 13,
|
|
122
|
-
small: 17,
|
|
123
|
-
normal: 20,
|
|
124
|
-
big: 26,
|
|
125
|
-
huge: 33,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export const HALF_PADDING_FROM_SIZE = {
|
|
129
|
-
tiny: 2,
|
|
130
|
-
small: 4,
|
|
131
|
-
normal: 5,
|
|
132
|
-
big: 7,
|
|
133
|
-
huge: 9,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const PADDING_FROM_SIZE = {
|
|
137
|
-
tiny: 5,
|
|
138
|
-
small: 8,
|
|
139
|
-
normal: 11,
|
|
140
|
-
big: 14,
|
|
141
|
-
huge: 17,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export const RADIUS_FROM_SIZE = {
|
|
145
|
-
tiny: 4,
|
|
146
|
-
small: 5,
|
|
147
|
-
normal: 5.5,
|
|
148
|
-
big: 7,
|
|
149
|
-
huge: 9,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export const GAP_FROM_SIZE = {
|
|
153
|
-
tiny: 1,
|
|
154
|
-
small: 3,
|
|
155
|
-
normal: 5,
|
|
156
|
-
big: 18,
|
|
157
|
-
huge: 30,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export const ICON_FROM_HEADER_SIZE = {
|
|
161
|
-
1: 23,
|
|
162
|
-
2: 20,
|
|
163
|
-
3: 17,
|
|
164
|
-
4: 14,
|
|
165
|
-
5: 11,
|
|
166
|
-
6: 8,
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export const ICON_WRAPPER_FROM_HEADER_SIZE = {
|
|
170
|
-
huge: 34,
|
|
171
|
-
big: 26,
|
|
172
|
-
normal: 19,
|
|
173
|
-
small: 17,
|
|
174
|
-
tiny: 15,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const WEIGHT_TO_NUMBER = {
|
|
178
|
-
thin: 100,
|
|
179
|
-
light: 250,
|
|
180
|
-
normal: 400,
|
|
181
|
-
bold: 550,
|
|
182
|
-
thick: 700,
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export const PILL_RADIUS_MODIFIER = 2.5;
|
package/src/constants/theme.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TReqoreEffectColor,
|
|
3
|
-
TReqoreEffectGradientAnimationTrigger,
|
|
4
|
-
TReqoreHexColor,
|
|
5
|
-
} from '../components/Effect';
|
|
6
|
-
import { Colors } from './colors';
|
|
7
|
-
|
|
8
|
-
export interface IReqoreSidebarTheme {
|
|
9
|
-
main?: TReqoreHexColor;
|
|
10
|
-
color?: TReqoreHexColor;
|
|
11
|
-
border?: TReqoreHexColor;
|
|
12
|
-
item?: {
|
|
13
|
-
color?: TReqoreHexColor;
|
|
14
|
-
background?: TReqoreHexColor;
|
|
15
|
-
border?: TReqoreHexColor;
|
|
16
|
-
hoverColor?: TReqoreHexColor;
|
|
17
|
-
hoverBackground?: TReqoreHexColor;
|
|
18
|
-
activeColor?: TReqoreHexColor;
|
|
19
|
-
activeBackground?: TReqoreHexColor;
|
|
20
|
-
};
|
|
21
|
-
subItem?: {
|
|
22
|
-
color?: TReqoreHexColor;
|
|
23
|
-
border?: TReqoreHexColor;
|
|
24
|
-
background?: TReqoreHexColor;
|
|
25
|
-
hoverColor?: TReqoreHexColor;
|
|
26
|
-
hoverBackground?: TReqoreHexColor;
|
|
27
|
-
activeColor?: TReqoreHexColor;
|
|
28
|
-
activeBackground?: TReqoreHexColor;
|
|
29
|
-
};
|
|
30
|
-
icon?: {
|
|
31
|
-
color?: TReqoreHexColor;
|
|
32
|
-
hoverColor?: TReqoreHexColor;
|
|
33
|
-
activeColor?: TReqoreHexColor;
|
|
34
|
-
};
|
|
35
|
-
section?: {
|
|
36
|
-
background?: TReqoreHexColor;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface IReqoreBreadcrumbsTheme {
|
|
41
|
-
main?: TReqoreHexColor;
|
|
42
|
-
item?: {
|
|
43
|
-
color?: TReqoreHexColor;
|
|
44
|
-
hoverColor?: TReqoreHexColor;
|
|
45
|
-
activeColor?: TReqoreHexColor;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface IReqoreNavbarTheme {
|
|
50
|
-
main?: TReqoreHexColor;
|
|
51
|
-
color?: TReqoreHexColor;
|
|
52
|
-
border?: TReqoreHexColor;
|
|
53
|
-
background?: TReqoreHexColor;
|
|
54
|
-
hoverColor?: TReqoreHexColor;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface IReqoreTheme {
|
|
58
|
-
main: TReqoreHexColor;
|
|
59
|
-
originalMain?: TReqoreHexColor;
|
|
60
|
-
text?: {
|
|
61
|
-
color?: TReqoreHexColor;
|
|
62
|
-
dim?: boolean;
|
|
63
|
-
};
|
|
64
|
-
intents: IReqoreIntents;
|
|
65
|
-
sidebar?: IReqoreSidebarTheme;
|
|
66
|
-
notifications: IReqoreIntents;
|
|
67
|
-
popover?: {
|
|
68
|
-
main: TReqoreHexColor;
|
|
69
|
-
};
|
|
70
|
-
header?: IReqoreNavbarTheme;
|
|
71
|
-
footer?: IReqoreNavbarTheme;
|
|
72
|
-
breadcrumbs?: IReqoreBreadcrumbsTheme;
|
|
73
|
-
buttons?: IReqoreCustomTheme;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface IReqoreCustomTheme {
|
|
77
|
-
main?: TReqoreEffectColor;
|
|
78
|
-
text?: {
|
|
79
|
-
color?: TReqoreEffectColor;
|
|
80
|
-
dim?: boolean;
|
|
81
|
-
};
|
|
82
|
-
gradient?: boolean;
|
|
83
|
-
animate?: TReqoreEffectGradientAnimationTrigger;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface IReqoreIntents {
|
|
87
|
-
info?: TReqoreHexColor;
|
|
88
|
-
success?: TReqoreHexColor;
|
|
89
|
-
pending?: TReqoreHexColor;
|
|
90
|
-
warning?: TReqoreHexColor;
|
|
91
|
-
danger?: TReqoreHexColor;
|
|
92
|
-
muted?: TReqoreHexColor;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type TReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
|
|
96
|
-
|
|
97
|
-
export const DEFAULT_INTENTS: IReqoreIntents = {
|
|
98
|
-
info: Colors.BLUE,
|
|
99
|
-
success: Colors.GREEN,
|
|
100
|
-
pending: Colors.YELLOW,
|
|
101
|
-
warning: Colors.ORANGE,
|
|
102
|
-
danger: Colors.RED,
|
|
103
|
-
muted: Colors.GRAY,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const DEFAULT_THEME: IReqoreTheme = {
|
|
107
|
-
main: Colors.DARK_THEME,
|
|
108
|
-
text: {
|
|
109
|
-
dim: true,
|
|
110
|
-
},
|
|
111
|
-
intents: DEFAULT_INTENTS,
|
|
112
|
-
notifications: {},
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const ReqoreIntents: { [key: string]: TReqoreIntent } = {
|
|
116
|
-
INFO: 'info',
|
|
117
|
-
SUCCESS: 'success',
|
|
118
|
-
PENDING: 'pending',
|
|
119
|
-
WARNING: 'warning',
|
|
120
|
-
DANGER: 'danger',
|
|
121
|
-
MUTED: 'muted',
|
|
122
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { memo, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
IReqorePaginationComponentProps,
|
|
4
|
-
IReqorePaginationProps,
|
|
5
|
-
ReqorePagination,
|
|
6
|
-
} from '../components/Paging';
|
|
7
|
-
import { ReqoreVerticalSpacer } from '../components/Spacer';
|
|
8
|
-
import {
|
|
9
|
-
getPaginationOptionsFromType,
|
|
10
|
-
TReqorePaginationType,
|
|
11
|
-
TReqorePaginationTypeResult,
|
|
12
|
-
} from '../constants/paging';
|
|
13
|
-
import { PADDING_FROM_SIZE, TSizes } from '../constants/sizes';
|
|
14
|
-
import { IReqorePagingResult, useReqorePaging } from '../hooks/usePaging';
|
|
15
|
-
|
|
16
|
-
export interface IReqorePagingContainerProps<T> {
|
|
17
|
-
type?: TReqorePaginationType<T>;
|
|
18
|
-
items: T[];
|
|
19
|
-
scrollContainer?: IReqorePaginationComponentProps['scrollContainer'];
|
|
20
|
-
children: (
|
|
21
|
-
items: T[],
|
|
22
|
-
Controls: JSX.Element,
|
|
23
|
-
options: TReqorePaginationTypeResult<T>
|
|
24
|
-
) => React.ReactNode;
|
|
25
|
-
size?: TSizes;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function PagingControls<T>({
|
|
29
|
-
withSpacer,
|
|
30
|
-
position,
|
|
31
|
-
pagingData,
|
|
32
|
-
componentOptions,
|
|
33
|
-
scrollContainer,
|
|
34
|
-
size,
|
|
35
|
-
...pagingProps
|
|
36
|
-
}: Partial<IReqorePaginationProps<T>> &
|
|
37
|
-
Partial<TReqorePaginationTypeResult<T>> & {
|
|
38
|
-
withSpacer?: boolean;
|
|
39
|
-
position?: 'top' | 'bottom';
|
|
40
|
-
pagingData: Omit<IReqorePagingResult<T>, 'items'>;
|
|
41
|
-
}) {
|
|
42
|
-
return pagingData.renderControls ? (
|
|
43
|
-
<>
|
|
44
|
-
{withSpacer && position === 'bottom' ? (
|
|
45
|
-
<ReqoreVerticalSpacer height={PADDING_FROM_SIZE[size]} />
|
|
46
|
-
) : null}
|
|
47
|
-
<ReqorePagination
|
|
48
|
-
key={`reqore-pagination-${position}`}
|
|
49
|
-
size={size}
|
|
50
|
-
{...pagingData}
|
|
51
|
-
{...componentOptions}
|
|
52
|
-
scrollContainer={scrollContainer}
|
|
53
|
-
{...pagingProps}
|
|
54
|
-
/>
|
|
55
|
-
{withSpacer && position === 'top' ? (
|
|
56
|
-
<ReqoreVerticalSpacer height={PADDING_FROM_SIZE[size]} />
|
|
57
|
-
) : null}
|
|
58
|
-
</>
|
|
59
|
-
) : null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function PagingContainer<T>({
|
|
63
|
-
type,
|
|
64
|
-
items,
|
|
65
|
-
scrollContainer,
|
|
66
|
-
children,
|
|
67
|
-
size = 'normal',
|
|
68
|
-
}: IReqorePagingContainerProps<T>) {
|
|
69
|
-
const {
|
|
70
|
-
pagingOptions = {},
|
|
71
|
-
componentOptions = {},
|
|
72
|
-
pageControlsPosition = 'bottom',
|
|
73
|
-
includeTopControls = true,
|
|
74
|
-
includeBottomControls = true,
|
|
75
|
-
} = useMemo(() => getPaginationOptionsFromType(type), [type]);
|
|
76
|
-
|
|
77
|
-
const { items: finalItems, ...pagingData } = useReqorePaging({
|
|
78
|
-
items,
|
|
79
|
-
...pagingOptions,
|
|
80
|
-
enabled: !!type,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<>
|
|
85
|
-
{includeTopControls && (pageControlsPosition === 'top' || pageControlsPosition === 'both') ? (
|
|
86
|
-
<PagingControls<T>
|
|
87
|
-
key='top-paging'
|
|
88
|
-
position='top'
|
|
89
|
-
withSpacer
|
|
90
|
-
scrollContainer={scrollContainer}
|
|
91
|
-
size={size}
|
|
92
|
-
pagingData={pagingData}
|
|
93
|
-
pagingOptions={pagingOptions}
|
|
94
|
-
componentOptions={componentOptions}
|
|
95
|
-
autoLoadMore={false}
|
|
96
|
-
scrollOnLoadMore={false}
|
|
97
|
-
/>
|
|
98
|
-
) : null}
|
|
99
|
-
|
|
100
|
-
{children(
|
|
101
|
-
finalItems,
|
|
102
|
-
<PagingControls
|
|
103
|
-
key='custom-paging'
|
|
104
|
-
scrollContainer={scrollContainer}
|
|
105
|
-
size={size}
|
|
106
|
-
pagingData={pagingData}
|
|
107
|
-
pagingOptions={pagingOptions}
|
|
108
|
-
componentOptions={componentOptions}
|
|
109
|
-
/>,
|
|
110
|
-
{
|
|
111
|
-
pagingOptions,
|
|
112
|
-
componentOptions,
|
|
113
|
-
pageControlsPosition,
|
|
114
|
-
includeTopControls,
|
|
115
|
-
includeBottomControls,
|
|
116
|
-
}
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
{includeBottomControls &&
|
|
120
|
-
(pageControlsPosition === 'bottom' || pageControlsPosition === 'both') ? (
|
|
121
|
-
<PagingControls<T>
|
|
122
|
-
key='bottom-paging'
|
|
123
|
-
position='bottom'
|
|
124
|
-
withSpacer
|
|
125
|
-
scrollContainer={scrollContainer}
|
|
126
|
-
size={size}
|
|
127
|
-
pagingData={pagingData}
|
|
128
|
-
pagingOptions={pagingOptions}
|
|
129
|
-
componentOptions={componentOptions}
|
|
130
|
-
/>
|
|
131
|
-
) : null}
|
|
132
|
-
</>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export const ReqorePaginationContainer = memo(PagingContainer) as typeof PagingContainer;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { size } from 'lodash';
|
|
2
|
-
import React, { MutableRefObject, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { useReqoreProperty } from '..';
|
|
4
|
-
import Popover from '../components/InternalPopover';
|
|
5
|
-
import PopoverContext from '../context/PopoverContext';
|
|
6
|
-
import { IPopoverOptions } from '../hooks/usePopover';
|
|
7
|
-
|
|
8
|
-
export interface IReqorePopoverProviderProps {
|
|
9
|
-
children: any;
|
|
10
|
-
uiScale?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IPopoverData extends IPopoverOptions {
|
|
14
|
-
id: string;
|
|
15
|
-
popperRef?: MutableRefObject<any>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const PopoverProvider: React.FC<IReqorePopoverProviderProps> = ({ children, uiScale }) => {
|
|
19
|
-
const [popovers, setPopovers] = useState<IPopoverData[]>([]);
|
|
20
|
-
const closePopoversOnEscPress = useReqoreProperty('closePopoversOnEscPress');
|
|
21
|
-
|
|
22
|
-
const handleClick = useCallback(
|
|
23
|
-
(event: MouseEvent) => {
|
|
24
|
-
popovers.forEach(({ popperRef, closeOnAnyClick, closeOnOutsideClick, id, targetElement }) => {
|
|
25
|
-
if (closeOnAnyClick) {
|
|
26
|
-
removePopover(id);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
closeOnOutsideClick &&
|
|
32
|
-
!(popperRef?.current && popperRef.current.contains(event.target)) &&
|
|
33
|
-
!targetElement?.contains(event.target as Node)
|
|
34
|
-
) {
|
|
35
|
-
removePopover(id);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
[popovers]
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
// Close last popover when ESC is pressed
|
|
43
|
-
const handleKeyDown = useCallback(
|
|
44
|
-
(event: KeyboardEvent) => {
|
|
45
|
-
if (event.key === 'Escape') {
|
|
46
|
-
const lastPopover = popovers[popovers.length - 1];
|
|
47
|
-
|
|
48
|
-
if (lastPopover) {
|
|
49
|
-
removePopover(lastPopover.id);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
[popovers]
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const removePopover = (id: string) => {
|
|
57
|
-
// Get the popover
|
|
58
|
-
const popover = popovers.find((p) => p.id === id);
|
|
59
|
-
|
|
60
|
-
if (popover) {
|
|
61
|
-
// Remove the blur
|
|
62
|
-
if (popover.blur) {
|
|
63
|
-
// Remove the blur
|
|
64
|
-
document.getElementById(`reqore-blur-${id}`)?.remove();
|
|
65
|
-
// Remove the z index class
|
|
66
|
-
popover.targetElement.classList.remove('reqore-blur-z-index');
|
|
67
|
-
}
|
|
68
|
-
// Remove the popover
|
|
69
|
-
setPopovers((cur: IPopoverData[]) => [...cur].filter((p) => p.id !== id));
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
document.addEventListener('click', handleClick, true);
|
|
75
|
-
|
|
76
|
-
if (closePopoversOnEscPress) {
|
|
77
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return () => {
|
|
81
|
-
document.removeEventListener('click', handleClick, true);
|
|
82
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
83
|
-
};
|
|
84
|
-
}, [popovers]);
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (!size(popovers)) {
|
|
88
|
-
document.removeEventListener('click', handleClick, true);
|
|
89
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
90
|
-
}
|
|
91
|
-
}, [popovers]);
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<PopoverContext.Provider
|
|
95
|
-
value={{
|
|
96
|
-
uiScale,
|
|
97
|
-
addPopover: (popoverData: IPopoverData) => {
|
|
98
|
-
setPopovers((cur: IPopoverData[]) => [...cur, popoverData]);
|
|
99
|
-
},
|
|
100
|
-
updatePopover: (popoverId: string, popoverData: Partial<IPopoverData>) => {
|
|
101
|
-
setPopovers((cur: IPopoverData[]) =>
|
|
102
|
-
[...cur].reduce<IPopoverData[]>((newPopovers, popover) => {
|
|
103
|
-
if (popover.id === popoverId) {
|
|
104
|
-
return [...newPopovers, { ...popover, ...popoverData }];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return [...newPopovers, popover];
|
|
108
|
-
}, [])
|
|
109
|
-
);
|
|
110
|
-
},
|
|
111
|
-
isPopoverOpen: (popoverId: string) => !!popovers.find((p) => p.id === popoverId),
|
|
112
|
-
removePopover,
|
|
113
|
-
popovers,
|
|
114
|
-
}}
|
|
115
|
-
>
|
|
116
|
-
{popovers.map((popover: IPopoverData) => (
|
|
117
|
-
<Popover {...popover} key={popover.id} />
|
|
118
|
-
))}
|
|
119
|
-
{children}
|
|
120
|
-
</PopoverContext.Provider>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default PopoverProvider;
|