@tectra-ng/ui 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/LICENSE +21 -0
- package/README.md +26 -2
- package/amount/README.md +28 -0
- package/autocomplete/README.md +82 -0
- package/avatar/README.md +43 -0
- package/badge/README.md +19 -0
- package/button/README.md +46 -0
- package/button-group/README.md +8 -0
- package/card/README.md +30 -0
- package/cascade-select/README.md +49 -0
- package/checkbox/README.md +64 -0
- package/chip/README.md +38 -0
- package/chips-input/README.md +47 -0
- package/color-picker/README.md +43 -0
- package/confirm/README.md +46 -0
- package/country/README.md +23 -0
- package/country-select/README.md +39 -0
- package/dialog/README.md +84 -0
- package/divider/README.md +24 -0
- package/drawer/README.md +54 -0
- package/email-suggestion/README.md +20 -0
- package/fesm2022/tectra-ng-ui-amount.mjs +415 -0
- package/fesm2022/tectra-ng-ui-amount.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +730 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-avatar.mjs +670 -0
- package/fesm2022/tectra-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-badge.mjs +191 -0
- package/fesm2022/tectra-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-button-group.mjs +50 -0
- package/fesm2022/tectra-ng-ui-button-group.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-button.mjs +725 -0
- package/fesm2022/tectra-ng-ui-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-card.mjs +210 -0
- package/fesm2022/tectra-ng-ui-card.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +887 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-checkbox.mjs +1150 -0
- package/fesm2022/tectra-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-chip.mjs +344 -0
- package/fesm2022/tectra-ng-ui-chip.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-chips-input.mjs +649 -0
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-color-picker.mjs +828 -0
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-confirm.mjs +489 -0
- package/fesm2022/tectra-ng-ui-confirm.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-country-select.mjs +545 -0
- package/fesm2022/tectra-ng-ui-country-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-country.mjs +313 -0
- package/fesm2022/tectra-ng-ui-country.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-dialog.mjs +1539 -0
- package/fesm2022/tectra-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-divider.mjs +194 -0
- package/fesm2022/tectra-ng-ui-divider.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-drawer.mjs +540 -0
- package/fesm2022/tectra-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-email-suggestion.mjs +341 -0
- package/fesm2022/tectra-ng-ui-email-suggestion.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-field.mjs +492 -0
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-fieldset.mjs +258 -0
- package/fesm2022/tectra-ng-ui-fieldset.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-highlight-text.mjs +246 -0
- package/fesm2022/tectra-ng-ui-highlight-text.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-icon-field.mjs +478 -0
- package/fesm2022/tectra-ng-ui-icon-field.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs +113 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-mask.mjs +413 -0
- package/fesm2022/tectra-ng-ui-input-mask.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-number.mjs +1045 -0
- package/fesm2022/tectra-ng-ui-input-number.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-otp.mjs +553 -0
- package/fesm2022/tectra-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input.mjs +260 -0
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-key-filter.mjs +185 -0
- package/fesm2022/tectra-ng-ui-key-filter.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-knob.mjs +630 -0
- package/fesm2022/tectra-ng-ui-knob.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-label.mjs +271 -0
- package/fesm2022/tectra-ng-ui-label.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-link.mjs +699 -0
- package/fesm2022/tectra-ng-ui-link.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-listbox.mjs +484 -0
- package/fesm2022/tectra-ng-ui-listbox.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs +717 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-menu.mjs +1484 -0
- package/fesm2022/tectra-ng-ui-menu.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-message.mjs +975 -0
- package/fesm2022/tectra-ng-ui-message.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs +569 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-overlay-badge.mjs +345 -0
- package/fesm2022/tectra-ng-ui-overlay-badge.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-paginator.mjs +849 -0
- package/fesm2022/tectra-ng-ui-paginator.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-panel.mjs +317 -0
- package/fesm2022/tectra-ng-ui-panel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-password-generator.mjs +292 -0
- package/fesm2022/tectra-ng-ui-password-generator.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-password.mjs +871 -0
- package/fesm2022/tectra-ng-ui-password.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-pill.mjs +361 -0
- package/fesm2022/tectra-ng-ui-pill.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-popover.mjs +742 -0
- package/fesm2022/tectra-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-progress-bar.mjs +440 -0
- package/fesm2022/tectra-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-progress-spinner.mjs +265 -0
- package/fesm2022/tectra-ng-ui-progress-spinner.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-radio-button.mjs +817 -0
- package/fesm2022/tectra-ng-ui-radio-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-rating.mjs +584 -0
- package/fesm2022/tectra-ng-ui-rating.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +2478 -0
- package/fesm2022/tectra-ng-ui-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-skeleton.mjs +548 -0
- package/fesm2022/tectra-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-slider.mjs +630 -0
- package/fesm2022/tectra-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-speed-dial.mjs +669 -0
- package/fesm2022/tectra-ng-ui-speed-dial.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-split-button.mjs +614 -0
- package/fesm2022/tectra-ng-ui-split-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-status-icon.mjs +295 -0
- package/fesm2022/tectra-ng-ui-status-icon.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-table.mjs +5997 -0
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tag.mjs +422 -0
- package/fesm2022/tectra-ng-ui-tag.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs +482 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toast.mjs +668 -0
- package/fesm2022/tectra-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toggle-button.mjs +416 -0
- package/fesm2022/tectra-ng-ui-toggle-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toggle-switch.mjs +560 -0
- package/fesm2022/tectra-ng-ui-toggle-switch.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tooltip.mjs +835 -0
- package/fesm2022/tectra-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs +986 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui.mjs +4 -0
- package/fesm2022/tectra-ng-ui.mjs.map +1 -0
- package/field/README.md +43 -0
- package/fieldset/README.md +36 -0
- package/highlight-text/README.md +20 -0
- package/icon-field/README.md +30 -0
- package/input/README.md +22 -0
- package/input-group/README.md +21 -0
- package/input-mask/README.md +30 -0
- package/input-number/README.md +61 -0
- package/input-otp/README.md +44 -0
- package/key-filter/README.md +31 -0
- package/knob/README.md +50 -0
- package/label/README.md +29 -0
- package/link/README.md +47 -0
- package/listbox/README.md +68 -0
- package/mention-textarea/README.md +47 -0
- package/menu/README.md +65 -0
- package/message/README.md +58 -0
- package/multiselect/README.md +85 -0
- package/overlay-badge/README.md +30 -0
- package/package.json +301 -3
- package/paginator/README.md +60 -0
- package/panel/README.md +45 -0
- package/password/README.md +60 -0
- package/password-generator/README.md +34 -0
- package/pill/README.md +42 -0
- package/popover/README.md +67 -0
- package/progress-bar/README.md +32 -0
- package/progress-spinner/README.md +22 -0
- package/radio-button/README.md +54 -0
- package/rating/README.md +49 -0
- package/select/README.md +78 -0
- package/skeleton/README.md +27 -0
- package/slider/README.md +48 -0
- package/speed-dial/README.md +49 -0
- package/split-button/README.md +45 -0
- package/status-icon/README.md +22 -0
- package/table/README.md +178 -0
- package/tag/README.md +42 -0
- package/textarea/README.md +37 -0
- package/toast/README.md +52 -0
- package/toggle-button/README.md +34 -0
- package/toggle-switch/README.md +49 -0
- package/tooltip/README.md +60 -0
- package/tree-select/README.md +49 -0
- package/types/tectra-ng-ui-amount.d.ts +135 -0
- package/types/tectra-ng-ui-amount.d.ts.map +1 -0
- package/types/tectra-ng-ui-autocomplete.d.ts +250 -0
- package/types/tectra-ng-ui-autocomplete.d.ts.map +1 -0
- package/types/tectra-ng-ui-avatar.d.ts +289 -0
- package/types/tectra-ng-ui-avatar.d.ts.map +1 -0
- package/types/tectra-ng-ui-badge.d.ts +119 -0
- package/types/tectra-ng-ui-badge.d.ts.map +1 -0
- package/types/tectra-ng-ui-button-group.d.ts +6 -0
- package/types/tectra-ng-ui-button-group.d.ts.map +1 -0
- package/types/tectra-ng-ui-button.d.ts +466 -0
- package/types/tectra-ng-ui-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-card.d.ts +71 -0
- package/types/tectra-ng-ui-card.d.ts.map +1 -0
- package/types/tectra-ng-ui-cascade-select.d.ts +244 -0
- package/types/tectra-ng-ui-cascade-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-checkbox.d.ts +450 -0
- package/types/tectra-ng-ui-checkbox.d.ts.map +1 -0
- package/types/tectra-ng-ui-chip.d.ts +106 -0
- package/types/tectra-ng-ui-chip.d.ts.map +1 -0
- package/types/tectra-ng-ui-chips-input.d.ts +187 -0
- package/types/tectra-ng-ui-chips-input.d.ts.map +1 -0
- package/types/tectra-ng-ui-color-picker.d.ts +237 -0
- package/types/tectra-ng-ui-color-picker.d.ts.map +1 -0
- package/types/tectra-ng-ui-confirm.d.ts +80 -0
- package/types/tectra-ng-ui-confirm.d.ts.map +1 -0
- package/types/tectra-ng-ui-country-select.d.ts +235 -0
- package/types/tectra-ng-ui-country-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-country.d.ts +105 -0
- package/types/tectra-ng-ui-country.d.ts.map +1 -0
- package/types/tectra-ng-ui-dialog.d.ts +453 -0
- package/types/tectra-ng-ui-dialog.d.ts.map +1 -0
- package/types/tectra-ng-ui-divider.d.ts +70 -0
- package/types/tectra-ng-ui-divider.d.ts.map +1 -0
- package/types/tectra-ng-ui-drawer.d.ts +188 -0
- package/types/tectra-ng-ui-drawer.d.ts.map +1 -0
- package/types/tectra-ng-ui-email-suggestion.d.ts +84 -0
- package/types/tectra-ng-ui-email-suggestion.d.ts.map +1 -0
- package/types/tectra-ng-ui-field.d.ts +139 -0
- package/types/tectra-ng-ui-field.d.ts.map +1 -0
- package/types/tectra-ng-ui-fieldset.d.ts +74 -0
- package/types/tectra-ng-ui-fieldset.d.ts.map +1 -0
- package/types/tectra-ng-ui-highlight-text.d.ts +75 -0
- package/types/tectra-ng-ui-highlight-text.d.ts.map +1 -0
- package/types/tectra-ng-ui-icon-field.d.ts +77 -0
- package/types/tectra-ng-ui-icon-field.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-group.d.ts +18 -0
- package/types/tectra-ng-ui-input-group.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-mask.d.ts +91 -0
- package/types/tectra-ng-ui-input-mask.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-number.d.ts +326 -0
- package/types/tectra-ng-ui-input-number.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-otp.d.ts +173 -0
- package/types/tectra-ng-ui-input-otp.d.ts.map +1 -0
- package/types/tectra-ng-ui-input.d.ts +113 -0
- package/types/tectra-ng-ui-input.d.ts.map +1 -0
- package/types/tectra-ng-ui-key-filter.d.ts +43 -0
- package/types/tectra-ng-ui-key-filter.d.ts.map +1 -0
- package/types/tectra-ng-ui-knob.d.ts +207 -0
- package/types/tectra-ng-ui-knob.d.ts.map +1 -0
- package/types/tectra-ng-ui-label.d.ts +53 -0
- package/types/tectra-ng-ui-label.d.ts.map +1 -0
- package/types/tectra-ng-ui-link.d.ts +223 -0
- package/types/tectra-ng-ui-link.d.ts.map +1 -0
- package/types/tectra-ng-ui-listbox.d.ts +131 -0
- package/types/tectra-ng-ui-listbox.d.ts.map +1 -0
- package/types/tectra-ng-ui-mention-textarea.d.ts +169 -0
- package/types/tectra-ng-ui-mention-textarea.d.ts.map +1 -0
- package/types/tectra-ng-ui-menu.d.ts +512 -0
- package/types/tectra-ng-ui-menu.d.ts.map +1 -0
- package/types/tectra-ng-ui-message.d.ts +390 -0
- package/types/tectra-ng-ui-message.d.ts.map +1 -0
- package/types/tectra-ng-ui-multiselect.d.ts +216 -0
- package/types/tectra-ng-ui-multiselect.d.ts.map +1 -0
- package/types/tectra-ng-ui-overlay-badge.d.ts +104 -0
- package/types/tectra-ng-ui-overlay-badge.d.ts.map +1 -0
- package/types/tectra-ng-ui-paginator.d.ts +293 -0
- package/types/tectra-ng-ui-paginator.d.ts.map +1 -0
- package/types/tectra-ng-ui-panel.d.ts +133 -0
- package/types/tectra-ng-ui-panel.d.ts.map +1 -0
- package/types/tectra-ng-ui-password-generator.d.ts +80 -0
- package/types/tectra-ng-ui-password-generator.d.ts.map +1 -0
- package/types/tectra-ng-ui-password.d.ts +271 -0
- package/types/tectra-ng-ui-password.d.ts.map +1 -0
- package/types/tectra-ng-ui-pill.d.ts +167 -0
- package/types/tectra-ng-ui-pill.d.ts.map +1 -0
- package/types/tectra-ng-ui-popover.d.ts +244 -0
- package/types/tectra-ng-ui-popover.d.ts.map +1 -0
- package/types/tectra-ng-ui-progress-bar.d.ts +151 -0
- package/types/tectra-ng-ui-progress-bar.d.ts.map +1 -0
- package/types/tectra-ng-ui-progress-spinner.d.ts +95 -0
- package/types/tectra-ng-ui-progress-spinner.d.ts.map +1 -0
- package/types/tectra-ng-ui-radio-button.d.ts +380 -0
- package/types/tectra-ng-ui-radio-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-rating.d.ts +195 -0
- package/types/tectra-ng-ui-rating.d.ts.map +1 -0
- package/types/tectra-ng-ui-select.d.ts +761 -0
- package/types/tectra-ng-ui-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-skeleton.d.ts +182 -0
- package/types/tectra-ng-ui-skeleton.d.ts.map +1 -0
- package/types/tectra-ng-ui-slider.d.ts +220 -0
- package/types/tectra-ng-ui-slider.d.ts.map +1 -0
- package/types/tectra-ng-ui-speed-dial.d.ts +175 -0
- package/types/tectra-ng-ui-speed-dial.d.ts.map +1 -0
- package/types/tectra-ng-ui-split-button.d.ts +139 -0
- package/types/tectra-ng-ui-split-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-status-icon.d.ts +105 -0
- package/types/tectra-ng-ui-status-icon.d.ts.map +1 -0
- package/types/tectra-ng-ui-table.d.ts +1301 -0
- package/types/tectra-ng-ui-table.d.ts.map +1 -0
- package/types/tectra-ng-ui-tag.d.ts +157 -0
- package/types/tectra-ng-ui-tag.d.ts.map +1 -0
- package/types/tectra-ng-ui-textarea.d.ts +146 -0
- package/types/tectra-ng-ui-textarea.d.ts.map +1 -0
- package/types/tectra-ng-ui-toast.d.ts +268 -0
- package/types/tectra-ng-ui-toast.d.ts.map +1 -0
- package/types/tectra-ng-ui-toggle-button.d.ts +184 -0
- package/types/tectra-ng-ui-toggle-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-toggle-switch.d.ts +226 -0
- package/types/tectra-ng-ui-toggle-switch.d.ts.map +1 -0
- package/types/tectra-ng-ui-tooltip.d.ts +275 -0
- package/types/tectra-ng-ui-tooltip.d.ts.map +1 -0
- package/types/tectra-ng-ui-tree-select.d.ts +339 -0
- package/types/tectra-ng-ui-tree-select.d.ts.map +1 -0
- package/types/tectra-ng-ui.d.ts +2 -0
- package/types/tectra-ng-ui.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tectra-ng-ui-toast.mjs","names":[],"sources":["../../../../packages/ui/toast/src/toast.service.ts","../../../../packages/ui/toast/src/toast-template.directive.ts","../../../../packages/ui/toast/src/toast.component.ts","../../../../packages/ui/toast/src/toast.component.html"],"sourcesContent":["import { Injectable, InjectionToken, Provider, inject, signal } from '@angular/core';\nimport { TxAnnouncer } from '@tectra-ng/core/a11y';\nimport { Subject } from 'rxjs';\nimport { TxToastAction, TxToastCloseReason, TxToastMessage, TxToastOptions, TxToastRef } from './toast.types';\n\nexport const TX_TOAST_OPTIONS = new InjectionToken<Partial<TxToastOptions>>('TX_TOAST_OPTIONS');\n\nexport function provideTxToast(options: Partial<TxToastOptions>): Provider {\n return { provide: TX_TOAST_OPTIONS, useValue: options };\n}\n\nconst DEFAULT_LIFE = 3000;\n\ntype TxToastText = Omit<TxToastOptions, 'severity' | 'text'>;\n\ninterface TxToastEntry {\n options: TxToastOptions;\n message: TxToastMessage;\n closed: Subject<TxToastCloseReason>;\n ref: TxToastRef;\n timer: ReturnType<typeof setTimeout> | undefined;\n startedAt: number;\n remaining: number;\n pauses: number;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class TxToastService {\n private announcer = inject(TxAnnouncer);\n private defaults = inject(TX_TOAST_OPTIONS, { optional: true }) ?? {};\n private entries = new Map<number, TxToastEntry>();\n private nextId = 1;\n private readonly messages = signal<TxToastMessage[]>([]);\n\n readonly toasts = this.messages.asReadonly();\n\n show(options: TxToastOptions): TxToastRef {\n const id = this.nextId++;\n const closed = new Subject<TxToastCloseReason>();\n const ref: TxToastRef = {\n id,\n closed: closed.asObservable(),\n close: () => this.close(id, 'api'),\n update: (patch) => this.update(id, patch),\n };\n const message = this.build(id, options, 0);\n const entry: TxToastEntry = { options, message, closed, ref, timer: undefined, startedAt: 0, remaining: message.life, pauses: 0 };\n this.entries.set(id, entry);\n this.messages.update((list) => [...list, message]);\n this.announce(message);\n this.schedule(entry);\n return ref;\n }\n\n success(text: string, options: TxToastText = {}): TxToastRef {\n return this.show({ ...options, severity: 'success', text });\n }\n\n info(text: string, options: TxToastText = {}): TxToastRef {\n return this.show({ ...options, severity: 'info', text });\n }\n\n warn(text: string, options: TxToastText = {}): TxToastRef {\n return this.show({ ...options, severity: 'warn', text });\n }\n\n error(text: string, options: TxToastText = {}): TxToastRef {\n return this.show({ ...options, severity: 'danger', text });\n }\n\n loading(text: string, options: TxToastText = {}): TxToastRef {\n return this.show({ ...options, loading: true, text });\n }\n\n close(id: number, reason: TxToastCloseReason = 'api'): void {\n const entry = this.entries.get(id);\n if (!entry) {\n return;\n }\n clearTimeout(entry.timer);\n this.entries.delete(id);\n this.messages.update((list) => list.filter((message) => message.id !== id));\n entry.closed.next(reason);\n entry.closed.complete();\n }\n\n clear(key?: string): void {\n for (const entry of [...this.entries.values()]) {\n if (key === undefined || entry.message.key === key) {\n this.close(entry.message.id, 'clear');\n }\n }\n }\n\n update(id: number, patch: Partial<TxToastOptions>): void {\n const entry = this.entries.get(id);\n if (!entry) {\n return;\n }\n const settled = patch.severity !== undefined && patch.loading === undefined ? { loading: false } : {};\n entry.options = { ...entry.options, ...settled, ...patch };\n const previous = entry.message;\n entry.message = this.build(id, entry.options, previous.version + 1, entry.pauses > 0);\n this.replace(entry.message);\n if (previous.title !== entry.message.title || previous.text !== entry.message.text) {\n this.announce(entry.message);\n }\n clearTimeout(entry.timer);\n entry.timer = undefined;\n entry.remaining = entry.message.life;\n if (entry.pauses === 0) {\n this.schedule(entry);\n }\n }\n\n run(id: number, action: TxToastAction): void {\n const entry = this.entries.get(id);\n if (!entry) {\n return;\n }\n action.run?.(entry.ref);\n if (!action.keepOpen) {\n this.close(id, 'action');\n }\n }\n\n pause(id: number): void {\n const entry = this.entries.get(id);\n if (!entry || entry.pauses++ > 0) {\n return;\n }\n if (entry.timer !== undefined) {\n clearTimeout(entry.timer);\n entry.timer = undefined;\n entry.remaining = Math.max(0, entry.remaining - (this.now() - entry.startedAt));\n }\n this.replace((entry.message = { ...entry.message, paused: true }));\n }\n\n resume(id: number): void {\n const entry = this.entries.get(id);\n if (!entry || entry.pauses === 0 || --entry.pauses > 0) {\n return;\n }\n this.replace((entry.message = { ...entry.message, paused: false }));\n this.schedule(entry);\n }\n\n private build(id: number, options: TxToastOptions, version: number, paused = false): TxToastMessage {\n const merged = { ...this.defaults, ...options };\n const loading = merged.loading ?? false;\n return {\n id,\n key: merged.key,\n severity: merged.severity ?? 'info',\n title: merged.title,\n text: merged.text,\n icon: merged.icon,\n loading,\n life: merged.life ?? DEFAULT_LIFE,\n sticky: merged.sticky ?? loading,\n closable: merged.closable ?? !loading,\n showProgress: merged.showProgress ?? false,\n actions: merged.actions ?? [],\n template: merged.template,\n data: merged.data,\n version,\n paused,\n };\n }\n\n private schedule(entry: TxToastEntry): void {\n const { message } = entry;\n if (message.sticky || message.life <= 0) {\n return;\n }\n entry.startedAt = this.now();\n entry.timer = setTimeout(() => this.close(message.id, 'timeout'), entry.remaining);\n }\n\n private replace(message: TxToastMessage): void {\n this.messages.update((list) => list.map((item) => (item.id === message.id ? message : item)));\n }\n\n private announce(message: TxToastMessage): void {\n const text = [message.title, message.text].filter(Boolean).join('. ');\n if (text) {\n void this.announcer.announce(text, message.severity === 'danger' || message.severity === 'warn' ? 'assertive' : 'polite');\n }\n }\n\n private now(): number {\n return Date.now();\n }\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport { TxToastContext } from './toast.types';\n\n@Directive({ selector: 'ng-template[txToastTemplate]' })\nexport class TxToastTemplate {\n readonly template = inject<TemplateRef<TxToastContext>>(TemplateRef);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n DestroyRef,\n ElementRef,\n afterNextRender,\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChild,\n inject,\n input,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectTranslations } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TxIcon, TxIconRegistry } from '@tectra-ng/icons';\nimport { TectraDeepPartial, TectraToastTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxProgressSpinner } from '@tectra-ng/ui/progress-spinner';\nimport { TxToastTemplate } from './toast-template.directive';\nimport { TxToastService } from './toast.service';\nimport { TxToastAction, TxToastContext, TxToastMessage, TxToastPart, TxToastPosition, TxToastSeverity } from './toast.types';\n\nconst ICONS: Record<TxToastSeverity, string> = {\n success: 'check',\n info: 'info-circle',\n warn: 'exclamation-triangle',\n danger: 'times',\n secondary: 'info-circle',\n contrast: 'info-circle',\n};\n\nconst SWIPE_THRESHOLD = 50;\nconst SWIPE_VELOCITY = 0.11;\n\ninterface TxToastSwipe {\n id: number;\n startX: number;\n startY: number;\n startedAt: number;\n}\n\n@Component({\n selector: 'tx-toast',\n imports: [NgTemplateOutlet, TxIcon, TxProgressSpinner],\n templateUrl: './toast.component.html',\n styleUrl: './toast.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-toast',\n role: 'region',\n '[attr.aria-label]': 'translations().notifications',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-position]': 'position()',\n '[attr.data-expanded]': 'expanded() ? \"\" : null',\n '[class.tx-toast--empty]': '!ordered().length',\n '(mouseenter)': 'setHovered(true)',\n '(mouseleave)': 'setHovered(false)',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class TxToast {\n private service = inject(TxToastService);\n private iconRegistry = inject(TxIconRegistry);\n private host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private document = inject(DOCUMENT);\n private swipe: TxToastSwipe | null = null;\n private pausedIds: number[] = [];\n\n readonly position = input<TxToastPosition>('bottom-center');\n readonly key = input<string | undefined>(undefined);\n readonly max = input<number, unknown>(3, { transform: numberAttribute });\n readonly inPlace = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly dt = input<TectraDeepPartial<TectraToastTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxToastPart, TxToast> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly customTemplate = contentChild(TxToastTemplate);\n\n readonly translations = injectTranslations();\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('toast', this, this.pt, this.ptOptions);\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-toast'), ...this.passThrough().root?.style }));\n\n private readonly hovered = signal(false);\n private readonly focused = signal(false);\n private readonly heights = signal<Record<number, number>>({});\n private readonly mounted = signal<Record<number, true>>({});\n readonly swiping = signal<{ id: number; x: number; y: number } | null>(null);\n\n readonly expanded = computed(() => this.hovered() || this.focused());\n readonly ordered = computed(() => [...this.service.toasts().filter((toast) => toast.key === this.key())].reverse());\n readonly frontHeight = computed(() => this.heights()[this.ordered()[0]?.id] ?? 0);\n readonly offsets = computed(() => {\n const heights = this.heights();\n const gap = this.gap();\n let offset = 0;\n return this.ordered().map((toast) => {\n const current = offset;\n offset += (heights[toast.id] ?? 0) + gap;\n return current;\n });\n });\n\n constructor() {\n afterNextRender(() => {\n if (!this.inPlace()) {\n this.document.body.appendChild(this.host);\n }\n });\n afterRenderEffect(() => {\n const toasts = this.ordered();\n const items = [...this.host.querySelectorAll<HTMLElement>(':scope > .tx-toast__item:not(.tx-toast__item--leave)')];\n const heights: Record<number, number> = {};\n toasts.forEach((toast, index) => {\n heights[toast.id] = items[index]?.querySelector<HTMLElement>('.tx-toast__pill')?.offsetHeight ?? 0;\n });\n if (JSON.stringify(heights) !== JSON.stringify(this.heights())) {\n this.heights.set(heights);\n }\n const fresh = toasts.filter((toast) => !this.mounted()[toast.id]);\n if (fresh.length) {\n const mount = () =>\n this.mounted.update((mounted) => ({ ...mounted, ...Object.fromEntries(fresh.map((toast) => [toast.id, true as const])) }));\n const view = this.document.defaultView;\n if (view?.requestAnimationFrame) {\n view.requestAnimationFrame(() => view.requestAnimationFrame(mount));\n } else {\n setTimeout(mount);\n }\n }\n if (this.expanded()) {\n this.pauseNew(toasts);\n }\n });\n inject(DestroyRef).onDestroy(() => {\n this.resumeAll();\n this.host.remove();\n });\n }\n\n isMounted(toast: TxToastMessage): boolean {\n return Boolean(this.mounted()[toast.id]);\n }\n\n heightOf(toast: TxToastMessage): number {\n return this.heights()[toast.id] ?? 0;\n }\n\n iconOf(toast: TxToastMessage): string | null {\n if (toast.icon === false) {\n return null;\n }\n const name = toast.icon ?? ICONS[toast.severity];\n return this.iconRegistry.has(name) ? name : null;\n }\n\n contextOf(toast: TxToastMessage): TxToastContext {\n return { $implicit: toast, close: () => this.service.close(toast.id, 'close') };\n }\n\n close(toast: TxToastMessage): void {\n this.service.close(toast.id, 'close');\n }\n\n run(toast: TxToastMessage, action: TxToastAction): void {\n this.service.run(toast.id, action);\n }\n\n setHovered(hovered: boolean): void {\n this.hovered.set(hovered);\n this.syncPause();\n }\n\n onFocusIn(): void {\n this.focused.set(true);\n this.syncPause();\n }\n\n onFocusOut(event: FocusEvent): void {\n if (!this.host.contains(event.relatedTarget as Node | null)) {\n this.focused.set(false);\n this.syncPause();\n }\n }\n\n onPointerDown(toast: TxToastMessage, event: PointerEvent): void {\n if (!toast.closable || event.button !== 0 || (event.target as Element).closest('button')) {\n return;\n }\n this.swipe = { id: toast.id, startX: event.clientX, startY: event.clientY, startedAt: Date.now() };\n (event.currentTarget as HTMLElement).setPointerCapture?.(event.pointerId);\n }\n\n onPointerMove(event: PointerEvent): void {\n if (!this.swipe) {\n return;\n }\n const x = event.clientX - this.swipe.startX;\n const y = event.clientY - this.swipe.startY;\n if (Math.abs(x) > 2 || Math.abs(y) > 2) {\n this.swiping.set(Math.abs(x) >= Math.abs(y) ? { id: this.swipe.id, x, y: 0 } : { id: this.swipe.id, x: 0, y });\n }\n }\n\n onPointerUp(): void {\n const swipe = this.swipe;\n const moved = this.swiping();\n this.swipe = null;\n this.swiping.set(null);\n if (!swipe || !moved || moved.id !== swipe.id) {\n return;\n }\n const distance = Math.max(Math.abs(moved.x), Math.abs(moved.y));\n const velocity = distance / Math.max(Date.now() - swipe.startedAt, 1);\n if (distance >= SWIPE_THRESHOLD || velocity > SWIPE_VELOCITY) {\n this.service.close(swipe.id, 'close');\n }\n }\n\n private gap(): number {\n const value = this.document.defaultView?.getComputedStyle(this.host).getPropertyValue('--tx-toast-gap');\n return parseFloat(value ?? '') || 8;\n }\n\n private syncPause(): void {\n if (this.expanded()) {\n this.pauseNew(this.ordered());\n } else {\n this.resumeAll();\n }\n }\n\n private pauseNew(toasts: TxToastMessage[]): void {\n toasts\n .filter((toast) => !this.pausedIds.includes(toast.id))\n .forEach((toast) => {\n this.pausedIds.push(toast.id);\n this.service.pause(toast.id);\n });\n }\n\n private resumeAll(): void {\n const ids = this.pausedIds;\n this.pausedIds = [];\n ids.forEach((id) => this.service.resume(id));\n }\n}\n","@for (toast of ordered(); track toast.id; let index = $index) {\n <div\n class=\"tx-toast__item\"\n animate.leave=\"tx-toast__item--leave\"\n [attr.data-front]=\"index === 0 ? '' : null\"\n [attr.data-visible]=\"index < max() ? '' : null\"\n [attr.data-mounted]=\"isMounted(toast) ? '' : null\"\n [attr.data-swiping]=\"swiping()?.id === toast.id ? '' : null\"\n [style.--_index]=\"index\"\n [style.--_z]=\"ordered().length - index\"\n [style.--_offset.px]=\"offsets()[index]\"\n [style.--_height.px]=\"heightOf(toast)\"\n [style.--_front-height.px]=\"frontHeight()\"\n [style.--_swipe-x.px]=\"swiping()?.id === toast.id ? swiping()?.x : 0\"\n [style.--_swipe-y.px]=\"swiping()?.id === toast.id ? swiping()?.y : 0\"\n [attr.aria-hidden]=\"index < max() ? null : true\"\n (pointerdown)=\"onPointerDown(toast, $event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp()\"\n (pointercancel)=\"onPointerUp()\"\n >\n <div\n class=\"tx-toast__pill\"\n [class]=\"passThrough().item?.class\"\n [style]=\"passThrough().item?.style\"\n [attr.data-severity]=\"toast.severity\"\n [class.tx-toast__pill--loading]=\"toast.loading\"\n [attr.aria-busy]=\"toast.loading || null\"\n >\n @if (toast.template ?? customTemplate()?.template; as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"contextOf(toast)\" />\n } @else {\n @if (toast.loading) {\n <span class=\"tx-toast__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n <tx-progress-spinner class=\"tx-toast__spinner\" [size]=\"14\" [strokeWidth]=\"6\" />\n </span>\n } @else if (iconOf(toast); as icon) {\n <span class=\"tx-toast__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n <tx-icon [name]=\"icon\" />\n </span>\n }\n <span class=\"tx-toast__body\" [class]=\"passThrough().body?.class\" [style]=\"passThrough().body?.style\">\n @if (toast.title) {\n <span\n class=\"tx-toast__title\"\n [class.tx-toast__title--hidden]=\"!!toast.text\"\n [class]=\"passThrough().title?.class\"\n [style]=\"passThrough().title?.style\"\n >{{ toast.title }}</span\n >\n }\n @if (toast.text) {\n <span class=\"tx-toast__text\" [class]=\"passThrough().text?.class\" [style]=\"passThrough().text?.style\">{{ toast.text }}</span>\n }\n </span>\n @if (toast.actions.length) {\n <span class=\"tx-toast__actions\" [class]=\"passThrough().actions?.class\" [style]=\"passThrough().actions?.style\">\n @for (action of toast.actions; track action.label) {\n <button type=\"button\" class=\"tx-toast__action\" (click)=\"run(toast, action)\">{{ action.label }}</button>\n }\n </span>\n }\n }\n @if (toast.closable) {\n <button\n type=\"button\"\n class=\"tx-toast__close\"\n [class]=\"passThrough().closeButton?.class\"\n [style]=\"passThrough().closeButton?.style\"\n [attr.aria-label]=\"translations().close\"\n (click)=\"close(toast)\"\n >\n <tx-icon name=\"times\" />\n </button>\n }\n @if (toast.showProgress && !toast.sticky && toast.life > 0) {\n <span class=\"tx-toast__progress-track\" aria-hidden=\"true\">\n @for (version of [toast.version]; track version) {\n <span\n class=\"tx-toast__progress\"\n [class]=\"passThrough().progress?.class\"\n [style]=\"passThrough().progress?.style\"\n [style.animation-duration.ms]=\"toast.life\"\n [class.tx-toast__progress--paused]=\"toast.paused\"\n ></span>\n }\n </span>\n }\n </div>\n </div>\n}\n"],"mappings":";;;;;;;;;;;AAKA,MAAa,mBAAmB,IAAI,eAAwC,kBAAkB;AAE9F,SAAgB,eAAe,SAAgC;CAC7D,OAAO;EAAE,SAAS;EAAkB,UAAU;CAAO;AACvD;AAEA,MAAM,eAAe;AAgBrB,IAAa,iBAAb,MAAa,eAAc;CACjB,YAAY,OAAO,WAAW;CAC9B,WAAW,OAAO,kBAAkB,EAAE,UAAU,KAAI,CAAE,KAAK,CAAA;CAC3D,0BAAU,IAAI,IAAG;CACjB,SAAS;CACA,WAAW,OAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE/C,SAAS,KAAK,SAAS,WAAU;CAE1C,KAAK,SAAuB;EAC1B,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,IAAI,QAAO;EAC1B,MAAM,MAAkB;GACtB;GACA,QAAQ,OAAO,aAAY;GAC3B,aAAa,KAAK,MAAM,IAAI,KAAK;GACjC,SAAS,UAAU,KAAK,OAAO,IAAI,KAAK;EACzC;EACD,MAAM,UAAU,KAAK,MAAM,IAAI,SAAS,CAAC;EACzC,MAAM,QAAsB;GAAE;GAAS;GAAS;GAAQ;GAAK,OAAO;GAAW,WAAW;GAAG,WAAW,QAAQ;GAAM,QAAQ;EAAC;EAC/H,KAAK,QAAQ,IAAI,IAAI,KAAK;EAC1B,KAAK,SAAS,QAAQ,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC;EACjD,KAAK,SAAS,OAAO;EACrB,KAAK,SAAS,KAAK;EACnB,OAAO;CACT;CAEA,QAAQ,MAAc,UAAuB,CAAA,GAAE;EAC7C,OAAO,KAAK,KAAK;GAAE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Component, booleanAttribute, computed, forwardRef, inject, input, output } from "@angular/core";
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { injectFluid } from "@tectra-ng/core/fluid";
|
|
6
|
+
import { TxRipple } from "@tectra-ng/core/ripple";
|
|
7
|
+
import { TxFormControlBase } from "@tectra-ng/core/forms";
|
|
8
|
+
import { optionalBoolean, optionalNumber } from "@tectra-ng/core/utils";
|
|
9
|
+
import { TxIcon, TxIconRegistry } from "@tectra-ng/icons";
|
|
10
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
11
|
+
var TxToggleButton = class TxToggleButton extends TxFormControlBase {
|
|
12
|
+
txIconRegistry = inject(TxIconRegistry);
|
|
13
|
+
onLabel = input("Yes", ...ngDevMode ? [{ debugName: "onLabel" }] : /* istanbul ignore next */ []);
|
|
14
|
+
offLabel = input("No", ...ngDevMode ? [{ debugName: "offLabel" }] : /* istanbul ignore next */ []);
|
|
15
|
+
onIcon = input(void 0, ...ngDevMode ? [{ debugName: "onIcon" }] : /* istanbul ignore next */ []);
|
|
16
|
+
offIcon = input(void 0, ...ngDevMode ? [{ debugName: "offIcon" }] : /* istanbul ignore next */ []);
|
|
17
|
+
iconPos = input("left", ...ngDevMode ? [{ debugName: "iconPos" }] : /* istanbul ignore next */ []);
|
|
18
|
+
size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
19
|
+
allowEmpty = input(true, {
|
|
20
|
+
...ngDevMode ? { debugName: "allowEmpty" } : /* istanbul ignore next */ {},
|
|
21
|
+
transform: booleanAttribute
|
|
22
|
+
});
|
|
23
|
+
invalid = input(false, {
|
|
24
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
25
|
+
transform: booleanAttribute
|
|
26
|
+
});
|
|
27
|
+
fluid = input(void 0, {
|
|
28
|
+
...ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {},
|
|
29
|
+
transform: optionalBoolean
|
|
30
|
+
});
|
|
31
|
+
disabledInput = input(false, {
|
|
32
|
+
...ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {},
|
|
33
|
+
alias: "disabled",
|
|
34
|
+
transform: booleanAttribute
|
|
35
|
+
});
|
|
36
|
+
tabindex = input(void 0, {
|
|
37
|
+
...ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {},
|
|
38
|
+
transform: optionalNumber
|
|
39
|
+
});
|
|
40
|
+
ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
41
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
42
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
43
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
44
|
+
unstyled = input(void 0, {
|
|
45
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
46
|
+
transform: optionalBoolean
|
|
47
|
+
});
|
|
48
|
+
changed = output();
|
|
49
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
50
|
+
isFluid = injectFluid(this.fluid);
|
|
51
|
+
passThrough = injectPassThrough("toggleButton", this, this.pt, this.ptOptions);
|
|
52
|
+
checked = computed(() => !!this.value(), ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
|
|
53
|
+
isDisabled = computed(() => this.disabled() || this.disabledInput(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
54
|
+
label = computed(() => this.checked() ? this.onLabel() : this.offLabel(), ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
55
|
+
currentIcon = computed(() => this.checked() ? this.onIcon() : this.offIcon(), ...ngDevMode ? [{ debugName: "currentIcon" }] : /* istanbul ignore next */ []);
|
|
56
|
+
iconName = computed(() => {
|
|
57
|
+
const icon = this.currentIcon();
|
|
58
|
+
return this.txIconRegistry.has(icon) ? icon : null;
|
|
59
|
+
}, ...ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []);
|
|
60
|
+
hostStyle = computed(() => ({
|
|
61
|
+
...toStyleObject(this.dt(), "--tx-toggle-button"),
|
|
62
|
+
...this.passThrough().root?.style
|
|
63
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
64
|
+
toggle(event) {
|
|
65
|
+
if (this.isDisabled() || this.checked() && !this.allowEmpty()) return;
|
|
66
|
+
const checked = !this.checked();
|
|
67
|
+
this.updateValue(checked);
|
|
68
|
+
this.changed.emit({
|
|
69
|
+
originalEvent: event,
|
|
70
|
+
checked
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
onBlur() {
|
|
74
|
+
this.markTouched();
|
|
75
|
+
}
|
|
76
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
77
|
+
minVersion: "12.0.0",
|
|
78
|
+
version: "22.2.3",
|
|
79
|
+
ngImport: i0,
|
|
80
|
+
type: TxToggleButton,
|
|
81
|
+
deps: null,
|
|
82
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
83
|
+
});
|
|
84
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
85
|
+
minVersion: "17.0.0",
|
|
86
|
+
version: "22.2.3",
|
|
87
|
+
type: TxToggleButton,
|
|
88
|
+
isStandalone: true,
|
|
89
|
+
selector: "tx-toggle-button",
|
|
90
|
+
inputs: {
|
|
91
|
+
onLabel: {
|
|
92
|
+
classPropertyName: "onLabel",
|
|
93
|
+
publicName: "onLabel",
|
|
94
|
+
isSignal: true,
|
|
95
|
+
isRequired: false,
|
|
96
|
+
transformFunction: null
|
|
97
|
+
},
|
|
98
|
+
offLabel: {
|
|
99
|
+
classPropertyName: "offLabel",
|
|
100
|
+
publicName: "offLabel",
|
|
101
|
+
isSignal: true,
|
|
102
|
+
isRequired: false,
|
|
103
|
+
transformFunction: null
|
|
104
|
+
},
|
|
105
|
+
onIcon: {
|
|
106
|
+
classPropertyName: "onIcon",
|
|
107
|
+
publicName: "onIcon",
|
|
108
|
+
isSignal: true,
|
|
109
|
+
isRequired: false,
|
|
110
|
+
transformFunction: null
|
|
111
|
+
},
|
|
112
|
+
offIcon: {
|
|
113
|
+
classPropertyName: "offIcon",
|
|
114
|
+
publicName: "offIcon",
|
|
115
|
+
isSignal: true,
|
|
116
|
+
isRequired: false,
|
|
117
|
+
transformFunction: null
|
|
118
|
+
},
|
|
119
|
+
iconPos: {
|
|
120
|
+
classPropertyName: "iconPos",
|
|
121
|
+
publicName: "iconPos",
|
|
122
|
+
isSignal: true,
|
|
123
|
+
isRequired: false,
|
|
124
|
+
transformFunction: null
|
|
125
|
+
},
|
|
126
|
+
size: {
|
|
127
|
+
classPropertyName: "size",
|
|
128
|
+
publicName: "size",
|
|
129
|
+
isSignal: true,
|
|
130
|
+
isRequired: false,
|
|
131
|
+
transformFunction: null
|
|
132
|
+
},
|
|
133
|
+
allowEmpty: {
|
|
134
|
+
classPropertyName: "allowEmpty",
|
|
135
|
+
publicName: "allowEmpty",
|
|
136
|
+
isSignal: true,
|
|
137
|
+
isRequired: false,
|
|
138
|
+
transformFunction: null
|
|
139
|
+
},
|
|
140
|
+
invalid: {
|
|
141
|
+
classPropertyName: "invalid",
|
|
142
|
+
publicName: "invalid",
|
|
143
|
+
isSignal: true,
|
|
144
|
+
isRequired: false,
|
|
145
|
+
transformFunction: null
|
|
146
|
+
},
|
|
147
|
+
fluid: {
|
|
148
|
+
classPropertyName: "fluid",
|
|
149
|
+
publicName: "fluid",
|
|
150
|
+
isSignal: true,
|
|
151
|
+
isRequired: false,
|
|
152
|
+
transformFunction: null
|
|
153
|
+
},
|
|
154
|
+
disabledInput: {
|
|
155
|
+
classPropertyName: "disabledInput",
|
|
156
|
+
publicName: "disabled",
|
|
157
|
+
isSignal: true,
|
|
158
|
+
isRequired: false,
|
|
159
|
+
transformFunction: null
|
|
160
|
+
},
|
|
161
|
+
tabindex: {
|
|
162
|
+
classPropertyName: "tabindex",
|
|
163
|
+
publicName: "tabindex",
|
|
164
|
+
isSignal: true,
|
|
165
|
+
isRequired: false,
|
|
166
|
+
transformFunction: null
|
|
167
|
+
},
|
|
168
|
+
ariaLabel: {
|
|
169
|
+
classPropertyName: "ariaLabel",
|
|
170
|
+
publicName: "ariaLabel",
|
|
171
|
+
isSignal: true,
|
|
172
|
+
isRequired: false,
|
|
173
|
+
transformFunction: null
|
|
174
|
+
},
|
|
175
|
+
dt: {
|
|
176
|
+
classPropertyName: "dt",
|
|
177
|
+
publicName: "dt",
|
|
178
|
+
isSignal: true,
|
|
179
|
+
isRequired: false,
|
|
180
|
+
transformFunction: null
|
|
181
|
+
},
|
|
182
|
+
pt: {
|
|
183
|
+
classPropertyName: "pt",
|
|
184
|
+
publicName: "pt",
|
|
185
|
+
isSignal: true,
|
|
186
|
+
isRequired: false,
|
|
187
|
+
transformFunction: null
|
|
188
|
+
},
|
|
189
|
+
ptOptions: {
|
|
190
|
+
classPropertyName: "ptOptions",
|
|
191
|
+
publicName: "ptOptions",
|
|
192
|
+
isSignal: true,
|
|
193
|
+
isRequired: false,
|
|
194
|
+
transformFunction: null
|
|
195
|
+
},
|
|
196
|
+
unstyled: {
|
|
197
|
+
classPropertyName: "unstyled",
|
|
198
|
+
publicName: "unstyled",
|
|
199
|
+
isSignal: true,
|
|
200
|
+
isRequired: false,
|
|
201
|
+
transformFunction: null
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
outputs: { changed: "changed" },
|
|
205
|
+
host: {
|
|
206
|
+
properties: {
|
|
207
|
+
"class": "passThrough().root?.class",
|
|
208
|
+
"style": "hostStyle()",
|
|
209
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
210
|
+
"attr.data-size": "size()",
|
|
211
|
+
"attr.data-icon-pos": "iconPos()",
|
|
212
|
+
"class.tx-toggle-button--checked": "checked()",
|
|
213
|
+
"class.tx-toggle-button--disabled": "isDisabled()",
|
|
214
|
+
"class.tx-toggle-button--invalid": "invalid()",
|
|
215
|
+
"class.tx-toggle-button--fluid": "isFluid()"
|
|
216
|
+
},
|
|
217
|
+
classAttribute: "tx-toggle-button"
|
|
218
|
+
},
|
|
219
|
+
providers: [{
|
|
220
|
+
provide: NG_VALUE_ACCESSOR,
|
|
221
|
+
useExisting: forwardRef(() => TxToggleButton),
|
|
222
|
+
multi: true
|
|
223
|
+
}],
|
|
224
|
+
usesInheritance: true,
|
|
225
|
+
ngImport: i0,
|
|
226
|
+
template: "<button\n txRipple\n type=\"button\"\n class=\"tx-toggle-button__control\"\n [attr.aria-pressed]=\"checked()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"invalid() || null\"\n [attr.tabindex]=\"tabindex() ?? null\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle($event)\"\n (blur)=\"onBlur()\"\n>\n <span class=\"tx-toggle-button__content\" [class]=\"passThrough().content?.class\" [style]=\"passThrough().content?.style\">\n @if (currentIcon(); as icon) {\n <span class=\"tx-toggle-button__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n @if (iconName(); as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"icon\"></span>\n }\n </span>\n }\n <span class=\"tx-toggle-button__label\" [class]=\"passThrough().label?.class\" [style]=\"passThrough().label?.style\">{{ label() }}</span>\n </span>\n</button>\n",
|
|
227
|
+
styles: [":host([data-styled]){display:inline-flex}:host([data-styled].tx-toggle-button--fluid){display:flex;width:100%}:host([data-styled].tx-toggle-button--fluid) .tx-toggle-button__control{flex:1}:host([data-styled]) .tx-toggle-button__control{display:inline-flex;align-items:center;justify-content:center;padding:var(--tx-toggle-button-padding);border:1px solid var(--tx-toggle-button-border-color);border-radius:var(--tx-toggle-button-border-radius);background:var(--tx-toggle-button-background);color:var(--tx-toggle-button-color);font-family:var(--tx-font-family);font-size:var(--tx-toggle-button-font-size);font-weight:var(--tx-toggle-button-font-weight);line-height:1.2;cursor:pointer;transition:background-color var(--tx-toggle-button-transition-duration),border-color var(--tx-toggle-button-transition-duration),color var(--tx-toggle-button-transition-duration)}:host([data-styled]) .tx-toggle-button__control:hover:not(:disabled){background:var(--tx-toggle-button-hover-background);color:var(--tx-toggle-button-hover-color)}:host([data-styled]) .tx-toggle-button__control:hover:not(:disabled) .tx-toggle-button__icon{color:var(--tx-toggle-button-icon-hover-color)}:host([data-styled]) .tx-toggle-button__control:focus-visible{outline:var(--tx-toggle-button-focus-ring-width) var(--tx-toggle-button-focus-ring-style) var(--tx-toggle-button-focus-ring-color);outline-offset:var(--tx-toggle-button-focus-ring-offset)}:host([data-styled]) .tx-toggle-button__control:disabled{border-color:var(--tx-toggle-button-disabled-border-color);background:var(--tx-toggle-button-disabled-background);color:var(--tx-toggle-button-disabled-color);cursor:not-allowed}:host([data-styled]) .tx-toggle-button__content{display:inline-flex;align-items:center;justify-content:center;gap:var(--tx-toggle-button-gap);padding:var(--tx-toggle-button-content-padding);border-radius:var(--tx-toggle-button-content-border-radius);transition:background-color var(--tx-toggle-button-transition-duration),box-shadow var(--tx-toggle-button-transition-duration)}:host([data-styled]) .tx-toggle-button__icon{display:inline-flex;color:var(--tx-toggle-button-icon-color);transition:color var(--tx-motion-duration) var(--tx-motion-easing)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control{border-color:var(--tx-toggle-button-checked-border-color);background:var(--tx-toggle-button-checked-background);color:var(--tx-toggle-button-checked-color)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control .tx-toggle-button__content{background:var(--tx-toggle-button-content-checked-background);box-shadow:var(--tx-toggle-button-content-checked-shadow)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control .tx-toggle-button__icon{color:var(--tx-toggle-button-icon-checked-color)}:host([data-styled].tx-toggle-button--invalid) .tx-toggle-button__control{border-color:var(--tx-toggle-button-invalid-border-color)}:host([data-styled][data-size=small]) .tx-toggle-button__control{padding:var(--tx-toggle-button-sm-padding);font-size:var(--tx-toggle-button-sm-font-size)}:host([data-styled][data-size=small]) .tx-toggle-button__content{padding:var(--tx-toggle-button-content-sm-padding)}:host([data-styled][data-size=large]) .tx-toggle-button__control{padding:var(--tx-toggle-button-lg-padding);font-size:var(--tx-toggle-button-lg-font-size)}:host([data-styled][data-size=large]) .tx-toggle-button__content{padding:var(--tx-toggle-button-content-lg-padding)}:host([data-styled][data-icon-pos=right]) .tx-toggle-button__icon{order:1}\n"],
|
|
228
|
+
dependencies: [{
|
|
229
|
+
kind: "component",
|
|
230
|
+
type: TxIcon,
|
|
231
|
+
selector: "tx-icon",
|
|
232
|
+
inputs: ["name"]
|
|
233
|
+
}, {
|
|
234
|
+
kind: "directive",
|
|
235
|
+
type: TxRipple,
|
|
236
|
+
selector: "[txRipple]",
|
|
237
|
+
inputs: [
|
|
238
|
+
"ripple",
|
|
239
|
+
"rippleDisabled",
|
|
240
|
+
"rippleCentered",
|
|
241
|
+
"rippleColor"
|
|
242
|
+
]
|
|
243
|
+
}],
|
|
244
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
248
|
+
minVersion: "12.0.0",
|
|
249
|
+
version: "22.2.3",
|
|
250
|
+
ngImport: i0,
|
|
251
|
+
type: TxToggleButton,
|
|
252
|
+
decorators: [{
|
|
253
|
+
type: Component,
|
|
254
|
+
args: [{
|
|
255
|
+
selector: "tx-toggle-button",
|
|
256
|
+
imports: [TxIcon, TxRipple],
|
|
257
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
258
|
+
providers: [{
|
|
259
|
+
provide: NG_VALUE_ACCESSOR,
|
|
260
|
+
useExisting: forwardRef(() => TxToggleButton),
|
|
261
|
+
multi: true
|
|
262
|
+
}],
|
|
263
|
+
host: {
|
|
264
|
+
class: "tx-toggle-button",
|
|
265
|
+
"[class]": "passThrough().root?.class",
|
|
266
|
+
"[style]": "hostStyle()",
|
|
267
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
268
|
+
"[attr.data-size]": "size()",
|
|
269
|
+
"[attr.data-icon-pos]": "iconPos()",
|
|
270
|
+
"[class.tx-toggle-button--checked]": "checked()",
|
|
271
|
+
"[class.tx-toggle-button--disabled]": "isDisabled()",
|
|
272
|
+
"[class.tx-toggle-button--invalid]": "invalid()",
|
|
273
|
+
"[class.tx-toggle-button--fluid]": "isFluid()"
|
|
274
|
+
},
|
|
275
|
+
template: "<button\n txRipple\n type=\"button\"\n class=\"tx-toggle-button__control\"\n [attr.aria-pressed]=\"checked()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"invalid() || null\"\n [attr.tabindex]=\"tabindex() ?? null\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle($event)\"\n (blur)=\"onBlur()\"\n>\n <span class=\"tx-toggle-button__content\" [class]=\"passThrough().content?.class\" [style]=\"passThrough().content?.style\">\n @if (currentIcon(); as icon) {\n <span class=\"tx-toggle-button__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n @if (iconName(); as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"icon\"></span>\n }\n </span>\n }\n <span class=\"tx-toggle-button__label\" [class]=\"passThrough().label?.class\" [style]=\"passThrough().label?.style\">{{ label() }}</span>\n </span>\n</button>\n",
|
|
276
|
+
styles: [":host([data-styled]){display:inline-flex}:host([data-styled].tx-toggle-button--fluid){display:flex;width:100%}:host([data-styled].tx-toggle-button--fluid) .tx-toggle-button__control{flex:1}:host([data-styled]) .tx-toggle-button__control{display:inline-flex;align-items:center;justify-content:center;padding:var(--tx-toggle-button-padding);border:1px solid var(--tx-toggle-button-border-color);border-radius:var(--tx-toggle-button-border-radius);background:var(--tx-toggle-button-background);color:var(--tx-toggle-button-color);font-family:var(--tx-font-family);font-size:var(--tx-toggle-button-font-size);font-weight:var(--tx-toggle-button-font-weight);line-height:1.2;cursor:pointer;transition:background-color var(--tx-toggle-button-transition-duration),border-color var(--tx-toggle-button-transition-duration),color var(--tx-toggle-button-transition-duration)}:host([data-styled]) .tx-toggle-button__control:hover:not(:disabled){background:var(--tx-toggle-button-hover-background);color:var(--tx-toggle-button-hover-color)}:host([data-styled]) .tx-toggle-button__control:hover:not(:disabled) .tx-toggle-button__icon{color:var(--tx-toggle-button-icon-hover-color)}:host([data-styled]) .tx-toggle-button__control:focus-visible{outline:var(--tx-toggle-button-focus-ring-width) var(--tx-toggle-button-focus-ring-style) var(--tx-toggle-button-focus-ring-color);outline-offset:var(--tx-toggle-button-focus-ring-offset)}:host([data-styled]) .tx-toggle-button__control:disabled{border-color:var(--tx-toggle-button-disabled-border-color);background:var(--tx-toggle-button-disabled-background);color:var(--tx-toggle-button-disabled-color);cursor:not-allowed}:host([data-styled]) .tx-toggle-button__content{display:inline-flex;align-items:center;justify-content:center;gap:var(--tx-toggle-button-gap);padding:var(--tx-toggle-button-content-padding);border-radius:var(--tx-toggle-button-content-border-radius);transition:background-color var(--tx-toggle-button-transition-duration),box-shadow var(--tx-toggle-button-transition-duration)}:host([data-styled]) .tx-toggle-button__icon{display:inline-flex;color:var(--tx-toggle-button-icon-color);transition:color var(--tx-motion-duration) var(--tx-motion-easing)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control{border-color:var(--tx-toggle-button-checked-border-color);background:var(--tx-toggle-button-checked-background);color:var(--tx-toggle-button-checked-color)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control .tx-toggle-button__content{background:var(--tx-toggle-button-content-checked-background);box-shadow:var(--tx-toggle-button-content-checked-shadow)}:host([data-styled].tx-toggle-button--checked) .tx-toggle-button__control .tx-toggle-button__icon{color:var(--tx-toggle-button-icon-checked-color)}:host([data-styled].tx-toggle-button--invalid) .tx-toggle-button__control{border-color:var(--tx-toggle-button-invalid-border-color)}:host([data-styled][data-size=small]) .tx-toggle-button__control{padding:var(--tx-toggle-button-sm-padding);font-size:var(--tx-toggle-button-sm-font-size)}:host([data-styled][data-size=small]) .tx-toggle-button__content{padding:var(--tx-toggle-button-content-sm-padding)}:host([data-styled][data-size=large]) .tx-toggle-button__control{padding:var(--tx-toggle-button-lg-padding);font-size:var(--tx-toggle-button-lg-font-size)}:host([data-styled][data-size=large]) .tx-toggle-button__content{padding:var(--tx-toggle-button-content-lg-padding)}:host([data-styled][data-icon-pos=right]) .tx-toggle-button__icon{order:1}\n"]
|
|
277
|
+
}]
|
|
278
|
+
}],
|
|
279
|
+
propDecorators: {
|
|
280
|
+
onLabel: [{
|
|
281
|
+
type: i0.Input,
|
|
282
|
+
args: [{
|
|
283
|
+
isSignal: true,
|
|
284
|
+
alias: "onLabel",
|
|
285
|
+
required: false
|
|
286
|
+
}]
|
|
287
|
+
}],
|
|
288
|
+
offLabel: [{
|
|
289
|
+
type: i0.Input,
|
|
290
|
+
args: [{
|
|
291
|
+
isSignal: true,
|
|
292
|
+
alias: "offLabel",
|
|
293
|
+
required: false
|
|
294
|
+
}]
|
|
295
|
+
}],
|
|
296
|
+
onIcon: [{
|
|
297
|
+
type: i0.Input,
|
|
298
|
+
args: [{
|
|
299
|
+
isSignal: true,
|
|
300
|
+
alias: "onIcon",
|
|
301
|
+
required: false
|
|
302
|
+
}]
|
|
303
|
+
}],
|
|
304
|
+
offIcon: [{
|
|
305
|
+
type: i0.Input,
|
|
306
|
+
args: [{
|
|
307
|
+
isSignal: true,
|
|
308
|
+
alias: "offIcon",
|
|
309
|
+
required: false
|
|
310
|
+
}]
|
|
311
|
+
}],
|
|
312
|
+
iconPos: [{
|
|
313
|
+
type: i0.Input,
|
|
314
|
+
args: [{
|
|
315
|
+
isSignal: true,
|
|
316
|
+
alias: "iconPos",
|
|
317
|
+
required: false
|
|
318
|
+
}]
|
|
319
|
+
}],
|
|
320
|
+
size: [{
|
|
321
|
+
type: i0.Input,
|
|
322
|
+
args: [{
|
|
323
|
+
isSignal: true,
|
|
324
|
+
alias: "size",
|
|
325
|
+
required: false
|
|
326
|
+
}]
|
|
327
|
+
}],
|
|
328
|
+
allowEmpty: [{
|
|
329
|
+
type: i0.Input,
|
|
330
|
+
args: [{
|
|
331
|
+
isSignal: true,
|
|
332
|
+
alias: "allowEmpty",
|
|
333
|
+
required: false
|
|
334
|
+
}]
|
|
335
|
+
}],
|
|
336
|
+
invalid: [{
|
|
337
|
+
type: i0.Input,
|
|
338
|
+
args: [{
|
|
339
|
+
isSignal: true,
|
|
340
|
+
alias: "invalid",
|
|
341
|
+
required: false
|
|
342
|
+
}]
|
|
343
|
+
}],
|
|
344
|
+
fluid: [{
|
|
345
|
+
type: i0.Input,
|
|
346
|
+
args: [{
|
|
347
|
+
isSignal: true,
|
|
348
|
+
alias: "fluid",
|
|
349
|
+
required: false
|
|
350
|
+
}]
|
|
351
|
+
}],
|
|
352
|
+
disabledInput: [{
|
|
353
|
+
type: i0.Input,
|
|
354
|
+
args: [{
|
|
355
|
+
isSignal: true,
|
|
356
|
+
alias: "disabled",
|
|
357
|
+
required: false
|
|
358
|
+
}]
|
|
359
|
+
}],
|
|
360
|
+
tabindex: [{
|
|
361
|
+
type: i0.Input,
|
|
362
|
+
args: [{
|
|
363
|
+
isSignal: true,
|
|
364
|
+
alias: "tabindex",
|
|
365
|
+
required: false
|
|
366
|
+
}]
|
|
367
|
+
}],
|
|
368
|
+
ariaLabel: [{
|
|
369
|
+
type: i0.Input,
|
|
370
|
+
args: [{
|
|
371
|
+
isSignal: true,
|
|
372
|
+
alias: "ariaLabel",
|
|
373
|
+
required: false
|
|
374
|
+
}]
|
|
375
|
+
}],
|
|
376
|
+
dt: [{
|
|
377
|
+
type: i0.Input,
|
|
378
|
+
args: [{
|
|
379
|
+
isSignal: true,
|
|
380
|
+
alias: "dt",
|
|
381
|
+
required: false
|
|
382
|
+
}]
|
|
383
|
+
}],
|
|
384
|
+
pt: [{
|
|
385
|
+
type: i0.Input,
|
|
386
|
+
args: [{
|
|
387
|
+
isSignal: true,
|
|
388
|
+
alias: "pt",
|
|
389
|
+
required: false
|
|
390
|
+
}]
|
|
391
|
+
}],
|
|
392
|
+
ptOptions: [{
|
|
393
|
+
type: i0.Input,
|
|
394
|
+
args: [{
|
|
395
|
+
isSignal: true,
|
|
396
|
+
alias: "ptOptions",
|
|
397
|
+
required: false
|
|
398
|
+
}]
|
|
399
|
+
}],
|
|
400
|
+
unstyled: [{
|
|
401
|
+
type: i0.Input,
|
|
402
|
+
args: [{
|
|
403
|
+
isSignal: true,
|
|
404
|
+
alias: "unstyled",
|
|
405
|
+
required: false
|
|
406
|
+
}]
|
|
407
|
+
}],
|
|
408
|
+
changed: [{
|
|
409
|
+
type: i0.Output,
|
|
410
|
+
args: ["changed"]
|
|
411
|
+
}]
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
export { TxToggleButton };
|
|
415
|
+
|
|
416
|
+
//# sourceMappingURL=tectra-ng-ui-toggle-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tectra-ng-ui-toggle-button.mjs","names":[],"sources":["../../../../packages/ui/toggle-button/src/toggle-button.component.ts","../../../../packages/ui/toggle-button/src/toggle-button.component.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectFluid } from '@tectra-ng/core/fluid';\nimport { TxRipple } from '@tectra-ng/core/ripple';\nimport { TxFormControlBase } from '@tectra-ng/core/forms';\nimport { optionalBoolean, optionalNumber } from '@tectra-ng/core/utils';\nimport { TxIcon, TxIconName, TxIconRegistry } from '@tectra-ng/icons';\nimport { TectraDeepPartial, TectraToggleButtonTokens, toStyleObject } from '@tectra-ng/themes';\nimport {\n TxToggleButtonChangeEvent,\n TxToggleButtonIconPosition,\n TxToggleButtonPart,\n TxToggleButtonSize,\n} from './toggle-button.types';\n\n@Component({\n selector: 'tx-toggle-button',\n imports: [TxIcon, TxRipple],\n templateUrl: './toggle-button.component.html',\n styleUrl: './toggle-button.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TxToggleButton), multi: true }],\n host: {\n class: 'tx-toggle-button',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-size]': 'size()',\n '[attr.data-icon-pos]': 'iconPos()',\n '[class.tx-toggle-button--checked]': 'checked()',\n '[class.tx-toggle-button--disabled]': 'isDisabled()',\n '[class.tx-toggle-button--invalid]': 'invalid()',\n '[class.tx-toggle-button--fluid]': 'isFluid()',\n },\n})\nexport class TxToggleButton extends TxFormControlBase<boolean> {\n private txIconRegistry = inject(TxIconRegistry);\n\n readonly onLabel = input<string>('Yes');\n readonly offLabel = input<string>('No');\n readonly onIcon = input<TxIconName | (string & {}) | undefined>(undefined);\n readonly offIcon = input<TxIconName | (string & {}) | undefined>(undefined);\n readonly iconPos = input<TxToggleButtonIconPosition>('left');\n readonly size = input<TxToggleButtonSize>('medium');\n readonly allowEmpty = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly invalid = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly fluid = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n // eslint-disable-next-line @angular-eslint/no-input-rename\n readonly disabledInput = input<boolean, unknown>(false, { alias: 'disabled', transform: booleanAttribute });\n readonly tabindex = input<number | undefined, unknown>(undefined, { transform: optionalNumber });\n readonly ariaLabel = input<string | undefined>(undefined);\n readonly dt = input<TectraDeepPartial<TectraToggleButtonTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxToggleButtonPart, TxToggleButton> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n changed = output<TxToggleButtonChangeEvent>();\n\n isUnstyled = injectUnstyled(this.unstyled);\n isFluid = injectFluid(this.fluid);\n passThrough = injectPassThrough('toggleButton', this, this.pt, this.ptOptions);\n\n readonly checked = computed(() => !!this.value());\n readonly isDisabled = computed(() => this.disabled() || this.disabledInput());\n readonly label = computed(() => (this.checked() ? this.onLabel() : this.offLabel()));\n readonly currentIcon = computed(() => (this.checked() ? this.onIcon() : this.offIcon()));\n readonly iconName = computed(() => {\n const icon = this.currentIcon();\n return this.txIconRegistry.has(icon) ? icon : null;\n });\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-toggle-button'), ...this.passThrough().root?.style }));\n\n toggle(event: Event): void {\n if (this.isDisabled() || (this.checked() && !this.allowEmpty())) {\n return;\n }\n const checked = !this.checked();\n this.updateValue(checked);\n this.changed.emit({ originalEvent: event, checked });\n }\n\n onBlur(): void {\n this.markTouched();\n }\n}\n","<button\n txRipple\n type=\"button\"\n class=\"tx-toggle-button__control\"\n [attr.aria-pressed]=\"checked()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"invalid() || null\"\n [attr.tabindex]=\"tabindex() ?? null\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle($event)\"\n (blur)=\"onBlur()\"\n>\n <span class=\"tx-toggle-button__content\" [class]=\"passThrough().content?.class\" [style]=\"passThrough().content?.style\">\n @if (currentIcon(); as icon) {\n <span class=\"tx-toggle-button__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n @if (iconName(); as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"icon\"></span>\n }\n </span>\n }\n <span class=\"tx-toggle-button__label\" [class]=\"passThrough().label?.class\" [style]=\"passThrough().label?.style\">{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