polaris_view_components 0.3.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/polaris_view_components/button_controller.js +48 -0
  4. data/app/assets/javascripts/polaris_view_components/index.js +11 -1
  5. data/app/assets/javascripts/polaris_view_components/modal_controller.js +25 -0
  6. data/app/assets/javascripts/polaris_view_components/polaris_controller.js +24 -0
  7. data/app/assets/javascripts/polaris_view_components/popover_controller.js +45 -0
  8. data/app/assets/javascripts/polaris_view_components/scrollable_controller.js +60 -0
  9. data/app/assets/javascripts/polaris_view_components/select_controller.js +6 -4
  10. data/app/assets/javascripts/polaris_view_components.js +1539 -5
  11. data/app/assets/stylesheets/polaris_view_components/custom.css +68 -0
  12. data/app/assets/stylesheets/polaris_view_components/shopify_navigation.css +0 -4
  13. data/app/assets/stylesheets/polaris_view_components/spacer_component.css +39 -0
  14. data/app/assets/stylesheets/polaris_view_components.css +93 -3
  15. data/app/assets/stylesheets/polaris_view_components.postcss.css +2 -0
  16. data/app/components/polaris/action.rb +3 -3
  17. data/app/components/polaris/action_list/item_component.html.erb +35 -0
  18. data/app/components/polaris/action_list/item_component.rb +41 -0
  19. data/app/components/polaris/action_list/section_component.html.erb +16 -0
  20. data/app/components/polaris/action_list/section_component.rb +26 -0
  21. data/app/components/polaris/action_list_component.html.erb +13 -0
  22. data/app/components/polaris/action_list_component.rb +25 -0
  23. data/app/components/polaris/application_component.rb +19 -19
  24. data/app/components/polaris/avatar_component.rb +1 -1
  25. data/app/components/polaris/badge_component.rb +1 -1
  26. data/app/components/polaris/banner_component.rb +6 -6
  27. data/app/components/polaris/base_button.rb +1 -1
  28. data/app/components/polaris/button_component.html.erb +13 -0
  29. data/app/components/polaris/button_group_component.rb +5 -5
  30. data/app/components/polaris/callout_card_component.rb +5 -5
  31. data/app/components/polaris/caption_component.rb +2 -2
  32. data/app/components/polaris/card/header_component.rb +1 -3
  33. data/app/components/polaris/card/section_component.rb +6 -2
  34. data/app/components/polaris/card_component.html.erb +4 -0
  35. data/app/components/polaris/card_component.rb +5 -6
  36. data/app/components/polaris/character_count.rb +10 -10
  37. data/app/components/polaris/checkbox_component.rb +4 -4
  38. data/app/components/polaris/choice_component.rb +1 -1
  39. data/app/components/polaris/choice_list_component.rb +4 -4
  40. data/app/components/polaris/data_table/cell_component.html.erb +18 -0
  41. data/app/components/polaris/data_table/cell_component.rb +49 -0
  42. data/app/components/polaris/data_table/column_component.rb +19 -0
  43. data/app/components/polaris/data_table_component.html.erb +77 -0
  44. data/app/components/polaris/data_table_component.rb +42 -0
  45. data/app/components/polaris/description_list_component.rb +3 -3
  46. data/app/components/polaris/display_text_component.rb +2 -2
  47. data/app/components/polaris/dropzone/component.rb +36 -38
  48. data/app/components/polaris/empty_state_component.html.erb +16 -11
  49. data/app/components/polaris/empty_state_component.rb +4 -3
  50. data/app/components/polaris/exception_list/item_component.rb +2 -2
  51. data/app/components/polaris/exception_list_component.rb +1 -1
  52. data/app/components/polaris/filters_component.html.erb +13 -0
  53. data/app/components/polaris/filters_component.rb +38 -0
  54. data/app/components/polaris/footer_help_component.rb +1 -1
  55. data/app/components/polaris/form_layout/group_component.rb +3 -3
  56. data/app/components/polaris/form_layout/item_component.rb +1 -1
  57. data/app/components/polaris/form_layout_component.rb +3 -3
  58. data/app/components/polaris/heading_component.rb +1 -1
  59. data/app/components/polaris/headless_button.html.erb +13 -0
  60. data/app/components/polaris/headless_button.rb +17 -5
  61. data/app/components/polaris/icon_component.rb +2 -2
  62. data/app/components/polaris/index_table/cell_component.rb +22 -0
  63. data/app/components/polaris/index_table/column_component.rb +13 -0
  64. data/app/components/polaris/index_table_component.html.erb +28 -0
  65. data/app/components/polaris/index_table_component.rb +25 -0
  66. data/app/components/polaris/inline_error_component.html.erb +2 -2
  67. data/app/components/polaris/inline_error_component.rb +7 -1
  68. data/app/components/polaris/label_component.rb +2 -2
  69. data/app/components/polaris/labelled_component.rb +2 -2
  70. data/app/components/polaris/layout/annotated_section.rb +1 -1
  71. data/app/components/polaris/layout/section.rb +2 -0
  72. data/app/components/polaris/layout_component.rb +3 -3
  73. data/app/components/polaris/link_component.rb +5 -3
  74. data/app/components/polaris/list_component.rb +3 -3
  75. data/app/components/polaris/modal/section_component.rb +19 -0
  76. data/app/components/polaris/modal_component.html.erb +79 -0
  77. data/app/components/polaris/modal_component.rb +98 -0
  78. data/app/components/polaris/page_actions_component.rb +21 -6
  79. data/app/components/polaris/page_component.rb +4 -4
  80. data/app/components/polaris/pagination_component.rb +1 -5
  81. data/app/components/polaris/popover/pane_component.html.erb +25 -0
  82. data/app/components/polaris/popover/pane_component.rb +20 -0
  83. data/app/components/polaris/popover/section_component.rb +19 -0
  84. data/app/components/polaris/popover_component.html.erb +38 -0
  85. data/app/components/polaris/popover_component.rb +90 -0
  86. data/app/components/polaris/progress_bar_component.rb +5 -5
  87. data/app/components/polaris/radio_button_component.rb +3 -3
  88. data/app/components/polaris/resource_item_component.html.erb +16 -6
  89. data/app/components/polaris/resource_item_component.rb +42 -9
  90. data/app/components/polaris/resource_list_component.html.erb +10 -0
  91. data/app/components/polaris/resource_list_component.rb +4 -10
  92. data/app/components/polaris/scrollable_component.html.erb +5 -0
  93. data/app/components/polaris/scrollable_component.rb +48 -0
  94. data/app/components/polaris/select_component.rb +10 -5
  95. data/app/components/polaris/setting_toggle_component.html.erb +10 -0
  96. data/app/components/polaris/setting_toggle_component.rb +24 -0
  97. data/app/components/polaris/shopify_navigation_component.rb +6 -6
  98. data/app/components/polaris/skeleton_body_text_component.rb +1 -1
  99. data/app/components/polaris/spacer_component.rb +50 -0
  100. data/app/components/polaris/spinner_component.rb +2 -2
  101. data/app/components/polaris/stack_component.rb +5 -5
  102. data/app/components/polaris/subheading_component.rb +1 -1
  103. data/app/components/polaris/tabs/tab_component.html.erb +10 -0
  104. data/app/components/polaris/tabs/tab_component.rb +34 -0
  105. data/app/components/polaris/tabs_component.html.erb +7 -0
  106. data/app/components/polaris/tabs_component.rb +37 -0
  107. data/app/components/polaris/tag_component.rb +2 -2
  108. data/app/components/polaris/text_container_component.rb +2 -2
  109. data/app/components/polaris/text_field_component.rb +8 -8
  110. data/app/components/polaris/text_style_component.rb +11 -2
  111. data/app/components/polaris/thumbnail_component.rb +2 -2
  112. data/app/helpers/polaris/form_builder.rb +30 -3
  113. data/app/helpers/polaris/url_helper.rb +3 -3
  114. data/app/helpers/polaris/view_helper.rb +26 -6
  115. data/app/validators/type_validator.rb +2 -2
  116. data/lib/generators/polaris_view_components/install_generator.rb +5 -5
  117. data/lib/polaris/view_components/engine.rb +6 -1
  118. data/lib/polaris/view_components/version.rb +1 -1
  119. data/lib/polaris_view_components.rb +1 -1
  120. metadata +45 -6
  121. data/app/components/polaris/choice_list/component.html.erb +0 -34
  122. data/app/components/polaris/choice_list/component.rb +0 -65
  123. data/app/helpers/polaris/action_helper.rb +0 -14
