@gitlab/ui 115.6.0 → 115.6.1

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 (57) hide show
  1. package/bin/migrate_custom_utils_to_tw.bundled.mjs +2642 -2171
  2. package/dist/components/base/alert/alert.js +1 -0
  3. package/dist/components/base/avatar/avatar.js +1 -0
  4. package/dist/components/base/badge/badge.js +1 -0
  5. package/dist/components/base/breadcrumb/breadcrumb.js +2 -1
  6. package/dist/components/base/button/button.js +1 -0
  7. package/dist/components/base/datepicker/datepicker.js +1 -0
  8. package/dist/components/base/drawer/drawer.js +1 -0
  9. package/dist/components/base/dropdown/dropdown.js +1 -0
  10. package/dist/components/base/icon/icon.js +1 -0
  11. package/dist/components/base/label/label.js +1 -0
  12. package/dist/components/base/link/link.js +1 -0
  13. package/dist/components/base/modal/modal.js +1 -0
  14. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +1 -0
  15. package/dist/components/base/new_dropdowns/listbox/listbox.js +1 -0
  16. package/dist/components/base/pagination/pagination.js +1 -0
  17. package/dist/components/base/path/path.js +1 -0
  18. package/dist/components/base/popover/popover.js +1 -0
  19. package/dist/components/base/table/table.js +1 -0
  20. package/dist/components/base/tabs/tab/tab.js +1 -0
  21. package/dist/components/base/tabs/tabs/tabs.js +1 -0
  22. package/dist/components/base/toggle/toggle.js +1 -0
  23. package/dist/components/base/token/token.js +1 -0
  24. package/dist/components/base/tooltip/tooltip.js +1 -0
  25. package/dist/components/charts/area/area.js +1 -0
  26. package/dist/components/charts/bar/bar.js +1 -0
  27. package/dist/components/charts/chart/chart.js +1 -0
  28. package/dist/components/charts/column/column.js +1 -0
  29. package/dist/components/charts/gauge/gauge.js +1 -0
  30. package/dist/components/charts/heatmap/heatmap.js +1 -0
  31. package/dist/components/charts/legend/legend.js +1 -0
  32. package/dist/components/charts/line/line.js +1 -0
  33. package/dist/components/charts/shared/tooltip/tooltip.js +1 -0
  34. package/dist/components/charts/sparkline/sparkline.js +1 -0
  35. package/dist/components/dashboards/dashboard_layout/dashboard_layout.js +0 -3
  36. package/dist/components/dashboards/dashboard_panel/dashboard_panel.js +2 -2
  37. package/dist/components/utilities/intersperse/intersperse.js +1 -0
  38. package/dist/components/utilities/sprintf/sprintf.js +1 -0
  39. package/dist/components/utilities/truncate/truncate.js +1 -0
  40. package/dist/tailwind.css +1 -1
  41. package/dist/tailwind.css.map +1 -1
  42. package/dist/utils/use_mock_intersection_observer.js +1 -0
  43. package/dist/vendor/bootstrap-vue/src/bv-config.js +2 -0
  44. package/dist/vendor/bootstrap-vue/src/components/modal/helpers/modal-manager.js +1 -0
  45. package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover.js +5 -0
  46. package/dist/vendor/bootstrap-vue/src/components/toast/helpers/bv-toast.js +1 -0
  47. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-popper.js +6 -0
  48. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +4 -0
  49. package/dist/vendor/bootstrap-vue/src/components/transition/bv-transition.js +5 -0
  50. package/dist/vendor/bootstrap-vue/src/directives/visible/visible.js +32 -0
  51. package/dist/vendor/bootstrap-vue/src/mixins/has-listener.js +3 -0
  52. package/dist/vendor/bootstrap-vue/src/mixins/id.js +2 -0
  53. package/package.json +12 -12
  54. package/src/components/base/breadcrumb/breadcrumb.vue +1 -1
  55. package/src/components/dashboards/dashboard_layout/dashboard_layout.md +145 -3
  56. package/src/components/dashboards/dashboard_layout/dashboard_layout.vue +0 -3
  57. package/src/components/dashboards/dashboard_panel/dashboard_panel.vue +33 -18
@@ -6,6 +6,38 @@ import { keys, clone } from '../../utils/object';
6
6
  import { nextTick } from '../../vue';
7
7
 
8
8
  // v-b-visible
