@gitlab/ui 72.11.0 → 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 (225) hide show
  1. package/CHANGELOG.md +14 -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/directives/safe_html/safe_html.js +5 -0
  10. package/src/directives/safe_html/safe_html.spec.js +17 -0
  11. package/src/internal/color_contrast/color_contrast.md +8 -0
  12. package/src/internal/color_contrast/color_contrast.spec.js +34 -0
  13. package/src/internal/color_contrast/color_contrast.stories.js +41 -0
  14. package/src/internal/color_contrast/color_contrast.vue +52 -0
  15. package/src/tokens/color.dark.tokens.stories.js +36 -22
  16. package/src/tokens/color.data_viz.dark.tokens.stories.js +13 -30
  17. package/src/tokens/color.data_viz.tokens.stories.js +13 -30
  18. package/src/tokens/color.theme.dark.tokens.stories.js +15 -30
  19. package/src/tokens/color.theme.tokens.stories.js +15 -30
  20. package/src/tokens/color.tokens.stories.js +36 -22
  21. package/src/tokens/color.transparency.tokens.stories.js +9 -12
  22. package/src/tokens/common_story_options.js +22 -80
  23. package/src/utils/constants.js +25 -0
  24. package/src/utils/utils.js +21 -1
  25. package/dist/charts.js +0 -14
  26. package/dist/components/base/accordion/accordion.js +0 -73
  27. package/dist/components/base/accordion/accordion_item.js +0 -133
  28. package/dist/components/base/alert/alert.js +0 -222
  29. package/dist/components/base/avatar/avatar.js +0 -160
  30. package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -107
  31. package/dist/components/base/avatar_link/avatar_link.js +0 -47
  32. package/dist/components/base/avatars_inline/avatars_inline.js +0 -119
  33. package/dist/components/base/badge/badge.js +0 -105
  34. package/dist/components/base/banner/banner.js +0 -139
  35. package/dist/components/base/breadcrumb/breadcrumb.js +0 -122
  36. package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -73
  37. package/dist/components/base/broadcast_message/broadcast_message.js +0 -112
  38. package/dist/components/base/broadcast_message/constants.js +0 -5
  39. package/dist/components/base/button/button.js +0 -151
  40. package/dist/components/base/button_group/button_group.js +0 -47
  41. package/dist/components/base/card/card.js +0 -71
  42. package/dist/components/base/carousel/carousel.js +0 -48
  43. package/dist/components/base/carousel/carousel_slide.js +0 -47
  44. package/dist/components/base/collapse/collapse.js +0 -59
  45. package/dist/components/base/datepicker/datepicker.js +0 -386
  46. package/dist/components/base/daterange_picker/daterange_picker.js +0 -288
  47. package/dist/components/base/drawer/drawer.js +0 -127
  48. package/dist/components/base/dropdown/dropdown.js +0 -261
  49. package/dist/components/base/dropdown/dropdown_divider.js +0 -48
  50. package/dist/components/base/dropdown/dropdown_form.js +0 -48
  51. package/dist/components/base/dropdown/dropdown_item.js +0 -131
  52. package/dist/components/base/dropdown/dropdown_section_header.js +0 -48
  53. package/dist/components/base/dropdown/dropdown_text.js +0 -48
  54. package/dist/components/base/filtered_search/common_story_options.js +0 -14
  55. package/dist/components/base/filtered_search/filtered_search.js +0 -388
  56. package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -89
  57. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -138
  58. package/dist/components/base/filtered_search/filtered_search_term.js +0 -203
  59. package/dist/components/base/filtered_search/filtered_search_token.js +0 -384
  60. package/dist/components/base/filtered_search/filtered_search_token_segment.js +0 -420
  61. package/dist/components/base/filtered_search/filtered_search_utils.js +0 -242
  62. package/dist/components/base/form/form.js +0 -49
  63. package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -78
  64. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +0 -60
  65. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
  66. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
  67. package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
  68. package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
  69. package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -199
  70. package/dist/components/base/form/form_combobox/constants.js +0 -55
  71. package/dist/components/base/form/form_combobox/form_combobox.js +0 -230
  72. package/dist/components/base/form/form_date/form_date.js +0 -143
  73. package/dist/components/base/form/form_fields/form_field_validator.js +0 -93
  74. package/dist/components/base/form/form_fields/form_fields.js +0 -214
  75. package/dist/components/base/form/form_fields/mappers.js +0 -13
  76. package/dist/components/base/form/form_fields/validators.js +0 -48
  77. package/dist/components/base/form/form_group/form_group.js +0 -97
  78. package/dist/components/base/form/form_input/form_input.js +0 -121
  79. package/dist/components/base/form/form_input_group/form_input_group.js +0 -108
  80. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -41
  81. package/dist/components/base/form/form_radio/form_radio.js +0 -65
  82. package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -78
  83. package/dist/components/base/form/form_select/constants.js +0 -12
  84. package/dist/components/base/form/form_select/form_select.js +0 -82
  85. package/dist/components/base/form/form_text/form_text.js +0 -38
  86. package/dist/components/base/form/form_textarea/form_textarea.js +0 -112
  87. package/dist/components/base/form/input_group_text/input_group_text.js +0 -48
  88. package/dist/components/base/icon/icon.js +0 -111
  89. package/dist/components/base/infinite_scroll/infinite_scroll.js +0 -197
  90. package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -151
  91. package/dist/components/base/label/label.js +0 -163
  92. package/dist/components/base/link/link.js +0 -50
  93. package/dist/components/base/loading_icon/loading_icon.js +0 -111
  94. package/dist/components/base/markdown/markdown.js +0 -52
  95. package/dist/components/base/modal/modal.js +0 -204
  96. package/dist/components/base/nav/nav.js +0 -48
  97. package/dist/components/base/nav/nav_item.js +0 -48
  98. package/dist/components/base/nav/nav_item_dropdown.js +0 -62
  99. package/dist/components/base/navbar/navbar.js +0 -48
  100. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -453
  101. package/dist/components/base/new_dropdowns/base_dropdown/constants.js +0 -4
  102. package/dist/components/base/new_dropdowns/constants.js +0 -21
  103. package/dist/components/base/new_dropdowns/disclosure/constants.js +0 -8
  104. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +0 -370
  105. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +0 -110
  106. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +0 -143
  107. package/dist/components/base/new_dropdowns/disclosure/mock_data.js +0 -147
  108. package/dist/components/base/new_dropdowns/disclosure/utils.js +0 -39
  109. package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -767
  110. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -58
  111. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -91
  112. package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +0 -93
  113. package/dist/components/base/new_dropdowns/listbox/mock_data.js +0 -118
  114. package/dist/components/base/new_dropdowns/listbox/utils.js +0 -34
  115. package/dist/components/base/paginated_list/paginated_list.js +0 -180
  116. package/dist/components/base/pagination/pagination.js +0 -399
  117. package/dist/components/base/path/data.js +0 -34
  118. package/dist/components/base/path/path.js +0 -189
  119. package/dist/components/base/popover/popover.js +0 -110
  120. package/dist/components/base/progress_bar/progress_bar.js +0 -48
  121. package/dist/components/base/search_box_by_click/search_box_by_click.js +0 -235
  122. package/dist/components/base/search_box_by_type/search_box_by_type.js +0 -167
  123. package/dist/components/base/segmented_control/segmented_control.js +0 -109
  124. package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -224
  125. package/dist/components/base/sorting/sorting.js +0 -171
  126. package/dist/components/base/sorting/sorting_item.js +0 -109
  127. package/dist/components/base/table/constants.js +0 -5
  128. package/dist/components/base/table/table.js +0 -89
  129. package/dist/components/base/table_lite/table_lite.js +0 -72
  130. package/dist/components/base/tabs/constants.js +0 -3
  131. package/dist/components/base/tabs/tab/tab.js +0 -83
  132. package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -143
  133. package/dist/components/base/tabs/tabs/tabs.js +0 -224
  134. package/dist/components/base/toast/toast.js +0 -82
  135. package/dist/components/base/toggle/toggle.js +0 -180
  136. package/dist/components/base/token/token.js +0 -85
  137. package/dist/components/base/token_selector/helpers.js +0 -5
  138. package/dist/components/base/token_selector/token_container.js +0 -165
  139. package/dist/components/base/token_selector/token_selector.js +0 -403
  140. package/dist/components/base/token_selector/token_selector_dropdown.js +0 -199
  141. package/dist/components/base/tooltip/tooltip.js +0 -55
  142. package/dist/components/charts/area/area.js +0 -311
  143. package/dist/components/charts/bar/bar.js +0 -253
  144. package/dist/components/charts/chart/chart.js +0 -215
  145. package/dist/components/charts/column/column.js +0 -226
  146. package/dist/components/charts/discrete_scatter/discrete_scatter.js +0 -203
  147. package/dist/components/charts/gauge/gauge.js +0 -208
  148. package/dist/components/charts/heatmap/heatmap.js +0 -295
  149. package/dist/components/charts/heatmap/index.js +0 -2
  150. package/dist/components/charts/legend/legend.js +0 -228
  151. package/dist/components/charts/line/line.js +0 -308
  152. package/dist/components/charts/series_label/series_label.js +0 -100
  153. package/dist/components/charts/single_stat/single_stat.js +0 -152
  154. package/dist/components/charts/sparkline/sparkline.js +0 -261
  155. package/dist/components/charts/stacked_column/stacked_column.js +0 -335
  156. package/dist/components/charts/tooltip/tooltip.js +0 -251
  157. package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -83
  158. package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -100
  159. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -35
  160. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -115
  161. package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -104
  162. package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -64
  163. package/dist/components/experimental/duo/chat/constants.js +0 -23
  164. package/dist/components/experimental/duo/chat/duo_chat.js +0 -359
  165. package/dist/components/experimental/duo/chat/mock_data.js +0 -83
  166. package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -94
  167. package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -124
  168. package/dist/components/experimental/experiment_badge/constants.js +0 -4
  169. package/dist/components/experimental/experiment_badge/experiment_badge.js +0 -107
  170. package/dist/components/mixins/button_mixin.js +0 -11
  171. package/dist/components/mixins/safe_link_mixin.js +0 -30
  172. package/dist/components/mixins/tooltip_mixin.js +0 -21
  173. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +0 -53
  174. package/dist/components/regions/empty_state/empty_state.js +0 -154
  175. package/dist/components/shared_components/charts/tooltip_default_format.js +0 -53
  176. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +0 -64
  177. package/dist/components/shared_components/close_button/close_button.js +0 -54
  178. package/dist/components/utilities/animated_number/animated_number.js +0 -131
  179. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -75
  180. package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -88
  181. package/dist/components/utilities/intersperse/intersperse.js +0 -86
  182. package/dist/components/utilities/sprintf/sprintf.js +0 -172
  183. package/dist/components/utilities/truncate/constants.js +0 -7
  184. package/dist/components/utilities/truncate/truncate.js +0 -111
  185. package/dist/components/utilities/truncate_text/constants.js +0 -7
  186. package/dist/components/utilities/truncate_text/truncate_text.js +0 -146
  187. package/dist/config.js +0 -86
  188. package/dist/directives/collapse_toggle.js +0 -1
  189. package/dist/directives/hover_load/hover_load.js +0 -45
  190. package/dist/directives/modal.js +0 -1
  191. package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
  192. package/dist/directives/outside/outside.js +0 -106
  193. package/dist/directives/resize_observer/resize_observer.js +0 -51
  194. package/dist/directives/safe_html/constants.js +0 -6
  195. package/dist/directives/safe_html/safe_html.js +0 -35
  196. package/dist/directives/safe_link/mock_data.js +0 -10
  197. package/dist/directives/safe_link/safe_link.js +0 -65
  198. package/dist/directives/tooltip.js +0 -1
  199. package/dist/index.css +0 -7
  200. package/dist/index.css.map +0 -1
  201. package/dist/index.js +0 -105
  202. package/dist/tokens/common_story_options.js +0 -109
  203. package/dist/utils/breakpoints.js +0 -20
  204. package/dist/utils/charts/config.js +0 -556
  205. package/dist/utils/charts/constants.js +0 -63
  206. package/dist/utils/charts/mock_data.js +0 -211
  207. package/dist/utils/charts/story_config.js +0 -42
  208. package/dist/utils/charts/theme.js +0 -192
  209. package/dist/utils/charts/utils.js +0 -54
  210. package/dist/utils/constants.js +0 -270
  211. package/dist/utils/data_utils.js +0 -21
  212. package/dist/utils/datetime_utility.js +0 -61
  213. package/dist/utils/i18n.js +0 -15
  214. package/dist/utils/is_slot_empty.js +0 -38
  215. package/dist/utils/number_utils.js +0 -124
  216. package/dist/utils/stories_constants.js +0 -29
  217. package/dist/utils/stories_utils.js +0 -13
  218. package/dist/utils/story_decorators/container.js +0 -16
  219. package/dist/utils/string_utils.js +0 -69
  220. package/dist/utils/svgs/svg_paths.js +0 -7
  221. package/dist/utils/test_utils.js +0 -33
  222. package/dist/utils/use_fake_date.js +0 -29
  223. package/dist/utils/use_mock_intersection_observer.js +0 -108
  224. package/dist/utils/utils.js +0 -177
  225. package/dist/utils.js +0 -5
