@unabridged/midwest 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/javascript/midwest/index.ts +3 -1
- package/app/assets/javascript/midwest.js +23 -1
- package/app/assets/javascript/midwest.js.map +1 -1
- package/app/assets/stylesheets/midwest.css +1 -1
- package/app/assets/stylesheets/midwest.tailwind.css +5 -1
- package/dist/css/midwest.css +1 -1
- package/dist/javascript/collection/app/assets/javascript/midwest/index.js +3 -0
- package/dist/javascript/collection/app/assets/javascript/midwest/index.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/banner_component/banner_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/countdown_timer_component/countdown_timer_component_controller.js +22 -0
- package/dist/javascript/collection/app/components/midwest/countdown_timer_component/countdown_timer_component_controller.js.map +1 -0
- package/dist/javascript/collection/app/components/midwest/dialog_component/dialog_component_controller.js +3 -0
- package/dist/javascript/collection/app/components/midwest/dialog_component/dialog_component_controller.js.map +1 -1
- package/dist/javascript/midwest.d.ts +14 -1
- package/dist/javascript/midwest.js +23 -1
- package/dist/javascript/midwest.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,10 +12,13 @@ import Tooltip from '../../../components/midwest/tooltip_component/tooltip_compo
|
|
|
12
12
|
import Carousel from '../../../components/midwest/carousel_component/carousel_component_controller.js';
|
|
13
13
|
import FormLiveSummary from '../../../components/midwest/form/live_summary_component/live_summary_component_controller.js';
|
|
14
14
|
import Form from '../../../components/midwest/form/form_controller.js';
|
|
15
|
+
import CountdownTimer from '../../../components/midwest/countdown_timer_component/countdown_timer_component_controller.js';
|
|
16
|
+
export { default as CountdownTimer } from '../../../components/midwest/countdown_timer_component/countdown_timer_component_controller.js';
|
|
15
17
|
|
|
16
18
|
function registerMidwestControllers(application) {
|
|
17
19
|
application.register("midwest-card", Card);
|
|
18
20
|
application.register("midwest-banner", Banner);
|
|
21
|
+
application.register("midwest-countdown-timer", CountdownTimer);
|
|
19
22
|
application.register("midwest-input", Input);
|
|
20
23
|
application.register("midwest-file", File);
|
|
21
24
|
application.register("midwest-dropdown", Dropdown);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../app/assets/javascript/midwest/index.ts"],"sourcesContent":["import Card from '../../../components/midwest/card_component/card_component_controller'\nimport Banner from '../../../components/midwest/banner_component/banner_component_controller'\nimport Input from '../../../components/midwest/form/input_component/input_component_controller'\nimport File from '../../../components/midwest/form/file_component/file_component_controller'\nimport Dropdown from '../../../components/midwest/dropdown_component/dropdown_component_controller'\nimport Prose from '../../../components/midwest/prose_component/prose_component_controller'\nimport Dialog from '../../../components/midwest/dialog_component/dialog_component_controller'\nimport Tabs from '../../../components/midwest/tabs_component/tabs_component_controller'\nimport Tooltip from '../../../components/midwest/tooltip_component/tooltip_component_controller'\nimport Carousel from '../../../components/midwest/carousel_component/carousel_component_controller'\nimport FormLiveSummary from '../../../components/midwest/form/live_summary_component/live_summary_component_controller'\nimport Form from '../../../components/midwest/form/form_controller'\n/* IMPORTS */\n\nexport { Card, Banner }\n\nexport function registerMidwestControllers (application: any) {\n application.register('midwest-card', Card)\n application.register('midwest-banner', Banner)\n application.register('midwest-input', Input)\n application.register('midwest-file', File)\n application.register('midwest-dropdown', Dropdown)\n application.register('midwest-prose', Prose)\n application.register('midwest-dialog', Dialog)\n application.register('midwest-tabs', Tabs)\n application.register('midwest-tooltip', Tooltip)\n application.register('midwest-carousel', Carousel)\n application.register('midwest-form-live-summary', FormLiveSummary)\n application.register('midwest-form', Form)\n /* EXPORTS */\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../app/assets/javascript/midwest/index.ts"],"sourcesContent":["import Card from '../../../components/midwest/card_component/card_component_controller'\nimport Banner from '../../../components/midwest/banner_component/banner_component_controller'\nimport Input from '../../../components/midwest/form/input_component/input_component_controller'\nimport File from '../../../components/midwest/form/file_component/file_component_controller'\nimport Dropdown from '../../../components/midwest/dropdown_component/dropdown_component_controller'\nimport Prose from '../../../components/midwest/prose_component/prose_component_controller'\nimport Dialog from '../../../components/midwest/dialog_component/dialog_component_controller'\nimport Tabs from '../../../components/midwest/tabs_component/tabs_component_controller'\nimport Tooltip from '../../../components/midwest/tooltip_component/tooltip_component_controller'\nimport Carousel from '../../../components/midwest/carousel_component/carousel_component_controller'\nimport FormLiveSummary from '../../../components/midwest/form/live_summary_component/live_summary_component_controller'\nimport Form from '../../../components/midwest/form/form_controller'\nimport CountdownTimer from '../../../components/midwest/countdown_timer_component/countdown_timer_component_controller'\n/* IMPORTS */\n\nexport { Card, Banner, CountdownTimer }\n\nexport function registerMidwestControllers (application: any) {\n application.register('midwest-card', Card)\n application.register('midwest-banner', Banner)\n application.register('midwest-countdown-timer', CountdownTimer)\n application.register('midwest-input', Input)\n application.register('midwest-file', File)\n application.register('midwest-dropdown', Dropdown)\n application.register('midwest-prose', Prose)\n application.register('midwest-dialog', Dialog)\n application.register('midwest-tabs', Tabs)\n application.register('midwest-tooltip', Tooltip)\n application.register('midwest-carousel', Carousel)\n application.register('midwest-form-live-summary', FormLiveSummary)\n application.register('midwest-form', Form)\n /* EXPORTS */\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAiBO,SAAS,2BAA4B,WAAkB,EAAA;AAC5D,EAAY,WAAA,CAAA,QAAA,CAAS,gBAAgB,IAAI,CAAA,CAAA;AACzC,EAAY,WAAA,CAAA,QAAA,CAAS,kBAAkB,MAAM,CAAA,CAAA;AAC7C,EAAY,WAAA,CAAA,QAAA,CAAS,2BAA2B,cAAc,CAAA,CAAA;AAC9D,EAAY,WAAA,CAAA,QAAA,CAAS,iBAAiB,KAAK,CAAA,CAAA;AAC3C,EAAY,WAAA,CAAA,QAAA,CAAS,gBAAgB,IAAI,CAAA,CAAA;AACzC,EAAY,WAAA,CAAA,QAAA,CAAS,oBAAoB,QAAQ,CAAA,CAAA;AACjD,EAAY,WAAA,CAAA,QAAA,CAAS,iBAAiB,KAAK,CAAA,CAAA;AAC3C,EAAY,WAAA,CAAA,QAAA,CAAS,kBAAkB,MAAM,CAAA,CAAA;AAC7C,EAAY,WAAA,CAAA,QAAA,CAAS,gBAAgB,IAAI,CAAA,CAAA;AACzC,EAAY,WAAA,CAAA,QAAA,CAAS,mBAAmB,OAAO,CAAA,CAAA;AAC/C,EAAY,WAAA,CAAA,QAAA,CAAS,oBAAoB,QAAQ,CAAA,CAAA;AACjD,EAAY,WAAA,CAAA,QAAA,CAAS,6BAA6B,eAAe,CAAA,CAAA;AACjE,EAAY,WAAA,CAAA,QAAA,CAAS,gBAAgB,IAAI,CAAA,CAAA;AAE3C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner_component_controller.js","sources":["../../../../../../../app/components/midwest/banner_component/banner_component_controller.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"banner_component_controller.js","sources":["../../../../../../../app/components/midwest/banner_component/banner_component_controller.ts"],"sourcesContent":["import { Controller } from '@hotwired/stimulus'\n\nexport default class Banner extends Controller<HTMLFormElement> {\n connect () {\n this.element.classList.add('shown')\n this.element.classList.add('visible')\n }\n\n close () {\n this.element.classList.add('closing')\n setTimeout(() => {\n this.element.classList.add('closed')\n }, 350)\n }\n}\n"],"names":[],"mappings":";;AAEA,MAAqB,eAAe,UAA4B,CAAA;AAAA,EAC9D,OAAW,GAAA;AACT,IAAK,IAAA,CAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,OAAO,CAAA,CAAA;AAClC,IAAK,IAAA,CAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,SAAS,CAAA,CAAA;AAAA,GACtC;AAAA,EAEA,KAAS,GAAA;AACP,IAAK,IAAA,CAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,SAAS,CAAA,CAAA;AACpC,IAAA,UAAA,CAAW,MAAM;AACf,MAAK,IAAA,CAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AAAA,OAClC,GAAG,CAAA,CAAA;AAAA,GACR;AACF;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
|
2
|
+
|
|
3
|
+
class CountdownTimer extends Controller {
|
|
4
|
+
static values = {
|
|
5
|
+
seconds: { type: Number, default: 5 }
|
|
6
|
+
};
|
|
7
|
+
timer = null;
|
|
8
|
+
connect() {
|
|
9
|
+
this.timer = setTimeout(() => {
|
|
10
|
+
this.dispatch("complete", { bubbles: true });
|
|
11
|
+
}, this.secondsValue * 1e3);
|
|
12
|
+
}
|
|
13
|
+
disconnect() {
|
|
14
|
+
if (this.timer !== null) {
|
|
15
|
+
clearTimeout(this.timer);
|
|
16
|
+
this.timer = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { CountdownTimer as default };
|
|
22
|
+
//# sourceMappingURL=countdown_timer_component_controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown_timer_component_controller.js","sources":["../../../../../../../app/components/midwest/countdown_timer_component/countdown_timer_component_controller.ts"],"sourcesContent":["import { Controller } from '@hotwired/stimulus'\n\nexport default class CountdownTimer extends Controller {\n static values = {\n seconds: { type: Number, default: 5 }\n }\n\n declare secondsValue: number\n\n private timer: ReturnType<typeof setTimeout> | null = null\n\n connect () {\n this.timer = setTimeout(() => {\n this.dispatch('complete', { bubbles: true })\n }, this.secondsValue * 1000)\n }\n\n disconnect () {\n if (this.timer !== null) {\n clearTimeout(this.timer)\n this.timer = null\n }\n }\n}\n"],"names":[],"mappings":";;AAEA,MAAqB,uBAAuB,UAAW,CAAA;AAAA,EACrD,OAAO,MAAS,GAAA;AAAA,IACd,OAAS,EAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,SAAS,CAAE,EAAA;AAAA,GACtC,CAAA;AAAA,EAIQ,KAA8C,GAAA,IAAA,CAAA;AAAA,EAEtD,OAAW,GAAA;AACT,IAAK,IAAA,CAAA,KAAA,GAAQ,WAAW,MAAM;AAC5B,MAAA,IAAA,CAAK,QAAS,CAAA,UAAA,EAAY,EAAE,OAAA,EAAS,MAAM,CAAA,CAAA;AAAA,KAC7C,EAAG,IAAK,CAAA,YAAA,GAAe,GAAI,CAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,UAAc,GAAA;AACZ,IAAI,IAAA,IAAA,CAAK,UAAU,IAAM,EAAA;AACvB,MAAA,YAAA,CAAa,KAAK,KAAK,CAAA,CAAA;AACvB,MAAA,IAAA,CAAK,KAAQ,GAAA,IAAA,CAAA;AAAA,KACf;AAAA,GACF;AACF;;;;"}
|
|
@@ -69,7 +69,10 @@ class Dialog extends Controller {
|
|
|
69
69
|
hide({ detail }) {
|
|
70
70
|
if (!detail.success)
|
|
71
71
|
return;
|
|
72
|
+
const redirectUrl = detail.fetchResponse?.location?.href;
|
|
72
73
|
this.dismiss();
|
|
74
|
+
if (redirectUrl)
|
|
75
|
+
window.Turbo?.visit(redirectUrl);
|
|
73
76
|
}
|
|
74
77
|
// Arrow function so `this` is stable for add/removeEventListener pairing.
|
|
75
78
|
dismiss = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog_component_controller.js","sources":["../../../../../../../app/components/midwest/dialog_component/dialog_component_controller.ts"],"sourcesContent":["\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class Dialog extends Controller<HTMLFormElement> {\n static targets = ['remoteContent', 'clearableForm']\n\n declare readonly hasRemoteContentTarget: boolean\n declare readonly remoteContentTarget: HTMLInputElement\n declare readonly remoteContentTargets: HTMLInputElement[]\n\n declare readonly hasClearableFormTarget: boolean\n declare readonly clearableFormTarget: HTMLFormElement\n declare readonly clearableFormTargets: HTMLFormElement[]\n\n static values = {\n resetFrame: { type: Boolean, default: false }\n }\n\n declare resetFrameValue: boolean\n declare readonly hasResetFrameValue: boolean\n\n private _previousFocus: HTMLElement | null = null\n\n connect () {\n document.addEventListener('turbo:frame-load', this.bindToggleEls)\n document.addEventListener('turbo:before-visit', this.dismiss)\n document.addEventListener('click', this.handleClickOutside)\n this.dialog.addEventListener('close', this.onClose)\n this.bindToggleEls()\n }\n\n disconnect () {\n document.removeEventListener('turbo:frame-load', this.bindToggleEls)\n document.removeEventListener('turbo:before-visit', this.dismiss)\n document.removeEventListener('click', this.handleClickOutside)\n this.dialog.removeEventListener('close', this.onClose)\n }\n\n get dialog () {\n return this.element\n }\n\n get htmlEl () {\n return document.documentElement\n }\n\n get toggleEls () {\n return document.querySelectorAll(`[data-toggle-dialog=\"${this.dialog.id}\"]`)\n }\n\n get frameEl () {\n return this.dialog.querySelector('turbo-frame')\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private handleClickOutside = (event: Event) => {\n if (event.target !== this.dialog) return\n this.dismiss()\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private bindToggleEls = () => {\n this.toggleEls.forEach((el) => {\n el.addEventListener('click', this.toggle.bind(this))\n })\n }\n\n remoteContentTargetConnected () {\n this.show()\n }\n\n toggle (e: any = undefined) {\n // if clicked elem is a link, prevent default behavior.\n if (e instanceof Event) e.preventDefault()\n this.htmlEl.classList.toggle('overflow-hidden', true)\n\n if (this.dialog.open) {\n this.dialog.close()\n } else {\n this._previousFocus = document.activeElement as HTMLElement\n this.dialog.showModal()\n this.dialog.addEventListener('keydown', this.handleFocusTrap)\n }\n }\n\n show (e: any = undefined) {\n // if clicked elem is a link, prevent default behavior.\n if (e instanceof Event) e.preventDefault()\n this.htmlEl.classList.toggle('overflow-hidden', true)\n this._previousFocus = document.activeElement as HTMLElement\n this.dialog.showModal()\n this.dialog.addEventListener('keydown', this.handleFocusTrap)\n }\n\n hide ({ detail }: { detail: { success: boolean } }) {\n if (!detail.success) return\n this.dismiss()\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n dismiss = () => {\n this.dialog.close()\n }\n\n reloadPage () {\n window.location.reload()\n }\n\n private handleFocusTrap = (event: KeyboardEvent) => {\n if (event.key !== 'Tab') return\n\n const focusable = Array.from(\n this.dialog.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter(el => !el.closest('[inert]'))\n\n if (focusable.length === 0) return\n\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n if (event.shiftKey) {\n if (document.activeElement === first) {\n event.preventDefault()\n last.focus()\n }\n } else {\n if (document.activeElement === last) {\n event.preventDefault()\n first.focus()\n }\n }\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private onClose = async () => {\n this.dialog.removeEventListener('keydown', this.handleFocusTrap)\n this._previousFocus?.focus()\n this._previousFocus = null\n this.htmlEl.classList.toggle('overflow-hidden', false)\n await this.delay(500)\n this.resetForm()\n this.resetFrame()\n }\n\n private resetFrame () {\n if (!this.resetFrameValue || (this.frameEl == null)) return\n\n this.frameEl.innerHTML = ''\n this.frameEl.removeAttribute('src')\n }\n\n private resetForm () {\n if (!this.hasClearableFormTarget) return\n this.clearableFormTarget.reset()\n }\n\n async delay (time = 500) {\n return await new Promise((resolve) => {\n setTimeout(resolve, time)\n })\n }\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"dialog_component_controller.js","sources":["../../../../../../../app/components/midwest/dialog_component/dialog_component_controller.ts"],"sourcesContent":["\nimport { Controller } from '@hotwired/stimulus'\n\ndeclare global {\n interface Window {\n Turbo?: { visit(url: string): void }\n }\n}\n\nexport default class Dialog extends Controller<HTMLFormElement> {\n static targets = ['remoteContent', 'clearableForm']\n\n declare readonly hasRemoteContentTarget: boolean\n declare readonly remoteContentTarget: HTMLInputElement\n declare readonly remoteContentTargets: HTMLInputElement[]\n\n declare readonly hasClearableFormTarget: boolean\n declare readonly clearableFormTarget: HTMLFormElement\n declare readonly clearableFormTargets: HTMLFormElement[]\n\n static values = {\n resetFrame: { type: Boolean, default: false }\n }\n\n declare resetFrameValue: boolean\n declare readonly hasResetFrameValue: boolean\n\n private _previousFocus: HTMLElement | null = null\n\n connect () {\n document.addEventListener('turbo:frame-load', this.bindToggleEls)\n document.addEventListener('turbo:before-visit', this.dismiss)\n document.addEventListener('click', this.handleClickOutside)\n this.dialog.addEventListener('close', this.onClose)\n this.bindToggleEls()\n }\n\n disconnect () {\n document.removeEventListener('turbo:frame-load', this.bindToggleEls)\n document.removeEventListener('turbo:before-visit', this.dismiss)\n document.removeEventListener('click', this.handleClickOutside)\n this.dialog.removeEventListener('close', this.onClose)\n }\n\n get dialog () {\n return this.element\n }\n\n get htmlEl () {\n return document.documentElement\n }\n\n get toggleEls () {\n return document.querySelectorAll(`[data-toggle-dialog=\"${this.dialog.id}\"]`)\n }\n\n get frameEl () {\n return this.dialog.querySelector('turbo-frame')\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private handleClickOutside = (event: Event) => {\n if (event.target !== this.dialog) return\n this.dismiss()\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private bindToggleEls = () => {\n this.toggleEls.forEach((el) => {\n el.addEventListener('click', this.toggle.bind(this))\n })\n }\n\n remoteContentTargetConnected () {\n this.show()\n }\n\n toggle (e: any = undefined) {\n // if clicked elem is a link, prevent default behavior.\n if (e instanceof Event) e.preventDefault()\n this.htmlEl.classList.toggle('overflow-hidden', true)\n\n if (this.dialog.open) {\n this.dialog.close()\n } else {\n this._previousFocus = document.activeElement as HTMLElement\n this.dialog.showModal()\n this.dialog.addEventListener('keydown', this.handleFocusTrap)\n }\n }\n\n show (e: any = undefined) {\n // if clicked elem is a link, prevent default behavior.\n if (e instanceof Event) e.preventDefault()\n this.htmlEl.classList.toggle('overflow-hidden', true)\n this._previousFocus = document.activeElement as HTMLElement\n this.dialog.showModal()\n this.dialog.addEventListener('keydown', this.handleFocusTrap)\n }\n\n hide ({ detail }: { detail: { success: boolean; fetchResponse?: { location: URL } } }) {\n if (!detail.success) return\n const redirectUrl = detail.fetchResponse?.location?.href\n this.dismiss()\n if (redirectUrl) window.Turbo?.visit(redirectUrl)\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n dismiss = () => {\n this.dialog.close()\n }\n\n reloadPage () {\n window.location.reload()\n }\n\n private handleFocusTrap = (event: KeyboardEvent) => {\n if (event.key !== 'Tab') return\n\n const focusable = Array.from(\n this.dialog.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter(el => !el.closest('[inert]'))\n\n if (focusable.length === 0) return\n\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n if (event.shiftKey) {\n if (document.activeElement === first) {\n event.preventDefault()\n last.focus()\n }\n } else {\n if (document.activeElement === last) {\n event.preventDefault()\n first.focus()\n }\n }\n }\n\n // Arrow function so `this` is stable for add/removeEventListener pairing.\n private onClose = async () => {\n this.dialog.removeEventListener('keydown', this.handleFocusTrap)\n this._previousFocus?.focus()\n this._previousFocus = null\n this.htmlEl.classList.toggle('overflow-hidden', false)\n await this.delay(500)\n this.resetForm()\n this.resetFrame()\n }\n\n private resetFrame () {\n if (!this.resetFrameValue || (this.frameEl == null)) return\n\n this.frameEl.innerHTML = ''\n this.frameEl.removeAttribute('src')\n }\n\n private resetForm () {\n if (!this.hasClearableFormTarget) return\n this.clearableFormTarget.reset()\n }\n\n async delay (time = 500) {\n return await new Promise((resolve) => {\n setTimeout(resolve, time)\n })\n }\n}\n"],"names":[],"mappings":";;AASA,MAAqB,eAAe,UAA4B,CAAA;AAAA,EAC9D,OAAO,OAAA,GAAU,CAAC,eAAA,EAAiB,eAAe,CAAA,CAAA;AAAA,EAUlD,OAAO,MAAS,GAAA;AAAA,IACd,UAAY,EAAA,EAAE,IAAM,EAAA,OAAA,EAAS,SAAS,KAAM,EAAA;AAAA,GAC9C,CAAA;AAAA,EAKQ,cAAqC,GAAA,IAAA,CAAA;AAAA,EAE7C,OAAW,GAAA;AACT,I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AClC,IAAA,IAAA,CAAK,oBAAoB,KAAM,EAAA,CAAA;AAAA,GACjC;AAAA,EAEA,MAAM,KAAO,CAAA,IAAA,GAAO,GAAK,EAAA;AACvB,IAAA,OAAO,MAAM,IAAI,OAAQ,CAAA,CAAC,OAAY,KAAA;AACpC,MAAA,UAAA,CAAW,SAAS,IAAI,CAAA,CAAA;AAAA,KACzB,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -37,6 +37,19 @@ declare class Banner extends Controller<HTMLFormElement> {
|
|
|
37
37
|
close(): void;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
declare class CountdownTimer extends Controller {
|
|
41
|
+
static values: {
|
|
42
|
+
seconds: {
|
|
43
|
+
type: NumberConstructor;
|
|
44
|
+
default: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
secondsValue: number;
|
|
48
|
+
private timer;
|
|
49
|
+
connect(): void;
|
|
50
|
+
disconnect(): void;
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
declare function registerMidwestControllers(application: any): void;
|
|
41
54
|
|
|
42
|
-
export { Banner, Card, registerMidwestControllers };
|
|
55
|
+
export { Banner, Card, CountdownTimer, registerMidwestControllers };
|
|
@@ -3026,7 +3026,10 @@ class Dialog extends Controller {
|
|
|
3026
3026
|
hide({ detail }) {
|
|
3027
3027
|
if (!detail.success)
|
|
3028
3028
|
return;
|
|
3029
|
+
const redirectUrl = detail.fetchResponse?.location?.href;
|
|
3029
3030
|
this.dismiss();
|
|
3031
|
+
if (redirectUrl)
|
|
3032
|
+
window.Turbo?.visit(redirectUrl);
|
|
3030
3033
|
}
|
|
3031
3034
|
// Arrow function so `this` is stable for add/removeEventListener pairing.
|
|
3032
3035
|
dismiss = () => {
|
|
@@ -3517,9 +3520,28 @@ class Form extends Controller {
|
|
|
3517
3520
|
}
|
|
3518
3521
|
}
|
|
3519
3522
|
|
|
3523
|
+
class CountdownTimer extends Controller {
|
|
3524
|
+
static values = {
|
|
3525
|
+
seconds: { type: Number, default: 5 }
|
|
3526
|
+
};
|
|
3527
|
+
timer = null;
|
|
3528
|
+
connect() {
|
|
3529
|
+
this.timer = setTimeout(() => {
|
|
3530
|
+
this.dispatch("complete", { bubbles: true });
|
|
3531
|
+
}, this.secondsValue * 1e3);
|
|
3532
|
+
}
|
|
3533
|
+
disconnect() {
|
|
3534
|
+
if (this.timer !== null) {
|
|
3535
|
+
clearTimeout(this.timer);
|
|
3536
|
+
this.timer = null;
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3520
3541
|
function registerMidwestControllers(application) {
|
|
3521
3542
|
application.register("midwest-card", Card);
|
|
3522
3543
|
application.register("midwest-banner", Banner);
|
|
3544
|
+
application.register("midwest-countdown-timer", CountdownTimer);
|
|
3523
3545
|
application.register("midwest-input", Input);
|
|
3524
3546
|
application.register("midwest-file", File);
|
|
3525
3547
|
application.register("midwest-dropdown", Dropdown);
|
|
@@ -3532,5 +3554,5 @@ function registerMidwestControllers(application) {
|
|
|
3532
3554
|
application.register("midwest-form", Form);
|
|
3533
3555
|
}
|
|
3534
3556
|
|
|
3535
|
-
export { Banner, Card, registerMidwestControllers };
|
|
3557
|
+
export { Banner, Card, CountdownTimer, registerMidwestControllers };
|
|
3536
3558
|
//# sourceMappingURL=midwest.js.map
|