@chayns-components/core 5.5.64 → 5.5.66

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 (35) hide show
  1. package/AGENTS.md +32 -0
  2. package/lib/cjs/components/combobox/ComboBox.js +1 -1
  3. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  4. package/lib/cjs/components/context-menu/ContextMenu.js +13 -5
  5. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  6. package/lib/cjs/components/context-menu/ContextMenu.test.js +234 -0
  7. package/lib/cjs/components/context-menu/ContextMenu.test.js.map +1 -0
  8. package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
  9. package/lib/cjs/components/context-menu/ContextMenu.utils.js +4 -1
  10. package/lib/cjs/components/context-menu/ContextMenu.utils.js.map +1 -1
  11. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js +11 -33
  12. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  13. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.styles.js +11 -3
  14. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -1
  15. package/lib/cjs/components/context-menu/context-menu-content/context-menu-content-item/ContextMenuContentItem.js +74 -0
  16. package/lib/cjs/components/context-menu/context-menu-content/context-menu-content-item/ContextMenuContentItem.js.map +1 -0
  17. package/lib/esm/components/combobox/ComboBox.js +1 -1
  18. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  19. package/lib/esm/components/context-menu/ContextMenu.js +13 -4
  20. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  21. package/lib/esm/components/context-menu/ContextMenu.test.js +223 -0
  22. package/lib/esm/components/context-menu/ContextMenu.test.js.map +1 -0
  23. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  24. package/lib/esm/components/context-menu/ContextMenu.utils.js +4 -1
  25. package/lib/esm/components/context-menu/ContextMenu.utils.js.map +1 -1
  26. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js +13 -35
  27. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  28. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.styles.js +11 -3
  29. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -1
  30. package/lib/esm/components/context-menu/context-menu-content/context-menu-content-item/ContextMenuContentItem.js +66 -0
  31. package/lib/esm/components/context-menu/context-menu-content/context-menu-content-item/ContextMenuContentItem.js.map +1 -0
  32. package/lib/types/components/context-menu/ContextMenu.types.d.ts +9 -0
  33. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +4 -2
  34. package/lib/types/components/context-menu/context-menu-content/context-menu-content-item/ContextMenuContentItem.d.ts +11 -0
  35. package/package.json +2 -2
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+
3
+ require("@testing-library/jest-dom/vitest");
4
+ var _react = require("@testing-library/react");
5
+ var _chaynsApi = require("chayns-api");
6
+ var _react2 = _interopRequireDefault(require("react"));
7
+ var _vitest2 = require("vitest");
8
+ var _ContextMenu = _interopRequireDefault(require("./ContextMenu"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const environment = _vitest2.vi.hoisted(() => ({
11
+ isTouch: false
12
+ }));
13
+ _vitest2.vi.mock('../../utils/environment', () => ({
14
+ useIsTouch: () => environment.isTouch
15
+ }));
16
+ _vitest2.vi.mock('chayns-api', async importOriginal => ({
17
+ ...(await importOriginal()),
18
+ createDialog: _vitest2.vi.fn(),
19
+ useSite: () => ({
20
+ colorMode: 0
21
+ })
22
+ }));
23
+ const renderMenu = items => {
24
+ (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ContextMenu.default, {
25
+ items: items,
26
+ coordinates: {
27
+ x: 0,
28
+ y: 0
29
+ }
30
+ }, /*#__PURE__*/_react2.default.createElement("button", {
31
+ type: "button"
32
+ }, "Options")));
33
+ _react.fireEvent.click(_react.screen.getByRole('button', {
34
+ name: 'Options'
35
+ }));
36
+ };
37
+ const createItems = () => [{
38
+ key: 'edit',
39
+ text: 'Edit',
40
+ onClick: _vitest2.vi.fn()
41
+ }, {
42
+ key: 'delete',
43
+ text: 'Delete',
44
+ isDisabled: true,
45
+ disabledReason: 'You do not have permission to delete this entry.',
46
+ onClick: _vitest2.vi.fn()
47
+ }];
48
+ (0, _vitest2.beforeEach)(() => {
49
+ environment.isTouch = false;
50
+ _vitest2.vi.clearAllMocks();
51
+ });
52
+ (0, _vitest2.describe)('ContextMenu disabled items', () => {
53
+ (0, _vitest2.it)('keeps disabled items visible and leaves the menu open when clicked', async () => {
54
+ var _items$, _items$2;
55
+ const items = createItems();
56
+ renderMenu(items);
57
+ const disabledItem = await _react.screen.findByRole('menuitem', {
58
+ name: 'Delete'
59
+ });
60
+ (0, _vitest2.expect)(disabledItem).toHaveAttribute('aria-disabled', 'true');
61
+ (0, _vitest2.expect)(disabledItem).toHaveAccessibleDescription((_items$ = items[1]) === null || _items$ === void 0 ? void 0 : _items$.disabledReason);
62
+ (0, _vitest2.expect)(disabledItem).toHaveStyle({
63
+ opacity: '0.5',
64
+ cursor: 'default'
65
+ });
66
+ _react.fireEvent.click(disabledItem);
67
+ (0, _vitest2.expect)((_items$2 = items[1]) === null || _items$2 === void 0 ? void 0 : _items$2.onClick).not.toHaveBeenCalled();
68
+ (0, _vitest2.expect)(disabledItem).toBeInTheDocument();
69
+ await (0, _react.waitFor)(() => {
70
+ var _items$3;
71
+ (0, _vitest2.expect)(document.querySelector('[data-ispopup="true"]')).toHaveTextContent(((_items$3 = items[1]) === null || _items$3 === void 0 ? void 0 : _items$3.disabledReason) ?? '');
72
+ });
73
+ });
74
+ (0, _vitest2.it)('shows the disabled reason on hover', async () => {
75
+ renderMenu(createItems());
76
+ const disabledItem = await _react.screen.findByRole('menuitem', {
77
+ name: 'Delete'
78
+ });
79
+ _react.fireEvent.mouseEnter(disabledItem);
80
+ await (0, _react.waitFor)(() => {
81
+ (0, _vitest2.expect)(document.querySelector('[data-ispopup="true"]')).toHaveTextContent('You do not have permission to delete this entry.');
82
+ });
83
+ });
84
+ _vitest2.it.each(['Enter', ' '])('does not activate a disabled item using %s', async key => {
85
+ var _items$4;
86
+ const items = createItems();
87
+ renderMenu(items);
88
+ const disabledItem = await _react.screen.findByRole('menuitem', {
89
+ name: 'Delete'
90
+ });
91
+ disabledItem.focus();
92
+ _react.fireEvent.keyDown(disabledItem, {
93
+ key
94
+ });
95
+ (0, _vitest2.expect)((_items$4 = items[1]) === null || _items$4 === void 0 ? void 0 : _items$4.onClick).not.toHaveBeenCalled();
96
+ (0, _vitest2.expect)(disabledItem).toBeInTheDocument();
97
+ });
98
+ (0, _vitest2.it)('prevents activating disabled items reached using arrow keys', async () => {
99
+ var _items$5, _items$6;
100
+ const items = createItems();
101
+ renderMenu(items);
102
+ await _react.screen.findByRole('menuitem', {
103
+ name: 'Delete'
104
+ });
105
+ const trigger = _react.screen.getByRole('button', {
106
+ name: 'Options'
107
+ });
108
+ _react.fireEvent.keyDown(trigger, {
109
+ key: 'ArrowDown'
110
+ });
111
+ _react.fireEvent.keyDown(trigger, {
112
+ key: 'ArrowDown'
113
+ });
114
+ _react.fireEvent.keyDown(trigger, {
115
+ key: 'Enter'
116
+ });
117
+ (0, _vitest2.expect)((_items$5 = items[1]) === null || _items$5 === void 0 ? void 0 : _items$5.onClick).not.toHaveBeenCalled();
118
+ (0, _vitest2.expect)(_react.screen.getByRole('menuitem', {
119
+ name: 'Delete'
120
+ })).toBeInTheDocument();
121
+ _react.fireEvent.keyDown(trigger, {
122
+ key: 'ArrowDown'
123
+ });
124
+ _react.fireEvent.keyDown(trigger, {
125
+ key: 'Enter'
126
+ });
127
+ (0, _vitest2.expect)((_items$6 = items[0]) === null || _items$6 === void 0 ? void 0 : _items$6.onClick).toHaveBeenCalledOnce();
128
+ });
129
+ (0, _vitest2.it)('does not initially select a disabled item marked as selected', async () => {
130
+ var _items$7;
131
+ const items = createItems().map(item => ({
132
+ ...item,
133
+ isSelected: item.isDisabled
134
+ }));
135
+ renderMenu(items);
136
+ await _react.screen.findByRole('menuitem', {
137
+ name: 'Delete'
138
+ });
139
+ _react.fireEvent.keyDown(_react.screen.getByRole('button', {
140
+ name: 'Options'
141
+ }), {
142
+ key: 'Enter'
143
+ });
144
+ (0, _vitest2.expect)((_items$7 = items[1]) === null || _items$7 === void 0 ? void 0 : _items$7.onClick).not.toHaveBeenCalled();
145
+ (0, _vitest2.expect)(_react.screen.getByRole('menuitem', {
146
+ name: 'Delete'
147
+ })).toBeInTheDocument();
148
+ });
149
+ (0, _vitest2.it)('still activates enabled items and closes the menu', async () => {
150
+ var _items$8;
151
+ const items = createItems();
152
+ renderMenu(items);
153
+ _react.fireEvent.click(await _react.screen.findByRole('menuitem', {
154
+ name: 'Edit'
155
+ }));
156
+ (0, _vitest2.expect)((_items$8 = items[0]) === null || _items$8 === void 0 ? void 0 : _items$8.onClick).toHaveBeenCalledOnce();
157
+ await (0, _react.waitFor)(() => (0, _vitest2.expect)(_react.screen.queryByRole('menuitem')).not.toBeInTheDocument());
158
+ });
159
+ (0, _vitest2.it)('supports disabled items without a reason', async () => {
160
+ const onClick = _vitest2.vi.fn();
161
+ renderMenu([{
162
+ key: 'delete',
163
+ text: 'Delete',
164
+ isDisabled: true,
165
+ onClick
166
+ }]);
167
+ _react.fireEvent.click(await _react.screen.findByRole('menuitem', {
168
+ name: 'Delete'
169
+ }));
170
+ (0, _vitest2.expect)(onClick).not.toHaveBeenCalled();
171
+ (0, _vitest2.expect)(document.querySelector('[data-ispopup="true"]')).not.toBeInTheDocument();
172
+ });
173
+ (0, _vitest2.it)('passes disabled items and their reasons to the native select dialog on touch devices', async () => {
174
+ var _items$9, _items$0, _items$1;
175
+ environment.isTouch = true;
176
+ const items = createItems();
177
+ const open = _vitest2.vi.fn().mockResolvedValue({
178
+ result: []
179
+ });
180
+ _vitest2.vi.mocked(_chaynsApi.createDialog).mockReturnValue({
181
+ open
182
+ });
183
+ renderMenu(items);
184
+ await (0, _react.waitFor)(() => (0, _vitest2.expect)(open).toHaveBeenCalledOnce());
185
+ (0, _vitest2.expect)(_chaynsApi.createDialog).toHaveBeenCalledWith(_vitest2.expect.objectContaining({
186
+ list: [_vitest2.expect.objectContaining({
187
+ id: 0,
188
+ name: 'Edit',
189
+ disabled: undefined,
190
+ subtitle: undefined
191
+ }), _vitest2.expect.objectContaining({
192
+ id: 1,
193
+ name: 'Delete',
194
+ disabled: true,
195
+ subtitle: (_items$9 = items[1]) === null || _items$9 === void 0 ? void 0 : _items$9.disabledReason
196
+ })]
197
+ }));
198
+ (0, _vitest2.expect)(_react.screen.queryByRole('menuitem')).not.toBeInTheDocument();
199
+ (0, _vitest2.expect)((_items$0 = items[0]) === null || _items$0 === void 0 ? void 0 : _items$0.onClick).not.toHaveBeenCalled();
200
+ (0, _vitest2.expect)((_items$1 = items[1]) === null || _items$1 === void 0 ? void 0 : _items$1.onClick).not.toHaveBeenCalled();
201
+ });
202
+ (0, _vitest2.it)('does not activate a disabled item even if the native dialog returns it', async () => {
203
+ var _items$10;
204
+ environment.isTouch = true;
205
+ const items = createItems();
206
+ const open = _vitest2.vi.fn().mockResolvedValue({
207
+ result: [1]
208
+ });
209
+ _vitest2.vi.mocked(_chaynsApi.createDialog).mockReturnValue({
210
+ open
211
+ });
212
+ renderMenu(items);
213
+ await (0, _react.waitFor)(() => (0, _vitest2.expect)(open).toHaveBeenCalledOnce());
214
+ (0, _vitest2.expect)((_items$10 = items[1]) === null || _items$10 === void 0 ? void 0 : _items$10.onClick).not.toHaveBeenCalled();
215
+ });
216
+ (0, _vitest2.it)('keeps using the native select dialog on touch devices for enabled items', async () => {
217
+ environment.isTouch = true;
218
+ const onClick = _vitest2.vi.fn();
219
+ _vitest2.vi.mocked(_chaynsApi.createDialog).mockReturnValue({
220
+ open: _vitest2.vi.fn().mockResolvedValue({
221
+ result: [0]
222
+ })
223
+ });
224
+ renderMenu([{
225
+ key: 'edit',
226
+ text: 'Edit',
227
+ onClick
228
+ }]);
229
+ await (0, _react.waitFor)(() => (0, _vitest2.expect)(onClick).toHaveBeenCalledOnce());
230
+ (0, _vitest2.expect)(_chaynsApi.createDialog).toHaveBeenCalledOnce();
231
+ (0, _vitest2.expect)(_react.screen.queryByRole('menuitem')).not.toBeInTheDocument();
232
+ });
233
+ });
234
+ //# sourceMappingURL=ContextMenu.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextMenu.test.js","names":["require","_react","_chaynsApi","_react2","_interopRequireDefault","_vitest2","_ContextMenu","e","__esModule","default","environment","vi","hoisted","isTouch","mock","useIsTouch","importOriginal","createDialog","fn","useSite","colorMode","renderMenu","items","render","createElement","coordinates","x","y","type","fireEvent","click","screen","getByRole","name","createItems","key","text","onClick","isDisabled","disabledReason","beforeEach","clearAllMocks","describe","it","_items$","_items$2","disabledItem","findByRole","expect","toHaveAttribute","toHaveAccessibleDescription","toHaveStyle","opacity","cursor","not","toHaveBeenCalled","toBeInTheDocument","waitFor","_items$3","document","querySelector","toHaveTextContent","mouseEnter","each","_items$4","focus","keyDown","_items$5","_items$6","trigger","toHaveBeenCalledOnce","_items$7","map","item","isSelected","_items$8","queryByRole","_items$9","_items$0","_items$1","open","mockResolvedValue","result","mocked","mockReturnValue","toHaveBeenCalledWith","objectContaining","list","id","disabled","undefined","subtitle","_items$10"],"sources":["../../../../src/components/context-menu/ContextMenu.test.tsx"],"sourcesContent":["import '@testing-library/jest-dom/vitest';\nimport { fireEvent, render, screen, waitFor } from '@testing-library/react';\nimport { createDialog } from 'chayns-api';\nimport React from 'react';\nimport { beforeEach, describe, expect, it, vi } from 'vitest';\nimport ContextMenu from './ContextMenu';\nimport type { ContextMenuItem } from './ContextMenu.types';\n\nconst environment = vi.hoisted(() => ({ isTouch: false }));\n\nvi.mock('../../utils/environment', () => ({\n useIsTouch: () => environment.isTouch,\n}));\n\nvi.mock('chayns-api', async (importOriginal) => ({\n ...(await importOriginal<typeof import('chayns-api')>()),\n createDialog: vi.fn(),\n useSite: () => ({ colorMode: 0 }),\n}));\n\nconst renderMenu = (items: ContextMenuItem[]) => {\n render(\n <ContextMenu items={items} coordinates={{ x: 0, y: 0 }}>\n <button type=\"button\">Options</button>\n </ContextMenu>,\n );\n\n fireEvent.click(screen.getByRole('button', { name: 'Options' }));\n};\n\nconst createItems = (): ContextMenuItem[] => [\n { key: 'edit', text: 'Edit', onClick: vi.fn() },\n {\n key: 'delete',\n text: 'Delete',\n isDisabled: true,\n disabledReason: 'You do not have permission to delete this entry.',\n onClick: vi.fn(),\n },\n];\n\nbeforeEach(() => {\n environment.isTouch = false;\n vi.clearAllMocks();\n});\n\ndescribe('ContextMenu disabled items', () => {\n it('keeps disabled items visible and leaves the menu open when clicked', async () => {\n const items = createItems();\n renderMenu(items);\n\n const disabledItem = await screen.findByRole('menuitem', { name: 'Delete' });\n expect(disabledItem).toHaveAttribute('aria-disabled', 'true');\n expect(disabledItem).toHaveAccessibleDescription(items[1]?.disabledReason);\n expect(disabledItem).toHaveStyle({ opacity: '0.5', cursor: 'default' });\n\n fireEvent.click(disabledItem);\n\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n expect(disabledItem).toBeInTheDocument();\n await waitFor(() => {\n expect(document.querySelector('[data-ispopup=\"true\"]')).toHaveTextContent(\n items[1]?.disabledReason ?? '',\n );\n });\n });\n\n it('shows the disabled reason on hover', async () => {\n renderMenu(createItems());\n const disabledItem = await screen.findByRole('menuitem', { name: 'Delete' });\n\n fireEvent.mouseEnter(disabledItem);\n\n await waitFor(() => {\n expect(document.querySelector('[data-ispopup=\"true\"]')).toHaveTextContent(\n 'You do not have permission to delete this entry.',\n );\n });\n });\n\n it.each(['Enter', ' '])('does not activate a disabled item using %s', async (key) => {\n const items = createItems();\n renderMenu(items);\n const disabledItem = await screen.findByRole('menuitem', { name: 'Delete' });\n\n disabledItem.focus();\n fireEvent.keyDown(disabledItem, { key });\n\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n expect(disabledItem).toBeInTheDocument();\n });\n\n it('prevents activating disabled items reached using arrow keys', async () => {\n const items = createItems();\n renderMenu(items);\n await screen.findByRole('menuitem', { name: 'Delete' });\n const trigger = screen.getByRole('button', { name: 'Options' });\n\n fireEvent.keyDown(trigger, { key: 'ArrowDown' });\n fireEvent.keyDown(trigger, { key: 'ArrowDown' });\n fireEvent.keyDown(trigger, { key: 'Enter' });\n\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument();\n\n fireEvent.keyDown(trigger, { key: 'ArrowDown' });\n fireEvent.keyDown(trigger, { key: 'Enter' });\n\n expect(items[0]?.onClick).toHaveBeenCalledOnce();\n });\n\n it('does not initially select a disabled item marked as selected', async () => {\n const items = createItems().map((item) => ({\n ...item,\n isSelected: item.isDisabled,\n }));\n renderMenu(items);\n await screen.findByRole('menuitem', { name: 'Delete' });\n\n fireEvent.keyDown(screen.getByRole('button', { name: 'Options' }), { key: 'Enter' });\n\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument();\n });\n\n it('still activates enabled items and closes the menu', async () => {\n const items = createItems();\n renderMenu(items);\n\n fireEvent.click(await screen.findByRole('menuitem', { name: 'Edit' }));\n\n expect(items[0]?.onClick).toHaveBeenCalledOnce();\n await waitFor(() => expect(screen.queryByRole('menuitem')).not.toBeInTheDocument());\n });\n\n it('supports disabled items without a reason', async () => {\n const onClick = vi.fn();\n renderMenu([{ key: 'delete', text: 'Delete', isDisabled: true, onClick }]);\n\n fireEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }));\n\n expect(onClick).not.toHaveBeenCalled();\n expect(document.querySelector('[data-ispopup=\"true\"]')).not.toBeInTheDocument();\n });\n\n it('passes disabled items and their reasons to the native select dialog on touch devices', async () => {\n environment.isTouch = true;\n const items = createItems();\n const open = vi.fn().mockResolvedValue({ result: [] });\n vi.mocked(createDialog).mockReturnValue({\n open,\n } as unknown as ReturnType<typeof createDialog>);\n\n renderMenu(items);\n\n await waitFor(() => expect(open).toHaveBeenCalledOnce());\n expect(createDialog).toHaveBeenCalledWith(\n expect.objectContaining({\n list: [\n expect.objectContaining({\n id: 0,\n name: 'Edit',\n disabled: undefined,\n subtitle: undefined,\n }),\n expect.objectContaining({\n id: 1,\n name: 'Delete',\n disabled: true,\n subtitle: items[1]?.disabledReason,\n }),\n ],\n }),\n );\n expect(screen.queryByRole('menuitem')).not.toBeInTheDocument();\n expect(items[0]?.onClick).not.toHaveBeenCalled();\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n });\n\n it('does not activate a disabled item even if the native dialog returns it', async () => {\n environment.isTouch = true;\n const items = createItems();\n const open = vi.fn().mockResolvedValue({ result: [1] });\n vi.mocked(createDialog).mockReturnValue({\n open,\n } as unknown as ReturnType<typeof createDialog>);\n\n renderMenu(items);\n\n await waitFor(() => expect(open).toHaveBeenCalledOnce());\n expect(items[1]?.onClick).not.toHaveBeenCalled();\n });\n\n it('keeps using the native select dialog on touch devices for enabled items', async () => {\n environment.isTouch = true;\n const onClick = vi.fn();\n vi.mocked(createDialog).mockReturnValue({\n open: vi.fn().mockResolvedValue({ result: [0] }),\n } as unknown as ReturnType<typeof createDialog>);\n\n renderMenu([{ key: 'edit', text: 'Edit', onClick }]);\n\n await waitFor(() => expect(onClick).toHaveBeenCalledOnce());\n expect(createDialog).toHaveBeenCalledOnce();\n expect(screen.queryByRole('menuitem')).not.toBeInTheDocument();\n });\n});\n"],"mappings":";;AAAAA,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAAwC,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAA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
- {"version":3,"file":"ContextMenu.types.js","names":["ContextMenuAlignment","exports"],"sources":["../../../../src/components/context-menu/ContextMenu.types.ts"],"sourcesContent":["import type { CSSProperties, MouseEvent, ReactNode } from 'react';\n\n/**\n * Enum representing the possible alignments for the context menu.\n */\nexport enum ContextMenuAlignment {\n TopLeft,\n BottomLeft,\n TopRight,\n BottomRight,\n TopCenter,\n BottomCenter,\n}\n\n/**\n * Type representing the coordinates for positioning the context menu.\n */\nexport type ContextMenuCoordinates = {\n /** The x-coordinate. */\n x: number;\n /** The y-coordinate. */\n y: number;\n};\n\n/**\n * Type representing an item in the context menu.\n */\nexport type ContextMenuItem = {\n /** Optional icons for the item. Can be strings or React nodes. */\n icons?: string[] | ReactNode;\n /** Whether the item is selected. */\n isSelected?: boolean;\n /** Unique key for the item. */\n key: string;\n /** Function called when the item is clicked. */\n onClick: (event?: MouseEvent<HTMLDivElement>) => Promise<void> | void;\n /** Whether to show a spacer after the item. */\n shouldShowSpacer?: boolean;\n /** The text displayed for the item. */\n text: string;\n};\n\n/**\n * Props for the ContextMenu component.\n */\nexport type ContextMenuProps = {\n /**\n * Context menu alignment\n * @description Optional custom alignment used instead of calculating it using the alignment\n * within the page. The available alignments can be taken from the ContextMenuAlignment enum.\n * @example alignment={ContextMenuAlignment.TopLeft}\n * @optional\n */\n alignment?: ContextMenuAlignment;\n /**\n * Additional class name applied to the trigger wrapper.\n * @optional\n */\n className?: string;\n /**\n * Children element\n * @description The element over which the content of the ContextMenu should be displayed.\n * @example children={<Icon icons={['fa fa-paper-clip']} />\n * @default <Icon icons={['ts-ellipsis_v']} size={18} />\n * @optional\n */\n children?: ReactNode;\n /**\n * Container element\n * @description The element where the content of the ContextMenu should be rendered via React Portal.\n * @example container={document.body}\n * @optional\n */\n container?: Element;\n /**\n * Custom coordinates\n * @description Optional own coordinates to be used instead of calculating the alignment based\n * on the alignment of the children.\n * @example coordinates={{ x: 100, y: 200 }}\n * @optional\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * Context menu headline\n * @description The headline of the context menu. If not provided, no headline will be displayed.\n * @example headline=\"Options\"\n * @optional\n */\n headline?: string;\n /**\n * Menu items\n * @description The items that will be displayed in the content of the ContextMenu. Custom icon\n * elements only will be displayed on desktop devices.\n * @example items={[{ key: '1', text: 'Option 1', onClick: () => {} }]}\n */\n items: ContextMenuItem[];\n /**\n * Hide callback function\n * @description Function to be executed when the content of the Context menu has been hidden.\n * @example onHide={() => console.log('Menu hidden')}\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Show callback function\n * @description Function to be executed when the content of the Context menu has been shown.\n * @example onShow={() => console.log('Menu shown')}\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Close on popup click flag\n * @description Whether the popup should be closed if it is clicked.\n * @default true\n * @optional\n */\n shouldCloseOnPopupClick?: boolean;\n /**\n * Disable click flag\n * @description Whether the click should be disabled.\n * @default false\n * @optional\n */\n shouldDisableClick?: boolean;\n /**\n * Hide popup arrow flag\n * @description Whether the arrow of the popup should be hidden.\n * @default false\n * @optional\n */\n shouldHidePopupArrow?: boolean;\n /**\n * Whether the default trigger padding/background styles should be applied.\n * @description Disable this when the trigger child already provides its own full visual styling.\n * @default true\n * @optional\n */\n shouldUseDefaultTriggerStyles?: boolean;\n /**\n * Show hover effect flag\n * @description Whether the hover effect should be shown.\n * @default false\n * @optional\n */\n shouldShowHoverEffect?: boolean;\n /**\n * Enables keyboard-only focus highlighting for the trigger.\n * @default false\n * @optional\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Inline styles applied to the trigger wrapper.\n * @optional\n */\n style?: CSSProperties;\n /**\n * Vertical offset between the trigger element and the context menu.\n * @description Use this prop to fine-tune the context menu position on the Y axis. Positive and\n * negative values can be used depending on the desired spacing.\n * @default 0\n * @example yOffset={8}\n * @optional\n */\n yOffset?: number;\n /**\n * Z-index value\n * @description The z-index of the popup.\n * @example zIndex={100}\n * @default 20\n * @optional\n */\n zIndex?: number;\n /**\n * Optional text for the select dialog.\n */\n dialogText?: string;\n};\n\n/**\n * Ref interface for the ContextMenu component.\n */\nexport interface ContextMenuRef {\n /** Hides the context menu. */\n hide: VoidFunction;\n /** Shows the context menu. */\n show: VoidFunction;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AAFA,IAGYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAShC;AACA;AACA;AAQA;AACA;AACA;AAgBA;AACA;AACA;AAuIA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"ContextMenu.types.js","names":["ContextMenuAlignment","exports"],"sources":["../../../../src/components/context-menu/ContextMenu.types.ts"],"sourcesContent":["import type { CSSProperties, MouseEvent, ReactNode } from 'react';\n\n/**\n * Enum representing the possible alignments for the context menu.\n */\nexport enum ContextMenuAlignment {\n TopLeft,\n BottomLeft,\n TopRight,\n BottomRight,\n TopCenter,\n BottomCenter,\n}\n\n/**\n * Type representing the coordinates for positioning the context menu.\n */\nexport type ContextMenuCoordinates = {\n /** The x-coordinate. */\n x: number;\n /** The y-coordinate. */\n y: number;\n};\n\n/**\n * Type representing an item in the context menu.\n */\nexport type ContextMenuItem = {\n /** Optional icons for the item. Can be strings or React nodes. */\n icons?: string[] | ReactNode;\n /**\n * Whether the item is disabled. Disabled items cannot be activated.\n */\n isDisabled?: boolean;\n /**\n * Reason why the item is disabled. Only shown for disabled items.\n * Displayed as a tooltip on desktop and a subtitle in the native select dialog on touch devices.\n */\n disabledReason?: string;\n /** Whether the item is selected. */\n isSelected?: boolean;\n /** Unique key for the item. */\n key: string;\n /** Function called when the item is clicked. */\n onClick: (event?: MouseEvent<HTMLDivElement>) => Promise<void> | void;\n /** Whether to show a spacer after the item. */\n shouldShowSpacer?: boolean;\n /** The text displayed for the item. */\n text: string;\n};\n\n/**\n * Props for the ContextMenu component.\n */\nexport type ContextMenuProps = {\n /**\n * Context menu alignment\n * @description Optional custom alignment used instead of calculating it using the alignment\n * within the page. The available alignments can be taken from the ContextMenuAlignment enum.\n * @example alignment={ContextMenuAlignment.TopLeft}\n * @optional\n */\n alignment?: ContextMenuAlignment;\n /**\n * Additional class name applied to the trigger wrapper.\n * @optional\n */\n className?: string;\n /**\n * Children element\n * @description The element over which the content of the ContextMenu should be displayed.\n * @example children={<Icon icons={['fa fa-paper-clip']} />\n * @default <Icon icons={['ts-ellipsis_v']} size={18} />\n * @optional\n */\n children?: ReactNode;\n /**\n * Container element\n * @description The element where the content of the ContextMenu should be rendered via React Portal.\n * @example container={document.body}\n * @optional\n */\n container?: Element;\n /**\n * Custom coordinates\n * @description Optional own coordinates to be used instead of calculating the alignment based\n * on the alignment of the children.\n * @example coordinates={{ x: 100, y: 200 }}\n * @optional\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * Context menu headline\n * @description The headline of the context menu. If not provided, no headline will be displayed.\n * @example headline=\"Options\"\n * @optional\n */\n headline?: string;\n /**\n * Menu items\n * @description The items that will be displayed in the content of the ContextMenu. Custom icon\n * elements only will be displayed on desktop devices.\n * @example items={[{ key: '1', text: 'Option 1', onClick: () => {} }]}\n */\n items: ContextMenuItem[];\n /**\n * Hide callback function\n * @description Function to be executed when the content of the Context menu has been hidden.\n * @example onHide={() => console.log('Menu hidden')}\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Show callback function\n * @description Function to be executed when the content of the Context menu has been shown.\n * @example onShow={() => console.log('Menu shown')}\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Close on popup click flag\n * @description Whether the popup should be closed if it is clicked.\n * @default true\n * @optional\n */\n shouldCloseOnPopupClick?: boolean;\n /**\n * Disable click flag\n * @description Whether the click should be disabled.\n * @default false\n * @optional\n */\n shouldDisableClick?: boolean;\n /**\n * Hide popup arrow flag\n * @description Whether the arrow of the popup should be hidden.\n * @default false\n * @optional\n */\n shouldHidePopupArrow?: boolean;\n /**\n * Whether the default trigger padding/background styles should be applied.\n * @description Disable this when the trigger child already provides its own full visual styling.\n * @default true\n * @optional\n */\n shouldUseDefaultTriggerStyles?: boolean;\n /**\n * Show hover effect flag\n * @description Whether the hover effect should be shown.\n * @default false\n * @optional\n */\n shouldShowHoverEffect?: boolean;\n /**\n * Enables keyboard-only focus highlighting for the trigger.\n * @default false\n * @optional\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Inline styles applied to the trigger wrapper.\n * @optional\n */\n style?: CSSProperties;\n /**\n * Vertical offset between the trigger element and the context menu.\n * @description Use this prop to fine-tune the context menu position on the Y axis. Positive and\n * negative values can be used depending on the desired spacing.\n * @default 0\n * @example yOffset={8}\n * @optional\n */\n yOffset?: number;\n /**\n * Z-index value\n * @description The z-index of the popup.\n * @example zIndex={100}\n * @default 20\n * @optional\n */\n zIndex?: number;\n /**\n * Optional text for the select dialog.\n */\n dialogText?: string;\n};\n\n/**\n * Ref interface for the ContextMenu component.\n */\nexport interface ContextMenuRef {\n /** Hides the context menu. */\n hide: VoidFunction;\n /** Shows the context menu. */\n show: VoidFunction;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AAFA,IAGYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAShC;AACA;AACA;AAQA;AACA;AACA;AAyBA;AACA;AACA;AAuIA;AACA;AACA","ignoreList":[]}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.selectItem = exports.getDefaultFocusedIndex = exports.getActiveItemIndex = void 0;
7
- const getDefaultFocusedIndex = items => items.findIndex(item => item.isSelected);
7
+ const getDefaultFocusedIndex = items => items.findIndex(item => item.isSelected && !item.isDisabled);
8
8
  exports.getDefaultFocusedIndex = getDefaultFocusedIndex;
9
9
  const getActiveItemIndex = ({
10
10
  contextMenuContentElement,
@@ -25,6 +25,9 @@ const selectItem = ({
25
25
  if (!item) {
26
26
  return false;
27
27
  }
28
+ if (item.isDisabled) {
29
+ return true;
30
+ }
28
31
  void item.onClick();
29
32
  if (shouldCloseOnPopupClick) {
30
33
  onClose();
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.utils.js","names":["getDefaultFocusedIndex","items","findIndex","item","isSelected","exports","getActiveItemIndex","contextMenuContentElement","focusedIndex","activeElement","document","activeItemElement","contains","closest","undefined","Number","dataset","index","selectItem","onClose","shouldCloseOnPopupClick","onClick"],"sources":["../../../../src/components/context-menu/ContextMenu.utils.ts"],"sourcesContent":["import type { ContextMenuItem } from './ContextMenu.types';\n\nexport const getDefaultFocusedIndex = (items: ContextMenuItem[]): number =>\n items.findIndex((item) => item.isSelected);\n\nexport const getActiveItemIndex = ({\n contextMenuContentElement,\n focusedIndex,\n}: {\n contextMenuContentElement: HTMLDivElement | null;\n focusedIndex: number;\n}) => {\n const activeElement = document.activeElement as HTMLElement | null;\n const activeItemElement = contextMenuContentElement?.contains(activeElement)\n ? activeElement?.closest<HTMLElement>('[data-index]')\n : undefined;\n\n return activeItemElement ? Number(activeItemElement.dataset.index) : focusedIndex;\n};\n\nexport const selectItem = ({\n index,\n items,\n onClose,\n shouldCloseOnPopupClick,\n}: {\n index: number;\n items: ContextMenuItem[];\n onClose: VoidFunction;\n shouldCloseOnPopupClick: boolean;\n}) => {\n const item = items[index];\n\n if (!item) {\n return false;\n }\n\n void item.onClick();\n\n if (shouldCloseOnPopupClick) {\n onClose();\n }\n\n return true;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,sBAAsB,GAAIC,KAAwB,IAC3DA,KAAK,CAACC,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC;AAACC,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAExC,MAAMM,kBAAkB,GAAGA,CAAC;EAC/BC,yBAAyB;EACzBC;AAIJ,CAAC,KAAK;EACF,MAAMC,aAAa,GAAGC,QAAQ,CAACD,aAAmC;EAClE,MAAME,iBAAiB,GAAGJ,yBAAyB,aAAzBA,yBAAyB,eAAzBA,yBAAyB,CAAEK,QAAQ,CAACH,aAAa,CAAC,GACtEA,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,OAAO,CAAc,cAAc,CAAC,GACnDC,SAAS;EAEf,OAAOH,iBAAiB,GAAGI,MAAM,CAACJ,iBAAiB,CAACK,OAAO,CAACC,KAAK,CAAC,GAAGT,YAAY;AACrF,CAAC;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEK,MAAMY,UAAU,GAAGA,CAAC;EACvBD,KAAK;EACLhB,KAAK;EACLkB,OAAO;EACPC;AAMJ,CAAC,KAAK;EACF,MAAMjB,IAAI,GAAGF,KAAK,CAACgB,KAAK,CAAC;EAEzB,IAAI,CAACd,IAAI,EAAE;IACP,OAAO,KAAK;EAChB;EAEA,KAAKA,IAAI,CAACkB,OAAO,CAAC,CAAC;EAEnB,IAAID,uBAAuB,EAAE;IACzBD,OAAO,CAAC,CAAC;EACb;EAEA,OAAO,IAAI;AACf,CAAC;AAACd,OAAA,CAAAa,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"ContextMenu.utils.js","names":["getDefaultFocusedIndex","items","findIndex","item","isSelected","isDisabled","exports","getActiveItemIndex","contextMenuContentElement","focusedIndex","activeElement","document","activeItemElement","contains","closest","undefined","Number","dataset","index","selectItem","onClose","shouldCloseOnPopupClick","onClick"],"sources":["../../../../src/components/context-menu/ContextMenu.utils.ts"],"sourcesContent":["import type { ContextMenuItem } from './ContextMenu.types';\n\nexport const getDefaultFocusedIndex = (items: ContextMenuItem[]): number =>\n items.findIndex((item) => item.isSelected && !item.isDisabled);\n\nexport const getActiveItemIndex = ({\n contextMenuContentElement,\n focusedIndex,\n}: {\n contextMenuContentElement: HTMLDivElement | null;\n focusedIndex: number;\n}) => {\n const activeElement = document.activeElement as HTMLElement | null;\n const activeItemElement = contextMenuContentElement?.contains(activeElement)\n ? activeElement?.closest<HTMLElement>('[data-index]')\n : undefined;\n\n return activeItemElement ? Number(activeItemElement.dataset.index) : focusedIndex;\n};\n\nexport const selectItem = ({\n index,\n items,\n onClose,\n shouldCloseOnPopupClick,\n}: {\n index: number;\n items: ContextMenuItem[];\n onClose: VoidFunction;\n shouldCloseOnPopupClick: boolean;\n}) => {\n const item = items[index];\n\n if (!item) {\n return false;\n }\n\n if (item.isDisabled) {\n return true;\n }\n\n void item.onClick();\n\n if (shouldCloseOnPopupClick) {\n onClose();\n }\n\n return true;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,sBAAsB,GAAIC,KAAwB,IAC3DA,KAAK,CAACC,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACC,UAAU,IAAI,CAACD,IAAI,CAACE,UAAU,CAAC;AAACC,OAAA,CAAAN,sBAAA,GAAAA,sBAAA;AAE5D,MAAMO,kBAAkB,GAAGA,CAAC;EAC/BC,yBAAyB;EACzBC;AAIJ,CAAC,KAAK;EACF,MAAMC,aAAa,GAAGC,QAAQ,CAACD,aAAmC;EAClE,MAAME,iBAAiB,GAAGJ,yBAAyB,aAAzBA,yBAAyB,eAAzBA,yBAAyB,CAAEK,QAAQ,CAACH,aAAa,CAAC,GACtEA,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,OAAO,CAAc,cAAc,CAAC,GACnDC,SAAS;EAEf,OAAOH,iBAAiB,GAAGI,MAAM,CAACJ,iBAAiB,CAACK,OAAO,CAACC,KAAK,CAAC,GAAGT,YAAY;AACrF,CAAC;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEK,MAAMY,UAAU,GAAGA,CAAC;EACvBD,KAAK;EACLjB,KAAK;EACLmB,OAAO;EACPC;AAMJ,CAAC,KAAK;EACF,MAAMlB,IAAI,GAAGF,KAAK,CAACiB,KAAK,CAAC;EAEzB,IAAI,CAACf,IAAI,EAAE;IACP,OAAO,KAAK;EAChB;EAEA,IAAIA,IAAI,CAACE,UAAU,EAAE;IACjB,OAAO,IAAI;EACf;EAEA,KAAKF,IAAI,CAACmB,OAAO,CAAC,CAAC;EAEnB,IAAID,uBAAuB,EAAE;IACzBD,OAAO,CAAC,CAAC;EACb;EAEA,OAAO,IAAI;AACf,CAAC;AAACd,OAAA,CAAAa,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _Icon = _interopRequireDefault(require("../../icon/Icon"));
8
+ var _ContextMenuContentItem = _interopRequireDefault(require("./context-menu-content-item/ContextMenuContentItem"));
9
9
  var _ContextMenuContent = require("./ContextMenuContent.styles");
10
10
  var _ContextMenu = require("../ContextMenu.types");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -48,39 +48,17 @@ const ContextMenuContent = /*#__PURE__*/_react.default.forwardRef(({
48
48
  const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -100 : 0;
49
49
  const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -21 : 21;
50
50
  const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;
51
- const content = (0, _react.useMemo)(() => items.map(({
52
- onClick,
53
- key,
54
- text,
55
- icons,
56
- shouldShowSpacer
57
- }, index) => {
58
- const isFocused = index === focusedIndex;
59
- let iconElement = null;
60
- if (/*#__PURE__*/(0, _react.isValidElement)(icons)) {
61
- iconElement = icons;
62
- } else if (Array.isArray(icons) && icons.length > 0) {
63
- iconElement = /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemIconWrapper, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
64
- icons: icons
65
- }));
66
- }
67
- return /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItem, {
68
- key: `context-menu-item-${key}`,
69
- "data-index": index
70
- }, /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemWrapper, {
71
- key: key,
72
- onClick: event => {
73
- event.preventDefault();
74
- event.stopPropagation();
75
- void onClick(event);
76
- },
77
- tabIndex: 0,
78
- $shouldHidePopupArrow: shouldHidePopupArrow,
79
- $isFocused: isFocused,
80
- onFocus: () => onItemFocus(index)
81
- }, iconElement, /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemText, null, text)), shouldShowSpacer && /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemSpacer, null));
82
- }), [items, focusedIndex, shouldHidePopupArrow, onItemFocus]);
51
+ const content = (0, _react.useMemo)(() => items.map((item, index) => /*#__PURE__*/_react.default.createElement(_ContextMenuContentItem.default, {
52
+ key: item.key,
53
+ item: item,
54
+ index: index,
55
+ isFocused: index === focusedIndex,
56
+ shouldHidePopupArrow: shouldHidePopupArrow,
57
+ onItemFocus: onItemFocus
58
+ })), [items, focusedIndex, shouldHidePopupArrow, onItemFocus]);
83
59
  return /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledMotionContextMenuContent, {
60
+ role: "menu",
61
+ "aria-label": headline,
84
62
  animate: {
85
63
  opacity: 1,
86
64
  y: 0
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuContent.js","names":["_react","_interopRequireWildcard","require","_Icon","_interopRequireDefault","_ContextMenuContent","_ContextMenu","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ContextMenuContent","React","forwardRef","alignment","coordinates","items","zIndex","shouldHidePopupArrow","headline","onItemFocus","focusedIndex","onMouseEnter","onMouseLeave","ref","isBottomLeftAlignment","ContextMenuAlignment","BottomLeft","isTopLeftAlignment","TopLeft","isTopRightAlignment","TopRight","isTopCenterAlignment","TopCenter","isBottomCenterAlignment","BottomCenter","percentageOffsetX","useMemo","anchorOffsetX","percentageOffsetY","anchorOffsetY","exitAndInitialY","content","map","onClick","key","text","icons","shouldShowSpacer","index","isFocused","iconElement","isValidElement","Array","isArray","length","createElement","StyledContextMenuContentItemIconWrapper","StyledContextMenuContentItem","StyledContextMenuContentItemWrapper","event","preventDefault","stopPropagation","tabIndex","$shouldHidePopupArrow","$isFocused","onFocus","StyledContextMenuContentItemText","StyledContextMenuContentItemSpacer","StyledMotionContextMenuContent","animate","opacity","y","exit","initial","$position","$zIndex","style","left","x","top","transition","ease","transformTemplate","StyledContextMenuContentHeadline","displayName","_default","exports"],"sources":["../../../../../src/components/context-menu/context-menu-content/ContextMenuContent.tsx"],"sourcesContent":["import React, { isValidElement, useMemo } from 'react';\nimport Icon from '../../icon/Icon';\nimport {\n StyledContextMenuContentHeadline,\n StyledContextMenuContentItem,\n StyledContextMenuContentItemIconWrapper,\n StyledContextMenuContentItemSpacer,\n StyledContextMenuContentItemText,\n StyledContextMenuContentItemWrapper,\n StyledMotionContextMenuContent,\n} from './ContextMenuContent.styles';\nimport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n} from '../ContextMenu.types';\n\ntype ContextMenuContentProps = {\n alignment: ContextMenuAlignment;\n coordinates: ContextMenuCoordinates;\n items: ContextMenuItem[];\n shouldHidePopupArrow: boolean;\n headline?: string;\n zIndex: number;\n focusedIndex: number;\n onItemFocus: (index: number) => void;\n onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n};\n\nconst ContextMenuContent = React.forwardRef<HTMLDivElement, ContextMenuContentProps>(\n (\n {\n alignment,\n coordinates,\n items,\n zIndex,\n shouldHidePopupArrow,\n headline,\n onItemFocus,\n focusedIndex,\n onMouseEnter,\n onMouseLeave,\n },\n ref,\n ) => {\n const isBottomLeftAlignment = alignment === ContextMenuAlignment.BottomLeft;\n const isTopLeftAlignment = alignment === ContextMenuAlignment.TopLeft;\n const isTopRightAlignment = alignment === ContextMenuAlignment.TopRight;\n const isTopCenterAlignment = alignment === ContextMenuAlignment.TopCenter;\n const isBottomCenterAlignment = alignment === ContextMenuAlignment.BottomCenter;\n\n const percentageOffsetX = useMemo(() => {\n if (isBottomLeftAlignment || isTopLeftAlignment) {\n return -100;\n }\n\n if (isBottomCenterAlignment || isTopCenterAlignment) {\n return -50;\n }\n\n return 0;\n }, [\n isBottomCenterAlignment,\n isBottomLeftAlignment,\n isTopCenterAlignment,\n isTopLeftAlignment,\n ]);\n\n const anchorOffsetX = useMemo(() => {\n if (isBottomLeftAlignment || isTopLeftAlignment) {\n return 15;\n }\n\n if (isBottomCenterAlignment || isTopCenterAlignment) {\n return 0;\n }\n\n return -15;\n }, [\n isBottomCenterAlignment,\n isBottomLeftAlignment,\n isTopCenterAlignment,\n isTopLeftAlignment,\n ]);\n\n const percentageOffsetY =\n isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -100 : 0;\n\n const anchorOffsetY =\n isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -21 : 21;\n\n const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;\n\n const content = useMemo(\n () =>\n items.map(({ onClick, key, text, icons, shouldShowSpacer }, index) => {\n const isFocused = index === focusedIndex;\n\n let iconElement = null;\n\n if (isValidElement(icons)) {\n iconElement = icons;\n } else if (Array.isArray(icons) && icons.length > 0) {\n iconElement = (\n <StyledContextMenuContentItemIconWrapper>\n <Icon icons={icons} />\n </StyledContextMenuContentItemIconWrapper>\n );\n }\n\n return (\n <StyledContextMenuContentItem\n key={`context-menu-item-${key}`}\n data-index={index}\n >\n <StyledContextMenuContentItemWrapper\n key={key}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n void onClick(event);\n }}\n tabIndex={0}\n $shouldHidePopupArrow={shouldHidePopupArrow}\n $isFocused={isFocused}\n onFocus={() => onItemFocus(index)}\n >\n {iconElement}\n <StyledContextMenuContentItemText>\n {text}\n </StyledContextMenuContentItemText>\n </StyledContextMenuContentItemWrapper>\n {shouldShowSpacer && <StyledContextMenuContentItemSpacer />}\n </StyledContextMenuContentItem>\n );\n }),\n [items, focusedIndex, shouldHidePopupArrow, onItemFocus],\n );\n\n return (\n <StyledMotionContextMenuContent\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n $position={alignment}\n $shouldHidePopupArrow={shouldHidePopupArrow}\n $zIndex={zIndex}\n ref={ref}\n style={{ left: coordinates.x, top: coordinates.y }}\n transition={{ ease: 'anticipate' }}\n transformTemplate={({ y = '0px' }) => `\n translateX(${percentageOffsetX}%)\n translateY(${percentageOffsetY}%)\n translateX(${anchorOffsetX}px)\n translateY(${anchorOffsetY}px)\n translateY(${y})\n `}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {headline && (\n <StyledContextMenuContentHeadline>{headline}</StyledContextMenuContentHeadline>\n )}\n {content}\n </StyledMotionContextMenuContent>\n );\n },\n);\n\nContextMenuContent.displayName = 'ContextMenuContent';\n\nexport default ContextMenuContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAJ,OAAA;AAI8B,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAA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C,OAAA,CAAA7F,OAAA,GAEvCiB,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ContextMenuContent.js","names":["_react","_interopRequireWildcard","require","_ContextMenuContentItem","_interopRequireDefault","_ContextMenuContent","_ContextMenu","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ContextMenuContent","React","forwardRef","alignment","coordinates","items","zIndex","shouldHidePopupArrow","headline","onItemFocus","focusedIndex","onMouseEnter","onMouseLeave","ref","isBottomLeftAlignment","ContextMenuAlignment","BottomLeft","isTopLeftAlignment","TopLeft","isTopRightAlignment","TopRight","isTopCenterAlignment","TopCenter","isBottomCenterAlignment","BottomCenter","percentageOffsetX","useMemo","anchorOffsetX","percentageOffsetY","anchorOffsetY","exitAndInitialY","content","map","item","index","createElement","key","isFocused","StyledMotionContextMenuContent","role","animate","opacity","y","exit","initial","$position","$shouldHidePopupArrow","$zIndex","style","left","x","top","transition","ease","transformTemplate","StyledContextMenuContentHeadline","displayName","_default","exports"],"sources":["../../../../../src/components/context-menu/context-menu-content/ContextMenuContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport ContextMenuContentItem from './context-menu-content-item/ContextMenuContentItem';\nimport {\n StyledContextMenuContentHeadline,\n StyledMotionContextMenuContent,\n} from './ContextMenuContent.styles';\nimport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n} from '../ContextMenu.types';\n\ntype ContextMenuContentProps = {\n alignment: ContextMenuAlignment;\n coordinates: ContextMenuCoordinates;\n items: ContextMenuItem[];\n shouldHidePopupArrow: boolean;\n headline?: string;\n zIndex: number;\n focusedIndex: number;\n onItemFocus: (index: number) => void;\n onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n};\n\nconst ContextMenuContent = React.forwardRef<HTMLDivElement, ContextMenuContentProps>(\n (\n {\n alignment,\n coordinates,\n items,\n zIndex,\n shouldHidePopupArrow,\n headline,\n onItemFocus,\n focusedIndex,\n onMouseEnter,\n onMouseLeave,\n },\n ref,\n ) => {\n const isBottomLeftAlignment = alignment === ContextMenuAlignment.BottomLeft;\n const isTopLeftAlignment = alignment === ContextMenuAlignment.TopLeft;\n const isTopRightAlignment = alignment === ContextMenuAlignment.TopRight;\n const isTopCenterAlignment = alignment === ContextMenuAlignment.TopCenter;\n const isBottomCenterAlignment = alignment === ContextMenuAlignment.BottomCenter;\n\n const percentageOffsetX = useMemo(() => {\n if (isBottomLeftAlignment || isTopLeftAlignment) {\n return -100;\n }\n\n if (isBottomCenterAlignment || isTopCenterAlignment) {\n return -50;\n }\n\n return 0;\n }, [\n isBottomCenterAlignment,\n isBottomLeftAlignment,\n isTopCenterAlignment,\n isTopLeftAlignment,\n ]);\n\n const anchorOffsetX = useMemo(() => {\n if (isBottomLeftAlignment || isTopLeftAlignment) {\n return 15;\n }\n\n if (isBottomCenterAlignment || isTopCenterAlignment) {\n return 0;\n }\n\n return -15;\n }, [\n isBottomCenterAlignment,\n isBottomLeftAlignment,\n isTopCenterAlignment,\n isTopLeftAlignment,\n ]);\n\n const percentageOffsetY =\n isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -100 : 0;\n\n const anchorOffsetY =\n isTopRightAlignment || isTopLeftAlignment || isTopCenterAlignment ? -21 : 21;\n\n const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;\n\n const content = useMemo(\n () =>\n items.map((item, index) => (\n <ContextMenuContentItem\n key={item.key}\n item={item}\n index={index}\n isFocused={index === focusedIndex}\n shouldHidePopupArrow={shouldHidePopupArrow}\n onItemFocus={onItemFocus}\n />\n )),\n [items, focusedIndex, shouldHidePopupArrow, onItemFocus],\n );\n\n return (\n <StyledMotionContextMenuContent\n role=\"menu\"\n aria-label={headline}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n $position={alignment}\n $shouldHidePopupArrow={shouldHidePopupArrow}\n $zIndex={zIndex}\n ref={ref}\n style={{ left: coordinates.x, top: coordinates.y }}\n transition={{ ease: 'anticipate' }}\n transformTemplate={({ y = '0px' }) => `\n translateX(${percentageOffsetX}%)\n translateY(${percentageOffsetY}%)\n translateX(${anchorOffsetX}px)\n translateY(${anchorOffsetY}px)\n translateY(${y})\n `}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {headline && (\n <StyledContextMenuContentHeadline>{headline}</StyledContextMenuContentHeadline>\n )}\n {content}\n </StyledMotionContextMenuContent>\n );\n },\n);\n\nContextMenuContent.displayName = 'ContextMenuContent';\n\nexport default ContextMenuContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAI8B,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GA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O,EAAE;MAAEC,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IAC9BC,IAAI,EAAE;MAAEF,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEZ;IAAgB,CAAE;IACzCc,OAAO,EAAE;MAAEH,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEZ;IAAgB,CAAE;IAC5Ce,SAAS,EAAE1C,SAAU;IACrB2C,qBAAqB,EAAEvC,oBAAqB;IAC5CwC,OAAO,EAAEzC,MAAO;IAChBO,GAAG,EAAEA,GAAI;IACTmC,KAAK,EAAE;MAAEC,IAAI,EAAE7C,WAAW,CAAC8C,CAAC;MAAEC,GAAG,EAAE/C,WAAW,CAACsC;IAAE,CAAE;IACnDU,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAa,CAAE;IACnCC,iBAAiB,EAAEA,CAAC;MAAEZ,CAAC,GAAG;IAAM,CAAC,KAAK;AACtD,iCAAiCjB,iBAAiB;AAClD,iCAAiCG,iBAAiB;AAClD,iCAAiCD,aAAa;AAC9C,iCAAiCE,aAAa;AAC9C,iCAAiCa,CAAC;AAClC,iBAAkB;IACF/B,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA;EAAa,GAE1BJ,QAAQ,iBACLlC,MAAA,CAAAS,OAAA,CAAAoD,aAAA,CAACxD,mBAAA,CAAA4E,gCAAgC,QAAE/C,QAA2C,CACjF,EACAuB,OAC2B,CAAC;AAEzC,CACJ,CAAC;AAED/B,kBAAkB,CAACwD,WAAW,GAAG,oBAAoB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEvCiB,kBAAkB","ignoreList":[]}
@@ -104,7 +104,9 @@ const StyledMotionContextMenuContent = exports.StyledMotionContextMenuContent =
104
104
  z-index: -1;
105
105
  }
106
106
  `;
107
- const StyledContextMenuContentItem = exports.StyledContextMenuContentItem = _styledComponents.default.div``;
107
+ const StyledContextMenuContentItem = exports.StyledContextMenuContentItem = _styledComponents.default.div`
108
+ position: relative;
109
+ `;
108
110
  const StyledContextMenuContentItemSpacer = exports.StyledContextMenuContentItemSpacer = _styledComponents.default.div`
109
111
  background-color: ${({
110
112
  theme
@@ -117,7 +119,12 @@ const StyledContextMenuContentItemWrapper = exports.StyledContextMenuContentItem
117
119
  border-radius: ${({
118
120
  $shouldHidePopupArrow
119
121
  }) => $shouldHidePopupArrow ? '3px' : 0};
120
- cursor: pointer;
122
+ cursor: ${({
123
+ $isDisabled
124
+ }) => $isDisabled ? 'default' : 'pointer'};
125
+ opacity: ${({
126
+ $isDisabled
127
+ }) => $isDisabled ? 0.5 : 1};
121
128
  display: flex;
122
129
  gap: 6px;
123
130
  margin: ${({
@@ -136,8 +143,9 @@ const StyledContextMenuContentItemWrapper = exports.StyledContextMenuContentItem
136
143
 
137
144
  &:hover {
138
145
  background-color: ${({
146
+ $isDisabled,
139
147
  theme
140
- }) => theme['secondary-103']};
148
+ }) => $isDisabled ? 'transparent' : theme['secondary-103']};
141
149
  }
142
150
  `;
143
151
  const StyledContextMenuContentItemIconWrapper = exports.StyledContextMenuContentItemIconWrapper = _styledComponents.default.div`
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuContent.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_ContextMenu","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionContextMenuContent","exports","styled","motion","div","theme","$shouldHidePopupArrow","text","$zIndex","css","$position","ContextMenuAlignment","TopLeft","BottomLeft","TopRight","BottomRight","TopCenter","BottomCenter","undefined","StyledContextMenuContentItem","StyledContextMenuContentItemSpacer","StyledContextMenuContentItemWrapper","$isFocused","StyledContextMenuContentItemIconWrapper","StyledContextMenuContentHeadline","StyledContextMenuContentItemText"],"sources":["../../../../../src/components/context-menu/context-menu-content/ContextMenuContent.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { ContextMenuAlignment } from '../ContextMenu.types';\n\ntype StyledMotionContextMenuContentProps = WithTheme<{\n $position: ContextMenuAlignment;\n $zIndex: number;\n $shouldHidePopupArrow: boolean;\n}>;\n\nexport const StyledMotionContextMenuContent = styled(\n motion.div,\n)<StyledMotionContextMenuContentProps>`\n background-color: ${({ theme }: StyledMotionContextMenuContentProps) => theme['001']};\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '6px' : '3px')};\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionContextMenuContentProps) => theme.text};\n max-width: 500px;\n pointer-events: all;\n position: absolute;\n z-index: ${({ $zIndex }) => $zIndex};\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $shouldHidePopupArrow }) =>\n $shouldHidePopupArrow &&\n css`\n display: none;\n `}\n\n ${({ $position }) => {\n switch ($position) {\n case ContextMenuAlignment.TopLeft:\n return css`\n bottom: -7px;\n right: 7px;\n transform: rotate(45deg);\n `;\n case ContextMenuAlignment.BottomLeft:\n return css`\n top: -7px;\n right: 7px;\n transform: rotate(225deg);\n `;\n case ContextMenuAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -7px;\n left: 7px;\n `;\n case ContextMenuAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: 7px;\n `;\n case ContextMenuAlignment.TopCenter:\n return css`\n bottom: -7px;\n right: 45%;\n transform: rotate(45deg);\n `;\n case ContextMenuAlignment.BottomCenter:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: 45%;\n `;\n\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '6px' : '3px')};\n z-index: -1;\n }\n`;\n\nexport const StyledContextMenuContentItem = styled.div``;\n\ntype StyledContextMenuContentItemSpacerProps = WithTheme<unknown>;\n\nexport const StyledContextMenuContentItemSpacer = styled.div<StyledContextMenuContentItemSpacerProps>`\n background-color: ${({ theme }) => theme['003']};\n height: 1px;\n width: 100%;\n`;\n\ntype StyledContextMenuContentItemWrapperProps = WithTheme<{\n $shouldHidePopupArrow: boolean;\n $isFocused: boolean;\n}>;\n\nexport const StyledContextMenuContentItemWrapper = styled.div<StyledContextMenuContentItemWrapperProps>`\n align-items: center;\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '3px' : 0)};\n cursor: pointer;\n display: flex;\n gap: 6px;\n margin: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '3px' : 0)};\n overflow: hidden;\n padding: 5px 8px;\n transition: background-color 0.3s ease;\n\n ${({ $isFocused, theme }) =>\n $isFocused &&\n css`\n background-color: ${theme['secondary-103']};\n `}\n\n &:hover {\n background-color: ${({ theme }: StyledContextMenuContentItemWrapperProps) =>\n theme['secondary-103']};\n }\n`;\n\nexport const StyledContextMenuContentItemIconWrapper = styled.div`\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 20px;\n`;\n\nexport const StyledContextMenuContentHeadline = styled.div`\n width: 100%;\n margin: 3px 6px;\n opacity: 50%;\n font-weight: bold;\n`;\n\nexport const StyledContextMenuContentItemText = styled.div`\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAA4D,SAAAE,wBAA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C;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA,CAAC;AAOM,MAAMgB,mCAAmC,GAAApB,OAAA,CAAAoB,mCAAA,GAAGnB,yBAAM,CAACE,GAA6C;AACvG;AACA,qBAAqB,CAAC;EAAEE;AAAsB,CAAC,KAAMA,qBAAqB,GAAG,KAAK,GAAG,CAAE;AACvF;AACA;AACA;AACA,cAAc,CAAC;EAAEA;AAAsB,CAAC,KAAMA,qBAAqB,GAAG,KAAK,GAAG,CAAE;AAChF;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEgB,UAAU;EAAEjB;AAAM,CAAC,KACpBiB,UAAU,IACV,IAAAb,qBAAG;AACX,gCAAgCJ,KAAK,CAAC,eAAe,CAAC;AACtD,SAAS;AACT;AACA;AACA,4BAA4B,CAAC;EAAEA;AAAgD,CAAC,KACpEA,KAAK,CAAC,eAAe,CAAC;AAClC;AACA,CAAC;AAEM,MAAMkB,uCAAuC,GAAAtB,OAAA,CAAAsB,uCAAA,GAAGrB,yBAAM,CAACE,GAAG;AACjE;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMoB,gCAAgC,GAAAvB,OAAA,CAAAuB,gCAAA,GAAGtB,yBAAM,CAACE,GAAG;AAC1D;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMqB,gCAAgC,GAAAxB,OAAA,CAAAwB,gCAAA,GAAGvB,yBAAM,CAACE,GAAG;AAC1D;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ContextMenuContent.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_ContextMenu","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionContextMenuContent","exports","styled","motion","div","theme","$shouldHidePopupArrow","text","$zIndex","css","$position","ContextMenuAlignment","TopLeft","BottomLeft","TopRight","BottomRight","TopCenter","BottomCenter","undefined","StyledContextMenuContentItem","StyledContextMenuContentItemSpacer","StyledContextMenuContentItemWrapper","$isDisabled","$isFocused","StyledContextMenuContentItemIconWrapper","StyledContextMenuContentHeadline","StyledContextMenuContentItemText"],"sources":["../../../../../src/components/context-menu/context-menu-content/ContextMenuContent.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { ContextMenuAlignment } from '../ContextMenu.types';\n\ntype StyledMotionContextMenuContentProps = WithTheme<{\n $position: ContextMenuAlignment;\n $zIndex: number;\n $shouldHidePopupArrow: boolean;\n}>;\n\nexport const StyledMotionContextMenuContent = styled(\n motion.div,\n)<StyledMotionContextMenuContentProps>`\n background-color: ${({ theme }: StyledMotionContextMenuContentProps) => theme['001']};\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '6px' : '3px')};\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionContextMenuContentProps) => theme.text};\n max-width: 500px;\n pointer-events: all;\n position: absolute;\n z-index: ${({ $zIndex }) => $zIndex};\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $shouldHidePopupArrow }) =>\n $shouldHidePopupArrow &&\n css`\n display: none;\n `}\n\n ${({ $position }) => {\n switch ($position) {\n case ContextMenuAlignment.TopLeft:\n return css`\n bottom: -7px;\n right: 7px;\n transform: rotate(45deg);\n `;\n case ContextMenuAlignment.BottomLeft:\n return css`\n top: -7px;\n right: 7px;\n transform: rotate(225deg);\n `;\n case ContextMenuAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -7px;\n left: 7px;\n `;\n case ContextMenuAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: 7px;\n `;\n case ContextMenuAlignment.TopCenter:\n return css`\n bottom: -7px;\n right: 45%;\n transform: rotate(45deg);\n `;\n case ContextMenuAlignment.BottomCenter:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: 45%;\n `;\n\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '6px' : '3px')};\n z-index: -1;\n }\n`;\n\nexport const StyledContextMenuContentItem = styled.div`\n position: relative;\n`;\n\ntype StyledContextMenuContentItemSpacerProps = WithTheme<unknown>;\n\nexport const StyledContextMenuContentItemSpacer = styled.div<StyledContextMenuContentItemSpacerProps>`\n background-color: ${({ theme }) => theme['003']};\n height: 1px;\n width: 100%;\n`;\n\ntype StyledContextMenuContentItemWrapperProps = WithTheme<{\n $shouldHidePopupArrow: boolean;\n $isFocused: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledContextMenuContentItemWrapper = styled.div<StyledContextMenuContentItemWrapperProps>`\n align-items: center;\n border-radius: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '3px' : 0)};\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n display: flex;\n gap: 6px;\n margin: ${({ $shouldHidePopupArrow }) => ($shouldHidePopupArrow ? '3px' : 0)};\n overflow: hidden;\n padding: 5px 8px;\n transition: background-color 0.3s ease;\n\n ${({ $isFocused, theme }) =>\n $isFocused &&\n css`\n background-color: ${theme['secondary-103']};\n `}\n\n &:hover {\n background-color: ${({ $isDisabled, theme }) =>\n $isDisabled ? 'transparent' : theme['secondary-103']};\n }\n`;\n\nexport const StyledContextMenuContentItemIconWrapper = styled.div`\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 20px;\n`;\n\nexport const StyledContextMenuContentHeadline = styled.div`\n width: 100%;\n margin: 3px 6px;\n opacity: 50%;\n font-weight: bold;\n`;\n\nexport const StyledContextMenuContentItemText = styled.div`\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAA4D,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,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ACA;AACA;AACA,CAAC;AAEM,MAAMqB,gCAAgC,GAAAxB,OAAA,CAAAwB,gCAAA,GAAGvB,yBAAM,CAACE,GAAG;AAC1D;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMsB,gCAAgC,GAAAzB,OAAA,CAAAyB,gCAAA,GAAGxB,yBAAM,CAACE,GAAG;AAC1D;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Icon = _interopRequireDefault(require("../../../icon/Icon"));
9
+ var _Tooltip = _interopRequireDefault(require("../../../tooltip/Tooltip"));
10
+ var _ContextMenuContent = require("../ContextMenuContent.styles");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ const ContextMenuContentItem = ({
14
+ item,
15
+ index,
16
+ isFocused,
17
+ shouldHidePopupArrow,
18
+ onItemFocus
19
+ }) => {
20
+ const disabledReasonId = (0, _react.useId)();
21
+ const [tooltipContainer, setTooltipContainer] = (0, _react.useState)(null);
22
+ const {
23
+ icons,
24
+ text,
25
+ onClick,
26
+ isDisabled = false,
27
+ disabledReason,
28
+ shouldShowSpacer
29
+ } = item;
30
+ let iconElement = null;
31
+ if (/*#__PURE__*/(0, _react.isValidElement)(icons)) {
32
+ iconElement = icons;
33
+ } else if (Array.isArray(icons) && icons.length > 0) {
34
+ iconElement = /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemIconWrapper, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
35
+ icons: icons
36
+ }));
37
+ }
38
+ const content = /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemWrapper, {
39
+ onClick: event => {
40
+ if (isDisabled) {
41
+ return;
42
+ }
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ void onClick(event);
46
+ },
47
+ tabIndex: 0,
48
+ role: "menuitem",
49
+ "aria-disabled": isDisabled,
50
+ "aria-describedby": isDisabled && disabledReason ? disabledReasonId : undefined,
51
+ $shouldHidePopupArrow: shouldHidePopupArrow,
52
+ $isFocused: isFocused,
53
+ $isDisabled: isDisabled,
54
+ onFocus: () => onItemFocus(index)
55
+ }, iconElement, /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemText, null, text));
56
+ return /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItem, {
57
+ ref: setTooltipContainer,
58
+ className: "context-menu-content-item",
59
+ "data-index": index,
60
+ "aria-disabled": isDisabled,
61
+ onClick: isDisabled ? event => event.stopPropagation() : undefined
62
+ }, isDisabled && disabledReason ? /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
63
+ item: {
64
+ text: disabledReason
65
+ },
66
+ container: tooltipContainer ?? undefined,
67
+ shouldUseFullWidth: true
68
+ }, content) : content, isDisabled && disabledReason && /*#__PURE__*/_react.default.createElement("span", {
69
+ id: disabledReasonId,
70
+ hidden: true
71
+ }, disabledReason), shouldShowSpacer && /*#__PURE__*/_react.default.createElement(_ContextMenuContent.StyledContextMenuContentItemSpacer, null));
72
+ };
73
+ var _default = exports.default = ContextMenuContentItem;
74
+ //# sourceMappingURL=ContextMenuContentItem.js.map