@gitlab/ui 36.1.0 → 36.2.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.
@@ -126,6 +126,7 @@ export const setupStorybookReadme = () =>
126
126
  'GlNav',
127
127
  'GlNavItem',
128
128
  'GlNavItemDropdown',
129
+ 'GlPopover',
129
130
  ],
130
131
  components: {
131
132
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "36.1.0",
3
+ "version": "36.2.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,28 +1,3 @@
1
- import examples from './examples';
2
-
3
1
  export default {
4
2
  followsDesignSystem: true,
5
- examples,
6
- bootstrapComponent: 'b-popover',
7
- bootstrapPropsInfo: {
8
- target: {
9
- additionalInfo:
10
- 'Element string ID, or a reference to an element or component, that you want to trigger the popover.',
11
- required: true,
12
- },
13
- triggers: {
14
- enum: 'triggerVariantOptions',
15
- },
16
- placement: {
17
- enum: 'popoverPlacements',
18
- },
19
- boundary: {
20
- additionalInfo:
21
- '"scrollParent", "viewport", "window", or a reference to an HTML element. This is the container that the popover will be constrained to visually.You may need to change this if your target element is in a small container with overflow scroll',
22
- },
23
- container: {
24
- additionalInfo:
25
- 'Specify container as null (default, appends to <body>) to avoid rendering problems in more complex components (like input groups, button groups, etc). You can use container to optionally specify a different element to append the popover to.',
26
- },
27
- },
28
3
  };
@@ -1,8 +1,8 @@
1
- import { withKnobs, select, text } from '@storybook/addon-knobs';
2
1
  import { GlPopover, GlButton } from '../../../index';
3
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
4
2
  import { popoverPlacements } from '../../../utils/constants';
5
3
 
4
+ const defaultValue = (prop) => GlPopover.props[prop].default;
5
+
6
6
  const components = { GlPopover, GlButton };
7
7
 
8
8
  const contentString = `
@@ -11,84 +11,88 @@ const contentString = `
11
11
  massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
12
12
  `;
13
13
 
14
- const template = `
15
- <div class="gl-display-flex gl-justify-content-center gl-p-6">
16
- <gl-button id="pop-top">{{placement}}</gl-button>
17
- <gl-popover target="pop-top"
18
- triggers="hover focus"
14
+ const getTemplate = (id, slots = '') => `
15
+ <div style="height:400px;" class="gl-display-flex gl-justify-content-center gl-align-items-center">
16
+ <gl-button id="${id}">{{placement}}</gl-button>
17
+ <gl-popover
18
+ target="${id}"
19
+ :triggers="triggers"
19
20
  :title="title"
20
21
  :placement="placement"
22
+ :show-close-button="showCloseButton"
21
23
  content="${contentString}"
22
- data-testid="popover-with-props"
23
- show
24
- />
25
- </div>
26
- `;
24
+ data-testid="${id}"
25
+ :show="$options.viewMode !== 'docs'">${slots}</gl-popover>
26
+ </div>`;
27
27
 
28
- const scopedSlotTemplate = `
29
- <div class="gl-display-flex gl-justify-content-center gl-p-6">
30
- <gl-button id="pop-top-two" data-testid="popover-button-click">{{placement}}</gl-button>
31
- <gl-popover target="pop-top-two"
32
- triggers="click"
33
- :placement="placement"
34
- content="${contentString}"
35
- >
36
- <template #title>
37
- <span data-testid="popover-title">Popover title</span>
38
- </template>
39
- </gl-popover>
40
- </div>
41
- `;
28
+ const generateProps = ({
29
+ placement = popoverPlacements.top,
30
+ title = 'Popover',
31
+ triggers = defaultValue('triggers'),
32
+ cssClasses = defaultValue('cssClasses'),
33
+ showCloseButton = defaultValue('showCloseButton'),
34
+ } = {}) => ({
35
+ placement,
36
+ title,
37
+ triggers,
38
+ cssClasses,
39
+ showCloseButton,
40
+ });
41
+
42
+ export const Default = (_args, { viewMode, argTypes }) => ({
43
+ viewMode,
44
+ components,
45
+ props: Object.keys(argTypes),
46
+ template: getTemplate('popover-with-props'),
47
+ });
48
+ Default.args = generateProps();
42
49
 
43
- function generateProps({ placement = popoverPlacements.top, title = 'Popover', triggers } = {}) {
44
- return {
50
+ export const WithCloseButton = (_args, { viewMode, argTypes }) => ({
51
+ viewMode,
52
+ components,
53
+ props: Object.keys(argTypes),
54
+ template: getTemplate('popover-with-close-button'),
55
+ });
56
+ WithCloseButton.args = generateProps({
57
+ showCloseButton: true,
58
+ });
59
+
60
+ export const OnClick = (_args, { viewMode, argTypes }) => ({
61
+ viewMode,
62
+ components,
63
+ props: Object.keys(argTypes),
64
+ template: getTemplate(
65
+ 'popover-button-click',
66
+ `
67
+ <template #title>
68
+ <span data-testid="popover-title">Popover title</span>
69
+ </template>
70
+ `
71
+ ),
72
+ });
73
+ OnClick.args = generateProps({
74
+ triggers: 'click',
75
+ });
76
+ OnClick.parameters = {
77
+ storyshots: { disable: true },
78
+ };
79
+
80
+ export default {
81
+ title: 'base/popover',
82
+ component: GlPopover,
83
+ parameters: {
84
+ knobs: { disable: true },
85
+ bootstrapComponent: 'b-popover',
86
+ },
87
+ argTypes: {
45
88
  placement: {
46
- type: String,
47
- default: select('placement', popoverPlacements, placement),
89
+ options: Object.values(popoverPlacements),
90
+ control: {
91
+ type: 'select',
92
+ },
48
93
  },
49
94
  title: {
50
- type: String,
51
- default: text('title', title),
95
+ control: { type: 'text' },
52
96
  },
53
- triggers: {
54
- type: String,
55
- default: text('hover focus', triggers),
56
- },
57
- };
58
- }
59
-
60
- documentedStoriesOf('base/popover', '')
61
- .addDecorator(withKnobs)
62
- .add('default', () => ({
63
- components,
64
- template,
65
- props: generateProps(),
66
- }))
67
- .add('with close button', () => ({
68
- components,
69
- template: `
70
- <div class="gl-display-flex gl-justify-content-center gl-p-6">
71
- <gl-button id="pop-with-close-button">{{placement}}</gl-button>
72
- <gl-popover
73
- target="pop-with-close-button"
74
- data-testid="popover-with-close-button"
75
- triggers="hover focus"
76
- :title="title"
77
- :placement="placement"
78
- content="${contentString}"
79
- show
80
- show-close-button
81
- />
82
- </div>
83
- `,
84
- props: generateProps(),
85
- }))
86
- .add(
87
- 'on click',
88
- () => ({
89
- components,
90
- template: scopedSlotTemplate,
91
- props: generateProps(),
92
- }),
93
- { storyshots: false }
94
- );
97
+ },
98
+ };
@@ -18,6 +18,11 @@ export default {
18
18
  required: false,
19
19
  default: () => [],
20
20
  },
21
+ /**
22
+ * Space-separated triggers for the popover.
23
+ *
24
+ * @values click, hover, focus, manual
25
+ */
21
26
  triggers: {
22
27
  type: String,
23
28
  required: false,
@@ -45,6 +50,9 @@ export default {
45
50
  methods: {
46
51
  close(e) {
47
52
  this.$refs[popoverRefName].doClose();
53
+ /**
54
+ * Emitted when the close button is clicked (requires showCloseButton to be `true`).
55
+ */
48
56
  this.$emit('close-button-clicked', e);
49
57
  },
50
58
  },
@@ -1981,6 +1981,14 @@
1981
1981
  color: inherit !important;
1982
1982
  }
1983
1983
 
1984
+ .gl-text-transparent {
1985
+ color: transparent;
1986
+ }
1987
+
1988
+ .gl-text-transparent\! {
1989
+ color: transparent !important;
1990
+ }
1991
+
1984
1992
  .gl-text-white {
1985
1993
  color: $white;
1986
1994
  }
@@ -11,6 +11,10 @@
11
11
  color: inherit;
12
12
  }
13
13
 
14
+ @mixin gl-text-transparent {
15
+ color: transparent;
16
+ }
17
+
14
18
  @mixin gl-text-white($hover: true) {
15
19
  color: $white;
16
20
  }
@@ -1,25 +0,0 @@
1
- import PopoverBasicExample from './popover.basic.example';
2
- import PopoverLoadingExample from './popover.loading.example';
3
- import PopoverNoTitleExample from './popover.notitle.example';
4
-
5
- var index = [{
6
- name: 'Examples',
7
- items: [{
8
- id: 'popover-basic',
9
- name: 'Basic',
10
- description: 'Basic Popover',
11
- component: PopoverBasicExample
12
- }, {
13
- id: 'popover-loading',
14
- name: 'Loading',
15
- description: 'Popover with Skeleton Loading',
16
- component: PopoverLoadingExample
17
- }, {
18
- id: 'popover-no-title',
19
- name: 'No title',
20
- description: 'Popover with no title',
21
- component: PopoverNoTitleExample
22
- }]
23
- }];
24
-
25
- export default index;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":"popovercontainer"}},[_c('gl-button',{attrs:{"id":"pop-basic"}},[_vm._v("Popover Button")]),_vm._v(" "),_c('gl-popover',{attrs:{"target":"pop-basic","container":"popovercontainer","placement":"top","title":"This is a Popover","triggers":"hover focus","content":"With a placement of top"}})],1)};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":"popovercontainer"}},[_c('gl-button',{attrs:{"id":"pop-basic"}},[_vm._v("Popover Button")]),_vm._v(" "),_c('gl-popover',{attrs:{"target":"pop-basic","container":"popovercontainer","placement":"top","title":"My popover","triggers":"hover focus","show":""}},[_c('gl-skeleton-loader')],1)],1)};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":"popovercontainer"}},[_c('gl-button',{attrs:{"id":"pop-basic"}},[_vm._v("Popover Button")]),_vm._v(" "),_c('gl-popover',{attrs:{"target":"pop-basic","container":"popovercontainer","placement":"top","triggers":"hover focus","content":"Popover content with no title"}})],1)};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,29 +0,0 @@
1
- import PopoverBasicExample from './popover.basic.example.vue';
2
- import PopoverLoadingExample from './popover.loading.example.vue';
3
- import PopoverNoTitleExample from './popover.notitle.example.vue';
4
-
5
- export default [
6
- {
7
- name: 'Examples',
8
- items: [
9
- {
10
- id: 'popover-basic',
11
- name: 'Basic',
12
- description: 'Basic Popover',
13
- component: PopoverBasicExample,
14
- },
15
- {
16
- id: 'popover-loading',
17
- name: 'Loading',
18
- description: 'Popover with Skeleton Loading',
19
- component: PopoverLoadingExample,
20
- },
21
- {
22
- id: 'popover-no-title',
23
- name: 'No title',
24
- description: 'Popover with no title',
25
- component: PopoverNoTitleExample,
26
- },
27
- ],
28
- },
29
- ];
@@ -1,13 +0,0 @@
1
- <template>
2
- <div id="popovercontainer">
3
- <gl-button id="pop-basic">Popover Button</gl-button>
4
- <gl-popover
5
- target="pop-basic"
6
- container="popovercontainer"
7
- placement="top"
8
- title="This is a Popover"
9
- triggers="hover focus"
10
- content="With a placement of top"
11
- />
12
- </div>
13
- </template>
@@ -1,15 +0,0 @@
1
- <template>
2
- <div id="popovercontainer">
3
- <gl-button id="pop-basic">Popover Button</gl-button>
4
- <gl-popover
5
- target="pop-basic"
6
- container="popovercontainer"
7
- placement="top"
8
- title="My popover"
9
- triggers="hover focus"
10
- show
11
- >
12
- <gl-skeleton-loader />
13
- </gl-popover>
14
- </div>
15
- </template>
@@ -1,12 +0,0 @@
1
- <template>
2
- <div id="popovercontainer">
3
- <gl-button id="pop-basic">Popover Button</gl-button>
4
- <gl-popover
5
- target="pop-basic"
6
- container="popovercontainer"
7
- placement="top"
8
- triggers="hover focus"
9
- content="Popover content with no title"
10
- />
11
- </div>
12
- </template>