@@ -1,5 +1,1480 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
2
 
3
+ class Button extends Controller {
4
+ disable(event) {
5
+ if (this.button.dataset.disabled) {
6
+ event.preventDefault();
7
+ } else {
8
+ this.button.dataset.disabled = true;
9
+ this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading");
10
+ this.buttonContent.insertAdjacentHTML("afterbegin", this.spinnerHTML);
11
+ }
12
+ }
13
+ enable() {
14
+ if (this.button.dataset.disabled) {
15
+ this.button.disabled = false;
16
+ delete this.button.dataset.disabled;
17
+ this.button.classList.remove("Polaris-Button--disabled", "Polaris-Button--loading");
18
+ this.spinner.remove();
19
+ }
20
+ }
21
+ get button() {
22
+ return this.element;
23
+ }
24
+ get buttonContent() {
25
+ return this.button.querySelector(".Polaris-Button__Content");
26
+ }
27
+ get spinner() {
28
+ return this.button.querySelector(".Polaris-Button__Spinner");
29
+ }
30
+ get spinnerHTML() {
31
+ return `\n <span class="Polaris-Button__Spinner">\n <span class="Polaris-Spinner Polaris-Spinner--sizeSmall">\n <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.229 1.173a9.25 9.25 0 1011.655 11.412 1.25 1.25 0 10-2.4-.698 6.75 6.75 0 11-8.506-8.329 1.25 1.25 0 10-.75-2.385z"></path>\n </svg>\n </span>\n </span>\n `;
32
+ }
33
+ }
34
+
35
+ class Modal extends Controller {
36
+ static classes=[ "hidden", "backdrop" ];
37
+ static values={
38
+ open: Boolean
39
+ };
40
+ connect() {
41
+ if (this.openValue) {
42
+ this.open();
43
+ }
44
+ }
45
+ open() {
46
+ this.element.classList.remove(this.hiddenClass);
47
+ this.element.insertAdjacentHTML("afterend", `<div class="${this.backdropClass}"></div>`);
48
+ this.backdrop = this.element.nextElementSibling;
49
+ }
50
+ close() {
51
+ this.element.classList.add(this.hiddenClass);
52
+ this.backdrop.remove();
53
+ }
54
+ }
55
+
56
+ class Polaris extends Controller {
57
+ openModal() {
58
+ this.findElement("modal").open();
59
+ }
60
+ disableButton() {
61
+ this.findElement("button").disable();
62
+ }
63
+ enableButton() {
64
+ this.findElement("button").enable();
65
+ }
66
+ findElement(type) {
67
+ const targetId = this.element.dataset.target.replace("#", "");
68
+ const target = document.getElementById(targetId);
69
+ const controllerName = `polaris-${type}`;
70
+ return this.application.getControllerForElementAndIdentifier(target, controllerName);
71
+ }
72
+ }
73
+
74
+ var top = "top";
75
+
76
+ var bottom = "bottom";
77
+
78
+ var right = "right";
79
+
80
+ var left = "left";
81
+
82
+ var auto = "auto";
83
+
84
+ var basePlacements = [ top, bottom, right, left ];
85
+
86
+ var start = "start";
87
+
88
+ var end = "end";
89
+
90
+ var clippingParents = "clippingParents";
91
+
92
+ var viewport = "viewport";
93
+
94
+ var popper = "popper";
95
+
96
+ var reference = "reference";
97
+
98
+ var variationPlacements = basePlacements.reduce((function(acc, placement) {
99
+ return acc.concat([ placement + "-" + start, placement + "-" + end ]);
100
+ }), []);
101
+
102
+ var placements = [].concat(basePlacements, [ auto ]).reduce((function(acc, placement) {
103
+ return acc.concat([ placement, placement + "-" + start, placement + "-" + end ]);
104
+ }), []);
105
+
106
+ var beforeRead = "beforeRead";
107
+
108
+ var read = "read";
109
+
110
+ var afterRead = "afterRead";
111
+
112
+ var beforeMain = "beforeMain";
113
+
114
+ var main = "main";
115
+
116
+ var afterMain = "afterMain";
117
+
118
+ var beforeWrite = "beforeWrite";
119
+
120
+ var write = "write";
121
+
122
+ var afterWrite = "afterWrite";
123
+
124
+ var modifierPhases = [ beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite ];
125
+
126
+ function getNodeName(element) {
127
+ return element ? (element.nodeName || "").toLowerCase() : null;
128
+ }
129
+
130
+ function getWindow(node) {
131
+ if (node == null) {
132
+ return window;
133
+ }
134
+ if (node.toString() !== "[object Window]") {
135
+ var ownerDocument = node.ownerDocument;
136
+ return ownerDocument ? ownerDocument.defaultView || window : window;
137
+ }
138
+ return node;
139
+ }
140
+
141
+ function isElement(node) {
142
+ var OwnElement = getWindow(node).Element;
143
+ return node instanceof OwnElement || node instanceof Element;
144
+ }
145
+
146
+ function isHTMLElement(node) {
147
+ var OwnElement = getWindow(node).HTMLElement;
148
+ return node instanceof OwnElement || node instanceof HTMLElement;
149
+ }
150
+
151
+ function isShadowRoot(node) {
152
+ if (typeof ShadowRoot === "undefined") {
153
+ return false;
154
+ }
155
+ var OwnElement = getWindow(node).ShadowRoot;
156
+ return node instanceof OwnElement || node instanceof ShadowRoot;
157
+ }
158
+
159
+ function applyStyles(_ref) {
160
+ var state = _ref.state;
161
+ Object.keys(state.elements).forEach((function(name) {
162
+ var style = state.styles[name] || {};
163
+ var attributes = state.attributes[name] || {};
164
+ var element = state.elements[name];
165
+ if (!isHTMLElement(element) || !getNodeName(element)) {
166
+ return;
167
+ }
168
+ Object.assign(element.style, style);
169
+ Object.keys(attributes).forEach((function(name) {
170
+ var value = attributes[name];
171
+ if (value === false) {
172
+ element.removeAttribute(name);
173
+ } else {
174
+ element.setAttribute(name, value === true ? "" : value);
175
+ }
176
+ }));
177
+ }));
178
+ }
179
+
180
+ function effect$2(_ref2) {
181
+ var state = _ref2.state;
182
+ var initialStyles = {
183
+ popper: {
184
+ position: state.options.strategy,
185
+ left: "0",
186
+ top: "0",
187
+ margin: "0"
188
+ },
189
+ arrow: {
190
+ position: "absolute"
191
+ },
192
+ reference: {}
193
+ };
194
+ Object.assign(state.elements.popper.style, initialStyles.popper);
195
+ state.styles = initialStyles;
196
+ if (state.elements.arrow) {
197
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
198
+ }
199
+ return function() {
200
+ Object.keys(state.elements).forEach((function(name) {
201
+ var element = state.elements[name];
202
+ var attributes = state.attributes[name] || {};
203
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
204
+ var style = styleProperties.reduce((function(style, property) {
205
+ style[property] = "";
206
+ return style;
207
+ }), {});
208
+ if (!isHTMLElement(element) || !getNodeName(element)) {
209
+ return;
210
+ }
211
+ Object.assign(element.style, style);
212
+ Object.keys(attributes).forEach((function(attribute) {
213
+ element.removeAttribute(attribute);
214
+ }));
215
+ }));
216
+ };
217
+ }
218
+
219
+ var applyStyles$1 = {
220
+ name: "applyStyles",
221
+ enabled: true,
222
+ phase: "write",
223
+ fn: applyStyles,
224
+ effect: effect$2,
225
+ requires: [ "computeStyles" ]
226
+ };
227
+
228
+ function getBasePlacement(placement) {
229
+ return placement.split("-")[0];
230
+ }
231
+
232
+ function getBoundingClientRect(element, includeScale) {
233
+ var rect = element.getBoundingClientRect();
234
+ var scaleX = 1;
235
+ var scaleY = 1;
236
+ return {
237
+ width: rect.width / scaleX,
238
+ height: rect.height / scaleY,
239
+ top: rect.top / scaleY,
240
+ right: rect.right / scaleX,
241
+ bottom: rect.bottom / scaleY,
242
+ left: rect.left / scaleX,
243
+ x: rect.left / scaleX,
244
+ y: rect.top / scaleY
245
+ };
246
+ }
247
+
248
+ function getLayoutRect(element) {
249
+ var clientRect = getBoundingClientRect(element);
250
+ var width = element.offsetWidth;
251
+ var height = element.offsetHeight;
252
+ if (Math.abs(clientRect.width - width) <= 1) {
253
+ width = clientRect.width;
254
+ }
255
+ if (Math.abs(clientRect.height - height) <= 1) {
256
+ height = clientRect.height;
257
+ }
258
+ return {
259
+ x: element.offsetLeft,
260
+ y: element.offsetTop,
261
+ width: width,
262
+ height: height
263
+ };
264
+ }
265
+
266
+ function contains(parent, child) {
267
+ var rootNode = child.getRootNode && child.getRootNode();
268
+ if (parent.contains(child)) {
269
+ return true;
270
+ } else if (rootNode && isShadowRoot(rootNode)) {
271
+ var next = child;
272
+ do {
273
+ if (next && parent.isSameNode(next)) {
274
+ return true;
275
+ }
276
+ next = next.parentNode || next.host;
277
+ } while (next);
278
+ }
279
+ return false;
280
+ }
281
+
282
+ function getComputedStyle(element) {
283
+ return getWindow(element).getComputedStyle(element);
284
+ }
285
+
286
+ function isTableElement(element) {
287
+ return [ "table", "td", "th" ].indexOf(getNodeName(element)) >= 0;
288
+ }
289
+
290
+ function getDocumentElement(element) {
291
+ return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
292
+ }
293
+
294
+ function getParentNode(element) {
295
+ if (getNodeName(element) === "html") {
296
+ return element;
297
+ }
298
+ return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
299
+ }
300
+
301
+ function getTrueOffsetParent(element) {
302
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
303
+ return null;
304
+ }
305
+ return element.offsetParent;
306
+ }
307
+
308
+ function getContainingBlock(element) {
309
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
310
+ var isIE = navigator.userAgent.indexOf("Trident") !== -1;
311
+ if (isIE && isHTMLElement(element)) {
312
+ var elementCss = getComputedStyle(element);
313
+ if (elementCss.position === "fixed") {
314
+ return null;
315
+ }
316
+ }
317
+ var currentNode = getParentNode(element);
318
+ while (isHTMLElement(currentNode) && [ "html", "body" ].indexOf(getNodeName(currentNode)) < 0) {
319
+ var css = getComputedStyle(currentNode);
320
+ if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || [ "transform", "perspective" ].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
321
+ return currentNode;
322
+ } else {
323
+ currentNode = currentNode.parentNode;
324
+ }
325
+ }
326
+ return null;
327
+ }
328
+
329
+ function getOffsetParent(element) {
330
+ var window = getWindow(element);
331
+ var offsetParent = getTrueOffsetParent(element);
332
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
333
+ offsetParent = getTrueOffsetParent(offsetParent);
334
+ }
335
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
336
+ return window;
337
+ }
338
+ return offsetParent || getContainingBlock(element) || window;
339
+ }
340
+
341
+ function getMainAxisFromPlacement(placement) {
342
+ return [ "top", "bottom" ].indexOf(placement) >= 0 ? "x" : "y";
343
+ }
344
+
345
+ var max = Math.max;
346
+
347
+ var min = Math.min;
348
+
349
+ var round = Math.round;
350
+
351
+ function within(min$1, value, max$1) {
352
+ return max(min$1, min(value, max$1));
353
+ }
354
+
355
+ function getFreshSideObject() {
356
+ return {
357
+ top: 0,
358
+ right: 0,
359
+ bottom: 0,
360
+ left: 0
361
+ };
362
+ }
363
+
364
+ function mergePaddingObject(paddingObject) {
365
+ return Object.assign({}, getFreshSideObject(), paddingObject);
366
+ }
367
+
368
+ function expandToHashMap(value, keys) {
369
+ return keys.reduce((function(hashMap, key) {
370
+ hashMap[key] = value;
371
+ return hashMap;
372
+ }), {});
373
+ }
374
+
375
+ var toPaddingObject = function toPaddingObject(padding, state) {
376
+ padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
377
+ placement: state.placement
378
+ })) : padding;
379
+ return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
380
+ };
381
+
382
+ function arrow(_ref) {
383
+ var _state$modifiersData$;
384
+ var state = _ref.state, name = _ref.name, options = _ref.options;
385
+ var arrowElement = state.elements.arrow;
386
+ var popperOffsets = state.modifiersData.popperOffsets;
387
+ var basePlacement = getBasePlacement(state.placement);
388
+ var axis = getMainAxisFromPlacement(basePlacement);
389
+ var isVertical = [ left, right ].indexOf(basePlacement) >= 0;
390
+ var len = isVertical ? "height" : "width";
391
+ if (!arrowElement || !popperOffsets) {
392
+ return;
393
+ }
394
+ var paddingObject = toPaddingObject(options.padding, state);
395
+ var arrowRect = getLayoutRect(arrowElement);
396
+ var minProp = axis === "y" ? top : left;
397
+ var maxProp = axis === "y" ? bottom : right;
398
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
399
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
400
+ var arrowOffsetParent = getOffsetParent(arrowElement);
401
+ var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
402
+ var centerToReference = endDiff / 2 - startDiff / 2;
403
+ var min = paddingObject[minProp];
404
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
405
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
406
+ var offset = within(min, center, max);
407
+ var axisProp = axis;
408
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset,
409
+ _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
410
+ }
411
+
412
+ function effect$1(_ref2) {
413
+ var state = _ref2.state, options = _ref2.options;
414
+ var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
415
+ if (arrowElement == null) {
416
+ return;
417
+ }
418
+ if (typeof arrowElement === "string") {
419
+ arrowElement = state.elements.popper.querySelector(arrowElement);
420
+ if (!arrowElement) {
421
+ return;
422
+ }
423
+ }
424
+ if (!contains(state.elements.popper, arrowElement)) {
425
+ return;
426
+ }
427
+ state.elements.arrow = arrowElement;
428
+ }
429
+
430
+ var arrow$1 = {
431
+ name: "arrow",
432
+ enabled: true,
433
+ phase: "main",
434
+ fn: arrow,
435
+ effect: effect$1,
436
+ requires: [ "popperOffsets" ],
437
+ requiresIfExists: [ "preventOverflow" ]
438
+ };
439
+
440
+ function getVariation(placement) {
441
+ return placement.split("-")[1];
442
+ }
443
+
444
+ var unsetSides = {
445
+ top: "auto",
446
+ right: "auto",
447
+ bottom: "auto",
448
+ left: "auto"
449
+ };
450
+
451
+ function roundOffsetsByDPR(_ref) {
452
+ var x = _ref.x, y = _ref.y;
453
+ var win = window;
454
+ var dpr = win.devicePixelRatio || 1;
455
+ return {
456
+ x: round(round(x * dpr) / dpr) || 0,
457
+ y: round(round(y * dpr) / dpr) || 0
458
+ };
459
+ }
460
+
461
+ function mapToStyles(_ref2) {
462
+ var _Object$assign2;
463
+ var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets;
464
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === "function" ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y = _ref3$y === void 0 ? 0 : _ref3$y;
465
+ var hasX = offsets.hasOwnProperty("x");
466
+ var hasY = offsets.hasOwnProperty("y");
467
+ var sideX = left;
468
+ var sideY = top;
469
+ var win = window;
470
+ if (adaptive) {
471
+ var offsetParent = getOffsetParent(popper);
472
+ var heightProp = "clientHeight";
473
+ var widthProp = "clientWidth";
474
+ if (offsetParent === getWindow(popper)) {
475
+ offsetParent = getDocumentElement(popper);
476
+ if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
477
+ heightProp = "scrollHeight";
478
+ widthProp = "scrollWidth";
479
+ }
480
+ }
481
+ offsetParent = offsetParent;
482
+ if (placement === top || (placement === left || placement === right) && variation === end) {
483
+ sideY = bottom;
484
+ y -= offsetParent[heightProp] - popperRect.height;
485
+ y *= gpuAcceleration ? 1 : -1;
486
+ }
487
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
488
+ sideX = right;
489
+ x -= offsetParent[widthProp] - popperRect.width;
490
+ x *= gpuAcceleration ? 1 : -1;
491
+ }
492
+ }
493
+ var commonStyles = Object.assign({
494
+ position: position
495
+ }, adaptive && unsetSides);
496
+ if (gpuAcceleration) {
497
+ var _Object$assign;
498
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "",
499
+ _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)",
500
+ _Object$assign));
501
+ }
502
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "",
503
+ _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
504
+ }
505
+
506
+ function computeStyles(_ref4) {
507
+ var state = _ref4.state, options = _ref4.options;
508
+ var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
509
+ var commonStyles = {
510
+ placement: getBasePlacement(state.placement),
511
+ variation: getVariation(state.placement),
512
+ popper: state.elements.popper,
513
+ popperRect: state.rects.popper,
514
+ gpuAcceleration: gpuAcceleration
515
+ };
516
+ if (state.modifiersData.popperOffsets != null) {
517
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
518
+ offsets: state.modifiersData.popperOffsets,
519
+ position: state.options.strategy,
520
+ adaptive: adaptive,
521
+ roundOffsets: roundOffsets
522
+ })));
523
+ }
524
+ if (state.modifiersData.arrow != null) {
525
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
526
+ offsets: state.modifiersData.arrow,
527
+ position: "absolute",
528
+ adaptive: false,
529
+ roundOffsets: roundOffsets
530
+ })));
531
+ }
532
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
533
+ "data-popper-placement": state.placement
534
+ });
535
+ }
536
+
537
+ var computeStyles$1 = {
538
+ name: "computeStyles",
539
+ enabled: true,
540
+ phase: "beforeWrite",
541
+ fn: computeStyles,
542
+ data: {}
543
+ };
544
+
545
+ var passive = {
546
+ passive: true
547
+ };
548
+
549
+ function effect(_ref) {
550
+ var state = _ref.state, instance = _ref.instance, options = _ref.options;
551
+ var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
552
+ var window = getWindow(state.elements.popper);
553
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
554
+ if (scroll) {
555
+ scrollParents.forEach((function(scrollParent) {
556
+ scrollParent.addEventListener("scroll", instance.update, passive);
557
+ }));
558
+ }
559
+ if (resize) {
560
+ window.addEventListener("resize", instance.update, passive);
561
+ }
562
+ return function() {
563
+ if (scroll) {
564
+ scrollParents.forEach((function(scrollParent) {
565
+ scrollParent.removeEventListener("scroll", instance.update, passive);
566
+ }));
567
+ }
568
+ if (resize) {
569
+ window.removeEventListener("resize", instance.update, passive);
570
+ }
571
+ };
572
+ }
573
+
574
+ var eventListeners = {
575
+ name: "eventListeners",
576
+ enabled: true,
577
+ phase: "write",
578
+ fn: function fn() {},
579
+ effect: effect,
580
+ data: {}
581
+ };
582
+
583
+ var hash$1 = {
584
+ left: "right",
585
+ right: "left",
586
+ bottom: "top",
587
+ top: "bottom"
588
+ };
589
+
590
+ function getOppositePlacement(placement) {
591
+ return placement.replace(/left|right|bottom|top/g, (function(matched) {
592
+ return hash$1[matched];
593
+ }));
594
+ }
595
+
596
+ var hash = {
597
+ start: "end",
598
+ end: "start"
599
+ };
600
+
601
+ function getOppositeVariationPlacement(placement) {
602
+ return placement.replace(/start|end/g, (function(matched) {
603
+ return hash[matched];
604
+ }));
605
+ }
606
+
607
+ function getWindowScroll(node) {
608
+ var win = getWindow(node);
609
+ var scrollLeft = win.pageXOffset;
610
+ var scrollTop = win.pageYOffset;
611
+ return {
612
+ scrollLeft: scrollLeft,
613
+ scrollTop: scrollTop
614
+ };
615
+ }
616
+
617
+ function getWindowScrollBarX(element) {
618
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
619
+ }
620
+
621
+ function getViewportRect(element) {
622
+ var win = getWindow(element);
623
+ var html = getDocumentElement(element);
624
+ var visualViewport = win.visualViewport;
625
+ var width = html.clientWidth;
626
+ var height = html.clientHeight;
627
+ var x = 0;
628
+ var y = 0;
629
+ if (visualViewport) {
630
+ width = visualViewport.width;
631
+ height = visualViewport.height;
632
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
633
+ x = visualViewport.offsetLeft;
634
+ y = visualViewport.offsetTop;
635
+ }
636
+ }
637
+ return {
638
+ width: width,
639
+ height: height,
640
+ x: x + getWindowScrollBarX(element),
641
+ y: y
642
+ };
643
+ }
644
+
645
+ function getDocumentRect(element) {
646
+ var _element$ownerDocumen;
647
+ var html = getDocumentElement(element);
648
+ var winScroll = getWindowScroll(element);
649
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
650
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
651
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
652
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
653
+ var y = -winScroll.scrollTop;
654
+ if (getComputedStyle(body || html).direction === "rtl") {
655
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
656
+ }
657
+ return {
658
+ width: width,
659
+ height: height,
660
+ x: x,
661
+ y: y
662
+ };
663
+ }
664
+
665
+ function isScrollParent(element) {
666
+ var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
667
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
668
+ }
669
+
670
+ function getScrollParent(node) {
671
+ if ([ "html", "body", "#document" ].indexOf(getNodeName(node)) >= 0) {
672
+ return node.ownerDocument.body;
673
+ }
674
+ if (isHTMLElement(node) && isScrollParent(node)) {
675
+ return node;
676
+ }
677
+ return getScrollParent(getParentNode(node));
678
+ }
679
+
680
+ function listScrollParents(element, list) {
681
+ var _element$ownerDocumen;
682
+ if (list === void 0) {
683
+ list = [];
684
+ }
685
+ var scrollParent = getScrollParent(element);
686
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
687
+ var win = getWindow(scrollParent);
688
+ var target = isBody ? [ win ].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
689
+ var updatedList = list.concat(target);
690
+ return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
691
+ }
692
+
693
+ function rectToClientRect(rect) {
694
+ return Object.assign({}, rect, {
695
+ left: rect.x,
696
+ top: rect.y,
697
+ right: rect.x + rect.width,
698
+ bottom: rect.y + rect.height
699
+ });
700
+ }
701
+
702
+ function getInnerBoundingClientRect(element) {
703
+ var rect = getBoundingClientRect(element);
704
+ rect.top = rect.top + element.clientTop;
705
+ rect.left = rect.left + element.clientLeft;
706
+ rect.bottom = rect.top + element.clientHeight;
707
+ rect.right = rect.left + element.clientWidth;
708
+ rect.width = element.clientWidth;
709
+ rect.height = element.clientHeight;
710
+ rect.x = rect.left;
711
+ rect.y = rect.top;
712
+ return rect;
713
+ }
714
+
715
+ function getClientRectFromMixedType(element, clippingParent) {
716
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
717
+ }
718
+
719
+ function getClippingParents(element) {
720
+ var clippingParents = listScrollParents(getParentNode(element));
721
+ var canEscapeClipping = [ "absolute", "fixed" ].indexOf(getComputedStyle(element).position) >= 0;
722
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
723
+ if (!isElement(clipperElement)) {
724
+ return [];
725
+ }
726
+ return clippingParents.filter((function(clippingParent) {
727
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
728
+ }));
729
+ }
730
+
731
+ function getClippingRect(element, boundary, rootBoundary) {
732
+ var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
733
+ var clippingParents = [].concat(mainClippingParents, [ rootBoundary ]);
734
+ var firstClippingParent = clippingParents[0];
735
+ var clippingRect = clippingParents.reduce((function(accRect, clippingParent) {
736
+ var rect = getClientRectFromMixedType(element, clippingParent);
737
+ accRect.top = max(rect.top, accRect.top);
738
+ accRect.right = min(rect.right, accRect.right);
739
+ accRect.bottom = min(rect.bottom, accRect.bottom);
740
+ accRect.left = max(rect.left, accRect.left);
741
+ return accRect;
742
+ }), getClientRectFromMixedType(element, firstClippingParent));
743
+ clippingRect.width = clippingRect.right - clippingRect.left;
744
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
745
+ clippingRect.x = clippingRect.left;
746
+ clippingRect.y = clippingRect.top;
747
+ return clippingRect;
748
+ }
749
+
750
+ function computeOffsets(_ref) {
751
+ var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
752
+ var basePlacement = placement ? getBasePlacement(placement) : null;
753
+ var variation = placement ? getVariation(placement) : null;
754
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
755
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
756
+ var offsets;
757
+ switch (basePlacement) {
758
+ case top:
759
+ offsets = {
760
+ x: commonX,
761
+ y: reference.y - element.height
762
+ };
763
+ break;
764
+
765
+ case bottom:
766
+ offsets = {
767
+ x: commonX,
768
+ y: reference.y + reference.height
769
+ };
770
+ break;
771
+
772
+ case right:
773
+ offsets = {
774
+ x: reference.x + reference.width,
775
+ y: commonY
776
+ };
777
+ break;
778
+
779
+ case left:
780
+ offsets = {
781
+ x: reference.x - element.width,
782
+ y: commonY
783
+ };
784
+ break;
785
+
786
+ default:
787
+ offsets = {
788
+ x: reference.x,
789
+ y: reference.y
790
+ };
791
+ }
792
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
793
+ if (mainAxis != null) {
794
+ var len = mainAxis === "y" ? "height" : "width";
795
+ switch (variation) {
796
+ case start:
797
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
798
+ break;
799
+
800
+ case end:
801
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
802
+ break;
803
+ }
804
+ }
805
+ return offsets;
806
+ }
807
+
808
+ function detectOverflow(state, options) {
809
+ if (options === void 0) {
810
+ options = {};
811
+ }
812
+ var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
813
+ var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
814
+ var altContext = elementContext === popper ? reference : popper;
815
+ var popperRect = state.rects.popper;
816
+ var element = state.elements[altBoundary ? altContext : elementContext];
817
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
818
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
819
+ var popperOffsets = computeOffsets({
820
+ reference: referenceClientRect,
821
+ element: popperRect,
822
+ strategy: "absolute",
823
+ placement: placement
824
+ });
825
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
826
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
827
+ var overflowOffsets = {
828
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
829
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
830
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
831
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
832
+ };
833
+ var offsetData = state.modifiersData.offset;
834
+ if (elementContext === popper && offsetData) {
835
+ var offset = offsetData[placement];
836
+ Object.keys(overflowOffsets).forEach((function(key) {
837
+ var multiply = [ right, bottom ].indexOf(key) >= 0 ? 1 : -1;
838
+ var axis = [ top, bottom ].indexOf(key) >= 0 ? "y" : "x";
839
+ overflowOffsets[key] += offset[axis] * multiply;
840
+ }));
841
+ }
842
+ return overflowOffsets;
843
+ }
844
+
845
+ function computeAutoPlacement(state, options) {
846
+ if (options === void 0) {
847
+ options = {};
848
+ }
849
+ var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
850
+ var variation = getVariation(placement);
851
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter((function(placement) {
852
+ return getVariation(placement) === variation;
853
+ })) : basePlacements;
854
+ var allowedPlacements = placements$1.filter((function(placement) {
855
+ return allowedAutoPlacements.indexOf(placement) >= 0;
856
+ }));
857
+ if (allowedPlacements.length === 0) {
858
+ allowedPlacements = placements$1;
859
+ }
860
+ var overflows = allowedPlacements.reduce((function(acc, placement) {
861
+ acc[placement] = detectOverflow(state, {
862
+ placement: placement,
863
+ boundary: boundary,
864
+ rootBoundary: rootBoundary,
865
+ padding: padding
866
+ })[getBasePlacement(placement)];
867
+ return acc;
868
+ }), {});
869
+ return Object.keys(overflows).sort((function(a, b) {
870
+ return overflows[a] - overflows[b];
871
+ }));
872
+ }
873
+
874
+ function getExpandedFallbackPlacements(placement) {
875
+ if (getBasePlacement(placement) === auto) {
876
+ return [];
877
+ }
878
+ var oppositePlacement = getOppositePlacement(placement);
879
+ return [ getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement) ];
880
+ }
881
+
882
+ function flip(_ref) {
883
+ var state = _ref.state, options = _ref.options, name = _ref.name;
884
+ if (state.modifiersData[name]._skip) {
885
+ return;
886
+ }
887
+ var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
888
+ var preferredPlacement = state.options.placement;
889
+ var basePlacement = getBasePlacement(preferredPlacement);
890
+ var isBasePlacement = basePlacement === preferredPlacement;
891
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [ getOppositePlacement(preferredPlacement) ] : getExpandedFallbackPlacements(preferredPlacement));
892
+ var placements = [ preferredPlacement ].concat(fallbackPlacements).reduce((function(acc, placement) {
893
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
894
+ placement: placement,
895
+ boundary: boundary,
896
+ rootBoundary: rootBoundary,
897
+ padding: padding,
898
+ flipVariations: flipVariations,
899
+ allowedAutoPlacements: allowedAutoPlacements
900
+ }) : placement);
901
+ }), []);
902
+ var referenceRect = state.rects.reference;
903
+ var popperRect = state.rects.popper;
904
+ var checksMap = new Map;
905
+ var makeFallbackChecks = true;
906
+ var firstFittingPlacement = placements[0];
907
+ for (var i = 0; i < placements.length; i++) {
908
+ var placement = placements[i];
909
+ var _basePlacement = getBasePlacement(placement);
910
+ var isStartVariation = getVariation(placement) === start;
911
+ var isVertical = [ top, bottom ].indexOf(_basePlacement) >= 0;
912
+ var len = isVertical ? "width" : "height";
913
+ var overflow = detectOverflow(state, {
914
+ placement: placement,
915
+ boundary: boundary,
916
+ rootBoundary: rootBoundary,
917
+ altBoundary: altBoundary,
918
+ padding: padding
919
+ });
920
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
921
+ if (referenceRect[len] > popperRect[len]) {
922
+ mainVariationSide = getOppositePlacement(mainVariationSide);
923
+ }
924
+ var altVariationSide = getOppositePlacement(mainVariationSide);
925
+ var checks = [];
926
+ if (checkMainAxis) {
927
+ checks.push(overflow[_basePlacement] <= 0);
928
+ }
929
+ if (checkAltAxis) {
930
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
931
+ }
932
+ if (checks.every((function(check) {
933
+ return check;
934
+ }))) {
935
+ firstFittingPlacement = placement;
936
+ makeFallbackChecks = false;
937
+ break;
938
+ }
939
+ checksMap.set(placement, checks);
940
+ }
941
+ if (makeFallbackChecks) {
942
+ var numberOfChecks = flipVariations ? 3 : 1;
943
+ var _loop = function _loop(_i) {
944
+ var fittingPlacement = placements.find((function(placement) {
945
+ var checks = checksMap.get(placement);
946
+ if (checks) {
947
+ return checks.slice(0, _i).every((function(check) {
948
+ return check;
949
+ }));
950
+ }
951
+ }));
952
+ if (fittingPlacement) {
953
+ firstFittingPlacement = fittingPlacement;
954
+ return "break";
955
+ }
956
+ };
957
+ for (var _i = numberOfChecks; _i > 0; _i--) {
958
+ var _ret = _loop(_i);
959
+ if (_ret === "break") break;
960
+ }
961
+ }
962
+ if (state.placement !== firstFittingPlacement) {
963
+ state.modifiersData[name]._skip = true;
964
+ state.placement = firstFittingPlacement;
965
+ state.reset = true;
966
+ }
967
+ }
968
+
969
+ var flip$1 = {
970
+ name: "flip",
971
+ enabled: true,
972
+ phase: "main",
973
+ fn: flip,
974
+ requiresIfExists: [ "offset" ],
975
+ data: {
976
+ _skip: false
977
+ }
978
+ };
979
+
980
+ function getSideOffsets(overflow, rect, preventedOffsets) {
981
+ if (preventedOffsets === void 0) {
982
+ preventedOffsets = {
983
+ x: 0,
984
+ y: 0
985
+ };
986
+ }
987
+ return {
988
+ top: overflow.top - rect.height - preventedOffsets.y,
989
+ right: overflow.right - rect.width + preventedOffsets.x,
990
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
991
+ left: overflow.left - rect.width - preventedOffsets.x
992
+ };
993
+ }
994
+
995
+ function isAnySideFullyClipped(overflow) {
996
+ return [ top, right, bottom, left ].some((function(side) {
997
+ return overflow[side] >= 0;
998
+ }));
999
+ }
1000
+
1001
+ function hide(_ref) {
1002
+ var state = _ref.state, name = _ref.name;
1003
+ var referenceRect = state.rects.reference;
1004
+ var popperRect = state.rects.popper;
1005
+ var preventedOffsets = state.modifiersData.preventOverflow;
1006
+ var referenceOverflow = detectOverflow(state, {
1007
+ elementContext: "reference"
1008
+ });
1009
+ var popperAltOverflow = detectOverflow(state, {
1010
+ altBoundary: true
1011
+ });
1012
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1013
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1014
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1015
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1016
+ state.modifiersData[name] = {
1017
+ referenceClippingOffsets: referenceClippingOffsets,
1018
+ popperEscapeOffsets: popperEscapeOffsets,
1019
+ isReferenceHidden: isReferenceHidden,
1020
+ hasPopperEscaped: hasPopperEscaped
1021
+ };
1022
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1023
+ "data-popper-reference-hidden": isReferenceHidden,
1024
+ "data-popper-escaped": hasPopperEscaped
1025
+ });
1026
+ }
1027
+
1028
+ var hide$1 = {
1029
+ name: "hide",
1030
+ enabled: true,
1031
+ phase: "main",
1032
+ requiresIfExists: [ "preventOverflow" ],
1033
+ fn: hide
1034
+ };
1035
+
1036
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1037
+ var basePlacement = getBasePlacement(placement);
1038
+ var invertDistance = [ left, top ].indexOf(basePlacement) >= 0 ? -1 : 1;
1039
+ var _ref = typeof offset === "function" ? offset(Object.assign({}, rects, {
1040
+ placement: placement
1041
+ })) : offset, skidding = _ref[0], distance = _ref[1];
1042
+ skidding = skidding || 0;
1043
+ distance = (distance || 0) * invertDistance;
1044
+ return [ left, right ].indexOf(basePlacement) >= 0 ? {
1045
+ x: distance,
1046
+ y: skidding
1047
+ } : {
1048
+ x: skidding,
1049
+ y: distance
1050
+ };
1051
+ }
1052
+
1053
+ function offset(_ref2) {
1054
+ var state = _ref2.state, options = _ref2.options, name = _ref2.name;
1055
+ var _options$offset = options.offset, offset = _options$offset === void 0 ? [ 0, 0 ] : _options$offset;
1056
+ var data = placements.reduce((function(acc, placement) {
1057
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1058
+ return acc;
1059
+ }), {});
1060
+ var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
1061
+ if (state.modifiersData.popperOffsets != null) {
1062
+ state.modifiersData.popperOffsets.x += x;
1063
+ state.modifiersData.popperOffsets.y += y;
1064
+ }
1065
+ state.modifiersData[name] = data;
1066
+ }
1067
+
1068
+ var offset$1 = {
1069
+ name: "offset",
1070
+ enabled: true,
1071
+ phase: "main",
1072
+ requires: [ "popperOffsets" ],
1073
+ fn: offset
1074
+ };
1075
+
1076
+ function popperOffsets(_ref) {
1077
+ var state = _ref.state, name = _ref.name;
1078
+ state.modifiersData[name] = computeOffsets({
1079
+ reference: state.rects.reference,
1080
+ element: state.rects.popper,
1081
+ strategy: "absolute",
1082
+ placement: state.placement
1083
+ });
1084
+ }
1085
+
1086
+ var popperOffsets$1 = {
1087
+ name: "popperOffsets",
1088
+ enabled: true,
1089
+ phase: "read",
1090
+ fn: popperOffsets,
1091
+ data: {}
1092
+ };
1093
+
1094
+ function getAltAxis(axis) {
1095
+ return axis === "x" ? "y" : "x";
1096
+ }
1097
+
1098
+ function preventOverflow(_ref) {
1099
+ var state = _ref.state, options = _ref.options, name = _ref.name;
1100
+ var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1101
+ var overflow = detectOverflow(state, {
1102
+ boundary: boundary,
1103
+ rootBoundary: rootBoundary,
1104
+ padding: padding,
1105
+ altBoundary: altBoundary
1106
+ });
1107
+ var basePlacement = getBasePlacement(state.placement);
1108
+ var variation = getVariation(state.placement);
1109
+ var isBasePlacement = !variation;
1110
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1111
+ var altAxis = getAltAxis(mainAxis);
1112
+ var popperOffsets = state.modifiersData.popperOffsets;
1113
+ var referenceRect = state.rects.reference;
1114
+ var popperRect = state.rects.popper;
1115
+ var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
1116
+ placement: state.placement
1117
+ })) : tetherOffset;
1118
+ var data = {
1119
+ x: 0,
1120
+ y: 0
1121
+ };
1122
+ if (!popperOffsets) {
1123
+ return;
1124
+ }
1125
+ if (checkMainAxis || checkAltAxis) {
1126
+ var mainSide = mainAxis === "y" ? top : left;
1127
+ var altSide = mainAxis === "y" ? bottom : right;
1128
+ var len = mainAxis === "y" ? "height" : "width";
1129
+ var offset = popperOffsets[mainAxis];
1130
+ var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
1131
+ var max$1 = popperOffsets[mainAxis] - overflow[altSide];
1132
+ var additive = tether ? -popperRect[len] / 2 : 0;
1133
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1134
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
1135
+ var arrowElement = state.elements.arrow;
1136
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1137
+ width: 0,
1138
+ height: 0
1139
+ };
1140
+ var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
1141
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1142
+ var arrowPaddingMax = arrowPaddingObject[altSide];
1143
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1144
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1145
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1146
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1147
+ var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1148
+ var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1149
+ var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1150
+ var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1151
+ if (checkMainAxis) {
1152
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1153
+ popperOffsets[mainAxis] = preventedOffset;
1154
+ data[mainAxis] = preventedOffset - offset;
1155
+ }
1156
+ if (checkAltAxis) {
1157
+ var _mainSide = mainAxis === "x" ? top : left;
1158
+ var _altSide = mainAxis === "x" ? bottom : right;
1159
+ var _offset = popperOffsets[altAxis];
1160
+ var _min = _offset + overflow[_mainSide];
1161
+ var _max = _offset - overflow[_altSide];
1162
+ var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
1163
+ popperOffsets[altAxis] = _preventedOffset;
1164
+ data[altAxis] = _preventedOffset - _offset;
1165
+ }
1166
+ }
1167
+ state.modifiersData[name] = data;
1168
+ }
1169
+
1170
+ var preventOverflow$1 = {
1171
+ name: "preventOverflow",
1172
+ enabled: true,
1173
+ phase: "main",
1174
+ fn: preventOverflow,
1175
+ requiresIfExists: [ "offset" ]
1176
+ };
1177
+
1178
+ function getHTMLElementScroll(element) {
1179
+ return {
1180
+ scrollLeft: element.scrollLeft,
1181
+ scrollTop: element.scrollTop
1182
+ };
1183
+ }
1184
+
1185
+ function getNodeScroll(node) {
1186
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1187
+ return getWindowScroll(node);
1188
+ } else {
1189
+ return getHTMLElementScroll(node);
1190
+ }
1191
+ }
1192
+
1193
+ function isElementScaled(element) {
1194
+ var rect = element.getBoundingClientRect();
1195
+ var scaleX = rect.width / element.offsetWidth || 1;
1196
+ var scaleY = rect.height / element.offsetHeight || 1;
1197
+ return scaleX !== 1 || scaleY !== 1;
1198
+ }
1199
+
1200
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1201
+ if (isFixed === void 0) {
1202
+ isFixed = false;
1203
+ }
1204
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1205
+ isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1206
+ var documentElement = getDocumentElement(offsetParent);
1207
+ var rect = getBoundingClientRect(elementOrVirtualElement);
1208
+ var scroll = {
1209
+ scrollLeft: 0,
1210
+ scrollTop: 0
1211
+ };
1212
+ var offsets = {
1213
+ x: 0,
1214
+ y: 0
1215
+ };
1216
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1217
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
1218
+ scroll = getNodeScroll(offsetParent);
1219
+ }
1220
+ if (isHTMLElement(offsetParent)) {
1221
+ offsets = getBoundingClientRect(offsetParent);
1222
+ offsets.x += offsetParent.clientLeft;
1223
+ offsets.y += offsetParent.clientTop;
1224
+ } else if (documentElement) {
1225
+ offsets.x = getWindowScrollBarX(documentElement);
1226
+ }
1227
+ }
1228
+ return {
1229
+ x: rect.left + scroll.scrollLeft - offsets.x,
1230
+ y: rect.top + scroll.scrollTop - offsets.y,
1231
+ width: rect.width,
1232
+ height: rect.height
1233
+ };
1234
+ }
1235
+
1236
+ function order(modifiers) {
1237
+ var map = new Map;
1238
+ var visited = new Set;
1239
+ var result = [];
1240
+ modifiers.forEach((function(modifier) {
1241
+ map.set(modifier.name, modifier);
1242
+ }));
1243
+ function sort(modifier) {
1244
+ visited.add(modifier.name);
1245
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1246
+ requires.forEach((function(dep) {
1247
+ if (!visited.has(dep)) {
1248
+ var depModifier = map.get(dep);
1249
+ if (depModifier) {
1250
+ sort(depModifier);
1251
+ }
1252
+ }
1253
+ }));
1254
+ result.push(modifier);
1255
+ }
1256
+ modifiers.forEach((function(modifier) {
1257
+ if (!visited.has(modifier.name)) {
1258
+ sort(modifier);
1259
+ }
1260
+ }));
1261
+ return result;
1262
+ }
1263
+
1264
+ function orderModifiers(modifiers) {
1265
+ var orderedModifiers = order(modifiers);
1266
+ return modifierPhases.reduce((function(acc, phase) {
1267
+ return acc.concat(orderedModifiers.filter((function(modifier) {
1268
+ return modifier.phase === phase;
1269
+ })));
1270
+ }), []);
1271
+ }
1272
+
1273
+ function debounce(fn) {
1274
+ var pending;
1275
+ return function() {
1276
+ if (!pending) {
1277
+ pending = new Promise((function(resolve) {
1278
+ Promise.resolve().then((function() {
1279
+ pending = undefined;
1280
+ resolve(fn());
1281
+ }));
1282
+ }));
1283
+ }
1284
+ return pending;
1285
+ };
1286
+ }
1287
+
1288
+ function mergeByName(modifiers) {
1289
+ var merged = modifiers.reduce((function(merged, current) {
1290
+ var existing = merged[current.name];
1291
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1292
+ options: Object.assign({}, existing.options, current.options),
1293
+ data: Object.assign({}, existing.data, current.data)
1294
+ }) : current;
1295
+ return merged;
1296
+ }), {});
1297
+ return Object.keys(merged).map((function(key) {
1298
+ return merged[key];
1299
+ }));
1300
+ }
1301
+
1302
+ var DEFAULT_OPTIONS = {
1303
+ placement: "bottom",
1304
+ modifiers: [],
1305
+ strategy: "absolute"
1306
+ };
1307
+
1308
+ function areValidElements() {
1309
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1310
+ args[_key] = arguments[_key];
1311
+ }
1312
+ return !args.some((function(element) {
1313
+ return !(element && typeof element.getBoundingClientRect === "function");
1314
+ }));
1315
+ }
1316
+
1317
+ function popperGenerator(generatorOptions) {
1318
+ if (generatorOptions === void 0) {
1319
+ generatorOptions = {};
1320
+ }
1321
+ var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1322
+ return function createPopper(reference, popper, options) {
1323
+ if (options === void 0) {
1324
+ options = defaultOptions;
1325
+ }
1326
+ var state = {
1327
+ placement: "bottom",
1328
+ orderedModifiers: [],
1329
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1330
+ modifiersData: {},
1331
+ elements: {
1332
+ reference: reference,
1333
+ popper: popper
1334
+ },
1335
+ attributes: {},
1336
+ styles: {}
1337
+ };
1338
+ var effectCleanupFns = [];
1339
+ var isDestroyed = false;
1340
+ var instance = {
1341
+ state: state,
1342
+ setOptions: function setOptions(setOptionsAction) {
1343
+ var options = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
1344
+ cleanupModifierEffects();
1345
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1346
+ state.scrollParents = {
1347
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1348
+ popper: listScrollParents(popper)
1349
+ };
1350
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers)));
1351
+ state.orderedModifiers = orderedModifiers.filter((function(m) {
1352
+ return m.enabled;
1353
+ }));
1354
+ runModifierEffects();
1355
+ return instance.update();
1356
+ },
1357
+ forceUpdate: function forceUpdate() {
1358
+ if (isDestroyed) {
1359
+ return;
1360
+ }
1361
+ var _state$elements = state.elements, reference = _state$elements.reference, popper = _state$elements.popper;
1362
+ if (!areValidElements(reference, popper)) {
1363
+ return;
1364
+ }
1365
+ state.rects = {
1366
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === "fixed"),
1367
+ popper: getLayoutRect(popper)
1368
+ };
1369
+ state.reset = false;
1370
+ state.placement = state.options.placement;
1371
+ state.orderedModifiers.forEach((function(modifier) {
1372
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1373
+ }));
1374
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1375
+ if (state.reset === true) {
1376
+ state.reset = false;
1377
+ index = -1;
1378
+ continue;
1379
+ }
1380
+ var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
1381
+ if (typeof fn === "function") {
1382
+ state = fn({
1383
+ state: state,
1384
+ options: _options,
1385
+ name: name,
1386
+ instance: instance
1387
+ }) || state;
1388
+ }
1389
+ }
1390
+ },
1391
+ update: debounce((function() {
1392
+ return new Promise((function(resolve) {
1393
+ instance.forceUpdate();
1394
+ resolve(state);
1395
+ }));
1396
+ })),
1397
+ destroy: function destroy() {
1398
+ cleanupModifierEffects();
1399
+ isDestroyed = true;
1400
+ }
1401
+ };
1402
+ if (!areValidElements(reference, popper)) {
1403
+ return instance;
1404
+ }
1405
+ instance.setOptions(options).then((function(state) {
1406
+ if (!isDestroyed && options.onFirstUpdate) {
1407
+ options.onFirstUpdate(state);
1408
+ }
1409
+ }));
1410
+ function runModifierEffects() {
1411
+ state.orderedModifiers.forEach((function(_ref3) {
1412
+ var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect;
1413
+ if (typeof effect === "function") {
1414
+ var cleanupFn = effect({
1415
+ state: state,
1416
+ name: name,
1417
+ instance: instance,
1418
+ options: options
1419
+ });
1420
+ var noopFn = function noopFn() {};
1421
+ effectCleanupFns.push(cleanupFn || noopFn);
1422
+ }
1423
+ }));
1424
+ }
1425
+ function cleanupModifierEffects() {
1426
+ effectCleanupFns.forEach((function(fn) {
1427
+ return fn();
1428
+ }));
1429
+ effectCleanupFns = [];
1430
+ }
1431
+ return instance;
1432
+ };
1433
+ }
1434
+
1435
+ var defaultModifiers = [ eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1 ];
1436
+
1437
+ var createPopper = popperGenerator({
1438
+ defaultModifiers: defaultModifiers
1439
+ });
1440
+
1441
+ class Popover extends Controller {
1442
+ static targets=[ "activator", "popover" ];
1443
+ static classes=[ "open", "closed" ];
1444
+ static values={
1445
+ placement: String,
1446
+ active: Boolean
1447
+ };
1448
+ connect() {
1449
+ createPopper(this.activatorTarget, this.popoverTarget, {
1450
+ placement: this.placementValue,
1451
+ modifiers: [ {
1452
+ name: "offset",
1453
+ options: {
1454
+ offset: [ 0, 5 ]
1455
+ }
1456
+ } ]
1457
+ });
1458
+ if (this.activeValue) {
1459
+ this.show();
1460
+ }
1461
+ }
1462
+ toggle() {
1463
+ this.popoverTarget.classList.toggle(this.closedClass);
1464
+ this.popoverTarget.classList.toggle(this.openClass);
1465
+ }
1466
+ show() {
1467
+ this.popoverTarget.classList.remove(this.closedClass);
1468
+ this.popoverTarget.classList.add(this.openClass);
1469
+ }
1470
+ hide(event) {
1471
+ if (!this.element.contains(event.target) && !this.popoverTarget.classList.contains(this.closedClass)) {
1472
+ this.popoverTarget.classList.remove(this.openClass);
1473
+ this.popoverTarget.classList.add(this.closedClass);
1474
+ }
1475
+ }
1476
+ }
1477
+
3
1478
  class ResourceItem extends Controller {
4
1479
  static targets=[ "link" ];
5
1480
  open(event) {
@@ -12,11 +1487,65 @@ class ResourceItem extends Controller {
12
1487
  }
13
1488
  }
14
1489
 
1490
+ class Scrollable extends Controller {
1491
+ static targets=[ "topEdge", "bottomEdge" ];
1492
+ static classes=[ "topShadow", "bottomShadow" ];
1493
+ static values={
1494
+ shadow: Boolean
1495
+ };
1496
+ initialize() {
1497
+ this.topEdgeReached = false;
1498
+ this.bottomEdgeReached = true;
1499
+ }
1500
+ connect() {
1501
+ if (this.shadowValue) {
1502
+ this.observer = new IntersectionObserver(this.handleIntersection);
1503
+ this.observer.observe(this.topEdgeTarget);
1504
+ this.observer.observe(this.bottomEdgeTarget);
1505
+ }
1506
+ }
1507
+ disconnect() {
1508
+ if (this.shadowValue) {
1509
+ this.observer.disconnect();
1510
+ }
1511
+ }
1512
+ handleIntersection=entries => {
1513
+ entries.forEach((entry => {
1514
+ const target = entry.target.dataset.polarisScrollableTarget;
1515
+ switch (target) {
1516
+ case "topEdge":
1517
+ this.topEdgeReached = entry.isIntersecting;
1518
+ break;
1519
+
1520
+ case "bottomEdge":
1521
+ this.bottomEdgeReached = entry.isIntersecting;
1522
+ break;
1523
+ }
1524
+ }));
1525
+ this.updateShadows();
1526
+ };
1527
+ updateShadows() {
1528
+ if (!this.topEdgeReached && !this.bottomEdgeReached) {
1529
+ this.element.classList.add(this.topShadowClass, this.bottomShadowClass);
1530
+ } else if (this.topEdgeReached && this.bottomEdgeReached) {
1531
+ this.element.classList.remove(this.topShadowClass, this.bottomShadowClass);
1532
+ } else if (this.topEdgeReached) {
1533
+ this.element.classList.remove(this.topShadowClass);
1534
+ this.element.classList.add(this.bottomShadowClass);
1535
+ } else if (this.bottomEdgeReached) {
1536
+ this.element.classList.add(this.topShadowClass);
1537
+ this.element.classList.remove(this.bottomShadowClass);
1538
+ }
1539
+ }
1540
+ }
1541
+
15
1542
  class Select extends Controller {
16
- static targets=[ "selectedOption" ];
17
- update(event) {
18
- const select = event.currentTarget;
19
- const option = select.options[select.selectedIndex];
1543
+ static targets=[ "select", "selectedOption" ];
1544
+ connect() {
1545
+ this.update();
1546
+ }
1547
+ update() {
1548
+ const option = this.selectTarget.options[this.selectTarget.selectedIndex];
20
1549
  this.selectedOptionTarget.innerText = option.text;
21
1550
  }
22
1551
  }
@@ -99,9 +1628,14 @@ class TextField extends Controller {
99
1628
  }
100
1629
 
101
1630
  function registerPolarisControllers(application) {
1631
+ application.register("polaris-button", Button);
1632
+ application.register("polaris-modal", Modal);
1633
+ application.register("polaris", Polaris);
1634
+ application.register("polaris-popover", Popover);
102
1635
  application.register("polaris-resource-item", ResourceItem);
1636
+ application.register("polaris-scrollable", Scrollable);
103
1637
  application.register("polaris-select", Select);
104
1638
  application.register("polaris-text-field", TextField);
105
1639
  }
106
1640
 
107
- export { ResourceItem, Select, TextField, registerPolarisControllers };
1641
+ export { Modal, Polaris, Popover, ResourceItem, Scrollable, Select, TextField, registerPolarisControllers };