@nanahoshi/mona-ui 0.17.0 → 0.18.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanahoshi/mona-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "A very light Angular UI framework",
|
|
5
5
|
"author": "Nanahoshi",
|
|
6
6
|
"repository": {
|
|
@@ -239,6 +239,10 @@
|
|
|
239
239
|
"types": "./types/nanahoshi-mona-ui-numeric-text-box.d.ts",
|
|
240
240
|
"default": "./fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs"
|
|
241
241
|
},
|
|
242
|
+
"./otp-input": {
|
|
243
|
+
"types": "./types/nanahoshi-mona-ui-otp-input.d.ts",
|
|
244
|
+
"default": "./fesm2022/nanahoshi-mona-ui-otp-input.mjs"
|
|
245
|
+
},
|
|
242
246
|
"./pager": {
|
|
243
247
|
"types": "./types/nanahoshi-mona-ui-pager.d.ts",
|
|
244
248
|
"default": "./fesm2022/nanahoshi-mona-ui-pager.mjs"
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef, TemplateRef } from '@angular/core';
|
|
3
|
+
import { FormValueControl } from '@angular/forms/signals';
|
|
4
|
+
import { VariantInputs, AttributeConfig } from '@nanahoshi/mona-ui/internal';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
type OtpInputType = "text" | "number" | "password";
|
|
9
|
+
|
|
10
|
+
declare const otpInputSlotThemeVariants: (props?: ({
|
|
11
|
+
rounded?: "full" | "large" | "medium" | "none" | "small" | null | undefined;
|
|
12
|
+
size?: "large" | "medium" | "small" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
|
+
type OtpInputSlotVariantProps = VariantProps<typeof otpInputSlotThemeVariants>;
|
|
15
|
+
type OtpInputSlotVariantInput = VariantInputs<OtpInputSlotVariantProps>;
|
|
16
|
+
type OtpInputVariantProps = OtpInputSlotVariantProps;
|
|
17
|
+
type OtpInputVariantInput = OtpInputSlotVariantInput;
|
|
18
|
+
|
|
19
|
+
interface OtpSlotViewModel {
|
|
20
|
+
active: boolean;
|
|
21
|
+
classes: string;
|
|
22
|
+
displayCharacter: string;
|
|
23
|
+
filled: boolean;
|
|
24
|
+
index: number;
|
|
25
|
+
placeholder: boolean;
|
|
26
|
+
selected: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface OtpGroupViewModel {
|
|
29
|
+
index: number;
|
|
30
|
+
slots: OtpSlotViewModel[];
|
|
31
|
+
}
|
|
32
|
+
declare class OtpInputComponent implements OtpInputVariantInput, FormValueControl<string> {
|
|
33
|
+
protected readonly activeSlotIndex: _angular_core.Signal<number>;
|
|
34
|
+
protected readonly classes: _angular_core.Signal<string>;
|
|
35
|
+
protected readonly computedAriaLabel: _angular_core.Signal<string | null>;
|
|
36
|
+
protected readonly computedAriaLabelledby: _angular_core.Signal<string | null>;
|
|
37
|
+
protected readonly derivedAutocomplete: _angular_core.Signal<string>;
|
|
38
|
+
protected readonly derivedInputMode: _angular_core.Signal<string>;
|
|
39
|
+
protected readonly hasFocus: _angular_core.WritableSignal<boolean>;
|
|
40
|
+
protected readonly inputClass: _angular_core.Signal<string>;
|
|
41
|
+
protected readonly inputRef: _angular_core.Signal<ElementRef<HTMLInputElement>>;
|
|
42
|
+
protected readonly invalidState: _angular_core.Signal<boolean>;
|
|
43
|
+
protected readonly isComplete: _angular_core.Signal<boolean>;
|
|
44
|
+
protected readonly isComposing: _angular_core.WritableSignal<boolean>;
|
|
45
|
+
protected readonly logicalSelectionEnd: _angular_core.Signal<number>;
|
|
46
|
+
protected readonly logicalSelectionStart: _angular_core.Signal<number>;
|
|
47
|
+
protected readonly nativeInputType: _angular_core.Signal<"text" | "password">;
|
|
48
|
+
protected readonly normalizedLength: _angular_core.Signal<number>;
|
|
49
|
+
protected readonly sanitizedAttributes: _angular_core.Signal<AttributeConfig>;
|
|
50
|
+
protected readonly selectionEnd: _angular_core.WritableSignal<number>;
|
|
51
|
+
protected readonly selectionStart: _angular_core.WritableSignal<number>;
|
|
52
|
+
protected readonly separatorTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
|
|
53
|
+
protected readonly visualGroups: _angular_core.Signal<OtpGroupViewModel[]>;
|
|
54
|
+
/**
|
|
55
|
+
* @description Accessible name for the inner `<input>` element.
|
|
56
|
+
* @default "Verification code"
|
|
57
|
+
*/
|
|
58
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
59
|
+
/**
|
|
60
|
+
* @description Regular expression used to determine whether each individual OTP character is allowed.
|
|
61
|
+
* @default null
|
|
62
|
+
*/
|
|
63
|
+
readonly characterPattern: _angular_core.InputSignal<RegExp | null>;
|
|
64
|
+
/**
|
|
65
|
+
* @description Emitted when a user interaction completes the verification code.
|
|
66
|
+
*/
|
|
67
|
+
readonly complete: _angular_core.OutputEmitterRef<string>;
|
|
68
|
+
/**
|
|
69
|
+
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
70
|
+
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* @description Configures slot grouping lengths. Accepts a uniform number or an array of group sizes.
|
|
76
|
+
* @default null
|
|
77
|
+
*/
|
|
78
|
+
readonly groupLength: _angular_core.InputSignal<number | number[] | null>;
|
|
79
|
+
/**
|
|
80
|
+
* @description Additional HTML attributes applied directly to the inner `<input>` element.
|
|
81
|
+
* @default {}
|
|
82
|
+
*/
|
|
83
|
+
readonly inputAttributes: _angular_core.InputSignal<AttributeConfig>;
|
|
84
|
+
/**
|
|
85
|
+
* @description Emitted when the inner input loses focus.
|
|
86
|
+
*/
|
|
87
|
+
readonly inputBlur: _angular_core.OutputEmitterRef<FocusEvent>;
|
|
88
|
+
/**
|
|
89
|
+
* @description Emitted when the inner input gains focus.
|
|
90
|
+
*/
|
|
91
|
+
readonly inputFocus: _angular_core.OutputEmitterRef<FocusEvent>;
|
|
92
|
+
/**
|
|
93
|
+
* @description Marks the OTP input as invalid. When bound to a signal form field via `[formField]`,
|
|
94
|
+
* this is written by the `FormField` directive.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
readonly invalid: _angular_core.InputSignal<boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* @description Sets the total number of characters accepted by the OTP input and the number of visual slots.
|
|
100
|
+
* @default 4
|
|
101
|
+
*/
|
|
102
|
+
readonly length: _angular_core.InputSignal<number>;
|
|
103
|
+
/**
|
|
104
|
+
* @description Hint character displayed in empty visual slots.
|
|
105
|
+
* @default ""
|
|
106
|
+
*/
|
|
107
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
108
|
+
/**
|
|
109
|
+
* @description Prevents value changes while preserving the component's focusability and visual state.
|
|
110
|
+
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
readonly readonly: _angular_core.InputSignal<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* @description Marks the OTP input as required. Triggers invalid state when touched and incomplete.
|
|
116
|
+
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
readonly required: _angular_core.InputSignal<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* @description Border-radius preset applied to the OTP slots.
|
|
122
|
+
* @default "medium"
|
|
123
|
+
*/
|
|
124
|
+
readonly rounded: _angular_core.InputSignal<"full" | "large" | "medium" | "none" | "small" | null | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* @description Text character or string displayed between visual slot groups.
|
|
127
|
+
* @default ""
|
|
128
|
+
*/
|
|
129
|
+
readonly separator: _angular_core.InputSignal<string>;
|
|
130
|
+
/**
|
|
131
|
+
* @description Additional CSS classes applied to separator elements.
|
|
132
|
+
* @default ""
|
|
133
|
+
*/
|
|
134
|
+
readonly separatorClass: _angular_core.InputSignal<string | string[]>;
|
|
135
|
+
/**
|
|
136
|
+
* @description Size preset controlling the dimensions and font size of the OTP slots.
|
|
137
|
+
* @default "medium"
|
|
138
|
+
*/
|
|
139
|
+
readonly size: _angular_core.InputSignal<"large" | "medium" | "small" | null | undefined>;
|
|
140
|
+
/**
|
|
141
|
+
* @description Additional CSS classes applied to each visual slot element.
|
|
142
|
+
* @default ""
|
|
143
|
+
*/
|
|
144
|
+
readonly slotClass: _angular_core.InputSignal<string | string[]>;
|
|
145
|
+
/**
|
|
146
|
+
* @description Determines whether visual slots within a group have spacing between them or are joined together.
|
|
147
|
+
* @default true
|
|
148
|
+
*/
|
|
149
|
+
readonly spacing: _angular_core.InputSignal<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* @description Emitted when the OTP input is interacted with — on blur or user value change.
|
|
152
|
+
* The `FormField` directive listens to this to mark the field as touched.
|
|
153
|
+
*/
|
|
154
|
+
readonly touch: _angular_core.OutputEmitterRef<void>;
|
|
155
|
+
/**
|
|
156
|
+
* @description Sets the touched state of the OTP input. When bound to a signal form field via `[formField]`,
|
|
157
|
+
* this is written by the `FormField` directive.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
readonly touched: _angular_core.InputSignal<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* @description Sets the type of the OTP input ("text", "number", or "password").
|
|
163
|
+
* @default "text"
|
|
164
|
+
*/
|
|
165
|
+
readonly type: _angular_core.InputSignal<OtpInputType>;
|
|
166
|
+
/**
|
|
167
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
168
|
+
* @default ""
|
|
169
|
+
*/
|
|
170
|
+
readonly userClass: _angular_core.InputSignal<string>;
|
|
171
|
+
/**
|
|
172
|
+
* @description Two-way bindable current value of the OTP input.
|
|
173
|
+
* @default ""
|
|
174
|
+
*/
|
|
175
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
176
|
+
constructor();
|
|
177
|
+
blur(): void;
|
|
178
|
+
focus(options?: FocusOptions): void;
|
|
179
|
+
focus(index?: number): void;
|
|
180
|
+
protected onBeforeInput(event: InputEvent): void;
|
|
181
|
+
protected onBlur(event: FocusEvent): void;
|
|
182
|
+
protected onCompositionEnd(event: CompositionEvent): void;
|
|
183
|
+
protected onCompositionStart(): void;
|
|
184
|
+
protected onFocus(event: FocusEvent): void;
|
|
185
|
+
protected onInput(_event?: Event): void;
|
|
186
|
+
protected onKeyDown(event: KeyboardEvent): void;
|
|
187
|
+
protected onKeyUp(): void;
|
|
188
|
+
protected onPaste(event: ClipboardEvent): void;
|
|
189
|
+
protected onSelect(): void;
|
|
190
|
+
protected onSlotPointerDown(event: PointerEvent, index: number): void;
|
|
191
|
+
private applyUserInsertion;
|
|
192
|
+
private syncSelection;
|
|
193
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OtpInputComponent, never>;
|
|
194
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<OtpInputComponent, "mona-otp-input", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "characterPattern": { "alias": "characterPattern"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "groupLength": { "alias": "groupLength"; "required": false; "isSignal": true; }; "inputAttributes": { "alias": "inputAttributes"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "separator": { "alias": "separator"; "required": false; "isSignal": true; }; "separatorClass": { "alias": "separatorClass"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "slotClass": { "alias": "slotClass"; "required": false; "isSignal": true; }; "spacing": { "alias": "spacing"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "complete": "complete"; "inputBlur": "inputBlur"; "inputFocus": "inputFocus"; "touch": "touch"; "value": "valueChange"; }, ["separatorTemplate"], never, true, never>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface OtpInputSeparatorContext {
|
|
198
|
+
$implicit: number;
|
|
199
|
+
groupIndex: number;
|
|
200
|
+
}
|
|
201
|
+
declare class OtpInputSeparatorTemplateDirective {
|
|
202
|
+
readonly templateRef: TemplateRef<any>;
|
|
203
|
+
static ngTemplateContextGuard(_directive: OtpInputSeparatorTemplateDirective, _context: unknown): _context is OtpInputSeparatorContext;
|
|
204
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OtpInputSeparatorTemplateDirective, never>;
|
|
205
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<OtpInputSeparatorTemplateDirective, "ng-template[monaOtpInputSeparatorTemplate]", never, {}, {}, never, never, true, never>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export { OtpInputComponent, OtpInputSeparatorTemplateDirective };
|
|
209
|
+
export type { OtpInputSeparatorContext, OtpInputType, OtpInputVariantProps };
|