@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.
Files changed (222) hide show
  1. package/package.json +1 -1
  2. package/tests.json +1 -1
  3. package/.eslintrc.js +0 -40
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  6. package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
  7. package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
  8. package/.github/workflows/beta_release.yml +0 -100
  9. package/.github/workflows/tests.yml +0 -84
  10. package/.gitpod.yml +0 -11
  11. package/.jest-test-results.json +0 -1
  12. package/.prettierrc +0 -7
  13. package/.vscode/settings.json +0 -0
  14. package/__tests__/breadcrumbs.test.tsx +0 -75
  15. package/__tests__/button.test.tsx +0 -218
  16. package/__tests__/checkbox.test.tsx +0 -45
  17. package/__tests__/collection.test.tsx +0 -243
  18. package/__tests__/containers/paging.test.tsx +0 -138
  19. package/__tests__/control_group.test.tsx +0 -32
  20. package/__tests__/drawer.test.tsx +0 -140
  21. package/__tests__/dropdown.test.tsx +0 -381
  22. package/__tests__/effect.test.tsx +0 -70
  23. package/__tests__/heading.test.tsx +0 -58
  24. package/__tests__/helpers/colors.test.tsx +0 -18
  25. package/__tests__/helpers/table.test.tsx +0 -67
  26. package/__tests__/hooks/useLatestZIndex.test.tsx +0 -10
  27. package/__tests__/hooks/useReqorePaging.test.tsx +0 -271
  28. package/__tests__/hooks/useTheme.test.tsx +0 -31
  29. package/__tests__/icon.test.tsx +0 -53
  30. package/__tests__/input.test.tsx +0 -482
  31. package/__tests__/layout.test.tsx +0 -37
  32. package/__tests__/menu.test.tsx +0 -65
  33. package/__tests__/messages.test.tsx +0 -79
  34. package/__tests__/modal.test.tsx +0 -204
  35. package/__tests__/multiselect.test.tsx +0 -458
  36. package/__tests__/navbar.test.tsx +0 -31
  37. package/__tests__/notifications.test.tsx +0 -178
  38. package/__tests__/pagination.test.tsx +0 -437
  39. package/__tests__/panel.test.tsx +0 -243
  40. package/__tests__/popover.test.tsx +0 -282
  41. package/__tests__/radiogroup.test.tsx +0 -47
  42. package/__tests__/setup.js +0 -8
  43. package/__tests__/stories/Collection.stories.tsx +0 -0
  44. package/__tests__/table.test.tsx +0 -647
  45. package/__tests__/tabs.test.tsx +0 -321
  46. package/__tests__/tag.test.tsx +0 -160
  47. package/__tests__/textarea.test.tsx +0 -467
  48. package/__tests__/timeAgo.test.tsx +0 -27
  49. package/__tests__/tree.test.tsx +0 -58
  50. package/build-storybook.log +0 -491
  51. package/chromatic.config.json +0 -1
  52. package/icons.ts +0 -1
  53. package/migration-storybook.log +0 -56
  54. package/public/logo-dark.png +0 -0
  55. package/public/logo.png +0 -0
  56. package/public/q-symbol-small.png +0 -0
  57. package/public/q-symbol.png +0 -0
  58. package/public/qoreLogo-dark.png +0 -0
  59. package/public/qoreLogo.png +0 -0
  60. package/src/components/Breadcrumbs/index.tsx +0 -254
  61. package/src/components/Breadcrumbs/item.tsx +0 -44
  62. package/src/components/Button/index.tsx +0 -633
  63. package/src/components/Checkbox/index.tsx +0 -388
  64. package/src/components/Collection/index.tsx +0 -426
  65. package/src/components/Collection/item.tsx +0 -267
  66. package/src/components/Columns/column.tsx +0 -27
  67. package/src/components/Columns/index.tsx +0 -41
  68. package/src/components/Comment/index.tsx +0 -141
  69. package/src/components/CommentFeed/index.tsx +0 -34
  70. package/src/components/Content/index.tsx +0 -34
  71. package/src/components/Content/wrapper.tsx +0 -36
  72. package/src/components/ControlGroup/index.tsx +0 -523
  73. package/src/components/DatePicker/index.tsx +0 -347
  74. package/src/components/Drawer/backdrop.tsx +0 -54
  75. package/src/components/Drawer/index.tsx +0 -365
  76. package/src/components/Dropdown/index.tsx +0 -153
  77. package/src/components/Dropdown/item.tsx +0 -33
  78. package/src/components/Dropdown/list.tsx +0 -222
  79. package/src/components/Effect/index.tsx +0 -464
  80. package/src/components/ExportModal/index.tsx +0 -99
  81. package/src/components/Header/index.tsx +0 -81
  82. package/src/components/Icon/index.tsx +0 -184
  83. package/src/components/Input/index.tsx +0 -295
  84. package/src/components/InputClearButton/index.tsx +0 -59
  85. package/src/components/InternalPopover/index.tsx +0 -303
  86. package/src/components/KeyValueTable/index.tsx +0 -192
  87. package/src/components/Label/index.tsx +0 -10
  88. package/src/components/Layout/content.tsx +0 -31
  89. package/src/components/Layout/index.tsx +0 -55
  90. package/src/components/Menu/divider.tsx +0 -92
  91. package/src/components/Menu/index.tsx +0 -141
  92. package/src/components/Menu/item.tsx +0 -137
  93. package/src/components/Menu/section.tsx +0 -81
  94. package/src/components/Message/index.tsx +0 -220
  95. package/src/components/Modal/index.tsx +0 -26
  96. package/src/components/MultiSelect/index.tsx +0 -288
  97. package/src/components/Navbar/divider.tsx +0 -50
  98. package/src/components/Navbar/group.tsx +0 -53
  99. package/src/components/Navbar/index.tsx +0 -82
  100. package/src/components/Navbar/item.tsx +0 -92
  101. package/src/components/Notifications/index.tsx +0 -57
  102. package/src/components/Notifications/notification.tsx +0 -362
  103. package/src/components/Paging/index.tsx +0 -321
  104. package/src/components/Panel/LabelEditor.tsx +0 -67
  105. package/src/components/Panel/NonResponsiveActions.tsx +0 -79
  106. package/src/components/Panel/__screenshots__/linux/panel-SomePanel.png +0 -0
  107. package/src/components/Panel/index.tsx +0 -912
  108. package/src/components/Panel/panel.screenshot.tsx +0 -29
  109. package/src/components/Paragraph/index.tsx +0 -43
  110. package/src/components/Popover/index.tsx +0 -68
  111. package/src/components/RadioGroup/index.tsx +0 -71
  112. package/src/components/Slider/index.tsx +0 -358
  113. package/src/components/Spacer/index.tsx +0 -142
  114. package/src/components/Spinner/index.tsx +0 -74
  115. package/src/components/Table/body.tsx +0 -109
  116. package/src/components/Table/cell.tsx +0 -136
  117. package/src/components/Table/header.tsx +0 -236
  118. package/src/components/Table/headerCell.tsx +0 -203
  119. package/src/components/Table/helpers.ts +0 -308
  120. package/src/components/Table/index.tsx +0 -797
  121. package/src/components/Table/row.tsx +0 -288
  122. package/src/components/Table/value.tsx +0 -28
  123. package/src/components/Tabs/content.tsx +0 -68
  124. package/src/components/Tabs/index.tsx +0 -124
  125. package/src/components/Tabs/item.tsx +0 -198
  126. package/src/components/Tabs/list.tsx +0 -381
  127. package/src/components/Tag/group.tsx +0 -73
  128. package/src/components/Tag/index.tsx +0 -463
  129. package/src/components/Textarea/index.tsx +0 -277
  130. package/src/components/TimeAgo/index.tsx +0 -15
  131. package/src/components/Tree/index.tsx +0 -271
  132. package/src/constants/animations.ts +0 -9
  133. package/src/constants/colors.ts +0 -13
  134. package/src/constants/paging.ts +0 -93
  135. package/src/constants/sizes.ts +0 -185
  136. package/src/constants/theme.ts +0 -122
  137. package/src/containers/Paging.tsx +0 -136
  138. package/src/containers/PopoverProvider.tsx +0 -124
  139. package/src/containers/ReqoreProvider.tsx +0 -289
  140. package/src/containers/ThemeProvider.tsx +0 -12
  141. package/src/containers/UIProvider.tsx +0 -101
  142. package/src/context/PopoverContext.tsx +0 -11
  143. package/src/context/ReqoreContext.tsx +0 -47
  144. package/src/context/ThemeContext.tsx +0 -4
  145. package/src/helpers/animations.ts +0 -13
  146. package/src/helpers/colors.ts +0 -335
  147. package/src/helpers/time.ts +0 -21
  148. package/src/helpers/utils.ts +0 -152
  149. package/src/hooks/useAutoFocus.ts +0 -106
  150. package/src/hooks/useCloneThroughFragments.ts +0 -39
  151. package/src/hooks/useCombinedRefs.ts +0 -26
  152. package/src/hooks/useLatestZIndex.ts +0 -13
  153. package/src/hooks/useOutsideClick.ts +0 -29
  154. package/src/hooks/usePaging.ts +0 -128
  155. package/src/hooks/usePopover.tsx +0 -220
  156. package/src/hooks/useQueryWithDelay.ts +0 -30
  157. package/src/hooks/useReqore.ts +0 -12
  158. package/src/hooks/useReqoreContext.ts +0 -16
  159. package/src/hooks/useReqoreEffect.ts +0 -49
  160. package/src/hooks/useTextareaAutoSize.ts +0 -22
  161. package/src/hooks/useTheme.ts +0 -48
  162. package/src/hooks/useTooltip.ts +0 -40
  163. package/src/hooks/useWhyDidYouUpdate.ts +0 -32
  164. package/src/icons.json +0 -2295
  165. package/src/index.tsx +0 -80
  166. package/src/mock/breadcrumbs.ts +0 -146
  167. package/src/mock/collectionData.tsx +0 -380
  168. package/src/mock/data.json +0 -11000
  169. package/src/mock/icons.ts +0 -32
  170. package/src/mock/menu.ts +0 -93
  171. package/src/mock/multiSelect.ts +0 -71
  172. package/src/mock/object.json +0 -317
  173. package/src/mock/styleMock.js +0 -1
  174. package/src/mock/tableData.ts +0 -64
  175. package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -27
  176. package/src/stories/Button/Button.stories.tsx +0 -405
  177. package/src/stories/Checkbox/Checkbox.stories.tsx +0 -75
  178. package/src/stories/Collection/Collection.stories.tsx +0 -317
  179. package/src/stories/Columns/Columns.stories.tsx +0 -158
  180. package/src/stories/Comment/Comment.stories.tsx +0 -136
  181. package/src/stories/ControlGroup/ControlGroup.stories.tsx +0 -399
  182. package/src/stories/DatePicker/DatePicker.stories.tsx +0 -348
  183. package/src/stories/Drawer/Drawer.stories.tsx +0 -294
  184. package/src/stories/Dropdown/Dropdown.stories.tsx +0 -375
  185. package/src/stories/Dropdown/DropdownTests.stories.tsx +0 -111
  186. package/src/stories/ExportModal/ExportModal.stories.tsx +0 -18
  187. package/src/stories/Header/Header.stories.tsx +0 -108
  188. package/src/stories/Icon/Icon.stories.tsx +0 -162
  189. package/src/stories/Input/Input.stories.tsx +0 -220
  190. package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +0 -346
  191. package/src/stories/Label/Label.stories.tsx +0 -33
  192. package/src/stories/Menu/Menu.stories.tsx +0 -367
  193. package/src/stories/Message/Message.stories.tsx +0 -167
  194. package/src/stories/Modal/Manager.stories.tsx +0 -192
  195. package/src/stories/Modal/Modal.stories.tsx +0 -252
  196. package/src/stories/MultiSelect/MultiSelect.stories.tsx +0 -140
  197. package/src/stories/Navbar/Navbar.stories.tsx +0 -119
  198. package/src/stories/Notifications/Interactive.stories.tsx +0 -117
  199. package/src/stories/Notifications/Notification.stories.tsx +0 -216
  200. package/src/stories/Notifications/Notifications.stories.tsx +0 -81
  201. package/src/stories/Paging/Paging.stories.tsx +0 -255
  202. package/src/stories/Panel/Panel.stories.tsx +0 -753
  203. package/src/stories/Paragraph/Paragraph.stories.tsx +0 -108
  204. package/src/stories/Popover/Popover.stories.tsx +0 -510
  205. package/src/stories/RadioGroup/RadioGroup.stories.tsx +0 -212
  206. package/src/stories/Slider/Slider.stories.tsx +0 -173
  207. package/src/stories/Spacer/Spacer.stories.tsx +0 -100
  208. package/src/stories/Spinner/Spinner.stories.tsx +0 -82
  209. package/src/stories/Table/Table.stories.tsx +0 -571
  210. package/src/stories/Tabs/Tabs.stories.tsx +0 -346
  211. package/src/stories/Tag/Tag.stories.tsx +0 -381
  212. package/src/stories/Tag/TagGroup.stories.tsx +0 -307
  213. package/src/stories/TextArea/TextArea.stories.tsx +0 -287
  214. package/src/stories/TextArea/TextAreaTests.stories.tsx +0 -108
  215. package/src/stories/Tree/Tree.stories.tsx +0 -124
  216. package/src/stories/Wrapper.tsx +0 -13
  217. package/src/stories/utils/args.ts +0 -151
  218. package/src/stories/utils.ts +0 -39
  219. package/src/styles.ts +0 -124
  220. package/src/types/global.ts +0 -211
  221. package/src/types/icons.ts +0 -2272
  222. package/tsconfig.prod.json +0 -26