@@ -1,270 +0,0 @@
1
- import { POSITION } from '../components/utilities/truncate/constants';
2
-
3
- function appendDefaultOption(options) {
4
- return {
5
- ...options,
6
- default: ''
7
- };
8
- }
9
- const COMMA = ',';
10
- const LEFT_MOUSE_BUTTON = 0;
11
- const glThemes = ['indigo', 'blue', 'light-blue', 'green', 'red', 'light-red'];
12
- const variantOptions = {
13
- primary: 'primary',
14
- secondary: 'secondary',
15
- success: 'success',
16
- warning: 'warning',
17
- danger: 'danger',
18
- info: 'info',
19
- light: 'light',
20
- dark: 'dark'
21
- };
22
- const badgeSizeOptions = {
23
- sm: 'sm',
24
- md: 'md',
25
- lg: 'lg'
26
- };
27
- const badgeVariantOptions = {
28
- muted: 'muted',
29
- neutral: 'neutral',
30
- info: 'info',
31
- success: 'success',
32
- warning: 'warning',
33
- danger: 'danger',
34
- tier: 'tier'
35
- };
36
- const badgeIconSizeOptions = {
37
- sm: 12,
38
- md: 16
39
- };
40
- const variantCssColorMap = {
41
- muted: 'gl-text-gray-500',
42
- neutral: 'gl-text-blue-100',
43
- info: 'gl-text-blue-500',
44
- success: 'gl-text-green-500',
45
- warning: 'gl-text-orange-500',
46
- danger: 'gl-text-red-500'
47
- };
48
- const targetOptions = ['_self', '_blank', '_parent', '_top', null];
49
- const labelSizeOptions = {
50
- default: null,
51
- sm: 'sm'
52
- };
53
- const viewModeOptions = {
54
- dark: 'dark',
55
- light: 'light'
56
- };
57
- const labelColorOptions = {
58
- ...viewModeOptions
59
- };
60
- const avatarSizeOptions = [96, 64, 48, 32, 24, 16];
61
- const avatarsInlineSizeOptions = [32, 24, 16];
62
- const avatarShapeOptions = {
63
- circle: 'circle',
64
- rect: 'rect'
65
- };
66
- const formStateOptions = {
67
- default: null,
68
- valid: true,
69
- invalid: false
70
- };
71
- const buttonCategoryOptions = {
72
- primary: 'primary',
73
- secondary: 'secondary',
74
- tertiary: 'tertiary'
75
- };
76
- const buttonVariantOptions = {
77
- default: 'default',
78
- confirm: 'confirm',
79
- info: 'info (deprecated)',
80
- success: 'success (deprecated)',
81
- danger: 'danger',
82
- dashed: 'dashed',
83
- link: 'link',
84
- /**
85
- * The "reset" variant can be used when customization of GlButton styles is required
86
- * (e.g. for the "close" button in GlLabel).
87
- * It should be used sparingly and only when other approaches fail.
88
- * Prefer supported variants where ever possible.
89
- */
90
- reset: 'gl-reset'
91
- };
92
- const badgeForButtonOptions = {
93
- [buttonVariantOptions.default]: badgeVariantOptions.neutral,
94
- [buttonVariantOptions.confirm]: badgeVariantOptions.info,
95
- [buttonVariantOptions.danger]: badgeVariantOptions.danger
96
- };
97
- const dropdownVariantOptions = {
98
- default: 'default',
99
- confirm: 'confirm',
100
- info: 'info (deprecated)',
101
- success: 'success (deprecated)',
102
- danger: 'danger',
103
- link: 'link'
104
- };
105
- const dropdownPlacements = {
106
- left: 'bottom-start',
107
- center: 'bottom',
108
- right: 'bottom-end'
109
- };
110
- const dropdownAnyCornerPlacement = [dropdownPlacements.left, 'top-start', dropdownPlacements.right, 'top-end'];
111
- const dropdownAllowedAutoPlacements = {
112
- left: dropdownAnyCornerPlacement,
113
- center: [dropdownPlacements.center, 'top'],
114
- right: dropdownAnyCornerPlacement
115
- };
116
- const buttonSizeOptions = {
117
- small: 'sm',
118
- medium: 'md'
119
- };
120
- const datepickerWidthOptionsMap = {
121
- sm: 'sm',
122
- md: 'md',
123
- lg: 'lg',
124
- xl: 'xl'
125
- };
126
-
127
- // size options all have corresponding styles (e.g. .s12 defined in icon.scss)
128
- const iconSizeOptions = [8, 12, 14, 16, 24, 32, 48, 72];
129
- const triggerVariantOptions = {
130
- click: 'click',
131
- hover: 'hover',
132
- focus: 'focus'
133
- };
134
- const tooltipPlacements = {
135
- top: 'top',
136
- left: 'left',
137
- right: 'right',
138
- bottom: 'bottom'
139
- };
140
-
141
- // in milliseconds
142
- const tooltipDelay = {
143
- show: 500,
144
- hide: 0
145
- };
146
- const popoverPlacements = {
147
- top: 'top',
148
- right: 'right',
149
- bottom: 'bottom',
150
- left: 'left'
151
- };
152
- const columnOptions = {
153
- stacked: 'stacked',
154
- tiled: 'tiled'
155
- };
156
- const alignOptions = {
157
- left: 'left',
158
- center: 'center',
159
- right: 'right',
160
- fill: 'fill'
161
- };
162
- const alertVariantOptions = {
163
- success: 'success',
164
- warning: 'warning',
165
- danger: 'danger',
166
- info: 'info',
167
- tip: 'tip'
168
- };
169
- const alertVariantIconMap = {
170
- success: 'check-circle',
171
- warning: 'warning',
172
- danger: 'error',
173
- info: 'information-o',
174
- tip: 'bulb'
175
- };
176
- const colorThemes = {
177
- indigo: 'theme-indigo-900',
178
- 'light-indigo': 'theme-indigo-700',
179
- blue: 'theme-blue-900',
180
- 'light-blue': 'theme-blue-700',
181
- green: 'theme-green-900',
182
- 'light-green': 'theme-green-700',
183
- red: 'theme-red-900',
184
- 'light-red': 'theme-red-700',
185
- dark: 'gray-900',
186
- light: 'gray-700'
187
- };
188
- const modalButtonDefaults = {
189
- actionPrimary: {
190
- variant: 'confirm',
191
- category: 'primary'
192
- },
193
- actionSecondary: {
194
- variant: 'confirm',
195
- category: 'secondary'
196
- },
197
- actionCancel: {
198
- variant: 'default'
199
- }
200
- };
201
- const tabsButtonDefaults = {
202
- actionPrimary: {
203
- variant: 'success',
204
- category: 'primary'
205
- },
206
- actionSecondary: {
207
- variant: 'default',
208
- category: 'secondary'
209
- },
210
- actionTertiary: {
211
- variant: 'default'
212
- }
213
- };
214
- const tokenVariants = ['default', 'search-type', 'search-value'];
215
- const resizeDebounceTime = 200;
216
- const variantOptionsWithNoDefault = appendDefaultOption(variantOptions);
217
-
218
- // Datetime constants
219
- const defaultDateFormat = 'YYYY-MM-DD';
220
- const bannerVariants = ['promotion', 'introduction'];
221
- const maxZIndex = 10;
222
- const modalSizeOptions = {
223
- sm: 'sm',
224
- md: 'md',
225
- lg: 'lg'
226
- };
227
- const focusableTags = ['INPUT', 'TEXTAREA', 'A', 'BUTTON', 'SELECT'];
228
- const keyboard = {
229
- escape: 'Escape',
230
- backspace: 'Backspace',
231
- delete: 'Delete',
232
- left: 'Left',
233
- arrowLeft: 'ArrowLeft',
234
- right: 'Right',
235
- arrowRight: 'ArrowRight',
236
- home: 'Home',
237
- end: 'End',
238
- tab: 'Tab'
239
- };
240
- const truncateOptions = POSITION;
241
- const formInputWidths = {
242
- xs: 'xs',
243
- sm: 'sm',
244
- md: 'md',
245
- lg: 'lg',
246
- xl: 'xl',
247
- '(unset or null)': null
248
- };
249
- const toggleLabelPosition = {
250
- hidden: 'hidden',
251
- left: 'left',
252
- top: 'top'
253
- };
254
- const tooltipActionEvents = ['open', 'close', 'enable', 'disable'];
255
- const drawerVariants = {
256
- default: 'default',
257
- sidebar: 'sidebar'
258
- };
259
- const loadingIconSizes = {
260
- 'sm (16x16)': 'sm',
261
- 'md (24x24)': 'md',
262
- 'lg (32x32)': 'lg',
263
- 'xl (64x64)': 'xl'
264
- };
265
- const loadingIconVariants = {
266
- spinner: 'spinner',
267
- dots: 'dots'
268
- };
269
-
270
- export { COMMA, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerWidthOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputWidths, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, loadingIconVariants, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
@@ -1,21 +0,0 @@
1
- import curry from 'lodash/fp/curry';
2
-
3
- const getRepeatingValue = index => {
4
- const values = [100, 500, 400, 200, 100, 800, 400, 500, 600, 300, 800, 900, 110, 700, 400, 300, 500, 300, 400, 600, 700];
5
- return index < values.length ? values[index] : values[index % values.length];
6
- };
7
- const generateTimeSeries = () => new Array(100).fill(0).map((el, i) => [new Date(2018, 0, i), getRepeatingValue(i)]);
8
-
9
- // takes an element and a list and `intersperses' that element between the elements of the list.
10
- // (',' ['a', 'b', 'c']) -> ['a', ',', 'b', ',', 'c']
11
- const intersperse = curry((separator, items) => {
12
- const [head, ...rest] = items;
13
- const separatorFactory = typeof separator === 'function' ? separator : () => separator;
14
- return [head, ...rest.flatMap(item => [separatorFactory(), item], rest)];
15
- });
16
-
17
- // inserts a value at a given index into an array
18
- // (1, 2, [1, 3, 4]) -> [1, 2, 3, 4]
19
- const insert = curry((index, newItem, items) => [...items.slice(0, index), newItem, ...items.slice(index)]);
20
-
21
- export { generateTimeSeries, insert, intersperse };
@@ -1,61 +0,0 @@
1
- // These utility methods come from the Gitlab repo; app/assets/javascripts/lib/utils/datetime_utility.js
2
-
3
- /**
4
- * This method allows you to create new Date instance from existing
5
- * date instance without keeping the reference.
6
- *
7
- * @param {Date} date
8
- */
9
- const newDate = date => date instanceof Date ? new Date(date.getTime()) : new Date();
10
-
11
- /**
12
- * Computes the difference between 2 date objects.
13
- *
14
- * @param {Date} a the start date
15
- * @param {Date} b the end date
16
- * @example
17
- * // returns 5
18
- * getDayDifference(new Date('2020-08-10'), new Date('2020-08-15'));
19
- * @returns {Number} Number of days between the 2 dates
20
- */
21
- const getDayDifference = (a, b) => {
22
- const millisecondsPerDay = 1000 * 60 * 60 * 24;
23
- const date1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
24
- const date2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
25
- return Math.floor((date2 - date1) / millisecondsPerDay);
26
- };
27
-
28
- /**
29
- * Subtracts a given number of days from a given date and returns the new date.
30
- *
31
- * @param {Date} date the date that we will substract days from
32
- * @param {Number} daysInPast number of days that are subtracted from a given date
33
- * @example
34
- * // returns Mon Aug 10 2020 00:00:00
35
- * getDateInPast(new Date('2020-08-15'), 5);
36
- * @returns {Date} Date in past as Date object
37
- */
38
- const getDateInPast = (date, daysInPast) => new Date(newDate(date).setDate(date.getDate() - daysInPast));
39
-
40
- /**
41
- * Adds a given number of days to a given date and returns the new date.
42
- *
43
- * @param {Date} date the date that we will add days to
44
- * @param {Number} daysInFuture number of days that are added to a given date
45
- * @example
46
- * // returns Mon Aug 15 2020 00:00:00
47
- * getDateInFuture(new Date('2020-08-10'), 5);
48
- * @returns {Date} Date in future as Date object
49
- */
50
- const getDateInFuture = (date, daysInFuture) => new Date(newDate(date).setDate(date.getDate() + daysInFuture));
51
-
52
- /**
53
- * Are the given two dates equal
54
- *
55
- * @param {Date} date1
56
- * @param {Date} date2
57
- * @returns {Boolean}
58
- */
59
- const areDatesEqual = (date1, date2) => Boolean(date1 && date2 && new Date(date1).getTime() === new Date(date2).getTime());
60
-
61
- export { areDatesEqual, getDateInFuture, getDateInPast, getDayDifference, newDate };
@@ -1,15 +0,0 @@
1
- import { i18n } from '../config';
2
-
3
- /**
4
- * Mark a label as translatable.
5
- *
6
- * @param {string} key Translation key to be leveraged by the consumer to provide a generic translation at configuration time.
7
- * @param {string} defaultValue A fallback value to be relied on if the consumer doesn't have translation capabilities.
8
- * @returns {string} The translated label.
9
- */
10
- const translate = (key, defaultValue) => {
11
- var _i18n$key;
12
- return (_i18n$key = i18n[key]) !== null && _i18n$key !== void 0 ? _i18n$key : defaultValue;
13
- };
14
-
15
- export { translate };
@@ -1,38 +0,0 @@
1
- import Vue from 'vue';
2
-
3
- // Fragment will be available only in Vue.js 3
4
- const {
5
- Fragment,
6
- Comment
7
- } = Vue;
8
- function callIfNeeded(fnOrResult, args) {
9
- return fnOrResult instanceof Function ? fnOrResult(args) : fnOrResult;
10
- }
11
- function isEmpty(vnode) {
12
- if (!vnode || Comment && vnode.type === Comment) {
13
- return true;
14
- }
15
- if (Array.isArray(vnode)) {
16
- // eslint-disable-next-line unicorn/no-array-callback-reference
17
- return vnode.every(isEmpty);
18
- }
19
- if (Fragment && vnode.type === Fragment) {
20
- // Vue.js 3 fragment, check children
21
- // eslint-disable-next-line unicorn/no-array-callback-reference
22
- return vnode.children.every(isEmpty);
23
- }
24
- return false;
25
- }
26
- function isSlotEmpty(vueInstance, slot, slotArgs) {
27
- var _vueInstance$$scopedS, _vueInstance$$scopedS2;
28
- const isVue3 = Boolean(Fragment);
29
- const slotContent = isVue3 ?
30
- // we need to check both $slots and $scopedSlots due to https://github.com/vuejs/core/issues/8869
31
- // additionally, in @vue/compat $slot might be a function instead of array of vnodes (sigh)
32
- callIfNeeded(vueInstance.$slots[slot] || vueInstance.$scopedSlots[slot], slotArgs) : (_vueInstance$$scopedS = (_vueInstance$$scopedS2 = vueInstance.$scopedSlots)[slot]) === null || _vueInstance$$scopedS === void 0 ? void 0 : _vueInstance$$scopedS.call(_vueInstance$$scopedS2, slotArgs);
33
-
34
- // eslint-disable-next-line unicorn/no-array-callback-reference
35
- return isEmpty(slotContent);
36
- }
37
-
38
- export { isSlotEmpty };
@@ -1,124 +0,0 @@
1
- /**
2
- * Adds two numbers together
3
- * @param {Number} a
4
- * @param {Number} b
5
- */
6
- const addition = (a, b) => a + b;
7
-
8
- /**
9
- * Returns the sum of all arguments
10
- * @param {...Number} numbers
11
- */
12
- const sum = function () {
13
- for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
14
- numbers[_key] = arguments[_key];
15
- }
16
- return numbers.reduce(addition);
17
- }; // eslint-disable-line unicorn/no-array-callback-reference
18
-
19
- /**
20
- * Returns the average of all arguments
21
- * @param {...Number} numbers
22
- */
23
- const average = function () {
24
- return sum(...arguments) / arguments.length;
25
- };
26
-
27
- /**
28
- * Returns the modulo of n for a divisor.
29
- *
30
- * Maps the integer n into the range [0, divisor) when the divisor is positive,
31
- * and (divisor, 0] when the divisor is negative.
32
- *
33
- * This is useful when indexing into an array, to ensure you always stay within
34
- * the array bounds.
35
- *
36
- * See https://2ality.com/2019/08/remainder-vs-modulo.html.
37
- *
38
- * @param {number} n The number to mod.
39
- * @param {number} divisor The divisor (e.g., the length of an array).
40
- * @returns {number}
41
- */
42
- function modulo(n, divisor) {
43
- const result = (n % divisor + divisor) % divisor;
44
- // Never return -0.
45
- return result === 0 ? 0 : result;
46
- }
47
-
48
- /**
49
- * Convert number to engineering format, using SI suffix
50
- * @param {Number|String} value - Number or Number-convertible String
51
- * @param {Number} precision
52
- * @return {String} number, possibly with a suffix
53
- */
54
- const engineeringNotation = function (value) {
55
- let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
56
- const invalidValues = [NaN, Infinity, -Infinity];
57
- const num = Number(value);
58
- if (invalidValues.includes(num) || invalidValues.includes(Number(precision))) {
59
- return num.toString();
60
- }
61
- const allYourBase = {
62
- '-24': 'y',
63
- '-21': 'z',
64
- '-18': 'a',
65
- '-15': 'f',
66
- '-12': 'p',
67
- '-9': 'n',
68
- '-6': 'μ',
69
- '-3': 'm',
70
- 0: '',
71
- 3: 'k',
72
- 6: 'M',
73
- 9: 'G',
74
- 12: 'T',
75
- 15: 'P',
76
- 18: 'E',
77
- 21: 'Z',
78
- 24: 'Y'
79
- };
80
- const exponentialNotation = num.toExponential(precision);
81
- const power = exponentialNotation.split('e').map(Number)[1] || 0;
82
- if (power < -24 || power > 24) {
83
- return exponentialNotation;
84
- }
85
- const scaledPower = 3 * Math.floor(power / 3);
86
- const scaledMantissa = (exponentialNotation / 10 ** scaledPower
87
- // strip trailing decimals from floating point rounding errors
88
- ).toFixed(precision)
89
- // strip trailing 0s after a decimal point
90
- .replace(/\.([1-9]*)0+$/, (_, fractionalDigits) => {
91
- if (fractionalDigits) {
92
- return `.${fractionalDigits}`;
93
- }
94
- return '';
95
- });
96
- return `${scaledMantissa}${allYourBase[scaledPower]}`;
97
- };
98
-
99
- /**
100
- * Formats a number as a locale-based string using `Intl.NumberFormat`.
101
- *
102
- * 2333 -> 2,333
103
- * 232324 -> 232,324
104
- *
105
- * @param {Number|string} value - number to be converted
106
- * @param {{}?} options - options to be passed to
107
- * `Intl.NumberFormat` such as `unit` and `style`.
108
- * @param {String|String[]} locales - If set, forces a different
109
- * language code from the one currently in the document.
110
- *
111
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
112
- *
113
- * @returns {String}
114
- */
115
- const formatNumberToLocale = function (value) {
116
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
117
- let locales = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
118
- if (Number.isNaN(Number(value))) {
119
- return value;
120
- }
121
- return new Intl.NumberFormat(locales, options).format(value);
122
- };
123
-
124
- export { addition, average, engineeringNotation, formatNumberToLocale, modulo, sum };
@@ -1,29 +0,0 @@
1
- /**
2
- * Arg types subcategories to be used to organize props within arg tables
3
- */
4
-
5
- const ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL = 'Look & feel';
6
- const ARG_TYPE_SUBCATEGORY_STATE = 'State';
7
- const ARG_TYPE_SUBCATEGORY_SEARCH = 'Search';
8
- const ARG_TYPE_SUBCATEGORY_ACCESSIBILITY = 'Accessibility';
9
- const ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL = 'Infinite scroll';
10
-
11
- /**
12
- * These are used to test varying lengths of series names
13
- */
14
- const SERIES_NAME_SHORT = 'SERIES_NAME_SHORT';
15
- const SERIES_NAME_LONG = 'SERIES_NAME_LONG';
16
- const SERIES_NAME_LONG_WITHOUT_SPACES = 'SERIES_NAME_LONG_WITHOUT_SPACES';
17
- const SERIES_NAME = {
18
- [SERIES_NAME_SHORT]: 'Series ',
19
- [SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
20
- [SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
21
- };
22
-
23
- /**
24
- * Reused constants for ListBox
25
- */
26
-
27
- const LISTBOX_CONTAINER_HEIGHT = '370px';
28
-
29
- export { ARG_TYPE_SUBCATEGORY_ACCESSIBILITY, ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL, ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL, ARG_TYPE_SUBCATEGORY_SEARCH, ARG_TYPE_SUBCATEGORY_STATE, LISTBOX_CONTAINER_HEIGHT, SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT };
@@ -1,13 +0,0 @@
1
- /**
2
- * Builds the parameters object disable one or multiple controls.
3
- */
4
- const disableControls = function () {
5
- let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6
- return Object.fromEntries(controls.map(control => [control, {
7
- control: {
8
- disable: true
9
- }
10
- }]));
11
- };
12
-
13
- export { disableControls };
@@ -1,16 +0,0 @@
1
- /**
2
- * Return a story decorator function, which wraps the given story in a `div`
3
- * element with the given `style` attributes.
4
- *
5
- * @param {object} style The style attribute to apply to the container.
6
- * @return {function} The story decorator.
7
- */
8
- const makeContainer = style => Story => ({
9
- render(h) {
10
- return h('div', {
11
- style
12
- }, [h(Story())]);
13
- }
14
- });
15
-
16
- export { makeContainer };
@@ -1,69 +0,0 @@
1
- import emojiRegexFactory from 'emoji-regex';
2
-
3
- /**
4
- * Split the given string after each occurrence of each of the given symbols.
5
- *
6
- * Symbols are strings, and can be of length one or more. Zero-length symbols
7
- * are ignored.
8
- *
9
- * Unlike with `String::split`, the symbol is left in results, with
10
- * the split occurring _after_ the symbol.
11
- *
12
- * For example:
13
- *
14
- * splitAfterSymbols(['/'], 'a/b/c') // ['a/', 'b/', 'c']
15
- * splitAfterSymbols(['foo'], 'foobar') // ['foo', 'bar']
16
- *
17
- * @param {string[]} symbols The symbols to split the string by.
18
- * @param {string} string The string to split.
19
- * @returns {string[]} The resulting strings.
20
- */
21
- const splitAfterSymbols = (symbols, string) => {
22
- const textParts = [];
23
- let textPartStartIndex = 0;
24
- if (string.length === 0) {
25
- return [string];
26
- }
27
- for (let i = 0; i < string.length;) {
28
- let symbolFound = false;
29
- for (let j = 0; j < symbols.length; j += 1) {
30
- const symbol = symbols[j];
31
- if (!symbol) {
32
- // eslint-disable-next-line no-continue
33
- continue;
34
- }
35
- symbolFound = string.slice(i, i + symbol.length) === symbol;
36
- if (symbolFound) {
37
- const textPartEndIndex = i + symbol.length;
38
- const textPart = string.slice(textPartStartIndex, textPartEndIndex);
39
- textParts.push(textPart);
40
- textPartStartIndex = textPartEndIndex;
41
- i = textPartStartIndex;
42
- break;
43
- }
44
- }
45
- if (!symbolFound) {
46
- i += 1;
47
- }
48
- }
49
- const final = string.slice(textPartStartIndex);
50
- if (final) {
51
- textParts.push(final);
52
- }
53
- return textParts;
54
- };
55
- const startsWithEmojiRegex = `^(${emojiRegexFactory().source})`;
56
- const getAvatarChar = name => {
57
- if (name) {
58
- // Check if string starts with an emoji (which could be multiple characters and zero-width joined)
59
- const match = name.match(startsWithEmojiRegex);
60
- if (match) {
61
- // Return the first match
62
- return match[0];
63
- }
64
- return name.charAt(0).toUpperCase();
65
- }
66
- return '';
67
- };
68
-
69
- export { getAvatarChar, splitAfterSymbols };
@@ -1,7 +0,0 @@
1
- const scrollHandleSvgPath = 'path://M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zM6 4a1 1 0 0 0-1 1v6a1 1 0 0 0 2 0V5a1 1 0 0 0-1-1zm4 0a1 1 0 0 0-1 1v6a1 1 0 0 0 2 0V5a1 1 0 0 0-1-1z';
2
- const marqueeSelectionSvgPath = 'path://M-6.251 -7L-7 -7L-7 -4.753A0.749 0.749 0 0 0 -5.502 -4.753L-5.502 -5.502L-4.753 -5.502A0.749 0.749 0 0 0 -4.753 -7L-6.251 -7ZM-6.251 -2.0067A0.749 0.749 0 0 1 -5.502 -1.2577L-5.502 1.239A0.749 0.749 0 1 1 -7 1.239L-7 -1.2577A0.749 0.749 0 0 1 -6.251 -2.0067ZM0.8455 0.8455L2.3505 4.3578L4.3578 2.3505L0.8455 0.8455ZM0.2883 -1.023L5.6251 1.264A0.9987 0.9987 0 0 1 5.9387 2.8888L4.943 3.8835L6.7616 5.703A0.749 0.749 0 1 1 5.703 6.7616L3.8835 4.943L2.8888 5.9387A0.9987 0.9987 0 0 1 1.264 5.6251L-1.023 0.2883C-1.3785 -0.5406 -0.5406 -1.3785 0.2883 -1.023ZM-6.251 6.9813L-7 6.9813L-7 4.7343A0.749 0.749 0 1 1 -5.502 4.7343L-5.502 5.4833L-4.753 5.4833A0.749 0.749 0 1 1 -4.753 6.9813L-6.251 6.9813ZM-2.0067 -6.251A0.749 0.749 0 0 1 -1.2577 -7L1.239 -7A0.749 0.749 0 1 1 1.239 -5.502L-1.2577 -5.502A0.749 0.749 0 0 1 -2.0067 -6.251ZM6.2323 -7L6.9813 -7L6.9813 -4.753A0.749 0.749 0 1 1 5.4833 -4.753L5.4833 -5.502L4.7343 -5.502A0.749 0.749 0 1 1 4.7343 -7L6.2323 -7Z';
3
- const redoSvgPath = 'path://M1.8332 -6.7552A7.0001 7.0001 0 0 0 -5.6875 -4.082L-5.6875 -5.4689A0.6563 0.6563 0 0 0 -7 -5.4689L-7 -1.7501L-3.2812 -1.7501A0.6563 0.6563 0 0 0 -3.2812 -3.0626L-4.7923 -3.0626A5.6876 5.6876 0 1 1 -5.2526 2.1822A0.6563 0.6563 0 0 0 -6.4645 2.6853A7.0001 7.0001 0 1 0 1.8332 -6.7561Z';
4
- const clearAllSvgPath = 'path://M-1.8332 -6.7552A7.0001 7.0001 0 0 1 5.6875 -4.082L5.6875 -5.4689A0.6563 0.6563 0 1 1 7 -5.4689L7 -1.7501L3.2812 -1.7501A0.6563 0.6563 0 1 1 3.2812 -3.0626L4.7923 -3.0626A5.6876 5.6876 0 1 0 5.2526 2.1822A0.6563 0.6563 0 1 1 6.4645 2.6853A7.0001 7.0001 0 1 1 -1.8332 -6.7561Z';
5
- const downloadSvgPath = 'path://M3.78 -0.841A0.75 0.75 0 0 0 2.72 -0.841L0.75 1.129L0.75 -6.25A0.75 0.75 0 0 0 -0.75 -6.25L-0.75 1.129L-2.72 -0.841A0.75 0.75 0 0 0 -3.78 0.219L-0.53 3.469L0 4L0.53 3.47L3.78 0.22A0.75 0.75 0 0 0 3.78 -0.841ZM-5.5 1.75A0.75 0.75 0 0 0 -7 1.75L-7 5A2 2 0 0 0 -5 7L5 7A2 2 0 0 0 7 5L7 1.75A0.75 0.75 0 0 0 5.5 1.75L5.5 5A0.5 0.5 0 0 1 5 5.5L-5 5.5A0.5 0.5 0 0 1 -5.5 5L-5.5 1.75Z';
6
-
7
- export { clearAllSvgPath, downloadSvgPath, marqueeSelectionSvgPath, redoSvgPath, scrollHandleSvgPath };