@gitlab/ui 68.5.0 → 68.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +35 -0
  3. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +4 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.css.map +1 -1
  6. package/dist/tokens/common_story_options.js +32 -0
  7. package/dist/tokens/css/tokens.css +122 -56
  8. package/dist/tokens/css/tokens.dark.css +2 -2
  9. package/dist/tokens/js/tokens.dark.js +1 -1
  10. package/dist/tokens/js/tokens.js +122 -56
  11. package/dist/tokens/json/tokens.dark.grouped.json +121 -55
  12. package/dist/tokens/json/tokens.dark.json +3504 -2104
  13. package/dist/tokens/json/tokens.grouped.json +121 -55
  14. package/dist/tokens/json/tokens.json +3465 -2065
  15. package/dist/tokens/scss/_tokens.dark.scss +2 -2
  16. package/dist/tokens/scss/_tokens.scss +122 -56
  17. package/dist/utils/utils.js +3 -2
  18. package/package.json +1 -1
  19. package/scss_to_js/scss_variables.js +122 -122
  20. package/scss_to_js/scss_variables.json +1265 -1265
  21. package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +44 -0
  22. package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.spec.js +64 -0
  23. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +15 -0
  24. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +10 -4
  25. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +4 -0
  26. package/src/scss/variables.scss +0 -74
  27. package/src/tokens/color.dark.tokens.json +1 -1
  28. package/src/tokens/color.dark.tokens.stories.js +42 -0
  29. package/src/tokens/color.data_viz.tokens.json +344 -0
  30. package/src/tokens/color.data_viz.tokens.stories.js +56 -0
  31. package/src/tokens/color.theme.tokens.json +412 -0
  32. package/src/tokens/color.theme.tokens.stories.js +60 -0
  33. package/src/tokens/color.tokens.json +0 -342
  34. package/src/tokens/color.tokens.stories.js +42 -0
  35. package/src/tokens/common_story_options.js +31 -0
  36. package/src/utils/utils.js +3 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [68.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v68.6.0...v68.7.0) (2023-11-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlDuoChatMessage:** added copy-code button ([3133d60](https://gitlab.com/gitlab-org/gitlab-ui/commit/3133d60d6004db689b4315fcc034774a4b53dac0))
7
+
8
+ # [68.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v68.5.0...v68.6.0) (2023-11-15)
9
+
10
+
11
+ ### Features
12
+
13
+ * **Tokens:** add theme color design tokens ([97405b4](https://gitlab.com/gitlab-org/gitlab-ui/commit/97405b483f44b60f8e24fa9dbb1a40dc080efd43))
14
+
1
15
  # [68.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v68.4.0...v68.5.0) (2023-11-14)
2
16
 
3
17
 
@@ -0,0 +1,35 @@
1
+ import iconsPath from '@gitlab/svgs/dist/icons.svg';
2
+
3
+ const createButton = () => {
4
+ const button = document.createElement('button');
5
+ button.type = 'button';
6
+ button.classList.add('btn', 'btn-default', 'btn-md', 'gl-button', 'btn-default-secondary', 'btn-icon');
7
+ button.dataset.title = 'Copy to clipboard';
8
+
9
+ // Create an SVG element with the correct namespace
10
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
11
+ svg.setAttribute('role', 'img');
12
+ svg.setAttribute('aria-hidden', 'true');
13
+ svg.classList.add('gl-button-icon', 'gl-icon', 's16');
14
+
15
+ // Create a 'use' element with the correct namespace
16
+ const use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
17
+ use.setAttribute('href', `${iconsPath}#copy-to-clipboard`);
18
+ svg.appendChild(use);
19
+ button.appendChild(svg);
20
+ return button;
21
+ };
22
+ class CopyCodeElement extends HTMLElement {
23
+ constructor() {
24
+ super();
25
+ const btn = createButton();
26
+ const wrapper = this.parentNode;
27
+ this.appendChild(btn);
28
+ btn.addEventListener('click', async () => {
29
+ const textToCopy = wrapper.innerText;
30
+ await navigator.clipboard.writeText(textToCopy);
31
+ });
32
+ }
33
+ }
34
+
35
+ export { CopyCodeElement };
@@ -2,6 +2,7 @@ import GlDuoUserFeedback from '../../../user_feedback/user_feedback';
2
2
  import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
3
3
  import { MESSAGE_MODEL_ROLES } from '../../constants';
4
4
  import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources';
5
+ import { CopyCodeElement } from './copy_code_element';
5
6
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
7
 
7
8
  const concatIndicesUntilEmpty = arr => {
@@ -65,6 +66,9 @@ var script = {
65
66
  * Is intentionally non-reactive
66
67
  */
67
68
  this.messageChunks = [];
69
+ if (!customElements.get('copy-code')) {
70
+ customElements.define('copy-code', CopyCodeElement);
71
+ }
68
72
  },
69
73
  mounted() {
70
74
  this.messageContent = this.content;