@unabridged/midwest 0.24.3 → 0.25.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 (28) hide show
  1. package/app/assets/javascript/midwest/index.ts +8 -0
  2. package/app/assets/javascript/midwest/map_providers.ts +61 -0
  3. package/app/assets/javascript/midwest.js +1009 -9
  4. package/app/assets/javascript/midwest.js.map +1 -1
  5. package/app/assets/stylesheets/midwest.css +1 -1
  6. package/app/assets/stylesheets/midwest.tailwind.css +13 -1
  7. package/dist/css/midwest.css +1 -1
  8. package/dist/javascript/collection/app/assets/javascript/midwest/index.js +8 -0
  9. package/dist/javascript/collection/app/assets/javascript/midwest/index.js.map +1 -1
  10. package/dist/javascript/collection/app/assets/javascript/midwest/map_providers.js +56 -0
  11. package/dist/javascript/collection/app/assets/javascript/midwest/map_providers.js.map +1 -0
  12. package/dist/javascript/collection/app/components/midwest/form/address_component/address_component_controller.js +441 -0
  13. package/dist/javascript/collection/app/components/midwest/form/address_component/address_component_controller.js.map +1 -0
  14. package/dist/javascript/collection/app/components/midwest/form/form_controller.js +37 -3
  15. package/dist/javascript/collection/app/components/midwest/form/form_controller.js.map +1 -1
  16. package/dist/javascript/collection/app/components/midwest/form/live_summary_component/live_summary_component_controller.js +55 -1
  17. package/dist/javascript/collection/app/components/midwest/form/live_summary_component/live_summary_component_controller.js.map +1 -1
  18. package/dist/javascript/collection/app/components/midwest/map_component/map_component_controller.js +297 -0
  19. package/dist/javascript/collection/app/components/midwest/map_component/map_component_controller.js.map +1 -0
  20. package/dist/javascript/collection/app/components/midwest/onboarding_component/onboarding_component_controller.js +34 -5
  21. package/dist/javascript/collection/app/components/midwest/onboarding_component/onboarding_component_controller.js.map +1 -1
  22. package/dist/javascript/collection/app/components/midwest/page_transition_component/page_transition_component_controller.js +38 -0
  23. package/dist/javascript/collection/app/components/midwest/page_transition_component/page_transition_component_controller.js.map +1 -0
  24. package/dist/javascript/collection/app/components/midwest/popover_component/popover_component_controller.js +67 -0
  25. package/dist/javascript/collection/app/components/midwest/popover_component/popover_component_controller.js.map +1 -0
  26. package/dist/javascript/midwest.js +1009 -9
  27. package/dist/javascript/midwest.js.map +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,67 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+
