@coveord/plasma-mantine 52.12.1 → 52.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,10 @@ interface CodeEditorProps
47
47
  value?: string;
48
48
  /** onChange value for controlled input */
49
49
  onChange?(value: string): void;
50
+ /** Called whenever the search icon is clicked */
51
+ onSearch?(): void;
52
+ /** Called whenever the copy icon is clicked */
53
+ onCopy?(): void;
50
54
  /** Called whenever the code editor gets the focus */
51
55
  onFocus?(): void;
52
56
  /**
@@ -87,6 +91,8 @@ export const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {
87
91
  language,
88
92
  defaultValue,
89
93
  onChange,
94
+ onCopy,
95
+ onSearch,
90
96
  onFocus,
91
97
  value,
92
98
  label,
@@ -129,6 +135,7 @@ export const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {
129
135
  if (editorRef.current) {
130
136
  editorRef.current.focus();
131
137
  editorRef.current.trigger('editor', 'actions.find', '');
138
+ onSearch?.();
132
139
  }
133
140
  };
134
141
 
@@ -169,7 +176,7 @@ export const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {
169
176
  const _buttons = (
170
177
  <Group position="right" spacing={0}>
171
178
  <Search handleSearch={handleSearch} />
172
- <CopyToClipboard value={_value} />
179
+ <CopyToClipboard value={_value} onCopy={() => onCopy?.()} />
173
180
  </Group>
174
181
  );
175
182
 
@@ -70,4 +70,21 @@ describe('CodeEditor', () => {
70
70
  expect(screen.getByTestId('monaco-editor')).toHaveAttribute('focus');
71
71
  expect(screen.getByTestId('monaco-editor')).toHaveAttribute('trigger');
72
72
  });
73
+
74
+ it('calls the onCopy callback when clicking on the copy button', async () => {
75
+ const user = userEvent.setup();
76
+ const onCopySpy = vi.fn();
77
+ render(<CodeEditor onCopy={onCopySpy} />);
78
+ await user.click(screen.getByRole('button', {name: /copy/i}));
79
+
80
+ expect(onCopySpy).toHaveBeenCalledTimes(1);
81
+ });
82
+ it('calls the onSearch callback when clicking on the search button', async () => {
83
+ const user = userEvent.setup();
84
+ const onSearchSpy = vi.fn();
85
+ render(<CodeEditor onSearch={onSearchSpy} />);
86
+ await user.click(screen.getByRole('button', {name: /search/i}));
87
+
88
+ expect(onSearchSpy).toHaveBeenCalledTimes(1);
89
+ });
73
90
  });
@@ -7,6 +7,7 @@ import {
7
7
  type NotificationProps,
8
8
  type StepperStylesParams,
9
9
  type TabsStylesParams,
10
+ getStylesRef,
10
11
  } from '@mantine/core';
11
12
 
12
13
  import {PlasmaColors} from './PlasmaColors';
@@ -371,5 +372,22 @@ export const plasmaTheme: MantineThemeOverride = {
371
372
  },
372
373
  }),
373
374
  },
375
+ NavLink: {
376
+ styles: (theme) => ({
377
+ root: {
378
+ color: theme.colors.gray[6],
379
+ borderRadius: `${theme.defaultRadius}px 0px 0px ${theme.defaultRadius}px`,
380
+ },
381
+ label: {
382
+ ref: getStylesRef('label'),
383
+ fontWeight: 500,
384
+ },
385
+ children: {
386
+ [`.${getStylesRef('label')}`]: {
387
+ fontWeight: 300,
388
+ },
389
+ },
390
+ }),
391
+ },
374
392
  },
375
393
  };