@@ -1,288 +0,0 @@
1
- import { omit, size } from 'lodash';
2
- import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { ReqoreDropdown, ReqoreInput } from '../..';
4
- import { TSizes } from '../../constants/sizes';
5
- import { IPopoverControls } from '../../hooks/usePopover';
6
- import ReqoreControlGroup, { IReqoreControlGroupProps } from '../ControlGroup';
7
- import { IReqoreDropdownProps } from '../Dropdown';
8
- import { IReqoreDropdownItem } from '../Dropdown/list';
9
- import { IReqoreEffect } from '../Effect';
10
- import { IReqoreInputProps } from '../Input';
11
- import ReqoreTag, { IReqoreTagProps } from '../Tag';
12
- import ReqoreTagGroup from '../Tag/group';
13
-
14
- export type TReqoreMultiSelectItem = Omit<IReqoreDropdownItem, 'color'> &
15
- Pick<IReqoreTagProps, 'asBadge' | 'rightIcon' | 'actions'> & { isNew?: boolean };
16
-
17
- export interface IReqoreMultiSelectProps
18
- extends Omit<IReqoreControlGroupProps, 'children' | 'vertical' | 'stack'> {
19
- value?: string[];
20
- onValueChange: (value: string[]) => void;
21
- items?: TReqoreMultiSelectItem[];
22
- onItemClick?: (item: IReqoreDropdownItem) => void;
23
- onItemClickIcon?: IReqoreTagProps['rightIcon'];
24
- onItemAdded?: (item: TReqoreMultiSelectItem) => void;
25
- onItemRemoved?: (item: TReqoreMultiSelectItem) => void;
26
- canRemoveItems?: boolean;
27
- canCreateItems?: boolean;
28
- selectedItemEffect?: IReqoreEffect;
29
- selectedItemSize?: TSizes;
30
- selectorProps?: Omit<IReqoreInputProps, 'value' | 'onValueChange'> & IReqoreDropdownProps;
31
- openOnMount?: IReqoreDropdownProps['isDefaultOpen'];
32
- enterKeySelects?: boolean;
33
- }
34
-
35
- export interface IReqoreMultiSelectItemProps
36
- extends Pick<IReqoreMultiSelectProps, 'selectedItemEffect' | 'selectedItemSize'> {
37
- item: TReqoreMultiSelectItem;
38
- onClick?: () => void;
39
- onRemoveClick?: () => void;
40
- onItemClickIcon?: IReqoreTagProps['rightIcon'];
41
- }
42
-
43
- export const ReqoreMultiSelectItem = memo(
44
- ({
45
- item,
46
- onRemoveClick,
47
- onClick,
48
- selectedItemEffect,
49
- selectedItemSize,
50
- onItemClickIcon,
51
- }: IReqoreMultiSelectItemProps) => {
52
- if (!item) {
53
- return null;
54
- }
55
-
56
- return (
57
- <ReqoreTag
58
- {...item}
59
- label={item.label || item.value}
60
- onRemoveClick={onRemoveClick}
61
- intent={item.intent}
62
- effect={!item.intent ? item.effect || selectedItemEffect : undefined}
63
- size={selectedItemSize}
64
- onClick={onClick}
65
- rightIcon={
66
- item.disabled
67
- ? undefined
68
- : item.rightIcon
69
- ? item.rightIcon
70
- : onClick
71
- ? onItemClickIcon
72
- : undefined
73
- }
74
- />
75
- );
76
- }
77
- );
78
-
79
- export const ReqoreMultiSelect = ({
80
- value = [],
81
- onValueChange,
82
- onItemClick,
83
- canRemoveItems,
84
- canCreateItems,
85
- items = [],
86
- selectedItemEffect,
87
- selectedItemSize,
88
- selectorProps,
89
- openOnMount,
90
- enterKeySelects,
91
- onItemClickIcon,
92
- onItemAdded,
93
- onItemRemoved,
94
- ...rest
95
- }: IReqoreMultiSelectProps) => {
96
- const [createdItems, setCreatedItems] = useState<TReqoreMultiSelectItem[]>([]);
97
- const [query, setQuery] = useState<string>('');
98
- const popoverData = useRef<IPopoverControls>(undefined);
99
- const [focused, setFocused] = useState<boolean>(false);
100
-
101
- useEffect(() => {
102
- if (query && !popoverData.current?.isOpen()) {
103
- popoverData.current?.open();
104
- }
105
- }, [query]);
106
-
107
- useEffect(() => {
108
- if (enterKeySelects) {
109
- document.addEventListener('keydown', handleKeyDown);
110
- }
111
-
112
- return () => {
113
- document.removeEventListener('keydown', handleKeyDown);
114
- };
115
- });
116
-
117
- const addRemoveItem = useCallback(
118
- (item: TReqoreMultiSelectItem): void => {
119
- if (value.includes(item.value)) {
120
- onValueChange(value.filter((v) => v !== item.value));
121
- onItemRemoved?.(item.value);
122
- } else {
123
- onValueChange([...value, item.value]);
124
- onItemAdded?.(item.value);
125
- }
126
- },
127
- [value, onValueChange, onItemAdded, onItemRemoved]
128
- );
129
-
130
- const handleItemSelect = useCallback(
131
- (item: Partial<TReqoreMultiSelectItem>) => {
132
- addRemoveItem(item);
133
-
134
- if (item.isNew) {
135
- setCreatedItems([
136
- ...createdItems,
137
- {
138
- value: item.value,
139
- },
140
- ]);
141
- }
142
-
143
- setQuery('');
144
- },
145
- [createdItems, value, items, addRemoveItem]
146
- );
147
-
148
- /*
149
- This code creates a list of all items that are available
150
- for selection in the dropdown. It will include the items
151
- that are passed in as props, as well as any items that the
152
- user has created.
153
- */
154
- const allItems: TReqoreMultiSelectItem[] = useMemo(() => {
155
- const customItems: TReqoreMultiSelectItem[] = size(createdItems)
156
- ? [{ divider: true, label: 'Custom Items' }, ...createdItems]
157
- : [];
158
-
159
- let filteredItems: TReqoreMultiSelectItem[] = [...items, ...customItems].filter((item) =>
160
- query
161
- ? item.divider
162
- ? false
163
- : (item.label || item.value)?.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1
164
- : true
165
- );
166
-
167
- // Mark selected items as selected
168
- filteredItems = filteredItems.map((item: TReqoreMultiSelectItem) => ({
169
- ...omit(item, ['actions', 'asBadge', 'rightIcon']),
170
- selected: value.includes(item.value),
171
- }));
172
-
173
- if (query && !size(filteredItems)) {
174
- filteredItems = [
175
- { label: 'No existing items found', readOnly: true, minimal: true, icon: 'ForbidLine' },
176
- ];
177
- }
178
-
179
- // If there is a query and there are filtered items
180
- // and there is no item that exactly matches the query, add it to the list
181
- if (
182
- query &&
183
- !filteredItems.some((item: TReqoreMultiSelectItem) => item.value === query) &&
184
- canCreateItems
185
- ) {
186
- filteredItems = [
187
- {
188
- label: `Create new "${query}"`,
189
- value: query,
190
- isNew: true,
191
- icon: 'AddCircleLine',
192
- minimal: true,
193
- flat: false,
194
- effect: {
195
- gradient: {
196
- colors: {
197
- 0: 'success',
198
- 100: 'success:darken:1',
199
- },
200
- },
201
- },
202
- },
203
- { divider: true, label: 'Items matching your query' },
204
- ...filteredItems,
205
- ];
206
- }
207
-
208
- return filteredItems;
209
- }, [items, createdItems, query, value]);
210
-
211
- const handleKeyDown = useCallback(
212
- (e: KeyboardEvent) => {
213
- if (e.key === 'Enter' && focused) {
214
- const item = [...items, ...createdItems].find((item) => item.value === query);
215
-
216
- if (item) {
217
- handleItemSelect(item);
218
- } else if (canCreateItems && query) {
219
- handleItemSelect({
220
- value: query,
221
- isNew: true,
222
- });
223
- }
224
- }
225
- },
226
- [items, createdItems, query, canCreateItems, focused]
227
- );
228
-
229
- const getItemByValue = useCallback(
230
- (value: string): TReqoreMultiSelectItem => {
231
- return [...items, ...createdItems].find((item) => item.value === value);
232
- },
233
- [items, createdItems, value]
234
- );
235
-
236
- return (
237
- <ReqoreControlGroup vertical fluid {...rest}>
238
- <ReqoreTagGroup minimal={rest.minimal} size={rest.size}>
239
- {size(value) ? (
240
- value.map((v) => (
241
- <ReqoreMultiSelectItem
242
- key={v}
243
- item={getItemByValue(v)}
244
- onItemClickIcon={onItemClickIcon}
245
- onRemoveClick={canRemoveItems ? () => addRemoveItem(getItemByValue(v)) : undefined}
246
- onClick={
247
- onItemClick
248
- ? () => {
249
- onItemClick(getItemByValue(v));
250
- }
251
- : undefined
252
- }
253
- selectedItemEffect={selectedItemEffect}
254
- selectedItemSize={selectedItemSize}
255
- />
256
- ))
257
- ) : (
258
- <ReqoreTag color='transparent' icon='ForbidLine' label='No items selected' />
259
- )}
260
- </ReqoreTagGroup>
261
- <ReqoreControlGroup minimal={rest.minimal} flat={rest.flat} size={rest.size}>
262
- <ReqoreDropdown<IReqoreInputProps>
263
- {...selectorProps}
264
- multiSelect
265
- handler='focus'
266
- onFocus={() => setFocused(true)}
267
- onBlur={() => setFocused(false)}
268
- passPopoverData={(data) => (popoverData.current = data)}
269
- component={ReqoreInput}
270
- onClearClick={() => setQuery('')}
271
- value={query}
272
- isDefaultOpen={openOnMount}
273
- onItemSelect={handleItemSelect}
274
- placeholder={canCreateItems ? 'Type to search or create an item...' : 'Type to search...'}
275
- onChange={(e: any) => setQuery(e.target.value)}
276
- items={
277
- size(allItems)
278
- ? allItems
279
- : canCreateItems
280
- ? [{ label: 'No items exist', readOnly: true, minimal: true, icon: 'ForbidLine' }]
281
- : []
282
- }
283
- useTargetWidth
284
- />
285
- </ReqoreControlGroup>
286
- </ReqoreControlGroup>
287
- );
288
- };
@@ -1,50 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styled from 'styled-components';
3
- import { IReqoreTheme } from '../../constants/theme';
4
- import { getReadableColor } from '../../helpers/colors';
5
-
6
- export interface IReqoreNavbarDividerProps extends React.HTMLAttributes<HTMLDivElement> {
7
- type?: 'header' | 'footer';
8
- theme?: IReqoreTheme;
9
- }
10
-
11
- const StyledNavbarDivider = styled.div<{
12
- theme: IReqoreTheme;
13
- type?: 'header' | 'footer';
14
- }>`
15
- position: relative;
16
- width: 20px;
17
- height: 100%;
18
- display: flex;
19
- justify-content: center;
20
- align-items: center;
21
-
22
- &:before {
23
- content: '';
24
- display: block;
25
- width: 1px;
26
- height: 50%;
27
- background-color: ${({ theme, type }) =>
28
- getReadableColor(
29
- theme,
30
- undefined,
31
- undefined,
32
- true,
33
- theme[type]?.background || theme[type]?.main || theme.main
34
- )};
35
- opacity: 0.2;
36
- }
37
- `;
38
-
39
- const ReqoreNavbarDivider = forwardRef<HTMLDivElement, IReqoreNavbarDividerProps>(
40
- ({ type, ...rest }: IReqoreNavbarDividerProps, ref: any) => (
41
- <StyledNavbarDivider
42
- {...rest}
43
- type={type}
44
- className={`${rest.className || ''} reqore-navbar-divider`}
45
- ref={ref}
46
- />
47
- )
48
- );
49
-
50
- export default ReqoreNavbarDivider;
@@ -1,53 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { IReqoreTheme } from '../../constants/theme';
4
-
5
- export interface IReqoreNavbarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
6
- position?: 'right' | 'left';
7
- type?: 'footer' | 'header';
8
- children?: any;
9
- theme?: IReqoreTheme;
10
- }
11
-
12
- export interface IReqoreNavbarGroupStyle extends IReqoreNavbarGroupProps {
13
- theme: IReqoreTheme;
14
- }
15
-
16
- export const StyledNavbarGroup = styled.div<IReqoreNavbarGroupStyle>`
17
- ${({ position }: IReqoreNavbarGroupStyle) => css`
18
- height: 100%;
19
- float: ${position};
20
- color: inherit;
21
- background-color: inherit;
22
- display: flex;
23
- justify-content: center;
24
- align-items: center;
25
- `}
26
- `;
27
-
28
- const ReqoreNavbarGroup = forwardRef<HTMLDivElement, IReqoreNavbarGroupProps>(
29
- ({ position = 'left', children, type, ...rest }: IReqoreNavbarGroupProps, ref: any) => (
30
- <StyledNavbarGroup
31
- {...rest}
32
- className={`${rest.className || ''} reqore-navbar-group`}
33
- position={position}
34
- ref={ref}
35
- >
36
- {React.Children.map(children, (child) =>
37
- child
38
- ? React.cloneElement(child, {
39
- type,
40
- theme: rest.theme,
41
- componentProps: {
42
- ...child.props?.componentProps,
43
- type,
44
- theme: rest.theme,
45
- },
46
- })
47
- : null
48
- )}
49
- </StyledNavbarGroup>
50
- )
51
- );
52
-
53
- export default ReqoreNavbarGroup;
@@ -1,82 +0,0 @@
1
- import { darken } from 'polished';
2
- import React, { forwardRef } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { IReqoreNavbarTheme, IReqoreTheme } from '../../constants/theme';
5
- import { getMainColor, getReadableColor } from '../../helpers/colors';
6
- import { useReqoreTheme } from '../../hooks/useTheme';
7
-
8
- export interface IReqoreNavbarProps extends React.HTMLAttributes<HTMLDivElement> {
9
- children?: any;
10
- position?: 'top' | 'bottom';
11
- type?: 'header' | 'footer';
12
- customTheme?: IReqoreNavbarTheme;
13
- flat?: boolean;
14
- }
15
-
16
- export interface IReqoreNavbarStyle extends IReqoreNavbarProps {
17
- theme: IReqoreTheme;
18
- }
19
-
20
- export const StyledNavbar = styled.div<IReqoreNavbarStyle>`
21
- ${({ theme, type }: IReqoreNavbarStyle) => css`
22
- height: 50px;
23
- flex-shrink: 0;
24
- width: 100%;
25
- padding: 0 10px;
26
- color: ${theme[type]?.color ||
27
- getReadableColor(
28
- theme,
29
- undefined,
30
- undefined,
31
- true,
32
- theme[type]?.background || theme[type]?.main || theme.main
33
- )};
34
- background-color: ${theme[type]?.background || theme[type]?.main || theme.main};
35
- `}
36
-
37
- ${({ theme, type, flat }: IReqoreNavbarStyle) =>
38
- !flat
39
- ? css`
40
- box-shadow: rgba(31, 26, 34, 0.05) 0px ${type === 'header' ? '2px' : '-2px'} 6px;
41
-
42
- border-${type === 'header' ? 'bottom' : 'top'}: 1px solid ${
43
- theme[type]?.border || darken(0.05, getMainColor(theme, type))
44
- };
45
- `
46
- : undefined}
47
- `;
48
-
49
- const ReqoreNavbar = forwardRef<HTMLDivElement, IReqoreNavbarProps>(
50
- ({ position = 'top', children, type, customTheme, ...rest }: IReqoreNavbarProps, ref: any) => {
51
- const theme = useReqoreTheme(type, customTheme);
52
-
53
- return (
54
- <StyledNavbar
55
- {...rest}
56
- className={`${rest.className || ''} reqore-navbar-${type}`}
57
- position={position}
58
- type={type}
59
- ref={ref}
60
- theme={theme}
61
- >
62
- {React.Children.map(children, (child) =>
63
- child
64
- ? React.cloneElement(child, {
65
- type,
66
- theme,
67
- componentProps: { theme },
68
- })
69
- : null
70
- )}
71
- </StyledNavbar>
72
- );
73
- }
74
- );
75
-
76
- export const ReqoreHeader = forwardRef<HTMLDivElement, IReqoreNavbarProps>(
77
- (props: IReqoreNavbarProps, ref: any) => <ReqoreNavbar {...props} type='header' ref={ref} />
78
- );
79
-
80
- export const ReqoreFooter = forwardRef<HTMLDivElement, IReqoreNavbarProps>(
81
- (props: IReqoreNavbarProps, ref: any) => <ReqoreNavbar {...props} type='footer' ref={ref} />
82
- );
@@ -1,92 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { IReqoreTheme } from '../../constants/theme';
4
- import { changeLightness, getMainColor } from '../../helpers/colors';
5
- import {
6
- ActiveIconScale,
7
- DisabledElement,
8
- InactiveIconScale,
9
- ScaleIconOnHover,
10
- } from '../../styles';
11
-
12
- export interface IReqoreNavbarItemProps extends React.HTMLAttributes<HTMLDivElement> {
13
- children?: any;
14
- interactive?: boolean;
15
- type?: 'header' | 'footer';
16
- disabled?: boolean;
17
- active?: boolean;
18
- theme?: IReqoreTheme;
19
- }
20
-
21
- export interface IReqoreNavbarItemStyle extends IReqoreNavbarItemProps {
22
- theme?: IReqoreTheme;
23
- }
24
-
25
- const StyledNavbarItem = styled.div<IReqoreNavbarItemStyle>`
26
- height: 100%;
27
- min-width: 50px;
28
- display: flex;
29
- justify-content: center;
30
- align-items: center;
31
- padding: 10px;
32
- color: inherit;
33
- background-color: ${({ theme, active, type }) =>
34
- active && (theme[type]?.hoverColor || changeLightness(getMainColor(theme, type), 0.05))};
35
-
36
- ${InactiveIconScale}
37
-
38
- ${({ active }: IReqoreNavbarItemStyle) => {
39
- if (active) {
40
- return css`
41
- ${ActiveIconScale}
42
- `;
43
- }
44
-
45
- return undefined;
46
- }}
47
-
48
- ${({ interactive, theme, type }: IReqoreNavbarItemStyle) => {
49
- if (interactive) {
50
- return css`
51
- transition: background-color 0.2s ease-out;
52
- cursor: pointer;
53
- &:hover {
54
- background-color: ${theme[type]?.hoverColor ||
55
- changeLightness(getMainColor(theme, type), 0.05)};
56
- }
57
- ${ScaleIconOnHover}
58
- `;
59
- }
60
-
61
- return undefined;
62
- }}
63
-
64
- opacity: ${({ disabled }) => disabled && 0.3};
65
-
66
- ${({ disabled }) =>
67
- disabled &&
68
- css`
69
- ${DisabledElement}
70
- `}
71
- `;
72
-
73
- const ReqoreNavbarItem = forwardRef<HTMLDivElement, IReqoreNavbarItemProps>(
74
- (
75
- { interactive, children, type, disabled, active, ...rest }: IReqoreNavbarItemProps,
76
- ref: any
77
- ) => (
78
- <StyledNavbarItem
79
- {...rest}
80
- className={`${rest.className || ''} reqore-navbar-item`}
81
- interactive={interactive || !!rest.onClick}
82
- disabled={disabled}
83
- active={active}
84
- type={type}
85
- ref={ref}
86
- >
87
- {children}
88
- </StyledNavbarItem>
89
- )
90
- );
91
-
92
- export default ReqoreNavbarItem;
@@ -1,57 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styled, { css } from 'styled-components';
3
-
4
- export interface IReqoreNotificationsWrapperProps {
5
- children: any;
6
- position?: IReqoreNotificationsPosition;
7
- }
8
-
9
- export type IReqoreNotificationsPosition =
10
- | 'TOP'
11
- | 'BOTTOM'
12
- | 'TOP LEFT'
13
- | 'TOP RIGHT'
14
- | 'BOTTOM LEFT'
15
- | 'BOTTOM RIGHT';
16
-
17
- export interface IReqoreNotificationsStyle {
18
- positions: string[];
19
- }
20
- const StyledNotificationsWrapper = styled.div<IReqoreNotificationsStyle>`
21
- position: fixed;
22
- z-index: 10000;
23
- padding: 0 20px 20px 20px;
24
-
25
- ${({ positions }) => {
26
- const hasTwoPositions = positions.length > 1;
27
-
28
- if (hasTwoPositions) {
29
- return css`
30
- ${positions[0]}: 30px;
31
- ${positions[1]}: 30px;
32
- `;
33
- }
34
-
35
- return css`
36
- ${positions[0]}: 30px;
37
- left: 50%;
38
- transform: translateX(-50%);
39
- `;
40
- }}
41
- `;
42
-
43
- const ReqoreNotificationsWrapper: React.FC<IReqoreNotificationsWrapperProps> = forwardRef<
44
- HTMLDivElement,
45
- IReqoreNotificationsWrapperProps
46
- >(({ children, position = 'TOP' }, ref: any) => (
47
- <StyledNotificationsWrapper
48
- positions={position
49
- .split(' ')
50
- .map((p: IReqoreNotificationsPosition | string): string => p.toLowerCase())}
51
- ref={ref}
52
- >
53
- {children}
54
- </StyledNotificationsWrapper>
55
- ));
56
-
57
- export default ReqoreNotificationsWrapper;