qbs-react-grid 2.2.6 → 2.2.11

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 (58) hide show
  1. package/dist/css/qbs-react-grid.css +1 -1
  2. package/dist/css/qbs-react-grid.min.css +1 -1
  3. package/dist/css/qbs-react-grid.min.css.map +1 -1
  4. package/es/index.d.ts +2 -0
  5. package/es/index.js +2 -1
  6. package/es/less/qbs-table.less +89 -6
  7. package/es/qbsTable/CustomTableCell.js +4 -2
  8. package/es/qbsTable/QbsTable.js +52 -6
  9. package/es/qbsTable/TableCardList.js +39 -5
  10. package/es/qbsTable/Toolbar.js +96 -21
  11. package/es/qbsTable/commontypes.d.ts +18 -0
  12. package/es/qbsTable/labels.d.ts +25 -0
  13. package/es/qbsTable/labels.js +32 -0
  14. package/es/qbsTable/utilities/ColumShowHide.d.ts +3 -0
  15. package/es/qbsTable/utilities/ColumShowHide.js +63 -35
  16. package/es/qbsTable/utilities/ToolTip.js +2 -1
  17. package/es/qbsTable/utilities/VerticalDropDownMenu.js +28 -7
  18. package/es/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
  19. package/es/qbsTable/utilities/columnToggleCoordinator.js +9 -0
  20. package/es/qbsTable/utilities/icons.d.ts +3 -0
  21. package/es/qbsTable/utilities/icons.js +67 -3
  22. package/es/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
  23. package/es/qbsTable/utilities/verticalMenuCoordinator.js +9 -0
  24. package/lib/index.d.ts +2 -0
  25. package/lib/index.js +6 -2
  26. package/lib/less/qbs-table.less +89 -6
  27. package/lib/qbsTable/CustomTableCell.js +4 -2
  28. package/lib/qbsTable/QbsTable.js +52 -6
  29. package/lib/qbsTable/TableCardList.js +39 -5
  30. package/lib/qbsTable/Toolbar.js +94 -19
  31. package/lib/qbsTable/commontypes.d.ts +18 -0
  32. package/lib/qbsTable/labels.d.ts +25 -0
  33. package/lib/qbsTable/labels.js +40 -0
  34. package/lib/qbsTable/utilities/ColumShowHide.d.ts +3 -0
  35. package/lib/qbsTable/utilities/ColumShowHide.js +62 -34
  36. package/lib/qbsTable/utilities/ToolTip.js +2 -1
  37. package/lib/qbsTable/utilities/VerticalDropDownMenu.js +27 -6
  38. package/lib/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
  39. package/lib/qbsTable/utilities/columnToggleCoordinator.js +15 -0
  40. package/lib/qbsTable/utilities/icons.d.ts +3 -0
  41. package/lib/qbsTable/utilities/icons.js +72 -5
  42. package/lib/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
  43. package/lib/qbsTable/utilities/verticalMenuCoordinator.js +15 -0
  44. package/package.json +1 -1
  45. package/src/index.ts +6 -0
  46. package/src/less/qbs-table.less +89 -6
  47. package/src/qbsTable/CustomTableCell.tsx +4 -2
  48. package/src/qbsTable/QbsTable.tsx +41 -4
  49. package/src/qbsTable/TableCardList.tsx +30 -3
  50. package/src/qbsTable/Toolbar.tsx +105 -26
  51. package/src/qbsTable/commontypes.ts +19 -0
  52. package/src/qbsTable/labels.ts +55 -0
  53. package/src/qbsTable/utilities/ColumShowHide.tsx +114 -77
  54. package/src/qbsTable/utilities/ToolTip.tsx +1 -1
  55. package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +36 -5
  56. package/src/qbsTable/utilities/columnToggleCoordinator.ts +14 -0
  57. package/src/qbsTable/utilities/icons.tsx +76 -3
  58. package/src/qbsTable/utilities/verticalMenuCoordinator.ts +14 -0
@@ -1,6 +1,13 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
2
2
 
3
3
  import { QbsColumnProps } from '../commontypes';
