@gitlab/ui 130.1.1 → 130.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.
@@ -163,6 +163,14 @@ var script = {
163
163
  required: false,
164
164
  default: null
165
165
  },
166
+ /**
167
+ * The `aria-label` attribute value for the toggle `button`.
168
+ */
169
+ ariaLabel: {
170
+ type: String,
171
+ required: false,
172
+ default: null
173
+ },
166
174
  /**
167
175
  * Custom value to be passed to the offset middleware.
168
176
  * https://floating-ui.com/docs/offset
@@ -273,6 +281,7 @@ var script = {
273
281
  'aria-expanded': String(this.visible),
274
282
  'aria-haspopup': this.ariaHaspopup,
275
283
  'aria-labelledby': this.toggleLabelledBy,
284
+ 'aria-label': this.ariaLabel || undefined,
276
285
  'aria-activedescendant': this.ariaActiveDescendant
277
286
  };
278
287
  },
@@ -1,5 +1,5 @@
1
1
  import { uniqueId, clamp } from 'lodash-es';
2
- import { stopEvent, filterVisible } from '../../../../utils/utils';
2
+ import { logWarning, stopEvent, filterVisible } from '../../../../utils/utils';
3
3
  import { GL_DROPDOWN_SHOWN, GL_DROPDOWN_HIDDEN, GL_DROPDOWN_BEFORE_CLOSE, GL_DROPDOWN_FOCUS_CONTENT, POSITION_ABSOLUTE, POSITION_FIXED, HOME, END, ARROW_UP, ARROW_DOWN, ENTER, SPACE, GL_DROPDOWN_CONTENTS_CLASS } from '../constants';
4
4
  import { buttonCategoryOptions, dropdownVariantOptions, buttonSizeOptions, dropdownPlacements } from '../../../../utils/constants';
5
5
  import GlBaseDropdown from '../base_dropdown/base_dropdown';
@@ -143,6 +143,17 @@ var script = {
143
143
  required: false,
144
144
  default: null
145
145
  },
146
+ /**
147
+ * The `aria-label` attribute value for the toggle button.
148
+ * Use when there is no visible label element to reference with `toggleAriaLabelledBy`.
149
+ * Do not provide both `toggleAriaLabel` and `toggleAriaLabelledBy`.
150
+ * When both are present, `toggleAriaLabelledBy` takes precedence per the WAI-ARIA spec.
151
+ */
152
+ toggleAriaLabel: {
153
+ type: String,
154
+ required: false,
155
+ default: null
156
+ },
146
157
  /**
147
158
  * The `aria-labelledby` attribute value for the list of options
148
159
  * Provide the string of ids seperated by space
@@ -230,6 +241,11 @@ var script = {
230
241
  }
231
242
  },
232
243
  mounted() {
244
+ if (this.toggleAriaLabel && this.toggleAriaLabelledBy) {
245
+ logWarning('Do not provide both `toggleAriaLabel` and `toggleAriaLabelledBy`. ' + 'When both are present, `toggleAriaLabelledBy` takes precedence and `toggleAriaLabel` is ignored. ' + 'See https://design.gitlab.com/components/dropdown-disclosure/#accessibility', {
246
+ name: 'GlDisclosureDropdown'
247
+ });
248
+ }
233
249
  if (this.startOpened) {
234
250
  this.open();
235
251
  }
@@ -349,7 +365,7 @@ var script = {
349
365
  const __vue_script__ = script;
350
366
 
351
367
  /* template */
