@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,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ElementRef, EnvironmentProviders, InputSignal, Signal, WritableSignal } from "@angular/core";
|
|
6
|
+
import { Chart, ChartComponentLike, ChartData, ChartOptions, ChartType, Plugin } from "chart.js";
|
|
7
|
+
import { NbComponentOrCustomStatus, NbComponentStatus } from "@liquid-js/lyr-core";
|
|
8
|
+
/**
|
|
9
|
+
* A colour a chart draws a series or slice in: a status's, a custom status included, or a CSS colour of its own, e.g.
|
|
10
|
+
* `#8f9bb3`, `rgb(143 155 179)` or a theme variable, `var(--color-info-300)`.
|
|
11
|
+
*/
|
|
12
|
+
type NbChartColor = NbComponentOrCustomStatus | `#${string}` | `rgb${string}` | `hsl${string}` | `oklch${string}` | `var(--${string})`;
|
|
13
|
+
/** The theme's colours and font, as a chart draws with them. */
|
|
14
|
+
interface NbChartTheme {
|
|
15
|
+
/** Each status's colour, and a light tint of it for areas. */
|
|
16
|
+
status: Record<NbComponentStatus, {
|
|
17
|
+
color: string;
|
|
18
|
+
tint: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** A colour of the series' or slices' own, as the chart draws it, with a light tint of it for areas. */
|
|
21
|
+
colorOf(color: NbChartColor): {
|
|
22
|
+
color: string;
|
|
23
|
+
tint: string;
|
|
24
|
+
};
|
|
25
|
+
text: string;
|
|
26
|
+
hint: string;
|
|
27
|
+
grid: string;
|
|
28
|
+
/** What slices are separated by: the background the chart is on, e.g. a card's. */
|
|
29
|
+
surface: string;
|
|
30
|
+
tooltipBackground: string;
|
|
31
|
+
tooltipText: string;
|
|
32
|
+
fontFamily: string;
|
|
33
|
+
/** The theme's caption size in pixels, which follows the content size. */
|
|
34
|
+
fontSize: number;
|
|
35
|
+
}
|
|
36
|
+
/** What line charts need from chart.js, for `provideNbCharts`. */
|
|
37
|
+
export declare const NB_LINE_CHART_PARTS: ChartComponentLike[];
|
|
38
|
+
/** What bar charts need from chart.js, for `provideNbCharts`. */
|
|
39
|
+
export declare const NB_BAR_CHART_PARTS: ChartComponentLike[];
|
|
40
|
+
/** What pie and doughnut charts need from chart.js, for `provideNbCharts`. */
|
|
41
|
+
export declare const NB_PIE_CHART_PARTS: ChartComponentLike[];
|
|
42
|
+
/**
|
|
43
|
+
* Registers the chart.js controllers, elements, scales and plugins an app's charts use, so the rest stays out of its
|
|
44
|
+
* bundle; `provideNbCharts(...registerables)` registers all of them.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* bootstrapApplication(AppComponent, {
|
|
48
|
+
* providers: [provideNbCharts(...NB_LINE_CHART_PARTS, ...NB_BAR_CHART_PARTS)],
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function provideNbCharts(...parts: ChartComponentLike[]): EnvironmentProviders;
|
|
53
|
+
/** The statuses whose colours datasets without their own take, in order. */
|
|
54
|
+
export declare const NB_CHART_PALETTE: NbChartColor[];
|
|
55
|
+
/**
|
|
56
|
+
* A chart.js chart, in the theme's colours and font, which follows the theme and the content size as they change:
|
|
57
|
+
*
|
|
58
|
+
* ```html
|
|
59
|
+
* <nb-chart type="bar" [data]="{ labels: months, datasets: [{ label: 'Orders', data: orders() }] }"
|
|
60
|
+
* aria-label="Orders per month" />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @stacked-example(Showcase, chart/chart-showcase.component)
|
|
64
|
+
*
|
|
65
|
+
* `type`, `data`, `options` and `plugins` are chart.js's, with its types, and the chart updates when they change.
|
|
66
|
+
* Datasets without colours of their own get the colours of the statuses in `palette` (primary, success, info,
|
|
67
|
+
* warning, danger); slices of a pie or doughnut each get one. Text, grid lines, tooltips and the font come from the
|
|
68
|
+
* theme, under the chart's own options. `chart()` is the chart.js chart.
|
|
69
|
+
*
|
|
70
|
+
* Register the chart.js parts the app's charts use with `provideNbCharts`, e.g. `NB_LINE_CHART_PARTS`. A chart is
|
|
71
|
+
* drawn on a canvas, which assistive technologies see as an image: name it, or describe what it shows, with
|
|
72
|
+
* `aria-label`.
|
|
73
|
+
*
|
|
74
|
+
* For common charts, `nb-line-chart`, `nb-bar-chart` and `nb-pie-chart` take labels and series instead.
|
|
75
|
+
*
|
|
76
|
+
* ### Installation
|
|
77
|
+
*
|
|
78
|
+
* Install [`chart.js`](https://www.npmjs.com/package/chart.js), which draws the charts, and import `NbChartComponent`
|
|
79
|
+
* from `@liquid-js/lyr-extras/chart`:
|
|
80
|
+
*
|
|
81
|
+
* ```bash
|
|
82
|
+
* npm install chart.js
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare class NbChartComponent<TType extends ChartType = ChartType> {
|
|
86
|
+
/** The chart's type, e.g. `line`, `bar` or `pie`. */
|
|
87
|
+
readonly type: InputSignal<TType>;
|
|
88
|
+
/** The chart's labels and datasets. */
|
|
89
|
+
readonly data: InputSignal<ChartData<TType>>;
|
|
90
|
+
/** chart.js options, over the theme's. */
|
|
91
|
+
readonly options: InputSignal<ChartOptions<TType> | undefined>;
|
|
92
|
+
/** chart.js plugins of this chart only. */
|
|
93
|
+
readonly plugins: InputSignal<Array<Plugin<TType>>>;
|
|
94
|
+
/** The colours datasets without their own take, in order: statuses, or CSS colours (`NbChartColor`). */
|
|
95
|
+
readonly palette: InputSignal<readonly string[]>;
|
|
96
|
+
/** Names the chart, or tells what it shows, for assistive technologies. */
|
|
97
|
+
readonly ariaLabel: InputSignal<string | undefined>;
|
|
98
|
+
protected readonly drawn: WritableSignal<Chart<TType> | undefined>;
|
|
99
|
+
/** The chart.js chart, once it's drawn. */
|
|
100
|
+
readonly chart: Signal<Chart<TType> | undefined>;
|
|
101
|
+
protected readonly canvas: Signal<ElementRef<HTMLCanvasElement>>;
|
|
102
|
+
constructor();
|
|
103
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbChartComponent<any>, never>;
|
|
104
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbChartComponent<any>, "nb-chart", never, {
|
|
105
|
+
"type": {
|
|
106
|
+
"alias": "type";
|
|
107
|
+
"required": true;
|
|
108
|
+
"isSignal": true;
|
|
109
|
+
};
|
|
110
|
+
"data": {
|
|
111
|
+
"alias": "data";
|
|
112
|
+
"required": true;
|
|
113
|
+
"isSignal": true;
|
|
114
|
+
};
|
|
115
|
+
"options": {
|
|
116
|
+
"alias": "options";
|
|
117
|
+
"required": false;
|
|
118
|
+
"isSignal": true;
|
|
119
|
+
};
|
|
120
|
+
"plugins": {
|
|
121
|
+
"alias": "plugins";
|
|
122
|
+
"required": false;
|
|
123
|
+
"isSignal": true;
|
|
124
|
+
};
|
|
125
|
+
"palette": {
|
|
126
|
+
"alias": "palette";
|
|
127
|
+
"required": false;
|
|
128
|
+
"isSignal": true;
|
|
129
|
+
};
|
|
130
|
+
"ariaLabel": {
|
|
131
|
+
"alias": "aria-label";
|
|
132
|
+
"required": false;
|
|
133
|
+
"isSignal": true;
|
|
134
|
+
};
|
|
135
|
+
}, {}, never, never, true, never>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A series of a line or bar chart: its name, a value per label, and optionally the status whose colour it takes, or a
|
|
139
|
+
* colour of its own.
|
|
140
|
+
*/
|
|
141
|
+
export interface NbChartSeries {
|
|
142
|
+
name: string;
|
|
143
|
+
/** A value per label; `null` leaves a gap, as Chart.js draws it. */
|
|
144
|
+
data: ReadonlyArray<number | null>;
|
|
145
|
+
status?: NbComponentOrCustomStatus;
|
|
146
|
+
/** A colour of its own, over its status's, e.g. for more series than there are statuses. */
|
|
147
|
+
color?: NbChartColor;
|
|
148
|
+
/** In a line chart, whether the area under this line is filled, over the chart's `area`, e.g. not for a target. */
|
|
149
|
+
area?: boolean;
|
|
150
|
+
/** In a line chart, draws this line dashed and without points, e.g. for a target or a budget. */
|
|
151
|
+
dashed?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A slice of a pie chart: its label, value, and optionally the status whose colour it takes, or a colour of its own.
|
|
155
|
+
*/
|
|
156
|
+
export interface NbChartSlice {
|
|
157
|
+
label: string;
|
|
158
|
+
value: number;
|
|
159
|
+
status?: NbComponentOrCustomStatus;
|
|
160
|
+
/** A colour of its own, over its status's, e.g. for more slices than there are statuses. */
|
|
161
|
+
color?: NbChartColor;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A line chart of series over labels, in the theme's colours; register `NB_LINE_CHART_PARTS`.
|
|
165
|
+
*
|
|
166
|
+
* ```html
|
|
167
|
+
* <nb-line-chart [labels]="months" [series]="[{ name: 'Visits', data: visits() }]" aria-label="Visits per month" />
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare class NbLineChartComponent {
|
|
171
|
+
readonly labels: import("@angular/core").InputSignal<readonly (string | number)[]>;
|
|
172
|
+
readonly series: import("@angular/core").InputSignal<readonly NbChartSeries[]>;
|
|
173
|
+
/** Fills the area under each line. */
|
|
174
|
+
readonly area: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
175
|
+
/** Curves the lines between points. */
|
|
176
|
+
readonly smooth: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
177
|
+
/** Names the chart, or tells what it shows, for assistive technologies. */
|
|
178
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
179
|
+
protected readonly palette: Signal<string[]>;
|
|
180
|
+
protected readonly data: Signal<ChartData<'line'>>;
|
|
181
|
+
protected readonly options: Signal<ChartOptions<'line'>>;
|
|
182
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbLineChartComponent, never>;
|
|
183
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbLineChartComponent, "nb-line-chart", never, {
|
|
184
|
+
"labels": {
|
|
185
|
+
"alias": "labels";
|
|
186
|
+
"required": false;
|
|
187
|
+
"isSignal": true;
|
|
188
|
+
};
|
|
189
|
+
"series": {
|
|
190
|
+
"alias": "series";
|
|
191
|
+
"required": false;
|
|
192
|
+
"isSignal": true;
|
|
193
|
+
};
|
|
194
|
+
"area": {
|
|
195
|
+
"alias": "area";
|
|
196
|
+
"required": false;
|
|
197
|
+
"isSignal": true;
|
|
198
|
+
};
|
|
199
|
+
"smooth": {
|
|
200
|
+
"alias": "smooth";
|
|
201
|
+
"required": false;
|
|
202
|
+
"isSignal": true;
|
|
203
|
+
};
|
|
204
|
+
"ariaLabel": {
|
|
205
|
+
"alias": "aria-label";
|
|
206
|
+
"required": false;
|
|
207
|
+
"isSignal": true;
|
|
208
|
+
};
|
|
209
|
+
}, {}, never, never, true, never>;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A bar chart of series over labels, in the theme's colours; register `NB_BAR_CHART_PARTS`.
|
|
213
|
+
*
|
|
214
|
+
* ```html
|
|
215
|
+
* <nb-bar-chart [labels]="months" [series]="[{ name: 'Orders', data: orders() }]" aria-label="Orders per month" />
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare class NbBarChartComponent {
|
|
219
|
+
readonly labels: import("@angular/core").InputSignal<readonly (string | number)[]>;
|
|
220
|
+
readonly series: import("@angular/core").InputSignal<readonly NbChartSeries[]>;
|
|
221
|
+
/** Bars across, with the labels down the side. */
|
|
222
|
+
readonly horizontal: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
223
|
+
/** The series' bars on top of each other. */
|
|
224
|
+
readonly stacked: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
225
|
+
/** Names the chart, or tells what it shows, for assistive technologies. */
|
|
226
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
227
|
+
protected readonly palette: Signal<string[]>;
|
|
228
|
+
protected readonly data: Signal<ChartData<'bar'>>;
|
|
229
|
+
protected readonly options: Signal<ChartOptions<'bar'>>;
|
|
230
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbBarChartComponent, never>;
|
|
231
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbBarChartComponent, "nb-bar-chart", never, {
|
|
232
|
+
"labels": {
|
|
233
|
+
"alias": "labels";
|
|
234
|
+
"required": false;
|
|
235
|
+
"isSignal": true;
|
|
236
|
+
};
|
|
237
|
+
"series": {
|
|
238
|
+
"alias": "series";
|
|
239
|
+
"required": false;
|
|
240
|
+
"isSignal": true;
|
|
241
|
+
};
|
|
242
|
+
"horizontal": {
|
|
243
|
+
"alias": "horizontal";
|
|
244
|
+
"required": false;
|
|
245
|
+
"isSignal": true;
|
|
246
|
+
};
|
|
247
|
+
"stacked": {
|
|
248
|
+
"alias": "stacked";
|
|
249
|
+
"required": false;
|
|
250
|
+
"isSignal": true;
|
|
251
|
+
};
|
|
252
|
+
"ariaLabel": {
|
|
253
|
+
"alias": "aria-label";
|
|
254
|
+
"required": false;
|
|
255
|
+
"isSignal": true;
|
|
256
|
+
};
|
|
257
|
+
}, {}, never, never, true, never>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A pie, or with `doughnut` a doughnut, of slices in the theme's colours; register `NB_PIE_CHART_PARTS`.
|
|
261
|
+
*
|
|
262
|
+
* ```html
|
|
263
|
+
* <nb-pie-chart doughnut [slices]="[{ label: 'Paid', value: 42 }, { label: 'Due', value: 8 }]" aria-label="Invoices" />
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
export declare class NbPieChartComponent {
|
|
267
|
+
readonly slices: import("@angular/core").InputSignal<readonly NbChartSlice[]>;
|
|
268
|
+
/** A ring rather than a pie. */
|
|
269
|
+
readonly doughnut: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
270
|
+
/** Names the chart, or tells what it shows, for assistive technologies. */
|
|
271
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
272
|
+
protected readonly palette: Signal<string[]>;
|
|
273
|
+
protected readonly options: ChartOptions<'pie' | 'doughnut'>;
|
|
274
|
+
protected readonly data: Signal<ChartData<'pie' | 'doughnut'>>;
|
|
275
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbPieChartComponent, never>;
|
|
276
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbPieChartComponent, "nb-pie-chart", never, {
|
|
277
|
+
"slices": {
|
|
278
|
+
"alias": "slices";
|
|
279
|
+
"required": false;
|
|
280
|
+
"isSignal": true;
|
|
281
|
+
};
|
|
282
|
+
"doughnut": {
|
|
283
|
+
"alias": "doughnut";
|
|
284
|
+
"required": false;
|
|
285
|
+
"isSignal": true;
|
|
286
|
+
};
|
|
287
|
+
"ariaLabel": {
|
|
288
|
+
"alias": "aria-label";
|
|
289
|
+
"required": false;
|
|
290
|
+
"isSignal": true;
|
|
291
|
+
};
|
|
292
|
+
}, {}, never, never, true, never>;
|
|
293
|
+
}
|
|
294
|
+
export type { NbChartColor, NbChartTheme };
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { AfterViewInit, ElementRef, OnDestroy, TemplateRef } from "@angular/core";
|
|
6
|
+
import { ControlValueAccessor, ValidationErrors, Validator } from "@angular/forms";
|
|
7
|
+
import { NbComponentShape, NbComponentSize, NbValidationDirective } from "@liquid-js/lyr-core";
|
|
8
|
+
import { ColorPickerTexts } from "nxt-color-picker";
|
|
9
|
+
/** The error kind of text that isn't a colour. */
|
|
10
|
+
export declare const NB_COLOR_PICKER_ERROR: "nbColorPicker";
|
|
11
|
+
/** The `nbColorPicker` error, as Angular gives parse errors: its kind and its message. */
|
|
12
|
+
export interface NbColorPickerError {
|
|
13
|
+
kind: typeof NB_COLOR_PICKER_ERROR;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A field for a colour, with a swatch and a picker dialog:
|
|
18
|
+
*
|
|
19
|
+
* ```html
|
|
20
|
+
* <nb-color-picker [formControl]="color" [presets]="['#3366ff', '#00d68f']" clearable />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @stacked-example(Showcase, color-picker/color-picker-showcase.component)
|
|
24
|
+
*
|
|
25
|
+
* ### Installation
|
|
26
|
+
*
|
|
27
|
+
* Install [`nxt-color-picker`](https://www.npmjs.com/package/nxt-color-picker), which draws the dialog, and import
|
|
28
|
+
* `NbColorPickerComponent` from `@liquid-js/lyr-extras/color-picker`:
|
|
29
|
+
*
|
|
30
|
+
* ```bash
|
|
31
|
+
* npm install nxt-color-picker
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ### Usage
|
|
35
|
+
*
|
|
36
|
+
* It's a form control whose value is the colour as text, e.g. `#3366ff`, or `null` without one. The user picks it in
|
|
37
|
+
* the dialog or types it, and with `clearable` the field has a button that clears it, as does emptying the text. It
|
|
38
|
+
* has the sizes, statuses, shapes and `ghost` look of `nbInput`, and its `readonly`, without the dialog; its swatch
|
|
39
|
+
* shows the colour over a checkerboard, so transparency shows:
|
|
40
|
+
* @stacked-example(Sizes and statuses, color-picker/color-picker-sizes.component)
|
|
41
|
+
*
|
|
42
|
+
* The dialog opens below the field when it has focus, as the date picker's does, and closes when focus or a click
|
|
43
|
+
* goes elsewhere. Arrow Down moves focus into it, where the sliders move with the arrow keys, Page Up and Down, Home
|
|
44
|
+
* and End; Enter and Escape close it, keeping the colour, and return to the field.
|
|
45
|
+
*
|
|
46
|
+
* `outputFormat` picks the text the value has, `hex`, `rgba`, `hsla` or `auto`, `alphaChannel` whether it can be
|
|
47
|
+
* transparent, and `cmyk` adds a CMYK input and makes the value a `cmyk()` colour. The dialog has the theme's
|
|
48
|
+
* colours, with its own `color-picker-*` variables, which follow the date picker's values.
|
|
49
|
+
*
|
|
50
|
+
* ### Validation
|
|
51
|
+
*
|
|
52
|
+
* While the text isn't a colour, e.g. `#12345`, the value stays the last colour, and the field has the
|
|
53
|
+
* `nbColorPicker` parse error, `{ kind, message }`, as Angular's controls report text they can't parse; so does
|
|
54
|
+
* empty text in a field that isn't `clearable`. It works with `formControl`, `formControlName`, `ngModel` and signal
|
|
55
|
+
* forms' `[formField]`, and with `nbValidation`:
|
|
56
|
+
* @stacked-example(Validation, color-picker/color-picker-validation.component)
|
|
57
|
+
*
|
|
58
|
+
* ### Texts
|
|
59
|
+
*
|
|
60
|
+
* Its texts, and the dialog's, are in the `colorPicker` section of Lyra's texts:
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* provideNbTexts({ colorPicker: { clear: 'Remove the color', ok: 'Apply' } })
|
|
64
|
+
* ```
|
|
65
|
+
* @styles
|
|
66
|
+
*
|
|
67
|
+
* color-picker-background-color:
|
|
68
|
+
* color-picker-border-color:
|
|
69
|
+
* color-picker-border-style:
|
|
70
|
+
* color-picker-border-width:
|
|
71
|
+
* color-picker-border-radius:
|
|
72
|
+
* color-picker-shadow:
|
|
73
|
+
* color-picker-text-color:
|
|
74
|
+
* color-picker-text-font-family:
|
|
75
|
+
* color-picker-text-font-size:
|
|
76
|
+
* color-picker-divider-color:
|
|
77
|
+
* color-picker-format-arrow-color:
|
|
78
|
+
*/
|
|
79
|
+
export declare class NbColorPickerComponent implements ControlValueAccessor, Validator, AfterViewInit, OnDestroy {
|
|
80
|
+
protected readonly nbDefaults: import("@angular/core").Signal<import("@liquid-js/lyr-core").NbControlDefaults>;
|
|
81
|
+
protected readonly texts: import("@angular/core").Signal<import("@liquid-js/lyr-extras/color-picker").NbColorPickerTexts>;
|
|
82
|
+
protected readonly message: (error: import("@liquid-js/lyr-core").NbValidationError) => string;
|
|
83
|
+
protected readonly validation: NbValidationDirective | null;
|
|
84
|
+
/** Field size: `tiny`, `small`, `medium` (default), `large` or `giant`. */
|
|
85
|
+
readonly sizeInput: import("@angular/core").InputSignal<NbComponentSize | undefined>;
|
|
86
|
+
/** The size in use: the input's, the app's default, or 'medium'. */
|
|
87
|
+
readonly size: import("@angular/core").WritableSignal<NbComponentSize>;
|
|
88
|
+
/** Field status: `basic` (default), `primary`, `info`, `success`, `warning`, `danger` or `control`. */
|
|
89
|
+
readonly status: import("@angular/core").InputSignal<string>;
|
|
90
|
+
/** Field shape: `rectangle` (default), `semi-round` or `round`. */
|
|
91
|
+
readonly shapeInput: import("@angular/core").InputSignal<NbComponentShape | undefined>;
|
|
92
|
+
/** The shape in use: the input's, the app's default, or 'rectangle'. */
|
|
93
|
+
readonly shape: import("@angular/core").WritableSignal<NbComponentShape>;
|
|
94
|
+
/** Makes the field as wide as its container. */
|
|
95
|
+
readonly fullWidth: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
96
|
+
/** Shows the field without its background and border, as `nbInput`'s `ghost` does. */
|
|
97
|
+
readonly ghost: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
98
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
99
|
+
/** Lets the user read and select the colour, but not change it, as a read-only field; its dialog doesn't open. */
|
|
100
|
+
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
101
|
+
/** Names the field when there's no `aria-labelledby`; "Color" by default. */
|
|
102
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
103
|
+
/** The id of the element that names the field, e.g. a `label`. */
|
|
104
|
+
readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
|
|
105
|
+
/** What labels the field: its own `aria-labelledby` and an `nbLabel` of its `nbValidation`. */
|
|
106
|
+
protected readonly fieldLabelledBy: import("@angular/core").Signal<string | null>;
|
|
107
|
+
/** The text of the value: `hex`, `rgba`, `hsla` or `auto`, which keeps the format a colour is typed in. */
|
|
108
|
+
readonly outputFormat: import("@angular/core").InputSignal<"hex" | "auto" | "rgba" | "hsla">;
|
|
109
|
+
/** Whether the colour can be transparent. */
|
|
110
|
+
readonly alphaChannel: import("@angular/core").InputSignal<"enabled" | "disabled" | "always" | "forced">;
|
|
111
|
+
/** Adds a CMYK input to the dialog and makes the value a `cmyk()` colour. */
|
|
112
|
+
readonly cmyk: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
113
|
+
/** Colours to pick from in the dialog. */
|
|
114
|
+
readonly presets: import("@angular/core").InputSignal<string[] | undefined>;
|
|
115
|
+
/** The dialog's distance from the field, in pixels. */
|
|
116
|
+
readonly overlayOffset: import("@angular/core").InputSignal<number>;
|
|
117
|
+
/** Shows a button that clears the colour, and lets emptying the text clear it. */
|
|
118
|
+
readonly clearable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
119
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
120
|
+
/** The colour, as text: the form value, `null` without one. */
|
|
121
|
+
protected readonly value: import("@angular/core").WritableSignal<string | null>;
|
|
122
|
+
/** The text the field shows; typing doesn't change it, so it doesn't replace what's typed. */
|
|
123
|
+
protected readonly text: import("@angular/core").WritableSignal<string>;
|
|
124
|
+
protected readonly swatch: import("@angular/core").Signal<string | undefined>;
|
|
125
|
+
protected readonly isDisabled: import("@angular/core").WritableSignal<boolean>;
|
|
126
|
+
protected readonly resolvedStatus: import("@angular/core").Signal<string>;
|
|
127
|
+
/** The field's buttons are white on colour, with the `control` status, and grey otherwise. */
|
|
128
|
+
protected readonly buttonStatus: import("@angular/core").Signal<"basic" | "control">;
|
|
129
|
+
/** Whether the text isn't a colour. */
|
|
130
|
+
protected readonly parseError: import("@angular/core").WritableSignal<boolean>;
|
|
131
|
+
protected readonly open: import("@angular/core").WritableSignal<boolean>;
|
|
132
|
+
protected readonly field: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
133
|
+
protected readonly dialog: import("@angular/core").Signal<TemplateRef<unknown>>;
|
|
134
|
+
private readonly overlayHandler;
|
|
135
|
+
private overlay?;
|
|
136
|
+
private readonly injector;
|
|
137
|
+
private readonly destroyRef;
|
|
138
|
+
/** The id of the dialog, which the field controls while it's open. */
|
|
139
|
+
protected readonly dialogId: string;
|
|
140
|
+
/** Whether Enter went down in the dialog, so it closes the dialog when it comes up there. */
|
|
141
|
+
private enterInDialog;
|
|
142
|
+
protected onChange: (value: string | null) => void;
|
|
143
|
+
protected onTouched: () => void;
|
|
144
|
+
protected onValidatorChange: () => void;
|
|
145
|
+
constructor();
|
|
146
|
+
ngAfterViewInit(): void;
|
|
147
|
+
ngOnDestroy(): void;
|
|
148
|
+
writeValue(value?: string | null): void;
|
|
149
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
150
|
+
registerOnTouched(fn: () => void): void;
|
|
151
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
152
|
+
setDisabledState(disabled: boolean): void;
|
|
153
|
+
/** The parse error of text that isn't a colour. */
|
|
154
|
+
validate(): ValidationErrors | null;
|
|
155
|
+
/**
|
|
156
|
+
* Clears the colour. The button goes away with it, so focus goes from the button to the field when it was there by
|
|
157
|
+
* keyboard.
|
|
158
|
+
*/
|
|
159
|
+
clear(event?: Event): void;
|
|
160
|
+
/** @internal */
|
|
161
|
+
onColorChange(color: string): void;
|
|
162
|
+
/** @internal */
|
|
163
|
+
onCmykChange(color: string): void;
|
|
164
|
+
/** @internal */
|
|
165
|
+
onInput(event: Event): void;
|
|
166
|
+
/**
|
|
167
|
+
* Arrow Down moves into the dialog, opening it if needed, and Escape closes it.
|
|
168
|
+
*
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
onFieldKeydown(event: KeyboardEvent): void;
|
|
172
|
+
/**
|
|
173
|
+
* Enter and Escape close the dialog, keeping the colour, and return to the field.
|
|
174
|
+
*
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
onDialogKeydown(event: KeyboardEvent): void;
|
|
178
|
+
/**
|
|
179
|
+
* Enter closes the dialog when it comes up, once the dialog's inputs have taken what was typed in them.
|
|
180
|
+
*
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
onDialogKeyup(event: KeyboardEvent): void;
|
|
184
|
+
/** @internal */
|
|
185
|
+
onBlur(): void;
|
|
186
|
+
/** The dialog closed: the field is touched once focus is elsewhere. */
|
|
187
|
+
protected onClose(): void;
|
|
188
|
+
/** Opens the dialog if needed, and moves focus to its first control. */
|
|
189
|
+
protected focusDialog(): void;
|
|
190
|
+
/** Closes the dialog, with focus back in the field. */
|
|
191
|
+
protected closeDialog(): void;
|
|
192
|
+
/**
|
|
193
|
+
* The value for typed text that is a colour, in the value's format, as the dialog gives it for a colour picked in
|
|
194
|
+
* it: without transparency where the format has none, and as `cmyk()` with `cmyk`.
|
|
195
|
+
*/
|
|
196
|
+
protected typedColor(text: string): string | undefined;
|
|
197
|
+
/** The field shows the colour, as the value has it, unless the text isn't one, and the field is touched. */
|
|
198
|
+
protected leave(): void;
|
|
199
|
+
/** A colour picked in the dialog, which the field shows, also while it has focus, e.g. as the colours are dragged. */
|
|
200
|
+
protected changed(color: string): void;
|
|
201
|
+
protected update(color: string | null): void;
|
|
202
|
+
/** Whether the field has focus, e.g. while the user types. */
|
|
203
|
+
protected focused(): boolean;
|
|
204
|
+
/** Shows a text in the field. */
|
|
205
|
+
protected show(text: string): void;
|
|
206
|
+
protected setParseError(parseError: boolean): void;
|
|
207
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbColorPickerComponent, never>;
|
|
208
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbColorPickerComponent, "nb-color-picker", never, {
|
|
209
|
+
"sizeInput": {
|
|
210
|
+
"alias": "size";
|
|
211
|
+
"required": false;
|
|
212
|
+
"isSignal": true;
|
|
213
|
+
};
|
|
214
|
+
"status": {
|
|
215
|
+
"alias": "status";
|
|
216
|
+
"required": false;
|
|
217
|
+
"isSignal": true;
|
|
218
|
+
};
|
|
219
|
+
"shapeInput": {
|
|
220
|
+
"alias": "shape";
|
|
221
|
+
"required": false;
|
|
222
|
+
"isSignal": true;
|
|
223
|
+
};
|
|
224
|
+
"fullWidth": {
|
|
225
|
+
"alias": "fullWidth";
|
|
226
|
+
"required": false;
|
|
227
|
+
"isSignal": true;
|
|
228
|
+
};
|
|
229
|
+
"ghost": {
|
|
230
|
+
"alias": "ghost";
|
|
231
|
+
"required": false;
|
|
232
|
+
"isSignal": true;
|
|
233
|
+
};
|
|
234
|
+
"placeholder": {
|
|
235
|
+
"alias": "placeholder";
|
|
236
|
+
"required": false;
|
|
237
|
+
"isSignal": true;
|
|
238
|
+
};
|
|
239
|
+
"readonly": {
|
|
240
|
+
"alias": "readonly";
|
|
241
|
+
"required": false;
|
|
242
|
+
"isSignal": true;
|
|
243
|
+
};
|
|
244
|
+
"ariaLabel": {
|
|
245
|
+
"alias": "aria-label";
|
|
246
|
+
"required": false;
|
|
247
|
+
"isSignal": true;
|
|
248
|
+
};
|
|
249
|
+
"ariaLabelledBy": {
|
|
250
|
+
"alias": "aria-labelledby";
|
|
251
|
+
"required": false;
|
|
252
|
+
"isSignal": true;
|
|
253
|
+
};
|
|
254
|
+
"outputFormat": {
|
|
255
|
+
"alias": "outputFormat";
|
|
256
|
+
"required": false;
|
|
257
|
+
"isSignal": true;
|
|
258
|
+
};
|
|
259
|
+
"alphaChannel": {
|
|
260
|
+
"alias": "alphaChannel";
|
|
261
|
+
"required": false;
|
|
262
|
+
"isSignal": true;
|
|
263
|
+
};
|
|
264
|
+
"cmyk": {
|
|
265
|
+
"alias": "cmyk";
|
|
266
|
+
"required": false;
|
|
267
|
+
"isSignal": true;
|
|
268
|
+
};
|
|
269
|
+
"presets": {
|
|
270
|
+
"alias": "presets";
|
|
271
|
+
"required": false;
|
|
272
|
+
"isSignal": true;
|
|
273
|
+
};
|
|
274
|
+
"overlayOffset": {
|
|
275
|
+
"alias": "overlayOffset";
|
|
276
|
+
"required": false;
|
|
277
|
+
"isSignal": true;
|
|
278
|
+
};
|
|
279
|
+
"clearable": {
|
|
280
|
+
"alias": "clearable";
|
|
281
|
+
"required": false;
|
|
282
|
+
"isSignal": true;
|
|
283
|
+
};
|
|
284
|
+
"disabled": {
|
|
285
|
+
"alias": "disabled";
|
|
286
|
+
"required": false;
|
|
287
|
+
"isSignal": true;
|
|
288
|
+
};
|
|
289
|
+
}, {}, never, never, true, never>;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The texts of the colour picker. `provideNbTexts({ colorPicker: { ... } })` changes them, and they're translated with
|
|
293
|
+
* Angular's i18n, as `$localize` messages with ids like `@@nb.colorPicker.invalid`.
|
|
294
|
+
*
|
|
295
|
+
* The dialog's texts, e.g. `ok` or `presetColors`, are `nxt-color-picker`'s, with ids like
|
|
296
|
+
* `@@nxt-color-picker.button.ok`; set them here too to change them.
|
|
297
|
+
*/
|
|
298
|
+
interface NbColorPickerTexts extends Partial<ColorPickerTexts> {
|
|
299
|
+
/** Names the field when it has no `aria-label` or `aria-labelledby`. */
|
|
300
|
+
color: string;
|
|
301
|
+
/** Label of the button that clears the colour. */
|
|
302
|
+
clear: string;
|
|
303
|
+
/** The message of the `nbColorPicker` error for text that isn't a colour. */
|
|
304
|
+
invalid: string;
|
|
305
|
+
}
|
|
306
|
+
declare module '@liquid-js/lyr-core' {
|
|
307
|
+
interface NbTexts {
|
|
308
|
+
colorPicker: NbColorPickerTexts;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
export type { NbColorPickerTexts };
|