@gitlab/ui 67.4.0 → 67.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [67.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v67.4.0...v67.5.0) (2023-11-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * **css:** Add focus variant for gl-z-index-1 ([8c08f01](https://gitlab.com/gitlab-org/gitlab-ui/commit/8c08f01a7877dd2836fb1eb024a9bfc8ad37cc44))
7
+ * **GlSorting:** Add opt-in for new dropdown design ([b4eb476](https://gitlab.com/gitlab-org/gitlab-ui/commit/b4eb476976ca488b89641404acd19c2029a5d27d))
8
+ * **GlSorting:** Make strings translatable ([2964d55](https://gitlab.com/gitlab-org/gitlab-ui/commit/2964d55864b17022d62c294ebf6c7babab611407))
9
+
1
10
  # [67.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v67.3.3...v67.4.0) (2023-11-02)
2
11
 
3
12
 
@@ -1,7 +1,10 @@
1
1
  import { GlTooltipDirective } from '../../../directives/tooltip';
2
2
  import GlButton from '../button/button';
3
3
  import GlButtonGroup from '../button_group/button_group';
4
+ import GlCollapsibleListbox from '../new_dropdowns/listbox/listbox';
5
+ import { isOption } from '../new_dropdowns/listbox/utils';
4
6
  import GlDropdown from '../dropdown/dropdown';
7
+ import { translate } from '../../../utils/i18n';
5
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
9
 
7
10
  var script = {
@@ -9,6 +12,7 @@ var script = {
9
12
  components: {
10
13
  GlButton,
11
14
  GlButtonGroup,
15
+ GlCollapsibleListbox,
12
16
  GlDropdown
13
17
  },
14
18
  directives: {
@@ -23,6 +27,24 @@ var script = {
23
27
  required: false,
24
28
  default: ''
25
29
  },
30
+ /**
31
+ * Sort options to display in the dropdown
32
+ */
33
+ sortOptions: {
34
+ type: Array,
35
+ required: false,
36
+ default: null,
37
+ validator: sortOptions => sortOptions.every(isOption)
38
+ },
39
+ /**
40
+ * The value of the item currently selected in the dropdown.
41
+ * Only to be used with the `sortOptions` prop.
42
+ */
43
+ sortBy: {
44
+ type: [String, Number],
45
+ required: false,
46
+ default: null
47
+ },
26
48
  /**
27
49
  * Determines the current sort order icon displayed.
28
50
  */
@@ -32,12 +54,13 @@ var script = {
32
54
  default: false
33
55
  },
34
56
  /**
35
- * The text of the tool tip for the sort direction toggle button.
57
+ * The text for the tooltip and aria-label of the sort direction toggle
58
+ * button instead of the defaults for ascending/descending.
36
59
  */
37
60
  sortDirectionToolTip: {
38
61
  type: String,
39
62
  required: false,
40
- default: 'Sort direction'
63
+ default: null
41
64
  },
42
65
  /**
43
66
  * Additional class(es) to apply to the root element of the GlDropdown.
@@ -68,8 +91,15 @@ var script = {
68
91
  localSortDirection() {
69
92
  return this.isAscending ? 'sort-lowest' : 'sort-highest';
70
93
  },
71
- sortDirectionAriaLabel() {
72
- return this.isAscending ? 'Sorting Direction: Ascending' : 'Sorting Direction: Descending';
94
+ sortDirectionText() {
95
+ if (this.sortDirectionToolTip) return this.sortDirectionToolTip;
96
+ return this.isAscending ? translate('GlSorting.sortAscending', 'Sort direction: ascending') : translate('GlSorting.sortDescending', 'Sort direction: descending');
97
+ },
98
+ useListbox() {
99
+ return Boolean(this.sortOptions);
100
+ },
101
+ listboxToggleClass() {
102
+ return [this.dropdownToggleClass, 'gl-rounded-top-right-none!', 'gl-rounded-bottom-right-none!', 'gl-focus-z-index-1'];
73
103
  }
74
104
  },
75
105
  methods: {
@@ -85,6 +115,18 @@ var script = {
85
115
  * @property {boolean} isAscending
86
116
  */
87
117
  this.$emit('sortDirectionChange', newDirection);
118
+ },
119
+ onSortByChanged(event) {
120
+ /**
121
+ * Emitted when the sort field is changed.
122
+ *
123
+ * The event's payload is the value of the selected sort field.
124
+ *
125
+ * Only emitted when using the `sortOptions` prop.
126
+ *
127
+ * @property {string|number} value
128
+ */
129
+ this.$emit('sortByChange', event);
88
130
  }
89
131
  }
90
132
  };
@@ -93,7 +135,7 @@ var script = {
93
135
  const __vue_script__ = script;
94
136
 
95
137
  /* template */
96
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-button-group',{staticClass:"gl-sorting"},[_c('gl-dropdown',_vm._b({class:_vm.dropdownClass,attrs:{"text":_vm.text,"category":"secondary","toggle-class":_vm.dropdownToggleClass,"right":""}},'gl-dropdown',_vm.$props,false),[_vm._t("default")],2),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],class:['sorting-direction-button', _vm.sortDirectionToggleClass],attrs:{"title":_vm.sortDirectionToolTip,"icon":_vm.localSortDirection,"aria-label":_vm.sortDirectionAriaLabel},on:{"click":_vm.toggleSortDirection}})],1)};
138
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-button-group',{staticClass:"gl-sorting"},[(_vm.useListbox)?_c('gl-collapsible-listbox',{class:_vm.dropdownClass,attrs:{"toggle-text":_vm.text,"items":_vm.sortOptions,"selected":_vm.sortBy,"toggle-class":_vm.listboxToggleClass,"placement":"right"},on:{"select":_vm.onSortByChanged}}):_c('gl-dropdown',_vm._b({class:_vm.dropdownClass,attrs:{"text":_vm.text,"category":"secondary","toggle-class":_vm.dropdownToggleClass,"right":""}},'gl-dropdown',_vm.$props,false),[_vm._t("default")],2),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],class:['sorting-direction-button', _vm.sortDirectionToggleClass],attrs:{"title":_vm.sortDirectionText,"icon":_vm.localSortDirection,"aria-label":_vm.sortDirectionText},on:{"click":_vm.toggleSortDirection}})],1)};
97
139
  var __vue_staticRenderFns__ = [];
98
140
 
99
141
  /* style */
@@ -5,6 +5,9 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
5
  /**
6
6
  * Sorting Item
7
7
  *
8
+ * NOTE: This component is deprecated. Instead, use the `sortOptions` prop of
9
+ * `GlSorting`.
10
+ *
8
11
  * This is written as a functional component because it is a simple wrapper over
9
12
  * the GlDropdownItem component and does not use internal state. Functional
10
13
  * components are cheaper to render and often used as wrappers like this. We're
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ * Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ * Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ * Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ * Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ // Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 02 Nov 2023 13:13:04 GMT
3
+ // Generated on Thu, 02 Nov 2023 13:48:18 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;