4
+ import type { QbsTableLabels } from '../labels';
5
+ import { mergeQbsTableLabels } from '../labels';
6
+ import {
7
+ closeOtherColumnToggles,
8
+ COLUMN_TOGGLE_CLOSE_OTHERS,
9
+ type ColumnToggleCloseDetail,
10
+ } from './columnToggleCoordinator';
4
11
  import { SettingsIcon } from './icons';
5
12
 
6
13
  interface ColumnToggleProps {
@@ -12,6 +19,8 @@ interface ColumnToggleProps {
12
19
  handleColumnToggle?: (columns: QbsColumnProps[]) => void;
13
20
  handleResetColumns?: () => void;
14
21
  tableHeight?: number;
22
+ labels?: QbsTableLabels;
23
+ rtl?: boolean;
15
24
  }
16
25
 
17
26
  const ColumnToggle: React.FC<ColumnToggleProps> = ({
@@ -22,17 +31,32 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
22
31
  setIsOpen,
23
32
  handleResetColumns,
24
33
  handleColumnToggle,
25
- tableHeight = 450
34
+ tableHeight = 450,
35
+ labels: labelsProp,
36
+ rtl = false,
26
37
  }) => {
38
+ const labels = mergeQbsTableLabels(labelsProp);
39
+ const toggleId = useId();
27
40
  const [draggedItem, setDraggedItem] = useState<number | null>(null);
28
41
  const popupRef = useRef<HTMLDivElement | null>(null);
29
42
  const [dragOverPosition, setDragOverPosition] = useState<number | null>();
30
43
 
44
+ useEffect(() => {
45
+ const handleCloseOthers = (event: Event) => {
46
+ const detail = (event as CustomEvent<ColumnToggleCloseDetail>).detail;
47
+ if (detail?.exceptId !== toggleId) {
48
+ setIsOpen(false);
49
+ }
50
+ };
51
+ document.addEventListener(COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
52
+ return () => document.removeEventListener(COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
53
+ }, [setIsOpen, toggleId]);
54
+
31
55
  const handleToggle = useCallback(
32
56
  (columnName: string) => {
33
57
  onToggle(columnName);
34
58
  },
35
- [onToggle]
59
+ [onToggle],
36
60
  );
37
61
 
38
62
  const onDragStart = useCallback((e: React.DragEvent, index: number) => {
@@ -59,22 +83,25 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
59
83
  }
60
84
  setDraggedItem(null);
61
85
  },
62
- [columns, draggedItem]
86
+ [columns, draggedItem, onReorder],
63
87
  );
88
+
64
89
  const handleClickOutside = useCallback(
65
90
  (event: MouseEvent) => {
66
- if (popupRef.current && !popupRef.current.contains(event.target as Node)) {
67
- setIsOpen(false);
91
+ const target = event.target as Node;
92
+ if (popupRef.current?.contains(target)) {
93
+ return;
68
94
  }
95
+ setIsOpen(false);
69
96
  },
70
- [setIsOpen]
97
+ [setIsOpen],
71
98
  );
99
+
72
100
  useEffect(() => {
101
+ if (!isOpen) return;
73
102
  document.addEventListener('mousedown', handleClickOutside);
74
- return () => {
75
- document.removeEventListener('mousedown', handleClickOutside);
76
- };
77
- }, [handleClickOutside]);
103
+ return () => document.removeEventListener('mousedown', handleClickOutside);
104
+ }, [handleClickOutside, isOpen]);
78
105
 
79
106
  const renderFixedColumn = (column: QbsColumnProps, index: number) => (
80
107
  <div
@@ -88,9 +115,9 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
88
115
  checked={column.isVisible}
89
116
  onChange={() => handleToggle(column.title)}
90
117
  className="qbs-table-checkbox-input"
91
- id={column.title}
118
+ id={`${toggleId}-${column.title}`}
92
119
  />
93
- <label htmlFor={column.title}>
120
+ <label htmlFor={`${toggleId}-${column.title}`}>
94
121
  <svg
95
122
  width="8"
96
123
  height="6"
@@ -101,13 +128,14 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
101
128
  <path
102
129
  d="M0 3.21739L2.89883 6L8 1.06994L6.89494 0L2.89883 3.86768L1.09728 2.14745L0 3.21739Z"
103
130
  fill="white"
104
- ></path>
131
+ />
105
132
  </svg>
106
133
  </label>
107
134
  </div>
108
135
  <div className="qbs-table-popup-value">{column.title}</div>
109
136
  </div>
110
137
  );
138
+
111
139
  const renderColumn = (column: QbsColumnProps, index: number) => (
112
140
  <div
113
141
  key={column.title}
@@ -124,9 +152,9 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
124
152
  checked={column.isVisible}
125
153
  onChange={() => handleToggle(column.title)}
126
154
  className="qbs-table-checkbox-input"
127
- id={column.title}
155
+ id={`${toggleId}-${column.title}`}
128
156
  />
129
- <label htmlFor={column.title}>
157
+ <label htmlFor={`${toggleId}-${column.title}`}>
130
158
  <svg
131
159
  width="8"
132
160
  height="6"
@@ -137,7 +165,7 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
137
165
  <path
138
166
  d="M0 3.21739L2.89883 6L8 1.06994L6.89494 0L2.89883 3.86768L1.09728 2.14745L0 3.21739Z"
139
167
  fill="white"
140
- ></path>
168
+ />
141
169
  </svg>
142
170
  </label>
143
171
  </div>
@@ -162,84 +190,93 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
162
190
  )}
163
191
  </div>
164
192
  );
