@gitlab/ui 42.16.0 → 42.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "42.16.0",
3
+ "version": "42.17.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,6 @@
1
1
  $gl-drawer-width: 400px;
2
2
  $gl-sidebar-width: 290px;
3
+ $gl-drawer-scrim-gradient: linear-gradient(to bottom, $transparent-rgba, $white);
3
4
 
4
5
  .gl-drawer {
5
6
  @include gl-right-0;
@@ -61,6 +62,20 @@ $gl-sidebar-width: 290px;
61
62
  @include gl-py-5;
62
63
  }
63
64
 
65
+ .gl-drawer-body-scrim-on-footer {
66
+ &::before {
67
+ background: $gl-drawer-scrim-gradient;
68
+ top: -$gl-border-size-1;
69
+ @include gl-translate-y-n100;
70
+ @include gl-content-empty;
71
+ @include gl-left-0;
72
+ @include gl-absolute;
73
+ @include gl-pointer-events-none;
74
+ @include gl-w-full;
75
+ @include gl-h-7;
76
+ }
77
+ }
78
+
64
79
  .gl-drawer-footer-sticky {
65
80
  @include gl-bg-white;
66
81
  @include gl-bottom-0;
@@ -94,6 +109,18 @@ $gl-sidebar-width: 290px;
94
109
  @include gl-flex-grow-1;
95
110
  }
96
111
 
112
+ .gl-drawer-body-scrim {
113
+ &::after {
114
+ background: $gl-drawer-scrim-gradient;
115
+ @include gl-content-empty;
116
+ @include gl-bottom-0;
117
+ @include gl-pointer-events-none;
118
+ @include gl-w-full;
119
+ @include gl-fixed;
120
+ @include gl-h-7;
121
+ }
122
+ }
123
+
97
124
  .gl-drawer-body > * {
98
125
  @include gl-border-b-solid;
99
126
  @include gl-border-b-gray-100;
@@ -101,6 +101,28 @@ describe('drawer component', () => {
101
101
  expect(wrapper.find(parentSelector).find(`[data-testid="${slot}"]`).exists()).toBe(true);
102
102
  });
103
103
 
104
+ it('should add scrim to footer', () => {
105
+ mountWithOpts({
106
+ slots: {
107
+ footer: `<div data-testid="footer" />`,
108
+ },
109
+ });
110
+
111
+ expect(wrapper.find('.gl-drawer-footer').classes()).toContain('gl-drawer-body-scrim-on-footer');
112
+ expect(wrapper.find('.gl-drawer-body').classes()).not.toContain('gl-drawer-body-scrim');
113
+ });
114
+
115
+ it('should add scrim to scrollable container', () => {
116
+ mountWithOpts({
117
+ slots: {
118
+ default: `<div data-testid="default" />`,
119
+ },
120
+ });
121
+
122
+ expect(wrapper.find('.gl-drawer-footer').exists()).toBe(false);
123
+ expect(wrapper.find('.gl-drawer-body').classes()).toContain('gl-drawer-body-scrim');
124
+ });
125
+
104
126
  it.each`
105
127
  variant | variantClass
106
128
  ${'default'} | ${'gl-drawer-default'}
@@ -1,8 +1,33 @@
1
- import { GlDrawer, GlButton } from '../../../index';
1
+ import { GlDrawer, GlButton, GlMarkdown } from '../../../index';
2
2
  import { drawerVariants } from '../../../utils/constants';
3
3
  import readme from './drawer.md';
4
4
 
5
- const components = { GlDrawer, GlButton };
5
+ const components = { GlDrawer, GlButton, GlMarkdown };
6
+
7
+ const generateStaticContent = (number = 1) =>
8
+ Array.from(
9
+ Array(number),
10
+ (_, index) => `
11
+ <div class="gl-mb-8">
12
+ <h4 class="gl-mb-4">View jobs in a pipeline ${index}</h4>
13
+ <p>
14
+ Pipeline configuration begins with jobs. Jobs are the most fundamental element of a .gitlab-ci.yml file.
15
+ </p>
16
+ <p>Jobs are:</p>
17
+ <ul>
18
+ <li>Defined with constraints stating under what conditions they should be executed. </li>
19
+ <li>Top-level elements with an arbitrary name and must contain at least the script clause.</li>
20
+ <li>Not limited in how many can be defined.</li>
21
+ </ul>
22
+ <p>For example:</p>
23
+ <gl-markdown compact>
24
+ <code>job1: script: "execute-script-for-job1"</code>
25
+ <br />
26
+ <code>job2: script: "execute-script-for-job2"</code>
27
+ </gl-markdown>
28
+ </div>
29
+ `
30
+ ).join('');
6
31
 
7
32
  const generateDrawerContent = (items) =>
8
33
  items
@@ -145,6 +170,24 @@ export const WithStickyFooter = (_args, { viewMode }) => ({
145
170
 
146
171
  WithStickyFooter.args = generateProps();
147
172
 
173
+ export const WithScrimAndStaticContent = (_args, { viewMode }) => ({
174
+ ...storyOptions(viewMode),
175
+ template: `
176
+ <div>
177
+ <gl-button @click="toggle">Toggle Drawer</gl-button>
178
+ ${createSidebarTemplate(`
179
+ <template #title>List Settings</template>
180
+ <div>
181
+ ${generateStaticContent(3)}
182
+ </div>
183
+ `)}
184
+ </div>`,
185
+ });
186
+
187
+ WithScrimAndStaticContent.args = generateProps({
188
+ headerSticky: true,
189
+ });
190
+
148
191
  export const SidebarVariant = (_args, { viewMode }) => ({
149
192
  ...storyOptions(viewMode),
150
193
  template: `
@@ -110,12 +110,13 @@ export default {
110
110
  </span>
111
111
  <slot name="header"></slot>
112
112
  </div>
113
- <div class="gl-drawer-body">
113
+ <div class="gl-drawer-body" :class="{ 'gl-drawer-body-scrim': !shouldRenderFooter }">
114
114
  <slot></slot>
115
115
  </div>
116
116
  <div
117
117
  v-if="shouldRenderFooter"
118
118
  class="gl-drawer-footer gl-drawer-footer-sticky"
119
+ :class="{ 'gl-drawer-body-scrim-on-footer': shouldRenderFooter }"
119
120
  :style="{ zIndex }"
120
121
  >
121
122
  <slot name="footer"></slot>