@gitlab/ui 72.11.1 → 72.12.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.
Files changed (223) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/tokens/css/tokens.css +1 -1
  3. package/dist/tokens/css/tokens.dark.css +1 -1
  4. package/dist/tokens/js/tokens.dark.js +1 -1
  5. package/dist/tokens/js/tokens.js +1 -1
  6. package/dist/tokens/scss/_tokens.dark.scss +1 -1
  7. package/dist/tokens/scss/_tokens.scss +1 -1
  8. package/package.json +1 -1
  9. package/src/internal/color_contrast/color_contrast.md +8 -0
  10. package/src/internal/color_contrast/color_contrast.spec.js +34 -0
  11. package/src/internal/color_contrast/color_contrast.stories.js +41 -0
  12. package/src/internal/color_contrast/color_contrast.vue +52 -0
  13. package/src/tokens/color.dark.tokens.stories.js +36 -22
  14. package/src/tokens/color.data_viz.dark.tokens.stories.js +13 -30
  15. package/src/tokens/color.data_viz.tokens.stories.js +13 -30
  16. package/src/tokens/color.theme.dark.tokens.stories.js +15 -30
  17. package/src/tokens/color.theme.tokens.stories.js +15 -30
  18. package/src/tokens/color.tokens.stories.js +36 -22
  19. package/src/tokens/color.transparency.tokens.stories.js +9 -12
  20. package/src/tokens/common_story_options.js +22 -80
  21. package/src/utils/constants.js +25 -0
  22. package/src/utils/utils.js +21 -1
  23. package/dist/charts.js +0 -14
  24. package/dist/components/base/accordion/accordion.js +0 -73
  25. package/dist/components/base/accordion/accordion_item.js +0 -133
  26. package/dist/components/base/alert/alert.js +0 -222
  27. package/dist/components/base/avatar/avatar.js +0 -160
  28. package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -107
  29. package/dist/components/base/avatar_link/avatar_link.js +0 -47
  30. package/dist/components/base/avatars_inline/avatars_inline.js +0 -119
  31. package/dist/components/base/badge/badge.js +0 -105
  32. package/dist/components/base/banner/banner.js +0 -139
  33. package/dist/components/base/breadcrumb/breadcrumb.js +0 -122
  34. package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -73
  35. package/dist/components/base/broadcast_message/broadcast_message.js +0 -112
  36. package/dist/components/base/broadcast_message/constants.js +0 -5
  37. package/dist/components/base/button/button.js +0 -151
  38. package/dist/components/base/button_group/button_group.js +0 -47
  39. package/dist/components/base/card/card.js +0 -71
  40. package/dist/components/base/carousel/carousel.js +0 -48
  41. package/dist/components/base/carousel/carousel_slide.js +0 -47
  42. package/dist/components/base/collapse/collapse.js +0 -59
  43. package/dist/components/base/datepicker/datepicker.js +0 -386
  44. package/dist/components/base/daterange_picker/daterange_picker.js +0 -288
  45. package/dist/components/base/drawer/drawer.js +0 -127
  46. package/dist/components/base/dropdown/dropdown.js +0 -261
  47. package/dist/components/base/dropdown/dropdown_divider.js +0 -48
  48. package/dist/components/base/dropdown/dropdown_form.js +0 -48
  49. package/dist/components/base/dropdown/dropdown_item.js +0 -131
  50. package/dist/components/base/dropdown/dropdown_section_header.js +0 -48
  51. package/dist/components/base/dropdown/dropdown_text.js +0 -48
  52. package/dist/components/base/filtered_search/common_story_options.js +0 -14
  53. package/dist/components/base/filtered_search/filtered_search.js +0 -388
  54. package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -89
  55. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -138
  56. package/dist/components/base/filtered_search/filtered_search_term.js +0 -203
  57. package/dist/components/base/filtered_search/filtered_search_token.js +0 -384
  58. package/dist/components/base/filtered_search/filtered_search_token_segment.js +0 -420
  59. package/dist/components/base/filtered_search/filtered_search_utils.js +0 -242
  60. package/dist/components/base/form/form.js +0 -49
  61. package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -78
  62. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +0 -60
  63. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
  64. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
  65. package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
  66. package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
  67. package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -199
  68. package/dist/components/base/form/form_combobox/constants.js +0 -55
  69. package/dist/components/base/form/form_combobox/form_combobox.js +0 -230
  70. package/dist/components/base/form/form_date/form_date.js +0 -143
  71. package/dist/components/base/form/form_fields/form_field_validator.js +0 -93
  72. package/dist/components/base/form/form_fields/form_fields.js +0 -214
  73. package/dist/components/base/form/form_fields/mappers.js +0 -13
  74. package/dist/components/base/form/form_fields/validators.js +0 -48
  75. package/dist/components/base/form/form_group/form_group.js +0 -97
  76. package/dist/components/base/form/form_input/form_input.js +0 -121
  77. package/dist/components/base/form/form_input_group/form_input_group.js +0 -108
  78. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -41
  79. package/dist/components/base/form/form_radio/form_radio.js +0 -65
  80. package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -78
  81. package/dist/components/base/form/form_select/constants.js +0 -12
  82. package/dist/components/base/form/form_select/form_select.js +0 -82
  83. package/dist/components/base/form/form_text/form_text.js +0 -38
  84. package/dist/components/base/form/form_textarea/form_textarea.js +0 -112
  85. package/dist/components/base/form/input_group_text/input_group_text.js +0 -48
  86. package/dist/components/base/icon/icon.js +0 -111
  87. package/dist/components/base/infinite_scroll/infinite_scroll.js +0 -197
  88. package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -151
  89. package/dist/components/base/label/label.js +0 -163
  90. package/dist/components/base/link/link.js +0 -50
  91. package/dist/components/base/loading_icon/loading_icon.js +0 -111
  92. package/dist/components/base/markdown/markdown.js +0 -52
  93. package/dist/components/base/modal/modal.js +0 -204
  94. package/dist/components/base/nav/nav.js +0 -48
  95. package/dist/components/base/nav/nav_item.js +0 -48
  96. package/dist/components/base/nav/nav_item_dropdown.js +0 -62
  97. package/dist/components/base/navbar/navbar.js +0 -48
  98. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -453
  99. package/dist/components/base/new_dropdowns/base_dropdown/constants.js +0 -4
  100. package/dist/components/base/new_dropdowns/constants.js +0 -21
  101. package/dist/components/base/new_dropdowns/disclosure/constants.js +0 -8
  102. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +0 -370
  103. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +0 -110
  104. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +0 -143
  105. package/dist/components/base/new_dropdowns/disclosure/mock_data.js +0 -147
  106. package/dist/components/base/new_dropdowns/disclosure/utils.js +0 -39
  107. package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -767
  108. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -58
  109. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -91
  110. package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +0 -93
  111. package/dist/components/base/new_dropdowns/listbox/mock_data.js +0 -118
  112. package/dist/components/base/new_dropdowns/listbox/utils.js +0 -34
  113. package/dist/components/base/paginated_list/paginated_list.js +0 -180
  114. package/dist/components/base/pagination/pagination.js +0 -399
  115. package/dist/components/base/path/data.js +0 -34
  116. package/dist/components/base/path/path.js +0 -189
  117. package/dist/components/base/popover/popover.js +0 -110
  118. package/dist/components/base/progress_bar/progress_bar.js +0 -48
  119. package/dist/components/base/search_box_by_click/search_box_by_click.js +0 -235
  120. package/dist/components/base/search_box_by_type/search_box_by_type.js +0 -167
  121. package/dist/components/base/segmented_control/segmented_control.js +0 -109
  122. package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -224
  123. package/dist/components/base/sorting/sorting.js +0 -171
  124. package/dist/components/base/sorting/sorting_item.js +0 -109
  125. package/dist/components/base/table/constants.js +0 -5
  126. package/dist/components/base/table/table.js +0 -89
  127. package/dist/components/base/table_lite/table_lite.js +0 -72
  128. package/dist/components/base/tabs/constants.js +0 -3
  129. package/dist/components/base/tabs/tab/tab.js +0 -83
  130. package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -143
  131. package/dist/components/base/tabs/tabs/tabs.js +0 -224
  132. package/dist/components/base/toast/toast.js +0 -82
  133. package/dist/components/base/toggle/toggle.js +0 -180
  134. package/dist/components/base/token/token.js +0 -85
  135. package/dist/components/base/token_selector/helpers.js +0 -5
  136. package/dist/components/base/token_selector/token_container.js +0 -165
  137. package/dist/components/base/token_selector/token_selector.js +0 -403
  138. package/dist/components/base/token_selector/token_selector_dropdown.js +0 -199
  139. package/dist/components/base/tooltip/tooltip.js +0 -55
  140. package/dist/components/charts/area/area.js +0 -311
  141. package/dist/components/charts/bar/bar.js +0 -253
  142. package/dist/components/charts/chart/chart.js +0 -215
  143. package/dist/components/charts/column/column.js +0 -226
  144. package/dist/components/charts/discrete_scatter/discrete_scatter.js +0 -203
  145. package/dist/components/charts/gauge/gauge.js +0 -208
  146. package/dist/components/charts/heatmap/heatmap.js +0 -295
  147. package/dist/components/charts/heatmap/index.js +0 -2
  148. package/dist/components/charts/legend/legend.js +0 -228
  149. package/dist/components/charts/line/line.js +0 -308
  150. package/dist/components/charts/series_label/series_label.js +0 -100
  151. package/dist/components/charts/single_stat/single_stat.js +0 -152
  152. package/dist/components/charts/sparkline/sparkline.js +0 -261
  153. package/dist/components/charts/stacked_column/stacked_column.js +0 -335
  154. package/dist/components/charts/tooltip/tooltip.js +0 -251
  155. package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -83
  156. package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -100
  157. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -35
  158. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -115
  159. package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -104
  160. package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -64
  161. package/dist/components/experimental/duo/chat/constants.js +0 -23
  162. package/dist/components/experimental/duo/chat/duo_chat.js +0 -359
  163. package/dist/components/experimental/duo/chat/mock_data.js +0 -83
  164. package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -94
  165. package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -124
  166. package/dist/components/experimental/experiment_badge/constants.js +0 -4
  167. package/dist/components/experimental/experiment_badge/experiment_badge.js +0 -107
  168. package/dist/components/mixins/button_mixin.js +0 -11
  169. package/dist/components/mixins/safe_link_mixin.js +0 -30
  170. package/dist/components/mixins/tooltip_mixin.js +0 -21
  171. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +0 -53
  172. package/dist/components/regions/empty_state/empty_state.js +0 -154
  173. package/dist/components/shared_components/charts/tooltip_default_format.js +0 -53
  174. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +0 -64
  175. package/dist/components/shared_components/close_button/close_button.js +0 -54
  176. package/dist/components/utilities/animated_number/animated_number.js +0 -131
  177. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -75
  178. package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -88
  179. package/dist/components/utilities/intersperse/intersperse.js +0 -86
  180. package/dist/components/utilities/sprintf/sprintf.js +0 -172
  181. package/dist/components/utilities/truncate/constants.js +0 -7
  182. package/dist/components/utilities/truncate/truncate.js +0 -111
  183. package/dist/components/utilities/truncate_text/constants.js +0 -7
  184. package/dist/components/utilities/truncate_text/truncate_text.js +0 -146
  185. package/dist/config.js +0 -86
  186. package/dist/directives/collapse_toggle.js +0 -1
  187. package/dist/directives/hover_load/hover_load.js +0 -45
  188. package/dist/directives/modal.js +0 -1
  189. package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
  190. package/dist/directives/outside/outside.js +0 -106
  191. package/dist/directives/resize_observer/resize_observer.js +0 -51
  192. package/dist/directives/safe_html/constants.js +0 -6
  193. package/dist/directives/safe_html/safe_html.js +0 -39
  194. package/dist/directives/safe_link/mock_data.js +0 -10
  195. package/dist/directives/safe_link/safe_link.js +0 -65
  196. package/dist/directives/tooltip.js +0 -1
  197. package/dist/index.css +0 -7
  198. package/dist/index.css.map +0 -1
  199. package/dist/index.js +0 -105
  200. package/dist/tokens/common_story_options.js +0 -109
  201. package/dist/utils/breakpoints.js +0 -20
  202. package/dist/utils/charts/config.js +0 -556
  203. package/dist/utils/charts/constants.js +0 -63
  204. package/dist/utils/charts/mock_data.js +0 -211
  205. package/dist/utils/charts/story_config.js +0 -42
  206. package/dist/utils/charts/theme.js +0 -192
  207. package/dist/utils/charts/utils.js +0 -54
  208. package/dist/utils/constants.js +0 -270
  209. package/dist/utils/data_utils.js +0 -21
  210. package/dist/utils/datetime_utility.js +0 -61
  211. package/dist/utils/i18n.js +0 -15
  212. package/dist/utils/is_slot_empty.js +0 -38
  213. package/dist/utils/number_utils.js +0 -124
  214. package/dist/utils/stories_constants.js +0 -29
  215. package/dist/utils/stories_utils.js +0 -13
  216. package/dist/utils/story_decorators/container.js +0 -16
  217. package/dist/utils/string_utils.js +0 -69
  218. package/dist/utils/svgs/svg_paths.js +0 -7
  219. package/dist/utils/test_utils.js +0 -33
  220. package/dist/utils/use_fake_date.js +0 -29
  221. package/dist/utils/use_mock_intersection_observer.js +0 -108
  222. package/dist/utils/utils.js +0 -177
  223. package/dist/utils.js +0 -5