165
- const handleAvailableColumns = () => {
166
- return columns.filter(item => !item.isVisible)?.length > 0 ? true : false;
167
- };
193
+
194
+ const handleAvailableColumns = () =>
195
+ columns.filter(item => !item.isVisible)?.length > 0;
196
+
168
197
  const handleColToggle = () => {
169
198
  setIsOpen(false);
170
199
  handleColumnToggle?.(columns);
171
200
  };
201
+
172
202
  return (
173
- <div>
174
- <button onClick={() => setIsOpen(!isOpen)}>
203
+ <div className="qbs-table-settings-wrapper">
204
+ <button
205
+ type="button"
206
+ onClick={event => {
207
+ event.stopPropagation();
208
+ if (isOpen) {
209
+ setIsOpen(false);
210
+ return;
211
+ }
212
+ closeOtherColumnToggles(toggleId);
213
+ setIsOpen(true);
214
+ }}
215
+ >
175
216
  <SettingsIcon />
176
217
  </button>
177
218
  {isOpen && (
178
- <div>
179
- <div
180
- className="qbs-table-column-popup"
181
- style={{ maxHeight: tableHeight - 40 }}
182
- ref={popupRef}
183
- >
184
- <div className="qbs-table-popup-container">
185
- <div className="qbs-table-popup-item">
186
- <div className="qbs-table-popup-label">FIXED COLUMNS</div>
187
- <div className="qbs-table-columns-container">
188
- <div className="qbs-table-column">
189
- {columns.map((column, index) =>
190
- column.fixed ? renderFixedColumn(column, index) : ''
191
- )}
192
- </div>
219
+ <div
220
+ className={`qbs-table-column-popup${rtl ? ' qbs-table-column-popup--rtl' : ''}`}
221
+ style={{ maxHeight: tableHeight - 40 }}
222
+ ref={popupRef}
223
+ dir={rtl ? 'rtl' : 'ltr'}
224
+ >
225
+ <div className="qbs-table-popup-container">
226
+ <div className="qbs-table-popup-item">
227
+ <div className="qbs-table-popup-label">{labels.fixedColumns}</div>
228
+ <div className="qbs-table-columns-container">
229
+ <div className="qbs-table-column">
230
+ {columns.map((column, index) =>
231
+ column.fixed ? renderFixedColumn(column, index) : null,
232
+ )}
193
233
  </div>
194
234
  </div>
195
- <div className="qbs-table-divider"></div>
196
- <div className="qbs-table-popup-item">
197
- <div className="qbs-table-popup-label">VISIBLE COLUMNS</div>
198
- <div className="qbs-table-columns-container">
199
- <div className="qbs-table-column">
200
- {columns.map((column, index) =>
201
- column.isVisible && !column.fixed ? renderColumn(column, index) : ''
202
- )}
203
- </div>
235
+ </div>
236
+ <div className="qbs-table-divider" />
237
+ <div className="qbs-table-popup-item">
238
+ <div className="qbs-table-popup-label">{labels.visibleColumns}</div>
239
+ <div className="qbs-table-columns-container">
240
+ <div className="qbs-table-column">
241
+ {columns.map((column, index) =>
242
+ column.isVisible && !column.fixed ? renderColumn(column, index) : null,
243
+ )}
204
244
  </div>
205
245
  </div>
206
- {handleAvailableColumns() && (
207
- <>
208
- <div className="qbs-table-divider"></div>
209
- <div className="qbs-table-popup-item">
210
- <div className="qbs-table-popup-label">AVAILABLE COLUMNS</div>
211
- <div className="qbs-table-columns-container">
212
- <div className="qbs-table-column">
213
- {columns.map((column, index) =>
214
- !column.isVisible && !column.fixed ? renderFixedColumn(column, index) : ''
215
- )}
216
- </div>
217
- </div>
218
- </div>
219
- </>
220
- )}
221
246
  </div>
222
- {handleResetColumns && (
247
+ {handleAvailableColumns() && (
223
248
  <>
224
- <div className="qbs-table-divider"></div>
225
- <div
226
- className="qbs-table-popup-item"
227
- style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}
228
- >
229
- <a
230
- className="qbs-table-reset-link"
231
- href="#"
232
- onClick={() => handleResetColumns?.()}
233
- >
234
- Reset to default
235
- </a>
236
- <a className="qbs-table-reset-link" href="#" onClick={() => handleColToggle()}>
237
- Save
238
- </a>
249
+ <div className="qbs-table-divider" />
250
+ <div className="qbs-table-popup-item">
251
+ <div className="qbs-table-popup-label">{labels.availableColumns}</div>
252
+ <div className="qbs-table-columns-container">
253
+ <div className="qbs-table-column">
254
+ {columns.map((column, index) =>
255
+ !column.isVisible && !column.fixed ? renderFixedColumn(column, index) : null,
256
+ )}
257
+ </div>
258
+ </div>
239
259
  </div>
240
260
  </>
241
261
  )}
242
262
  </div>
263
+ {handleResetColumns && (
264
+ <>
265
+ <div className="qbs-table-divider" />
266
+ <div className="qbs-table-popup-footer">
267
+ <button
268
+ type="button"
269
+ className="qbs-table-reset-link"
270
+ onClick={() => handleResetColumns?.()}
271
+ >
272
+ {labels.resetToDefault}
273
+ </button>
274
+ <button type="button" className="qbs-table-reset-link" onClick={() => handleColToggle()}>
275
+ {labels.save}
276
+ </button>
277
+ </div>
278
+ </>
279
+ )}
243
280
  </div>
244
281
  )}
245
282
  </div>
@@ -29,7 +29,7 @@ const TooltipComponent: React.FC<any> = ({ title, children, tableBodyRef }) => {
29
29
  >
30
30
  {children}
31
31
  </span>
32
- <span ref={dropRef} className={'tooltiptext'}>
32
+ <span ref={dropRef} className="tooltiptext" dir="auto">
33
33
  {title}
34
34
  </span>
35
35
  </div>
@@ -1,9 +1,14 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useId, useRef, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
 
4
4
  import { ThreeDotIcon } from './icons';
5
5
  import TooltipComponent from './ToolTip';
6
6
  import type { ActionProps } from '../commontypes';
7
+ import {
8
+ closeOtherVerticalMenus,
9
+ VERTICAL_MENU_CLOSE_OTHERS,
10
+ type VerticalMenuCloseDetail,
11
+ } from './verticalMenuCoordinator';
7
12
 
8
13
  type VerticalMenuDropdownProps = {
9
14
  actionDropDown?: readonly ActionProps[];
@@ -22,9 +27,22 @@ const VerticalMenuDropdown: React.FC<VerticalMenuDropdownProps> = ({
22
27
  }) => {
23
28
  const [openMenu, setOpenMenu] = useState(false);
24
29
  const [position, setPosition] = useState({ top: 0, left: 0 });
30
+ const menuId = useId();
25
31
  const menuButtonRef = useRef<HTMLButtonElement>(null);
26
32
  const menuRef = useRef<HTMLDivElement>(null);
27
33
 
34
+ useEffect(() => {
35
+ const handleCloseOthers = (event: Event) => {
36
+ const detail = (event as CustomEvent<VerticalMenuCloseDetail>).detail;
37
+ if (detail?.exceptId !== menuId) {
38
+ setOpenMenu(false);
39
+ }
40
+ };
41
+
42
+ document.addEventListener(VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
43
+ return () => document.removeEventListener(VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
44
+ }, [menuId]);
45
+
28
46
  const updateMenuPosition = () => {
29
47
  if (!menuButtonRef.current) return;
30
48
 
@@ -44,7 +62,15 @@ const VerticalMenuDropdown: React.FC<VerticalMenuDropdownProps> = ({
44
62
  const spaceBelow = window.innerHeight - rect.bottom;
45
63
  const openBelow = spaceBelow >= menuHeight + menuGap;
46
64
 
47
- let left = rect.left;
65
+ const isRtl =
66
+ (document.documentElement.getAttribute('dir') ||
67
+ document.body.getAttribute('dir') ||
68
+ getComputedStyle(document.documentElement).direction) === 'rtl';
69
+
70
+ let left = isRtl ? rect.left : rect.left - menuWidth;
71
+ if (!isRtl && left < viewportPadding) {
72
+ left = rect.left;
73
+ }
48
74
  if (left + menuWidth > window.innerWidth - viewportPadding) {
49
75
  left = Math.max(viewportPadding, rect.right - menuWidth);
50
76
  }
@@ -173,11 +199,16 @@ const VerticalMenuDropdown: React.FC<VerticalMenuDropdownProps> = ({
173
199
  {visibleCount > 0 && (
174
200
  <button
175
201
  type="button"
176
- className="vertical-menu-trigger-button p-2 rounded text-base-gray hover:bg-gray-light-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
202
+ className="vertical-menu-trigger-button"
177
203
  onClick={event => {
178
204
  event.stopPropagation();
179
- if (!openMenu) updateMenuPosition();
180
- setOpenMenu(prev => !prev);
205
+ if (openMenu) {
206
+ setOpenMenu(false);
207
+ return;
208
+ }
209
+ closeOtherVerticalMenus(menuId);
210
+ updateMenuPosition();
211
+ setOpenMenu(true);
181
212
  }}
182
213
  ref={menuButtonRef}
183
214
  >
@@ -0,0 +1,14 @@
1
+ export const COLUMN_TOGGLE_CLOSE_OTHERS = 'qbs-column-toggle-close-others';
2
+
3
+ export type ColumnToggleCloseDetail = {
4
+ exceptId: string;
5
+ };
6
+
7
+ export const closeOtherColumnToggles = (exceptId: string) => {
8
+ if (typeof document === 'undefined') return;
9
+ document.dispatchEvent(
10
+ new CustomEvent<ColumnToggleCloseDetail>(COLUMN_TOGGLE_CLOSE_OTHERS, {
11
+ detail: { exceptId },
12
+ }),
13
+ );
14
+ };
@@ -5,7 +5,7 @@ export const ThreeDotIcon: React.FC<any> = () => {
5
5
  <svg width="4" height="16" viewBox="0 0 4 16" fill="none" xmlns="http://www.w3.org/2000/svg">
6
6
  <path
7
7
  d="M2 2.16665L2 2.17498M2 7.99998L2 8.00831M2 13.8333L2 13.8416M2 2.99998C1.53976 2.99998 1.16667 2.62688 1.16667 2.16665C1.16667 1.70641 1.53976 1.33331 2 1.33331C2.46024 1.33331 2.83333 1.70641 2.83333 2.16665C2.83333 2.62688 2.46024 2.99998 2 2.99998ZM2 8.83331C1.53976 8.83331 1.16667 8.46022 1.16667 7.99998C1.16667 7.53974 1.53976 7.16665 2 7.16665C2.46024 7.16665 2.83333 7.53974 2.83333 7.99998C2.83333 8.46022 2.46024 8.83331 2 8.83331ZM2 14.6666C1.53976 14.6666 1.16666 14.2935 1.16666 13.8333C1.16666 13.3731 1.53976 13 2 13C2.46024 13 2.83333 13.3731 2.83333 13.8333C2.83333 14.2935 2.46024 14.6666 2 14.6666Z"
8
- stroke="#313131"
8
+ stroke="currentColor"
9
9
  strokeWidth="1.5"
10
10
  strokeLinecap="round"
11
11
  strokeLinejoin="round"
@@ -21,14 +21,14 @@ export const SettingsIcon: React.FC<any> = () => {
21
21
  fillRule="evenodd"
22
22
  clipRule="evenodd"
23
23
  d="M10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10C12.5 11.3807 11.3807 12.5 10 12.5Z"
24
- stroke="#313131"
24
+ stroke="currentColor"
25
25
  strokeWidth="1.5"
26
26
  strokeLinecap="round"
27
27
  strokeLinejoin="round"
28
28
  />
29
29
  <path
30
30
  d="M1.66797 9.26718C1.66797 8.40052 2.3763 7.68385 3.2513 7.68385C4.75964 7.68385 5.3763 6.61718 4.61797 5.30885C4.18464 4.55885 4.44297 3.58385 5.2013 3.15052L6.64297 2.32552C7.3013 1.93385 8.1513 2.16718 8.54297 2.82552L8.63463 2.98385C9.38463 4.29218 10.618 4.29218 11.3763 2.98385L11.468 2.82552C11.8596 2.16718 12.7096 1.93385 13.368 2.32552L14.8096 3.15052C15.568 3.58385 15.8263 4.55885 15.393 5.30885C14.6346 6.61718 15.2513 7.68385 16.7596 7.68385C17.6263 7.68385 18.343 8.39218 18.343 9.26718V10.7338C18.343 11.6005 17.6346 12.3172 16.7596 12.3172C15.2513 12.3172 14.6346 13.3838 15.393 14.6922C15.8263 15.4505 15.568 16.4172 14.8096 16.8505L13.368 17.6755C12.7096 18.0672 11.8596 17.8339 11.468 17.1755L11.3763 17.0172C10.6263 15.7089 9.39297 15.7089 8.63463 17.0172L8.54297 17.1755C8.1513 17.8339 7.3013 18.0672 6.64297 17.6755L5.2013 16.8505C4.44297 16.4172 4.18464 15.4422 4.61797 14.6922C5.3763 13.3838 4.75964 12.3172 3.2513 12.3172C2.3763 12.3172 1.66797 11.6005 1.66797 10.7338V9.26718Z"
31
- stroke="#313131"
31
+ stroke="currentColor"
32
32
  strokeWidth="1.5"
33
33
  strokeLinecap="round"
34
34
  strokeLinejoin="round"
@@ -134,3 +134,76 @@ export const TableView: React.FC<any> = ({ className }) => {
134
134
  </svg>
135
135
  );
136
136
  };
137
+
138
+ export const ExpandIcon: React.FC<any> = ({ className }) => (
139
+ <svg
140
+ width="16"
141
+ height="16"
142
+ className={className}
143
+ viewBox="0 0 16 16"
144
+ fill="none"
145
+ xmlns="http://www.w3.org/2000/svg"
146
+ >
147
+ <path
148
+ d="M2.66797 5.33073V2.66406M2.66797 2.66406H5.33464M2.66797 2.66406L6.0013 5.9974M13.3346 5.33073V2.66406M13.3346 2.66406H10.668M13.3346 2.66406L10.0013 5.9974M2.66797 10.6641V13.3307M2.66797 13.3307H5.33464M2.66797 13.3307L6.0013 9.9974M13.3346 13.3307L10.0013 9.9974M13.3346 13.3307V10.6641M13.3346 13.3307H10.668"
149
+ stroke="currentColor"
150
+ strokeWidth="1.5"
151
+ strokeLinecap="round"
152
+ strokeLinejoin="round"
153
+ />
154
+ </svg>
155
+ );
156
+
157
+ export const ContentView: React.FC<any> = ({ className }) => (
158
+ <svg
159
+ width="16"
160
+ height="17"
161
+ className={className}
162
+ viewBox="0 0 16 17"
163
+ fill="none"
164
+ xmlns="http://www.w3.org/2000/svg"
165
+ >
166
+ <path
167
+ d="M4.00344 9.48438C3.24485 9.48438 2.94141 9.80804 2.94141 10.6122V12.6553C2.94141 13.4594 3.24485 13.7831 4.00344 13.7831H11.994C12.7526 13.7831 13.056 13.4594 13.056 12.6553V10.6122C13.056 9.80804 12.7526 9.48438 11.994 9.48438H4.00344Z"
168
+ stroke="currentColor"
169
+ strokeLinecap="round"
170
+ strokeLinejoin="round"
171
+ />
172
+ <path
173
+ d="M4.00344 3.66406C3.24485 3.66406 2.94141 3.98773 2.94141 4.79184V6.835C2.94141 7.63911 3.24485 7.96278 4.00344 7.96278H11.994C12.7526 7.96278 13.056 7.63911 13.056 6.835V4.79184C13.056 3.98773 12.7526 3.66406 11.994 3.66406H4.00344Z"
174
+ stroke="currentColor"
175
+ strokeLinecap="round"
176
+ strokeLinejoin="round"
177
+ />
178
+ </svg>
179
+ );
180
+
181
+ export const DefaultView: React.FC<any> = ({ className }) => (
182
+ <svg
183
+ width="16"
184
+ height="17"
185
+ className={className}
186
+ viewBox="0 0 16 17"
187
+ fill="none"
188
+ xmlns="http://www.w3.org/2000/svg"
189
+ >
190
+ <path
191
+ fillRule="evenodd"
192
+ clipRule="evenodd"
193
+ d="M2.39844 4.72969C2.39844 4.28786 2.75661 3.92969 3.19844 3.92969H12.7984C13.2403 3.92969 13.5984 4.28786 13.5984 4.72969C13.5984 5.17152 13.2403 5.52969 12.7984 5.52969H3.19844C2.75661 5.52969 2.39844 5.17152 2.39844 4.72969Z"
194
+ fill="currentColor"
195
+ />
196
+ <path
197
+ fillRule="evenodd"
198
+ clipRule="evenodd"
199
+ d="M2.39844 8.72969C2.39844 8.28786 2.75661 7.92969 3.19844 7.92969H12.7984C13.2403 7.92969 13.5984 8.28786 13.5984 8.72969C13.5984 9.17152 13.2403 9.52969 12.7984 9.52969H3.19844C2.75661 9.52969 2.39844 9.17152 2.39844 8.72969Z"
200
+ fill="currentColor"
201
+ />
202
+ <path
203
+ fillRule="evenodd"
204
+ clipRule="evenodd"
205
+ d="M2.39844 12.7297C2.39844 12.2879 2.75661 11.9297 3.19844 11.9297H12.7984C13.2403 11.9297 13.5984 12.2879 13.5984 12.7297C13.5984 13.1715 13.2403 13.5297 12.7984 13.5297H3.19844C2.75661 13.5297 2.39844 13.1715 2.39844 12.7297Z"
206
+ fill="currentColor"
207
+ />
208
+ </svg>
209
+ );
@@ -0,0 +1,14 @@
1
+ export const VERTICAL_MENU_CLOSE_OTHERS = 'qbs-vertical-menu-close-others';
2
+
3
+ export type VerticalMenuCloseDetail = {
4
+ exceptId: string;
5
+ };
6
+
7
+ export const closeOtherVerticalMenus = (exceptId: string) => {
8
+ if (typeof document === 'undefined') return;
9
+ document.dispatchEvent(
10
+ new CustomEvent<VerticalMenuCloseDetail>(VERTICAL_MENU_CLOSE_OTHERS, {
11
+ detail: { exceptId },
12
+ }),
13
+ );
14
+ };