@gitlab/ui 49.5.0 → 49.6.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 +14 -0
- package/dist/components/base/button/button.js +3 -3
- package/dist/components/base/dropdown/dropdown.js +1 -1
- package/dist/components/base/form/form_date/form_date.js +143 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +1 -1
- package/dist/components/base/new_dropdowns/listbox/listbox.js +1 -1
- package/dist/components/mixins/button_mixin.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/constants.js +1 -5
- package/package.json +2 -2
- package/src/components/base/button/button.vue +2 -3
- package/src/components/base/dropdown/dropdown.md +11 -0
- package/src/components/base/dropdown/dropdown.scss +3 -1
- package/src/components/base/dropdown/dropdown.vue +1 -1
- package/src/components/base/form/form_date/form_date.md +26 -0
- package/src/components/base/form/form_date/form_date.scss +7 -0
- package/src/components/base/form/form_date/form_date.spec.js +85 -0
- package/src/components/base/form/form_date/form_date.stories.js +100 -0
- package/src/components/base/form/form_date/form_date.vue +135 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +1 -1
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +1 -1
- package/src/components/base/new_dropdowns/listbox/listbox.vue +1 -1
- package/src/components/mixins/button_mixin.js +2 -2
- package/src/scss/components.scss +1 -0
- package/src/utils/constants.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [49.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v49.5.1...v49.6.0) (2022-11-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlFormDate:** Add component ([099e6d3](https://gitlab.com/gitlab-org/gitlab-ui/commit/099e6d36e2544a85796316b237dde04b5e3150d3))
|
|
7
|
+
|
|
8
|
+
## [49.5.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v49.5.0...v49.5.1) (2022-11-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **GlDropdown:** Dropdown arrow position when in block mode ([7a34f2d](https://gitlab.com/gitlab-org/gitlab-ui/commit/7a34f2dfea96388dbd281f2b372dc14299cabadd))
|
|
14
|
+
|
|
1
15
|
# [49.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v49.4.1...v49.5.0) (2022-11-07)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BButton } from 'bootstrap-vue/esm/index.js';
|
|
2
|
-
import { buttonCategoryOptions, buttonVariantOptions, buttonSizeOptions
|
|
2
|
+
import { buttonCategoryOptions, buttonVariantOptions, buttonSizeOptions } from '../../../utils/constants';
|
|
3
3
|
import { logWarning } from '../../../utils/utils';
|
|
4
4
|
import { SafeLinkMixin } from '../../mixins/safe_link_mixin';
|
|
5
5
|
import GlIcon from '../icon/icon';
|
|
@@ -30,7 +30,7 @@ var script = {
|
|
|
30
30
|
size: {
|
|
31
31
|
type: String,
|
|
32
32
|
required: false,
|
|
33
|
-
default:
|
|
33
|
+
default: 'medium',
|
|
34
34
|
validator: value => Object.keys(buttonSizeOptions).includes(value)
|
|
35
35
|
},
|
|
36
36
|
selected: {
|
|
@@ -92,7 +92,7 @@ var script = {
|
|
|
92
92
|
return classes;
|
|
93
93
|
},
|
|
94
94
|
buttonSize() {
|
|
95
|
-
return
|
|
95
|
+
return buttonSizeOptions[this.size];
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
mounted() {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import _uniqueId from 'lodash/uniqueId';
|
|
2
|
+
import GlFormInput from '../form_input/form_input';
|
|
3
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
|
+
|
|
5
|
+
var script = {
|
|
6
|
+
name: 'GlFormDate',
|
|
7
|
+
components: {
|
|
8
|
+
GlFormInput
|
|
9
|
+
},
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
model: {
|
|
12
|
+
event: 'change',
|
|
13
|
+
prop: 'value'
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
id: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
min: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: false,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
max: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: false,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
minInvalidFeedback: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
default: 'Must be after minimum date'
|
|
35
|
+
},
|
|
36
|
+
maxInvalidFeedback: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false,
|
|
39
|
+
default: 'Must be before maximum date'
|
|
40
|
+
},
|
|
41
|
+
value: {
|
|
42
|
+
type: String,
|
|
43
|
+
required: false,
|
|
44
|
+
default: null
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
currentValue: this.value,
|
|
50
|
+
inputId: this.id || _uniqueId('form-date-'),
|
|
51
|
+
invalidFeedbackId: _uniqueId('form-date-invalid-feedback-'),
|
|
52
|
+
outputId: _uniqueId('form-date-output-'),
|
|
53
|
+
valueAsDate: null
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
ariaDescribedBy() {
|
|
58
|
+
return [this.valueAsDate && this.outputId, this.isInvalid && this.invalidFeedbackId].join(' ');
|
|
59
|
+
},
|
|
60
|
+
isLessThanMin() {
|
|
61
|
+
return this.currentValue && this.min && this.currentValue < this.min;
|
|
62
|
+
},
|
|
63
|
+
isGreaterThanMax() {
|
|
64
|
+
return this.currentValue && this.max && this.currentValue > this.max;
|
|
65
|
+
},
|
|
66
|
+
isInvalid() {
|
|
67
|
+
return this.isLessThanMin || this.isGreaterThanMax;
|
|
68
|
+
},
|
|
69
|
+
outputValue() {
|
|
70
|
+
if (!this.valueAsDate) return null;
|
|
71
|
+
return new Intl.DateTimeFormat(undefined, {
|
|
72
|
+
dateStyle: 'full'
|
|
73
|
+
}).format(this.valueAsDate);
|
|
74
|
+
},
|
|
75
|
+
state() {
|
|
76
|
+
return !this.isInvalid;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
watch: {
|
|
80
|
+
value: {
|
|
81
|
+
handler(newValue) {
|
|
82
|
+
this.currentValue = newValue;
|
|
83
|
+
this.updateValueAsDate();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async mounted() {
|
|
88
|
+
await this.$nextTick();
|
|
89
|
+
this.updateValueAsDate();
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
updateValueAsDate() {
|
|
93
|
+
this.valueAsDate = this.$refs.input.$el.valueAsDate;
|
|
94
|
+
},
|
|
95
|
+
onChange($event) {
|
|
96
|
+
/**
|
|
97
|
+
* Emitted when date is changed.
|
|
98
|
+
*
|
|
99
|
+
* @event change
|
|
100
|
+
*/
|
|
101
|
+
this.updateValueAsDate();
|
|
102
|
+
this.$emit('change', $event);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/* script */
|
|
108
|
+
const __vue_script__ = script;
|
|
109
|
+
|
|
110
|
+
/* template */
|
|
111
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-form-date"},[_c('gl-form-input',_vm._b({ref:"input",attrs:{"id":_vm.inputId,"aria-describedby":_vm.ariaDescribedBy,"min":_vm.min,"max":_vm.max,"pattern":"\\d{4}-\\d{2}-\\d{2}","placeholder":"yyyy-mm-dd","state":_vm.state,"type":"date"},on:{"change":_vm.onChange},model:{value:(_vm.currentValue),callback:function ($$v) {_vm.currentValue=$$v;},expression:"currentValue"}},'gl-form-input',_vm.$attrs,false)),_vm._v(" "),(_vm.outputValue)?_c('output',{ref:"output",staticClass:"gl-sr-only",attrs:{"id":_vm.outputId,"for":_vm.inputId}},[_vm._v("\n "+_vm._s(_vm.outputValue)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.isInvalid)?_c('div',{ref:"invalidFeedback",staticClass:"invalid-feedback",attrs:{"id":_vm.invalidFeedbackId}},[(_vm.isLessThanMin)?[_vm._v("\n "+_vm._s(_vm.minInvalidFeedback)+"\n ")]:_vm._e(),_vm._v(" "),(_vm.isGreaterThanMax)?[_vm._v("\n "+_vm._s(_vm.maxInvalidFeedback)+"\n ")]:_vm._e()],2):_vm._e()],1)};
|
|
112
|
+
var __vue_staticRenderFns__ = [];
|
|
113
|
+
|
|
114
|
+
/* style */
|
|
115
|
+
const __vue_inject_styles__ = undefined;
|
|
116
|
+
/* scoped */
|
|
117
|
+
const __vue_scope_id__ = undefined;
|
|
118
|
+
/* module identifier */
|
|
119
|
+
const __vue_module_identifier__ = undefined;
|
|
120
|
+
/* functional template */
|
|
121
|
+
const __vue_is_functional_template__ = false;
|
|
122
|
+
/* style inject */
|
|
123
|
+
|
|
124
|
+
/* style inject SSR */
|
|
125
|
+
|
|
126
|
+
/* style inject shadow dom */
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
const __vue_component__ = __vue_normalize__(
|
|
131
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
132
|
+
__vue_inject_styles__,
|
|
133
|
+
__vue_script__,
|
|
134
|
+
__vue_scope_id__,
|
|
135
|
+
__vue_is_functional_template__,
|
|
136
|
+
__vue_module_identifier__,
|
|
137
|
+
false,
|
|
138
|
+
undefined,
|
|
139
|
+
undefined,
|
|
140
|
+
undefined
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export default __vue_component__;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buttonSizeOptions } from '../../utils/constants';
|
|
2
2
|
|
|
3
3
|
const ButtonMixin = {
|
|
4
4
|
computed: {
|
|
5
5
|
buttonSize() {
|
|
6
|
-
return
|
|
6
|
+
return buttonSizeOptions[this.size];
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
};
|