@@ -1,214 +0,0 @@
1
- import isFunction from 'lodash/isFunction';
2
- import mapValues from 'lodash/mapValues';
3
- import uniqueId from 'lodash/uniqueId';
4
- import GlFormGroup from '../form_group/form_group';
5
- import GlFormInput from '../form_input/form_input';
6
- import GlFormFieldValidator from './form_field_validator';
7
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
-
9
- var script = {
10
- name: 'GlFormFields',
11
- components: {
12
- GlFormGroup,
13
- GlFormInput,
14
- GlFormFieldValidator
15
- },
16
- model: {
17
- prop: 'values',
18
- event: 'input'
19
- },
20
- props: {
21
- /**
22
- * Object of keys to FieldDefinitions.
23
- * The shape of the keys will be the same for `values` and what's emitted by the `input` event.
24
- *
25
- * @typedef {object} FieldDefinition
26
- * @template TValue=string
27
- * @property {string} label - Label text to show for this field.
28
- * @property {undefined | Object} groupAttrs - Properties that are passed to the group wrapping this field.
29
- * @property {undefined | Object} inputAttrs - Properties that are passed to the actual input for this field.
30
- * @property {undefined | function(string): TValue} mapValue - Function that maps the inputted string value to the field's actual value (e.g. a Number).
31
- * @property {undefined | Array<function(TValue): string | undefined>=} validators - Collection of validator functions.
32
- *
33
- * @type {{ [key: string]: FieldDefinition }}
34
- */
35
- fields: {
36
- type: Object,
37
- required: true
38
- },
39
- /**
40
- * The current value for each field, by key.
41
- * Keys should match between `values` and `fields`.
42
- */
43
- values: {
44
- type: Object,
45
- required: true
46
- },
47
- /**
48
- * The id of the form element to handle "submit" listening.
49
- */
50
- formId: {
51
- type: String,
52
- required: true
53
- }
54
- },
55
- data() {
56
- return {
57
- fieldDirtyStatuses: {},
58
- fieldValidations: {}
59
- };
60
- },
61
- computed: {
62
- formElement() {
63
- return document.getElementById(this.formId);
64
- },
65
- fieldValidationProps() {
66
- return mapValues(this.fields, (_, fieldName) => {
67
- const invalidFeedback = this.fieldValidations[fieldName] || '';
68
- return {
69
- invalidFeedback,
70
- state: invalidFeedback ? false : null
71
- };
72
- });
73
- },
74
- fieldValues() {
75
- return mapValues(this.fields, (_, fieldName) => {
76
- if (fieldName in this.values) {
77
- return this.values[fieldName];
78
- }
79
- return this.getMappedValue(fieldName, undefined);
80
- });
81
- },
82
- fieldNames() {
83
- return Object.keys(this.fields);
84
- },
85
- fieldsToRender() {
86
- return mapValues(this.fields, (field, fieldName) => {
87
- const id = uniqueId('gl-form-field-');
88
- const scopedSlotName = `input(${fieldName})`;
89
- const hasScopedSlot = this.$scopedSlots[scopedSlotName];
90
- const scopedSlotAttrs = hasScopedSlot && {
91
- value: this.fieldValues[fieldName],
92
- input: val => this.onFieldInput(fieldName, val),
93
- blur: () => this.onFieldBlur(fieldName),
94
- validation: this.fieldValidationProps[fieldName],
95
- id
96
- };
97
- return {
98
- ...field,
99
- id,
100
- label: field.label || fieldName,
101
- scopedSlotName,
102
- scopedSlotAttrs
103
- };
104
- });
105
- }
106
- },
107
- mounted() {
108
- var _this$formElement;
109
- // why: We emit initial values as a convenience so that `v-model="values"` can be easily initialized.
110
- this.$emit('input', this.fieldValues);
111
- (_this$formElement = this.formElement) === null || _this$formElement === void 0 ? void 0 : _this$formElement.addEventListener('submit', this.onFormSubmission);
112
- },
113
- destroyed() {
114
- var _this$formElement2;
115
- (_this$formElement2 = this.formElement) === null || _this$formElement2 === void 0 ? void 0 : _this$formElement2.removeEventListener('submit', this.onFormSubmission);
116
- },
117
- methods: {
118
- setFieldDirty(fieldName) {
119
- this.$set(this.fieldDirtyStatuses, fieldName, true);
120
- },
121
- setAllFieldsDirty() {
122
- this.fieldNames.forEach(fieldName => this.setFieldDirty(fieldName));
123
- },
124
- hasAllFieldsValid() {
125
- // note: Only check "fieldNames" since "fields" could have changed since the life of "fieldValidations"
126
- return this.fieldNames.every(fieldName => !this.fieldValidations[fieldName]);
127
- },
128
- async checkBeforeSubmission() {
129
- this.setAllFieldsDirty();
130
- await this.$nextTick();
131
- return this.hasAllFieldsValid();
132
- },
133
- getMappedValue(fieldName, val) {
134
- const field = this.fields[fieldName];
135
- if (isFunction(field === null || field === void 0 ? void 0 : field.mapValue)) {
136
- return field.mapValue(val);
137
- }
138
- return val;
139
- },
140
- onFieldValidationUpdate(fieldName, invalidFeedback) {
141
- this.$set(this.fieldValidations, fieldName, invalidFeedback);
142
- },
143
- onFieldBlur(fieldName) {
144
- this.setFieldDirty(fieldName);
145
- },
146
- onFieldInput(fieldName, inputValue) {
147
- const val = this.getMappedValue(fieldName, inputValue);
148
-
149
- /**
150
- * Emitted when any of the form values change. Used by `v-model`.
151
- */
152
- this.$emit('input', {
153
- ...this.values,
154
- [fieldName]: val
155
- });
156
-
157
- /**
158
- * Emitted when a form input emits the `input` event.
159
- */
160
- this.$emit('input-field', {
161
- name: fieldName,
162
- value: val
163
- });
164
- },
165
- async onFormSubmission(e) {
166
- e.preventDefault();
167
- const isValid = await this.checkBeforeSubmission();
168
- if (isValid) {
169
- /**
170
- * Emitted when the form is submitted and all of the form fields are valid.
171
- */
172
- this.$emit('submit', e);
173
- }
174
- }
175
- }
176
- };
177
-
178
- /* script */
179
- const __vue_script__ = script;
180
-
181
- /* template */
182
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.fieldsToRender),function(field,fieldName){return _c('gl-form-group',_vm._b({key:fieldName,attrs:{"label":field.label,"label-for":field.id,"invalid-feedback":_vm.fieldValidationProps[fieldName].invalidFeedback,"state":_vm.fieldValidationProps[fieldName].state}},'gl-form-group',field.groupAttrs,false),[_c('gl-form-field-validator',{attrs:{"value":_vm.fieldValues[fieldName],"validators":field.validators,"should-validate":_vm.fieldDirtyStatuses[fieldName]},on:{"update":function($event){return _vm.onFieldValidationUpdate(fieldName, $event)}}}),_vm._v(" "),(field.scopedSlotAttrs)?[_vm._t(field.scopedSlotName,null,null,field.scopedSlotAttrs)]:[_c('gl-form-input',_vm._b({attrs:{"id":field.id,"value":_vm.fieldValues[fieldName],"state":_vm.fieldValidationProps[fieldName].state},on:{"input":function($event){return _vm.onFieldInput(fieldName, $event)},"blur":function($event){return _vm.onFieldBlur(fieldName)}}},'gl-form-input',field.inputAttrs,false))]],2)}),1)};
183
- var __vue_staticRenderFns__ = [];
184
-
185
- /* style */
186
- const __vue_inject_styles__ = undefined;
187
- /* scoped */
188
- const __vue_scope_id__ = undefined;
189
- /* module identifier */
190
- const __vue_module_identifier__ = undefined;
191
- /* functional template */
192
- const __vue_is_functional_template__ = false;
193
- /* style inject */
194
-
195
- /* style inject SSR */
196
-
197
- /* style inject shadow dom */
198
-
199
-
200
-
201
- const __vue_component__ = __vue_normalize__(
202
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
203
- __vue_inject_styles__,
204
- __vue_script__,
205
- __vue_scope_id__,
206
- __vue_is_functional_template__,
207
- __vue_module_identifier__,
208
- false,
209
- undefined,
210
- undefined,
211
- undefined
212
- );
213
-
214
- export default __vue_component__;
@@ -1,13 +0,0 @@
1
- // This contains core mapping behavior (like mapping to native JavaScript types)
2
- // and**should not** contain domain-specific mappers.
3
- //
4
- // ```
5
- // // Good
6
- // export const mapToBoolean = ...
7
- //
8
- // // Bad
9
- // export const mapToApolloCacheWidget = ...
10
- // ```
11
- const mapToNumber = x => Number(x || 0);
12
-
13
- export { mapToNumber };
@@ -1,48 +0,0 @@
1
- import emojiRegex from 'emoji-regex';
2
-
3
- const EMOJI_REGEX = emojiRegex();
4
-
5
- // This contains core validating behavior and **should not** contain
6
- // domain-specific validations.
7
- //
8
- // Look to what's allowed in HTML attributes as a good basis for what belongs here
9
- //
10
- // ```
11
- // // Good
12
- // export const required = ...
13
- //
14
- // // Bad
15
- // export const projectPathIsUnique = ...
16
- // ```
17
- const factory = (failMessage, isValid) => val => !isValid(val) ? failMessage : '';
18
-
19
- /**
20
- * Validator function to check if a string is present and non-empty.
21
- *
22
- * Returns an empty string if the input contains a valid string.
23
- *
24
- * Returns `failMessage` if the input string is empty, null, or undefined.
25
- * @param {string} failMessage - The error message to be returned when validation fails.
26
- * @returns {Function} A validation function that returns either `failMessage` or empty string.
27
- */
28
- const required = failMessage => factory(failMessage, val => val !== '' && val !== null && val !== undefined);
29
-
30
- /**
31
- * Validator function to check if a string contains any emojis.
32
- *
33
- * Returns an empty string if the input is empty, null, or undefined, or if no emoji is present.
34
- *
35
- * Returns `failMessage` if the input string contains at least one emoji.
36
- * @param {string} failMessage - The error message to be returned when validation fails.
37
- * @returns {Function} A validation function that returns either `failMessage` or empty string.
38
- */
39
- const noEmojis = failMessage => factory(failMessage, val => {
40
- var _val$match$length, _val$match;
41
- if (!val || typeof val !== 'string') {
42
- return true;
43
- }
44
- const resultsLength = (_val$match$length = (_val$match = val.match(EMOJI_REGEX)) === null || _val$match === void 0 ? void 0 : _val$match.length) !== null && _val$match$length !== void 0 ? _val$match$length : 0;
45
- return resultsLength < 1;
46
- });
47
-
48
- export { factory, noEmojis, required };
@@ -1,97 +0,0 @@
1
- import { BFormGroup } from 'bootstrap-vue/esm/index.js';
2
- import isString from 'lodash/isString';
3
- import isPlainObject from 'lodash/isPlainObject';
4
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
-
6
- var script = {
7
- name: 'GlFormGroup',
8
- components: {
9
- BFormGroup
10
- },
11
- inheritAttrs: false,
12
- props: {
13
- labelClass: {
14
- type: [String, Array, Object],
15
- required: false,
16
- default: null
17
- },
18
- labelDescription: {
19
- type: String,
20
- required: false,
21
- default: ''
22
- },
23
- optional: {
24
- type: Boolean,
25
- required: false,
26
- default: false
27
- },
28
- optionalText: {
29
- type: String,
30
- required: false,
31
- default: '(optional)'
32
- }
33
- },
34
- computed: {
35
- actualLabelClass() {
36
- const {
37
- labelClass
38
- } = this;
39
- const defaultClass = 'col-form-label';
40
- if (isString(labelClass)) {
41
- return `${labelClass} ${defaultClass}`;
42
- }
43
- if (Array.isArray(labelClass)) {
44
- return [...labelClass, defaultClass];
45
- }
46
- if (isPlainObject(labelClass)) {
47
- return {
48
- ...labelClass,
49
- [defaultClass]: true
50
- };
51
- }
52
- return defaultClass;
53
- },
54
- hasLabelDescription() {
55
- // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
56
- return Boolean(this.labelDescription || this.$slots['label-description']);
57
- }
58
- }
59
- };
60
-
61
- /* script */
62
- const __vue_script__ = script;
63
-
64
- /* template */
65
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-group',_vm._b({staticClass:"gl-form-group",attrs:{"label-class":_vm.actualLabelClass},scopedSlots:_vm._u([{key:"label",fn:function(){return [_vm._t("label",function(){return [_vm._v("\n "+_vm._s(_vm.$attrs.label)+"\n "),(_vm.optional)?_c('span',{staticClass:"optional-label",attrs:{"data-testid":"optional-label"}},[_vm._v(_vm._s(_vm.optionalText))]):_vm._e()]}),_vm._v(" "),(_vm.hasLabelDescription)?_c('div',{staticClass:"label-description",attrs:{"data-testid":"label-description"}},[_vm._t("label-description",function(){return [_vm._v(_vm._s(_vm.labelDescription))]})],2):_vm._e()]},proxy:true},_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-form-group',_vm.$attrs,false))};
66
- var __vue_staticRenderFns__ = [];
67
-
68
- /* style */
69
- const __vue_inject_styles__ = undefined;
70
- /* scoped */
71
- const __vue_scope_id__ = undefined;
72
- /* module identifier */
73
- const __vue_module_identifier__ = undefined;
74
- /* functional template */
75
- const __vue_is_functional_template__ = false;
76
- /* style inject */
77
-
78
- /* style inject SSR */
79
-
80
- /* style inject shadow dom */
81
-
82
-
83
-
84
- const __vue_component__ = __vue_normalize__(
85
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
86
- __vue_inject_styles__,
87
- __vue_script__,
88
- __vue_scope_id__,
89
- __vue_is_functional_template__,
90
- __vue_module_identifier__,
91
- false,
92
- undefined,
93
- undefined,
94
- undefined
95
- );
96
-
97
- export default __vue_component__;
@@ -1,121 +0,0 @@
1
- import isObject from 'lodash/isObject';
2
- import { BFormInput } from 'bootstrap-vue/esm/index.js';
3
- import { formInputWidths } from '../../../../utils/constants';
4
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
-
6
- const MODEL_PROP = 'value';
7
- const MODEL_EVENT = 'input';
8
- var script = {
9
- name: 'GlFormInput',
10
- components: {
11
- BFormInput
12
- },
13
- inheritAttrs: false,
14
- model: {
15
- prop: MODEL_PROP,
16
- event: MODEL_EVENT
17
- },
18
- props: {
19
- /**
20
- * Maximum width of the input
21
- */
22
- width: {
23
- type: [String, Object],
24
- required: false,
25
- default: null,
26
- validator: value => {
27
- const widths = isObject(value) ? Object.values(value) : [value];
28
- return widths.every(width => Object.values(formInputWidths).includes(width));
29
- }
30
- }
31
- },
32
- computed: {
33
- cssClasses() {
34
- if (this.width === null) {
35
- return [];
36
- }
37
- if (isObject(this.width)) {
38
- const {
39
- default: defaultWidth,
40
- ...nonDefaultWidths
41
- } = this.width;
42
- return [...(defaultWidth ? [`gl-form-input-${defaultWidth}`] : []), ...Object.entries(nonDefaultWidths).map(_ref => {
43
- let [breakpoint, width] = _ref;
44
- return `gl-${breakpoint}-form-input-${width}`;
45
- })];
46
- }
47
- return [`gl-form-input-${this.width}`];
48
- },
49
- listeners() {
50
- var _this = this;
51
- return {
52
- ...this.$listeners,
53
- // Swap purpose of input and update events from underlying BFormInput.
54
- // See https://gitlab.com/gitlab-org/gitlab-ui/-/issues/631.
55
- input: function () {
56
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57
- args[_key] = arguments[_key];
58
- }
59
- /**
60
- * Emitted to update the v-model
61
- *
62
- * @event update
63
- * @property {string} value new value
64
- */
65
- _this.$emit('update', ...args);
66
- },
67
- update: function () {
68
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
69
- args[_key2] = arguments[_key2];
70
- }
71
- /**
72
- * Triggered by user interaction. Emitted after any formatting (not including 'trim' or 'number' props).
73
- * Useful for getting the currently entered value when the 'debounce' or 'lazy' props are set.
74
- *
75
- * @event input
76
- * @property {string} value new value
77
- */
78
- _this.$emit(MODEL_EVENT, ...args);
79
- }
80
- };
81
- }
82
- }
83
- };
84
-
85
- /* script */
86
- const __vue_script__ = script;
87
-
88
- /* template */
89
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-input',_vm._g(_vm._b({staticClass:"gl-form-input",class:_vm.cssClasses,attrs:{"no-wheel":""}},'b-form-input',_vm.$attrs,false),_vm.listeners))};
90
- var __vue_staticRenderFns__ = [];
91
-
92
- /* style */
93
- const __vue_inject_styles__ = undefined;
94
- /* scoped */
95
- const __vue_scope_id__ = undefined;
96
- /* module identifier */
97
- const __vue_module_identifier__ = undefined;
98
- /* functional template */
99
- const __vue_is_functional_template__ = false;
100
- /* style inject */
101
-
102
- /* style inject SSR */
103
-
104
- /* style inject shadow dom */
105
-
106
-
107
-
108
- const __vue_component__ = __vue_normalize__(
109
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
110
- __vue_inject_styles__,
111
- __vue_script__,
112
- __vue_scope_id__,
113
- __vue_is_functional_template__,
114
- __vue_module_identifier__,
115
- false,
116
- undefined,
117
- undefined,
118
- undefined
119
- );
120
-
121
- export default __vue_component__;
@@ -1,108 +0,0 @@
1
- import { BInputGroup, BInputGroupPrepend, BInputGroupAppend, BFormInput } from 'bootstrap-vue/esm/index.js';
2
- import GlDropdown from '../../dropdown/dropdown';
3
- import GlDropdownItem from '../../dropdown/dropdown_item';
4
- import { InputGroupMixin } from './form_input_group_mixin';
5
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
-
7
- var script = {
8
- name: 'GlFormInputGroup',
9
- components: {
10
- BInputGroup,
11
- BInputGroupPrepend,
12
- BInputGroupAppend,
13
- BFormInput,
14
- GlDropdown,
15
- GlDropdownItem
16
- },
17
- mixins: [InputGroupMixin],
18
- props: {
19
- /**
20
- * Automatically selects the content of the input field on click.
21
- */
22
- selectOnClick: {
23
- type: Boolean,
24
- required: false,
25
- default: false
26
- },
27
- /**
28
- * Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})
29
- */
30
- predefinedOptions: {
31
- type: Array,
32
- required: false,
33
- default: () => [{
34
- value: '',
35
- name: ''
36
- }],
37
- validator: options => options.every(opt => Object.keys(opt).includes('name', 'value'))
38
- },
39
- label: {
40
- type: String,
41
- required: false,
42
- default: undefined
43
- },
44
- inputClass: {
45
- type: [String, Array, Object],
46
- required: false,
47
- default: ''
48
- }
49
- },
50
- data() {
51
- return {
52
- activeOption: this.predefinedOptions && this.predefinedOptions[0].name
53
- };
54
- },
55
- methods: {
56
- handleClick() {
57
- if (this.selectOnClick) {
58
- this.$refs.input.$el.select();
59
- }
60
- },
61
- updateValue(option) {
62
- const {
63
- name,
64
- value
65
- } = option;
66
- this.activeOption = name;
67
- this.localValue = value;
68
- }
69
- }
70
- };
71
-
72
- /* script */
73
- const __vue_script__ = script;
74
-
75
- /* template */
76
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-input-group',[(_vm.activeOption || _vm.$scopedSlots.prepend)?_c('b-input-group-prepend',[_vm._t("prepend"),_vm._v(" "),(_vm.activeOption)?_c('gl-dropdown',{attrs:{"text":_vm.activeOption}},_vm._l((_vm.predefinedOptions),function(option){return _c('gl-dropdown-item',{key:option.value,attrs:{"is-check-item":"","is-checked":_vm.activeOption === option.name},on:{"click":function($event){return _vm.updateValue(option)}}},[_vm._v("\n "+_vm._s(option.name)+"\n ")])}),1):_vm._e()],2):_vm._e(),_vm._v(" "),_vm._t("default",function(){return [_c('b-form-input',_vm._g(_vm._b({ref:"input",class:['gl-form-input', _vm.inputClass],attrs:{"aria-label":_vm.label},on:{"click":_vm.handleClick},model:{value:(_vm.localValue),callback:function ($$v) {_vm.localValue=$$v;},expression:"localValue"}},'b-form-input',_vm.$attrs,false),_vm.$listeners))]}),_vm._v(" "),(_vm.$scopedSlots.append)?_c('b-input-group-append',[_vm._t("append")],2):_vm._e()],2)};
77
- var __vue_staticRenderFns__ = [];
78
-
79
- /* style */
80
- const __vue_inject_styles__ = undefined;
81
- /* scoped */
82
- const __vue_scope_id__ = undefined;
83
- /* module identifier */
84
- const __vue_module_identifier__ = undefined;
85
- /* functional template */
86
- const __vue_is_functional_template__ = false;
87
- /* style inject */
88
-
89
- /* style inject SSR */
90
-
91
- /* style inject shadow dom */
92
-
93
-
94
-
95
- const __vue_component__ = __vue_normalize__(
96
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
97
- __vue_inject_styles__,
98
- __vue_script__,
99
- __vue_scope_id__,
100
- __vue_is_functional_template__,
101
- __vue_module_identifier__,
102
- false,
103
- undefined,
104
- undefined,
105
- undefined
106
- );
107
-
108
- export default __vue_component__;
@@ -1,41 +0,0 @@
1
- const InputGroupMixin = {
2
- props: {
3
- value: {
4
- type: [String, Number],
5
- default: ''
6
- }
7
- },
8
- data() {
9
- return {
10
- localValue: this.stringifyValue(this.value)
11
- };
12
- },
13
- watch: {
14
- value(newVal) {
15
- if (newVal !== this.localValue) {
16
- this.localValue = this.stringifyValue(newVal);
17
- }
18
- },
19
- localValue(newVal) {
20
- if (newVal !== this.value) {
21
- this.$emit('input', newVal);
22
- }
23
- }
24
- },
25
- mounted() {
26
- const value = this.stringifyValue(this.value);
27
- if (this.activeOption) {
28
- const activeOption = this.predefinedOptions.find(opt => opt.name === this.activeOption);
29
- this.localValue = activeOption.value;
30
- } else if (value !== this.localValue) {
31
- this.localValue = value;
32
- }
33
- },
34
- methods: {
35
- stringifyValue(value) {
36
- return value === undefined || value === null ? '' : String(value);
37
- }
38
- }
39
- };
40
-
41
- export { InputGroupMixin };