@gitlab/duo-ui 0.3.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.4.0](https://gitlab.com/gitlab-org/duo-ui/compare/v0.3.0...v0.4.0) (2024-11-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update rollup config to include files from all paths ([4adcb17](https://gitlab.com/gitlab-org/duo-ui/commit/4adcb17729c40868c093625b10089858bf1cebae))
7
+
1
8
  # [0.3.0](https://gitlab.com/gitlab-org/duo-ui/compare/v0.2.0...v0.3.0) (2024-11-04)
2
9
 
3
10
 
package/dist/config.js ADDED
@@ -0,0 +1,44 @@
1
+ import translationKeys from '../translations';
2
+
3
+ const i18n = translationKeys;
4
+ let configured = false;
5
+
6
+ /**
7
+ * Set GitLab Duo-UI configuration.
8
+ *
9
+ * @typedef {object} GitLabUIConfiguration
10
+ * @template TValue=string
11
+ * @property {undefined | Object} translations Generic translations for component labels to fall back to.
12
+ */
13
+ const setConfigs = function () {
14
+ let {
15
+ translations
16
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ if (configured) {
18
+ if (process.env.NODE_ENV === 'development') {
19
+ throw new Error('GitLab Duo-UI can only be configured once!');
20
+ }
21
+ return;
22
+ }
23
+ configured = true;
24
+ if (typeof translations === 'object') {
25
+ if (process.env.NODE_ENV === 'development') {
26
+ const undefinedTranslationKeys = Object.keys(i18n).reduce((acc, current) => {
27
+ if (!(current in translations)) {
28
+ acc.push(current);
29
+ }
30
+ return acc;
31
+ }, []);
32
+ if (undefinedTranslationKeys.length) {
33
+ /* eslint-disable no-console */
34
+ console.warn('[@gitlab/duo-ui] The following translations have not been given, so will fall back to their default US English strings:');
35
+ console.table(undefinedTranslationKeys);
36
+ /* eslint-enable no-console */
37
+ }
38
+ }
39
+ Object.assign(i18n, translations);
40
+ }
41
+ };
42
+
43
+ export default setConfigs;
44
+ export { i18n };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default as DuoUserFeedback } from './components/user_feedback/user_feedback';
2
+ export { default as DuoChat } from './components/chat/duo_chat';
3
+ export { default as DuoChatContextItemMenu } from './components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Wrapper around setTimeout which executes immediately in visual tests
3
+ * in order to avoid flaky tests
4
+ */
5
+ function setStoryTimeout(fn, timeout) {
6
+ return setTimeout(fn, process.env.IS_VISUAL_TEST ? 0 : timeout);
7
+ }
8
+
9
+ // adopted this method from Bootstraps utils
10
+ // https://github.com/bootstrap-vue/bootstrap-vue/blob/2fd03f0b1d0cc41f9930078ba8b1c16b10e4ac2f/tests/utils.js#L6
11
+ const waitForAnimationFrame = () => new Promise(resolve => {
12
+ requestAnimationFrame(resolve);
13
+ });
14
+ const getResetAnimationsCSS = () => `
15
+ *, *::after, *::before {
16
+ -webkit-transition: none !important;
17
+ -moz-transition: none !important;
18
+ -ms-transition: none !important;
19
+ -o-transition: none !important;
20
+ transition: none !important;
21
+
22
+ -webkit-animation: none !important;
23
+ -moz-animation: none !important;
24
+ -ms-animation: none !important;
25
+ -o-animation: none !important;
26
+ animation: none !important;
27
+ }
28
+
29
+ input, textarea {
30
+ caret-color: transparent !important;
31
+ }`;
32
+
33
+ export { getResetAnimationsCSS, setStoryTimeout, waitForAnimationFrame };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/duo-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Duo UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",