3
+ class Popover extends Controller {
4
+ animating = false;
5
+ closeTimer = null;
6
+ connect() {
7
+ this.element.addEventListener("beforetoggle", this.onBeforeToggle);
8
+ }
9
+ disconnect() {
10
+ this.element.removeEventListener("beforetoggle", this.onBeforeToggle);
11
+ this.cleanUp();
12
+ }
13
+ onBeforeToggle = (event) => {
14
+ const toggle = event;
15
+ if (toggle.newState === "open") {
16
+ if (this.closeTimer) {
17
+ clearTimeout(this.closeTimer);
18
+ this.closeTimer = null;
19
+ }
20
+ this.element.classList.remove("is-closing");
21
+ this.animating = false;
22
+ return;
23
+ }
24
+ if (toggle.newState !== "closed")
25
+ return;
26
+ if (window.matchMedia("(width < 700px)").matches)
27
+ return;
28
+ if (!this.element.classList.contains("midwest-motion"))
29
+ return;
30
+ if (this.animating)
31
+ return;
32
+ event.preventDefault();
33
+ this.animating = true;
34
+ this.element.classList.add("is-closing");
35
+ this.closeTimer = setTimeout(() => {
36
+ this.closeTimer = null;
37
+ this.element.style.display = "none";
38
+ this.element.style.transition = "none";
39
+ this.element.hidePopover();
40
+ this.animating = false;
41
+ requestAnimationFrame(() => {
42
+ this.element.style.removeProperty("display");
43
+ this.element.style.removeProperty("transition");
44
+ this.element.classList.remove("is-closing");
45
+ });
46
+ }, this.exitDuration());
47
+ };
48
+ cleanUp() {
49
+ if (this.closeTimer) {
50
+ clearTimeout(this.closeTimer);
51
+ this.closeTimer = null;
52
+ }
53
+ this.element.classList.remove("is-closing");
54
+ this.element.style.removeProperty("transition");
55
+ this.animating = false;
56
+ }
57
+ exitDuration() {
58
+ const durations = getComputedStyle(this.element).transitionDuration.split(",").map((s) => {
59
+ const n = parseFloat(s);
60
+ return s.trim().endsWith("ms") ? n : n * 1e3;
61
+ });
62
+ return Math.max(0, ...durations);
63
+ }
64
+ }
65
+
66
+ export { Popover as default };
67
+ //# sourceMappingURL=popover_component_controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover_component_controller.js","sources":["../../../../../../../app/components/midwest/popover_component/popover_component_controller.ts"],"sourcesContent":["import { Controller } from '@hotwired/stimulus'\n\n// Plays the motion exit animation *before* the native popover close fires.\n// Without this, Chromium recalculates `position-try-fallbacks` the moment\n// `:popover-open` is removed, which jumps the popover to a different anchor\n// position while it is still visible. By deferring the actual close until after\n// the animation, the recalculation happens while the element is already\n// transparent — invisible to the user.\nexport default class Popover extends Controller<HTMLElement> {\n private animating = false\n private closeTimer: ReturnType<typeof setTimeout> | null = null\n\n connect () {\n this.element.addEventListener('beforetoggle', this.onBeforeToggle)\n }\n\n disconnect () {\n this.element.removeEventListener('beforetoggle', this.onBeforeToggle)\n this.cleanUp()\n }\n\n private onBeforeToggle = (event: Event) => {\n const toggle = event as ToggleEvent\n\n // If the popover reopens during the exit animation, cancel it cleanly.\n if (toggle.newState === 'open') {\n if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null }\n this.element.classList.remove('is-closing')\n this.animating = false\n return\n }\n\n if (toggle.newState !== 'closed') return\n // Anchor positioning is only active on desktop.\n if (window.matchMedia('(width < 700px)').matches) return\n // Only intercept motion-driven popovers; non-motion close is instant so there\n // is no visible jump to fix.\n if (!this.element.classList.contains('midwest-motion')) return\n // We are the one calling hidePopover() after the animation — let it through.\n if (this.animating) return\n\n event.preventDefault()\n this.animating = true\n this.element.classList.add('is-closing')\n\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null\n // Set display:none *before* hidePopover() so that when :popover-open is\n // removed and position-try-fallbacks recalculates, the element is already\n // out of the rendering tree — the recalculated position is never painted.\n this.element.style.display = 'none'\n this.element.style.transition = 'none'\n this.element.hidePopover()\n this.animating = false\n requestAnimationFrame(() => {\n this.element.style.removeProperty('display')\n this.element.style.removeProperty('transition')\n this.element.classList.remove('is-closing')\n })\n }, this.exitDuration())\n }\n\n private cleanUp () {\n if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null }\n this.element.classList.remove('is-closing')\n this.element.style.removeProperty('transition')\n this.animating = false\n }\n\n private exitDuration (): number {\n const durations = getComputedStyle(this.element)\n .transitionDuration.split(',')\n .map((s) => {\n const n = parseFloat(s)\n return s.trim().endsWith('ms') ? n : n * 1000\n })\n return Math.max(0, ...durations)\n }\n}\n"],"names":[],"mappings":";;AAQA,MAAqB,gBAAgB,UAAwB,CAAA;AAAA,EACnD,SAAY,GAAA,KAAA,CAAA;AAAA,EACZ,UAAmD,GAAA,IAAA,CAAA;AAAA,EAE3D,OAAW,GAAA;AACT,IAAA,IAAA,CAAK,OAAQ,CAAA,gBAAA,CAAiB,cAAgB,EAAA,IAAA,CAAK,cAAc,CAAA,CAAA;AAAA,GACnE;AAAA,EAEA,UAAc,GAAA;AACZ,IAAA,IAAA,CAAK,OAAQ,CAAA,mBAAA,CAAoB,cAAgB,EAAA,IAAA,CAAK,cAAc,CAAA,CAAA;AACpE,IAAA,IAAA,CAAK,OAAQ,EAAA,CAAA;AAAA,GACf;AAAA,EAEQ,cAAA,GAAiB,CAAC,KAAiB,KAAA;AACzC,IAAA,MAAM,MAAS,GAAA,KAAA,CAAA;AAGf,IAAI,IAAA,MAAA,CAAO,aAAa,MAAQ,EAAA;AAC9B,MAAA,IAAI,KAAK,UAAY,EAAA;AAAE,QAAA,YAAA,CAAa,KAAK,UAAU,CAAA,CAAA;AAAG,QAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAAA,OAAK;AAC7E,MAAK,IAAA,CAAA,OAAA,CAAQ,SAAU,CAAA,MAAA,CAAO,YAAY,CAAA,CAAA;AAC1C,MAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA;AACjB,MAAA,OAAA;AAAA,KACF;AAEA,IAAA,IAAI,OAAO,QAAa,KAAA,QAAA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