352
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",staticClass:"gl-disclosure-dropdown",attrs:{"aria-labelledby":_vm.toggleAriaLabelledBy,"arrow-element":_vm.$refs.disclosureArrow,"toggle-id":_vm.toggleId,"toggle-text":_vm.toggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"block":_vm.block,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy,"is-disclosure":""},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide,_vm.$options.events.GL_DROPDOWN_BEFORE_CLOSE,_vm.onBeforeClose,_vm.$options.events.GL_DROPDOWN_FOCUS_CONTENT,_vm.onKeydown]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(slotProps){return [_vm._t("toggle",null,null,slotProps)]}}:null],null,true)},[_vm._v(" "),_vm._t("header"),_vm._v(" "),_c(_vm.disclosureTag,{ref:"content",tag:"component",class:_vm.$options.GL_DROPDOWN_CONTENTS_CLASS,attrs:{"id":_vm.disclosureId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.toggleId,"data-testid":"disclosure-content","tabindex":"-1"},on:{"keydown":_vm.onKeydown,"click":_vm.handleAutoClose}},[_vm._t("default",function(){return [_vm._l((_vm.items),function(item,index){return [(_vm.isItem(item))?[_c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"siblings-have-icons":_vm.siblingsHaveIcons,"item":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([('list-item' in _vm.$scopedSlots)?{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":item})]},proxy:true}:null],null,true)})]:[_c('gl-disclosure-dropdown-group',{key:item.name,attrs:{"bordered":index !== 0,"group":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null,(_vm.$scopedSlots['list-item'])?{key:"default",fn:function(){return _vm._l((item.items),function(groupItem){return _c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"siblings-have-icons":_vm.doSomeItemsHaveIcon(item.items),"item":groupItem},on:{"action":_vm.handleAction},scopedSlots:_vm._u([{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":groupItem})]},proxy:true}],null,true)})})},proxy:true}:null],null,true)})]]})]})],2),_vm._v(" "),_vm._t("footer")],2)};
368
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",staticClass:"gl-disclosure-dropdown",attrs:{"aria-labelledby":_vm.toggleAriaLabelledBy,"aria-label":_vm.toggleAriaLabelledBy ? undefined : _vm.toggleAriaLabel,"arrow-element":_vm.$refs.disclosureArrow,"toggle-id":_vm.toggleId,"toggle-text":_vm.toggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"block":_vm.block,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy,"is-disclosure":""},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide,_vm.$options.events.GL_DROPDOWN_BEFORE_CLOSE,_vm.onBeforeClose,_vm.$options.events.GL_DROPDOWN_FOCUS_CONTENT,_vm.onKeydown]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(slotProps){return [_vm._t("toggle",null,null,slotProps)]}}:null],null,true)},[_vm._v(" "),_vm._t("header"),_vm._v(" "),_c(_vm.disclosureTag,{ref:"content",tag:"component",class:_vm.$options.GL_DROPDOWN_CONTENTS_CLASS,attrs:{"id":_vm.disclosureId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.toggleId,"data-testid":"disclosure-content","tabindex":"-1"},on:{"keydown":_vm.onKeydown,"click":_vm.handleAutoClose}},[_vm._t("default",function(){return [_vm._l((_vm.items),function(item,index){return [(_vm.isItem(item))?[_c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"siblings-have-icons":_vm.siblingsHaveIcons,"item":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([('list-item' in _vm.$scopedSlots)?{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":item})]},proxy:true}:null],null,true)})]:[_c('gl-disclosure-dropdown-group',{key:item.name,attrs:{"bordered":index !== 0,"group":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null,(_vm.$scopedSlots['list-item'])?{key:"default",fn:function(){return _vm._l((item.items),function(groupItem){return _c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"siblings-have-icons":_vm.doSomeItemsHaveIcon(item.items),"item":groupItem},on:{"action":_vm.handleAction},scopedSlots:_vm._u([{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":groupItem})]},proxy:true}],null,true)})})},proxy:true}:null],null,true)})]]})]})],2),_vm._v(" "),_vm._t("footer")],2)};
353
369
  var __vue_staticRenderFns__ = [];
354
370
 
355
371
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "130.1.1",
3
+ "version": "130.2.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -28,6 +28,7 @@
28
28
  "!src/vendor",
29
29
  "src/vendor/bootstrap-vue/src/**/*.{js,scss}",
30
30
  "src/vendor/bootstrap/scss/**/*.scss",
31
+ "!*.figma.{js,ts}",
31
32
  "!*.stories.js",
32
33
  "!*.snap",
33
34
  "!*.spec.{js,scss}"
@@ -38,6 +39,7 @@
38
39
  "copy-fonts": "make copy-fonts",
39
40
  "build-tokens": "make tokens",
40
41
  "sync-tokens": "node --env-file=.figma.env bin/figma_sync_tokens.mjs",
42
+ "figma:connect": "node --env-file=.figma.env node_modules/.bin/figma connect",
41
43
  "clean": "rm -r dist storybook",
42
44
  "cy:edge": "cypress run --browser edge --env grepTags=-@storybook",
43
45
  "cy:run": "cypress run --browser firefox --env grepTags=-@storybook",
@@ -99,6 +101,7 @@
99
101
  "@babel/preset-env": "^7.29.2",
100
102
  "@babel/preset-react": "^7.28.5",
101
103
  "@cypress/grep": "^4.1.1",
104
+ "@figma/code-connect": "^1.4.2",
102
105
  "@gitlab/fonts": "^1.3.1",
103
106
  "@gitlab/svgs": "*",
104
107
  "@jest/test-sequencer": "30.3.0",
@@ -195,6 +195,14 @@ export default {
195
195
  required: false,
196
196
  default: null,
197
197
  },
198
+ /**
199
+ * The `aria-label` attribute value for the toggle `button`.
200
+ */
201
+ ariaLabel: {
202
+ type: String,
203
+ required: false,
204
+ default: null,
205
+ },
198
206
  /**
199
207
  * Custom value to be passed to the offset middleware.
200
208
  * https://floating-ui.com/docs/offset
@@ -302,6 +310,7 @@ export default {
302
310
  'aria-expanded': String(this.visible),
303
311
  'aria-haspopup': this.ariaHaspopup,
304
312
  'aria-labelledby': this.toggleLabelledBy,
313
+ 'aria-label': this.ariaLabel || undefined,
305
314
  'aria-activedescendant': this.ariaActiveDescendant,
306
315
  };
307
316
  },
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { clamp, uniqueId } from 'lodash-es';
3
- import { stopEvent, filterVisible } from '../../../../utils/utils';
3
+ import { stopEvent, filterVisible, logWarning } from '../../../../utils/utils';
4
4
  import {
5
5
  GL_DROPDOWN_SHOWN,
6
6
  GL_DROPDOWN_HIDDEN,
@@ -163,6 +163,17 @@ export default {
163
163
  required: false,
164
164
  default: null,
165
165
  },
166
+ /**
167
+ * The `aria-label` attribute value for the toggle button.
168
+ * Use when there is no visible label element to reference with `toggleAriaLabelledBy`.
169
+ * Do not provide both `toggleAriaLabel` and `toggleAriaLabelledBy`.
170
+ * When both are present, `toggleAriaLabelledBy` takes precedence per the WAI-ARIA spec.
171
+ */
172
+ toggleAriaLabel: {
173
+ type: String,
174
+ required: false,
175
+ default: null,
176
+ },
166
177
  /**
167
178
  * The `aria-labelledby` attribute value for the list of options
168
179
  * Provide the string of ids seperated by space
@@ -251,6 +262,16 @@ export default {
251
262
  },
252
263
  },
253
264
  mounted() {
265
+ if (this.toggleAriaLabel && this.toggleAriaLabelledBy) {
266
+ logWarning(
267
+ 'Do not provide both `toggleAriaLabel` and `toggleAriaLabelledBy`. ' +
268
+ 'When both are present, `toggleAriaLabelledBy` takes precedence and `toggleAriaLabel` is ignored. ' +
269
+ 'See https://design.gitlab.com/components/dropdown-disclosure/#accessibility',
270
+ {
271
+ name: 'GlDisclosureDropdown',
272
+ },
273
+ );
274
+ }
254
275
  if (this.startOpened) {
255
276
  this.open();
256
277
  }
@@ -374,6 +395,7 @@ export default {
374
395
  <gl-base-dropdown
375
396
  ref="baseDropdown"
376
397
  :aria-labelledby="toggleAriaLabelledBy"
398
+ :aria-label="toggleAriaLabelledBy ? undefined : toggleAriaLabel"
377
399
  :arrow-element="$refs.disclosureArrow"
378
400
  :toggle-id="toggleId"
379
401
  :toggle-text="toggleText"