@liquid-js/lyr-extras 0.0.0-stage → 22.0.0-alpha.1
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.txt +23 -0
- package/README.md +61 -2
- package/fesm2022/liquid-js-lyr-extras-chart.mjs +871 -0
- package/fesm2022/liquid-js-lyr-extras-chart.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs +821 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs +923 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs +369 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs +240 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs +1142 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs +864 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs +236 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras.mjs +0 -0
- package/package.json +159 -3
- package/types/liquid-js-lyr-extras-chart.d.ts +294 -0
- package/types/liquid-js-lyr-extras-color-picker.d.ts +311 -0
- package/types/liquid-js-lyr-extras-markdown-editor.d.ts +367 -0
- package/types/liquid-js-lyr-extras-markdown-viewer.d.ts +174 -0
- package/types/liquid-js-lyr-extras-mask.d.ts +130 -0
- package/types/liquid-js-lyr-extras-media.d.ts +517 -0
- package/types/liquid-js-lyr-extras-phone-input.d.ts +428 -0
- package/types/liquid-js-lyr-extras-qr-code.d.ts +113 -0
- package/types/liquid-js-lyr-extras.d.ts +1 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator, ValidatorFn } from "@angular/forms";
|
|
5
|
+
import { SchemaPath } from "@angular/forms/signals";
|
|
6
|
+
import { NbComponentShape, NbComponentSize, NbValidationDirective, NbValidationError } from "@liquid-js/lyr-core";
|
|
7
|
+
import { CountryCode, PhoneNumber } from "libphonenumber-js";
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import { ElementRef, Injector, OnInit, Provider } from "@angular/core";
|
|
10
|
+
import { FlagDatabaseKey } from "nxt-flags";
|
|
11
|
+
/**
|
|
12
|
+
* The texts of the phone input. `provideNbTexts({ phoneInput: { ... } })` changes them, and they're translated with
|
|
13
|
+
* Angular's i18n, as `$localize` messages with ids like `@@nb.phoneInput.invalid`.
|
|
14
|
+
*/
|
|
15
|
+
interface NbPhoneInputTexts {
|
|
16
|
+
/** Names the number field when it has no `aria-label` or `aria-labelledby`. */
|
|
17
|
+
number: string;
|
|
18
|
+
/** Label of the button that picks the country, given the country's name. */
|
|
19
|
+
country: (name: string) => string;
|
|
20
|
+
/** Label of the button that picks the country while there's none. */
|
|
21
|
+
noCountry: string;
|
|
22
|
+
/** Label and placeholder of the field that searches the countries. */
|
|
23
|
+
search: string;
|
|
24
|
+
/** The message of the `nbPhoneNumber` error for a number that isn't valid. */
|
|
25
|
+
invalid: string;
|
|
26
|
+
/** The message of the `nbPhoneNumber` error for a number from a country that isn't allowed. */
|
|
27
|
+
otherCountry: string;
|
|
28
|
+
}
|
|
29
|
+
declare module '@liquid-js/lyr-core' {
|
|
30
|
+
interface NbTexts {
|
|
31
|
+
phoneInput: NbPhoneInputTexts;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The error kind of a phone number that isn't valid or isn't from an allowed country. */
|
|
35
|
+
export declare const NB_PHONE_NUMBER_ERROR: "nbPhoneNumber";
|
|
36
|
+
/**
|
|
37
|
+
* What's wrong with a phone number: it isn't valid (`invalid`), or it's from a country that isn't allowed (`country`).
|
|
38
|
+
*/
|
|
39
|
+
type NbPhoneNumberProblem = 'invalid' | 'country';
|
|
40
|
+
/**
|
|
41
|
+
* The `nbPhoneNumber` error, the same in signal, reactive and template-driven forms, as Angular gives parse errors:
|
|
42
|
+
* its kind, what's wrong, and its message.
|
|
43
|
+
*/
|
|
44
|
+
interface NbPhoneNumberError {
|
|
45
|
+
kind: typeof NB_PHONE_NUMBER_ERROR;
|
|
46
|
+
problem: NbPhoneNumberProblem;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
/** A value, or a function that gives it, e.g. from another control or a signal. */
|
|
50
|
+
type NbPhoneNumberOption<T> = T | (() => T);
|
|
51
|
+
/** A message of this validator's errors, or a function that gives it for what's wrong. */
|
|
52
|
+
type NbPhoneNumberMessage = string | ((problem: NbPhoneNumberProblem) => string);
|
|
53
|
+
interface NbPhoneNumberOptions {
|
|
54
|
+
/** The country of numbers without a calling code; the app locale's country by default. */
|
|
55
|
+
country?: NbPhoneNumberOption<CountryCode | undefined>;
|
|
56
|
+
/** The countries whose numbers pass, all by default. */
|
|
57
|
+
countries?: NbPhoneNumberOption<ReadonlyArray<CountryCode> | undefined>;
|
|
58
|
+
/** The message of its errors, in place of the app's (`provideNbValidation`, `provideNbTexts`). */
|
|
59
|
+
message?: NbPhoneNumberMessage;
|
|
60
|
+
}
|
|
61
|
+
/** Where the errors take their messages and numbers their country from. @internal */
|
|
62
|
+
interface NbPhoneNumberContext {
|
|
63
|
+
texts: () => NbPhoneInputTexts;
|
|
64
|
+
/** The message of an error, as `nb-validation-errors` shows it. */
|
|
65
|
+
message: (error: NbValidationError) => string;
|
|
66
|
+
country?: CountryCode;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validates a phone number in reactive forms: an empty value passes, a number that isn't valid or isn't from one of
|
|
70
|
+
* `countries` gets the `nbPhoneNumber` error, with its message. In templates, use the `nbPhoneNumber` attribute.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* readonly phone = new FormControl('', nbPhoneNumberValidator({ countries: ['US', 'CA'] }));
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* The error's message is `message`, if given, or the one `nb-validation-errors` shows for `nbPhoneNumber`: the app's
|
|
77
|
+
* (`provideNbValidation`, `provideNbTexts({ validation })`), or the phone input's texts, `invalid` or
|
|
78
|
+
* `otherCountry`. Made in an injection context, e.g. in a field initializer, it reads numbers in the app locale's
|
|
79
|
+
* country and has the app's messages; elsewhere, numbers need a calling code unless `country` is given, and the
|
|
80
|
+
* messages are the default ones.
|
|
81
|
+
*/
|
|
82
|
+
export declare function nbPhoneNumberValidator(options?: NbPhoneNumberOptions): ValidatorFn;
|
|
83
|
+
/**
|
|
84
|
+
* Validates a phone number in signal forms, as `nbPhoneNumberValidator` does:
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* readonly form = form(this.model, (path) => {
|
|
88
|
+
* nbPhoneNumber(path.phone, { countries: ['US', 'CA'] });
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function nbPhoneNumber(path: SchemaPath<string | null | undefined>, options?: NbPhoneNumberOptions): void;
|
|
93
|
+
/** A country in the list. */
|
|
94
|
+
interface NbPhoneCountry {
|
|
95
|
+
code: CountryCode;
|
|
96
|
+
name: string;
|
|
97
|
+
callingCode: string;
|
|
98
|
+
/** The names, the calling code and the ISO code, as the search compares them. */
|
|
99
|
+
search: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A phone number field with the country's flag, which picks the country:
|
|
103
|
+
*
|
|
104
|
+
* ```html
|
|
105
|
+
* <nb-phone-input formControlName="phone" />
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @stacked-example(Showcase, phone-input/phone-input-showcase.component)
|
|
109
|
+
*
|
|
110
|
+
* ### Installation
|
|
111
|
+
*
|
|
112
|
+
* It parses and formats numbers with [`libphonenumber-js`](https://www.npmjs.com/package/libphonenumber-js), names
|
|
113
|
+
* the countries with [`i18n-iso-countries`](https://www.npmjs.com/package/i18n-iso-countries)' language files, and
|
|
114
|
+
* shows flags with [`nxt-flags`](https://www.npmjs.com/package/nxt-flags); install them and import
|
|
115
|
+
* `NbPhoneInputComponent` from `@liquid-js/lyr-extras/phone-input`.
|
|
116
|
+
*
|
|
117
|
+
* ```sh
|
|
118
|
+
* npm install libphonenumber-js i18n-iso-countries nxt-flags
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* The flags are images the app serves from `assets/flags`; add them to the assets in `angular.json`:
|
|
122
|
+
*
|
|
123
|
+
* ```json
|
|
124
|
+
* { "glob": "*.svg", "input": "node_modules/nxt-flags/assets/flags", "output": "assets/flags" }
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* To serve them from elsewhere, e.g. a CDN, set the path with `provideFlagsPath()` from `nxt-flags`.
|
|
128
|
+
*
|
|
129
|
+
* ### Usage
|
|
130
|
+
*
|
|
131
|
+
* The user types the number in their country's format or with a calling code, e.g. `+44`, which picks the country.
|
|
132
|
+
* The flag button replaces the field with a search of the countries, by name or calling code; Escape goes back.
|
|
133
|
+
* The country is the one of the app's locale (`LOCALE_ID`) until the user or a number picks another, or set it with
|
|
134
|
+
* `country`, which also tells which one is picked. It has the sizes, statuses, shapes and `ghost` look of `nbInput`,
|
|
135
|
+
* and its `placeholder` and `readonly`; the placeholder is an example number of the country by default.
|
|
136
|
+
* @stacked-example(Sizes and statuses, phone-input/phone-input-sizes.component)
|
|
137
|
+
*
|
|
138
|
+
* The value is the number in the `E.164` format, e.g. `+12015550123`, or `null` without one; when the field leaves,
|
|
139
|
+
* it shows the number in its country's format, `(201) 555-0123`. While the text isn't a valid number, the value
|
|
140
|
+
* stays the last valid one, or `null`, and the field has the `nbPhoneNumber` parse error,
|
|
141
|
+
* `{ kind, problem: 'invalid', message }`, as Angular's controls report text they can't parse; so validators never
|
|
142
|
+
* see the text. A number from a country that isn't in `countries`, which the list offers, has the same error with
|
|
143
|
+
* `problem: 'country'`. The errors work in reactive, template-driven and signal forms alike.
|
|
144
|
+
*
|
|
145
|
+
* It works with `formControl`, `formControlName`, `ngModel` and signal forms' `[formField]`.
|
|
146
|
+
* @stacked-example(Validation, phone-input/phone-input-validation.component)
|
|
147
|
+
*
|
|
148
|
+
* ### Validators
|
|
149
|
+
*
|
|
150
|
+
* Phone numbers in other fields, e.g. a text field or data from elsewhere, are checked the same way with validators:
|
|
151
|
+
* `nbPhoneNumberValidator(options)` in reactive forms, the `nbPhoneNumber` attribute in template-driven forms, and
|
|
152
|
+
* `nbPhoneNumber(path, options)` in signal forms. The options are the `country` of numbers without a
|
|
153
|
+
* calling code, the app locale's by default, and the `countries` whose numbers pass, each a value or a function that
|
|
154
|
+
* gives it, and the `message` of the errors, a text or a function of what's wrong, in place of the app's. Their
|
|
155
|
+
* `nbPhoneNumber` error says what's wrong, `invalid` or `country`, with its message.
|
|
156
|
+
*
|
|
157
|
+
* ```ts
|
|
158
|
+
* readonly phone = new FormControl<string | null>(null, nbPhoneNumberValidator({ countries: ['US', 'CA'] }));
|
|
159
|
+
*
|
|
160
|
+
* readonly contactForm = form(this.contact, (path) => {
|
|
161
|
+
* nbPhoneNumber(path.phone, { countries: ['GB'] });
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* ```html
|
|
166
|
+
* <input nbInput type="tel" name="support" ngModel nbPhoneNumber [nbPhoneNumberCountries]="['US', 'CA']" />
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* ### Country names
|
|
170
|
+
*
|
|
171
|
+
* The countries are named in English. For other languages, provide the language file of `i18n-iso-countries`, e.g.
|
|
172
|
+
* per locale's build, or loaded by `LOCALE_ID`:
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* providers: [provideNbCountryNames(() => import('i18n-iso-countries/langs/de.json'))]
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* Countries without a name in the file aren't in the list; their numbers are still accepted.
|
|
179
|
+
*/
|
|
180
|
+
export declare class NbPhoneInputComponent implements OnInit, ControlValueAccessor, Validator {
|
|
181
|
+
protected readonly nbDefaults: import("@angular/core").Signal<import("@liquid-js/lyr-core").NbControlDefaults>;
|
|
182
|
+
protected readonly texts: import("@angular/core").Signal<import("@liquid-js/lyr-extras/phone-input").NbPhoneInputTexts>;
|
|
183
|
+
/** Where its errors take their messages from. */
|
|
184
|
+
protected readonly errorContext: NbPhoneNumberContext;
|
|
185
|
+
protected readonly locale: string;
|
|
186
|
+
protected readonly injector: Injector;
|
|
187
|
+
protected readonly validation: NbValidationDirective | null;
|
|
188
|
+
/**
|
|
189
|
+
* The country of the number: the app locale's country at first, unless it's set, then the one the user or the number
|
|
190
|
+
* picks.
|
|
191
|
+
*/
|
|
192
|
+
readonly country: import("@angular/core").ModelSignal<CountryCode | undefined>;
|
|
193
|
+
/** The countries in the list, whose numbers pass, all by default. */
|
|
194
|
+
readonly countries: import("@angular/core").InputSignal<readonly CountryCode[] | undefined>;
|
|
195
|
+
/** Field size: `tiny`, `small`, `medium` (default), `large` or `giant`. */
|
|
196
|
+
readonly sizeInput: import("@angular/core").InputSignal<NbComponentSize | undefined>;
|
|
197
|
+
/** The size in use: the input's, the app's default, or 'medium'. */
|
|
198
|
+
readonly size: import("@angular/core").WritableSignal<NbComponentSize>;
|
|
199
|
+
/** Field status: `basic` (default), `primary`, `info`, `success`, `warning`, `danger` or `control`. */
|
|
200
|
+
readonly status: import("@angular/core").InputSignal<string>;
|
|
201
|
+
/** Field shape: `rectangle` (default), `semi-round` or `round`. */
|
|
202
|
+
readonly shapeInput: import("@angular/core").InputSignal<NbComponentShape | undefined>;
|
|
203
|
+
/** The shape in use: the input's, the app's default, or 'rectangle'. */
|
|
204
|
+
readonly shape: import("@angular/core").WritableSignal<NbComponentShape>;
|
|
205
|
+
readonly fullWidth: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
206
|
+
/** Shows the field without its background and border, as `nbInput`'s `ghost` does. */
|
|
207
|
+
readonly ghost: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
208
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
209
|
+
/** Lets the user read and select the number, but not change it or its country, as a read-only field. */
|
|
210
|
+
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
211
|
+
/** The number field's placeholder; an example number of the country by default. */
|
|
212
|
+
readonly placeholder: import("@angular/core").InputSignal<string | undefined>;
|
|
213
|
+
/** The country list's distance from the search field, as other fields' overlays have it. */
|
|
214
|
+
readonly overlayOffset: import("@angular/core").InputSignal<number>;
|
|
215
|
+
/** Names the number field when there's no `aria-labelledby`; "Phone number" by default. */
|
|
216
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
217
|
+
/** The id of the element that names the number field, e.g. a `label`. */
|
|
218
|
+
readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
|
|
219
|
+
/** What labels the field: its own `aria-labelledby` and an `nbLabel` of its `nbValidation`. */
|
|
220
|
+
protected readonly fieldLabelledBy: import("@angular/core").Signal<string | null>;
|
|
221
|
+
/** The country the number is parsed in, the locale's until `country` has one. */
|
|
222
|
+
readonly selectedCountry: import("@angular/core").Signal<CountryCode | undefined>;
|
|
223
|
+
constructor();
|
|
224
|
+
ngOnInit(): void;
|
|
225
|
+
protected readonly isDisabled: import("@angular/core").WritableSignal<boolean>;
|
|
226
|
+
protected readonly resolvedStatus: import("@angular/core").Signal<string>;
|
|
227
|
+
/** The field's buttons are white on colour, with the `control` status, and grey otherwise. */
|
|
228
|
+
protected readonly buttonStatus: import("@angular/core").Signal<"basic" | "control">;
|
|
229
|
+
/** The number as the field shows it. */
|
|
230
|
+
protected readonly text: import("@angular/core").WritableSignal<string>;
|
|
231
|
+
/** Whether the text isn't a valid number. */
|
|
232
|
+
protected readonly parseError: import("@angular/core").WritableSignal<boolean>;
|
|
233
|
+
/** Whether the search of the countries replaces the number field. */
|
|
234
|
+
protected readonly picking: import("@angular/core").WritableSignal<boolean>;
|
|
235
|
+
protected readonly query: import("@angular/core").WritableSignal<string>;
|
|
236
|
+
protected readonly namesSource: import("@liquid-js/lyr-extras/phone-input").NbCountryNamesSource;
|
|
237
|
+
protected readonly names: import("@angular/core").ResourceRef<import("@liquid-js/lyr-extras/phone-input").NbCountryNames | undefined>;
|
|
238
|
+
/** The countries with a name, in the language's order. */
|
|
239
|
+
protected readonly list: import("@angular/core").Signal<NbPhoneCountry[]>;
|
|
240
|
+
/** The countries the search finds. */
|
|
241
|
+
protected readonly shown: import("@angular/core").Signal<NbPhoneCountry[]>;
|
|
242
|
+
protected readonly countryName: import("@angular/core").Signal<string | undefined>;
|
|
243
|
+
protected readonly countryLabel: import("@angular/core").Signal<string>;
|
|
244
|
+
/** An example number of the country, in its format. */
|
|
245
|
+
protected readonly example: import("@angular/core").Signal<string>;
|
|
246
|
+
protected readonly numberField: import("@angular/core").Signal<ElementRef<HTMLInputElement>>;
|
|
247
|
+
protected readonly searchField: import("@angular/core").Signal<ElementRef<HTMLInputElement>>;
|
|
248
|
+
/** The value last given to the form, `null` without one. */
|
|
249
|
+
protected value: string | null;
|
|
250
|
+
protected onChange: (value: string | null) => void;
|
|
251
|
+
protected onTouched: () => void;
|
|
252
|
+
protected onValidatorChange: () => void;
|
|
253
|
+
writeValue(value?: string | null): void;
|
|
254
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
255
|
+
registerOnTouched(fn: () => void): void;
|
|
256
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
257
|
+
setDisabledState(disabled: boolean): void;
|
|
258
|
+
/** The parse error of text that isn't a valid number, or the error of a number from a country not in `countries`. */
|
|
259
|
+
validate(): ValidationErrors | null;
|
|
260
|
+
/** Moves focus to the number. */
|
|
261
|
+
focus(): void;
|
|
262
|
+
/** Sets `country`, when it's another. */
|
|
263
|
+
protected pickCountry(code?: CountryCode): void;
|
|
264
|
+
/** The flag of a country, the unknown flag without one. */
|
|
265
|
+
protected flag(code?: CountryCode): FlagDatabaseKey;
|
|
266
|
+
protected typed(event: Event): void;
|
|
267
|
+
protected left(): void;
|
|
268
|
+
/** Replaces the number field with the search of the countries, whose list opens. */
|
|
269
|
+
protected pick(): void;
|
|
270
|
+
protected searched(event: Event): void;
|
|
271
|
+
protected chose(country?: NbPhoneCountry | string): void;
|
|
272
|
+
/**
|
|
273
|
+
* Escape in the search goes back to the number, the list closing too; it's handled, so nothing else closes, e.g. a
|
|
274
|
+
* dialog around it.
|
|
275
|
+
*/
|
|
276
|
+
protected searchEscaped(event: Event): void;
|
|
277
|
+
/** Leaving the search touches the control, as leaving an autocomplete's input does. */
|
|
278
|
+
protected searchLeft(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Shows the number field again, and moves focus to it after Escape or picking a country, which can come after the
|
|
281
|
+
* search field lost focus to the list.
|
|
282
|
+
*/
|
|
283
|
+
protected stopPicking(focus: boolean): void;
|
|
284
|
+
/** What the search field shows: the text typed in it, or the name of the country picked. */
|
|
285
|
+
protected readonly displayCountry: (value?: NbPhoneCountry | string) => string;
|
|
286
|
+
/** The valid number in the text, in the picked country unless it has a calling code. */
|
|
287
|
+
protected parse(text: string): PhoneNumber | undefined;
|
|
288
|
+
/** A number as the field shows it: in its country's format, or international without one. */
|
|
289
|
+
protected display(number: PhoneNumber): string;
|
|
290
|
+
/**
|
|
291
|
+
* Gives the form the number in the text, when it's another; while the text isn't a valid number, the value stays
|
|
292
|
+
* and the field has the parse error.
|
|
293
|
+
*/
|
|
294
|
+
protected update(): void;
|
|
295
|
+
protected setParseError(parseError: boolean): void;
|
|
296
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbPhoneInputComponent, never>;
|
|
297
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbPhoneInputComponent, "nb-phone-input", never, {
|
|
298
|
+
"country": {
|
|
299
|
+
"alias": "country";
|
|
300
|
+
"required": false;
|
|
301
|
+
"isSignal": true;
|
|
302
|
+
};
|
|
303
|
+
"countries": {
|
|
304
|
+
"alias": "countries";
|
|
305
|
+
"required": false;
|
|
306
|
+
"isSignal": true;
|
|
307
|
+
};
|
|
308
|
+
"sizeInput": {
|
|
309
|
+
"alias": "size";
|
|
310
|
+
"required": false;
|
|
311
|
+
"isSignal": true;
|
|
312
|
+
};
|
|
313
|
+
"status": {
|
|
314
|
+
"alias": "status";
|
|
315
|
+
"required": false;
|
|
316
|
+
"isSignal": true;
|
|
317
|
+
};
|
|
318
|
+
"shapeInput": {
|
|
319
|
+
"alias": "shape";
|
|
320
|
+
"required": false;
|
|
321
|
+
"isSignal": true;
|
|
322
|
+
};
|
|
323
|
+
"fullWidth": {
|
|
324
|
+
"alias": "fullWidth";
|
|
325
|
+
"required": false;
|
|
326
|
+
"isSignal": true;
|
|
327
|
+
};
|
|
328
|
+
"ghost": {
|
|
329
|
+
"alias": "ghost";
|
|
330
|
+
"required": false;
|
|
331
|
+
"isSignal": true;
|
|
332
|
+
};
|
|
333
|
+
"disabled": {
|
|
334
|
+
"alias": "disabled";
|
|
335
|
+
"required": false;
|
|
336
|
+
"isSignal": true;
|
|
337
|
+
};
|
|
338
|
+
"readonly": {
|
|
339
|
+
"alias": "readonly";
|
|
340
|
+
"required": false;
|
|
341
|
+
"isSignal": true;
|
|
342
|
+
};
|
|
343
|
+
"placeholder": {
|
|
344
|
+
"alias": "placeholder";
|
|
345
|
+
"required": false;
|
|
346
|
+
"isSignal": true;
|
|
347
|
+
};
|
|
348
|
+
"overlayOffset": {
|
|
349
|
+
"alias": "overlayOffset";
|
|
350
|
+
"required": false;
|
|
351
|
+
"isSignal": true;
|
|
352
|
+
};
|
|
353
|
+
"ariaLabel": {
|
|
354
|
+
"alias": "aria-label";
|
|
355
|
+
"required": false;
|
|
356
|
+
"isSignal": true;
|
|
357
|
+
};
|
|
358
|
+
"ariaLabelledBy": {
|
|
359
|
+
"alias": "aria-labelledby";
|
|
360
|
+
"required": false;
|
|
361
|
+
"isSignal": true;
|
|
362
|
+
};
|
|
363
|
+
}, {
|
|
364
|
+
"country": "countryChange";
|
|
365
|
+
}, never, never, true, never>;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Country names in a language, as the language files of
|
|
369
|
+
* [`i18n-iso-countries`](https://www.npmjs.com/package/i18n-iso-countries) have them, e.g. its `langs/de.json`: the
|
|
370
|
+
* language and the names by ISO 3166-1 code, each a name or a list of names, the first of which is shown.
|
|
371
|
+
*/
|
|
372
|
+
interface NbCountryNames {
|
|
373
|
+
locale: string;
|
|
374
|
+
countries: Record<string, string | string[]>;
|
|
375
|
+
}
|
|
376
|
+
/** Country names, or a function that loads them, e.g. `() => import('i18n-iso-countries/langs/de.json')`. */
|
|
377
|
+
type NbCountryNamesSource = NbCountryNames | (() => Promise<NbCountryNames | {
|
|
378
|
+
default: NbCountryNames;
|
|
379
|
+
}>);
|
|
380
|
+
/**
|
|
381
|
+
* Sets the language of the country names in the phone input, English by default, for the app or for the components
|
|
382
|
+
* inside the one that provides it:
|
|
383
|
+
*
|
|
384
|
+
* ```ts
|
|
385
|
+
* providers: [provideNbCountryNames(() => import('i18n-iso-countries/langs/de.json'))]
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function provideNbCountryNames(names: NbCountryNamesSource): Provider[];
|
|
389
|
+
/**
|
|
390
|
+
* Validates a phone number in template-driven forms, as `nbPhoneNumberValidator` does in reactive forms:
|
|
391
|
+
*
|
|
392
|
+
* ```html
|
|
393
|
+
* <input nbInput type="tel" name="phone" ngModel nbPhoneNumber [nbPhoneNumberCountries]="['US', 'CA']" />
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
export declare class NbPhoneNumberValidatorDirective implements Validator {
|
|
397
|
+
/** The country of numbers without a calling code; the app locale's country by default. */
|
|
398
|
+
readonly country: import("@angular/core").InputSignal<CountryCode | undefined>;
|
|
399
|
+
/** The countries whose numbers pass, all by default. */
|
|
400
|
+
readonly countries: import("@angular/core").InputSignal<readonly CountryCode[] | undefined>;
|
|
401
|
+
/** The message of its errors, in place of the app's. */
|
|
402
|
+
readonly message: import("@angular/core").InputSignal<NbPhoneNumberMessage | undefined>;
|
|
403
|
+
protected readonly isInput: boolean;
|
|
404
|
+
protected readonly context: NbPhoneNumberContext;
|
|
405
|
+
protected onValidatorChange: () => void;
|
|
406
|
+
constructor();
|
|
407
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
408
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
409
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbPhoneNumberValidatorDirective, never>;
|
|
410
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NbPhoneNumberValidatorDirective, "[nbPhoneNumber][ngModel],[nbPhoneNumber][formControl],[nbPhoneNumber][formControlName]", never, {
|
|
411
|
+
"country": {
|
|
412
|
+
"alias": "nbPhoneNumberCountry";
|
|
413
|
+
"required": false;
|
|
414
|
+
"isSignal": true;
|
|
415
|
+
};
|
|
416
|
+
"countries": {
|
|
417
|
+
"alias": "nbPhoneNumberCountries";
|
|
418
|
+
"required": false;
|
|
419
|
+
"isSignal": true;
|
|
420
|
+
};
|
|
421
|
+
"message": {
|
|
422
|
+
"alias": "nbPhoneNumberMessage";
|
|
423
|
+
"required": false;
|
|
424
|
+
"isSignal": true;
|
|
425
|
+
};
|
|
426
|
+
}, {}, never, never, true, never>;
|
|
427
|
+
}
|
|
428
|
+
export type { NbCountryNames, NbCountryNamesSource, NbPhoneInputTexts, NbPhoneNumberError, NbPhoneNumberMessage, NbPhoneNumberOption, NbPhoneNumberOptions, NbPhoneNumberProblem };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ElementRef } from "@angular/core";
|
|
6
|
+
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
|
|
7
|
+
import { FileExtension, Options, RecursivePartial } from "@liquid-js/qr-code-styling";
|
|
8
|
+
export type NbQrCodeOptions = RecursivePartial<Options>;
|
|
9
|
+
export interface NbQrCodeDownload {
|
|
10
|
+
/** The file name without the extension, `qr-code` by default. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** `svg` by default. */
|
|
13
|
+
extension?: `${FileExtension}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shows `data` as a QR code, e.g. a link to open on a phone:
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <nb-qr-code data="https://liquid-js.github.io/lyra/" />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @stacked-example(Showcase, qr-code/qr-code-showcase.component)
|
|
23
|
+
*
|
|
24
|
+
* ### Installation
|
|
25
|
+
*
|
|
26
|
+
* Install [`@liquid-js/qr-code-styling`](https://www.npmjs.com/package/@liquid-js/qr-code-styling), which draws the
|
|
27
|
+
* code, and import `NbQrCodeComponent` from `@liquid-js/lyr-extras/qr-code`:
|
|
28
|
+
*
|
|
29
|
+
* ```bash
|
|
30
|
+
* npm install @liquid-js/qr-code-styling @liquid-js/qrcode-generator
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* The library loads when the first code shows. The code also renders on the server, e.g. when a page is
|
|
34
|
+
* prerendered, so it's in the page as an SVG before scripts run; the library's Node build draws it there and needs:
|
|
35
|
+
*
|
|
36
|
+
* ```bash
|
|
37
|
+
* npm install @xmldom/xmldom
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* The server leaves out a logo set by `options.image`, which the browser then adds.
|
|
41
|
+
*
|
|
42
|
+
* ### Usage
|
|
43
|
+
*
|
|
44
|
+
* The code is 10rem wide and scales with its width. It's dark on white, which phones read most reliably, also in
|
|
45
|
+
* dark themes: set `color` and `background-color` to change that, keeping a strong contrast.
|
|
46
|
+
*
|
|
47
|
+
* `options` takes the [library's options](https://www.npmjs.com/package/@liquid-js/qr-code-styling), e.g. the dot
|
|
48
|
+
* shapes, a logo in the middle or a gradient, over the defaults. `download()` saves the code as an SVG or an
|
|
49
|
+
* image in the colours it shows with:
|
|
50
|
+
* @stacked-example(Styles and download, qr-code/qr-code-download.component)
|
|
51
|
+
*
|
|
52
|
+
* It's an image named by `aria-label`, or by its data without one. In the browser it's drawn on a canvas by the
|
|
53
|
+
* library, aligned to the screen's pixels and scaled down from a larger drawing, so the modules don't show seams
|
|
54
|
+
* where their edges fall between pixels; it's drawn again when its size or the theme changes.
|
|
55
|
+
*/
|
|
56
|
+
export declare class NbQrCodeComponent {
|
|
57
|
+
protected readonly element: HTMLElement;
|
|
58
|
+
/**
|
|
59
|
+
* The text the code holds, e.g. a URL.
|
|
60
|
+
*/
|
|
61
|
+
readonly data: import("@angular/core").InputSignal<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Options of `@liquid-js/qr-code-styling`, over the defaults.
|
|
64
|
+
*/
|
|
65
|
+
readonly options: import("@angular/core").InputSignal<RecursivePartial<Options>>;
|
|
66
|
+
/**
|
|
67
|
+
* Names the image for screen readers; the data by default.
|
|
68
|
+
*/
|
|
69
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
70
|
+
protected readonly sanitizer: DomSanitizer;
|
|
71
|
+
protected readonly browser: boolean;
|
|
72
|
+
protected readonly canvas: import("@angular/core").Signal<ElementRef<HTMLCanvasElement>>;
|
|
73
|
+
/** Whether the canvas shows the code; until then, and on the server, the SVG does. */
|
|
74
|
+
protected readonly drawn: import("@angular/core").WritableSignal<boolean>;
|
|
75
|
+
protected readonly width: import("@angular/core").WritableSignal<number>;
|
|
76
|
+
/** Counts window resizes, e.g. a zoom that changes the pixel ratio or the element's position on the screen. */
|
|
77
|
+
protected readonly layout: import("@angular/core").WritableSignal<number>;
|
|
78
|
+
protected readonly theme: import("@angular/core").Signal<import("@liquid-js/lyr-core").NbThemeChange | undefined>;
|
|
79
|
+
protected readonly themeStyle: import("@angular/core").Signal<number>;
|
|
80
|
+
protected drawing: number;
|
|
81
|
+
/**
|
|
82
|
+
* The code's SVG. A resource, so a server render waits for it and the page has the code.
|
|
83
|
+
*/
|
|
84
|
+
protected readonly svg: import("@angular/core").ResourceRef<string | undefined>;
|
|
85
|
+
/** The last code drawn, which stays while the next one is drawn. */
|
|
86
|
+
protected readonly lastSvg: import("@angular/core").WritableSignal<string | undefined>;
|
|
87
|
+
protected readonly markup: import("@angular/core").Signal<SafeHtml | undefined>;
|
|
88
|
+
constructor();
|
|
89
|
+
/**
|
|
90
|
+
* Saves the code as a file, in the colours it shows with.
|
|
91
|
+
*/
|
|
92
|
+
download({ name, extension }?: NbQrCodeDownload): Promise<void>;
|
|
93
|
+
protected draw(): Promise<void>;
|
|
94
|
+
protected readonly qrOptions: import("@angular/core").Signal<RecursivePartial<Options>>;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbQrCodeComponent, never>;
|
|
96
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbQrCodeComponent, "nb-qr-code", never, {
|
|
97
|
+
"data": {
|
|
98
|
+
"alias": "data";
|
|
99
|
+
"required": true;
|
|
100
|
+
"isSignal": true;
|
|
101
|
+
};
|
|
102
|
+
"options": {
|
|
103
|
+
"alias": "options";
|
|
104
|
+
"required": false;
|
|
105
|
+
"isSignal": true;
|
|
106
|
+
};
|
|
107
|
+
"ariaLabel": {
|
|
108
|
+
"alias": "aria-label";
|
|
109
|
+
"required": false;
|
|
110
|
+
"isSignal": true;
|
|
111
|
+
};
|
|
112
|
+
}, {}, never, never, true, never>;
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|