@tailng-ui/components 0.17.0 → 0.19.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/package.json +16 -5
- package/src/lib/feedback/empty/tng-empty.component.d.ts +16 -1
- package/src/lib/feedback/empty/tng-empty.component.d.ts.map +1 -1
- package/src/lib/feedback/empty/tng-empty.component.js +47 -57
- package/src/lib/feedback/empty/tng-empty.component.js.map +1 -1
- package/src/lib/feedback/index.d.ts +0 -5
- package/src/lib/feedback/index.d.ts.map +1 -1
- package/src/lib/feedback/index.js +4 -5
- package/src/lib/feedback/index.js.map +1 -1
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.d.ts +4 -0
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.d.ts.map +1 -1
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.js +16 -26
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.js.map +1 -1
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.d.ts +4 -0
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.d.ts.map +1 -1
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.js +18 -32
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.js.map +1 -1
- package/src/lib/feedback/skeleton/tng-skeleton.component.d.ts +4 -0
- package/src/lib/feedback/skeleton/tng-skeleton.component.d.ts.map +1 -1
- package/src/lib/feedback/skeleton/tng-skeleton.component.js +14 -20
- package/src/lib/feedback/skeleton/tng-skeleton.component.js.map +1 -1
- package/src/lib/feedback/toast/tng-toast.component.d.ts +4 -1
- package/src/lib/feedback/toast/tng-toast.component.d.ts.map +1 -1
- package/src/lib/feedback/toast/tng-toast.component.js +17 -19
- package/src/lib/feedback/toast/tng-toast.component.js.map +1 -1
- package/src/lib/form/autocomplete/tng-autocomplete.component.d.ts +4 -0
- package/src/lib/form/autocomplete/tng-autocomplete.component.d.ts.map +1 -1
- package/src/lib/form/autocomplete/tng-autocomplete.component.js +46 -49
- package/src/lib/form/autocomplete/tng-autocomplete.component.js.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.d.ts +3 -0
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.d.ts.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.js +33 -58
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.js.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle.component.d.ts +3 -0
- package/src/lib/form/button-toggle/tng-button-toggle.component.d.ts.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle.component.js +15 -26
- package/src/lib/form/button-toggle/tng-button-toggle.component.js.map +1 -1
- package/src/lib/form/checkbox/tng-checkbox.component.d.ts +3 -0
- package/src/lib/form/checkbox/tng-checkbox.component.d.ts.map +1 -1
- package/src/lib/form/checkbox/tng-checkbox.component.js +32 -42
- package/src/lib/form/checkbox/tng-checkbox.component.js.map +1 -1
- package/src/lib/form/chips/tng-chips.component.d.ts +3 -0
- package/src/lib/form/chips/tng-chips.component.d.ts.map +1 -1
- package/src/lib/form/chips/tng-chips.component.js +14 -19
- package/src/lib/form/chips/tng-chips.component.js.map +1 -1
- package/src/lib/form/combobox/tng-combobox.component.d.ts +3 -0
- package/src/lib/form/combobox/tng-combobox.component.d.ts.map +1 -1
- package/src/lib/form/combobox/tng-combobox.component.js +10 -13
- package/src/lib/form/combobox/tng-combobox.component.js.map +1 -1
- package/src/lib/form/datepicker/tng-datepicker.component.d.ts +4 -1
- package/src/lib/form/datepicker/tng-datepicker.component.d.ts.map +1 -1
- package/src/lib/form/datepicker/tng-datepicker.component.js +58 -98
- package/src/lib/form/datepicker/tng-datepicker.component.js.map +1 -1
- package/src/lib/form/form-field/tng-form-field.component.d.ts +3 -0
- package/src/lib/form/form-field/tng-form-field.component.d.ts.map +1 -1
- package/src/lib/form/form-field/tng-form-field.component.js +28 -33
- package/src/lib/form/form-field/tng-form-field.component.js.map +1 -1
- package/src/lib/form/index.d.ts +0 -20
- package/src/lib/form/index.d.ts.map +1 -1
- package/src/lib/form/index.js +4 -20
- package/src/lib/form/index.js.map +1 -1
- package/src/lib/form/input/tng-input.component.d.ts +3 -0
- package/src/lib/form/input/tng-input.component.d.ts.map +1 -1
- package/src/lib/form/input/tng-input.component.js +49 -60
- package/src/lib/form/input/tng-input.component.js.map +1 -1
- package/src/lib/form/input-otp/tng-input-otp.component.d.ts +3 -0
- package/src/lib/form/input-otp/tng-input-otp.component.d.ts.map +1 -1
- package/src/lib/form/input-otp/tng-input-otp.component.js +55 -69
- package/src/lib/form/input-otp/tng-input-otp.component.js.map +1 -1
- package/src/lib/form/label/tng-label.component.d.ts +3 -0
- package/src/lib/form/label/tng-label.component.d.ts.map +1 -1
- package/src/lib/form/label/tng-label.component.js +12 -19
- package/src/lib/form/label/tng-label.component.js.map +1 -1
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.d.ts +4 -0
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.d.ts.map +1 -1
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.js +40 -43
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.js.map +1 -1
- package/src/lib/form/multiselect/tng-multiselect.component.d.ts +4 -0
- package/src/lib/form/multiselect/tng-multiselect.component.d.ts.map +1 -1
- package/src/lib/form/multiselect/tng-multiselect.component.js +49 -52
- package/src/lib/form/multiselect/tng-multiselect.component.js.map +1 -1
- package/src/lib/form/radio/tng-radio.component.d.ts +3 -0
- package/src/lib/form/radio/tng-radio.component.d.ts.map +1 -1
- package/src/lib/form/radio/tng-radio.component.js +18 -33
- package/src/lib/form/radio/tng-radio.component.js.map +1 -1
- package/src/lib/form/select/tng-select.component.d.ts +4 -0
- package/src/lib/form/select/tng-select.component.d.ts.map +1 -1
- package/src/lib/form/select/tng-select.component.js +52 -53
- package/src/lib/form/select/tng-select.component.js.map +1 -1
- package/src/lib/form/select/tng-select.slots.d.ts +5 -0
- package/src/lib/form/select/tng-select.slots.d.ts.map +1 -1
- package/src/lib/form/select/tng-select.slots.js +21 -17
- package/src/lib/form/select/tng-select.slots.js.map +1 -1
- package/src/lib/form/slider/tng-slider.component.d.ts +3 -0
- package/src/lib/form/slider/tng-slider.component.d.ts.map +1 -1
- package/src/lib/form/slider/tng-slider.component.js +14 -27
- package/src/lib/form/slider/tng-slider.component.js.map +1 -1
- package/src/lib/form/switch/tng-switch.component.d.ts +3 -0
- package/src/lib/form/switch/tng-switch.component.d.ts.map +1 -1
- package/src/lib/form/switch/tng-switch.component.js +15 -24
- package/src/lib/form/switch/tng-switch.component.js.map +1 -1
- package/src/lib/form/textarea/tng-textarea.component.d.ts +3 -0
- package/src/lib/form/textarea/tng-textarea.component.d.ts.map +1 -1
- package/src/lib/form/textarea/tng-textarea.component.js +19 -36
- package/src/lib/form/textarea/tng-textarea.component.js.map +1 -1
- package/src/lib/form/toggle/tng-toggle.component.d.ts +3 -0
- package/src/lib/form/toggle/tng-toggle.component.d.ts.map +1 -1
- package/src/lib/form/toggle/tng-toggle.component.js +41 -41
- package/src/lib/form/toggle/tng-toggle.component.js.map +1 -1
- package/src/lib/form/toggle-group/tng-toggle-group.component.d.ts +4 -0
- package/src/lib/form/toggle-group/tng-toggle-group.component.d.ts.map +1 -1
- package/src/lib/form/toggle-group/tng-toggle-group.component.js +28 -31
- package/src/lib/form/toggle-group/tng-toggle-group.component.js.map +1 -1
- package/src/lib/layout/accordion/tng-accordion.component.d.ts +10 -0
- package/src/lib/layout/accordion/tng-accordion.component.d.ts.map +1 -1
- package/src/lib/layout/accordion/tng-accordion.component.js +49 -148
- package/src/lib/layout/accordion/tng-accordion.component.js.map +1 -1
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.d.ts +3 -0
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.d.ts.map +1 -1
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.js +10 -13
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.js.map +1 -1
- package/src/lib/layout/card/tng-card.component.d.ts +21 -0
- package/src/lib/layout/card/tng-card.component.d.ts.map +1 -1
- package/src/lib/layout/card/tng-card.component.js +92 -136
- package/src/lib/layout/card/tng-card.component.js.map +1 -1
- package/src/lib/layout/collapsible/tng-collapsible.component.d.ts +3 -0
- package/src/lib/layout/collapsible/tng-collapsible.component.d.ts.map +1 -1
- package/src/lib/layout/collapsible/tng-collapsible.component.js +17 -24
- package/src/lib/layout/collapsible/tng-collapsible.component.js.map +1 -1
- package/src/lib/layout/drawer/tng-drawer.component.d.ts +4 -0
- package/src/lib/layout/drawer/tng-drawer.component.d.ts.map +1 -1
- package/src/lib/layout/drawer/tng-drawer.component.js +48 -51
- package/src/lib/layout/drawer/tng-drawer.component.js.map +1 -1
- package/src/lib/layout/grid/tng-grid.component.d.ts +8 -0
- package/src/lib/layout/grid/tng-grid.component.d.ts.map +1 -1
- package/src/lib/layout/grid/tng-grid.component.js +48 -110
- package/src/lib/layout/grid/tng-grid.component.js.map +1 -1
- package/src/lib/layout/index.d.ts +1 -8
- package/src/lib/layout/index.d.ts.map +1 -1
- package/src/lib/layout/index.js +5 -8
- package/src/lib/layout/index.js.map +1 -1
- package/src/lib/layout/separator/tng-separator.component.d.ts +3 -0
- package/src/lib/layout/separator/tng-separator.component.d.ts.map +1 -1
- package/src/lib/layout/separator/tng-separator.component.js +11 -16
- package/src/lib/layout/separator/tng-separator.component.js.map +1 -1
- package/src/lib/layout/stepper/tng-stepper.component.d.ts +3 -0
- package/src/lib/layout/stepper/tng-stepper.component.d.ts.map +1 -1
- package/src/lib/layout/stepper/tng-stepper.component.js +10 -13
- package/src/lib/layout/stepper/tng-stepper.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.js +47 -49
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.js +16 -18
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.js +10 -12
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.d.ts +3 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.js +12 -10
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.js +12 -14
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.js +23 -25
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.js.map +1 -1
- package/src/lib/navigation/context-menu/tng-context-menu.component.d.ts +5 -0
- package/src/lib/navigation/context-menu/tng-context-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/context-menu/tng-context-menu.component.js +24 -26
- package/src/lib/navigation/context-menu/tng-context-menu.component.js.map +1 -1
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.d.ts +4 -0
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.js +19 -23
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.js.map +1 -1
- package/src/lib/navigation/index.d.ts +0 -12
- package/src/lib/navigation/index.d.ts.map +1 -1
- package/src/lib/navigation/index.js +4 -12
- package/src/lib/navigation/index.js.map +1 -1
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.d.ts +3 -0
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.d.ts.map +1 -1
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.js +22 -20
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.js.map +1 -1
- package/src/lib/navigation/menu/tng-menu.component.d.ts +5 -0
- package/src/lib/navigation/menu/tng-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/menu/tng-menu.component.js +21 -23
- package/src/lib/navigation/menu/tng-menu.component.js.map +1 -1
- package/src/lib/navigation/menubar/tng-menubar.component.d.ts +5 -0
- package/src/lib/navigation/menubar/tng-menubar.component.d.ts.map +1 -1
- package/src/lib/navigation/menubar/tng-menubar.component.js +20 -22
- package/src/lib/navigation/menubar/tng-menubar.component.js.map +1 -1
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.d.ts +4 -0
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.js +11 -13
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.js.map +1 -1
- package/src/lib/navigation/tabs/tng-tabs.component.d.ts +5 -0
- package/src/lib/navigation/tabs/tng-tabs.component.d.ts.map +1 -1
- package/src/lib/navigation/tabs/tng-tabs.component.js +32 -34
- package/src/lib/navigation/tabs/tng-tabs.component.js.map +1 -1
- package/src/lib/navigation/toolbar/tng-toolbar.component.d.ts +4 -0
- package/src/lib/navigation/toolbar/tng-toolbar.component.d.ts.map +1 -1
- package/src/lib/navigation/toolbar/tng-toolbar.component.js +11 -13
- package/src/lib/navigation/toolbar/tng-toolbar.component.js.map +1 -1
- package/src/lib/overlay/dialog/tng-dialog.component.d.ts +4 -0
- package/src/lib/overlay/dialog/tng-dialog.component.d.ts.map +1 -1
- package/src/lib/overlay/dialog/tng-dialog.component.js +18 -25
- package/src/lib/overlay/dialog/tng-dialog.component.js.map +1 -1
- package/src/lib/overlay/index.d.ts +0 -3
- package/src/lib/overlay/index.d.ts.map +1 -1
- package/src/lib/overlay/index.js +4 -3
- package/src/lib/overlay/index.js.map +1 -1
- package/src/lib/overlay/popover/tng-popover.component.d.ts +4 -0
- package/src/lib/overlay/popover/tng-popover.component.d.ts.map +1 -1
- package/src/lib/overlay/popover/tng-popover.component.js +23 -37
- package/src/lib/overlay/popover/tng-popover.component.js.map +1 -1
- package/src/lib/overlay/tooltip/tng-tooltip.component.d.ts +4 -0
- package/src/lib/overlay/tooltip/tng-tooltip.component.d.ts.map +1 -1
- package/src/lib/overlay/tooltip/tng-tooltip.component.js +17 -21
- package/src/lib/overlay/tooltip/tng-tooltip.component.js.map +1 -1
- package/src/lib/utility/avatar/tng-avatar.component.d.ts +4 -1
- package/src/lib/utility/avatar/tng-avatar.component.d.ts.map +1 -1
- package/src/lib/utility/avatar/tng-avatar.component.js +20 -22
- package/src/lib/utility/avatar/tng-avatar.component.js.map +1 -1
- package/src/lib/utility/badge/tng-badge.component.d.ts +4 -0
- package/src/lib/utility/badge/tng-badge.component.d.ts.map +1 -1
- package/src/lib/utility/badge/tng-badge.component.js +13 -10
- package/src/lib/utility/badge/tng-badge.component.js.map +1 -1
- package/src/lib/utility/button/tng-button.component.d.ts +4 -1
- package/src/lib/utility/button/tng-button.component.d.ts.map +1 -1
- package/src/lib/utility/button/tng-button.component.js +19 -29
- package/src/lib/utility/button/tng-button.component.js.map +1 -1
- package/src/lib/utility/code-block/tng-code-block.component.d.ts +4 -0
- package/src/lib/utility/code-block/tng-code-block.component.d.ts.map +1 -1
- package/src/lib/utility/code-block/tng-code-block.component.js +73 -103
- package/src/lib/utility/code-block/tng-code-block.component.js.map +1 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.d.ts +4 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.d.ts.map +1 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.js +28 -36
- package/src/lib/utility/copy-button/tng-copy-button.component.js.map +1 -1
- package/src/lib/utility/index.d.ts +1 -9
- package/src/lib/utility/index.d.ts.map +1 -1
- package/src/lib/utility/index.js +5 -8
- package/src/lib/utility/index.js.map +1 -1
- package/src/lib/utility/tag/tng-tag.component.d.ts +4 -1
- package/src/lib/utility/tag/tng-tag.component.d.ts.map +1 -1
- package/src/lib/utility/tag/tng-tag.component.js +18 -24
- package/src/lib/utility/tag/tng-tag.component.js.map +1 -1
- package/src/lib/utility/tree/tng-tree.component.d.ts +4 -1
- package/src/lib/utility/tree/tng-tree.component.d.ts.map +1 -1
- package/src/lib/utility/tree/tng-tree.component.js +23 -25
- package/src/lib/utility/tree/tng-tree.component.js.map +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
1
|
import { Component, forwardRef, HostBinding, input, output, } from '@angular/core';
|
|
3
2
|
import { booleanAttribute } from '@angular/core';
|
|
4
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
4
|
import { coerceTngInputNullableBoolean, TngInput, } from '@tailng-ui/primitives';
|
|
6
5
|
import { TngFormFieldComponent, } from '../form-field/tng-form-field.component';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
7
|
function normalizeAttr(value) {
|
|
8
8
|
if (value === undefined || value === null)
|
|
9
9
|
return null;
|
|
@@ -18,43 +18,31 @@ function readInputValue(event) {
|
|
|
18
18
|
return null;
|
|
19
19
|
return target.value;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
export class TngInputComponent {
|
|
22
22
|
// ---- Wrapper (form-field) appearance knobs ----
|
|
23
|
-
appearance = input('outline');
|
|
24
|
-
size = input('md');
|
|
25
|
-
tone = input('neutral');
|
|
26
|
-
fullWidth = input(true, {
|
|
27
|
-
transform: booleanAttribute,
|
|
28
|
-
});
|
|
23
|
+
appearance = input('outline', ...(ngDevMode ? [{ debugName: "appearance" }] : []));
|
|
24
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
25
|
+
tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : []));
|
|
26
|
+
fullWidth = input(true, { ...(ngDevMode ? { debugName: "fullWidth" } : {}), transform: booleanAttribute });
|
|
29
27
|
// ---- Input API passthrough ----
|
|
30
|
-
ariaDescribedBy = input(null);
|
|
31
|
-
ariaInvalid = input(null, {
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
id = input(null);
|
|
44
|
-
name = input(null);
|
|
45
|
-
placeholder = input(null);
|
|
46
|
-
readonly = input(false, {
|
|
47
|
-
transform: booleanAttribute,
|
|
48
|
-
});
|
|
49
|
-
required = input(false, {
|
|
50
|
-
transform: booleanAttribute,
|
|
51
|
-
});
|
|
52
|
-
type = input('text');
|
|
28
|
+
ariaDescribedBy = input(null, ...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : []));
|
|
29
|
+
ariaInvalid = input(null, { ...(ngDevMode ? { debugName: "ariaInvalid" } : {}), transform: coerceTngInputNullableBoolean });
|
|
30
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
31
|
+
ariaLabelledby = input(null, ...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : []));
|
|
32
|
+
ariaRequired = input(null, { ...(ngDevMode ? { debugName: "ariaRequired" } : {}), transform: coerceTngInputNullableBoolean });
|
|
33
|
+
autocomplete = input(null, ...(ngDevMode ? [{ debugName: "autocomplete" }] : []));
|
|
34
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
35
|
+
id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
36
|
+
name = input(null, ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
37
|
+
placeholder = input(null, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
38
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
39
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
|
|
40
|
+
type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
53
41
|
/**
|
|
54
42
|
* Controlled value input (only used when NOT using CVA).
|
|
55
43
|
* If you bind [value], you should also listen to (valueChange) (or use signals).
|
|
56
44
|
*/
|
|
57
|
-
value = input(null);
|
|
45
|
+
value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
58
46
|
// ---- Outputs ----
|
|
59
47
|
valueChange = output();
|
|
60
48
|
inputEvent = output({ alias: 'input' });
|
|
@@ -138,37 +126,38 @@ let TngInputComponent = class TngInputComponent {
|
|
|
138
126
|
normalizeAttrValue(value) {
|
|
139
127
|
return normalizeAttr(value);
|
|
140
128
|
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
HostBinding('attr.data-slot')
|
|
144
|
-
], TngInputComponent.prototype, "dataSlot", void 0);
|
|
145
|
-
__decorate([
|
|
146
|
-
HostBinding('attr.data-appearance')
|
|
147
|
-
], TngInputComponent.prototype, "dataAppearance", null);
|
|
148
|
-
__decorate([
|
|
149
|
-
HostBinding('attr.data-size')
|
|
150
|
-
], TngInputComponent.prototype, "dataSize", null);
|
|
151
|
-
__decorate([
|
|
152
|
-
HostBinding('attr.data-tone')
|
|
153
|
-
], TngInputComponent.prototype, "dataTone", null);
|
|
154
|
-
__decorate([
|
|
155
|
-
HostBinding('attr.data-full-width')
|
|
156
|
-
], TngInputComponent.prototype, "dataFullWidth", null);
|
|
157
|
-
TngInputComponent = __decorate([
|
|
158
|
-
Component({
|
|
159
|
-
selector: 'tng-input',
|
|
160
|
-
standalone: true,
|
|
161
|
-
imports: [TngFormFieldComponent, TngInput],
|
|
162
|
-
templateUrl: './tng-input.component.html',
|
|
163
|
-
styleUrl: './tng-input.component.css',
|
|
164
|
-
providers: [
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.1", type: TngInputComponent, isStandalone: true, selector: "tng-input", inputs: { appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "ariaInvalid", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaRequired: { classPropertyName: "ariaRequired", publicName: "ariaRequired", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", inputEvent: "input", blurEvent: "blur" }, host: { properties: { "attr.data-slot": "this.dataSlot", "attr.data-appearance": "this.dataAppearance", "attr.data-size": "this.dataSize", "attr.data-tone": "this.dataTone", "attr.data-full-width": "this.dataFullWidth" } }, providers: [
|
|
165
131
|
{
|
|
166
132
|
provide: NG_VALUE_ACCESSOR,
|
|
167
133
|
useExisting: forwardRef(() => TngInputComponent),
|
|
168
134
|
multi: true,
|
|
169
135
|
},
|
|
170
|
-
],
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
136
|
+
], ngImport: i0, template: "<tng-form-field\n class=\"tng-input\"\n [appearance]=\"appearance()\"\n [size]=\"size()\"\n [tone]=\"tone()\"\n [fullWidth]=\"fullWidth()\"\n>\n <input\n tngInput\n class=\"tng-input-control\"\n [type]=\"type()\"\n [disabled]=\"effectiveDisabled\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledby]=\"ariaLabelledby()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n [ariaInvalid]=\"ariaInvalid()\"\n [ariaRequired]=\"ariaRequired()\"\n [attr.autocomplete]=\"normalizeAttrValue(autocomplete())\"\n [attr.id]=\"normalizeAttrValue(id())\"\n [attr.name]=\"normalizeAttrValue(name())\"\n [attr.placeholder]=\"normalizeAttrValue(placeholder())\"\n [value]=\"effectiveValue\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n</tng-form-field>", styles: [":host {\n display: inline-flex;\n max-width: 100%;\n}\n\n:host([data-full-width]) {\n width: 100%;\n}\n\n.tng-input {\n width: 100%;\n}\n\n:host(:not([data-full-width])) .tng-input {\n width: auto;\n}\n\n/* Optional: make sure the native control fills the form-field */\n.tng-input-control {\n appearance: none;\n background: transparent;\n border: 0;\n border-radius: 0;\n box-sizing: border-box;\n box-shadow: none;\n color: inherit;\n display: block;\n flex: 1 1 auto;\n font: inherit;\n min-width: 0;\n outline: none;\n padding: 0;\n width: 100%;\n}\n\n.tng-input-control::placeholder {\n color: var(--_tng-input-placeholder, var(--tng-semantic-foreground-muted));\n}\n"], dependencies: [{ kind: "component", type: TngFormFieldComponent, selector: "tng-form-field", inputs: ["appearance", "size", "tone", "fullWidth"] }, { kind: "directive", type: TngInput, selector: "input[tngInput], textarea[tngInput]", inputs: ["ariaDescribedBy", "ariaLabel", "ariaLabelledby", "ariaInvalid", "ariaRequired", "disabled", "readonly", "required"], exportAs: ["tngInput"] }] });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngInputComponent, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{ selector: 'tng-input', standalone: true, imports: [TngFormFieldComponent, TngInput], providers: [
|
|
141
|
+
{
|
|
142
|
+
provide: NG_VALUE_ACCESSOR,
|
|
143
|
+
useExisting: forwardRef(() => TngInputComponent),
|
|
144
|
+
multi: true,
|
|
145
|
+
},
|
|
146
|
+
], template: "<tng-form-field\n class=\"tng-input\"\n [appearance]=\"appearance()\"\n [size]=\"size()\"\n [tone]=\"tone()\"\n [fullWidth]=\"fullWidth()\"\n>\n <input\n tngInput\n class=\"tng-input-control\"\n [type]=\"type()\"\n [disabled]=\"effectiveDisabled\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledby]=\"ariaLabelledby()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n [ariaInvalid]=\"ariaInvalid()\"\n [ariaRequired]=\"ariaRequired()\"\n [attr.autocomplete]=\"normalizeAttrValue(autocomplete())\"\n [attr.id]=\"normalizeAttrValue(id())\"\n [attr.name]=\"normalizeAttrValue(name())\"\n [attr.placeholder]=\"normalizeAttrValue(placeholder())\"\n [value]=\"effectiveValue\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n</tng-form-field>", styles: [":host {\n display: inline-flex;\n max-width: 100%;\n}\n\n:host([data-full-width]) {\n width: 100%;\n}\n\n.tng-input {\n width: 100%;\n}\n\n:host(:not([data-full-width])) .tng-input {\n width: auto;\n}\n\n/* Optional: make sure the native control fills the form-field */\n.tng-input-control {\n appearance: none;\n background: transparent;\n border: 0;\n border-radius: 0;\n box-sizing: border-box;\n box-shadow: none;\n color: inherit;\n display: block;\n flex: 1 1 auto;\n font: inherit;\n min-width: 0;\n outline: none;\n padding: 0;\n width: 100%;\n}\n\n.tng-input-control::placeholder {\n color: var(--_tng-input-placeholder, var(--tng-semantic-foreground-muted));\n}\n"] }]
|
|
147
|
+
}], propDecorators: { appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaInvalid", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaRequired", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], inputEvent: [{ type: i0.Output, args: ["input"] }], blurEvent: [{ type: i0.Output, args: ["blur"] }], dataSlot: [{
|
|
148
|
+
type: HostBinding,
|
|
149
|
+
args: ['attr.data-slot']
|
|
150
|
+
}], dataAppearance: [{
|
|
151
|
+
type: HostBinding,
|
|
152
|
+
args: ['attr.data-appearance']
|
|
153
|
+
}], dataSize: [{
|
|
154
|
+
type: HostBinding,
|
|
155
|
+
args: ['attr.data-size']
|
|
156
|
+
}], dataTone: [{
|
|
157
|
+
type: HostBinding,
|
|
158
|
+
args: ['attr.data-tone']
|
|
159
|
+
}], dataFullWidth: [{
|
|
160
|
+
type: HostBinding,
|
|
161
|
+
args: ['attr.data-full-width']
|
|
162
|
+
}] } });
|
|
174
163
|
//# sourceMappingURL=tng-input.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-input.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/input/tng-input.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,KAAK,EACL,MAAM,GACP,MAA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E,IAAI;QAChB,OAAO,EAAE,CAAC,qBAAqB,EAAE,QAAQ,CAAC;QAC1C,WAAW,EAAE,4BAA4B;QACzC,QAAQ,EAAE,2BAA2B;QACrC,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC;gBAChD,KAAK,EAAE,IAAI;aACZ;SACF;KACF,CAAC;GACW,iBAAiB,CAkJ7B","sourcesContent":["import {\n Component,\n forwardRef,\n HostBinding,\n input,\n output,\n} from '@angular/core';\nimport { booleanAttribute } from '@angular/core';\nimport type { ControlValueAccessor} from '@angular/forms';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport {\n coerceTngInputNullableBoolean,\n TngInput,\n type TngInputType,\n} from '@tailng-ui/primitives';\n\nimport {\n TngFormFieldComponent,\n type TngFormFieldAppearance,\n type TngFormFieldSize,\n type TngFormFieldTone,\n} from '../form-field/tng-form-field.component';\n\ntype NullableBooleanInput = boolean | null | string | undefined;\n\nfunction normalizeAttr(value: string | null | undefined): string | null {\n if (value === undefined || value === null) return null;\n const v = value.trim();\n return v.length > 0 ? v : null;\n}\n\nfunction readInputValue(event: unknown): string | null {\n if (!(event instanceof Event)) return null;\n const target = event.target;\n if (!(target instanceof HTMLInputElement)) return null;\n return target.value;\n}\n\n@Component({\n selector: 'tng-input',\n standalone: true,\n imports: [TngFormFieldComponent, TngInput],\n templateUrl: './tng-input.component.html',\n styleUrl: './tng-input.component.css',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TngInputComponent),\n multi: true,\n },\n ],\n})\nexport class TngInputComponent implements ControlValueAccessor {\n // ---- Wrapper (form-field) appearance knobs ----\n public readonly appearance = input<TngFormFieldAppearance>('outline');\n public readonly size = input<TngFormFieldSize>('md');\n public readonly tone = input<TngFormFieldTone>('neutral');\n public readonly fullWidth = input<boolean, boolean | string>(true, {\n transform: booleanAttribute,\n });\n\n // ---- Input API passthrough ----\n public readonly ariaDescribedBy = input<string | null>(null);\n public readonly ariaInvalid = input<boolean | null, NullableBooleanInput>(null, {\n transform: coerceTngInputNullableBoolean,\n });\n public readonly ariaLabel = input<string | null>(null);\n public readonly ariaLabelledby = input<string | null>(null);\n public readonly ariaRequired = input<boolean | null, NullableBooleanInput>(null, {\n transform: coerceTngInputNullableBoolean,\n });\n\n public readonly autocomplete = input<string | null>(null);\n public readonly disabled = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly id = input<string | null>(null);\n public readonly name = input<string | null>(null);\n public readonly placeholder = input<string | null>(null);\n public readonly readonly = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly required = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly type = input<TngInputType>('text');\n\n /**\n * Controlled value input (only used when NOT using CVA).\n * If you bind [value], you should also listen to (valueChange) (or use signals).\n */\n public readonly value = input<string | null>(null);\n\n // ---- Outputs ----\n public readonly valueChange = output<string>();\n public readonly inputEvent = output<Event>({ alias: 'input' });\n public readonly blurEvent = output<FocusEvent>({ alias: 'blur' });\n\n // ---- CVA state ----\n private usingCva = false;\n private cvaValue: string | null = null;\n private cvaDisabled = false;\n\n private onChange: (value: string) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n\n // ---- Host attrs (optional, useful for styling/debug) ----\n @HostBinding('attr.data-slot')\n protected readonly dataSlot = 'input-component' as const;\n\n @HostBinding('attr.data-appearance')\n protected get dataAppearance(): TngFormFieldAppearance {\n return this.appearance();\n }\n\n @HostBinding('attr.data-size')\n protected get dataSize(): TngFormFieldSize {\n return this.size();\n }\n\n @HostBinding('attr.data-tone')\n protected get dataTone(): TngFormFieldTone {\n return this.tone();\n }\n\n @HostBinding('attr.data-full-width')\n protected get dataFullWidth(): '' | null {\n return this.fullWidth() ? '' : null;\n }\n\n // ---- Derived values for template ----\n protected get effectiveValue(): string {\n const v = this.usingCva ? this.cvaValue : this.value();\n return v ?? '';\n }\n\n protected get effectiveDisabled(): boolean {\n return this.cvaDisabled || this.disabled();\n }\n\n // ---- CVA ----\n public writeValue(value: unknown): void {\n this.usingCva = true;\n this.cvaValue =\n typeof value === 'string'\n ? value\n : value == null\n ? null\n : String(value);\n }\n\n public registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n public setDisabledState(isDisabled: boolean): void {\n this.cvaDisabled = isDisabled;\n }\n\n // ---- DOM handlers ----\n public onInput(event: unknown): void {\n const next = readInputValue(event);\n if (next === null) return;\n\n // If disabled, ignore (optional safety)\n if (this.effectiveDisabled) return;\n\n // Keep CVA in sync when used\n if (this.usingCva) {\n if (this.cvaValue === next) {\n // Still forward the raw event output if you want:\n if (event instanceof Event) this.inputEvent.emit(event);\n return;\n }\n this.cvaValue = next;\n this.onChange(next);\n }\n\n // For controlled-input usage, emit valueChange always\n this.valueChange.emit(next);\n\n if (event instanceof Event) {\n this.inputEvent.emit(event);\n }\n }\n\n public onBlur(event: FocusEvent): void {\n this.onTouched();\n this.blurEvent.emit(event);\n }\n\n protected normalizeAttrValue(value: string | null | undefined): string | null {\n return normalizeAttr(value);\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"tng-input.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/input/tng-input.component.ts","../../../../../../../../libs/tailng-ui/components/src/lib/form/input/tng-input.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EACL,6BAA6B,EAC7B,QAAQ,GAET,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,qBAAqB,GAItB,MAAM,wCAAwC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ent":["import {\n Component,\n forwardRef,\n HostBinding,\n input,\n output,\n} from '@angular/core';\nimport { booleanAttribute } from '@angular/core';\nimport type { ControlValueAccessor} from '@angular/forms';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport {\n coerceTngInputNullableBoolean,\n TngInput,\n type TngInputType,\n} from '@tailng-ui/primitives';\n\nimport {\n TngFormFieldComponent,\n type TngFormFieldAppearance,\n type TngFormFieldSize,\n type TngFormFieldTone,\n} from '../form-field/tng-form-field.component';\n\ntype NullableBooleanInput = boolean | null | string | undefined;\n\nfunction normalizeAttr(value: string | null | undefined): string | null {\n if (value === undefined || value === null) return null;\n const v = value.trim();\n return v.length > 0 ? v : null;\n}\n\nfunction readInputValue(event: unknown): string | null {\n if (!(event instanceof Event)) return null;\n const target = event.target;\n if (!(target instanceof HTMLInputElement)) return null;\n return target.value;\n}\n\n@Component({\n selector: 'tng-input',\n standalone: true,\n imports: [TngFormFieldComponent, TngInput],\n templateUrl: './tng-input.component.html',\n styleUrl: './tng-input.component.css',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TngInputComponent),\n multi: true,\n },\n ],\n})\nexport class TngInputComponent implements ControlValueAccessor {\n // ---- Wrapper (form-field) appearance knobs ----\n public readonly appearance = input<TngFormFieldAppearance>('outline');\n public readonly size = input<TngFormFieldSize>('md');\n public readonly tone = input<TngFormFieldTone>('neutral');\n public readonly fullWidth = input<boolean, boolean | string>(true, {\n transform: booleanAttribute,\n });\n\n // ---- Input API passthrough ----\n public readonly ariaDescribedBy = input<string | null>(null);\n public readonly ariaInvalid = input<boolean | null, NullableBooleanInput>(null, {\n transform: coerceTngInputNullableBoolean,\n });\n public readonly ariaLabel = input<string | null>(null);\n public readonly ariaLabelledby = input<string | null>(null);\n public readonly ariaRequired = input<boolean | null, NullableBooleanInput>(null, {\n transform: coerceTngInputNullableBoolean,\n });\n\n public readonly autocomplete = input<string | null>(null);\n public readonly disabled = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly id = input<string | null>(null);\n public readonly name = input<string | null>(null);\n public readonly placeholder = input<string | null>(null);\n public readonly readonly = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly required = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly type = input<TngInputType>('text');\n\n /**\n * Controlled value input (only used when NOT using CVA).\n * If you bind [value], you should also listen to (valueChange) (or use signals).\n */\n public readonly value = input<string | null>(null);\n\n // ---- Outputs ----\n public readonly valueChange = output<string>();\n public readonly inputEvent = output<Event>({ alias: 'input' });\n public readonly blurEvent = output<FocusEvent>({ alias: 'blur' });\n\n // ---- CVA state ----\n private usingCva = false;\n private cvaValue: string | null = null;\n private cvaDisabled = false;\n\n private onChange: (value: string) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n\n // ---- Host attrs (optional, useful for styling/debug) ----\n @HostBinding('attr.data-slot')\n protected readonly dataSlot = 'input-component' as const;\n\n @HostBinding('attr.data-appearance')\n protected get dataAppearance(): TngFormFieldAppearance {\n return this.appearance();\n }\n\n @HostBinding('attr.data-size')\n protected get dataSize(): TngFormFieldSize {\n return this.size();\n }\n\n @HostBinding('attr.data-tone')\n protected get dataTone(): TngFormFieldTone {\n return this.tone();\n }\n\n @HostBinding('attr.data-full-width')\n protected get dataFullWidth(): '' | null {\n return this.fullWidth() ? '' : null;\n }\n\n // ---- Derived values for template ----\n protected get effectiveValue(): string {\n const v = this.usingCva ? this.cvaValue : this.value();\n return v ?? '';\n }\n\n protected get effectiveDisabled(): boolean {\n return this.cvaDisabled || this.disabled();\n }\n\n // ---- CVA ----\n public writeValue(value: unknown): void {\n this.usingCva = true;\n this.cvaValue =\n typeof value === 'string'\n ? value\n : value == null\n ? null\n : String(value);\n }\n\n public registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n public setDisabledState(isDisabled: boolean): void {\n this.cvaDisabled = isDisabled;\n }\n\n // ---- DOM handlers ----\n public onInput(event: unknown): void {\n const next = readInputValue(event);\n if (next === null) return;\n\n // If disabled, ignore (optional safety)\n if (this.effectiveDisabled) return;\n\n // Keep CVA in sync when used\n if (this.usingCva) {\n if (this.cvaValue === next) {\n // Still forward the raw event output if you want:\n if (event instanceof Event) this.inputEvent.emit(event);\n return;\n }\n this.cvaValue = next;\n this.onChange(next);\n }\n\n // For controlled-input usage, emit valueChange always\n this.valueChange.emit(next);\n\n if (event instanceof Event) {\n this.inputEvent.emit(event);\n }\n }\n\n public onBlur(event: FocusEvent): void {\n this.onTouched();\n this.blurEvent.emit(event);\n }\n\n protected normalizeAttrValue(value: string | null | undefined): string | null {\n return normalizeAttr(value);\n }\n}","<tng-form-field\n class=\"tng-input\"\n [appearance]=\"appearance()\"\n [size]=\"size()\"\n [tone]=\"tone()\"\n [fullWidth]=\"fullWidth()\"\n>\n <input\n tngInput\n class=\"tng-input-control\"\n [type]=\"type()\"\n [disabled]=\"effectiveDisabled\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledby]=\"ariaLabelledby()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n [ariaInvalid]=\"ariaInvalid()\"\n [ariaRequired]=\"ariaRequired()\"\n [attr.autocomplete]=\"normalizeAttrValue(autocomplete())\"\n [attr.id]=\"normalizeAttrValue(id())\"\n [attr.name]=\"normalizeAttrValue(name())\"\n [attr.placeholder]=\"normalizeAttrValue(placeholder())\"\n [value]=\"effectiveValue\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n</tng-form-field>"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit } from '@angular/core';
|
|
2
2
|
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
3
4
|
export type TngInputOtpType = 'numeric' | 'alphanumeric' | 'custom';
|
|
4
5
|
export type TngInputOtpInputMode = 'numeric' | 'text' | 'tel' | 'decimal';
|
|
5
6
|
export declare function sanitizeTngOtpCharacters(value: string, mode: TngInputOtpType, pattern: string | RegExp | null): readonly string[];
|
|
@@ -81,5 +82,7 @@ export declare class TngInputOtpComponent implements AfterViewInit, ControlValue
|
|
|
81
82
|
private isFocusWithinHost;
|
|
82
83
|
private normalizeAndClamp;
|
|
83
84
|
private attachFormResetListener;
|
|
85
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TngInputOtpComponent, never>;
|
|
86
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TngInputOtpComponent, "tng-input-otp", never, { "length": { "alias": "length"; "required": false; "isSignal": true; }; "valueInput": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "pattern": { "alias": "pattern"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "selectOnFocus": { "alias": "selectOnFocus"; "required": false; "isSignal": true; }; "placeholderChar": { "alias": "placeholderChar"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "inputMode": { "alias": "inputMode"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "ariaLabelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "complete": "complete"; }, never, never, true, never>;
|
|
84
87
|
}
|
|
85
88
|
//# sourceMappingURL=tng-input-otp.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-input-otp.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/input-otp/tng-input-otp.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAWd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"tng-input-otp.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/input-otp/tng-input-otp.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAWd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;;AAQzE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAY1E,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAC9B,SAAS,MAAM,EAAE,CA4BnB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAc9E;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,SAAS,EAAE,MAAM,GAChB,MAAM,CAqBR;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EA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IAAI;IA+ClE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAkCxD,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAuBjE,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAK1C,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQvD,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9C,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIhD,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,uBAAuB;yCAncpB,oBAAoB;2CAApB,oBAAoB;CA2dhC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
1
|
import { Component, computed, effect, ElementRef, forwardRef, inject, input, output, Renderer2, signal, } from '@angular/core';
|
|
3
2
|
import { booleanAttribute } from '@angular/core';
|
|
4
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
4
|
import { clampTngOtpValue, normalizeTngOtpLength, resolveTngOtpState, TngInputOtp as TngInputOtpPrimitive, } from '@tailng-ui/primitives';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
6
|
const tngOtpDigitPattern = /^\d$/;
|
|
7
7
|
const tngOtpAlphanumericPattern = /^[a-zA-Z0-9]$/;
|
|
8
8
|
let tngInputOtpInstanceCounter = 0;
|
|
@@ -101,7 +101,7 @@ function clampOtpIndex(index, length) {
|
|
|
101
101
|
}
|
|
102
102
|
return Math.trunc(index);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
export class TngInputOtpComponent {
|
|
105
105
|
hostRef = inject(ElementRef);
|
|
106
106
|
renderer = inject(Renderer2);
|
|
107
107
|
generatedId = `tng-input-otp-${++tngInputOtpInstanceCounter}`;
|
|
@@ -109,74 +109,58 @@ let TngInputOtpComponent = class TngInputOtpComponent {
|
|
|
109
109
|
hasInitializedUncontrolled = false;
|
|
110
110
|
onChangeCallback = () => undefined;
|
|
111
111
|
onTouchedCallback = () => undefined;
|
|
112
|
-
uncontrolledValue = signal('');
|
|
113
|
-
formsDisabled = signal(false);
|
|
114
|
-
focusedState = signal(false);
|
|
115
|
-
focusVisibleState = signal(false);
|
|
116
|
-
keyboardInteraction = signal(false);
|
|
117
|
-
activeIndexState = signal(0);
|
|
118
|
-
length = input(6, {
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
autoFocus = input(false, {
|
|
142
|
-
transform: booleanAttribute,
|
|
143
|
-
});
|
|
144
|
-
selectOnFocus = input(true, {
|
|
145
|
-
transform: booleanAttribute,
|
|
146
|
-
});
|
|
147
|
-
placeholderChar = input('');
|
|
148
|
-
name = input(null);
|
|
149
|
-
id = input(null);
|
|
150
|
-
form = input(null);
|
|
151
|
-
autocomplete = input('one-time-code');
|
|
152
|
-
inputMode = input(null);
|
|
153
|
-
ariaLabel = input(null);
|
|
154
|
-
ariaLabelledby = input(null);
|
|
155
|
-
ariaDescribedby = input(null);
|
|
112
|
+
uncontrolledValue = signal('', ...(ngDevMode ? [{ debugName: "uncontrolledValue" }] : []));
|
|
113
|
+
formsDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formsDisabled" }] : []));
|
|
114
|
+
focusedState = signal(false, ...(ngDevMode ? [{ debugName: "focusedState" }] : []));
|
|
115
|
+
focusVisibleState = signal(false, ...(ngDevMode ? [{ debugName: "focusVisibleState" }] : []));
|
|
116
|
+
keyboardInteraction = signal(false, ...(ngDevMode ? [{ debugName: "keyboardInteraction" }] : []));
|
|
117
|
+
activeIndexState = signal(0, ...(ngDevMode ? [{ debugName: "activeIndexState" }] : []));
|
|
118
|
+
length = input(6, { ...(ngDevMode ? { debugName: "length" } : {}), transform: (value) => normalizeTngOtpLength(typeof value === 'number' ? value : Number(value)) });
|
|
119
|
+
valueInput = input(undefined, { ...(ngDevMode ? { debugName: "valueInput" } : {}), alias: 'value' });
|
|
120
|
+
defaultValue = input('', ...(ngDevMode ? [{ debugName: "defaultValue" }] : []));
|
|
121
|
+
type = input('numeric', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
122
|
+
pattern = input(null, ...(ngDevMode ? [{ debugName: "pattern" }] : []));
|
|
123
|
+
mask = input(false, { ...(ngDevMode ? { debugName: "mask" } : {}), transform: booleanAttribute });
|
|
124
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : {}), alias: 'disabled',
|
|
125
|
+
transform: booleanAttribute });
|
|
126
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
127
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
|
|
128
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
|
|
129
|
+
autoFocus = input(false, { ...(ngDevMode ? { debugName: "autoFocus" } : {}), transform: booleanAttribute });
|
|
130
|
+
selectOnFocus = input(true, { ...(ngDevMode ? { debugName: "selectOnFocus" } : {}), transform: booleanAttribute });
|
|
131
|
+
placeholderChar = input('', ...(ngDevMode ? [{ debugName: "placeholderChar" }] : []));
|
|
132
|
+
name = input(null, ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
133
|
+
id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
134
|
+
form = input(null, ...(ngDevMode ? [{ debugName: "form" }] : []));
|
|
135
|
+
autocomplete = input('one-time-code', ...(ngDevMode ? [{ debugName: "autocomplete" }] : []));
|
|
136
|
+
inputMode = input(null, ...(ngDevMode ? [{ debugName: "inputMode" }] : []));
|
|
137
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
138
|
+
ariaLabelledby = input(null, ...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : []));
|
|
139
|
+
ariaDescribedby = input(null, ...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : []));
|
|
156
140
|
valueChange = output();
|
|
157
141
|
complete = output();
|
|
158
|
-
disabled = computed(() => this.disabledInput() || this.formsDisabled());
|
|
159
|
-
focused = computed(() => this.focusedState());
|
|
160
|
-
focusVisible = computed(() => this.focusVisibleState());
|
|
161
|
-
activeIndex = computed(() => clampOtpIndex(this.activeIndexState(), this.length()));
|
|
162
|
-
rootId = computed(() => this.id() ?? this.generatedId);
|
|
142
|
+
disabled = computed(() => this.disabledInput() || this.formsDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
143
|
+
focused = computed(() => this.focusedState(), ...(ngDevMode ? [{ debugName: "focused" }] : []));
|
|
144
|
+
focusVisible = computed(() => this.focusVisibleState(), ...(ngDevMode ? [{ debugName: "focusVisible" }] : []));
|
|
145
|
+
activeIndex = computed(() => clampOtpIndex(this.activeIndexState(), this.length()), ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
146
|
+
rootId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "rootId" }] : []));
|
|
163
147
|
currentValue = computed(() => {
|
|
164
148
|
const controlled = this.valueInput();
|
|
165
149
|
if (controlled !== undefined) {
|
|
166
150
|
return this.normalizeAndClamp(controlled ?? '');
|
|
167
151
|
}
|
|
168
152
|
return this.normalizeAndClamp(this.uncontrolledValue());
|
|
169
|
-
});
|
|
170
|
-
slots = computed(() => toTngOtpSlots(this.length(), this.currentValue()));
|
|
171
|
-
completionState = computed(() => resolveTngOtpState(this.length(), this.currentValue()));
|
|
153
|
+
}, ...(ngDevMode ? [{ debugName: "currentValue" }] : []));
|
|
154
|
+
slots = computed(() => toTngOtpSlots(this.length(), this.currentValue()), ...(ngDevMode ? [{ debugName: "slots" }] : []));
|
|
155
|
+
completionState = computed(() => resolveTngOtpState(this.length(), this.currentValue()), ...(ngDevMode ? [{ debugName: "completionState" }] : []));
|
|
172
156
|
resolvedInputMode = computed(() => {
|
|
173
157
|
const explicit = this.inputMode();
|
|
174
158
|
if (explicit !== null) {
|
|
175
159
|
return explicit;
|
|
176
160
|
}
|
|
177
161
|
return this.type() === 'numeric' ? 'numeric' : 'text';
|
|
178
|
-
});
|
|
179
|
-
slotInputType = computed(() => this.mask() ? 'password' : 'text');
|
|
162
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedInputMode" }] : []));
|
|
163
|
+
slotInputType = computed(() => this.mask() ? 'password' : 'text', ...(ngDevMode ? [{ debugName: "slotInputType" }] : []));
|
|
180
164
|
syncUncontrolledState = effect(() => {
|
|
181
165
|
const controlled = this.valueInput();
|
|
182
166
|
const length = this.length();
|
|
@@ -200,7 +184,7 @@ let TngInputOtpComponent = class TngInputOtpComponent {
|
|
|
200
184
|
this.uncontrolledValue.set(normalizedCurrent);
|
|
201
185
|
}
|
|
202
186
|
this.activeIndexState.update((index) => clampOtpIndex(index, length));
|
|
203
|
-
});
|
|
187
|
+
}, ...(ngDevMode ? [{ debugName: "syncUncontrolledState" }] : []));
|
|
204
188
|
ngAfterViewInit() {
|
|
205
189
|
this.attachFormResetListener();
|
|
206
190
|
if (!this.autoFocus() || this.disabled()) {
|
|
@@ -477,21 +461,23 @@ let TngInputOtpComponent = class TngInputOtpComponent {
|
|
|
477
461
|
this.onChangeCallback(resetValue);
|
|
478
462
|
});
|
|
479
463
|
}
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
Component({
|
|
483
|
-
selector: 'tng-input-otp',
|
|
484
|
-
imports: [TngInputOtpPrimitive],
|
|
485
|
-
templateUrl: './tng-input-otp.component.html',
|
|
486
|
-
styleUrl: './tng-input-otp.component.css',
|
|
487
|
-
providers: [
|
|
464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngInputOtpComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
465
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: TngInputOtpComponent, isStandalone: true, selector: "tng-input-otp", inputs: { length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, valueInput: { classPropertyName: "valueInput", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, placeholderChar: { classPropertyName: "placeholderChar", publicName: "placeholderChar", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", complete: "complete" }, providers: [
|
|
488
466
|
{
|
|
489
467
|
provide: NG_VALUE_ACCESSOR,
|
|
490
468
|
useExisting: forwardRef(() => TngInputOtpComponent),
|
|
491
469
|
multi: true,
|
|
492
470
|
},
|
|
493
|
-
],
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
471
|
+
], ngImport: i0, template: "<div\n tngInputOtp\n class=\"tng-input-otp-root\"\n [id]=\"rootId()\"\n [length]=\"length()\"\n [value]=\"currentValue()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [invalid]=\"invalid()\"\n [focused]=\"focused()\"\n [focusVisible]=\"focusVisible()\"\n [activeIndex]=\"activeIndex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n>\n @for (slot of slots(); track $index) {\n <input\n class=\"tng-input-otp-slot\"\n [attr.id]=\"rootId() + '-slot-' + $index\"\n [attr.data-tng-otp-slot]=\"$index\"\n [tabIndex]=\"isSlotTabbable($index) ? 0 : -1\"\n [value]=\"slotValue($index)\"\n [attr.placeholder]=\"slotPlaceholder($index)\"\n [type]=\"slotInputType()\"\n [inputMode]=\"resolvedInputMode()\"\n [attr.autocomplete]=\"$index === 0 ? autocomplete() : 'off'\"\n [attr.aria-label]=\"slotAriaLabel($index)\"\n [readonly]=\"readonly()\"\n [disabled]=\"disabled()\"\n [required]=\"required()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n maxlength=\"1\"\n (mousedown)=\"onSlotPointerDown()\"\n (focus)=\"onSlotFocus($index, $event)\"\n (blur)=\"onSlotBlur($event)\"\n (keydown)=\"onSlotKeydown($index, $event)\"\n (input)=\"onSlotInput($index, $event)\"\n (paste)=\"onSlotPaste($index, $event)\"\n />\n }\n\n <input\n class=\"tng-input-otp-hidden-input\"\n type=\"text\"\n [value]=\"currentValue()\"\n [attr.name]=\"name()\"\n [attr.form]=\"form()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [attr.aria-hidden]=\"'true'\"\n tabindex=\"-1\"\n />\n</div>\n", styles: [":host {\n display: inline-flex;\n max-inline-size: 100%;\n}\n\n.tng-input-otp-root {\n align-items: center;\n column-gap: 0.5rem;\n display: inline-flex;\n inline-size: fit-content;\n position: relative;\n}\n\n.tng-input-otp-slot {\n appearance: none;\n background: var(--tng-semantic-background-surface);\n border: 1px solid var(--tng-semantic-border-default);\n border-radius: 0.56rem;\n color: var(--tng-semantic-foreground-primary);\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n font-weight: 600;\n inline-size: 2.45rem;\n block-size: 2.6rem;\n line-height: 1;\n text-align: center;\n transition:\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n background-color 0.15s ease,\n color 0.15s ease;\n}\n\n.tng-input-otp-slot::placeholder {\n color: var(--tng-semantic-foreground-muted);\n font-weight: 500;\n}\n\n.tng-input-otp-slot:focus-visible {\n border-color: var(--tng-semantic-accent-brand);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--tng-semantic-accent-brand) 30%, transparent);\n outline: none;\n}\n\n.tng-input-otp-slot[readonly] {\n cursor: default;\n}\n\n.tng-input-otp-slot:disabled {\n background: color-mix(in srgb, var(--tng-semantic-background-muted) 86%, transparent);\n color: var(--tng-semantic-foreground-muted);\n cursor: not-allowed;\n}\n\n.tng-input-otp-root[data-invalid] .tng-input-otp-slot {\n border-color: color-mix(in srgb, var(--tng-semantic-accent-danger) 75%, var(--tng-semantic-border-default));\n}\n\n.tng-input-otp-root[data-focus-visible] .tng-input-otp-slot[data-tng-otp-slot] {\n box-shadow: none;\n}\n\n.tng-input-otp-hidden-input {\n block-size: 1px;\n inline-size: 1px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n}\n"], dependencies: [{ kind: "directive", type: TngInputOtpPrimitive, selector: "[tngInputOtp]", inputs: ["length", "value", "disabled", "readonly", "required", "invalid", "focused", "focusVisible", "activeIndex"], exportAs: ["tngInputOtp"] }] });
|
|
472
|
+
}
|
|
473
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngInputOtpComponent, decorators: [{
|
|
474
|
+
type: Component,
|
|
475
|
+
args: [{ selector: 'tng-input-otp', imports: [TngInputOtpPrimitive], providers: [
|
|
476
|
+
{
|
|
477
|
+
provide: NG_VALUE_ACCESSOR,
|
|
478
|
+
useExisting: forwardRef(() => TngInputOtpComponent),
|
|
479
|
+
multi: true,
|
|
480
|
+
},
|
|
481
|
+
], template: "<div\n tngInputOtp\n class=\"tng-input-otp-root\"\n [id]=\"rootId()\"\n [length]=\"length()\"\n [value]=\"currentValue()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [invalid]=\"invalid()\"\n [focused]=\"focused()\"\n [focusVisible]=\"focusVisible()\"\n [activeIndex]=\"activeIndex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n>\n @for (slot of slots(); track $index) {\n <input\n class=\"tng-input-otp-slot\"\n [attr.id]=\"rootId() + '-slot-' + $index\"\n [attr.data-tng-otp-slot]=\"$index\"\n [tabIndex]=\"isSlotTabbable($index) ? 0 : -1\"\n [value]=\"slotValue($index)\"\n [attr.placeholder]=\"slotPlaceholder($index)\"\n [type]=\"slotInputType()\"\n [inputMode]=\"resolvedInputMode()\"\n [attr.autocomplete]=\"$index === 0 ? autocomplete() : 'off'\"\n [attr.aria-label]=\"slotAriaLabel($index)\"\n [readonly]=\"readonly()\"\n [disabled]=\"disabled()\"\n [required]=\"required()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n maxlength=\"1\"\n (mousedown)=\"onSlotPointerDown()\"\n (focus)=\"onSlotFocus($index, $event)\"\n (blur)=\"onSlotBlur($event)\"\n (keydown)=\"onSlotKeydown($index, $event)\"\n (input)=\"onSlotInput($index, $event)\"\n (paste)=\"onSlotPaste($index, $event)\"\n />\n }\n\n <input\n class=\"tng-input-otp-hidden-input\"\n type=\"text\"\n [value]=\"currentValue()\"\n [attr.name]=\"name()\"\n [attr.form]=\"form()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [attr.aria-hidden]=\"'true'\"\n tabindex=\"-1\"\n />\n</div>\n", styles: [":host {\n display: inline-flex;\n max-inline-size: 100%;\n}\n\n.tng-input-otp-root {\n align-items: center;\n column-gap: 0.5rem;\n display: inline-flex;\n inline-size: fit-content;\n position: relative;\n}\n\n.tng-input-otp-slot {\n appearance: none;\n background: var(--tng-semantic-background-surface);\n border: 1px solid var(--tng-semantic-border-default);\n border-radius: 0.56rem;\n color: var(--tng-semantic-foreground-primary);\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n font-weight: 600;\n inline-size: 2.45rem;\n block-size: 2.6rem;\n line-height: 1;\n text-align: center;\n transition:\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n background-color 0.15s ease,\n color 0.15s ease;\n}\n\n.tng-input-otp-slot::placeholder {\n color: var(--tng-semantic-foreground-muted);\n font-weight: 500;\n}\n\n.tng-input-otp-slot:focus-visible {\n border-color: var(--tng-semantic-accent-brand);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--tng-semantic-accent-brand) 30%, transparent);\n outline: none;\n}\n\n.tng-input-otp-slot[readonly] {\n cursor: default;\n}\n\n.tng-input-otp-slot:disabled {\n background: color-mix(in srgb, var(--tng-semantic-background-muted) 86%, transparent);\n color: var(--tng-semantic-foreground-muted);\n cursor: not-allowed;\n}\n\n.tng-input-otp-root[data-invalid] .tng-input-otp-slot {\n border-color: color-mix(in srgb, var(--tng-semantic-accent-danger) 75%, var(--tng-semantic-border-default));\n}\n\n.tng-input-otp-root[data-focus-visible] .tng-input-otp-slot[data-tng-otp-slot] {\n box-shadow: none;\n}\n\n.tng-input-otp-hidden-input {\n block-size: 1px;\n inline-size: 1px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n}\n"] }]
|
|
482
|
+
}], propDecorators: { length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], valueInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], selectOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectOnFocus", required: false }] }], placeholderChar: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholderChar", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputMode", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], complete: [{ type: i0.Output, args: ["complete"] }] } });
|
|
497
483
|
//# sourceMappingURL=tng-input-otp.component.js.map
|