@gitlab/ui 128.5.1 → 128.7.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/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +14 -2
- package/dist/components/base/new_dropdowns/listbox/listbox.js +9 -1
- package/dist/components/extended/multi_step_form_template/multi_step_form_template.js +87 -0
- package/dist/components/index.js +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/utils/i18n.js +14 -12
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +16 -1
- package/src/components/base/new_dropdowns/dropdown.scss +4 -1
- package/src/components/base/new_dropdowns/listbox/listbox.vue +9 -0
- package/src/components/extended/multi_step_form_template/multi_step_form_template.vue +84 -0
- package/src/components/index.js +4 -0
- package/src/utils/i18n.js +13 -9
- package/translations.js +2 -0
|
@@ -166,6 +166,14 @@ var script = {
|
|
|
166
166
|
required: false,
|
|
167
167
|
default: false
|
|
168
168
|
},
|
|
169
|
+
/**
|
|
170
|
+
* Allows the dropdown panel to match the width of the trigger element
|
|
171
|
+
*/
|
|
172
|
+
panelMatchTriggerWidth: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
required: false,
|
|
175
|
+
default: false
|
|
176
|
+
},
|
|
169
177
|
/**
|
|
170
178
|
* Strategy to be applied by computePosition. If this is set to fixed, the dropdown's position
|
|
171
179
|
* needs to be set to fixed in CSS as well.
|
|
@@ -333,7 +341,8 @@ var script = {
|
|
|
333
341
|
panelClasses() {
|
|
334
342
|
return {
|
|
335
343
|
'!gl-block': this.visible,
|
|
336
|
-
[FIXED_WIDTH_CLASS]: !this.fluidWidth,
|
|
344
|
+
[FIXED_WIDTH_CLASS]: !this.fluidWidth && !this.panelMatchTriggerWidth,
|
|
345
|
+
'gl-new-dropdown-panel-fluid-width': this.fluidWidth && !this.panelMatchTriggerWidth,
|
|
337
346
|
'gl-fixed': this.openedYet && this.isFixed,
|
|
338
347
|
'gl-absolute': this.openedYet && !this.isFixed
|
|
339
348
|
};
|
|
@@ -366,9 +375,12 @@ var script = {
|
|
|
366
375
|
const maxWidth = this.fluidWidth ? {
|
|
367
376
|
maxWidth: `${Math.max(0, availableWidth)}px`
|
|
368
377
|
} : {};
|
|
378
|
+
const triggerWidth = this.panelMatchTriggerWidth ? {
|
|
379
|
+
minWidth: `${this.toggleElement.getBoundingClientRect().width}px`
|
|
380
|
+
} : {};
|
|
369
381
|
Object.assign(contentsEl.style, {
|
|
370
382
|
maxHeight: `${Math.max(contentsAvailableHeight, 0)}px`
|
|
371
|
-
}, maxWidth);
|
|
383
|
+
}, maxWidth, triggerWidth);
|
|
372
384
|
}
|
|
373
385
|
})]
|
|
374
386
|
};
|
|
@@ -318,6 +318,14 @@ var script = {
|
|
|
318
318
|
required: false,
|
|
319
319
|
default: false
|
|
320
320
|
},
|
|
321
|
+
/**
|
|
322
|
+
* Allows the dropdown panel to match the width of the trigger element
|
|
323
|
+
*/
|
|
324
|
+
panelMatchTriggerWidth: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
required: false,
|
|
327
|
+
default: false
|
|
328
|
+
},
|
|
321
329
|
/**
|
|
322
330
|
* Strategy to be applied by computePosition. If the dropdown's container is too short for it to
|
|
323
331
|
* fit in, setting this to fixed will let it position itself above its container.
|
|
@@ -911,7 +919,7 @@ var script = {
|
|
|
911
919
|
const __vue_script__ = script;
|
|
912
920
|
|
|
913
921
|
/* template */
|
|
914
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","active-item-id":_vm.activeItemId,"aria-labelledby":_vm.toggleAriaLabelledBy,"block":_vm.block,"has-searchable-listbox":_vm.searchable,"has-external-label":_vm.isInFormGroup,"listbox-id":_vm.listboxIdComputed,"toggle-id":_vm.toggleIdComputed,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleButtonClasses,"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,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_FOCUS_CONTENT,_vm.onFocusContent,_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(slotProps){return [_vm._t("toggle",null,null,slotProps)]}}:null,{key:"default",fn:function(ref){
|
|
922
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","active-item-id":_vm.activeItemId,"aria-labelledby":_vm.toggleAriaLabelledBy,"block":_vm.block,"has-searchable-listbox":_vm.searchable,"has-external-label":_vm.isInFormGroup,"listbox-id":_vm.listboxIdComputed,"toggle-id":_vm.toggleIdComputed,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleButtonClasses,"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,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"panel-match-trigger-width":_vm.panelMatchTriggerWidth,"positioning-strategy":_vm.positioningStrategy},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_FOCUS_CONTENT,_vm.onFocusContent,_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(slotProps){return [_vm._t("toggle",null,null,slotProps)]}}:null,{key:"default",fn:function(ref){
|
|
915
923
|
var visible = ref.visible;
|
|
916
924
|
return [(_vm.headerText)?_c('div',{staticClass:"gl-flex gl-min-h-8 gl-items-center !gl-p-4",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-grow gl-pr-2 gl-text-sm gl-font-bold gl-text-strong",attrs:{"id":_vm.headerId,"data-testid":"listbox-header-text"}},[_vm._v("\n "+_vm._s(_vm.headerText)+"\n ")]),_vm._v(" "),(_vm.showResetButton)?_c('gl-button',{staticClass:"!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset",attrs:{"category":"tertiary","size":"small","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.showSelectAllButton)?_c('gl-button',{staticClass:"!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset",attrs:{"category":"tertiary","size":"small","data-testid":"listbox-select-all-button"},on:{"click":_vm.onSelectAllButtonClicked}},[_vm._v("\n "+_vm._s(_vm.showSelectAllButtonLabel)+"\n ")]):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.searchable)?_c('div',{class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('gl-listbox-search-input',{ref:"searchBox",class:{ 'gl-listbox-topmost': !_vm.headerText },attrs:{"id":_vm.searchInputId,"data-testid":"listbox-search-input","role":"combobox","aria-expanded":String(visible),"aria-controls":_vm.listboxId,"aria-activedescendant":_vm.activeItemId,"aria-haspopup":"listbox","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }$event.preventDefault();},_vm.onKeydown]},model:{value:(_vm.searchStr),callback:function ($$v) {_vm.searchStr=$$v;},expression:"searchStr"}}),_vm._v(" "),(_vm.searching)?_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-search-loader","size":"md"}}):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.showList)?_c(_vm.listboxTag,{ref:"list",tag:"component",staticClass:"gl-new-dropdown-contents gl-new-dropdown-contents-with-scrim-overlay",class:_vm.listboxClasses,attrs:{"id":_vm.listboxId,"aria-busy":_vm.isBusy,"aria-labelledby":_vm.listboxAriaLabelledByID,"aria-multiselectable":_vm.multiple ? 'true' : undefined,"role":"listbox","tabindex":"0"},on:{"keydown":_vm.onKeydown}},[_c(_vm.itemTag,{tag:"component",staticClass:"top-scrim-wrapper",attrs:{"aria-hidden":"true","data-testid":"top-scrim"}},[_c('div',{staticClass:"top-scrim",class:{ 'top-scrim-light': !_vm.hasHeader, 'top-scrim-dark': _vm.hasHeader }})]),_vm._v(" "),_c(_vm.itemTag,{ref:"top-boundary",tag:"component",attrs:{"aria-hidden":"true"}}),_vm._v(" "),_vm._l((_vm.items),function(item,index){return [(_vm.isOption(item))?[_c('gl-listbox-item',_vm._b({key:_vm.listboxItemKey(item),attrs:{"id":_vm.generateItemId(item),"data-testid":("listbox-item-" + (item.value)),"is-highlighted":_vm.isHighlighted(item),"is-selected":_vm.isSelected(item),"is-focused":_vm.isFocused(item),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(item, $event)}}},'gl-listbox-item',_vm.listboxItemMoreItemsAriaAttributes(index),false),[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(item.text)+"\n ")]},{"item":item})],2)]:[_c('gl-listbox-group',{key:item.text,class:_vm.groupClasses(index),attrs:{"name":item.text,"text-sr-only":item.textSrOnly},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((item.options),function(option){return _c('gl-listbox-item',{key:_vm.listboxItemKey(option),attrs:{"id":_vm.generateItemId(option),"data-testid":("listbox-item-" + (option.value)),"is-highlighted":_vm.isHighlighted(option),"is-selected":_vm.isSelected(option),"is-focused":_vm.isFocused(option),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(option, $event)}}},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(option.text)+"\n ")]},{"item":option})],2)})],2)]]}),_vm._v(" "),(_vm.infiniteScrollLoading)?_c(_vm.itemTag,{tag:"component"},[_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-infinite-scroll-loader","size":"md"}})],1):_vm._e(),_vm._v(" "),(_vm.showIntersectionObserver)?_c('gl-intersection-observer',{on:{"appear":_vm.onIntersectionObserverAppear}}):_vm._e(),_vm._v(" "),_c(_vm.itemTag,{ref:"bottom-boundary",tag:"component",attrs:{"aria-hidden":"true"}}),_vm._v(" "),_c(_vm.itemTag,{tag:"component",staticClass:"bottom-scrim-wrapper",attrs:{"aria-hidden":"true","data-testid":"bottom-scrim"}},[_c('div',{staticClass:"bottom-scrim",class:{ '!gl-rounded-none': _vm.hasFooter }})])],2):_vm._e(),_vm._v(" "),(_vm.announceSRSearchResults)?_c('span',{staticClass:"gl-sr-only",attrs:{"data-testid":"listbox-number-of-results","aria-live":"assertive"}},[_vm._t("search-summary-sr-only",function(){return [_vm._v("\n "+_vm._s(_vm.srOnlyResultsLabel(_vm.flattenedOptions.length))+"\n ")]})],2):_vm._e(),_vm._v(" "),(_vm.isBusy)?_c('span',{staticClass:"gl-sr-only",attrs:{"aria-live":"polite","data-testid":"listbox-loading-announcement"}},[_vm._v("\n "+_vm._s(_vm.loadingAnnouncementText)+"\n ")]):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-py-3 gl-pl-7 gl-pr-5 gl-text-base gl-text-subtle",attrs:{"aria-live":"assertive","data-testid":"listbox-no-results-text"}},[_vm._v("\n "+_vm._s(_vm.noResultsText)+"\n ")]):_vm._e(),_vm._v(" "),_vm._t("footer")]}}],null,true)})};
|
|
917
925
|
var __vue_staticRenderFns__ = [];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { translate } from '../../../utils/i18n';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
+
|
|
4
|
+
var script = {
|
|
5
|
+
name: 'GlMultiStepFormTemplate',
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* The tile of the form. Should not be specific to the current step.
|
|
9
|
+
*/
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* The number of the current step. If a non-zero number is passed, then the current step number will be shown at the top of the form.
|
|
16
|
+
*/
|
|
17
|
+
currentStep: {
|
|
18
|
+
type: Number,
|
|
19
|
+
required: false,
|
|
20
|
+
default: null
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* The total number of steps. If a non-zero number is passed to this prop and a non-zero number is passed to the `currentStep` prop, then they will be formatted together at the top of the form. In English, this will appear as `Step n of x` where n is the current step and x is the step total.
|
|
24
|
+
*/
|
|
25
|
+
stepsTotal: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: false,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Optional override to the semantic element used for the form title's heading tag. Defaults to `h1` but should be adjusted in usage to prevent unexpected heading level changes in the DOM.
|
|
32
|
+
*/
|
|
33
|
+
headingTag: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
default: 'h1'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
stepMessage() {
|
|
41
|
+
return this.stepsTotal ? translate('GlMultiStepFormTemplate.stepXofY', 'Step %{currentStep} of %{stepsTotal}', {
|
|
42
|
+
currentStep: this.currentStep,
|
|
43
|
+
stepsTotal: this.stepsTotal
|
|
44
|
+
}) : translate('GlMultiStepFormTemplate.stepX', 'Step %{currentStep}', {
|
|
45
|
+
currentStep: this.currentStep
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/* script */
|
|
52
|
+
const __vue_script__ = script;
|
|
53
|
+
|
|
54
|
+
/* template */
|
|
55
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mx-auto gl-max-w-80 gl-pt-8"},[_c(_vm.headingTag,{tag:"component",staticClass:"gl-heading-1 gl-mb-3 gl-mt-0 gl-text-center",attrs:{"data-testid":"multi-step-form-title"}},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")]),_vm._v(" "),(_vm.currentStep)?_c('p',{staticClass:"gl-m-0 gl-text-center",attrs:{"data-testid":"multi-step-form-steps"}},[_vm._v("\n "+_vm._s(_vm.stepMessage)+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-mt-7",attrs:{"data-testid":"multi-step-form-content"}},[_vm._t("default")],2),_vm._v(" "),(_vm.$scopedSlots.back || _vm.$scopedSlots.next)?_c('div',{staticClass:"gl-mt-6 gl-flex gl-justify-center gl-gap-3",attrs:{"data-testid":"multi-step-form-action"}},[_vm._t("back"),_vm._v(" "),_vm._t("next")],2):_vm._e(),_vm._v(" "),(_vm.$scopedSlots.footer)?_c('div',{staticClass:"gl-mt-7",attrs:{"data-testid":"multi-step-form-footer"}},[_vm._t("footer")],2):_vm._e()],1)};
|
|
56
|
+
var __vue_staticRenderFns__ = [];
|
|
57
|
+
|
|
58
|
+
/* style */
|
|
59
|
+
const __vue_inject_styles__ = undefined;
|
|
60
|
+
/* scoped */
|
|
61
|
+
const __vue_scope_id__ = undefined;
|
|
62
|
+
/* module identifier */
|
|
63
|
+
const __vue_module_identifier__ = undefined;
|
|
64
|
+
/* functional template */
|
|
65
|
+
const __vue_is_functional_template__ = false;
|
|
66
|
+
/* style inject */
|
|
67
|
+
|
|
68
|
+
/* style inject SSR */
|
|
69
|
+
|
|
70
|
+
/* style inject shadow dom */
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
75
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
76
|
+
__vue_inject_styles__,
|
|
77
|
+
__vue_script__,
|
|
78
|
+
__vue_scope_id__,
|
|
79
|
+
__vue_is_functional_template__,
|
|
80
|
+
__vue_module_identifier__,
|
|
81
|
+
false,
|
|
82
|
+
undefined,
|
|
83
|
+
undefined,
|
|
84
|
+
undefined
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
export { __vue_component__ as default };
|
package/dist/components/index.js
CHANGED
|
@@ -103,3 +103,4 @@ export { default as GlIntersperse } from './utilities/intersperse/intersperse';
|
|
|
103
103
|
export { default as GlSprintf } from './utilities/sprintf/sprintf';
|
|
104
104
|
export { default as GlTruncate } from './utilities/truncate/truncate';
|
|
105
105
|
export { default as GlTruncateText } from './utilities/truncate_text/truncate_text';
|
|
106
|
+
export { default as GlMultiStepFormTemplate } from './extended/multi_step_form_template/multi_step_form_template';
|