9
+ // Private visibility check directive
10
+ // Based on IntersectionObserver
11
+ //
12
+ // Usage:
13
+ // v-b-visibility.<margin>.<once>="<callback>"
14
+ //
15
+ // Value:
16
+ // <callback>: method to be called when visibility state changes, receives one arg:
17
+ // true: element is visible
18
+ // false: element is not visible
19
+ // null: IntersectionObserver not supported
20
+ //
21
+ // Modifiers:
22
+ // <margin>: a positive decimal value of pixels away from viewport edge
23
+ // before being considered "visible". default is 0
24
+ // <once>: keyword 'once', meaning when the element becomes visible and
25
+ // callback is called observation/notification will stop.
26
+ //
27
+ // When used in a render function:
28
+ // export default {
29
+ // directives: { 'b-visible': VBVisible },
30
+ // render(h) {
31
+ // h(
32
+ // 'div',
33
+ // {
34
+ // directives: [
35
+ // { name: 'b-visible', value=this.callback, modifiers: { '123':true, 'once':true } }
36
+ // ]
37
+ // }
38
+ // )
39
+ // }
40
+
9
41
  const OBSERVER_PROP_NAME = '__bv__visibility_observer';
10
42
  class VisibilityObserver {
11
43
  constructor(el, options) {
@@ -2,6 +2,9 @@ import { extend, isVue3 } from '../vue';
2
2
  import { isUndefined, isArray } from '../utils/inspect';
3
3
 
4
4
  // Mixin to determine if an event listener has been registered
5
+ // either via `v-on:name` (in the parent) or programmatically
6
+ // via `vm.$on('name', ...)`
7
+ // See: https://github.com/vuejs/vue/issues/10825
5
8
 
6
9
  // @vue/component
7
10
  const hasListenerMixin = extend({
@@ -3,6 +3,8 @@ import { PROP_TYPE_STRING } from '../constants/props';
3
3
  import { makeProp } from '../utils/props';
4
4
 
5
5
  // SSR safe client-side ID attribute generation
6
+ // ID's can only be generated client-side, after mount
7
+ // `this._uid` is not synched between server and client
6
8
 
7
9
  // --- Props ---
8
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "115.6.0",
3
+ "version": "115.6.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -74,7 +74,7 @@
74
74
  "iframe-resizer": "^4.4.5",
75
75
  "lodash": "^4.17.21",
76
76
  "popper.js": "^1.16.1",
77
- "portal-vue": "^2.1.7",
77
+ "portal-vue": "2.1.7",
78
78
  "vue-functional-data-merge": "^3.1.0",
79
79
  "vue-runtime-helpers": "^1.1.2"
80
80
  },
@@ -104,9 +104,9 @@
104
104
  "@gitlab/fonts": "^1.3.0",
105
105
  "@gitlab/svgs": "3.136.0",
106
106
  "@jest/test-sequencer": "30.0.4",
107
- "@rollup/plugin-commonjs": "^21.1.0",
108
- "@rollup/plugin-node-resolve": "^10.0.0",
109
- "@rollup/plugin-replace": "^3.1.0",
107
+ "@rollup/plugin-commonjs": "^28.0.6",
108
+ "@rollup/plugin-node-resolve": "^16.0.1",
109
+ "@rollup/plugin-replace": "^6.0.2",
110
110
  "@storybook/addon-a11y": "^7.6.20",
111
111
  "@storybook/addon-docs": "^7.6.20",
112
112
  "@storybook/addon-essentials": "^7.6.20",
@@ -160,7 +160,7 @@
160
160
  "postcss-scss": "4.0.9",
161
161
  "react": "18.3.1",
162
162
  "react-dom": "18.3.1",
163
- "rollup": "^2.79.2",
163
+ "rollup": "^3.29.5",
164
164
  "rollup-plugin-babel": "^4.4.0",
165
165
  "rollup-plugin-postcss": "4.0.2",
166
166
  "rollup-plugin-string": "^3.0.0",
@@ -168,22 +168,22 @@
168
168
  "rollup-plugin-vue": "^5.1.9",
169
169
  "sass": "^1.89.2",
170
170
  "sass-loader": "^10.5.2",
171
- "sass-true": "^6.1.0",
172
- "start-server-and-test": "^1.15.4",
171
+ "sass-true": "^9",
172
+ "start-server-and-test": "^2.0.12",
173
173
  "storybook": "^7.6.20",
174
174
  "storybook-dark-mode": "4.0.2",
175
175
  "style-dictionary": "^5.0.1",
176
- "style-loader": "3.3.2",
176
+ "style-loader": "^4",
177
177
  "tailwind-config-viewer": "2.0.4",
178
178
  "tailwindcss": "3.4.17",
179
179
  "vue": "2.7.16",
180
180
  "vue-docgen-loader": "1.5.1",
181
181
  "vue-loader": "^15.11.1",
182
182
  "vue-loader-vue3": "npm:vue-loader@17.4.2",
183
- "vue-router": "^3.5.1",
183
+ "vue-router": "^3.6.5",
184
184
  "vue-template-compiler": "2.7.16",
185
185
  "vue-test-utils-compat": "^0.0.15",
186
- "webpack": "^5.99.9",
187
- "yargs": "^17.7.2"
186
+ "webpack": "^5.100.1",
187
+ "yargs": "^18.0.0"
188
188
  }
189
189
  }
@@ -147,7 +147,7 @@ export default {
147
147
  this.resetItems();
148
148
 
149
149
  const containerWidth = this.$el.clientWidth;
150
- const buttonWidth = 40; // px
150
+ const buttonWidth = this.size === 'sm' ? 40 : 48; // px
151
151
 
152
152
  if (this.totalBreadcrumbsWidth > containerWidth) {
153
153
  // Not all breadcrumb items fit. Start moving items over to the dropdown.
@@ -1,3 +1,145 @@
1
- The dashboard layout is used to provide a consistent UI within a dashboarding environment.
2
- The layout component should be used to render a grid-style dashboard as outlined by our
3
- [Pajamas documentation](https://design.gitlab.com/patterns/dashboards).
1
+ ## Dashboard layout
2
+
3
+ The `GlDashboardLayout` component provides an easy way to render grid-based dashboards
4
+ using a configuration as outlined by our [Pajamas guidelines](#pajamas-guidelines).
5
+ For more in-depth details on the dashboard layout framework, see the
6
+ [architecture design document](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/dashboard_layout_framework/).
7
+
8
+ ### When to use
9
+
10
+ This component should be used when:
11
+
12
+ - You want an easy way to create a dashboard interface.
13
+ - You want your dashboard to align with our [Pajamas guidelines](#pajamas-guidelines).
14
+ - You want to benefit from features such as customizable layouts with resizable, draggable elements.
15
+
16
+ ### Current limitations
17
+
18
+ The `GlDashboardLayout` component is limited to rendering dashboards. As defined
19
+ in our architecture design document it does not provide:
20
+
21
+ - Data exploration outside defined panel visualizations.
22
+ - User-driven customization outside of editing panel position and size.
23
+ - Navigation placement for dashboards.
24
+
25
+ ## The component
26
+
27
+ The component expects a dashboard configuration object as input and renders a dashboard
28
+ layout with title, description, actions, and panels.
29
+
30
+ ### Grid layout
31
+
32
+ Panels within the dashboard layout are rendered in a cross-browser 12-column grid
33
+ system with an unlimited number of rows. The grid is responsive and collapses down to a
34
+ single column at the [medium breakpoint](https://design.gitlab.com/product-foundations/layout/#breakpoints).
35
+
36
+ ### Dashboard panels
37
+
38
+ The dashboard layout is not opinionated about the panel component used. You are free to choose
39
+ whichever panel component best suits your needs. However, to ensure consistency with
40
+ our design patterns, it's strongly recommended that you use `GlDashboardPanel`.
41
+
42
+ ### Filters
43
+
44
+ The component provides a `#filters` slot to render your filters in the dashboard layout.
45
+ The component does not manage or sync filters and leaves it up to the consumer to manage this state.
46
+
47
+ We expect dashboards using the framework to implement two types of filters:
48
+
49
+ - Dashboard filters: Applied to every panel and visualization in the dashboard.
50
+ - Panel filters: Applied per panel to refine results available within the dashboard context.
51
+
52
+ ### Basic implementation
53
+
54
+ A basic implementation of a static dashboard using the `#panel` slot to render existing
55
+ visualizations wrapped in `GlDashboardPanel`.
56
+
57
+ ```html
58
+ <script>
59
+ import { GlDashboardLayout, GlDashboardPanel } from '@gitlab/ui';
60
+
61
+ // Your i18n library
62
+ import { __ } from '~/locale';
63
+
64
+ // Your visualizations
65
+ import UsersVisualization from './my_users_visualization.vue';
66
+ import EventsVisualization from './my_events_visualization.vue';
67
+
68
+ export default {
69
+ components: {
70
+ GlDashboardLayout,
71
+ GlDashboardPanel,
72
+ UsersVisualization,
73
+ EventsVisualization,
74
+ },
75
+ data() {
76
+ return {
77
+ dashboard: {
78
+ title: __('My dashboard title'),
79
+ description: __('The dashboard description to render'),
80
+ panels: [
81
+ {
82
+ // Each panel ID must be unique within the context of this dashboard obj
83
+ id: 'active-users-panel',
84
+ dashboardPanelProps: {
85
+ title: __('Active users over time'),
86
+ // Any additional GlDashboardPanel props go here
87
+ },
88
+ component: UsersVisualization,
89
+ componentProps: {
90
+ apiPath: '/example-users-api',
91
+ // Any props you want to pass to your component
92
+ },
93
+ gridAttributes: {
94
+ width: 6,
95
+ height: 4,
96
+ yPos: 0,
97
+ xPos: 0,
98
+ },
99
+ },
100
+ {
101
+ // Each panel ID must be unique within the context of this dashboard obj
102
+ id: 'events-over-time-panel',
103
+ dashboardPanelProps: {
104
+ title: __('Events over time'),
105
+ // Any additional GlDashboardPanel props go here
106
+ },
107
+ component: EventsVisualization,
108
+ componentProps: {
109
+ apiPath: '/example-events-api',
110
+ // Any props you want to pass to your component
111
+ },
112
+ gridAttributes: {
113
+ width: 6,
114
+ height: 4,
115
+ yPos: 0,
116
+ xPos: 6,
117
+ },
118
+ },
119
+ ],
120
+ },
121
+ }
122
+ },
123
+ }
124
+ </script>
125
+
126
+ <template>
127
+ <gl-dashboard-layout :config="dashboard">
128
+ <template #panel="{ panel }">
129
+ <gl-dashboard-panel v-bind="panel.dashboardPanelProps">
130
+ <template #body>
131
+ <component
132
+ :is="panel.component"
133
+ class="gl-h-full gl-overflow-hidden"
134
+ v-bind="panel.componentProps"
135
+ />
136
+ </template>
137
+ </gl-dashboard-panel>
138
+ </template>
139
+ </gl-dashboard-layout>
140
+ </template>
141
+ ```
142
+
143
+ ## Pajamas guidelines
144
+
145
+ - [Pajamas dashboards pattern](https://design.gitlab.com/patterns/dashboards)
@@ -4,9 +4,6 @@ import { dashboardConfigValidator } from './validators';
4
4
 
5
5
  /**
6
6
  * The `DashboardLayout` component provides an easy way to render dashboards using a configuration, aligning with our [Pajamas guidelines](https://design.gitlab.com/patterns/dashboards).
7
- *
8
- * Please refer to the [documentation](https://docs.gitlab.com/development/fe_guide/dashboard_layout_framework) for more information.
9
- *
10
7
  */
11
8
  export default {
12
9
  name: 'GlDashboardLayout',
@@ -178,25 +178,40 @@ export default {
178
178
  </template>
179
179
  </div>
180
180
 
181
- <gl-disclosure-dropdown
182
- v-if="shouldShowActions"
183
- :items="actions"
184
- icon="ellipsis_v"
185
- :toggle-text="actionsToggleText"
186
- text-sr-only
187
- no-caret
188
- placement="bottom-end"
189
- fluid-width
190
- toggle-class="gl-ml-1"
191
- category="tertiary"
192
- positioning-strategy="fixed"
193
- @shown="$emit('dropdownOpen')"
194
- @hidden="$emit('dropdownClosed')"
181
+ <div
182
+ v-if="shouldShowActions || $scopedSlots.filters"
183
+ data-testid="panel-actions-filters-container"
184
+ class="gl-flex gl-flex-col gl-items-end gl-gap-2"
195
185
  >
196
- <template #list-item="{ item }">
197
- <span> <gl-icon :name="item.icon" /> {{ item.text }}</span>
198
- </template>
199
- </gl-disclosure-dropdown>
186
+ <gl-disclosure-dropdown
187
+ v-if="shouldShowActions"
188
+ :items="actions"
189
+ icon="ellipsis_v"
190
+ :toggle-text="actionsToggleText"
191
+ text-sr-only
192
+ no-caret
193
+ placement="bottom-end"
194
+ fluid-width
195
+ toggle-class="gl-ml-1"
196
+ category="tertiary"
197
+ positioning-strategy="fixed"
198
+ @shown="$emit('dropdownOpen')"
199
+ @hidden="$emit('dropdownClosed')"
200
+ >
201
+ <template #list-item="{ item }">
202
+ <span> <gl-icon :name="item.icon" /> {{ item.text }}</span>
203
+ </template>
204
+ </gl-disclosure-dropdown>
205
+
206
+ <div
207
+ v-if="$scopedSlots.filters"
208
+ class="gl-flex gl-items-center gl-justify-end gl-pb-2"
209
+ data-testid="panel-filters-container"
210
+ >
211
+ <!-- @slot The filter section to add additional UI elements for filtering, grouping, etc. -->
212
+ <slot name="filters"></slot>
213
+ </div>
214
+ </div>
200
215
  </div>
201
216
  <div :class="bodyClasses">
202
217
  <template v-if="loading">