@hyalo/angular 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +32 -3
- package/fesm2022/hyalo-angular-accordion.mjs +230 -0
- package/fesm2022/hyalo-angular-accordion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button.mjs +203 -0
- package/fesm2022/hyalo-angular-button.mjs.map +1 -0
- package/fesm2022/hyalo-angular-card.mjs +221 -0
- package/fesm2022/hyalo-angular-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-choice.mjs +788 -0
- package/fesm2022/hyalo-angular-choice.mjs.map +1 -0
- package/fesm2022/hyalo-angular-dialog.mjs +571 -0
- package/fesm2022/hyalo-angular-dialog.mjs.map +1 -0
- package/fesm2022/hyalo-angular-field.mjs +312 -0
- package/fesm2022/hyalo-angular-field.mjs.map +1 -0
- package/fesm2022/hyalo-angular-icon.mjs +343 -0
- package/fesm2022/hyalo-angular-icon.mjs.map +1 -0
- package/fesm2022/hyalo-angular-interaction.mjs +455 -0
- package/fesm2022/hyalo-angular-interaction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navbar.mjs +343 -0
- package/fesm2022/hyalo-angular-navbar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-overlay.mjs +94 -0
- package/fesm2022/hyalo-angular-overlay.mjs.map +1 -0
- package/fesm2022/hyalo-angular-popover-overlay-kit-6wPwnxln.mjs +3 -0
- package/fesm2022/hyalo-angular-popover.mjs +487 -0
- package/fesm2022/hyalo-angular-popover.mjs.map +1 -0
- package/fesm2022/hyalo-angular-segmented.mjs +223 -0
- package/fesm2022/hyalo-angular-segmented.mjs.map +1 -0
- package/fesm2022/hyalo-angular-select.mjs +464 -0
- package/fesm2022/hyalo-angular-select.mjs.map +1 -0
- package/fesm2022/hyalo-angular-tabs.mjs +324 -0
- package/fesm2022/hyalo-angular-tabs.mjs.map +1 -0
- package/fesm2022/hyalo-angular-theme.mjs +94 -0
- package/fesm2022/hyalo-angular-theme.mjs.map +1 -0
- package/fesm2022/hyalo-angular-toast.mjs +322 -0
- package/fesm2022/hyalo-angular-toast.mjs.map +1 -0
- package/fesm2022/hyalo-angular.mjs +473 -0
- package/fesm2022/hyalo-angular.mjs.map +1 -0
- package/package.json +133 -3
- package/styles/hyalo-core.css +25 -0
- package/styles/hyalo.css +17 -0
- package/styles/overlays/dialog.css +9 -0
- package/styles/overlays/popover.css +9 -0
- package/styles/overlays/select.css +9 -0
- package/styles/overlays/toast.css +8 -0
- package/styles/palettes/aurora.css +47 -0
- package/styles/palettes/ember.css +47 -0
- package/styles/palettes/graphite.css +47 -0
- package/styles/palettes/ocean.css +47 -0
- package/styles/palettes/orchid.css +47 -0
- package/styles/palettes/rose.css +47 -0
- package/styles/parts/card.css +49 -0
- package/styles/parts/dialog.css +116 -0
- package/styles/parts/drawer.css +124 -0
- package/styles/parts/field.css +36 -0
- package/styles/parts/glass.css +137 -0
- package/styles/parts/motion.css +82 -0
- package/styles/parts/navbar.css +55 -0
- package/styles/parts/popover.css +27 -0
- package/styles/parts/presence.css +55 -0
- package/styles/parts/reset.css +42 -0
- package/styles/parts/select.css +46 -0
- package/styles/parts/themes.css +105 -0
- package/styles/parts/toast.css +128 -0
- package/styles/parts/tokens.css +151 -0
- package/styles/parts/typography.css +64 -0
- package/types/hyalo-angular-accordion.d.ts +74 -0
- package/types/hyalo-angular-button.d.ts +88 -0
- package/types/hyalo-angular-card.d.ts +61 -0
- package/types/hyalo-angular-choice.d.ts +259 -0
- package/types/hyalo-angular-dialog.d.ts +170 -0
- package/types/hyalo-angular-field.d.ts +135 -0
- package/types/hyalo-angular-icon.d.ts +122 -0
- package/types/hyalo-angular-interaction.d.ts +131 -0
- package/types/hyalo-angular-navbar.d.ts +110 -0
- package/types/hyalo-angular-overlay.d.ts +31 -0
- package/types/hyalo-angular-popover.d.ts +142 -0
- package/types/hyalo-angular-segmented.d.ts +79 -0
- package/types/hyalo-angular-select.d.ts +130 -0
- package/types/hyalo-angular-tabs.d.ts +102 -0
- package/types/hyalo-angular-theme.d.ts +46 -0
- package/types/hyalo-angular-toast.d.ts +79 -0
- package/types/hyalo-angular.d.ts +345 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-choice.mjs","names":[],"sources":["../../../projects/hyalo/choice/checkbox.ts","../../../projects/hyalo/choice/checkbox.html","../../../projects/hyalo/choice/radio.ts","../../../projects/hyalo/choice/radio-group.html","../../../projects/hyalo/choice/radio.html","../../../projects/hyalo/choice/switch.ts","../../../projects/hyalo/choice/switch.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n booleanAttribute,\r\n input,\r\n model,\r\n output,\r\n} from '@angular/core';\r\nimport type { FormCheckboxControl } from '@angular/forms/signals';\r\nimport { injectId } from '@hyalo/angular';\r\n\r\nimport { HyIcon } from '@hyalo/angular/icon';\r\n\r\n/**\r\n * A checkbox with a label. It wraps a real `<input type=\"checkbox\">`, so\r\n * Space toggles it, clicking the label works and forms see it.\r\n *\r\n * ```html\r\n * <hy-checkbox [formField]=\"form.terms\">I accept the terms</hy-checkbox>\r\n * <hy-checkbox [(checked)]=\"all\" [indeterminate]=\"some\">Select all</hy-checkbox>\r\n * ```\r\n */\r\n@Component({\r\n selector: 'hy-checkbox',\r\n imports: [HyIcon],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'hy-choice hy-checkbox',\r\n '[attr.data-checked]': 'checked() || null',\r\n '[attr.data-indeterminate]': 'indeterminate() || null',\r\n '[attr.data-disabled]': 'disabled() || null',\r\n '[attr.data-invalid]': '(invalid() && touched()) || null',\r\n },\r\n templateUrl: './checkbox.html',\r\n styleUrl: './choice.css',\r\n})\r\nexport class HyCheckbox implements FormCheckboxControl {\r\n protected readonly descriptionId = injectId('checkbox-desc');\r\n\r\n /** Whether the box is checked. Two-way bindable and works with `[formField]`. */\r\n readonly checked = model(false);\r\n /** Shows a dash for a partly selected group. Cleared when the user toggles. */\r\n readonly indeterminate = model(false);\r\n /** Secondary text under the label. */\r\n readonly description = input<string>();\r\n readonly name = input('');\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly required = input(false, { transform: booleanAttribute });\r\n readonly invalid = input(false, { transform: booleanAttribute });\r\n readonly touched = input(false, { transform: booleanAttribute });\r\n /** Emits when focus leaves the checkbox. */\r\n readonly touch = output<void>();\r\n\r\n protected onChange(event: Event): void {\r\n this.indeterminate.set(false);\r\n this.checked.set((event.target as HTMLInputElement).checked);\r\n }\r\n}\r\n","<label class=\"hy-choice__row\">\r\n <span class=\"hy-choice__control hy-checkbox__box\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"hy-choice__input\"\r\n [name]=\"name()\"\r\n [checked]=\"checked()\"\r\n [indeterminate]=\"indeterminate()\"\r\n [disabled]=\"disabled()\"\r\n [required]=\"required()\"\r\n [attr.aria-invalid]=\"(invalid() && touched()) || null\"\r\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\r\n (change)=\"onChange($event)\"\r\n (blur)=\"touch.emit()\"\r\n />\r\n <hy-icon\r\n class=\"hy-checkbox__mark\"\r\n [name]=\"indeterminate() ? 'minus' : 'check'\"\r\n [strokeWidth]=\"2.5\"\r\n />\r\n </span>\r\n <span class=\"hy-choice__label\"><ng-content /></span>\r\n</label>\r\n@if (description()) {\r\n <p class=\"hy-choice__description\" [id]=\"descriptionId\">{{ description() }}</p>\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n booleanAttribute,\r\n computed,\r\n inject,\r\n input,\r\n model,\r\n output,\r\n} from '@angular/core';\r\nimport type { FormValueControl } from '@angular/forms/signals';\r\nimport { injectId } from '@hyalo/angular';\r\n\r\n/**\r\n * A group of radio buttons. Holds the value; the radios inside only say\r\n * which value they stand for.\r\n *\r\n * ```html\r\n * <hy-radio-group label=\"Delivery\" [formField]=\"form.delivery\">\r\n * <hy-radio value=\"standard\" description=\"3 to 5 days\">Standard</hy-radio>\r\n * <hy-radio value=\"express\">Express</hy-radio>\r\n * </hy-radio-group>\r\n * ```\r\n *\r\n * The radios are native inputs sharing one name, so arrow keys move the\r\n * selection the way the platform does, including in RTL.\r\n */\r\n@Component({\r\n selector: 'hy-radio-group',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'hy-radio-group',\r\n role: 'radiogroup',\r\n '[attr.aria-labelledby]': 'label() ? labelId : null',\r\n '[attr.aria-invalid]': 'showsError() || null',\r\n '[attr.aria-required]': 'required() || null',\r\n '[attr.data-orientation]': 'orientation()',\r\n },\r\n templateUrl: './radio-group.html',\r\n styleUrl: './choice.css',\r\n})\r\nexport class HyRadioGroup<T> implements FormValueControl<T | undefined> {\r\n protected readonly labelId = injectId('radio-label');\r\n private readonly generatedName = injectId('radio');\r\n\r\n /** Selected value. Two-way bindable and works with `[formField]`. */\r\n readonly value = model<T | undefined>(undefined);\r\n /** Visible group label. */\r\n readonly label = input<string>();\r\n /** Shared input name. Generated when not set. */\r\n readonly name = input('');\r\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly required = input(false, { transform: booleanAttribute });\r\n readonly invalid = input(false, { transform: booleanAttribute });\r\n readonly touched = input(false, { transform: booleanAttribute });\r\n readonly errors = input<readonly { readonly kind: string; readonly message?: string }[]>([]);\r\n /** Emits when focus leaves a radio. */\r\n readonly touch = output<void>();\r\n\r\n readonly groupName = computed(() => this.name() || this.generatedName);\r\n protected readonly showsError = computed(() => this.invalid() && this.touched());\r\n protected readonly errorMessage = computed(() => {\r\n const first = this.errors()[0];\r\n return first ? (first.message ?? first.kind) : '';\r\n });\r\n}\r\n\r\n/** One option inside a `hy-radio-group`. */\r\n@Component({\r\n selector: 'hy-radio',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'hy-choice hy-radio',\r\n '[attr.data-checked]': 'checked() || null',\r\n '[attr.data-disabled]': 'isDisabled() || null',\r\n },\r\n templateUrl: './radio.html',\r\n styleUrl: './choice.css',\r\n})\r\nexport class HyRadio<T> {\r\n protected readonly group = inject<HyRadioGroup<T>>(HyRadioGroup);\r\n protected readonly descriptionId = injectId('radio-desc');\r\n\r\n /** The value this radio selects. */\r\n readonly value = input.required<T>();\r\n /** Secondary text under the label. */\r\n readonly description = input<string>();\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n\r\n protected readonly checked = computed(() => this.group.value() === this.value());\r\n protected readonly isDisabled = computed(() => this.disabled() || this.group.disabled());\r\n}\r\n","@if (label()) {\r\n <span class=\"hy-radio-group__label\" [id]=\"labelId\">{{ label() }}</span>\r\n}\r\n<div class=\"hy-radio-group__items\"><ng-content /></div>\r\n@if (showsError()) {\r\n <p class=\"hy-choice__error\">{{ errorMessage() }}</p>\r\n}\r\n","<label class=\"hy-choice__row\">\r\n <span class=\"hy-choice__control hy-radio__circle\">\r\n <input\r\n type=\"radio\"\r\n class=\"hy-choice__input\"\r\n [name]=\"group.groupName()\"\r\n [checked]=\"checked()\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\r\n (change)=\"group.value.set(value())\"\r\n (blur)=\"group.touch.emit()\"\r\n />\r\n <span class=\"hy-radio__dot\" aria-hidden=\"true\"></span>\r\n </span>\r\n <span class=\"hy-choice__label\"><ng-content /></span>\r\n</label>\r\n@if (description()) {\r\n <p class=\"hy-choice__description\" [id]=\"descriptionId\">{{ description() }}</p>\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n booleanAttribute,\r\n input,\r\n model,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport type { FormCheckboxControl } from '@angular/forms/signals';\r\nimport { injectId, rubberband } from '@hyalo/angular';\r\n\r\n/** Movement before a press on the track turns into a drag, in px. */\r\nconst SLOP = 4;\r\n/** Track padding on each side, in px. Matches choice.css. */\r\nconst TRACK_PADDING = 2;\r\n/** Width of the pressed thumb, in rem. Matches choice.css. */\r\nconst PRESSED_THUMB = 1.5;\r\n\r\n/**\r\n * An on/off switch for settings that apply right away. For choices that\r\n * are submitted with a form, a checkbox is usually clearer.\r\n *\r\n * It is a native checkbox with `role=\"switch\"`, so screen readers say\r\n * \"on\" and \"off\" and Space toggles it. The thumb can also be dragged: it\r\n * follows the pointer, and lands on whichever side it is let go nearer.\r\n *\r\n * ```html\r\n * <hy-switch [(checked)]=\"notifications\">Email notifications</hy-switch>\r\n * ```\r\n */\r\n@Component({\r\n selector: 'hy-switch',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'hy-choice hy-switch',\r\n '[attr.data-checked]': 'checked() || null',\r\n '[attr.data-disabled]': 'disabled() || null',\r\n },\r\n templateUrl: './switch.html',\r\n styleUrl: './choice.css',\r\n})\r\nexport class HySwitch implements FormCheckboxControl {\r\n protected readonly descriptionId = injectId('switch-desc');\r\n /** Physical thumb offset in px while it is dragged, otherwise null. */\r\n protected readonly drag = signal<number | null>(null);\r\n private press: { x: number; from: number; travel: number; dir: number; pos: number } | null =\r\n null;\r\n /** Where a finished drag landed, until the click it causes is handled. */\r\n private landed: boolean | null = null;\r\n\r\n /** Whether the switch is on. Two-way bindable and works with `[formField]`. */\r\n readonly checked = model(false);\r\n /** Secondary text under the label. */\r\n readonly description = input<string>();\r\n readonly name = input('');\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly required = input(false, { transform: booleanAttribute });\r\n /** Emits when focus leaves the switch. */\r\n readonly touch = output<void>();\r\n\r\n protected onChange(event: Event): void {\r\n this.checked.set((event.target as HTMLInputElement).checked);\r\n }\r\n\r\n protected onDown(event: PointerEvent): void {\r\n if (this.disabled() || event.button !== 0) return;\r\n const track = event.currentTarget as HTMLElement;\r\n const rem = parseFloat(getComputedStyle(track.ownerDocument.documentElement).fontSize) || 16;\r\n const travel = track.clientWidth - 2 * TRACK_PADDING - PRESSED_THUMB * rem;\r\n this.press = {\r\n x: event.clientX,\r\n from: this.checked() ? travel : 0,\r\n travel,\r\n dir: getComputedStyle(track).direction === 'rtl' ? -1 : 1,\r\n pos: this.checked() ? travel : 0,\r\n };\r\n }\r\n\r\n protected onMove(event: PointerEvent): void {\r\n const press = this.press;\r\n if (!press) return;\r\n const moved = (event.clientX - press.x) * press.dir;\r\n if (this.drag() === null) {\r\n if (Math.abs(moved) < SLOP) return;\r\n try {\r\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\r\n } catch {\r\n // The pointer is already gone; the drag still ends on pointerup.\r\n }\r\n }\r\n // Past either end the thumb resists instead of stopping dead.\r\n const raw = press.from + moved;\r\n const over = raw < 0 ? raw : raw > press.travel ? raw - press.travel : 0;\r\n press.pos = Math.min(Math.max(raw, 0), press.travel) + rubberband(over, press.travel);\r\n this.drag.set(press.pos * press.dir);\r\n }\r\n\r\n protected onUp(cancelled = false): void {\r\n const press = this.press;\r\n this.press = null;\r\n if (!press || this.drag() === null) return;\r\n this.drag.set(null);\r\n // Decided in logical position, so it is the same in both directions.\r\n const on = press.pos > press.travel / 2;\r\n if (cancelled) {\r\n this.checked.set(on);\r\n return;\r\n }\r\n // The release also clicks the label. That click applies the drag\r\n // instead of toggling; if no click comes, apply it anyway.\r\n this.landed = on;\r\n setTimeout(() => {\r\n if (this.landed === null) return;\r\n this.checked.set(this.landed);\r\n this.landed = null;\r\n });\r\n }\r\n\r\n protected onClick(event: MouseEvent): void {\r\n if (this.landed === null) return;\r\n event.preventDefault();\r\n this.checked.set(this.landed);\r\n this.landed = null;\r\n }\r\n}\r\n","<label class=\"hy-choice__row\">\r\n <span\r\n class=\"hy-choice__control hy-switch__track\"\r\n (pointerdown)=\"onDown($event)\"\r\n (pointermove)=\"onMove($event)\"\r\n (pointerup)=\"onUp()\"\r\n (pointercancel)=\"onUp(true)\"\r\n >\r\n <input\r\n type=\"checkbox\"\r\n role=\"switch\"\r\n class=\"hy-choice__input\"\r\n [name]=\"name()\"\r\n [checked]=\"checked()\"\r\n [disabled]=\"disabled()\"\r\n [required]=\"required()\"\r\n [attr.aria-checked]=\"checked()\"\r\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\r\n (click)=\"onClick($event)\"\r\n (change)=\"onChange($event)\"\r\n (blur)=\"touch.emit()\"\r\n />\r\n <span\r\n class=\"hy-switch__thumb\"\r\n aria-hidden=\"true\"\r\n [attr.data-dragging]=\"drag() === null ? null : ''\"\r\n [style.--_drag.px]=\"drag()\"\r\n ></span>\r\n </span>\r\n <span class=\"hy-choice__label\"><ng-content /></span>\r\n</label>\r\n@if (description()) {\r\n <p class=\"hy-choice__description\" [id]=\"descriptionId\">{{ description() }}</p>\r\n}\r\n"],"mappings":";;;;AAoCA,IAAa,aAAb,MAAa,WAAU;CACF,gBAAgB,SAAS,eAAe;CAGlD,UAAU,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEtB,gBAAgB,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,cAAc,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,OAAO,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAChB,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,UAAU,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACpD,UAAU,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,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,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAR,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAQ,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,SAAA;GAAA,OAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,qBAAA;IAAA,sBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC1CrB;EAkCA,QAAA,CAAA,8+HAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADQa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAXpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,iBACJ,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,uBAAuB;IACvB,wBAAwB;GACzB;GAAA,UAAA;GAAA,QAAA,CAAA,8+HAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, Injectable, InjectionToken, Injector, afterNextRender, inject, input } from "@angular/core";
|
|
3
|
+
import { filter, firstValueFrom } from "rxjs";
|
|
4
|
+
import { HyFidelity, HyMotion, HySpring, HyVelocityTracker, MOTION, SPRINGS, injectId, project, rubberband } from "@hyalo/angular";
|
|
5
|
+
import { Dialog } from "@angular/cdk/dialog";
|
|
6
|
+
import { HyButton } from "@hyalo/angular/button";
|
|
7
|
+
import { createGlobalPositionStrategy } from "@angular/cdk/overlay";
|
|
8
|
+
const HY_DIALOG_DATA = new InjectionToken("HY_DIALOG_DATA");
|
|
9
|
+
var HyDialogRef = class {
|
|
10
|
+
cdkRef;
|
|
11
|
+
closing = false;
|
|
12
|
+
closed;
|
|
13
|
+
exit = null;
|
|
14
|
+
constructor(cdkRef) {
|
|
15
|
+
this.cdkRef = cdkRef;
|
|
16
|
+
this.closed = firstValueFrom(cdkRef.closed, { defaultValue: void 0 });
|
|
17
|
+
}
|
|
18
|
+
get id() {
|
|
19
|
+
return this.cdkRef.id;
|
|
20
|
+
}
|
|
21
|
+
get containerElement() {
|
|
22
|
+
return this.cdkRef.overlayRef.overlayElement?.querySelector(".cdk-dialog-container") ?? null;
|
|
23
|
+
}
|
|
24
|
+
close(result) {
|
|
25
|
+
if (this.closing) return;
|
|
26
|
+
this.closing = true;
|
|
27
|
+
if (this.exit) {
|
|
28
|
+
this.exit(() => this.cdkRef.close(result));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const pane = this.cdkRef.overlayRef.overlayElement;
|
|
32
|
+
const backdrop = this.cdkRef.overlayRef.backdropElement;
|
|
33
|
+
const panel = this.containerElement;
|
|
34
|
+
pane.dataset["state"] = "closing";
|
|
35
|
+
backdrop?.setAttribute("data-state", "closing");
|
|
36
|
+
let done = false;
|
|
37
|
+
const finish = () => {
|
|
38
|
+
if (done) return;
|
|
39
|
+
done = true;
|
|
40
|
+
pane.removeEventListener("animationend", onEnd);
|
|
41
|
+
this.cdkRef.close(result);
|
|
42
|
+
};
|
|
43
|
+
const onEnd = (event) => {
|
|
44
|
+
if (event.target === pane || event.target === panel) finish();
|
|
45
|
+
};
|
|
46
|
+
pane.addEventListener("animationend", onEnd);
|
|
47
|
+
setTimeout(finish, MOTION.settle.duration * 1e3 + 80);
|
|
48
|
+
}
|
|
49
|
+
cancelClose() {
|
|
50
|
+
this.closing = false;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var HyDialogTitle = class HyDialogTitle {
|
|
54
|
+
id = injectId("dialog-title");
|
|
55
|
+
constructor() {
|
|
56
|
+
const el = inject(ElementRef).nativeElement;
|
|
57
|
+
afterNextRender(() => el.closest("[role=\"dialog\"], [role=\"alertdialog\"]")?.setAttribute("aria-labelledby", this.id));
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
60
|
+
minVersion: "12.0.0",
|
|
61
|
+
version: "22.2.3",
|
|
62
|
+
ngImport: i0,
|
|
63
|
+
type: HyDialogTitle,
|
|
64
|
+
deps: [],
|
|
65
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
66
|
+
});
|
|
67
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
68
|
+
minVersion: "14.0.0",
|
|
69
|
+
version: "22.2.3",
|
|
70
|
+
type: HyDialogTitle,
|
|
71
|
+
isStandalone: true,
|
|
72
|
+
selector: "[hyDialogTitle]",
|
|
73
|
+
host: {
|
|
74
|
+
properties: { "id": "id" },
|
|
75
|
+
classAttribute: "hy-dialog__title"
|
|
76
|
+
},
|
|
77
|
+
ngImport: i0
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
81
|
+
minVersion: "12.0.0",
|
|
82
|
+
version: "22.2.3",
|
|
83
|
+
ngImport: i0,
|
|
84
|
+
type: HyDialogTitle,
|
|
85
|
+
decorators: [{
|
|
86
|
+
type: Directive,
|
|
87
|
+
args: [{
|
|
88
|
+
selector: "[hyDialogTitle]",
|
|
89
|
+
host: {
|
|
90
|
+
class: "hy-dialog__title",
|
|
91
|
+
"[id]": "id"
|
|
92
|
+
}
|
|
93
|
+
}]
|
|
94
|
+
}],
|
|
95
|
+
ctorParameters: () => []
|
|
96
|
+
});
|
|
97
|
+
var HyDialogContent = class HyDialogContent {
|
|
98
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
99
|
+
minVersion: "12.0.0",
|
|
100
|
+
version: "22.2.3",
|
|
101
|
+
ngImport: i0,
|
|
102
|
+
type: HyDialogContent,
|
|
103
|
+
deps: [],
|
|
104
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
105
|
+
});
|
|
106
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
107
|
+
minVersion: "14.0.0",
|
|
108
|
+
version: "22.2.3",
|
|
109
|
+
type: HyDialogContent,
|
|
110
|
+
isStandalone: true,
|
|
111
|
+
selector: "[hyDialogContent]",
|
|
112
|
+
host: { classAttribute: "hy-dialog__content" },
|
|
113
|
+
ngImport: i0
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
117
|
+
minVersion: "12.0.0",
|
|
118
|
+
version: "22.2.3",
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
type: HyDialogContent,
|
|
121
|
+
decorators: [{
|
|
122
|
+
type: Directive,
|
|
123
|
+
args: [{
|
|
124
|
+
selector: "[hyDialogContent]",
|
|
125
|
+
host: { class: "hy-dialog__content" }
|
|
126
|
+
}]
|
|
127
|
+
}]
|
|
128
|
+
});
|
|
129
|
+
var HyDialogActions = class HyDialogActions {
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
131
|
+
minVersion: "12.0.0",
|
|
132
|
+
version: "22.2.3",
|
|
133
|
+
ngImport: i0,
|
|
134
|
+
type: HyDialogActions,
|
|
135
|
+
deps: [],
|
|
136
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
137
|
+
});
|
|
138
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
139
|
+
minVersion: "14.0.0",
|
|
140
|
+
version: "22.2.3",
|
|
141
|
+
type: HyDialogActions,
|
|
142
|
+
isStandalone: true,
|
|
143
|
+
selector: "[hyDialogActions]",
|
|
144
|
+
host: { classAttribute: "hy-dialog__actions" },
|
|
145
|
+
ngImport: i0
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
149
|
+
minVersion: "12.0.0",
|
|
150
|
+
version: "22.2.3",
|
|
151
|
+
ngImport: i0,
|
|
152
|
+
type: HyDialogActions,
|
|
153
|
+
decorators: [{
|
|
154
|
+
type: Directive,
|
|
155
|
+
args: [{
|
|
156
|
+
selector: "[hyDialogActions]",
|
|
157
|
+
host: { class: "hy-dialog__actions" }
|
|
158
|
+
}]
|
|
159
|
+
}]
|
|
160
|
+
});
|
|
161
|
+
var HyDialogClose = class HyDialogClose {
|
|
162
|
+
ref = inject(HyDialogRef, { optional: true });
|
|
163
|
+
hyDialogClose = input(void 0, {
|
|
164
|
+
...ngDevMode ? { debugName: "hyDialogClose" } : /* istanbul ignore next */ {},
|
|
165
|
+
transform: (value) => value === "" ? void 0 : value
|
|
166
|
+
});
|
|
167
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
168
|
+
minVersion: "12.0.0",
|
|
169
|
+
version: "22.2.3",
|
|
170
|
+
ngImport: i0,
|
|
171
|
+
type: HyDialogClose,
|
|
172
|
+
deps: [],
|
|
173
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
174
|
+
});
|
|
175
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
176
|
+
minVersion: "17.1.0",
|
|
177
|
+
version: "22.2.3",
|
|
178
|
+
type: HyDialogClose,
|
|
179
|
+
isStandalone: true,
|
|
180
|
+
selector: "button[hyDialogClose]",
|
|
181
|
+
inputs: { hyDialogClose: {
|
|
182
|
+
classPropertyName: "hyDialogClose",
|
|
183
|
+
publicName: "hyDialogClose",
|
|
184
|
+
isSignal: true,
|
|
185
|
+
isRequired: false,
|
|
186
|
+
transformFunction: null
|
|
187
|
+
} },
|
|
188
|
+
host: {
|
|
189
|
+
attributes: { "type": "button" },
|
|
190
|
+
listeners: { "click": "ref?.close(hyDialogClose())" }
|
|
191
|
+
},
|
|
192
|
+
ngImport: i0
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
196
|
+
minVersion: "12.0.0",
|
|
197
|
+
version: "22.2.3",
|
|
198
|
+
ngImport: i0,
|
|
199
|
+
type: HyDialogClose,
|
|
200
|
+
decorators: [{
|
|
201
|
+
type: Directive,
|
|
202
|
+
args: [{
|
|
203
|
+
selector: "button[hyDialogClose]",
|
|
204
|
+
host: {
|
|
205
|
+
type: "button",
|
|
206
|
+
"(click)": "ref?.close(hyDialogClose())"
|
|
207
|
+
}
|
|
208
|
+
}]
|
|
209
|
+
}],
|
|
210
|
+
propDecorators: { hyDialogClose: [{
|
|
211
|
+
type: i0.Input,
|
|
212
|
+
args: [{
|
|
213
|
+
isSignal: true,
|
|
214
|
+
alias: "hyDialogClose",
|
|
215
|
+
required: false
|
|
216
|
+
}]
|
|
217
|
+
}] }
|
|
218
|
+
});
|
|
219
|
+
const HY_DIALOG_PARTS = [
|
|
220
|
+
HyDialogTitle,
|
|
221
|
+
HyDialogContent,
|
|
222
|
+
HyDialogActions,
|
|
223
|
+
HyDialogClose
|
|
224
|
+
];
|
|
225
|
+
const SLOP = 10;
|
|
226
|
+
const INTERACTIVE = "button, a[href], input, select, textarea, label, summary, [contenteditable], [role=\"slider\"], [tabindex]:not([tabindex=\"-1\"])";
|
|
227
|
+
function driveSheet(panel, backdrop, side, host) {
|
|
228
|
+
const vertical = side === "bottom";
|
|
229
|
+
const rtl = getComputedStyle(panel).direction === "rtl";
|
|
230
|
+
const sign = vertical ? 1 : side === "end" !== rtl ? 1 : -1;
|
|
231
|
+
const size = () => (vertical ? panel.offsetHeight : panel.offsetWidth) + 32;
|
|
232
|
+
panel.classList.add("hy-sheet-driven");
|
|
233
|
+
if (backdrop) backdrop.style.transition = "none";
|
|
234
|
+
const paint = (offset) => {
|
|
235
|
+
const full = size();
|
|
236
|
+
let shown = offset < 0 ? rubberband(offset, full) : offset;
|
|
237
|
+
if (!host.dismissible && offset > 0) shown = rubberband(offset, full);
|
|
238
|
+
const px = `${shown * sign}px`;
|
|
239
|
+
panel.style.translate = vertical ? `0 ${px}` : `${px} 0`;
|
|
240
|
+
if (backdrop) backdrop.style.opacity = String(Math.min(1, Math.max(0, 1 - shown / full)));
|
|
241
|
+
};
|
|
242
|
+
const spring = new HySpring(0, paint);
|
|
243
|
+
panel.style.translate = vertical ? "0 100%" : `${sign * 100}% 0`;
|
|
244
|
+
if (backdrop) backdrop.style.opacity = "0";
|
|
245
|
+
requestAnimationFrame(() => {
|
|
246
|
+
spring.set(size());
|
|
247
|
+
spring.to(0, SPRINGS.settle);
|
|
248
|
+
});
|
|
249
|
+
let closing = false;
|
|
250
|
+
const exit = (finish) => {
|
|
251
|
+
if (panel.ownerDocument.hidden) {
|
|
252
|
+
spring.stop();
|
|
253
|
+
finish();
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
closing = true;
|
|
257
|
+
spring.to(size(), {
|
|
258
|
+
...SPRINGS.settle,
|
|
259
|
+
onRest: finish
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
if (vertical) {
|
|
263
|
+
const grabber = panel.ownerDocument.createElement("div");
|
|
264
|
+
grabber.className = "hy-drawer__grabber";
|
|
265
|
+
grabber.setAttribute("aria-hidden", "true");
|
|
266
|
+
panel.prepend(grabber);
|
|
267
|
+
if (typeof ResizeObserver === "function") new ResizeObserver(() => {
|
|
268
|
+
panel.style.touchAction = panel.scrollHeight > panel.clientHeight + 1 ? "" : "none";
|
|
269
|
+
}).observe(panel);
|
|
270
|
+
}
|
|
271
|
+
let press = null;
|
|
272
|
+
const tracker = new HyVelocityTracker();
|
|
273
|
+
const along = (e) => (vertical ? e.clientY : e.clientX) * sign;
|
|
274
|
+
const across = (e) => vertical ? e.clientX : e.clientY;
|
|
275
|
+
const grab = (p, e) => {
|
|
276
|
+
p.dragging = true;
|
|
277
|
+
p.x = along(e);
|
|
278
|
+
p.from = spring.value;
|
|
279
|
+
spring.stop();
|
|
280
|
+
if (closing) {
|
|
281
|
+
closing = false;
|
|
282
|
+
host.cancelClose();
|
|
283
|
+
}
|
|
284
|
+
tracker.reset();
|
|
285
|
+
tracker.add(spring.value);
|
|
286
|
+
try {
|
|
287
|
+
panel.setPointerCapture(e.pointerId);
|
|
288
|
+
} catch {}
|
|
289
|
+
panel.dataset["dragging"] = "";
|
|
290
|
+
panel.ownerDocument.getSelection()?.removeAllRanges();
|
|
291
|
+
};
|
|
292
|
+
panel.addEventListener("pointerdown", (e) => {
|
|
293
|
+
if (e.button !== 0 || !e.isPrimary) return;
|
|
294
|
+
const target = e.target;
|
|
295
|
+
const onGrabber = !!target.closest(".hy-drawer__grabber");
|
|
296
|
+
if (!onGrabber && target.closest(INTERACTIVE)) return;
|
|
297
|
+
if (vertical && !onGrabber && panel.scrollTop > 0) return;
|
|
298
|
+
const p = {
|
|
299
|
+
id: e.pointerId,
|
|
300
|
+
x: along(e),
|
|
301
|
+
y: across(e),
|
|
302
|
+
from: spring.value,
|
|
303
|
+
dragging: false
|
|
304
|
+
};
|
|
305
|
+
press = p;
|
|
306
|
+
if (spring.running) grab(p, e);
|
|
307
|
+
});
|
|
308
|
+
panel.addEventListener("pointermove", (e) => {
|
|
309
|
+
if (!press || e.pointerId !== press.id) return;
|
|
310
|
+
const moved = along(e) - press.x;
|
|
311
|
+
if (!press.dragging) {
|
|
312
|
+
const cross = Math.abs(across(e) - press.y);
|
|
313
|
+
if (cross > SLOP && cross > Math.abs(moved)) {
|
|
314
|
+
press = null;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (Math.abs(moved) < SLOP) return;
|
|
318
|
+
grab(press, e);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const offset = press.from + moved;
|
|
322
|
+
tracker.add(offset);
|
|
323
|
+
spring.set(offset);
|
|
324
|
+
});
|
|
325
|
+
const release = (e) => {
|
|
326
|
+
if (!press || e.pointerId !== press.id) return;
|
|
327
|
+
const wasDragging = press.dragging;
|
|
328
|
+
press = null;
|
|
329
|
+
if (!wasDragging) return;
|
|
330
|
+
delete panel.dataset["dragging"];
|
|
331
|
+
const swallow = (click) => {
|
|
332
|
+
click.stopPropagation();
|
|
333
|
+
click.preventDefault();
|
|
334
|
+
};
|
|
335
|
+
panel.addEventListener("click", swallow, {
|
|
336
|
+
capture: true,
|
|
337
|
+
once: true
|
|
338
|
+
});
|
|
339
|
+
setTimeout(() => panel.removeEventListener("click", swallow, { capture: true }));
|
|
340
|
+
const velocity = e.type === "pointercancel" ? 0 : tracker.velocity();
|
|
341
|
+
const full = size();
|
|
342
|
+
const landing = spring.value + project(velocity);
|
|
343
|
+
const out = Math.abs(velocity) > 400 ? velocity > 0 : landing > full / 2;
|
|
344
|
+
spring.velocity = velocity;
|
|
345
|
+
if (out && host.dismissible) host.close();
|
|
346
|
+
else spring.to(0, SPRINGS.settle);
|
|
347
|
+
};
|
|
348
|
+
panel.addEventListener("pointerup", release);
|
|
349
|
+
panel.addEventListener("pointercancel", release);
|
|
350
|
+
return exit;
|
|
351
|
+
}
|
|
352
|
+
function openSurface(cdk, motion, fidelity, content, config, extra) {
|
|
353
|
+
let ref;
|
|
354
|
+
const dismissible = config.dismissible ?? true;
|
|
355
|
+
const cdkRef = cdk.open(content, {
|
|
356
|
+
data: config.data,
|
|
357
|
+
role: config.role ?? "dialog",
|
|
358
|
+
ariaLabel: config.label ?? null,
|
|
359
|
+
autoFocus: config.autoFocus ?? "first-tabbable",
|
|
360
|
+
restoreFocus: true,
|
|
361
|
+
ariaModal: true,
|
|
362
|
+
disableClose: true,
|
|
363
|
+
hasBackdrop: true,
|
|
364
|
+
backdropClass: "hy-backdrop",
|
|
365
|
+
panelClass: extra.panelClass,
|
|
366
|
+
positionStrategy: extra.positionStrategy,
|
|
367
|
+
width: extra.width,
|
|
368
|
+
maxWidth: extra.maxWidth,
|
|
369
|
+
height: extra.height,
|
|
370
|
+
providers: (dialogRef) => {
|
|
371
|
+
ref = new HyDialogRef(dialogRef);
|
|
372
|
+
return [{
|
|
373
|
+
provide: HyDialogRef,
|
|
374
|
+
useValue: ref
|
|
375
|
+
}, {
|
|
376
|
+
provide: HY_DIALOG_DATA,
|
|
377
|
+
useValue: config.data
|
|
378
|
+
}];
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
const hyRef = ref ?? new HyDialogRef(cdkRef);
|
|
382
|
+
const container = hyRef.containerElement;
|
|
383
|
+
if (container) {
|
|
384
|
+
container.classList.add("hy-glass");
|
|
385
|
+
container.dataset["material"] = fidelity.tier() === "low" ? "solid" : config.material ?? "frosted";
|
|
386
|
+
container.dataset["thickness"] = "thick";
|
|
387
|
+
if (extra.sheet && !motion.reduced()) hyRef.exit = driveSheet(container, cdkRef.overlayRef.backdropElement, extra.sheet, {
|
|
388
|
+
dismissible,
|
|
389
|
+
close: () => hyRef.close(),
|
|
390
|
+
cancelClose: () => hyRef.cancelClose()
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (dismissible) {
|
|
394
|
+
cdkRef.backdropClick.subscribe(() => hyRef.close());
|
|
395
|
+
cdkRef.keydownEvents.pipe(filter((e) => e.key === "Escape" && !e.defaultPrevented)).subscribe((e) => {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
hyRef.close();
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return hyRef;
|
|
401
|
+
}
|
|
402
|
+
const MAX_WIDTH = {
|
|
403
|
+
sm: "26rem",
|
|
404
|
+
md: "36rem",
|
|
405
|
+
lg: "52rem",
|
|
406
|
+
full: "72rem"
|
|
407
|
+
};
|
|
408
|
+
var HyConfirmDialog = class HyConfirmDialog {
|
|
409
|
+
data = inject(HY_DIALOG_DATA);
|
|
410
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
411
|
+
minVersion: "12.0.0",
|
|
412
|
+
version: "22.2.3",
|
|
413
|
+
ngImport: i0,
|
|
414
|
+
type: HyConfirmDialog,
|
|
415
|
+
deps: [],
|
|
416
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
417
|
+
});
|
|
418
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
419
|
+
minVersion: "17.0.0",
|
|
420
|
+
version: "22.2.3",
|
|
421
|
+
type: HyConfirmDialog,
|
|
422
|
+
isStandalone: true,
|
|
423
|
+
selector: "hy-confirm-dialog",
|
|
424
|
+
ngImport: i0,
|
|
425
|
+
template: "<h2 hyDialogTitle>{{ data.title }}</h2>\r\n@if (data.message) {\r\n <p hyDialogContent>{{ data.message }}</p>\r\n}\r\n<div hyDialogActions>\r\n <button hyButton variant=\"ghost\" tone=\"neutral\" [hyDialogClose]=\"false\">\r\n {{ data.cancelLabel ?? 'Cancel' }}\r\n </button>\r\n <button hyButton [tone]=\"data.tone ?? 'primary'\" [hyDialogClose]=\"true\">\r\n {{ data.confirmLabel ?? 'Confirm' }}\r\n </button>\r\n</div>\r\n",
|
|
426
|
+
dependencies: [
|
|
427
|
+
{
|
|
428
|
+
kind: "directive",
|
|
429
|
+
type: HyDialogTitle,
|
|
430
|
+
selector: "[hyDialogTitle]"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
kind: "directive",
|
|
434
|
+
type: HyDialogContent,
|
|
435
|
+
selector: "[hyDialogContent]"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
kind: "directive",
|
|
439
|
+
type: HyDialogActions,
|
|
440
|
+
selector: "[hyDialogActions]"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
kind: "directive",
|
|
444
|
+
type: HyDialogClose,
|
|
445
|
+
selector: "button[hyDialogClose]",
|
|
446
|
+
inputs: ["hyDialogClose"]
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
kind: "component",
|
|
450
|
+
type: HyButton,
|
|
451
|
+
selector: "button[hyButton], a[hyButton]",
|
|
452
|
+
inputs: [
|
|
453
|
+
"variant",
|
|
454
|
+
"size",
|
|
455
|
+
"tone",
|
|
456
|
+
"iconOnly",
|
|
457
|
+
"loading",
|
|
458
|
+
"disabled"
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
466
|
+
minVersion: "12.0.0",
|
|
467
|
+
version: "22.2.3",
|
|
468
|
+
ngImport: i0,
|
|
469
|
+
type: HyConfirmDialog,
|
|
470
|
+
decorators: [{
|
|
471
|
+
type: Component,
|
|
472
|
+
args: [{
|
|
473
|
+
selector: "hy-confirm-dialog",
|
|
474
|
+
imports: [HY_DIALOG_PARTS, HyButton],
|
|
475
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
476
|
+
template: "<h2 hyDialogTitle>{{ data.title }}</h2>\r\n@if (data.message) {\r\n <p hyDialogContent>{{ data.message }}</p>\r\n}\r\n<div hyDialogActions>\r\n <button hyButton variant=\"ghost\" tone=\"neutral\" [hyDialogClose]=\"false\">\r\n {{ data.cancelLabel ?? 'Cancel' }}\r\n </button>\r\n <button hyButton [tone]=\"data.tone ?? 'primary'\" [hyDialogClose]=\"true\">\r\n {{ data.confirmLabel ?? 'Confirm' }}\r\n </button>\r\n</div>\r\n"
|
|
477
|
+
}]
|
|
478
|
+
}]
|
|
479
|
+
});
|
|
480
|
+
var HyDialog = class HyDialog {
|
|
481
|
+
cdk = inject(Dialog);
|
|
482
|
+
motion = inject(HyMotion);
|
|
483
|
+
fidelity = inject(HyFidelity);
|
|
484
|
+
open(content, config = {}) {
|
|
485
|
+
const size = config.size ?? "md";
|
|
486
|
+
return openSurface(this.cdk, this.motion, this.fidelity, content, config, {
|
|
487
|
+
panelClass: ["hy-dialog-pane", `hy-dialog--${size}`],
|
|
488
|
+
maxWidth: MAX_WIDTH[size]
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
async confirm(options) {
|
|
492
|
+
return await this.open(HyConfirmDialog, {
|
|
493
|
+
data: options,
|
|
494
|
+
size: "sm",
|
|
495
|
+
role: "alertdialog"
|
|
496
|
+
}).closed === true;
|
|
497
|
+
}
|
|
498
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
499
|
+
minVersion: "12.0.0",
|
|
500
|
+
version: "22.2.3",
|
|
501
|
+
ngImport: i0,
|
|
502
|
+
type: HyDialog,
|
|
503
|
+
deps: [],
|
|
504
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
505
|
+
});
|
|
506
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
507
|
+
minVersion: "12.0.0",
|
|
508
|
+
version: "22.2.3",
|
|
509
|
+
ngImport: i0,
|
|
510
|
+
type: HyDialog,
|
|
511
|
+
providedIn: "root"
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
515
|
+
minVersion: "12.0.0",
|
|
516
|
+
version: "22.2.3",
|
|
517
|
+
ngImport: i0,
|
|
518
|
+
type: HyDialog,
|
|
519
|
+
decorators: [{
|
|
520
|
+
type: Injectable,
|
|
521
|
+
args: [{ providedIn: "root" }]
|
|
522
|
+
}]
|
|
523
|
+
});
|
|
524
|
+
var HyDrawer = class HyDrawer {
|
|
525
|
+
cdk = inject(Dialog);
|
|
526
|
+
motion = inject(HyMotion);
|
|
527
|
+
fidelity = inject(HyFidelity);
|
|
528
|
+
injector = inject(Injector);
|
|
529
|
+
open(content, config = {}) {
|
|
530
|
+
const side = config.side ?? "end";
|
|
531
|
+
const position = createGlobalPositionStrategy(this.injector);
|
|
532
|
+
if (side === "bottom") position.bottom("0").centerHorizontally();
|
|
533
|
+
else if (side === "start") position.start("0").top("0");
|
|
534
|
+
else position.end("0").top("0");
|
|
535
|
+
return openSurface(this.cdk, this.motion, this.fidelity, content, config, {
|
|
536
|
+
panelClass: ["hy-drawer-pane", `hy-drawer--${side}`],
|
|
537
|
+
positionStrategy: position,
|
|
538
|
+
width: side === "bottom" ? "100%" : config.size ?? "min(24rem, 100vw - 2.5rem)",
|
|
539
|
+
height: side === "bottom" ? config.size ?? "auto" : "100%",
|
|
540
|
+
sheet: side
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
544
|
+
minVersion: "12.0.0",
|
|
545
|
+
version: "22.2.3",
|
|
546
|
+
ngImport: i0,
|
|
547
|
+
type: HyDrawer,
|
|
548
|
+
deps: [],
|
|
549
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
550
|
+
});
|
|
551
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
552
|
+
minVersion: "12.0.0",
|
|
553
|
+
version: "22.2.3",
|
|
554
|
+
ngImport: i0,
|
|
555
|
+
type: HyDrawer,
|
|
556
|
+
providedIn: "root"
|
|
557
|
+
});
|
|
558
|
+
};
|
|
559
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
560
|
+
minVersion: "12.0.0",
|
|
561
|
+
version: "22.2.3",
|
|
562
|
+
ngImport: i0,
|
|
563
|
+
type: HyDrawer,
|
|
564
|
+
decorators: [{
|
|
565
|
+
type: Injectable,
|
|
566
|
+
args: [{ providedIn: "root" }]
|
|
567
|
+
}]
|
|
568
|
+
});
|
|
569
|
+
export { HY_DIALOG_DATA, HY_DIALOG_PARTS, HyDialog, HyDialogActions, HyDialogClose, HyDialogContent, HyDialogRef, HyDialogTitle, HyDrawer };
|
|
570
|
+
|
|
571
|
+
//# sourceMappingURL=hyalo-angular-dialog.mjs.map
|