oasys-lib 3.14.1 → 3.14.2
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/fesm2022/oasys-lib.mjs +2216 -64
- package/fesm2022/oasys-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/bergamotte/variables.css +1 -1
- package/src/assets/bergamotte-loyalty-tier-1/variables.css +1 -1
- package/src/assets/bergamotte-loyalty-tier-2/variables.css +1 -1
- package/src/assets/bloomandwild/variables.css +1 -1
- package/src/assets/bloomandwild-loyalty-tier-1/variables.css +1 -1
- package/src/assets/bloomandwild-loyalty-tier-2/variables.css +1 -1
- package/src/assets/bloomon/variables.css +1 -1
- package/src/assets/bloomon-loyalty-tier-1/variables.css +1 -1
- package/src/assets/bloomon-loyalty-tier-2/variables.css +1 -1
- package/types/oasys-lib.d.ts +2209 -24
- package/types/oasys-lib.d.ts.map +1 -1
package/fesm2022/oasys-lib.mjs
CHANGED
|
@@ -11,12 +11,23 @@ import { register } from 'swiper/element/bundle';
|
|
|
11
11
|
import * as i1$1 from '@angular/forms';
|
|
12
12
|
import { ReactiveFormsModule, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Dismissive action slot for `<ui-alert>`: its text becomes the label of a
|
|
16
|
+
* `tertiary` button that emits the alert's `cancel` output. Use for "Not now",
|
|
17
|
+
* "Keep my order" and similar. Adding it also turns off the live region and
|
|
18
|
+
* moves focus to the alert when it appears (see `<ui-alert>`).
|
|
19
|
+
*
|
|
20
|
+
* @import import { OasysAlertCancelDirective } from 'oasys-lib';
|
|
21
|
+
*/
|
|
14
22
|
class OasysAlertCancelDirective {
|
|
23
|
+
/** @ignore */
|
|
15
24
|
text = '';
|
|
16
25
|
elem = inject(ElementRef);
|
|
26
|
+
/** @ignore */
|
|
17
27
|
ngAfterContentChecked() {
|
|
18
28
|
this.text = this.elem ? this.elem.nativeElement.innerText : '';
|
|
19
29
|
}
|
|
30
|
+
/** @ignore */
|
|
20
31
|
focus() {
|
|
21
32
|
const element = this.elem ? this.elem.nativeElement : undefined;
|
|
22
33
|
if (element && typeof element.focus === 'function') {
|
|
@@ -39,9 +50,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
39
50
|
}]
|
|
40
51
|
}] });
|
|
41
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Main action slot for `<ui-alert>`: its text becomes the label of a
|
|
55
|
+
* `secondary` button that emits the alert's `confirm` output. Use for the
|
|
56
|
+
* action that resolves the message, such as "Try again" or "Reset your
|
|
57
|
+
* password".
|
|
58
|
+
*
|
|
59
|
+
* @import import { OasysAlertConfirmDirective } from 'oasys-lib';
|
|
60
|
+
*/
|
|
42
61
|
class OasysAlertConfirmDirective {
|
|
43
62
|
elem = inject(ElementRef);
|
|
63
|
+
/** @ignore */
|
|
44
64
|
text = '';
|
|
65
|
+
/** @ignore */
|
|
45
66
|
ngAfterContentChecked() {
|
|
46
67
|
this.text = this.elem.nativeElement.innerText;
|
|
47
68
|
}
|
|
@@ -56,6 +77,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
56
77
|
}]
|
|
57
78
|
}] });
|
|
58
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Message slot for `<ui-alert>`: `<ui-alert-content>…</ui-alert-content>`.
|
|
82
|
+
* Plain text or inline markup such as links.
|
|
83
|
+
*
|
|
84
|
+
* @import import { OasysAlertContentDirective } from 'oasys-lib';
|
|
85
|
+
*/
|
|
59
86
|
class OasysAlertContentDirective {
|
|
60
87
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: OasysAlertContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
61
88
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: OasysAlertContentDirective, isStandalone: true, selector: "ui-alert-content, [ui-alert-content]", ngImport: i0 });
|
|
@@ -68,6 +95,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
68
95
|
}]
|
|
69
96
|
}] });
|
|
70
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Title slot for `<ui-alert>`: `<ui-alert-title>Payment failed</ui-alert-title>`.
|
|
100
|
+
* Rendered in bold above the message. Keep it to a few words.
|
|
101
|
+
*
|
|
102
|
+
* @import import { OasysAlertTitleDirective } from 'oasys-lib';
|
|
103
|
+
*/
|
|
71
104
|
class OasysAlertTitleDirective {
|
|
72
105
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: OasysAlertTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
73
106
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: OasysAlertTitleDirective, isStandalone: true, selector: "ui-alert-title, [ui-alert-title]", ngImport: i0 });
|
|
@@ -184,33 +217,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
184
217
|
type: Injectable
|
|
185
218
|
}] });
|
|
186
219
|
|
|
220
|
+
/**
|
|
221
|
+
* A padded block with an optional background, border and radius
|
|
222
|
+
* (`<ui-box>`). Reach for it whenever you would otherwise write `padding`,
|
|
223
|
+
* `background-color`, `border` or `border-radius` in SCSS.
|
|
224
|
+
*
|
|
225
|
+
* Renders `<ui-box>` (a flex column) wrapping your content in a single
|
|
226
|
+
* `<div class="ui-box-content">`. Pair it with the other layout primitives:
|
|
227
|
+
* `<ui-stack>` for spacing between children, `<ui-grid>` for columns and
|
|
228
|
+
* `<ui-container>` for page width and gutters.
|
|
229
|
+
*
|
|
230
|
+
* Things to know:
|
|
231
|
+
* - The background defaults to `primary` (white on Bloom & Wild), so a box
|
|
232
|
+
* always paints one. Use `box_background="transparent"` for boxes that only
|
|
233
|
+
* add padding, especially boxes nested inside another box.
|
|
234
|
+
* - By default the content is capped at the desktop content width and centred.
|
|
235
|
+
* Set `[box_content_fill_width]="true"` for cards, rows and full-bleed
|
|
236
|
+
* backgrounds so the content uses the box's full width.
|
|
237
|
+
* - Multi-section cards: use one outer box for the shared border and radius
|
|
238
|
+
* (`box_space="none"`), and inner transparent boxes, without borders, for
|
|
239
|
+
* each section's padding. Two adjacent bordered boxes draw a double border.
|
|
240
|
+
* - Text switches to the on-dark colour automatically on dark backgrounds that
|
|
241
|
+
* have a brand token for it; `box_text_on_dark` overrides that.
|
|
242
|
+
* - Spacing values are brand tokens: `near` and `default` are larger on
|
|
243
|
+
* bloomon than on Bloom & Wild.
|
|
244
|
+
*
|
|
245
|
+
* @import import { OasysLayoutBoxComponent } from 'oasys-lib';
|
|
246
|
+
* @knownIssue Automatic on-dark text only works for the deprecated background
|
|
247
|
+
* names (`core-*`, `tint-highlight`) and `rewards-*`: the current names
|
|
248
|
+
* `tertiary` and `quaternary` have no on-dark token, so text stays dark on a
|
|
249
|
+
* dark background (e.g. `quaternary` on every brand, `tertiary` on Bloom &
|
|
250
|
+
* Wild). Workaround: for dark backgrounds use the matching deprecated name
|
|
251
|
+
* (`core-tertiary`, `core-quaternary`), which renders the same colour and
|
|
252
|
+
* switches the text per brand; or force it with `[box_text_on_dark]="true"`.
|
|
253
|
+
* @knownIssue `box_border_color="rewards-primary"` and
|
|
254
|
+
* `"rewards-primary-on-dark"` have no styles, so the border falls back to the
|
|
255
|
+
* text colour. Workaround: use `primary` / `primary-on-dark`, or set
|
|
256
|
+
* `border-color: var(--oasys-color-rewards-border-primary)` in the component's
|
|
257
|
+
* SCSS.
|
|
258
|
+
* @knownIssue `box_align_x` has no visible effect: the content wrapper always
|
|
259
|
+
* fills the box's width (and with `box_fill_mode="fit"` the box shrinks to its
|
|
260
|
+
* content), so `center` and `end` never move anything. Workaround: wrap the
|
|
261
|
+
* children in `<ui-stack stack_align="center">` (or `end`), or use a text
|
|
262
|
+
* alignment class for text.
|
|
263
|
+
*/
|
|
187
264
|
class LayoutBoxComponent {
|
|
265
|
+
/**
|
|
266
|
+
* Padding on all four sides. `none` for a box that only adds a background or
|
|
267
|
+
* border; `gutter` matches the page container's gutter. Pass an object to
|
|
268
|
+
* vary it by screen size, e.g.
|
|
269
|
+
* `[box_space]="{ mobile: 'near', tablet: 'default', laptop: 'expanded', desktop: 'expanded' }"`:
|
|
270
|
+
* give every device key, because a size you leave out gets no padding.
|
|
271
|
+
*/
|
|
188
272
|
box_space = 'default';
|
|
273
|
+
/**
|
|
274
|
+
* ARIA role for the inner content wrapper (not the `<ui-box>` element
|
|
275
|
+
* itself). Leave unset unless the content needs a landmark or other role.
|
|
276
|
+
*/
|
|
189
277
|
box_role;
|
|
278
|
+
/** Overrides the top padding from `box_space`. Accepts the same values, including a per-device object. */
|
|
190
279
|
box_space_top;
|
|
280
|
+
/** Overrides the right padding from `box_space`. Accepts the same values, including a per-device object. */
|
|
191
281
|
box_space_right;
|
|
282
|
+
/** Overrides the bottom padding from `box_space`. Accepts the same values, including a per-device object. */
|
|
192
283
|
box_space_bottom;
|
|
284
|
+
/** Overrides the left padding from `box_space`. Accepts the same values, including a per-device object. */
|
|
193
285
|
box_space_left;
|
|
286
|
+
/**
|
|
287
|
+
* Horizontal alignment of the content wrapper. Currently has no visible effect
|
|
288
|
+
* (see Known issues): to centre the children, wrap them in
|
|
289
|
+
* `<ui-stack stack_align="center">`.
|
|
290
|
+
*/
|
|
194
291
|
box_align_x = 'start';
|
|
292
|
+
/**
|
|
293
|
+
* Vertical alignment of the content when the box is taller than it, e.g.
|
|
294
|
+
* `center` in a grid row of equal-height boxes.
|
|
295
|
+
*/
|
|
195
296
|
box_align_y = 'start';
|
|
297
|
+
/**
|
|
298
|
+
* How the box sizes itself: `fill` (default) takes the full width of its
|
|
299
|
+
* parent (and its height, where the parent has one), `fit` shrinks to its content's width (badges, chips inside
|
|
300
|
+
* a stack), `cover` fills the parent and stretches the content to match.
|
|
301
|
+
*/
|
|
196
302
|
box_fill_mode = 'fill';
|
|
303
|
+
/**
|
|
304
|
+
* Background colour from the brand palette. `transparent` for padding-only
|
|
305
|
+
* boxes. Prefer `primary`–`quaternary`, `highlight` and `rewards-*`; the
|
|
306
|
+
* `core-*` and `tint-highlight` names are deprecated aliases (but see the
|
|
307
|
+
* known issue about on-dark text).
|
|
308
|
+
*/
|
|
197
309
|
box_background = 'primary';
|
|
198
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Forces on-dark (`true`) or on-light (`false`) text colour. Leave unset to
|
|
312
|
+
* follow the brand token for `box_background`.
|
|
313
|
+
*/
|
|
199
314
|
box_text_on_dark = undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Let the content use the box's full width. Without it the content is capped
|
|
317
|
+
* at the desktop content width and centred, which suits page-level bands but
|
|
318
|
+
* not cards or rows. Bind a boolean: `[box_content_fill_width]="true"`.
|
|
319
|
+
*/
|
|
200
320
|
box_content_fill_width = false;
|
|
321
|
+
/**
|
|
322
|
+
* Border colour. `selectable` / `selected` for choice cards, `secondary` for
|
|
323
|
+
* subtle dividers, `primary-on-dark` on dark backgrounds. Only visible when
|
|
324
|
+
* `box_border_width` is set.
|
|
325
|
+
*/
|
|
201
326
|
box_border_color = 'primary';
|
|
327
|
+
/** Border width. `none` (default) hides the border; `prominent` for selected states. */
|
|
202
328
|
box_border_width = 'none';
|
|
329
|
+
/** Border style; `dashed` for placeholder or drop areas. Only visible with `box_border_width`. */
|
|
203
330
|
box_border_style = 'solid';
|
|
331
|
+
/**
|
|
332
|
+
* Corner radius. `layout` for cards and panels, `soften` for small
|
|
333
|
+
* elements, `round` for pills and circles, `rewards-*` for loyalty UI.
|
|
334
|
+
*/
|
|
204
335
|
box_border_radius = 'none';
|
|
336
|
+
/** @ignore */
|
|
205
337
|
didFirstInit = false;
|
|
338
|
+
/** @ignore */
|
|
206
339
|
prefix = 'ui-layout-box';
|
|
340
|
+
/** @ignore */
|
|
207
341
|
boxLayoutClasses;
|
|
342
|
+
/** @ignore */
|
|
208
343
|
backgroundIsDark = false;
|
|
209
344
|
changes = inject(ChangeDetectorRef);
|
|
210
345
|
tokenService = inject(TokenService);
|
|
211
346
|
/**
|
|
212
347
|
* Check the passed string to see if it contains JSON
|
|
213
348
|
*
|
|
349
|
+
* @ignore
|
|
214
350
|
* @param string
|
|
215
351
|
* @returns - boolean
|
|
216
352
|
*/
|
|
@@ -223,6 +359,7 @@ class LayoutBoxComponent {
|
|
|
223
359
|
}
|
|
224
360
|
return true;
|
|
225
361
|
}
|
|
362
|
+
/** @ignore */
|
|
226
363
|
getSizeClasses(spaceInput, overrideName) {
|
|
227
364
|
if (!spaceInput) {
|
|
228
365
|
return [];
|
|
@@ -235,46 +372,54 @@ class LayoutBoxComponent {
|
|
|
235
372
|
}
|
|
236
373
|
return [this.prefix, `${this.prefix}-${spaceInput}${overrideName ? `-${overrideName}` : ''}`];
|
|
237
374
|
}
|
|
375
|
+
/** @ignore */
|
|
238
376
|
getOverrideClasses(spaceOverrides) {
|
|
239
377
|
const spaceTypes = ['top', 'right', 'bottom', 'left'];
|
|
240
378
|
return spaceOverrides
|
|
241
379
|
.map((item, index) => this.getSizeClasses(item, spaceTypes[index]))
|
|
242
380
|
.filter(Boolean);
|
|
243
381
|
}
|
|
382
|
+
/** @ignore */
|
|
244
383
|
getAlignmentClasses(alignmentOverride) {
|
|
245
384
|
const spaceTypes = ['align-x', 'distribute-y'];
|
|
246
385
|
return alignmentOverride
|
|
247
386
|
.map((item, index) => item ? `${this.prefix}-${spaceTypes[index]}-${item}` : undefined)
|
|
248
387
|
.filter(Boolean);
|
|
249
388
|
}
|
|
389
|
+
/** @ignore */
|
|
250
390
|
getBackgroundClass() {
|
|
251
391
|
const value = this.box_background ? `${this.prefix}-background-${this.box_background}` : '';
|
|
252
392
|
return value;
|
|
253
393
|
}
|
|
394
|
+
/** @ignore */
|
|
254
395
|
getBorderColorClass() {
|
|
255
396
|
const value = this.box_border_color
|
|
256
397
|
? `${this.prefix}-border-color-${this.box_border_color}`
|
|
257
398
|
: '';
|
|
258
399
|
return value;
|
|
259
400
|
}
|
|
401
|
+
/** @ignore */
|
|
260
402
|
getBorderWidthClass() {
|
|
261
403
|
const value = this.box_border_width
|
|
262
404
|
? `${this.prefix}-border-width-${this.box_border_width}`
|
|
263
405
|
: '';
|
|
264
406
|
return value;
|
|
265
407
|
}
|
|
408
|
+
/** @ignore */
|
|
266
409
|
getBorderStyleClass() {
|
|
267
410
|
const value = this.box_border_style
|
|
268
411
|
? `${this.prefix}-border-style-${this.box_border_style}`
|
|
269
412
|
: '';
|
|
270
413
|
return value;
|
|
271
414
|
}
|
|
415
|
+
/** @ignore */
|
|
272
416
|
getBorderRadiusClass() {
|
|
273
417
|
const value = this.box_border_radius
|
|
274
418
|
? `${this.prefix}-border-radius-${this.box_border_radius}`
|
|
275
419
|
: '';
|
|
276
420
|
return value;
|
|
277
421
|
}
|
|
422
|
+
/** @ignore */
|
|
278
423
|
ngOnChanges() {
|
|
279
424
|
if (!this.didFirstInit) {
|
|
280
425
|
return;
|
|
@@ -282,6 +427,7 @@ class LayoutBoxComponent {
|
|
|
282
427
|
this.ngOnInit();
|
|
283
428
|
this.changes.markForCheck();
|
|
284
429
|
}
|
|
430
|
+
/** @ignore */
|
|
285
431
|
ngOnInit() {
|
|
286
432
|
const spaceOverrides = [
|
|
287
433
|
this.box_space_top,
|
|
@@ -367,24 +513,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
367
513
|
type: Input
|
|
368
514
|
}] } });
|
|
369
515
|
|
|
516
|
+
/**
|
|
517
|
+
* A flexbox row or column with consistent spacing between its children
|
|
518
|
+
* (`<ui-stack>`). The default tool for spacing things out: use it instead of
|
|
519
|
+
* margins, `gap` or `display: flex` in SCSS.
|
|
520
|
+
*
|
|
521
|
+
* - `stack_direction`: `y` (default) stacks vertically, `x` lays out a row.
|
|
522
|
+
* - `stack_gap`: the space between children.
|
|
523
|
+
* - `stack_align`: cross-axis alignment (horizontal in a column, vertical in a
|
|
524
|
+
* row). `stack_distribute`: main-axis spacing, e.g. `space-between` to push
|
|
525
|
+
* a label and a price to opposite ends of a row.
|
|
526
|
+
* - `stack_collapse_below`: turn a row into a column on smaller screens.
|
|
527
|
+
*
|
|
528
|
+
* The stack is always full width and adds no padding or background; wrap it
|
|
529
|
+
* in a `<ui-box>` for those. Nest stacks freely, e.g. a vertical stack of
|
|
530
|
+
* horizontal rows. Use `<ui-grid>` when items must line up in columns.
|
|
531
|
+
*
|
|
532
|
+
* Lists: when the children are a list of like items (links, features,
|
|
533
|
+
* results), set `[stack_as_list]="true"` and make each child an `<li>` (or
|
|
534
|
+
* give it `role="listitem"`), so screen readers announce the list and its
|
|
535
|
+
* length. List bullets are already removed.
|
|
536
|
+
*
|
|
537
|
+
* @import import { OasysLayoutStackComponent } from 'oasys-lib';
|
|
538
|
+
*/
|
|
370
539
|
class LayoutStackComponent {
|
|
371
540
|
changes = inject(ChangeDetectorRef);
|
|
541
|
+
/** @ignore */
|
|
372
542
|
didFirstInit = false;
|
|
543
|
+
/** @ignore */
|
|
373
544
|
prefix = 'ui-layout-stack';
|
|
545
|
+
/** @ignore */
|
|
374
546
|
stackLayoutClasses;
|
|
547
|
+
/**
|
|
548
|
+
* Space between children. `tight` / `tiny` for related items (a label and
|
|
549
|
+
* its value), `default` between blocks, `expanded` between sections;
|
|
550
|
+
* `gutter` matches the page container gutter. Values are brand spacing
|
|
551
|
+
* tokens: `near` and `default` are larger on bloomon than on Bloom & Wild.
|
|
552
|
+
*/
|
|
375
553
|
stack_gap = 'default';
|
|
554
|
+
/**
|
|
555
|
+
* Cross-axis alignment: where children sit horizontally in a vertical stack,
|
|
556
|
+
* or vertically in a horizontal one (`center` to line up an icon with
|
|
557
|
+
* text).
|
|
558
|
+
*/
|
|
376
559
|
stack_align = 'start';
|
|
560
|
+
/** `y` (default) for a column, `x` for a row. */
|
|
377
561
|
stack_direction = 'y';
|
|
562
|
+
/**
|
|
563
|
+
* Main-axis distribution. `start` / `center` / `end` pack the children;
|
|
564
|
+
* `space-between` / `space-around` / `space-evenly` spread them out;
|
|
565
|
+
* `fill` makes every child grow to share the space; `fit` gives child
|
|
566
|
+
* `<ui-stack>`s equal widths. `cover` has no effect on a stack.
|
|
567
|
+
* `space-between` and `end` in a vertical stack need the stack to have a
|
|
568
|
+
* height (e.g. inside a fixed-height or `box_fill_mode="cover"` box).
|
|
569
|
+
*/
|
|
378
570
|
stack_distribute = 'start';
|
|
571
|
+
/**
|
|
572
|
+
* Let children wrap onto new lines when they don't fit, e.g. a row of
|
|
573
|
+
* chips or tags. Bind a boolean: `[stack_wrap]="true"`.
|
|
574
|
+
*/
|
|
379
575
|
stack_wrap = false;
|
|
576
|
+
/**
|
|
577
|
+
* Below this breakpoint a horizontal stack becomes vertical: `tablet` (under
|
|
578
|
+
* 767px), `laptop` (under 1080px) or `desktop` (under 1440px). `none`
|
|
579
|
+
* (default) never collapses.
|
|
580
|
+
*/
|
|
380
581
|
stack_collapse_below = 'none';
|
|
582
|
+
/**
|
|
583
|
+
* Adds `role="list"` so assistive technology announces the children as a
|
|
584
|
+
* list. Each direct child must then be an `<li>` or have
|
|
585
|
+
* `role="listitem"`. Bind a boolean: `[stack_as_list]="true"`.
|
|
586
|
+
*/
|
|
381
587
|
stack_as_list = false;
|
|
588
|
+
/** @ignore */
|
|
382
589
|
defaultDistribution() {
|
|
383
590
|
if (this.stack_distribute) {
|
|
384
591
|
return this.stack_distribute;
|
|
385
592
|
}
|
|
386
593
|
return this.stack_direction === 'x' ? 'fit' : 'fill';
|
|
387
594
|
}
|
|
595
|
+
/** @ignore */
|
|
388
596
|
ngOnChanges() {
|
|
389
597
|
if (!this.didFirstInit) {
|
|
390
598
|
return;
|
|
@@ -392,6 +600,7 @@ class LayoutStackComponent {
|
|
|
392
600
|
this.ngOnInit();
|
|
393
601
|
this.changes.markForCheck();
|
|
394
602
|
}
|
|
603
|
+
/** @ignore */
|
|
395
604
|
ngOnInit() {
|
|
396
605
|
this.stack_distribute = this.defaultDistribution();
|
|
397
606
|
this.stackLayoutClasses = [
|
|
@@ -430,19 +639,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
430
639
|
type: Input
|
|
431
640
|
}] } });
|
|
432
641
|
|
|
642
|
+
/**
|
|
643
|
+
* A single-colour icon from the brand's icon sprite (`<ui-icon>`). Use it next
|
|
644
|
+
* to text or inside your own layouts. For an icon on a button, use
|
|
645
|
+
* `<ui-button button_icon="...">` instead of placing `<ui-icon>` in a button.
|
|
646
|
+
* For full-colour artwork such as payment provider badges, use `<ui-logo>`.
|
|
647
|
+
*
|
|
648
|
+
* Renders an inline `<svg>` that references
|
|
649
|
+
* `./<brand>/assets/icons/icons.svg#icon-<icon_name>`, so each brand gets its
|
|
650
|
+
* own artwork for the same name. The consuming app must:
|
|
651
|
+
* - serve the sprite at `<brand-slug>/assets/icons/icons.svg` relative to the
|
|
652
|
+
* document base URL (copy it from `oasys-lib/src/assets/<brand>/icons`);
|
|
653
|
+
* - have an element with a `brand-tokens-<brand>` class on the page (usually
|
|
654
|
+
* `<body>`). The brand is read from the first such element; until one
|
|
655
|
+
* exists the icon renders nothing.
|
|
656
|
+
*
|
|
657
|
+
* Colour: the icon is filled with `currentColor`, so it takes the text colour
|
|
658
|
+
* of its parent. Set the colour on a wrapper (for example a `text-color--*`
|
|
659
|
+
* class); never assume the inherited colour is the one in the design.
|
|
660
|
+
*
|
|
661
|
+
* Size: 2rem square by default (20px with the 62.5% root font size). Use
|
|
662
|
+
* `icon_size_override` with a rem value to change it; `icon_size` does not
|
|
663
|
+
* change the size.
|
|
664
|
+
*
|
|
665
|
+
* Accessibility: icons are decorative by default (`role="presentation"`),
|
|
666
|
+
* which is right when visible text next to the icon already says the same
|
|
667
|
+
* thing. When the icon is the only thing conveying meaning, add visually
|
|
668
|
+
* hidden text next to it (`<span class="visually-hidden">`), or put the name on
|
|
669
|
+
* the interactive element that contains it (for example `aria_label` on an
|
|
670
|
+
* icon-only `<ui-button>`). Describe the purpose, not the picture:
|
|
671
|
+
* https://www.w3.org/WAI/tutorials/images/functional/
|
|
672
|
+
*
|
|
673
|
+
* @import import { OasysIconComponent } from 'oasys-lib';
|
|
674
|
+
* @knownIssue `icon_size` does not change the icon's size: it only adds an
|
|
675
|
+
* `icon-size-*` class that no stylesheet uses. Workaround: set
|
|
676
|
+
* `icon_size_override` to a rem value, for example `icon_size_override="1.6rem"`.
|
|
677
|
+
* @knownIssue `icon_size_override` is always read as rem: `"24px"` renders a
|
|
678
|
+
* 240px icon (24 x the root font size). Workaround: only pass rem values.
|
|
679
|
+
* @knownIssue `alt_text` does not give the icon an accessible name: it sets
|
|
680
|
+
* `role="img"` and an `alt` attribute, which SVG ignores, so screen readers
|
|
681
|
+
* announce an unnamed image. Workaround: leave `alt_text` empty and add
|
|
682
|
+
* `<span class="visually-hidden">` text next to the icon, or label the
|
|
683
|
+
* surrounding control.
|
|
684
|
+
* @knownIssue On bloomon, `gift`, `greeting-card`, `logomark` and
|
|
685
|
+
* `loyalty-vip` render nothing because they are missing from the bloomon
|
|
686
|
+
* sprite. Workaround: do not use these names on bloomon; check the Icon Gallery
|
|
687
|
+
* story (Media Visual) under the bloomon theme.
|
|
688
|
+
*/
|
|
433
689
|
class IconComponent {
|
|
434
690
|
document = inject(DOCUMENT);
|
|
435
691
|
tokenService = inject(TokenService);
|
|
692
|
+
/**
|
|
693
|
+
* Has no visual effect: it only adds an `icon-size-small` / `icon-size-large`
|
|
694
|
+
* class. Use `icon_size_override` to resize.
|
|
695
|
+
*/
|
|
436
696
|
icon_size = 'large';
|
|
697
|
+
/**
|
|
698
|
+
* Width and height of the icon, in rem (for example `"1.6rem"`). Defaults to
|
|
699
|
+
* the `--oasys-size-unit-20` token (2rem). Other units are misread as rem.
|
|
700
|
+
*/
|
|
437
701
|
icon_size_override;
|
|
702
|
+
/** Which icon to show. Browse them all in the Icon Gallery story (Media Visual). */
|
|
438
703
|
icon_name;
|
|
704
|
+
/**
|
|
705
|
+
* Where the icon sits relative to text. Only adds an `icon-context-*` class
|
|
706
|
+
* on the wrapper; it changes nothing visually or for accessibility.
|
|
707
|
+
*/
|
|
439
708
|
icon_context = 'none';
|
|
709
|
+
/**
|
|
710
|
+
* Intended to make the icon meaningful, but it does not currently give the
|
|
711
|
+
* icon an accessible name (see Known issues). Leave empty and use visually
|
|
712
|
+
* hidden text or a label on the surrounding control instead.
|
|
713
|
+
*/
|
|
440
714
|
alt_text = '';
|
|
715
|
+
/** Class(es) added to the `<svg>`, for one-off styling hooks. */
|
|
441
716
|
icon_class;
|
|
717
|
+
/** @ignore */
|
|
442
718
|
size;
|
|
719
|
+
/** @ignore */
|
|
443
720
|
iconDisplayClasses;
|
|
721
|
+
/** @ignore */
|
|
444
722
|
iconSizeInPixels;
|
|
723
|
+
/** @ignore */
|
|
445
724
|
iconPath;
|
|
725
|
+
/** @ignore */
|
|
446
726
|
getSizeInPixels(size) {
|
|
447
727
|
const convertedSize = this.tokenService.convertRemToPixels(size);
|
|
448
728
|
if (isNaN(convertedSize)) {
|
|
@@ -450,9 +730,11 @@ class IconComponent {
|
|
|
450
730
|
}
|
|
451
731
|
return convertedSize;
|
|
452
732
|
}
|
|
733
|
+
/** @ignore */
|
|
453
734
|
ngOnChanges() {
|
|
454
735
|
this.ngOnInit();
|
|
455
736
|
}
|
|
737
|
+
/** @ignore */
|
|
456
738
|
ngOnInit() {
|
|
457
739
|
this.tokenService.getBrandName().subscribe((brandName) => {
|
|
458
740
|
this.iconPath = `./${brandName}/assets/icons/icons.svg#icon-${this.icon_name}`;
|
|
@@ -507,12 +789,61 @@ class SwiperProvider {
|
|
|
507
789
|
}
|
|
508
790
|
}
|
|
509
791
|
|
|
792
|
+
/**
|
|
793
|
+
* Hands every Oasys link to the consuming app's routing handler. It matches
|
|
794
|
+
* **every `<a>`** in a template that imports it (plus `[uiHref]`), including
|
|
795
|
+
* the links rendered inside `<ui-button href>`, `<ui-promo-card>`,
|
|
796
|
+
* `<ui-section>` and `<ui-seo-block>`. There are no
|
|
797
|
+
* inputs; it is mostly something apps configure rather than use.
|
|
798
|
+
*
|
|
799
|
+
* It calls the `ROUTING_HANDLER` provider (`IRoutingHandlerService`):
|
|
800
|
+
* - `handleHrefDomains(anchor)` once, after the link renders: the place to
|
|
801
|
+
* rewrite the `href` or add `target="_blank"` / `rel="noopener"` to links
|
|
802
|
+
* that leave your domains.
|
|
803
|
+
* - `handleRoutingOnClick(anchor, event)` on every click: the place to route
|
|
804
|
+
* internally (call `event.preventDefault()` and navigate with your router),
|
|
805
|
+
* open modals, or track analytics. The directive itself never prevents the
|
|
806
|
+
* default, so a handler that does nothing leaves a normal browser link.
|
|
807
|
+
*
|
|
808
|
+
* Setup: every app (and test) that renders an Oasys link must provide the
|
|
809
|
+
* token in its `bootstrapApplication` (or test) providers. There is no
|
|
810
|
+
* default: without it, the first link that renders throws
|
|
811
|
+
* `NullInjectorError: No provider for InjectionToken ROUTING_HANDLER`.
|
|
812
|
+
*
|
|
813
|
+
* Example handler (an `@Injectable` service provided in root):
|
|
814
|
+
*
|
|
815
|
+
* ```ts
|
|
816
|
+
* export class AppRoutingHandler implements IRoutingHandlerService {
|
|
817
|
+
* private readonly router = inject(Router);
|
|
818
|
+
* handleHrefDomains(anchor: HTMLAnchorElement): void {
|
|
819
|
+
* if (anchor.hostname !== location.hostname) {
|
|
820
|
+
* anchor.target = '_blank';
|
|
821
|
+
* anchor.rel = 'noopener';
|
|
822
|
+
* }
|
|
823
|
+
* }
|
|
824
|
+
* handleRoutingOnClick(anchor: HTMLAnchorElement, event: MouseEvent): void {
|
|
825
|
+
* if (anchor.hostname === location.hostname && anchor.target !== '_blank') {
|
|
826
|
+
* event.preventDefault();
|
|
827
|
+
* this.router.navigateByUrl(anchor.pathname + anchor.search);
|
|
828
|
+
* }
|
|
829
|
+
* }
|
|
830
|
+
* }
|
|
831
|
+
* // providers: [{ provide: ROUTING_HANDLER, useExisting: AppRoutingHandler }]
|
|
832
|
+
* ```
|
|
833
|
+
*
|
|
834
|
+
* Links stay real `<a href>` elements, so they keep native keyboard and
|
|
835
|
+
* screen reader behaviour; give each one text that makes sense on its own.
|
|
836
|
+
*
|
|
837
|
+
* @import import { OasysHrefDirective, ROUTING_HANDLER, IRoutingHandlerService } from 'oasys-lib';
|
|
838
|
+
*/
|
|
510
839
|
class OasysHrefDirective {
|
|
511
840
|
element = inject(ElementRef);
|
|
512
841
|
routingHandler = inject(ROUTING_HANDLER);
|
|
842
|
+
/** @ignore */
|
|
513
843
|
onClick(event) {
|
|
514
844
|
this.routingHandler.handleRoutingOnClick(this.element.nativeElement, event);
|
|
515
845
|
}
|
|
846
|
+
/** @ignore */
|
|
516
847
|
ngAfterViewInit() {
|
|
517
848
|
this.routingHandler.handleHrefDomains(this.element.nativeElement);
|
|
518
849
|
}
|
|
@@ -680,23 +1011,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
680
1011
|
args: [{ selector: 'ui-button', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Eager, standalone: true, imports: [IconComponent, NgTemplateOutlet, OasysHrefDirective, RouterModule], template: "<ng-template #content>\n <div class=\"button-content\">\n @if (button_icon() && button_icon_placement() !== 'none') {\n <ui-icon\n [icon_name]=\"button_icon()\"\n [icon_size]=\"button_size()\"\n [icon_class]=\"'buttonIcon'\"\n [icon_context]=\"button_icon_placement()\"\n ></ui-icon>\n }\n <span class=\"ui-text\" [class.visuallyhidden]=\"button_icon_placement() === 'iconOnly'\">\n <span #buttontext>\n <ng-content></ng-content>\n </span>\n </span>\n </div>\n <div class=\"button-overlay\"></div>\n <div class=\"button-overlay-focus\"></div>\n</ng-template>\n\n@if (href()) {\n <a\n [attr.href]=\"href()\"\n [attr.disabled]=\"button_disabled() === true || null\"\n [attr.aria-label]=\"computedAccessibleButtonContent()\"\n [class]=\"computedButtonDisplayClasses()\"\n >\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </a>\n} @else if (routerLink()) {\n <a\n [routerLink]=\"routerLink()\"\n [attr.disabled]=\"button_disabled() === true || null\"\n [attr.aria-label]=\"computedAccessibleButtonContent()\"\n [class]=\"computedButtonDisplayClasses()\"\n >\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </a>\n} @else {\n <button\n (click)=\"onClick()\"\n [type]=\"button_event_type()\"\n [class]=\"computedButtonDisplayClasses()\"\n [attr.disabled]=\"button_disabled() === true || null\"\n [attr.aria-label]=\"computedAccessibleButtonContent()\"\n [attr.role]=\"aria_role()\"\n [attr.aria-checked]=\"\n aria_role() === 'checkbox' || aria_role() === 'switch' ? button_selected() : null\n \"\n >\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </button>\n}\n", styles: ["ui-button{display:contents}ui-button button,ui-button a{border:0;padding:0;position:relative;display:inline-flex;text-align:center;justify-content:center;align-items:center;border-style:solid;cursor:pointer;user-select:none;appearance:none;-webkit-appearance:none;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;border-width:var(--oasys-component-button-border-width);border-radius:var(--oasys-component-button-border-radius);font-family:var(--oasys-typography-body-body-font-family)}ui-button button .button-content,ui-button a .button-content{display:flex;align-items:center;gap:var(--oasys-component-button-content-stack);min-height:var(--oasys-component-button-content-height)}ui-button button .button-content .ui-icon,ui-button a .button-content .ui-icon{display:flex;align-items:center;max-height:var(--oasys-component-button-line-height)}ui-button button .button-content .ui-text,ui-button a .button-content .ui-text{text-transform:var(--oasys-component-button-text-transform);letter-spacing:var(--oasys-component-button-letter-spacing);font-weight:var(--oasys-component-button-font-weight);line-height:var(--oasys-component-button-line-height)}ui-button button .button-overlay,ui-button button .button-overlay-focus,ui-button a .button-overlay,ui-button a .button-overlay-focus{position:absolute;inset:0;touch-action:none;pointer-events:none;border-radius:var(--oasys-component-button-border-radius);opacity:0}ui-button button:hover .button-overlay,ui-button a:hover .button-overlay{opacity:var(--oasys-component-button-opacity-overlay-hover)}ui-button button:focus .button-overlay,ui-button a:focus .button-overlay{opacity:var(--oasys-component-button-opacity-overlay-focus)}ui-button button:focus-visible .button-overlay,ui-button a:focus-visible .button-overlay{opacity:var(--oasys-component-button-opacity-overlay-focus)}ui-button button.type-primary,ui-button a.type-primary{background-color:var(--oasys-component-button-color-primary-background);border-color:var(--oasys-component-button-color-primary-border);color:var(--oasys-component-button-color-primary-text)}ui-button button.type-primary:hover:not(.button--selected),ui-button a.type-primary:hover:not(.button--selected){background-color:var(--oasys-component-button-color-primary-hover-underlay)}ui-button button.type-primary.button--selected:not([disabled]),ui-button a.type-primary.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-primary-hover-underlay);border-color:var(--oasys-component-button-color-primary-selected-border)}ui-button button.type-primary .button-overlay,ui-button a.type-primary .button-overlay{background-color:var(--oasys-component-button-color-primary-hover-overlay)}ui-button button.type-primary .ui-text,ui-button a.type-primary .ui-text{font-weight:var(--oasys-component-button-font-weight-primary)}ui-button button.type-primary.button--selected .ui-text,ui-button a.type-primary.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-primary)}ui-button button.type-secondary,ui-button a.type-secondary{background-color:var(--oasys-component-button-color-secondary-background);border-color:var(--oasys-component-button-color-secondary-border);color:var(--oasys-component-button-color-secondary-text)}ui-button button.type-secondary:hover:not(.button--selected),ui-button a.type-secondary:hover:not(.button--selected){background-color:var(--oasys-component-button-color-secondary-hover-underlay)}ui-button button.type-secondary.button--selected:not([disabled]),ui-button a.type-secondary.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-secondary-hover-underlay);border-color:var(--oasys-component-button-color-secondary-selected-border)}ui-button button.type-secondary .button-overlay,ui-button a.type-secondary .button-overlay{background-color:var(--oasys-component-button-color-secondary-hover-overlay)}ui-button button.type-secondary .ui-text,ui-button a.type-secondary .ui-text{font-weight:var(--oasys-component-button-font-weight-secondary)}ui-button button.type-secondary.button--selected .ui-text,ui-button a.type-secondary.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-secondary)}ui-button button.type-tertiary,ui-button a.type-tertiary{background-color:var(--oasys-component-button-color-tertiary-background);border-color:var(--oasys-component-button-color-tertiary-border);color:var(--oasys-component-button-color-tertiary-text)}ui-button button.type-tertiary:hover:not(.button--selected),ui-button a.type-tertiary:hover:not(.button--selected){background-color:var(--oasys-component-button-color-tertiary-hover-underlay)}ui-button button.type-tertiary.button--selected:not([disabled]),ui-button a.type-tertiary.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-tertiary-hover-underlay);border-color:var(--oasys-component-button-color-tertiary-selected-border)}ui-button button.type-tertiary .button-overlay,ui-button a.type-tertiary .button-overlay{background-color:var(--oasys-component-button-color-tertiary-hover-overlay)}ui-button button.type-tertiary .ui-text,ui-button a.type-tertiary .ui-text{font-weight:var(--oasys-component-button-font-weight-tertiary)}ui-button button.type-tertiary.button--selected .ui-text,ui-button a.type-tertiary.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-tertiary)}ui-button button.type-primary-inverse,ui-button a.type-primary-inverse{background-color:var(--oasys-component-button-color-primary-inverse-background);border-color:var(--oasys-component-button-color-primary-inverse-border);color:var(--oasys-component-button-color-primary-inverse-text)}ui-button button.type-primary-inverse:hover:not(.button--selected),ui-button a.type-primary-inverse:hover:not(.button--selected){background-color:var(--oasys-component-button-color-primary-inverse-hover-underlay)}ui-button button.type-primary-inverse.button--selected:not([disabled]),ui-button a.type-primary-inverse.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-primary-inverse-hover-underlay);border-color:var(--oasys-component-button-color-primary-inverse-selected-border)}ui-button button.type-primary-inverse .button-overlay,ui-button a.type-primary-inverse .button-overlay{background-color:var(--oasys-component-button-color-primary-inverse-hover-overlay)}ui-button button.type-primary-inverse .ui-text,ui-button a.type-primary-inverse .ui-text{font-weight:var(--oasys-component-button-font-weight-primary-inverse)}ui-button button.type-primary-inverse.button--selected .ui-text,ui-button a.type-primary-inverse.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-primary-inverse)}ui-button button.type-secondary-inverse,ui-button a.type-secondary-inverse{background-color:var(--oasys-component-button-color-secondary-inverse-background);border-color:var(--oasys-component-button-color-secondary-inverse-border);color:var(--oasys-component-button-color-secondary-inverse-text)}ui-button button.type-secondary-inverse:hover:not(.button--selected),ui-button a.type-secondary-inverse:hover:not(.button--selected){background-color:var(--oasys-component-button-color-secondary-inverse-hover-underlay)}ui-button button.type-secondary-inverse.button--selected:not([disabled]),ui-button a.type-secondary-inverse.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-secondary-inverse-hover-underlay);border-color:var(--oasys-component-button-color-secondary-inverse-selected-border)}ui-button button.type-secondary-inverse .button-overlay,ui-button a.type-secondary-inverse .button-overlay{background-color:var(--oasys-component-button-color-secondary-inverse-hover-overlay)}ui-button button.type-secondary-inverse .ui-text,ui-button a.type-secondary-inverse .ui-text{font-weight:var(--oasys-component-button-font-weight-secondary-inverse)}ui-button button.type-secondary-inverse.button--selected .ui-text,ui-button a.type-secondary-inverse.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-secondary-inverse)}ui-button button.type-tertiary-inverse,ui-button a.type-tertiary-inverse{background-color:var(--oasys-component-button-color-tertiary-inverse-background);border-color:var(--oasys-component-button-color-tertiary-inverse-border);color:var(--oasys-component-button-color-tertiary-inverse-text)}ui-button button.type-tertiary-inverse:hover:not(.button--selected),ui-button a.type-tertiary-inverse:hover:not(.button--selected){background-color:var(--oasys-component-button-color-tertiary-inverse-hover-underlay)}ui-button button.type-tertiary-inverse.button--selected:not([disabled]),ui-button a.type-tertiary-inverse.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-tertiary-inverse-hover-underlay);border-color:var(--oasys-component-button-color-tertiary-inverse-selected-border)}ui-button button.type-tertiary-inverse .button-overlay,ui-button a.type-tertiary-inverse .button-overlay{background-color:var(--oasys-component-button-color-tertiary-inverse-hover-overlay)}ui-button button.type-tertiary-inverse .ui-text,ui-button a.type-tertiary-inverse .ui-text{font-weight:var(--oasys-component-button-font-weight-tertiary-inverse)}ui-button button.type-tertiary-inverse.button--selected .ui-text,ui-button a.type-tertiary-inverse.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-tertiary-inverse)}ui-button button.type-expressive,ui-button a.type-expressive{background-color:var(--oasys-component-button-color-expressive-background);border-color:var(--oasys-component-button-color-expressive-border);color:var(--oasys-component-button-color-expressive-text)}ui-button button.type-expressive:hover:not(.button--selected),ui-button a.type-expressive:hover:not(.button--selected){background-color:var(--oasys-component-button-color-expressive-hover-underlay)}ui-button button.type-expressive.button--selected:not([disabled]),ui-button a.type-expressive.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-expressive-hover-underlay);border-color:var(--oasys-component-button-color-expressive-selected-border)}ui-button button.type-expressive .button-overlay,ui-button a.type-expressive .button-overlay{background-color:var(--oasys-component-button-color-expressive-hover-overlay)}ui-button button.type-expressive .ui-text,ui-button a.type-expressive .ui-text{font-weight:var(--oasys-component-button-font-weight-expressive)}ui-button button.type-expressive.button--selected .ui-text,ui-button a.type-expressive.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-expressive)}ui-button button.type-danger,ui-button a.type-danger{background-color:var(--oasys-component-button-color-danger-background);border-color:var(--oasys-component-button-color-danger-border);color:var(--oasys-component-button-color-danger-text)}ui-button button.type-danger:hover:not(.button--selected),ui-button a.type-danger:hover:not(.button--selected){background-color:var(--oasys-component-button-color-danger-hover-underlay)}ui-button button.type-danger.button--selected:not([disabled]),ui-button a.type-danger.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-danger-hover-underlay);border-color:var(--oasys-component-button-color-danger-selected-border)}ui-button button.type-danger .button-overlay,ui-button a.type-danger .button-overlay{background-color:var(--oasys-component-button-color-danger-hover-overlay)}ui-button button.type-danger .ui-text,ui-button a.type-danger .ui-text{font-weight:var(--oasys-component-button-font-weight-danger)}ui-button button.type-danger.button--selected .ui-text,ui-button a.type-danger.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-danger)}ui-button button.type-facebook,ui-button a.type-facebook{background-color:var(--oasys-component-button-color-facebook-background);border-color:var(--oasys-component-button-color-facebook-border);color:var(--oasys-component-button-color-facebook-text)}ui-button button.type-facebook:hover:not(.button--selected),ui-button a.type-facebook:hover:not(.button--selected){background-color:var(--oasys-component-button-color-facebook-hover-underlay)}ui-button button.type-facebook.button--selected:not([disabled]),ui-button a.type-facebook.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-facebook-hover-underlay);border-color:var(--oasys-component-button-color-facebook-selected-border)}ui-button button.type-facebook .button-overlay,ui-button a.type-facebook .button-overlay{background-color:var(--oasys-component-button-color-facebook-hover-overlay)}ui-button button.type-facebook .ui-text,ui-button a.type-facebook .ui-text{font-weight:var(--oasys-component-button-font-weight-facebook)}ui-button button.type-facebook.button--selected .ui-text,ui-button a.type-facebook.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-facebook)}ui-button button.type-paypal,ui-button a.type-paypal{background-color:var(--oasys-component-button-color-paypal-background);border-color:var(--oasys-component-button-color-paypal-border);color:var(--oasys-component-button-color-paypal-text)}ui-button button.type-paypal:hover:not(.button--selected),ui-button a.type-paypal:hover:not(.button--selected){background-color:var(--oasys-component-button-color-paypal-hover-underlay)}ui-button button.type-paypal.button--selected:not([disabled]),ui-button a.type-paypal.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-paypal-hover-underlay);border-color:var(--oasys-component-button-color-paypal-selected-border)}ui-button button.type-paypal .button-overlay,ui-button a.type-paypal .button-overlay{background-color:var(--oasys-component-button-color-paypal-hover-overlay)}ui-button button.type-paypal .ui-text,ui-button a.type-paypal .ui-text{font-weight:var(--oasys-component-button-font-weight-paypal)}ui-button button.type-paypal.button--selected .ui-text,ui-button a.type-paypal.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-paypal)}ui-button button.type-rewards,ui-button a.type-rewards{background-color:var(--oasys-component-button-color-rewards-background);border-color:var(--oasys-component-button-color-rewards-border);color:var(--oasys-component-button-color-rewards-text)}ui-button button.type-rewards:hover:not(.button--selected),ui-button a.type-rewards:hover:not(.button--selected){background-color:var(--oasys-component-button-color-rewards-hover-underlay)}ui-button button.type-rewards.button--selected:not([disabled]),ui-button a.type-rewards.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-rewards-hover-underlay);border-color:var(--oasys-component-button-color-rewards-selected-border)}ui-button button.type-rewards .button-overlay,ui-button a.type-rewards .button-overlay{background-color:var(--oasys-component-button-color-rewards-hover-overlay)}ui-button button.type-rewards .ui-text,ui-button a.type-rewards .ui-text{font-weight:var(--oasys-component-button-font-weight-rewards)}ui-button button.type-rewards.button--selected .ui-text,ui-button a.type-rewards.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-rewards)}ui-button button.type-rewards-on-dark,ui-button a.type-rewards-on-dark{background-color:var(--oasys-component-button-color-rewards-on-dark-background);border-color:var(--oasys-component-button-color-rewards-on-dark-border);color:var(--oasys-component-button-color-rewards-on-dark-text)}ui-button button.type-rewards-on-dark:hover:not(.button--selected),ui-button a.type-rewards-on-dark:hover:not(.button--selected){background-color:var(--oasys-component-button-color-rewards-on-dark-hover-underlay)}ui-button button.type-rewards-on-dark.button--selected:not([disabled]),ui-button a.type-rewards-on-dark.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-rewards-on-dark-hover-underlay);border-color:var(--oasys-component-button-color-rewards-on-dark-selected-border)}ui-button button.type-rewards-on-dark .button-overlay,ui-button a.type-rewards-on-dark .button-overlay{background-color:var(--oasys-component-button-color-rewards-on-dark-hover-overlay)}ui-button button.type-rewards-on-dark .ui-text,ui-button a.type-rewards-on-dark .ui-text{font-weight:var(--oasys-component-button-font-weight-rewards-on-dark)}ui-button button.type-rewards-on-dark.button--selected .ui-text,ui-button a.type-rewards-on-dark.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-rewards-on-dark)}ui-button button.type-chip,ui-button a.type-chip{background-color:var(--oasys-component-button-color-chip-background);border-color:var(--oasys-component-button-color-chip-border);color:var(--oasys-component-button-color-chip-text)}ui-button button.type-chip:hover:not(.button--selected),ui-button a.type-chip:hover:not(.button--selected){background-color:var(--oasys-component-button-color-chip-hover-underlay)}ui-button button.type-chip.button--selected:not([disabled]),ui-button a.type-chip.button--selected:not([disabled]){background-color:var(--oasys-component-button-color-chip-hover-underlay);border-color:var(--oasys-component-button-color-chip-selected-border)}ui-button button.type-chip .button-overlay,ui-button a.type-chip .button-overlay{background-color:var(--oasys-component-button-color-chip-hover-overlay)}ui-button button.type-chip .ui-text,ui-button a.type-chip .ui-text{font-weight:var(--oasys-component-button-font-weight-chip)}ui-button button.type-chip.button--selected .ui-text,ui-button a.type-chip.button--selected .ui-text{font-weight:var(--oasys-component-button-font-weight-selected-chip)}ui-button button .buttonIcon,ui-button a .buttonIcon{fill:currentColor}ui-button button.size-large.button--icon--iconOnly,ui-button a.size-large.button--icon--iconOnly{max-width:var(--oasys-component-button-size-large-icon-only-width)}ui-button button.size-large,ui-button a.size-large{padding:var(--oasys-component-button-size-large-inset-y) var(--oasys-component-button-size-large-inset-x);font-size:var(--oasys-component-button-size-large-font-size)}ui-button button.size-small.button--icon--iconOnly,ui-button a.size-small.button--icon--iconOnly{max-width:var(--oasys-component-button-size-small-icon-only-width)}ui-button button.size-small,ui-button a.size-small{padding:var(--oasys-component-button-size-small-inset-y) var(--oasys-component-button-size-small-inset-x);font-size:var(--oasys-component-button-size-small-font-size)}ui-button button[disabled],ui-button a[disabled]{background-color:var(--oasys-component-button-color-disabled-background);border-color:var(--oasys-component-button-color-disabled-border);color:var(--oasys-component-button-color-disabled-text);cursor:default;pointer-events:none}ui-button button.button--has-icon.button--icon--trailing .button-content,ui-button a.button--has-icon.button--icon--trailing .button-content{flex-direction:row-reverse}ui-button button.button--full-width,ui-button a.button--full-width{width:100%}ui-button button.button--nowrap .button-content .ui-text,ui-button a.button--nowrap .button-content .ui-text{white-space:nowrap}ui-button button.button--chip,ui-button a.button--chip{border-radius:var(--oasys-radius-soften);padding:var(--oasys-spacing-near)}ui-button button.button--chip .ui-text,ui-button a.button--chip .ui-text{letter-spacing:unset;line-height:calc(var(--oasys-typography-body-body-line-height) - 2px);font-size:var(--oasys-typography-body-body-font-size);text-transform:unset}ui-button button.button--chip[disabled],ui-button a.button--chip[disabled]{background-color:var(--oasys-component-button-color-chip-background)}\n"] }]
|
|
681
1012
|
}], propDecorators: { button_icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_icon", required: false }] }], button_icon_placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_icon_placement", required: false }] }], button_size: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_size", required: false }] }], button_type: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_type", required: false }] }], button_full_width: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_full_width", required: false }] }], button_event_type: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_event_type", required: false }] }], button_disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_disabled", required: false }] }], button_selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_selected", required: false }] }], button_text_nowrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "button_text_nowrap", required: false }] }], aria_label: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria_label", required: false }] }], aria_role: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria_role", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], routerLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "routerLink", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }], ngContent: [{ type: i0.ViewChild, args: ['buttontext', { isSignal: true }] }] } });
|
|
682
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* An inline message (`<ui-alert>`) that tells the user something has happened:
|
|
1016
|
+
* a success, a failure, or neutral information, optionally with up to two
|
|
1017
|
+
* actions. Use it for feedback next to the thing it is about (a form, a
|
|
1018
|
+
* section of a page). It is not a modal and not a toast.
|
|
1019
|
+
*
|
|
1020
|
+
* Content is projected through four slot elements, all optional:
|
|
1021
|
+
* - `<ui-alert-title>`: short, bold first line.
|
|
1022
|
+
* - `<ui-alert-content>`: the message.
|
|
1023
|
+
* - `<ui-alert-cancel>`: label for the dismissive action, rendered first as a
|
|
1024
|
+
* `tertiary` button that emits `cancel`.
|
|
1025
|
+
* - `<ui-alert-confirm>`: label for the main action, rendered second as a
|
|
1026
|
+
* `secondary` button that emits `confirm`.
|
|
1027
|
+
*
|
|
1028
|
+
* A button only renders when its slot has text. The buttons are `small` on
|
|
1029
|
+
* mobile whatever `button_size` says, and with `direction="dynamic"` they sit
|
|
1030
|
+
* below the message on mobile and beside it from tablet up.
|
|
1031
|
+
*
|
|
1032
|
+
* Accessibility:
|
|
1033
|
+
* - The message is a live region (`role="alert"` plus `aria-live` from
|
|
1034
|
+
* `aria_live`). Screen readers announce it when it appears or its text
|
|
1035
|
+
* changes, so add it to the page when the event happens (for example inside
|
|
1036
|
+
* an `@if`) rather than rendering it in advance. Each time the alert goes
|
|
1037
|
+
* from hidden to visible the component re-applies the live region so it is
|
|
1038
|
+
* announced again.
|
|
1039
|
+
* - An alert that is already on the page at first load may not be announced.
|
|
1040
|
+
* If it must be, show it after the view has rendered (for example set the
|
|
1041
|
+
* `@if` condition in `afterNextRender`).
|
|
1042
|
+
* - When there is a `<ui-alert-cancel>`, the alert behaves like an interrupting
|
|
1043
|
+
* prompt: `aria_live` is ignored (forced to `off`) and focus moves to the
|
|
1044
|
+
* message when the alert becomes visible, so screen reader users hear it and
|
|
1045
|
+
* can tab straight to the actions.
|
|
1046
|
+
* - The tone icon is decorative. Say "success" or "failed" in the words of the
|
|
1047
|
+
* title or message; never rely on colour or the icon alone.
|
|
1048
|
+
* - Don't use it for content that is always on the page: every appearance
|
|
1049
|
+
* interrupts screen reader users.
|
|
1050
|
+
*
|
|
1051
|
+
* Import the four slot directives (or `OasysAlertModule`) alongside the
|
|
1052
|
+
* component.
|
|
1053
|
+
*
|
|
1054
|
+
* @import import { OasysAlertComponent, OasysAlertTitleDirective, OasysAlertContentDirective, OasysAlertCancelDirective, OasysAlertConfirmDirective } from 'oasys-lib';
|
|
1055
|
+
*/
|
|
683
1056
|
class OasysAlertComponent {
|
|
1057
|
+
/** @ignore */
|
|
684
1058
|
breakpointService = inject(BreakpointService);
|
|
1059
|
+
/**
|
|
1060
|
+
* Where the actions sit. `dynamic` puts them below the message on mobile and
|
|
1061
|
+
* beside it from tablet up; `vertical` and `horizontal` fix one layout.
|
|
1062
|
+
*/
|
|
685
1063
|
direction = 'dynamic';
|
|
1064
|
+
/**
|
|
1065
|
+
* Meaning of the message, shown by colour and icon: `positive` for success,
|
|
1066
|
+
* `negative` for errors and failures, `neutral` for general information.
|
|
1067
|
+
*/
|
|
686
1068
|
tone = 'neutral';
|
|
1069
|
+
/**
|
|
1070
|
+
* How urgently screen readers announce the alert. `polite` (default) waits
|
|
1071
|
+
* until the user is idle: use it for confirmations and most messages.
|
|
1072
|
+
* `assertive` interrupts: use it only for errors that block the user's task.
|
|
1073
|
+
* `off` stops the announcement: use it when the same message is announced
|
|
1074
|
+
* elsewhere. Ignored when there is a `<ui-alert-cancel>` (focus moves to the
|
|
1075
|
+
* alert instead).
|
|
1076
|
+
*/
|
|
687
1077
|
aria_live = 'polite';
|
|
1078
|
+
/** Size of the action buttons from tablet up. On mobile they are always `small`. */
|
|
688
1079
|
button_size = 'large';
|
|
1080
|
+
/** Emitted when the `<ui-alert-cancel>` button is clicked. */
|
|
689
1081
|
// adding this ignore because changing this value requires a breaking change in FE monolith
|
|
690
1082
|
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
691
1083
|
cancel = new EventEmitter();
|
|
1084
|
+
/** Emitted when the `<ui-alert-confirm>` button is clicked. */
|
|
692
1085
|
confirm = new EventEmitter();
|
|
1086
|
+
/** @ignore */
|
|
693
1087
|
cancelButton;
|
|
1088
|
+
/** @ignore */
|
|
694
1089
|
confirmButton;
|
|
1090
|
+
/** @ignore */
|
|
695
1091
|
cancelbuttoncontainer;
|
|
1092
|
+
/** @ignore */
|
|
696
1093
|
alertHost;
|
|
697
1094
|
wasVisible = false;
|
|
698
1095
|
hasFocusedOnCurrentVisibility = false;
|
|
699
1096
|
ariaLiveElement;
|
|
1097
|
+
/** @ignore */
|
|
700
1098
|
get isVertical() {
|
|
701
1099
|
switch (this.direction) {
|
|
702
1100
|
case 'vertical':
|
|
@@ -708,21 +1106,26 @@ class OasysAlertComponent {
|
|
|
708
1106
|
}
|
|
709
1107
|
}
|
|
710
1108
|
}
|
|
1109
|
+
/** @ignore */
|
|
711
1110
|
get buttonSize() {
|
|
712
1111
|
return this.breakpointService.currentSize.value === Breakpoint.MOBILE
|
|
713
1112
|
? 'small'
|
|
714
1113
|
: this.button_size;
|
|
715
1114
|
}
|
|
1115
|
+
/** @ignore */
|
|
716
1116
|
cancelled() {
|
|
717
1117
|
this.cancel.emit();
|
|
718
1118
|
}
|
|
1119
|
+
/** @ignore */
|
|
719
1120
|
confirmed() {
|
|
720
1121
|
this.confirm.emit();
|
|
721
1122
|
}
|
|
1123
|
+
/** @ignore */
|
|
722
1124
|
ngAfterViewInit() {
|
|
723
1125
|
this.ariaLiveElement = this.alertHost?.nativeElement;
|
|
724
1126
|
this.checkVisibilityAndFocus();
|
|
725
1127
|
}
|
|
1128
|
+
/** @ignore */
|
|
726
1129
|
ngAfterContentChecked() {
|
|
727
1130
|
this.checkVisibilityAndFocus();
|
|
728
1131
|
}
|
|
@@ -847,9 +1250,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
847
1250
|
}]
|
|
848
1251
|
}] });
|
|
849
1252
|
|
|
1253
|
+
/**
|
|
1254
|
+
* A breadcrumb trail (`<ui-breadcrumbs>`) showing where the current page sits in
|
|
1255
|
+
* the site hierarchy, with a link back to each ancestor. Use it near the top of
|
|
1256
|
+
* content pages such as help-centre articles and category pages. Don't use it
|
|
1257
|
+
* for step-by-step flows like checkout.
|
|
1258
|
+
*
|
|
1259
|
+
* Pass the whole trail, root first and current page last, to
|
|
1260
|
+
* `breadcrumbs_values`. Each item renders as a small tertiary `<ui-button>`
|
|
1261
|
+
* link with a chevron between items, inside a `<nav>` landmark on a
|
|
1262
|
+
* `core-secondary` full-width bar. Items wrap onto more lines when space runs
|
|
1263
|
+
* out. The bar's background and padding are fixed; place the component inside
|
|
1264
|
+
* a `<ui-container>` to line it up with the page content.
|
|
1265
|
+
*
|
|
1266
|
+
* Every item, including the last (current page), is rendered as a link, so
|
|
1267
|
+
* give the last item the current page's URL.
|
|
1268
|
+
*
|
|
1269
|
+
* @import import { OasysBreadcrumbsComponent } from 'oasys-lib';
|
|
1270
|
+
* @knownIssue `breadcrumbs_values` is only read once, when the component
|
|
1271
|
+
* initialises: changing it afterwards does not update the trail. Workaround:
|
|
1272
|
+
* have the final trail ready before rendering (for example inside an `@if`),
|
|
1273
|
+
* or re-create the component when the trail changes.
|
|
1274
|
+
* @knownIssue An empty array still renders an empty coloured bar and an empty
|
|
1275
|
+
* `<nav>` landmark. Workaround: wrap the component in
|
|
1276
|
+
* `@if (trail.length > 0)`.
|
|
1277
|
+
* @knownIssue Screen readers are not told which item is the current page:
|
|
1278
|
+
* `aria-current` is set to the item's name on the `<ui-button>` wrapper
|
|
1279
|
+
* instead of `aria-current="page"` on the link. Workaround: none in consumer
|
|
1280
|
+
* code; make sure the last item's name matches the page's `<h1>`.
|
|
1281
|
+
* @knownIssue The landmark label is hard-coded in English
|
|
1282
|
+
* (`aria-label="breadcrumbs"`) on every locale. Workaround: none in consumer
|
|
1283
|
+
* code.
|
|
1284
|
+
*/
|
|
850
1285
|
class BreadcrumbsComponent {
|
|
1286
|
+
/**
|
|
1287
|
+
* The trail, root first and current page last, as an array of
|
|
1288
|
+
* `{ href, name }` objects: `href` is the link URL and `name` the visible
|
|
1289
|
+
* label. Also accepts the same array as a JSON string, for markup rendered
|
|
1290
|
+
* from CMS content where attributes can only be strings; invalid JSON
|
|
1291
|
+
* throws. Read once on init (see Known issues).
|
|
1292
|
+
*/
|
|
851
1293
|
breadcrumbs_values;
|
|
1294
|
+
/** @ignore */
|
|
852
1295
|
values;
|
|
1296
|
+
/** @ignore */
|
|
853
1297
|
ngOnInit() {
|
|
854
1298
|
if (typeof this.breadcrumbs_values === 'string') {
|
|
855
1299
|
this.values = JSON.parse(this.breadcrumbs_values) ?? [];
|
|
@@ -998,39 +1442,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
998
1442
|
}]
|
|
999
1443
|
}] });
|
|
1000
1444
|
|
|
1445
|
+
// TODO - migrate inputs to InputSignals when Angular supports it within angular 19.
|
|
1446
|
+
// Issue - https://github.com/angular/angular/issues/53981
|
|
1001
1447
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1448
|
+
* A responsive image (`<ui-image>`). Use it for every content image (product
|
|
1449
|
+
* shots, banners, editorial images) instead of a bare `<img>`, so images get a
|
|
1450
|
+
* CDN `srcset`, lazy loading and reserved space by default.
|
|
1451
|
+
*
|
|
1452
|
+
* Renders a `<picture>` with a WebP `<source srcset>` and an `<img>` fallback.
|
|
1453
|
+
* The host is a block that fills its container's width; height follows the
|
|
1454
|
+
* image unless `image_fill` is set.
|
|
1004
1455
|
*
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
1456
|
+
* Requires `IMAGE_URL_PROVIDER` from the consuming app: its
|
|
1457
|
+
* `generateImageUrl(src, breakpoints, fallbackBreakpoint)` returns the WebP
|
|
1458
|
+
* `srcSetUrls` and a `fallbackUrl` for your image CDN. Without it the component
|
|
1459
|
+
* throws a `NullInjectorError`. Breakpoint widths come from
|
|
1460
|
+
* `IMAGE_BREAKPOINTS`, which you can override.
|
|
1461
|
+
*
|
|
1462
|
+
* Accessibility: images are decorative by default (`alt=""` and
|
|
1463
|
+
* `role="presentation"`). Set `image_alt_text` whenever the image conveys
|
|
1464
|
+
* something the surrounding text does not, for example a product photo with
|
|
1465
|
+
* no visible product name. Use the W3C alt decision tree when unsure:
|
|
1466
|
+
* https://www.w3.org/WAI/tutorials/images/decision-tree/
|
|
1467
|
+
*
|
|
1468
|
+
* Performance (Core Web Vitals):
|
|
1469
|
+
* - Set `preload_aspect_ratio` so space is reserved before the image loads
|
|
1470
|
+
* (prevents layout shift).
|
|
1471
|
+
* - Images lazy-load by default. For the largest image in the first viewport
|
|
1472
|
+
* (the LCP image, such as a hero or the first product), set
|
|
1473
|
+
* `fetchpriority="high"`, which also loads it eagerly. Use it on one or two
|
|
1474
|
+
* images per page at most.
|
|
1475
|
+
* - Tell the browser how wide the image renders with `image_width` (fixed
|
|
1476
|
+
* pixel width) or `image_sizes` (a `sizes` value), so it downloads the right
|
|
1477
|
+
* file. Without either it assumes full viewport width (`100vw`).
|
|
1478
|
+
*
|
|
1479
|
+
* @import import { OasysImageComponent } from 'oasys-lib';
|
|
1007
1480
|
*/
|
|
1008
1481
|
class ImageComponent {
|
|
1482
|
+
/** Source image URL or path. Passed to `IMAGE_URL_PROVIDER` to build the `srcset`. */
|
|
1009
1483
|
image_src;
|
|
1010
|
-
|
|
1484
|
+
/**
|
|
1485
|
+
* Alternative text. Leave empty (the default) for decorative images, which
|
|
1486
|
+
* are then hidden from assistive technology. Set it when the image conveys
|
|
1487
|
+
* information; describe what matters in context, not "image of".
|
|
1488
|
+
*/
|
|
1489
|
+
image_alt_text = '';
|
|
1490
|
+
/**
|
|
1491
|
+
* `id` of an element that describes the image in more detail, such as a
|
|
1492
|
+
* caption. Sets `aria-describedby` on the `<img>`.
|
|
1493
|
+
*/
|
|
1011
1494
|
image_aria_describedby = null;
|
|
1495
|
+
/**
|
|
1496
|
+
* Fill the parent's width and height, cropping with `object-fit: cover`. The
|
|
1497
|
+
* parent must have a height. Use for background-style and fixed-size tiles.
|
|
1498
|
+
*/
|
|
1012
1499
|
image_fill = false;
|
|
1500
|
+
/**
|
|
1501
|
+
* Download priority hint. Use `high` for the LCP image only (it also forces
|
|
1502
|
+
* eager loading), `low` for images that matter least, such as later carousel
|
|
1503
|
+
* slides.
|
|
1504
|
+
*/
|
|
1013
1505
|
fetchpriority = 'auto';
|
|
1506
|
+
/**
|
|
1507
|
+
* Native `loading`. Keep `lazy` for images below the fold. Ignored when
|
|
1508
|
+
* `fetchpriority` is `high`, which always loads eagerly.
|
|
1509
|
+
*/
|
|
1014
1510
|
loading = 'lazy';
|
|
1511
|
+
/**
|
|
1512
|
+
* Intrinsic aspect ratio (width:height). Sets `width`/`height` and
|
|
1513
|
+
* `aspect-ratio` on the `<img>` so space is reserved before it loads,
|
|
1514
|
+
* avoiding layout shift. Strongly recommended; match the image's real ratio.
|
|
1515
|
+
*/
|
|
1015
1516
|
preload_aspect_ratio = null;
|
|
1016
|
-
|
|
1017
|
-
|
|
1517
|
+
/**
|
|
1518
|
+
* Rendered width in px, when it is fixed and known. Sets `sizes` to that
|
|
1519
|
+
* width so the browser picks a smaller file. It does not size the element.
|
|
1520
|
+
*/
|
|
1521
|
+
image_width = null;
|
|
1522
|
+
/**
|
|
1523
|
+
* `sizes` value used when `image_width` is not set, for example
|
|
1524
|
+
* `"(min-width: 768px) 50vw, 100vw"`. Defaults to `100vw`.
|
|
1525
|
+
*/
|
|
1526
|
+
image_sizes = null;
|
|
1527
|
+
/** Emitted when the `<img>` finishes loading. */
|
|
1018
1528
|
image_loaded = new EventEmitter();
|
|
1019
1529
|
imageUrlProvider = inject(IMAGE_URL_PROVIDER);
|
|
1530
|
+
/** @ignore */
|
|
1020
1531
|
image = signal(null, ...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
|
|
1021
1532
|
breakpoints = inject(IMAGE_BREAKPOINTS);
|
|
1022
1533
|
fallbackBreakpoint = 768;
|
|
1534
|
+
/** @ignore */
|
|
1023
1535
|
get class() {
|
|
1024
1536
|
return this.image_fill ? 'imageFill' : '';
|
|
1025
1537
|
}
|
|
1026
1538
|
/**
|
|
1027
1539
|
* On init lifecycle hook to create the image.
|
|
1540
|
+
* @ignore
|
|
1028
1541
|
*/
|
|
1029
1542
|
ngOnInit() {
|
|
1030
1543
|
this.createImage();
|
|
1031
1544
|
}
|
|
1032
1545
|
/**
|
|
1033
1546
|
* On changes, handle any changes in input properties.
|
|
1547
|
+
* @ignore
|
|
1034
1548
|
*/
|
|
1035
1549
|
ngOnChanges(changes) {
|
|
1036
1550
|
const hasSubsequentChange = Object.values(changes).some((change) => !change.firstChange);
|
|
@@ -1040,6 +1554,7 @@ class ImageComponent {
|
|
|
1040
1554
|
}
|
|
1041
1555
|
/**
|
|
1042
1556
|
* Creates the image object with the provided properties.
|
|
1557
|
+
* @ignore
|
|
1043
1558
|
*/
|
|
1044
1559
|
createImage() {
|
|
1045
1560
|
const ratios = this.preload_aspect_ratio?.split(':');
|
|
@@ -1101,17 +1616,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1101
1616
|
args: ['class']
|
|
1102
1617
|
}] } });
|
|
1103
1618
|
|
|
1619
|
+
/**
|
|
1620
|
+
* A static content card (`<ui-card>`) for editorial and category content: an
|
|
1621
|
+
* image on top, then an optional highlight label that overlaps the bottom edge
|
|
1622
|
+
* of the image, a pair of small meta texts, and up to two lines of copy. Every
|
|
1623
|
+
* text slot is optional and only renders when set.
|
|
1624
|
+
*
|
|
1625
|
+
* Use it for blog listings, category tiles and carousels of editorial content.
|
|
1626
|
+
* It is not a product card: it has no price, CTA, output or selection state.
|
|
1627
|
+
* For a selectable card use `<ui-select-card>`; for a marketing tile with a
|
|
1628
|
+
* CTA use `<ui-promo-card>`.
|
|
1629
|
+
*
|
|
1630
|
+
* - The card is not interactive. To make it a link, wrap it in an `<a>` whose
|
|
1631
|
+
* accessible name makes sense on its own (the link text is all the card's
|
|
1632
|
+
* text plus the image alt text).
|
|
1633
|
+
* - The card fills the width of its parent; size it with a grid column or
|
|
1634
|
+
* wrapper.
|
|
1635
|
+
* - No text slot is a heading except the label (see known issues). If the card
|
|
1636
|
+
* needs a heading for the page outline, put it in the surrounding markup.
|
|
1637
|
+
* - `alt_text` defaults to `''` (decorative). Set it only when the image adds
|
|
1638
|
+
* information the text does not already give.
|
|
1639
|
+
* - Image aspect ratios come from the `--oasys-component-card-aspect-ratio-*`
|
|
1640
|
+
* tokens, so they can differ per brand.
|
|
1641
|
+
*
|
|
1642
|
+
* Requires an `IMAGE_URL_PROVIDER` (for the inner `<ui-image>`).
|
|
1643
|
+
*
|
|
1644
|
+
* @import import { OasysCardComponent } from 'oasys-lib';
|
|
1645
|
+
* @knownIssue `label_text` renders as an `<h5>`, so every labelled card adds an
|
|
1646
|
+
* out-of-sequence heading to the page outline. Workaround: only use
|
|
1647
|
+
* `label_text` where an extra h5 is acceptable (for example a grid of category
|
|
1648
|
+
* cards under an h4), otherwise leave it unset and show the label in
|
|
1649
|
+
* surrounding markup.
|
|
1650
|
+
*/
|
|
1104
1651
|
class CardComponent {
|
|
1105
1652
|
tokenService = inject(TokenService);
|
|
1653
|
+
/**
|
|
1654
|
+
* Short highlight label (for example a category name) shown on a tinted
|
|
1655
|
+
* pill that overlaps the bottom edge of the image. Hidden when unset; an
|
|
1656
|
+
* empty string still renders an empty pill.
|
|
1657
|
+
*/
|
|
1106
1658
|
label_text = input(...(ngDevMode ? [undefined, { debugName: "label_text" }] : /* istanbul ignore next */ []));
|
|
1659
|
+
/** Image URL, passed to `<ui-image>` (and so through the app's `IMAGE_URL_PROVIDER`). */
|
|
1107
1660
|
image = input('', ...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
|
|
1661
|
+
/**
|
|
1662
|
+
* Alt text for the image. Leave as `''` for decorative images, which is
|
|
1663
|
+
* usually right when the card text already describes the content.
|
|
1664
|
+
*/
|
|
1108
1665
|
alt_text = input('', ...(ngDevMode ? [{ debugName: "alt_text" }] : /* istanbul ignore next */ []));
|
|
1666
|
+
/** Image aspect ratio. Unset behaves like `portrait`. */
|
|
1109
1667
|
image_format = input(...(ngDevMode ? [undefined, { debugName: "image_format" }] : /* istanbul ignore next */ []));
|
|
1668
|
+
/** Small supporting text on the left of the meta row, such as a category or tags. */
|
|
1110
1669
|
small_title_left = input(...(ngDevMode ? [undefined, { debugName: "small_title_left" }] : /* istanbul ignore next */ []));
|
|
1670
|
+
/** Small supporting text on the right of the meta row, such as a published date. */
|
|
1111
1671
|
small_sub_title_right = input(...(ngDevMode ? [undefined, { debugName: "small_sub_title_right" }] : /* istanbul ignore next */ []));
|
|
1672
|
+
/** Centred body copy, such as a short category description. */
|
|
1112
1673
|
standard_content = input(...(ngDevMode ? [undefined, { debugName: "standard_content" }] : /* istanbul ignore next */ []));
|
|
1674
|
+
/** Emphasised copy, typically the title of a blog post. Rendered as a `<p>`, not a heading. */
|
|
1113
1675
|
bold_content = input(...(ngDevMode ? [undefined, { debugName: "bold_content" }] : /* istanbul ignore next */ []));
|
|
1676
|
+
/**
|
|
1677
|
+
* Drop the card's `core-primary` background so it blends into a coloured
|
|
1678
|
+
* section.
|
|
1679
|
+
*/
|
|
1114
1680
|
transparent_background = input(false, ...(ngDevMode ? [{ debugName: "transparent_background" }] : /* istanbul ignore next */ []));
|
|
1681
|
+
/** @ignore */
|
|
1115
1682
|
aspectRatio = computed(() => {
|
|
1116
1683
|
switch (this.image_format()) {
|
|
1117
1684
|
case 'square':
|
|
@@ -1124,7 +1691,9 @@ class CardComponent {
|
|
|
1124
1691
|
return this.tokenService.getTokenValue('--oasys-component-card-aspect-ratio-portrait');
|
|
1125
1692
|
}
|
|
1126
1693
|
}, ...(ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []));
|
|
1694
|
+
/** @ignore */
|
|
1127
1695
|
imageLabel = viewChild('imagelabel', { ...(ngDevMode ? { debugName: "imageLabel" } : /* istanbul ignore next */ {}), read: (ElementRef) });
|
|
1696
|
+
/** @ignore */
|
|
1128
1697
|
stackOffset = signal('0px', ...(ngDevMode ? [{ debugName: "stackOffset" }] : /* istanbul ignore next */ []));
|
|
1129
1698
|
constructor() {
|
|
1130
1699
|
const spacingTightSize = this.tokenService.getTokenValue('--oasys-spacing-tight');
|
|
@@ -1175,8 +1744,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1175
1744
|
}]
|
|
1176
1745
|
}] });
|
|
1177
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* A full-width horizontal rule (`<ui-divider>`) that separates sections of
|
|
1749
|
+
* content, such as rows in a summary or groups of options in a form.
|
|
1750
|
+
*
|
|
1751
|
+
* - `secondary` (default) is a thin hairline for separating related items.
|
|
1752
|
+
* - `primary` is a thick band for separating major sections.
|
|
1753
|
+
*
|
|
1754
|
+
* It always fills the width of its container, so control its length and the
|
|
1755
|
+
* space around it from the parent (for example a `<ui-stack>` gap or
|
|
1756
|
+
* `<ui-box>` padding). It takes no content.
|
|
1757
|
+
*
|
|
1758
|
+
* Accessibility: the divider is purely visual. It renders no `<hr>` and no
|
|
1759
|
+
* `role="separator"`, so screen readers do not announce it. Don't rely on it
|
|
1760
|
+
* to convey structure; use headings or lists for that.
|
|
1761
|
+
*
|
|
1762
|
+
* Don't stack a divider between two bordered `<ui-box>`es to fake a single
|
|
1763
|
+
* card: use one outer box with the border instead.
|
|
1764
|
+
*
|
|
1765
|
+
* @import import { OasysDividerComponent } from 'oasys-lib';
|
|
1766
|
+
*/
|
|
1178
1767
|
class DividerComponent {
|
|
1768
|
+
/**
|
|
1769
|
+
* Visual weight. `secondary` is a thin hairline between related items;
|
|
1770
|
+
* `primary` is a thick band between major sections.
|
|
1771
|
+
*/
|
|
1179
1772
|
divider_type = 'secondary';
|
|
1773
|
+
/** @ignore */
|
|
1180
1774
|
getClass() {
|
|
1181
1775
|
return this.divider_type === 'secondary'
|
|
1182
1776
|
? `ui-divider--type-${this.divider_type}`
|
|
@@ -1206,19 +1800,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1206
1800
|
}]
|
|
1207
1801
|
}] });
|
|
1208
1802
|
|
|
1803
|
+
/**
|
|
1804
|
+
* Groups related form controls under a caption (`<ui-form-group>`). Renders a
|
|
1805
|
+
* `<fieldset>` with a `<legend>` and stacks the projected controls with `near`
|
|
1806
|
+
* spacing.
|
|
1807
|
+
*
|
|
1808
|
+
* Use it whenever several controls answer one question or belong together:
|
|
1809
|
+
* always for a set of radios or checkboxes (the legend is the question, e.g.
|
|
1810
|
+
* "Delivery options"), and for blocks of text inputs such as an address.
|
|
1811
|
+
* Screen readers announce the legend when focus enters the group, so keep it
|
|
1812
|
+
* short.
|
|
1813
|
+
*
|
|
1814
|
+
* `group_title` is required. If the surrounding page already shows a visible
|
|
1815
|
+
* heading for the group, set `[group_title_hidden]="true"`: the legend is then
|
|
1816
|
+
* visually hidden but still announced. Do not leave it empty: it falls back to
|
|
1817
|
+
* "Untitled Form Group".
|
|
1818
|
+
*
|
|
1819
|
+
* `group_type` only changes the legend's text style: `primary` for a main
|
|
1820
|
+
* question, `secondary` for a smaller sub-group. Match it to the
|
|
1821
|
+
* `radio_type` / `checkbox_type` of the controls inside.
|
|
1822
|
+
*
|
|
1823
|
+
* @import import { OasysFormGroupComponent } from 'oasys-lib';
|
|
1824
|
+
* @knownIssue Every `<ui-form-group>` logs a console warning that
|
|
1825
|
+
* "group_title" is required, even when it is set. Workaround: ignore the
|
|
1826
|
+
* warning when `group_title` is set to non-empty text.
|
|
1827
|
+
*/
|
|
1209
1828
|
class FormGroupComponent {
|
|
1210
|
-
|
|
1829
|
+
/** Caption rendered in the `<legend>`: the group's accessible name. Phrase it as the question or topic ("Delivery options", "Recipient's address"). Empty text falls back to "Untitled Form Group". */
|
|
1211
1830
|
group_title = input.required(...(ngDevMode ? [{ debugName: "group_title" }] : /* istanbul ignore next */ []));
|
|
1212
|
-
|
|
1831
|
+
/** Visually hide the legend but keep it announced to screen readers. Use when a visible heading already introduces the group. */
|
|
1213
1832
|
group_title_hidden = input(false, ...(ngDevMode ? [{ debugName: "group_title_hidden" }] : /* istanbul ignore next */ []));
|
|
1214
|
-
|
|
1833
|
+
/** Legend text style only (no effect on semantics): `primary` for a main question, `secondary` for a sub-group. */
|
|
1215
1834
|
group_type = input('primary', ...(ngDevMode ? [{ debugName: "group_type" }] : /* istanbul ignore next */ []));
|
|
1216
|
-
|
|
1835
|
+
/** Replaces what screen readers announce for the group (set as `aria-label` on the `<legend>`). Rarely needed: only when the visible title needs more context when read out. */
|
|
1217
1836
|
ariaLabel = input(...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1218
1837
|
// Trim the title and fall back to a placeholder when empty; computed so the warn only re-fires when the input changes.
|
|
1838
|
+
/** @ignore */
|
|
1219
1839
|
resolvedTitle = computed(() => this.group_title() ? this.group_title().trim() : this.FALLBACK_TITLE, ...(ngDevMode ? [{ debugName: "resolvedTitle" }] : /* istanbul ignore next */ []));
|
|
1220
1840
|
hasWarnedMissingTitle = signal(false, ...(ngDevMode ? [{ debugName: "hasWarnedMissingTitle" }] : /* istanbul ignore next */ []));
|
|
1221
1841
|
FALLBACK_TITLE = 'Untitled Form Group';
|
|
1842
|
+
/** @ignore */
|
|
1222
1843
|
ngOnChanges() {
|
|
1223
1844
|
if (!this.hasWarnedMissingTitle()) {
|
|
1224
1845
|
this.hasWarnedMissingTitle = signal(true, ...(ngDevMode ? [{ debugName: "hasWarnedMissingTitle" }] : /* istanbul ignore next */ []));
|
|
@@ -1266,38 +1887,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1266
1887
|
args: [{ providedIn: 'root' }]
|
|
1267
1888
|
}] });
|
|
1268
1889
|
|
|
1890
|
+
/**
|
|
1891
|
+
* The Oasys checkbox (`<ui-checkbox>`). Use it for an on/off choice (such as a
|
|
1892
|
+
* marketing opt-in) or for picking any number of options from a list. For one
|
|
1893
|
+
* choice from a list, use `<ui-radio>` or a radio `<ui-chip>`; for a
|
|
1894
|
+
* stand-alone toggle button, use `<ui-button aria_role="switch">`.
|
|
1895
|
+
*
|
|
1896
|
+
* Renders a native `<input type="checkbox">` with a `<label>` holding `label`.
|
|
1897
|
+
* Projected content:
|
|
1898
|
+
* - default slot: hint text shown under the label. It sits inside the
|
|
1899
|
+
* `<label>`, so it is read as part of the checkbox's name; keep it short.
|
|
1900
|
+
* - `[tertiary-content]`: extra content on the label line, such as a price.
|
|
1901
|
+
*
|
|
1902
|
+
* Works with Angular forms (`formControlName`, `formControl`, `ngModel`); the
|
|
1903
|
+
* value is a boolean. Without forms, use `[(checked)]` or `didChange`.
|
|
1904
|
+
*
|
|
1905
|
+
* Accessibility:
|
|
1906
|
+
* - `label` is required and is the accessible name; make it describe the choice.
|
|
1907
|
+
* - Wrap related checkboxes in `<ui-form-group>` so they sit in a
|
|
1908
|
+
* `<fieldset>` whose `<legend>` (`group_title`) asks the question. Do not add
|
|
1909
|
+
* `role="checkboxgroup"`: it is not an ARIA role.
|
|
1910
|
+
* - Set `ariaDescribedBy` to the id of an element that explains the checkbox
|
|
1911
|
+
* (for example an error message outside the component).
|
|
1912
|
+
*
|
|
1913
|
+
* Validation: `required` only sets the native attribute, which drives the
|
|
1914
|
+
* error styling (red label and box once touched and unchecked). It does not
|
|
1915
|
+
* validate your form control: add `Validators.requiredTrue` as well.
|
|
1916
|
+
*
|
|
1917
|
+
* @import import { OasysCheckboxComponent } from 'oasys-lib';
|
|
1918
|
+
* @knownIssue Disabling the form control (`control.disable()` or
|
|
1919
|
+
* `new FormControl({ value: false, disabled: true })`) does not disable the
|
|
1920
|
+
* checkbox, because the component does not implement `setDisabledState`.
|
|
1921
|
+
* Workaround: also bind `[disabled]` to the control's disabled state (Angular
|
|
1922
|
+
* logs a dev-mode warning about `disabled` on a reactive form directive; it is
|
|
1923
|
+
* safe to ignore here).
|
|
1924
|
+
*/
|
|
1269
1925
|
class CheckboxComponent {
|
|
1270
1926
|
tokenService = inject(TokenService);
|
|
1271
1927
|
idGenerator = inject(IdGeneratorService);
|
|
1928
|
+
/**
|
|
1929
|
+
* `primary` is a bordered, tappable tile with body-size text, for choices
|
|
1930
|
+
* that are the main content of a step. `secondary` is a compact inline
|
|
1931
|
+
* checkbox with supporting-size text, for consents and opt-ins.
|
|
1932
|
+
*/
|
|
1272
1933
|
checkbox_type = input('primary', ...(ngDevMode ? [{ debugName: "checkbox_type" }] : /* istanbul ignore next */ []));
|
|
1934
|
+
/** Visible label and accessible name. Describe the choice, not the action. */
|
|
1273
1935
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1936
|
+
/**
|
|
1937
|
+
* Sets the native `required` attribute, which drives the error styling once
|
|
1938
|
+
* the checkbox is touched and unchecked. Also add `Validators.requiredTrue` to
|
|
1939
|
+
* your form control: this input does not validate it.
|
|
1940
|
+
*/
|
|
1274
1941
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
1942
|
+
/**
|
|
1943
|
+
* Disables the checkbox. Bind it even when using reactive forms: disabling the
|
|
1944
|
+
* form control alone does not disable the checkbox.
|
|
1945
|
+
*/
|
|
1275
1946
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1947
|
+
/**
|
|
1948
|
+
* Id of an element that describes the checkbox, such as an error message.
|
|
1949
|
+
* Becomes the input's `aria-describedby`.
|
|
1950
|
+
*/
|
|
1276
1951
|
ariaDescribedBy = input(...(ngDevMode ? [undefined, { debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []));
|
|
1277
|
-
|
|
1952
|
+
/**
|
|
1953
|
+
* Hides the tick box so the whole label acts as the control. Used by
|
|
1954
|
+
* `<ui-chip>`; prefer a checkbox chip over setting this directly.
|
|
1955
|
+
*/
|
|
1278
1956
|
hide_checkbox = input(false, ...(ngDevMode ? [{ debugName: "hide_checkbox" }] : /* istanbul ignore next */ []));
|
|
1957
|
+
/** Icon shown before the label. Only shown when `hide_checkbox` is `true`. */
|
|
1279
1958
|
iconName = input(...(ngDevMode ? [undefined, { debugName: "iconName" }] : /* istanbul ignore next */ []));
|
|
1280
1959
|
// Two-way: `[checked]`, `[(checked)]`, and CVA writeValue all need to drive
|
|
1281
1960
|
// this single source of truth.
|
|
1961
|
+
/**
|
|
1962
|
+
* Checked state. Supports two-way binding with `[(checked)]`. With Angular
|
|
1963
|
+
* forms, set the form control's value instead.
|
|
1964
|
+
*/
|
|
1282
1965
|
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
1966
|
+
/** Emits the new checked state when the user toggles the checkbox. */
|
|
1283
1967
|
didChange = output();
|
|
1968
|
+
/** @ignore */
|
|
1284
1969
|
id = signal(this.idGenerator.generateId('checkbox'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1970
|
+
/** @ignore */
|
|
1285
1971
|
iconSize = signal('', ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
1972
|
+
/** @ignore */
|
|
1286
1973
|
hint = computed(() => (this.ariaDescribedBy() ? this.ariaDescribedBy() : this.label()), ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1974
|
+
/** @ignore */
|
|
1287
1975
|
ngOnInit() {
|
|
1288
1976
|
this.iconSize.set(this.tokenService.getTokenValue(`--oasys-component-checkbox-icon-size-${this.checkbox_type()}`));
|
|
1289
1977
|
}
|
|
1978
|
+
/** @ignore */
|
|
1290
1979
|
onChange = () => undefined;
|
|
1980
|
+
/** @ignore */
|
|
1291
1981
|
onTouched = () => undefined;
|
|
1982
|
+
/** @ignore */
|
|
1292
1983
|
writeValue(checked) {
|
|
1293
1984
|
this.checked.set(checked);
|
|
1294
1985
|
}
|
|
1986
|
+
/** @ignore */
|
|
1295
1987
|
registerOnChange(fn) {
|
|
1296
1988
|
this.onChange = fn;
|
|
1297
1989
|
}
|
|
1990
|
+
/** @ignore */
|
|
1298
1991
|
registerOnTouched(fn) {
|
|
1299
1992
|
this.onTouched = fn;
|
|
1300
1993
|
}
|
|
1994
|
+
/** @ignore */
|
|
1301
1995
|
onModelChange(event) {
|
|
1302
1996
|
this.checked.set(event);
|
|
1303
1997
|
this.onChange(event);
|
|
@@ -1340,43 +2034,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1340
2034
|
}]
|
|
1341
2035
|
}] });
|
|
1342
2036
|
|
|
2037
|
+
/**
|
|
2038
|
+
* The Oasys radio button (`<ui-radio>`). Use a set of radios for picking
|
|
2039
|
+
* exactly one option from a short list that should stay visible, such as
|
|
2040
|
+
* delivery or email-frequency choices. For many options, use
|
|
2041
|
+
* `<ui-combobox>`; for compact pill-style choices, use a radio `<ui-chip>`.
|
|
2042
|
+
*
|
|
2043
|
+
* Each `<ui-radio>` is one option. Renders a native `<input type="radio">`
|
|
2044
|
+
* with a `<label>` holding `label`. Projected content:
|
|
2045
|
+
* - default slot: hint text shown under the label, inside the `<label>`.
|
|
2046
|
+
* - `[tertiary-content]`: extra content on the label line, such as a price.
|
|
2047
|
+
*
|
|
2048
|
+
* Grouping: give every radio in a set the same `name` and its own `value`, and
|
|
2049
|
+
* wrap the set in `<ui-form-group>` so it sits in a `<fieldset>` whose
|
|
2050
|
+
* `<legend>` (`group_title`) asks the question.
|
|
2051
|
+
*
|
|
2052
|
+
* Forms: bind every radio in the set to the same control
|
|
2053
|
+
* (`formControlName="delivery"` on each). The control value is the `value`
|
|
2054
|
+
* of the selected radio, as a string.
|
|
2055
|
+
*
|
|
2056
|
+
* Keyboard: arrow keys move focus between enabled radios with the same `name`
|
|
2057
|
+
* (wrapping at the ends) without selecting; Space selects. Tab and Shift+Tab
|
|
2058
|
+
* also step through the radios, leaving the set at the first and last one.
|
|
2059
|
+
*
|
|
2060
|
+
* @import import { OasysRadioComponent } from 'oasys-lib';
|
|
2061
|
+
* @knownIssue `name` defaults to the same value (`testname`) for every radio,
|
|
2062
|
+
* so radios without a `name` all join one native group across the page:
|
|
2063
|
+
* selecting in one set clears the others, and arrow keys move between sets.
|
|
2064
|
+
* Workaround: always give each set its own `name`.
|
|
2065
|
+
* @knownIssue `[checked]="true"` does not check the radio: the radio's
|
|
2066
|
+
* internal `ngModel` overwrites it on init. Workaround: bind the set to a form
|
|
2067
|
+
* control (`formControlName`, `formControl`, or `[ngModel]` on every radio)
|
|
2068
|
+
* and set that to the radio's `value`.
|
|
2069
|
+
* @knownIssue Disabling the form control (`control.disable()` or
|
|
2070
|
+
* `new FormControl({ value: '', disabled: true })`) does not disable the
|
|
2071
|
+
* radios, because the component does not implement `setDisabledState`.
|
|
2072
|
+
* Workaround: also bind `[disabled]` on each radio (Angular logs a dev-mode
|
|
2073
|
+
* warning about `disabled` on a reactive form directive; it is safe to ignore
|
|
2074
|
+
* here).
|
|
2075
|
+
*/
|
|
1343
2076
|
class RadioComponent {
|
|
1344
2077
|
NAV_KEYS = new Set(['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft']);
|
|
1345
2078
|
FORWARD_KEYS = new Set(['ArrowDown', 'ArrowRight']);
|
|
1346
2079
|
idGenerator = inject(IdGeneratorService);
|
|
1347
2080
|
document = inject(DOCUMENT$1);
|
|
2081
|
+
/**
|
|
2082
|
+
* `primary` is a bordered, tappable tile with body-size text. `secondary` is
|
|
2083
|
+
* a compact inline radio with supporting-size text. Use the same type for
|
|
2084
|
+
* every radio in a set.
|
|
2085
|
+
*/
|
|
1348
2086
|
radio_type = input('primary', ...(ngDevMode ? [{ debugName: "radio_type" }] : /* istanbul ignore next */ []));
|
|
2087
|
+
/** Visible label and accessible name of this option. */
|
|
1349
2088
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2089
|
+
/**
|
|
2090
|
+
* Native group name. Give every radio in a set the same `name`, unique on the
|
|
2091
|
+
* page: it groups the radios for selection and for arrow-key navigation.
|
|
2092
|
+
*/
|
|
1350
2093
|
name = input('testname', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2094
|
+
/**
|
|
2095
|
+
* Meant to check this radio without Angular forms, but it has no effect (see
|
|
2096
|
+
* Known issues). Set the value of a form control or `ngModel` instead.
|
|
2097
|
+
*/
|
|
1351
2098
|
checked = input(...(ngDevMode ? [undefined, { debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
2099
|
+
/**
|
|
2100
|
+
* Disables this radio; arrow keys skip it. Bind it even when using reactive
|
|
2101
|
+
* forms: disabling the form control alone does not disable the radio.
|
|
2102
|
+
*/
|
|
1352
2103
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2104
|
+
/**
|
|
2105
|
+
* Id given to the hint under the label, which the input references with
|
|
2106
|
+
* `aria-describedby`. Set a unique id when you project hint text. Unlike
|
|
2107
|
+
* `<ui-checkbox>`, do not pass the id of another element: it would be
|
|
2108
|
+
* duplicated.
|
|
2109
|
+
*/
|
|
1353
2110
|
ariaDescribedBy = input(...(ngDevMode ? [undefined, { debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []));
|
|
1354
|
-
|
|
2111
|
+
/**
|
|
2112
|
+
* Hides the radio circle so the whole label acts as the control. Used by
|
|
2113
|
+
* `<ui-chip>`; prefer a radio chip over setting this directly.
|
|
2114
|
+
*/
|
|
1355
2115
|
hide_radio = input(false, ...(ngDevMode ? [{ debugName: "hide_radio" }] : /* istanbul ignore next */ []));
|
|
2116
|
+
/** Icon shown before the label. Only shown when `hide_radio` is `true`. */
|
|
1356
2117
|
iconName = input(...(ngDevMode ? [undefined, { debugName: "iconName" }] : /* istanbul ignore next */ []));
|
|
2118
|
+
/** Value this option gives the form control (or `didChange`) when selected. */
|
|
1357
2119
|
value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2120
|
+
/** Emits this radio's `value` when the user selects it. */
|
|
1358
2121
|
didChange = output();
|
|
2122
|
+
/** @ignore */
|
|
1359
2123
|
id = signal(this.idGenerator.generateId('radio'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2124
|
+
/** @ignore */
|
|
1360
2125
|
selectedValue = signal('', ...(ngDevMode ? [{ debugName: "selectedValue" }] : /* istanbul ignore next */ []));
|
|
1361
2126
|
// Stable id for the hint span so the input can reference it via aria-describedby.
|
|
1362
2127
|
// Browsers ignore aria-describedby pointing to empty/missing elements, so this is
|
|
1363
2128
|
// safe to set even when no hint is projected.
|
|
2129
|
+
/** @ignore */
|
|
1364
2130
|
hint = computed(() => (this.ariaDescribedBy() ? this.ariaDescribedBy() : this.label()), ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
2131
|
+
/** @ignore */
|
|
1365
2132
|
onChange = () => undefined;
|
|
2133
|
+
/** @ignore */
|
|
1366
2134
|
onTouched = () => undefined;
|
|
2135
|
+
/** @ignore */
|
|
1367
2136
|
selectOption() {
|
|
1368
2137
|
this.onChange(this.value());
|
|
1369
2138
|
this.onTouched();
|
|
1370
2139
|
}
|
|
2140
|
+
/** @ignore */
|
|
1371
2141
|
writeValue(value) {
|
|
1372
2142
|
this.selectedValue.set(value);
|
|
1373
2143
|
}
|
|
2144
|
+
/** @ignore */
|
|
1374
2145
|
registerOnChange(fn) {
|
|
1375
2146
|
this.onChange = fn;
|
|
1376
2147
|
}
|
|
2148
|
+
/** @ignore */
|
|
1377
2149
|
registerOnTouched(fn) {
|
|
1378
2150
|
this.onTouched = fn;
|
|
1379
2151
|
}
|
|
2152
|
+
/** @ignore */
|
|
1380
2153
|
onModelChange(event) {
|
|
1381
2154
|
this.value.set(event);
|
|
1382
2155
|
this.onChange(event);
|
|
@@ -1388,6 +2161,7 @@ class RadioComponent {
|
|
|
1388
2161
|
// Arrows wrap at the edges; Tab/Shift+Tab escape the group at the edges so the
|
|
1389
2162
|
// user can reach the next/previous focusable element on the page.
|
|
1390
2163
|
// Disabled siblings are skipped.
|
|
2164
|
+
/** @ignore */
|
|
1391
2165
|
onKeyDown(event) {
|
|
1392
2166
|
const isArrow = this.NAV_KEYS.has(event.key);
|
|
1393
2167
|
const isTab = event.key === 'Tab';
|
|
@@ -1454,12 +2228,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1454
2228
|
}]
|
|
1455
2229
|
}] });
|
|
1456
2230
|
|
|
2231
|
+
/**
|
|
2232
|
+
* Moves keyboard focus to the element shortly after it is created (`[autofocus]`
|
|
2233
|
+
* attribute). It focuses 500ms after init, so it also works for elements that
|
|
2234
|
+
* appear inside modals, drawers and steps that animate in, where the native
|
|
2235
|
+
* `autofocus` attribute may not apply.
|
|
2236
|
+
*
|
|
2237
|
+
* `<ui-text-input>` and `<ui-combobox>` already use it: prefer their own
|
|
2238
|
+
* `autofocus` input over adding this to an Oasys component yourself. Use the
|
|
2239
|
+
* directive directly on native focusable elements (`input`, `button`, `a`,
|
|
2240
|
+
* `textarea`, or anything with `tabindex`).
|
|
2241
|
+
*
|
|
2242
|
+
* Always bind a boolean: `[autofocus]="true"` or `[autofocus]="condition"`.
|
|
2243
|
+
* The selector matches the native attribute, so once the directive is imported,
|
|
2244
|
+
* a bare `autofocus` attribute is a template type error under strict templates.
|
|
2245
|
+
*
|
|
2246
|
+
* Accessibility: moving focus without the user asking can disorient screen
|
|
2247
|
+
* reader and keyboard users. Only autofocus the obvious first field of a
|
|
2248
|
+
* focused task (a modal, a single-field form), never on page load of a normal
|
|
2249
|
+
* page, and only one element per view.
|
|
2250
|
+
*
|
|
2251
|
+
* @import import { OasysAutofocusDirective } from 'oasys-lib';
|
|
2252
|
+
* @knownIssue The value is read once, when the element is created: changing it
|
|
2253
|
+
* from `false` to `true` later (for example to focus a field that has just
|
|
2254
|
+
* failed validation) does nothing. Workaround: create the element only when it
|
|
2255
|
+
* should take focus (wrap it in `@if`), or call `.focus()` on the element
|
|
2256
|
+
* yourself.
|
|
2257
|
+
*/
|
|
1457
2258
|
class OasysAutofocusDirective {
|
|
1458
2259
|
el = inject(ElementRef);
|
|
1459
2260
|
_autofocus;
|
|
2261
|
+
/**
|
|
2262
|
+
* Whether to focus the element 500ms after it is created. `true` or unset
|
|
2263
|
+
* focuses; `false` does not. Only the value at creation time counts.
|
|
2264
|
+
*/
|
|
1460
2265
|
set autofocus(condition) {
|
|
1461
2266
|
this._autofocus = condition;
|
|
1462
2267
|
}
|
|
2268
|
+
/** @ignore */
|
|
1463
2269
|
ngOnInit() {
|
|
1464
2270
|
if (this._autofocus || typeof this._autofocus === 'undefined') {
|
|
1465
2271
|
setTimeout(() => {
|
|
@@ -1480,39 +2286,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1480
2286
|
type: Input
|
|
1481
2287
|
}] } });
|
|
1482
2288
|
|
|
2289
|
+
/**
|
|
2290
|
+
* The Oasys single-line text field (`<ui-text-input>`), with a floating label,
|
|
2291
|
+
* optional hint and inline error. Use it for names, emails, phone numbers,
|
|
2292
|
+
* postcodes, passwords and other short free text. Use `<ui-textarea>` for
|
|
2293
|
+
* multi-line text and `<ui-combobox>` to pick from a list.
|
|
2294
|
+
*
|
|
2295
|
+
* It is a `ControlValueAccessor`: bind it with `formControlName` (or
|
|
2296
|
+
* `formControl` / `ngModel`) and put validation on the form control. It renders
|
|
2297
|
+
* a native `<input>` with a `<label for>` pointing at it, so `label` is required
|
|
2298
|
+
* and is the field's accessible name.
|
|
2299
|
+
*
|
|
2300
|
+
* Accessibility and form conventions:
|
|
2301
|
+
* - Fields are optional by default. Set `[optional]="false"` on required fields
|
|
2302
|
+
* so the input gets `aria-required="true"`. Nothing is shown visually, so
|
|
2303
|
+
* mark optional fields in the label text instead, e.g. "Company (optional)".
|
|
2304
|
+
* - Always set `autocomplete` for personal data (name, email, address, tel,
|
|
2305
|
+
* passwords) so browsers and password managers can fill it, and pick the
|
|
2306
|
+
* `type` / `inputmode` that brings up the right mobile keyboard.
|
|
2307
|
+
* - `hint` is linked to the input with `aria-describedby`. For
|
|
2308
|
+
* `type="password"` the hint only appears once the field is first focused.
|
|
2309
|
+
* - `type="password"` adds a Show/Hide toggle button. Pass translated
|
|
2310
|
+
* `show_password_*` / `hide_password_*` strings.
|
|
2311
|
+
* - `type="tel"` replaces the accessible name with the label, preface text and
|
|
2312
|
+
* the digits read one by one, unless you set `aria_label`.
|
|
2313
|
+
*
|
|
2314
|
+
* Errors: project a `<ui-form-errors>` as content. It is hidden until the
|
|
2315
|
+
* control is dirty and invalid and the user has left the field (blur) or
|
|
2316
|
+
* pressed Enter; it hides again while they type. Once shown it is linked to the
|
|
2317
|
+
* input with `aria-describedby`. It is not a live region, so pair a form with
|
|
2318
|
+
* `<ui-form-errors-summary>` to tell users about errors on submit.
|
|
2319
|
+
*
|
|
2320
|
+
* Project an element with the `preface` attribute to show a fixed prefix to
|
|
2321
|
+
* the left of the input (e.g. a country dial code).
|
|
2322
|
+
*
|
|
2323
|
+
* @import import { OasysTextInputComponent } from 'oasys-lib';
|
|
2324
|
+
* @knownIssue Disabling the form control (`control.disable()` or
|
|
2325
|
+
* `new FormControl({ value, disabled: true })`) does not disable the input: the
|
|
2326
|
+
* component does not implement `setDisabledState`. Workaround: also bind
|
|
2327
|
+
* `[disabled]` to the control's state, e.g.
|
|
2328
|
+
* `[disabled]="form.controls.email.disabled"`.
|
|
2329
|
+
* @knownIssue `autocorrect` defaults to `true` for every `type`, so spellcheck
|
|
2330
|
+
* and Safari autocorrect stay on for email, password, tel and url fields.
|
|
2331
|
+
* Workaround: set `[autocorrect]="false"` on every field that is not natural
|
|
2332
|
+
* language text.
|
|
2333
|
+
* @knownIssue `inputmode` defaults to `text` for every type except `tel` and
|
|
2334
|
+
* `number`, so `type="email"`, `url` and `search` fields render
|
|
2335
|
+
* `inputmode="text"` instead of the matching keyboard. Workaround: set
|
|
2336
|
+
* `inputmode` to match, e.g. `type="email" inputmode="email"`.
|
|
2337
|
+
* @knownIssue The inline error only appears once the control is dirty (the
|
|
2338
|
+
* user typed) and the input itself has been blurred or had Enter pressed.
|
|
2339
|
+
* Tabbing through an empty required field, or submitting a form the user never
|
|
2340
|
+
* typed in, shows no inline error, and `markAllAsTouched()` does not change
|
|
2341
|
+
* that. Workaround: on submit, show a `<ui-form-errors-summary>` listing the
|
|
2342
|
+
* errors; to also reveal inline errors, call `form.markAllAsDirty()` and
|
|
2343
|
+
* dispatch a `blur` event on each field's `<input>`.
|
|
2344
|
+
*/
|
|
1483
2345
|
class TextInputComponent {
|
|
2346
|
+
/** Visible label, linked to the input with `<label for>`. It is the field's accessible name, so keep it short and specific ("Email address"). Add "(optional)" to the text for optional fields. */
|
|
1484
2347
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2348
|
+
/**
|
|
2349
|
+
* Help text shown under the field and linked with `aria-describedby`. Use it
|
|
2350
|
+
* for format or purpose ("We'll send your order confirmation here"). Hidden
|
|
2351
|
+
* while an error is showing. For `type="password"` it appears on first focus.
|
|
2352
|
+
*/
|
|
1485
2353
|
hint = input(...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
2354
|
+
/**
|
|
2355
|
+
* Fields are optional by default. Set `[optional]="false"` on required fields
|
|
2356
|
+
* to add `aria-required="true"`. This does not validate: also add
|
|
2357
|
+
* `Validators.required` to the control.
|
|
2358
|
+
*/
|
|
1486
2359
|
optional = input(true, ...(ngDevMode ? [{ debugName: "optional" }] : /* istanbul ignore next */ []));
|
|
2360
|
+
/**
|
|
2361
|
+
* Native input type. Use `email`, `tel`, `password`, `url`, `search` or
|
|
2362
|
+
* `number` when they apply so browsers validate, autofill and pick a keyboard.
|
|
2363
|
+
* `password` adds a Show/Hide toggle. Read once on init: changing it later has
|
|
2364
|
+
* no effect.
|
|
2365
|
+
*/
|
|
1487
2366
|
type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
2367
|
+
/**
|
|
2368
|
+
* Virtual keyboard to show on touch devices. Ignored for `type="tel"` (always
|
|
2369
|
+
* `tel`) and `type="number"` (always `numeric`). For every other type it is
|
|
2370
|
+
* sent as-is, so match it to the type (`email` for email fields) or use
|
|
2371
|
+
* `numeric` / `decimal` for digit-only text such as card or order numbers.
|
|
2372
|
+
*/
|
|
1488
2373
|
inputmode = input('text', ...(ngDevMode ? [{ debugName: "inputmode" }] : /* istanbul ignore next */ []));
|
|
2374
|
+
/**
|
|
2375
|
+
* Autofill hint for browsers and password managers. Always set it for
|
|
2376
|
+
* personal data: `name`, `given-name`, `family-name`, `email`, `tel`,
|
|
2377
|
+
* `street-address` / `address-line1`, `postal-code`, `current-password`,
|
|
2378
|
+
* `new-password`, `one-time-code`. Use `off` only for fields that must never be
|
|
2379
|
+
* autofilled, such as a gift message recipient's details.
|
|
2380
|
+
*/
|
|
1489
2381
|
autocomplete = input('on', ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
2382
|
+
/** Focus the input when it first renders. Use sparingly (for example the first field in a modal): moving focus on page load disorientates screen reader users. */
|
|
1490
2383
|
autofocus = input(false, ...(ngDevMode ? [{ debugName: "autofocus" }] : /* istanbul ignore next */ []));
|
|
2384
|
+
/**
|
|
2385
|
+
* Native `minlength` attribute. It does not make your form control invalid;
|
|
2386
|
+
* add `Validators.minLength` to the control as well, or the field shows a red
|
|
2387
|
+
* border with no message.
|
|
2388
|
+
*/
|
|
1491
2389
|
minlength = input(null, ...(ngDevMode ? [{ debugName: "minlength" }] : /* istanbul ignore next */ []));
|
|
2390
|
+
/** Native `maxlength`: the browser stops typing at this length. Defaults to 255. Add `Validators.maxLength` if the form control must also enforce it. */
|
|
1492
2391
|
maxlength = input(255, ...(ngDevMode ? [{ debugName: "maxlength" }] : /* istanbul ignore next */ []));
|
|
2392
|
+
/**
|
|
2393
|
+
* Native `pattern` attribute (a regular expression). Like `minlength`, it does
|
|
2394
|
+
* not make your form control invalid; use `Validators.pattern` on the control.
|
|
2395
|
+
*/
|
|
1493
2396
|
pattern = input(null, ...(ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []));
|
|
2397
|
+
/**
|
|
2398
|
+
* Turns browser spellcheck and Safari autocorrect on or off. Defaults to
|
|
2399
|
+
* `true` for every type, so set `[autocorrect]="false"` on emails, passwords,
|
|
2400
|
+
* phone numbers, postcodes, codes and names.
|
|
2401
|
+
*/
|
|
1494
2402
|
autocorrect = input(this.type() === 'text', ...(ngDevMode ? [{ debugName: "autocorrect" }] : /* istanbul ignore next */ [])); // do not spell check emails and passwords
|
|
2403
|
+
/**
|
|
2404
|
+
* Disables the input. The form control's own disabled state is not picked
|
|
2405
|
+
* up, so bind this when you disable the control.
|
|
2406
|
+
*/
|
|
1495
2407
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2408
|
+
/**
|
|
2409
|
+
* Overrides the accessible name from `label`. Rarely needed; for
|
|
2410
|
+
* `type="tel"` setting it also stops the label and digits being read out one
|
|
2411
|
+
* by one.
|
|
2412
|
+
*/
|
|
1496
2413
|
aria_label = input(...(ngDevMode ? [undefined, { debugName: "aria_label" }] : /* istanbul ignore next */ []));
|
|
2414
|
+
/** Text of the password toggle while the password is hidden. Pass a translated string. Only used with `type="password"`. */
|
|
1497
2415
|
show_password_string = input('Show', ...(ngDevMode ? [{ debugName: "show_password_string" }] : /* istanbul ignore next */ [])); // Pass in translated string
|
|
2416
|
+
/** Text of the password toggle while the password is visible. Pass a translated string. Only used with `type="password"`. */
|
|
1498
2417
|
hide_password_string = input('Hide', ...(ngDevMode ? [{ debugName: "hide_password_string" }] : /* istanbul ignore next */ [])); // Pass in translated string
|
|
2418
|
+
/** Accessible name of the toggle while the password is hidden. Pass a translated string. */
|
|
1499
2419
|
show_password_aria_label = input('Show password', ...(ngDevMode ? [{ debugName: "show_password_aria_label" }] : /* istanbul ignore next */ [])); // Pass in translated string
|
|
2420
|
+
/**
|
|
2421
|
+
* Accessible name of the toggle while the password is visible. Pass a
|
|
2422
|
+
* translated string. The current value is appended, so screen readers read
|
|
2423
|
+
* the revealed password.
|
|
2424
|
+
*/
|
|
1500
2425
|
hide_password_aria_label = input('Hide password', ...(ngDevMode ? [{ debugName: "hide_password_aria_label" }] : /* istanbul ignore next */ [])); // Pass in translated string
|
|
2426
|
+
/** Not used: setting it has no effect. Pass error messages to the projected `<ui-form-errors>` via `error_messages`. */
|
|
1501
2427
|
validation_messages = input(...(ngDevMode ? [undefined, { debugName: "validation_messages" }] : /* istanbul ignore next */ [])); // Pass in translated string
|
|
2428
|
+
/** Emits the new value on every keystroke. Prefer reading the form control; use this when the field is not in a form. */
|
|
1502
2429
|
didChange = output();
|
|
2430
|
+
/** @ignore */
|
|
1503
2431
|
prefaceContent = viewChild('prefaceContent', ...(ngDevMode ? [{ debugName: "prefaceContent" }] : /* istanbul ignore next */ []));
|
|
2432
|
+
/** @ignore */
|
|
1504
2433
|
textValue = signal('', ...(ngDevMode ? [{ debugName: "textValue" }] : /* istanbul ignore next */ []));
|
|
2434
|
+
/** @ignore */
|
|
1505
2435
|
showPassword = signal(false, ...(ngDevMode ? [{ debugName: "showPassword" }] : /* istanbul ignore next */ []));
|
|
2436
|
+
/** @ignore */
|
|
1506
2437
|
inputDidChange = signal(false, ...(ngDevMode ? [{ debugName: "inputDidChange" }] : /* istanbul ignore next */ [])); // only show valdiation after a change event (ie. blur)
|
|
2438
|
+
/** @ignore */
|
|
1507
2439
|
textInputType = signal('text', ...(ngDevMode ? [{ debugName: "textInputType" }] : /* istanbul ignore next */ []));
|
|
2440
|
+
/** @ignore */
|
|
1508
2441
|
hasBeenFocused = signal(false, ...(ngDevMode ? [{ debugName: "hasBeenFocused" }] : /* istanbul ignore next */ [])); // once the field is focused, the password hint stays visible
|
|
2442
|
+
/** @ignore */
|
|
1509
2443
|
id = signal('', ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2444
|
+
/** @ignore */
|
|
1510
2445
|
safariAutocorrect = signal('on', ...(ngDevMode ? [{ debugName: "safariAutocorrect" }] : /* istanbul ignore next */ []));
|
|
1511
2446
|
// Computed signal for hide_password_aria_label that combines the base label with the current input value for better screen reader context
|
|
2447
|
+
/** @ignore */
|
|
1512
2448
|
hidePasswordLabel = computed(() => {
|
|
1513
2449
|
return `${this.hide_password_aria_label()} ${this.textValue()}`;
|
|
1514
2450
|
}, ...(ngDevMode ? [{ debugName: "hidePasswordLabel" }] : /* istanbul ignore next */ []));
|
|
1515
2451
|
// Computed signal for hint display logic
|
|
2452
|
+
/** @ignore */
|
|
1516
2453
|
shouldShowHint = computed(() => {
|
|
1517
2454
|
if (!this.hint()) {
|
|
1518
2455
|
return false;
|
|
@@ -1525,22 +2462,29 @@ class TextInputComponent {
|
|
|
1525
2462
|
// For all other input types, always show hint
|
|
1526
2463
|
return true;
|
|
1527
2464
|
}, ...(ngDevMode ? [{ debugName: "shouldShowHint" }] : /* istanbul ignore next */ []));
|
|
2465
|
+
/** @ignore */
|
|
1528
2466
|
ngOnInit() {
|
|
1529
2467
|
this.id.set(Math.random().toString());
|
|
1530
2468
|
this.textInputType.set(this.type());
|
|
1531
2469
|
this.safariAutocorrect.set(this.autocorrect() ? 'on' : 'off');
|
|
1532
2470
|
}
|
|
2471
|
+
/** @ignore */
|
|
1533
2472
|
onChange = () => undefined;
|
|
2473
|
+
/** @ignore */
|
|
1534
2474
|
onTouched = () => undefined;
|
|
2475
|
+
/** @ignore */
|
|
1535
2476
|
writeValue(textValue) {
|
|
1536
2477
|
this.textValue.set(textValue);
|
|
1537
2478
|
}
|
|
2479
|
+
/** @ignore */
|
|
1538
2480
|
registerOnChange(fn) {
|
|
1539
2481
|
this.onChange = fn;
|
|
1540
2482
|
}
|
|
2483
|
+
/** @ignore */
|
|
1541
2484
|
registerOnTouched(fn) {
|
|
1542
2485
|
this.onTouched = fn;
|
|
1543
2486
|
}
|
|
2487
|
+
/** @ignore */
|
|
1544
2488
|
onModelChange(textValue) {
|
|
1545
2489
|
this.textValue.set(textValue);
|
|
1546
2490
|
this.onChange(textValue);
|
|
@@ -1549,25 +2493,30 @@ class TextInputComponent {
|
|
|
1549
2493
|
// re-appear on blur or Enter (see onBlur / onEnter).
|
|
1550
2494
|
this.inputDidChange.set(false);
|
|
1551
2495
|
}
|
|
2496
|
+
/** @ignore */
|
|
1552
2497
|
onFocus() {
|
|
1553
2498
|
this.hasBeenFocused.set(true);
|
|
1554
2499
|
}
|
|
2500
|
+
/** @ignore */
|
|
1555
2501
|
onBlur() {
|
|
1556
2502
|
// User left the field — reveal validation errors if still invalid.
|
|
1557
2503
|
this.inputDidChange.set(true);
|
|
1558
2504
|
// Mark the form control as touched (standard CVA behavior on blur).
|
|
1559
2505
|
this.onTouched();
|
|
1560
2506
|
}
|
|
2507
|
+
/** @ignore */
|
|
1561
2508
|
onEnter() {
|
|
1562
2509
|
// Pressing Enter triggers validation surface even though focus is kept.
|
|
1563
2510
|
this.inputDidChange.set(true);
|
|
1564
2511
|
// Enter is an explicit commit action — also mark the control as touched.
|
|
1565
2512
|
this.onTouched();
|
|
1566
2513
|
}
|
|
2514
|
+
/** @ignore */
|
|
1567
2515
|
toggleShowPassword() {
|
|
1568
2516
|
this.showPassword.set(!this.showPassword());
|
|
1569
2517
|
this.textInputType.set(this.showPassword() ? 'text' : 'password');
|
|
1570
2518
|
}
|
|
2519
|
+
/** @ignore */
|
|
1571
2520
|
accessibleAriaLabel() {
|
|
1572
2521
|
let prefaceText = '';
|
|
1573
2522
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
@@ -1584,6 +2533,7 @@ class TextInputComponent {
|
|
|
1584
2533
|
const telephoneToText = prefaceText + ' ' + textValue.split('').join(' ');
|
|
1585
2534
|
return this.label() + telephoneToText;
|
|
1586
2535
|
}
|
|
2536
|
+
/** @ignore */
|
|
1587
2537
|
getInputMode() {
|
|
1588
2538
|
switch (this.textInputType()) {
|
|
1589
2539
|
// For telephone inputs, use tel input mode
|
|
@@ -1599,6 +2549,7 @@ class TextInputComponent {
|
|
|
1599
2549
|
}
|
|
1600
2550
|
}
|
|
1601
2551
|
}
|
|
2552
|
+
/** @ignore */
|
|
1602
2553
|
getAriaDescribedBy() {
|
|
1603
2554
|
const describedBy = [];
|
|
1604
2555
|
if (this.inputDidChange()) {
|
|
@@ -1653,29 +2604,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1653
2604
|
}]
|
|
1654
2605
|
}] });
|
|
1655
2606
|
|
|
2607
|
+
/**
|
|
2608
|
+
* The Oasys multi-line text field (`<ui-textarea>`), with a floating label,
|
|
2609
|
+
* optional hint, optional character counter and inline error. Use it for free
|
|
2610
|
+
* text that can run to several lines, such as gift messages, delivery
|
|
2611
|
+
* instructions or contact-us messages. Use `<ui-text-input>` for single-line
|
|
2612
|
+
* values.
|
|
2613
|
+
*
|
|
2614
|
+
* It is a `ControlValueAccessor`: bind it with `formControlName` (or
|
|
2615
|
+
* `formControl` / `ngModel`) and put validation on the form control. Disabling
|
|
2616
|
+
* the form control disables the textarea. It renders a native `<textarea>` with
|
|
2617
|
+
* a `<label for>`, so `label` is required and is the accessible name.
|
|
2618
|
+
*
|
|
2619
|
+
* The textarea grows with its content from `min_rows` up to `max_rows`, then
|
|
2620
|
+
* scrolls. The user cannot resize it by hand.
|
|
2621
|
+
*
|
|
2622
|
+
* Accessibility and form conventions:
|
|
2623
|
+
* - Fields are optional by default. Set `[optional]="false"` on required fields
|
|
2624
|
+
* (adds the native `required` attribute). Mark optional fields in the label
|
|
2625
|
+
* text, e.g. "Delivery instructions (optional)".
|
|
2626
|
+
* - `hint` and the counter are linked with `aria-describedby`. The counter is a
|
|
2627
|
+
* polite live region.
|
|
2628
|
+
* - `char_limit` only drives the counter and a red border. It does not stop
|
|
2629
|
+
* typing or invalidate the control: add `Validators.maxLength` and a message.
|
|
2630
|
+
*
|
|
2631
|
+
* Errors: project a `<ui-form-errors>` as content. It is hidden until the
|
|
2632
|
+
* control is dirty and invalid and the user has left the field, and hides again
|
|
2633
|
+
* while they type. Once shown it is linked with `aria-describedby`.
|
|
2634
|
+
*
|
|
2635
|
+
* @import import { OasysTextareaComponent } from 'oasys-lib';
|
|
2636
|
+
* @knownIssue The inline error only appears once the control is dirty (the
|
|
2637
|
+
* user typed) and the textarea has been blurred. Submitting a form the user
|
|
2638
|
+
* never typed in shows no inline error, and `markAllAsTouched()` does not change
|
|
2639
|
+
* that. Workaround: on submit, show a `<ui-form-errors-summary>` listing the
|
|
2640
|
+
* errors; to also reveal inline errors, call `form.markAllAsDirty()` and
|
|
2641
|
+
* dispatch a `blur` event on the `<textarea>`.
|
|
2642
|
+
*/
|
|
1656
2643
|
class TextareaComponent {
|
|
2644
|
+
/** Visible label, linked with `<label for>`. It is the accessible name. Add "(optional)" to the text for optional fields. */
|
|
1657
2645
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2646
|
+
/** Help text under the field, linked with `aria-describedby`. Hidden while an error is showing. */
|
|
1658
2647
|
hint = input(...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
2648
|
+
/** Example text shown while empty. It disappears on typing and is not a label, so never put instructions only here; use `hint`. */
|
|
1659
2649
|
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2650
|
+
/** Height in rows when empty or short. The textarea grows from here as the user types. */
|
|
1660
2651
|
min_rows = input(3, ...(ngDevMode ? [{ debugName: "min_rows" }] : /* istanbul ignore next */ []));
|
|
2652
|
+
/** Height in rows at which it stops growing and scrolls instead. Values below `min_rows` are treated as `min_rows`. */
|
|
1661
2653
|
max_rows = input(8, ...(ngDevMode ? [{ debugName: "max_rows" }] : /* istanbul ignore next */ []));
|
|
2654
|
+
/**
|
|
2655
|
+
* Maximum characters, shown by the counter (`show_counter`). Going over turns
|
|
2656
|
+
* the border and counter red but does not stop typing or invalidate the form
|
|
2657
|
+
* control: add `Validators.maxLength` with the same value and an error message.
|
|
2658
|
+
*/
|
|
1662
2659
|
char_limit = input(null, ...(ngDevMode ? [{ debugName: "char_limit" }] : /* istanbul ignore next */ []));
|
|
2660
|
+
/** Show a "count / limit" counter under the field. Only renders when `char_limit` is set. */
|
|
1663
2661
|
show_counter = input(false, ...(ngDevMode ? [{ debugName: "show_counter" }] : /* istanbul ignore next */ []));
|
|
2662
|
+
/**
|
|
2663
|
+
* Fields are optional by default. Set `[optional]="false"` on required fields
|
|
2664
|
+
* to add the native `required` attribute. Also add `Validators.required` to the
|
|
2665
|
+
* control so the form is invalid and an error message can show.
|
|
2666
|
+
*/
|
|
1664
2667
|
optional = input(true, ...(ngDevMode ? [{ debugName: "optional" }] : /* istanbul ignore next */ []));
|
|
2668
|
+
/** Disables the textarea. Disabling the form control works too. */
|
|
1665
2669
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2670
|
+
/** Shows the value but stops editing (still focusable and submitted). Use to show text the user cannot change here. */
|
|
1666
2671
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2672
|
+
/** Emits the new value on every keystroke. Prefer reading the form control; use this when the field is not in a form. */
|
|
1667
2673
|
didChange = output();
|
|
2674
|
+
/** @ignore */
|
|
1668
2675
|
textareaEl = viewChild.required('textareaEl');
|
|
2676
|
+
/** @ignore */
|
|
1669
2677
|
textValue = signal('', ...(ngDevMode ? [{ debugName: "textValue" }] : /* istanbul ignore next */ []));
|
|
2678
|
+
/** @ignore */
|
|
1670
2679
|
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2680
|
+
/** @ignore */
|
|
1671
2681
|
inputDidChange = signal(false, ...(ngDevMode ? [{ debugName: "inputDidChange" }] : /* istanbul ignore next */ []));
|
|
2682
|
+
/** @ignore */
|
|
1672
2683
|
id = signal('', ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2684
|
+
/** @ignore */
|
|
1673
2685
|
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
2686
|
+
/** @ignore */
|
|
1674
2687
|
charCount = computed(() => (this.textValue() || '').length, ...(ngDevMode ? [{ debugName: "charCount" }] : /* istanbul ignore next */ []));
|
|
2688
|
+
/** @ignore */
|
|
1675
2689
|
isOverLimit = computed(() => {
|
|
1676
2690
|
const limit = this.char_limit();
|
|
1677
2691
|
return limit !== null && this.charCount() > limit;
|
|
1678
2692
|
}, ...(ngDevMode ? [{ debugName: "isOverLimit" }] : /* istanbul ignore next */ []));
|
|
2693
|
+
/** @ignore */
|
|
1679
2694
|
counterId = computed(() => `textarea-count-${this.id()}`, ...(ngDevMode ? [{ debugName: "counterId" }] : /* istanbul ignore next */ []));
|
|
1680
2695
|
constructor() {
|
|
1681
2696
|
afterRenderEffect(() => {
|
|
@@ -1686,23 +2701,31 @@ class TextareaComponent {
|
|
|
1686
2701
|
this.autosize(this.textareaEl().nativeElement);
|
|
1687
2702
|
});
|
|
1688
2703
|
}
|
|
2704
|
+
/** @ignore */
|
|
1689
2705
|
ngOnInit() {
|
|
1690
2706
|
this.id.set(Math.random().toString());
|
|
1691
2707
|
}
|
|
2708
|
+
/** @ignore */
|
|
1692
2709
|
onChange = () => undefined;
|
|
2710
|
+
/** @ignore */
|
|
1693
2711
|
onTouched = () => undefined;
|
|
2712
|
+
/** @ignore */
|
|
1694
2713
|
writeValue(value) {
|
|
1695
2714
|
this.textValue.set(value);
|
|
1696
2715
|
}
|
|
2716
|
+
/** @ignore */
|
|
1697
2717
|
registerOnChange(fn) {
|
|
1698
2718
|
this.onChange = fn;
|
|
1699
2719
|
}
|
|
2720
|
+
/** @ignore */
|
|
1700
2721
|
registerOnTouched(fn) {
|
|
1701
2722
|
this.onTouched = fn;
|
|
1702
2723
|
}
|
|
2724
|
+
/** @ignore */
|
|
1703
2725
|
setDisabledState(isDisabled) {
|
|
1704
2726
|
this.cvaDisabled.set(isDisabled);
|
|
1705
2727
|
}
|
|
2728
|
+
/** @ignore */
|
|
1706
2729
|
onModelChange(value) {
|
|
1707
2730
|
this.textValue.set(value);
|
|
1708
2731
|
this.onChange(value);
|
|
@@ -1711,12 +2734,14 @@ class TextareaComponent {
|
|
|
1711
2734
|
// re-appear on blur (see onBlur).
|
|
1712
2735
|
this.inputDidChange.set(false);
|
|
1713
2736
|
}
|
|
2737
|
+
/** @ignore */
|
|
1714
2738
|
onBlur() {
|
|
1715
2739
|
// User left the field — reveal validation errors if still invalid.
|
|
1716
2740
|
this.inputDidChange.set(true);
|
|
1717
2741
|
// Mark the form control as touched (standard CVA behavior on blur).
|
|
1718
2742
|
this.onTouched();
|
|
1719
2743
|
}
|
|
2744
|
+
/** @ignore */
|
|
1720
2745
|
getAriaDescribedBy() {
|
|
1721
2746
|
const describedBy = [];
|
|
1722
2747
|
if (this.inputDidChange()) {
|
|
@@ -1763,26 +2788,99 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1763
2788
|
], standalone: true, imports: [ReactiveFormsModule, FormsModule, LayoutStackComponent], template: "<ui-stack class=\"ui-textarea-container\" stack_gap=\"tight\">\n <div class=\"ui-textarea\" [class.ui-textarea--over-limit]=\"isOverLimit()\">\n <textarea\n #textareaEl\n [id]=\"id()\"\n [name]=\"id()\"\n [ngModel]=\"textValue()\"\n (ngModelChange)=\"onModelChange($event)\"\n (blur)=\"onBlur()\"\n [class.ng-input-did-change]=\"inputDidChange()\"\n [class.ng-input-did-not-change]=\"!inputDidChange()\"\n [placeholder]=\"placeholder()\"\n [attr.disabled]=\"isDisabled() || null\"\n [attr.readonly]=\"readonly() || null\"\n [required]=\"!optional()\"\n [attr.aria-describedby]=\"getAriaDescribedBy()\"\n class=\"text-body--default text-body--regular\"\n ></textarea>\n <ui-stack class=\"label-container\" stack_direction=\"x\">\n <label class=\"text-body--supporting text-body--regular\" [for]=\"id()\">{{ label() }}</label>\n </ui-stack>\n </div>\n\n @if (hint() || (show_counter() && char_limit() !== null)) {\n <ui-stack\n class=\"ui-textarea__footer\"\n stack_direction=\"x\"\n stack_align=\"start\"\n stack_gap=\"near\"\n >\n @if (hint()) {\n <div\n class=\"ui-textarea__hint-container ui-text-input-hint text-body--supporting text-color--supporting\"\n [attr.id]=\"'hint_' + id()\"\n >\n {{ hint() }}\n </div>\n }\n @if (show_counter() && char_limit() !== null) {\n <span\n [id]=\"counterId()\"\n aria-live=\"polite\"\n class=\"ui-textarea__counter text-body--supporting\"\n [class.ui-textarea__counter--error]=\"isOverLimit()\"\n >{{ charCount() }} / {{ char_limit() }}</span>\n }\n </ui-stack>\n }\n\n <ui-stack stack_gap=\"none\">\n <div class=\"input-errors\">\n <div class=\"input-errors-content\" [attr.id]=\"'error_' + id()\">\n <ng-content select=\"ui-form-errors\"></ng-content>\n </div>\n </div>\n </ui-stack>\n</ui-stack>\n", styles: ["html{font-size:62.5%}html,html body{font-family:var(--oasys-typography-body-body-font-family);font-weight:var(--oasys-typography-body-body-font-weight);font-size:var(--oasys-typography-body-body-font-size);line-height:var(--oasys-typography-body-body-line-height);color:var(--oasys-color-brand-foreground-primary)}html b,html bold,html strong,html body b,html body bold,html body strong{font-weight:var(--oasys-typography-body-emphasis-hero-font-weight)}html i,html body i{font-style:normal}h1,h2,h3,.text-heading,.text-body--expressive,.ui-rce blockquote,.ui-prose blockquote,article blockquote,.text-heading--body--expressive{font-family:var(--oasys-typography-heading-hero-desktop-font-family)}h4,h5,h6,.text-heading--functional,.ui-rce h3,.ui-prose h3,article h3,.ui-rce h2,.ui-prose h2,article h2{font-family:var(--oasys-typography-heading-func-primary-desktop-font-family)}ui-container h1,ui-container h2,ui-container h3,ui-container h4,ui-container h5,ui-container h6,ui-container p,ui-box h1,ui-box h2,ui-box h3,ui-box h4,ui-box h5,ui-box h6,ui-box p,ui-stack h1,ui-stack h2,ui-stack h3,ui-stack h4,ui-stack h5,ui-stack h6,ui-stack p,ui-grid h1,ui-grid h2,ui-grid h3,ui-grid h4,ui-grid h5,ui-grid h6,ui-grid p{margin:0}h1:not(.seo-h1){font-size:var(--oasys-typography-heading-hero-desktop-font-size);line-height:var(--oasys-typography-heading-hero-desktop-line-height);font-weight:var(--oasys-typography-heading-hero-desktop-font-weight)}@media only screen and (max-width:766px){h1:not(.seo-h1){font-size:var(--oasys-typography-heading-hero-mobile-font-size);line-height:var(--oasys-typography-heading-hero-mobile-line-height);font-weight:var(--oasys-typography-heading-hero-mobile-font-weight)}}.text-heading--hero,h1.text-heading--hero,h2.text-heading--hero,h3.text-heading--hero,h4.text-heading--hero,h5.text-heading--hero,h6.text-heading--hero{font-family:var(--oasys-typography-heading-hero-desktop-font-family);font-size:var(--oasys-typography-heading-hero-desktop-font-size);line-height:var(--oasys-typography-heading-hero-desktop-line-height);font-weight:var(--oasys-typography-heading-hero-desktop-font-weight)}@media only screen and (max-width:766px){.text-heading--hero,h1.text-heading--hero,h2.text-heading--hero,h3.text-heading--hero,h4.text-heading--hero,h5.text-heading--hero,h6.text-heading--hero{font-size:var(--oasys-typography-heading-hero-mobile-font-size);line-height:var(--oasys-typography-heading-hero-mobile-line-height);font-weight:var(--oasys-typography-heading-hero-mobile-font-weight)}}h2{font-size:var(--oasys-typography-heading-primary-desktop-font-size);line-height:var(--oasys-typography-heading-primary-desktop-line-height);font-weight:var(--oasys-typography-heading-primary-desktop-font-weight)}@media only screen and (max-width:766px){h2{font-size:var(--oasys-typography-heading-primary-mobile-font-size);line-height:var(--oasys-typography-heading-primary-mobile-line-height);font-weight:var(--oasys-typography-heading-primary-mobile-font-weight)}}.text-heading--primary,h1.text-heading--primary,h2.text-heading--primary,h3.text-heading--primary,h4.text-heading--primary,h5.text-heading--primary,h6.text-heading--primary{font-family:var(--oasys-typography-heading-hero-desktop-font-family);font-size:var(--oasys-typography-heading-primary-desktop-font-size);line-height:var(--oasys-typography-heading-primary-desktop-line-height);font-weight:var(--oasys-typography-heading-primary-desktop-font-weight)}@media only screen and (max-width:766px){.text-heading--primary,h1.text-heading--primary,h2.text-heading--primary,h3.text-heading--primary,h4.text-heading--primary,h5.text-heading--primary,h6.text-heading--primary{font-size:var(--oasys-typography-heading-primary-mobile-font-size);line-height:var(--oasys-typography-heading-primary-mobile-line-height);font-weight:var(--oasys-typography-heading-primary-mobile-font-weight)}}h3{font-size:var(--oasys-typography-heading-secondary-font-size);line-height:var(--oasys-typography-heading-secondary-line-height);font-weight:var(--oasys-typography-heading-secondary-font-weight)}.text-heading--secondary,h1.text-heading--secondary,h2.text-heading--secondary,h3.text-heading--secondary,h4.text-heading--secondary,h5.text-heading--secondary,h6.text-heading--secondary{font-family:var(--oasys-typography-heading-hero-desktop-font-family);font-size:var(--oasys-typography-heading-secondary-font-size);line-height:var(--oasys-typography-heading-secondary-line-height);font-weight:var(--oasys-typography-heading-secondary-font-weight)}h4{font-size:var(--oasys-typography-heading-func-primary-desktop-font-size);line-height:var(--oasys-typography-heading-func-primary-desktop-line-height);font-weight:var(--oasys-typography-heading-func-primary-desktop-font-weight)}@media only screen and (max-width:766px){h4{font-size:var(--oasys-typography-heading-func-primary-mobile-font-size);line-height:var(--oasys-typography-heading-func-primary-mobile-line-height)}}.text-heading--functional--primary,.ui-rce h2,.ui-prose h2,article h2,h1.text-heading--functional--primary,h2.text-heading--functional--primary,h3.text-heading--functional--primary,h4.text-heading--functional--primary,h5.text-heading--functional--primary,h6.text-heading--functional--primary{font-family:var(--oasys-typography-heading-func-primary-desktop-font-family);font-size:var(--oasys-typography-heading-func-primary-desktop-font-size);line-height:var(--oasys-typography-heading-func-primary-desktop-line-height);font-weight:var(--oasys-typography-heading-func-primary-desktop-font-weight)}@media only screen and (max-width:766px){.text-heading--functional--primary,.ui-rce h2,.ui-prose h2,article h2,h1.text-heading--functional--primary,h2.text-heading--functional--primary,h3.text-heading--functional--primary,h4.text-heading--functional--primary,h5.text-heading--functional--primary,h6.text-heading--functional--primary{font-size:var(--oasys-typography-heading-func-primary-mobile-font-size);line-height:var(--oasys-typography-heading-func-primary-mobile-line-height)}}h5{font-size:var(--oasys-typography-heading-func-secondary-desktop-font-size);line-height:var(--oasys-typography-heading-func-secondary-desktop-line-height);font-weight:var(--oasys-typography-heading-func-secondary-desktop-font-weight)}@media only screen and (max-width:766px){h5{font-size:var(--oasys-typography-heading-func-secondary-mobile-font-size);line-height:var(--oasys-typography-heading-func-secondary-mobile-line-height);font-weight:var(--oasys-typography-heading-func-secondary-mobile-font-weight)}}.text-heading--functional--secondary,.ui-rce h3,.ui-prose h3,article h3,h1.text-heading--functional--secondary,h2.text-heading--functional--secondary,h3.text-heading--functional--secondary,h4.text-heading--functional--secondary,h5.text-heading--functional--secondary,h6.text-heading--functional--secondary{font-family:var(--oasys-typography-heading-func-primary-desktop-font-family);font-size:var(--oasys-typography-heading-func-secondary-desktop-font-size);line-height:var(--oasys-typography-heading-func-secondary-desktop-line-height);font-weight:var(--oasys-typography-heading-func-secondary-desktop-font-weight)}@media only screen and (max-width:766px){.text-heading--functional--secondary,.ui-rce h3,.ui-prose h3,article h3,h1.text-heading--functional--secondary,h2.text-heading--functional--secondary,h3.text-heading--functional--secondary,h4.text-heading--functional--secondary,h5.text-heading--functional--secondary,h6.text-heading--functional--secondary{font-size:var(--oasys-typography-heading-func-secondary-mobile-font-size);line-height:var(--oasys-typography-heading-func-secondary-mobile-line-height);font-weight:var(--oasys-typography-heading-func-secondary-mobile-font-weight)}}label{-webkit-user-select:none;user-select:none;cursor:pointer}label,.text-label--primary{font-size:var(--oasys-typography-heading-label-primary-font-size);line-height:var(--oasys-typography-heading-label-primary-line-height);font-weight:var(--oasys-typography-heading-label-primary-font-weight)}.text-label--secondary{font-size:var(--oasys-typography-heading-label-secondary-font-size);line-height:var(--oasys-typography-heading-label-secondary-line-height);font-weight:var(--oasys-typography-heading-label-secondary-font-weight)}.text-body--expressive,.ui-rce blockquote,.ui-prose blockquote,article blockquote,.text-heading--body--expressive{font-size:var(--oasys-typography-body-expressive-font-size);line-height:var(--oasys-typography-body-expressive-line-height);font-weight:var(--oasys-typography-body-expressive-font-weight)}.text-body--hero,.ui-rce h6,.ui-prose h6,article h6{font-size:var(--oasys-typography-body-hero-font-size);line-height:var(--oasys-typography-body-hero-line-height);font-weight:var(--oasys-typography-body-hero-font-weight)}.text-body--default,.ui-rce p{font-size:var(--oasys-typography-body-body-font-size);line-height:var(--oasys-typography-body-body-line-height);font-weight:var(--oasys-typography-body-body-font-weight)}.text-body--supporting{font-size:var(--oasys-typography-body-supporting-font-size);line-height:var(--oasys-typography-body-supporting-line-height);font-weight:var(--oasys-typography-body-supporting-font-weight)}.text-body--micro{font-size:var(--oasys-typography-body-micro-font-size);line-height:var(--oasys-typography-body-micro-line-height);font-weight:var(--oasys-typography-body-micro-font-weight)}.text-body--regular,.ui-rce h6,.ui-prose h6,article h6{font-weight:var(--oasys-typography-body-body-font-weight)}.text-body--line-through{text-decoration:var(--oasys-typography-body-line-through-body-text-decoration)}.text-body--emphasis,.ui-rce h3,.ui-prose h3,article h3,.ui-rce h2,.ui-prose h2,article h2,a--standalone,.text-link--standalone,.ui-rce .ui-rce-embed a,.ui-rce .ui-rce-embed a:hover,.ui-prose .ui-rce-embed a,.ui-prose .ui-rce-embed a:hover,article .ui-rce-embed a,article .ui-rce-embed a:hover,.ui-textarea-container .ui-textarea textarea{font-weight:var(--oasys-typography-body-emphasis-hero-font-weight)}.text-body--body-emphasis{font-size:var(--oasys-typography-body-emphasis-body-font-size);line-height:var(--oasys-typography-body-emphasis-body-line-height);font-weight:var(--oasys-typography-body-emphasis-body-font-weight)}.text-body--supporting-emphasis{font-size:var(--oasys-typography-body-emphasis-supporting-font-size);line-height:var(--oasys-typography-body-emphasis-supporting-line-height);font-weight:var(--oasys-typography-body-emphasis-supporting-font-weight)}.text-body--hero-line-through{font-size:var(--oasys-typography-body-line-through-hero-font-size);line-height:var(--oasys-typography-body-line-through-hero-line-height);font-weight:var(--oasys-typography-body-line-through-hero-font-weight);text-decoration:var(--oasys-typography-body-line-through-hero-text-decoration)}.text-body--supporting-line-through{font-size:var(--oasys-typography-body-line-through-supporting-font-size);line-height:var(--oasys-typography-body-line-through-supporting-line-height);font-weight:var(--oasys-typography-body-line-through-supporting-font-weight);text-decoration:var(--oasys-typography-body-line-through-supporting-text-decoration)}.text-body--hero-emphasis-line-through{font-size:var(--oasys-typography-body-emphasis-line-through-hero-font-size);line-height:var(--oasys-typography-body-emphasis-line-through-hero-line-height);font-weight:var(--oasys-typography-body-emphasis-line-through-hero-font-weight);text-decoration:var(--oasys-typography-body-emphasis-line-through-hero-text-decoration)}.text-body--body-emphasis-line-through{font-size:var(--oasys-typography-body-emphasis-line-through-body-font-size);line-height:var(--oasys-typography-body-emphasis-line-through-body-line-height);font-weight:var(--oasys-typography-body-emphasis-line-through-body-font-weight);text-decoration:var(--oasys-typography-body-emphasis-line-through-body-text-decoration)}.text-body--supporting-emphasis-line-through{font-size:var(--oasys-typography-body-emphasis-line-through-supporting-font-size);line-height:var(--oasys-typography-body-emphasis-line-through-supporting-line-height);font-weight:var(--oasys-typography-body-emphasis-line-through-supporting-font-weight);text-decoration:var(--oasys-typography-body-emphasis-line-through-supporting-text-decoration)}.text-color--on-light{color:var(--oasys-color-brand-foreground-primary)}.text-color--on-light.text-color--supporting,.text-color--on-light .text-color--supporting{color:var(--oasys-color-brand-foreground-secondary)}.text-color--on-dark{color:var(--oasys-color-brand-foreground-primary-on-dark)}.text-color--on-dark.text-color--supporting,.text-color--on-dark .text-color--supporting{color:var(--oasys-color-brand-foreground-secondary-on-dark)}.text-color--supporting{color:var(--oasys-color-brand-foreground-secondary)}.text-color--error{color:var(--oasys-color-system-foreground-negative)}.text-color--highlight{color:var(--oasys-color-brand-foreground-highlight)}a{color:inherit;text-decoration:none}.text--readable-width,.ui-rce blockquote,.ui-prose blockquote,article blockquote{max-width:70ch}a,.text-link,.ui-rce a,.ui-rce a:hover,.ui-prose a,.ui-prose a:hover,article a,article a:hover{text-decoration:none;cursor:pointer}a--standalone,.text-link--standalone,.ui-rce .ui-rce-embed a,.ui-rce .ui-rce-embed a:hover,.ui-prose .ui-rce-embed a,.ui-prose .ui-rce-embed a:hover,article .ui-rce-embed a,article .ui-rce-embed a:hover{text-decoration:underline}a--paragraph,.text-link--paragraph,.ui-rce a,.ui-rce a:hover,.ui-prose a,.ui-prose a:hover,article a,article a:hover{text-decoration:underline;font-weight:inherit}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.ui-rce h2,.ui-prose h2,article h2{padding-top:var(--oasys-prose-vertical-adjustment-heading-primary-large-top);margin-bottom:var(--oasys-prose-vertical-adjustment-heading-primary-large-bottom)}@media only screen and (max-width:766px){.ui-rce h2,.ui-prose h2,article h2{padding-top:var(--oasys-prose-vertical-adjustment-heading-primary-small-top);margin-bottom:var(--oasys-prose-vertical-adjustment-heading-primary-small-bottom)}}.ui-rce h3,.ui-prose h3,article h3{padding-top:var(--oasys-prose-vertical-adjustment-heading-secondary-large-top);margin-bottom:var(--oasys-prose-vertical-adjustment-heading-secondary-large-bottom)}@media only screen and (max-width:766px){.ui-rce h3,.ui-prose h3,article h3{padding-top:var(--oasys-prose-vertical-adjustment-heading-secondary-small-top);margin-bottom:var(--oasys-prose-vertical-adjustment-heading-secondary-small-bottom)}}.ui-rce p,.ui-rce ul,.ui-rce ol,.ui-prose p,.ui-prose ul,.ui-prose ol,article p,article ul,article ol{margin-bottom:var(--oasys-prose-vertical-adjustment-paragraph-bottom)}.ui-rce p:empty,.ui-rce ul:empty,.ui-rce ol:empty,.ui-prose p:empty,.ui-prose ul:empty,.ui-prose ol:empty,article p:empty,article ul:empty,article ol:empty{display:none}.ui-rce blockquote,.ui-prose blockquote,article blockquote{padding-top:var(--oasys-prose-vertical-adjustment-blockquote-top);margin-bottom:var(--oasys-prose-vertical-adjustment-blockquote-bottom);text-align:center;margin:0 auto}.ui-rce hr,.ui-prose hr,article hr{display:block;width:100%;border:0;padding:0;margin:0;height:var(--oasys-size-unit-8);background:var(--oasys-color-brand-background-secondary);margin-top:var(--oasys-spacing-expanded);margin-bottom:var(--oasys-spacing-expanded)}.ui-rce ol,.ui-prose ol,article ol{list-style-type:decimal;list-style-position:inside}.ui-rce ul,.ui-prose ul,article ul{list-style:initial;list-style-position:inside}.ui-rce .ui-rce-embed,.ui-prose .ui-rce-embed,article .ui-rce-embed{padding-top:var(--oasys-prose-vertical-adjustment-component-top-bottom);margin-bottom:var(--oasys-prose-vertical-adjustment-component-top-bottom)}.ui-rce .ui-rce-embed ui-button a,.ui-rce .ui-rce-embed ui-button a:hover,.ui-prose .ui-rce-embed ui-button a,.ui-prose .ui-rce-embed ui-button a:hover,article .ui-rce-embed ui-button a,article .ui-rce-embed ui-button a:hover{text-decoration:none}.ui-rce>ui-box .ui-box-content>*:first-child{padding-top:0}.ui-rce>ui-box .ui-box-content>*:last-child{margin-bottom:0}.ui-rce .ui-rce-instance:last-of-type{padding-bottom:var(--oasys-spacing-expanded)}.ui-rce ui-button,.ui-rce img{display:inline-block;margin:0;margin-top:var(--oasys-spacing-near);margin-right:var(--oasys-spacing-near);vertical-align:top}.ui-rce ui-button:last-child,.ui-rce img:last-child{margin-right:0}.ui-rce img{width:100%}.ui-rce ol p,.ui-rce ul p{display:inline;margin:0}form fieldset legend{margin-bottom:var(--oasys-spacing-near)}form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-text-input,form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea,form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-combobox,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-text-input,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-combobox,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-text-input,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-combobox{border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-danger)}form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors{grid-template-rows:1fr;transform:translateY(0);opacity:1}form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors .input-errors-content,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors .input-errors-content,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .input-errors .input-errors-content{visibility:visible!important}form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .hint-container,form.ng-dirty .ui-text-input-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea__hint-container,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .hint-container,form.ng-dirty .ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea__hint-container,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .hint-container,form.ng-dirty .ui-combobox-container:has(input.ng-invalid.ng-input-did-change:not(:focus-within)) .ui-textarea__hint-container{display:none!important}form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .ui-text-input,form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .ui-textarea,form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .ui-combobox,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .ui-text-input,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .ui-textarea,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .ui-combobox,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .ui-text-input,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .ui-textarea,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .ui-combobox{border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-danger)}form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .input-errors,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .input-errors,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .input-errors{grid-template-rows:1fr;transform:translateY(0);opacity:1}form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .input-errors .input-errors-content,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .input-errors .input-errors-content,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .input-errors .input-errors-content{visibility:visible!important}form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .hint-container,form.ng-dirty.ng-submitted .ui-text-input-container:has(input.ng-invalid) .ui-textarea__hint-container,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .hint-container,form.ng-dirty.ng-submitted .ui-textarea-container:has(textarea.ng-invalid) .ui-textarea__hint-container,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .hint-container,form.ng-dirty.ng-submitted .ui-combobox-container:has(input.ng-invalid) .ui-textarea__hint-container{display:none!important}.ui-checkbox input,.ui-checkbox textarea,.ui-radio input,.ui-radio textarea,.ui-text-input input,.ui-text-input textarea,.ui-textarea input,.ui-textarea textarea,.ui-combobox input,.ui-combobox textarea{appearance:none;margin:0;border:none}.ui-checkbox input,.ui-radio input{cursor:pointer}.ui-checkbox,.ui-radio{--_inset: var(--oasys-spacing-near);--_radius: var(--oasys-radius-soften);--_transition_duration: calc(var(--oasys-animation-duration) * 1ms)}.ui-checkbox input,.ui-radio input{position:absolute;inset:0;border-radius:var(--oasys-radius-soften)}.ui-checkbox input.secondary,.ui-radio input.secondary{inset:unset;top:var(--_inset);--_focusSize: var(--oasys-typography-heading-label-secondary-line-height);width:var(--_focusSize);height:var(--_focusSize)}.ui-checkbox input+label,.ui-radio input+label{width:inherit;display:flex;align-items:center;gap:var(--oasys-spacing-tight)}.ui-checkbox input+label .icon-container,.ui-radio input+label .icon-container{align-self:flex-start;padding:var(--oasys-component-checkbox-icon-inset);border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-selected);border-radius:var(--_radius)}.ui-checkbox input+label .input-hint:empty,.ui-radio input+label .input-hint:empty{display:none}.ui-checkbox input+label.primary,.ui-radio input+label.primary{padding:var(--_inset);border-radius:var(--_radius);border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-selectable)}.ui-checkbox input+label.secondary,.ui-radio input+label.secondary{padding:var(--_inset) 0}.ui-checkbox input+label.secondary .icon-container,.ui-radio input+label.secondary .icon-container{background:transparent;border-radius:var(--_radius);border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-selected)}.ui-checkbox input+label,.ui-checkbox input+label .icon-container,.ui-radio input+label,.ui-radio input+label .icon-container{transition:background-color calc(var(--_transition_duration) * 1ms),border-color calc(var(--_transition_duration) * 1ms)}.ui-checkbox input:hover+label.primary,.ui-checkbox input:checked+label.primary,.ui-radio input:hover+label.primary,.ui-radio input:checked+label.primary{background:var(--oasys-color-interaction-background-selected)}.ui-checkbox input:hover+label.secondary .icon-container,.ui-checkbox input:checked+label.secondary .icon-container,.ui-radio input:hover+label.secondary .icon-container,.ui-radio input:checked+label.secondary .icon-container{background:var(--oasys-color-interaction-background-selected)}.ui-checkbox input:checked+label.primary .icon-container,.ui-checkbox input:checked+label.secondary .icon-container,.ui-radio input:checked+label.primary .icon-container,.ui-radio input:checked+label.secondary .icon-container{background:var(--oasys-color-interaction-border-selected);border-color:var(--oasys-color-interaction-border-selected);color:var(--oasys-color-brand-foreground-primary-on-dark)}.ui-checkbox input:checked+label.primary,.ui-radio input:checked+label.primary{border-color:var(--oasys-color-interaction-border-selected)!important}.ui-checkbox input.ng-touched.ng-invalid+label,.ui-radio input.ng-touched.ng-invalid+label{color:var(--oasys-color-system-foreground-negative)}.ui-checkbox input.ng-touched.ng-invalid+label .icon-container,.ui-radio input.ng-touched.ng-invalid+label .icon-container{border-color:var(--oasys-color-system-foreground-negative)}.ui-chip .ui-checkbox input+label .icon-container.icon--hidden,.ui-chip .ui-radio input+label .icon-container.icon--hidden{display:none}.ui-chip .ui-checkbox input+label .label--center,.ui-chip .ui-radio input+label .label--center{margin:0 auto}.ui-chip .ui-checkbox input:checked+label.primary,.ui-chip .ui-radio input:checked+label.primary{border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-selected)!important}:host{display:block;width:100%}:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .ui-text-input,:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .ui-textarea,:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .ui-combobox{border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-danger)}:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .input-errors{grid-template-rows:1fr;transform:translateY(0);opacity:1}:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .input-errors .input-errors-content{visibility:visible!important}:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .hint-container,:host.ng-dirty.ng-invalid:has(textarea.ng-input-did-change) .ui-textarea-container .ui-textarea__hint-container{display:none!important}.ui-textarea-container .ui-textarea{--_label-height: var(--oasys-typography-body-supporting-line-height);--_label-input-gap: var(--oasys-spacing-tiny);--_label-top-inset: var(--oasys-spacing-near);--_input-inset-top: calc( var(--_label-height) + var(--_label-input-gap) + var(--_label-top-inset) );position:relative;transition:border calc(var(--oasys-animation-duration-long) * 1ms);border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-selectable)}.ui-textarea-container .ui-textarea,.ui-textarea-container .ui-textarea textarea{border-radius:var(--oasys-radius-soften);width:100%}.ui-textarea-container .ui-textarea textarea{box-sizing:border-box;display:block;padding:var(--oasys-spacing-near);padding-top:var(--_input-inset-top);color:var(--oasys-color-brand-foreground-primary);resize:none;overflow:hidden}.ui-textarea-container .ui-textarea .label-container{position:absolute;top:var(--oasys-spacing-near);left:var(--oasys-spacing-near);right:var(--oasys-spacing-near);width:calc(100% - var(--oasys-spacing-near) - var(--oasys-spacing-near))}.ui-textarea-container .ui-textarea .label-container,.ui-textarea-container .ui-textarea .label-container label{pointer-events:none;-webkit-user-select:none;user-select:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ui-textarea-container .ui-textarea--over-limit{border-color:var(--oasys-color-interaction-border-danger)}.ui-textarea-container .input-errors{--_ad: calc(var(--oasys-animation-duration-long) * 1ms);display:grid;grid-template-rows:0fr;overflow:hidden;opacity:0;transform:translateY(-33%);transition:grid-template-rows var(--_ad),opacity var(--_ad),transform var(--_ad);transition-timing-function:cubic-bezier(var(--oasys-animation-timing-function-soft));will-change:grid-template-rows,transform,opacity}.ui-textarea-container .input-errors .input-errors-content{min-height:0;visibility:hidden;transition:visibility var(--_ad)}.ui-textarea-container .input-errors .hint-container{display:block!important}.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .ui-text-input,.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .ui-textarea,.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .ui-combobox{border:var(--oasys-border-width-primary) solid var(--oasys-color-interaction-border-danger)}.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .input-errors{grid-template-rows:1fr;transform:translateY(0);opacity:1}.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .input-errors .input-errors-content{visibility:visible!important}.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .hint-container,.ui-textarea-container:has(textarea.ng-invalid.ng-input-did-change) .ui-textarea__hint-container{display:none!important}.ui-textarea-container:has(textarea:disabled) textarea{background-color:none;color:var(--oasys-component-text-input-color-disabled-foreground);cursor:not-allowed}.ui-textarea-container:has(textarea:disabled) .ui-textarea{background-color:var(--oasys-component-text-input-color-disabled-background)}.ui-textarea-container:has(textarea:disabled) .ui-textarea__counter{color:var(--oasys-component-text-input-color-disabled-foreground)}.ui-textarea-container:has(textarea[readonly]) .ui-textarea{background-color:var(--oasys-color-brand-background-secondary)}.ui-textarea-container .ui-textarea__footer .ui-textarea__hint-container{flex:1;min-width:0}.ui-textarea-container .ui-textarea__footer .ui-textarea__counter{flex-shrink:0;white-space:nowrap;margin-left:auto;color:var(--oasys-color-brand-foreground-secondary)}.ui-textarea-container .ui-textarea__footer .ui-textarea__counter--error{color:var(--oasys-color-system-foreground-negative)}\n"] }]
|
|
1764
2789
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], min_rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "min_rows", required: false }] }], max_rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "max_rows", required: false }] }], char_limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "char_limit", required: false }] }], show_counter: [{ type: i0.Input, args: [{ isSignal: true, alias: "show_counter", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], didChange: [{ type: i0.Output, args: ["didChange"] }], textareaEl: [{ type: i0.ViewChild, args: ['textareaEl', { isSignal: true }] }] } });
|
|
1765
2790
|
|
|
2791
|
+
/**
|
|
2792
|
+
* The Oasys chip (`<ui-chip>`). A form choice styled as a bordered, tappable
|
|
2793
|
+
* pill: the radio or tick box is hidden and the whole label is the control.
|
|
2794
|
+
* Use chips for short choices laid out in a row or grid, such as delivery
|
|
2795
|
+
* slots, pause lengths or occasion types.
|
|
2796
|
+
*
|
|
2797
|
+
* `chip_type` picks the behaviour:
|
|
2798
|
+
* - `radio` (default): one choice from a set. Renders a `<ui-radio>`. Give
|
|
2799
|
+
* every chip in the set the same `name` and its own `value`; the form value
|
|
2800
|
+
* is the selected chip's `value` as a string.
|
|
2801
|
+
* - `checkbox`: an on/off choice. Renders a `<ui-checkbox>`; the form value is
|
|
2802
|
+
* a boolean.
|
|
2803
|
+
*
|
|
2804
|
+
* Chips are form inputs and belong in a form group. Wrap a set in
|
|
2805
|
+
* `<ui-form-group>` (a `<fieldset>` with a `<legend>`), and lay the chips out
|
|
2806
|
+
* with `<ui-stack>` or `<ui-grid>`. Do not add `role="chipgroup"`: it is not
|
|
2807
|
+
* an ARIA role. For a toggle outside a form, use
|
|
2808
|
+
* `<ui-button button_type="chip" aria_role="switch">` instead.
|
|
2809
|
+
*
|
|
2810
|
+
* Projected content is shown on the label line (for example a price or
|
|
2811
|
+
* "Sold out"). It is inside the `<label>`, so it is read as part of the name.
|
|
2812
|
+
*
|
|
2813
|
+
* Keyboard: radio chips behave like `<ui-radio>` (arrow keys move focus within
|
|
2814
|
+
* the same `name`, Space selects). Checkbox chips toggle with Space.
|
|
2815
|
+
*
|
|
2816
|
+
* @import import { OasysChipComponent } from 'oasys-lib';
|
|
2817
|
+
* @knownIssue Radio chips without a `name` all share the default name
|
|
2818
|
+
* (`Radio Group`), so separate sets on one page act as a single group:
|
|
2819
|
+
* selecting in one clears the others. Workaround: give each set its own
|
|
2820
|
+
* `name`.
|
|
2821
|
+
* @knownIssue Binding `[value]="true"` on a checkbox chip does not check it:
|
|
2822
|
+
* the chip's internal `ngModel` overwrites it on init. Workaround: bind the
|
|
2823
|
+
* chip to a form control (`formControlName`, `formControl` or `ngModel`) and
|
|
2824
|
+
* set that to `true`.
|
|
2825
|
+
* @knownIssue Disabling the form control (`control.disable()` or
|
|
2826
|
+
* `new FormControl({ value: '', disabled: true })`) does not disable the chip,
|
|
2827
|
+
* because the component does not implement `setDisabledState`. Workaround:
|
|
2828
|
+
* also bind `[disabled]` on each chip (Angular logs a dev-mode warning about
|
|
2829
|
+
* `disabled` on a reactive form directive; it is safe to ignore here).
|
|
2830
|
+
*/
|
|
1766
2831
|
class ChipComponent {
|
|
2832
|
+
/** `radio` for one choice from a set, `checkbox` for an on/off choice. */
|
|
1767
2833
|
chip_type = input('radio', ...(ngDevMode ? [{ debugName: "chip_type" }] : /* istanbul ignore next */ []));
|
|
2834
|
+
/** Icon shown before the label. Decorative: the label must still say it all. */
|
|
1768
2835
|
icon_name = input(...(ngDevMode ? [undefined, { debugName: "icon_name" }] : /* istanbul ignore next */ []));
|
|
2836
|
+
/** Visible label and accessible name. Keep it short so chips fit in a row. */
|
|
1769
2837
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2838
|
+
/**
|
|
2839
|
+
* Disables the chip. Bind it even when using reactive forms: disabling the
|
|
2840
|
+
* form control alone does not disable the chip.
|
|
2841
|
+
*/
|
|
1770
2842
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2843
|
+
/**
|
|
2844
|
+
* Checkbox chips: the id of an element that describes the chip, such as an
|
|
2845
|
+
* error message. Radio chips: avoid. The id is also given to the chip's own
|
|
2846
|
+
* empty hint element, so it duplicates the id of the element you meant.
|
|
2847
|
+
*/
|
|
1771
2848
|
ariaDescribedBy = input(...(ngDevMode ? [undefined, { debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []));
|
|
1772
|
-
|
|
2849
|
+
/**
|
|
2850
|
+
* Checkbox chips only. Sets the native `required` attribute for the error
|
|
2851
|
+
* styling; add `Validators.requiredTrue` to the form control as well.
|
|
2852
|
+
*/
|
|
1773
2853
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
1774
|
-
|
|
2854
|
+
/**
|
|
2855
|
+
* Radio chips only. Native group name: give every chip in a set the same
|
|
2856
|
+
* `name`, unique on the page.
|
|
2857
|
+
*/
|
|
1775
2858
|
name = input('Radio Group', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2859
|
+
/**
|
|
2860
|
+
* Radio chips: the value this chip gives the form control when selected.
|
|
2861
|
+
* Checkbox chips: holds the checked state after the user toggles it, but
|
|
2862
|
+
* binding `true` does not check the chip; set the form control's value
|
|
2863
|
+
* instead.
|
|
2864
|
+
*/
|
|
1776
2865
|
value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2866
|
+
/**
|
|
2867
|
+
* Emits on user selection: the chip's `value` for radio chips, the new checked
|
|
2868
|
+
* state for checkbox chips.
|
|
2869
|
+
*/
|
|
1777
2870
|
didChange = output();
|
|
1778
2871
|
idGenerator = inject(IdGeneratorService);
|
|
2872
|
+
/** @ignore */
|
|
1779
2873
|
id = signal(this.idGenerator.generateId('chip'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2874
|
+
/** @ignore */
|
|
1780
2875
|
selectedValue = signal(undefined, ...(ngDevMode ? [{ debugName: "selectedValue" }] : /* istanbul ignore next */ []));
|
|
2876
|
+
/** @ignore */
|
|
1781
2877
|
onChange = () => undefined;
|
|
2878
|
+
/** @ignore */
|
|
1782
2879
|
onTouched = () => undefined;
|
|
1783
2880
|
/**
|
|
1784
2881
|
* CVA - Write value
|
|
1785
2882
|
* @param {string | boolean} value
|
|
2883
|
+
* @ignore
|
|
1786
2884
|
*/
|
|
1787
2885
|
writeValue(value) {
|
|
1788
2886
|
this.selectedValue.set(value);
|
|
@@ -1790,6 +2888,7 @@ class ChipComponent {
|
|
|
1790
2888
|
/**
|
|
1791
2889
|
* CVA - Register on change
|
|
1792
2890
|
* @param {() => void} fn
|
|
2891
|
+
* @ignore
|
|
1793
2892
|
*/
|
|
1794
2893
|
registerOnChange(fn) {
|
|
1795
2894
|
this.onChange = fn;
|
|
@@ -1797,6 +2896,7 @@ class ChipComponent {
|
|
|
1797
2896
|
/**
|
|
1798
2897
|
* CVA - Register on touched
|
|
1799
2898
|
* @param {() => void} fn
|
|
2899
|
+
* @ignore
|
|
1800
2900
|
*/
|
|
1801
2901
|
registerOnTouched(fn) {
|
|
1802
2902
|
this.onTouched = fn;
|
|
@@ -1804,6 +2904,7 @@ class ChipComponent {
|
|
|
1804
2904
|
/**
|
|
1805
2905
|
* On modal interaction and change
|
|
1806
2906
|
* @param event
|
|
2907
|
+
* @ignore
|
|
1807
2908
|
*/
|
|
1808
2909
|
onModalChange(event) {
|
|
1809
2910
|
this.value.set(event);
|
|
@@ -1845,19 +2946,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1845
2946
|
}]
|
|
1846
2947
|
}] });
|
|
1847
2948
|
|
|
2949
|
+
/**
|
|
2950
|
+
* The page-width wrapper (`<ui-container>`). Use it once per page section to
|
|
2951
|
+
* align content to the site grid: it centres the content, caps its width at
|
|
2952
|
+
* each breakpoint (767px on tablet, 1080px on laptop, 1440px on desktop; full
|
|
2953
|
+
* width on mobile) and adds the side gutters (small up to laptop, large from
|
|
2954
|
+
* laptop up; gutter sizes are brand tokens).
|
|
2955
|
+
*
|
|
2956
|
+
* It has no background, padding top/bottom or layout of its own. For a
|
|
2957
|
+
* full-bleed coloured band, put the container inside a
|
|
2958
|
+
* `<ui-box [box_content_fill_width]="true">` with the background, not the
|
|
2959
|
+
* other way round. Lay out the content inside with `<ui-grid>` or
|
|
2960
|
+
* `<ui-stack>`.
|
|
2961
|
+
*
|
|
2962
|
+
* Don't nest containers: the gutters add up.
|
|
2963
|
+
*
|
|
2964
|
+
* @import import { OasysLayoutContainerComponent } from 'oasys-lib';
|
|
2965
|
+
*/
|
|
1848
2966
|
class LayoutContainerComponent {
|
|
1849
2967
|
changes = inject(ChangeDetectorRef);
|
|
2968
|
+
/**
|
|
2969
|
+
* Span the full viewport width instead of stopping at the breakpoint widths.
|
|
2970
|
+
* The gutters still apply unless `container_gutter` is off. Bind a boolean:
|
|
2971
|
+
* `[container_fluid]="true"`.
|
|
2972
|
+
*/
|
|
1850
2973
|
container_fluid = false;
|
|
2974
|
+
/**
|
|
2975
|
+
* Side gutters. Turn off (`[container_gutter]="false"`) when the content
|
|
2976
|
+
* must touch the container edges, e.g. an edge-to-edge image carousel.
|
|
2977
|
+
*/
|
|
1851
2978
|
container_gutter = true;
|
|
2979
|
+
/** @ignore */
|
|
1852
2980
|
prefix = 'ui-layout-container';
|
|
2981
|
+
/** @ignore */
|
|
1853
2982
|
containerLayoutClasses;
|
|
2983
|
+
/** @ignore */
|
|
1854
2984
|
containerGutterNameLarge;
|
|
2985
|
+
/** @ignore */
|
|
1855
2986
|
containerGutterNameSmall;
|
|
2987
|
+
/** @ignore */
|
|
1856
2988
|
containerHorizontalSizes;
|
|
2989
|
+
/** @ignore */
|
|
1857
2990
|
ngOnChanges() {
|
|
1858
2991
|
this.ngOnInit();
|
|
1859
2992
|
this.changes.markForCheck();
|
|
1860
2993
|
}
|
|
2994
|
+
/** @ignore */
|
|
1861
2995
|
ngOnInit() {
|
|
1862
2996
|
this.containerLayoutClasses = [
|
|
1863
2997
|
this.prefix,
|
|
@@ -1883,14 +3017,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1883
3017
|
type: Input
|
|
1884
3018
|
}] } });
|
|
1885
3019
|
|
|
3020
|
+
/**
|
|
3021
|
+
* One column of a `<ui-grid>` (`<ui-column>`). Only use it as a direct child
|
|
3022
|
+
* of `<ui-grid>`; it has no effect anywhere else.
|
|
3023
|
+
*
|
|
3024
|
+
* `columns` sets how many grid tracks it spans (out of 12, or the grid's
|
|
3025
|
+
* `grid_base`) and `column_inset` how many tracks to skip before it. Both take
|
|
3026
|
+
* a number, or an object per device for responsive layouts:
|
|
3027
|
+
* `[columns]="{ mobile: 12, tablet: 6, laptop: 4, desktop: 4 }"`. A device you
|
|
3028
|
+
* leave out of the object spans the full 12 tracks.
|
|
3029
|
+
*
|
|
3030
|
+
* Columns that add up to more than a row wrap onto the next row. The column
|
|
3031
|
+
* is only a grid cell: put a `<ui-box>` or `<ui-stack>` inside for padding,
|
|
3032
|
+
* background and spacing.
|
|
3033
|
+
*
|
|
3034
|
+
* @import import { OasysLayoutGridColumnComponent } from 'oasys-lib';
|
|
3035
|
+
* @knownIssue `column_inset` is silently ignored unless it has the same shape
|
|
3036
|
+
* as `columns`: a number inset needs a number `columns`, and each device key
|
|
3037
|
+
* in an inset object needs the same key in the `columns` object. Workaround:
|
|
3038
|
+
* write both as numbers, or both as objects with the same device keys, e.g.
|
|
3039
|
+
* `[columns]="{ mobile: 12, tablet: 6, laptop: 6, desktop: 6 }"` with
|
|
3040
|
+
* `[column_inset]="{ mobile: 0, tablet: 3, laptop: 3, desktop: 3 }"`.
|
|
3041
|
+
*/
|
|
1886
3042
|
class LayoutGridColumnComponent {
|
|
1887
3043
|
changes = inject(ChangeDetectorRef);
|
|
3044
|
+
/** @ignore */
|
|
1888
3045
|
didFirstInit = false;
|
|
3046
|
+
/** @ignore */
|
|
1889
3047
|
prefix = 'ui-layout-column';
|
|
3048
|
+
/** @ignore */
|
|
1890
3049
|
columnLayoutClasses;
|
|
3050
|
+
/**
|
|
3051
|
+
* Tracks to span: 1–12 (or up to the grid's `grid_base`), or an object per
|
|
3052
|
+
* device (`mobile`, `tablet`, `laptop`, `desktop`). `mobile` only applies
|
|
3053
|
+
* when the grid has `grid_collapse_below="none"`. Defaults to 12 (full
|
|
3054
|
+
* width).
|
|
3055
|
+
*/
|
|
1891
3056
|
columns = 12;
|
|
3057
|
+
/**
|
|
3058
|
+
* Tracks to leave empty before the column (1–11; `0` for none), to centre or
|
|
3059
|
+
* indent content. Must match the shape of `columns` (see known issues).
|
|
3060
|
+
*/
|
|
1892
3061
|
column_inset;
|
|
3062
|
+
/** @ignore */
|
|
1893
3063
|
grid_base;
|
|
3064
|
+
/** @ignore */
|
|
1894
3065
|
getSizeClasses(columns, classString) {
|
|
1895
3066
|
if (!columns) {
|
|
1896
3067
|
return [''];
|
|
@@ -1902,6 +3073,7 @@ class LayoutGridColumnComponent {
|
|
|
1902
3073
|
}
|
|
1903
3074
|
return [this.prefix, `${this.prefix}${classString}${columns}`];
|
|
1904
3075
|
}
|
|
3076
|
+
/** @ignore */
|
|
1905
3077
|
ngOnChanges() {
|
|
1906
3078
|
if (!this.didFirstInit) {
|
|
1907
3079
|
return;
|
|
@@ -1909,6 +3081,7 @@ class LayoutGridColumnComponent {
|
|
|
1909
3081
|
this.ngOnInit();
|
|
1910
3082
|
this.changes.markForCheck();
|
|
1911
3083
|
}
|
|
3084
|
+
/** @ignore */
|
|
1912
3085
|
ngOnInit() {
|
|
1913
3086
|
this.columnLayoutClasses = [
|
|
1914
3087
|
this.prefix,
|
|
@@ -1933,26 +3106,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1933
3106
|
type: Input
|
|
1934
3107
|
}] } });
|
|
1935
3108
|
|
|
3109
|
+
/**
|
|
3110
|
+
* A column grid (`<ui-grid>`) for side-by-side layouts: product grids, a
|
|
3111
|
+
* content column next to a sidebar, equal cards in a row. Its children must be
|
|
3112
|
+
* `<ui-column>`s, each saying how many tracks it spans.
|
|
3113
|
+
*
|
|
3114
|
+
* - Default: a 12-track CSS grid. Columns span 12 (full width) unless you set
|
|
3115
|
+
* `columns`, and wrap onto the next row when a row is full.
|
|
3116
|
+
* - `grid_base`: change the number of tracks, e.g. `[grid_base]="3"` with
|
|
3117
|
+
* `[columns]="1"` on each column for a three-up product grid.
|
|
3118
|
+
* - `grid_auto`: equal-width columns on one row, however many there are.
|
|
3119
|
+
*
|
|
3120
|
+
* Below `grid_collapse_below` (`tablet` by default, so on mobile) the grid
|
|
3121
|
+
* becomes a single vertical column and every `columns` / `column_inset` value
|
|
3122
|
+
* is ignored. To control mobile spans, set `grid_collapse_below="none"` and
|
|
3123
|
+
* give each column a `mobile` value.
|
|
3124
|
+
*
|
|
3125
|
+
* Use `<ui-stack>` instead for a single row or column of items that just need
|
|
3126
|
+
* even spacing. To expose a grid as a list, put `role="list"` on a wrapping
|
|
3127
|
+
* element and `role="listitem"` on each `<ui-column>`.
|
|
3128
|
+
*
|
|
3129
|
+
* @import import { OasysLayoutGridComponent } from 'oasys-lib';
|
|
3130
|
+
*/
|
|
1936
3131
|
class LayoutGridComponent {
|
|
1937
3132
|
changes = inject(ChangeDetectorRef);
|
|
3133
|
+
/**
|
|
3134
|
+
* Give every column an equal share of one row, ignoring `columns`,
|
|
3135
|
+
* `column_inset` and `grid_base`. Columns never wrap, so keep the count
|
|
3136
|
+
* small. Bind a boolean: `[grid_auto]="true"`.
|
|
3137
|
+
*/
|
|
1938
3138
|
grid_auto = false;
|
|
3139
|
+
/**
|
|
3140
|
+
* Below this breakpoint the columns stack into one vertical column:
|
|
3141
|
+
* `tablet` (under 767px), `laptop` (under 1080px) or `desktop` (under
|
|
3142
|
+
* 1440px). `none` keeps the grid at every size, which is required for
|
|
3143
|
+
* per-device `mobile` spans and for multi-column grids on mobile.
|
|
3144
|
+
*/
|
|
1939
3145
|
grid_collapse_below = 'tablet';
|
|
3146
|
+
/**
|
|
3147
|
+
* Space between columns and rows. Values are brand spacing tokens: `near`
|
|
3148
|
+
* and `default` are larger on bloomon than on Bloom & Wild.
|
|
3149
|
+
*/
|
|
1940
3150
|
grid_gap = 'default';
|
|
3151
|
+
/**
|
|
3152
|
+
* Number of tracks. Columns and insets count in these tracks, so with
|
|
3153
|
+
* `[grid_base]="4"` a column of `[columns]="1"` is a quarter. Set `columns`
|
|
3154
|
+
* on every column when the base is under 12: the default span of 12 would
|
|
3155
|
+
* overflow it. Spans above 12 and insets above 11 are not supported.
|
|
3156
|
+
*/
|
|
1941
3157
|
grid_base = 12;
|
|
3158
|
+
/** @ignore */
|
|
1942
3159
|
didFirstInit = false;
|
|
3160
|
+
/** @ignore */
|
|
1943
3161
|
prefix = 'ui-layout-grid';
|
|
3162
|
+
/** @ignore */
|
|
1944
3163
|
gridLayoutClasses;
|
|
3164
|
+
/** @ignore */
|
|
1945
3165
|
get gridTemplateColumns() {
|
|
1946
3166
|
if (this.grid_auto)
|
|
1947
3167
|
return null;
|
|
1948
3168
|
return `repeat(${this.grid_base}, 1fr)`;
|
|
1949
3169
|
}
|
|
3170
|
+
/** @ignore */
|
|
1950
3171
|
ngOnChanges() {
|
|
1951
3172
|
if (!this.didFirstInit)
|
|
1952
3173
|
return;
|
|
1953
3174
|
this.ngOnInit();
|
|
1954
3175
|
this.changes.markForCheck();
|
|
1955
3176
|
}
|
|
3177
|
+
/** @ignore */
|
|
1956
3178
|
ngOnInit() {
|
|
1957
3179
|
this.gridLayoutClasses = [
|
|
1958
3180
|
this.prefix,
|
|
@@ -2015,12 +3237,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2015
3237
|
}]
|
|
2016
3238
|
}] });
|
|
2017
3239
|
|
|
3240
|
+
/**
|
|
3241
|
+
* Inline validation message for one form field (`<ui-form-errors>`). Project it
|
|
3242
|
+
* inside `<ui-text-input>`, `<ui-textarea>` or `<ui-combobox>`; the field shows
|
|
3243
|
+
* it below the input, styles the field as invalid and hides it while the user
|
|
3244
|
+
* is typing.
|
|
3245
|
+
*
|
|
3246
|
+
* Only `<ui-text-input>` and `<ui-textarea>` link the message to their input
|
|
3247
|
+
* with `aria-describedby` (once the user has left the field). `<ui-combobox>`
|
|
3248
|
+
* shows it but does not link it, so screen readers do not read it with the
|
|
3249
|
+
* field. `<ui-checkbox>` and `<ui-radio>` have no slot for it.
|
|
3250
|
+
*
|
|
3251
|
+
* Bind `errors` to the control's errors and `error_messages` to a map of
|
|
3252
|
+
* translated messages keyed by validator name (`required`, `email`,
|
|
3253
|
+
* `minlength`, `pattern`, or your custom validator's key). Only the message for
|
|
3254
|
+
* the first error key is shown, so put the most important validator first. If
|
|
3255
|
+
* that key has no message, nothing is rendered.
|
|
3256
|
+
*
|
|
3257
|
+
* Write messages that say how to fix the problem ("Enter an email address like
|
|
3258
|
+
* name@example.com"), not just that something is wrong.
|
|
3259
|
+
*
|
|
3260
|
+
* It renders plain text with no ARIA role or live region. Outside a form field
|
|
3261
|
+
* it is always visible while `errors` is set.
|
|
3262
|
+
*
|
|
3263
|
+
* @import import { OasysFormErrorsComponent } from 'oasys-lib';
|
|
3264
|
+
*/
|
|
2018
3265
|
class FormErrorsComponent {
|
|
3266
|
+
/** The control's current errors, e.g. `form.get('email')?.errors`. `null` renders nothing. */
|
|
2019
3267
|
errors = input(null, ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
3268
|
+
/** Translated messages keyed by validator error key, e.g. `{ required: 'Enter your email address', email: 'Enter a valid email address' }`. */
|
|
2020
3269
|
error_messages = input({}, ...(ngDevMode ? [{ debugName: "error_messages" }] : /* istanbul ignore next */ []));
|
|
3270
|
+
/** @ignore */
|
|
2021
3271
|
errorMessage = computed(() => {
|
|
2022
3272
|
const currentErrors = this.errors();
|
|
2023
|
-
const messages = this.error_messages()
|
|
3273
|
+
const messages = this.error_messages() ?? {};
|
|
2024
3274
|
if (!currentErrors) {
|
|
2025
3275
|
return undefined;
|
|
2026
3276
|
}
|
|
@@ -2050,26 +3300,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2050
3300
|
}]
|
|
2051
3301
|
}] });
|
|
2052
3302
|
|
|
3303
|
+
/**
|
|
3304
|
+
* A section or page heading (`<ui-heading>`) with an optional surtitle above
|
|
3305
|
+
* and subtitle below. Use it for headings that introduce a page or section;
|
|
3306
|
+
* for a one-off bold line inside a component, a text class such as
|
|
3307
|
+
* `text-heading--functional--secondary` on a `<p>` is enough.
|
|
3308
|
+
*
|
|
3309
|
+
* Visual style (`heading_type`) and HTML level (`heading_level`) are
|
|
3310
|
+
* independent: pick the style from the design and the level from the page
|
|
3311
|
+
* outline.
|
|
3312
|
+
* - The title renders as an `<h2>` by default. Use `h1` only for the main
|
|
3313
|
+
* title of the page, when there is no other `<h1>`. Use `h3` for a heading
|
|
3314
|
+
* inside a section that already has an `<h2>`. Don't skip levels.
|
|
3315
|
+
* - The subtitle renders as a heading one level below the title (an `<h2>`
|
|
3316
|
+
* title gets an `<h3>` subtitle), so it appears in the document outline. It
|
|
3317
|
+
* accepts simple HTML (sanitised by Angular).
|
|
3318
|
+
* - The surtitle is a plain `<p>`.
|
|
3319
|
+
*
|
|
3320
|
+
* Alignment comes from the brand: `hero`, `primary` and `secondary` headings
|
|
3321
|
+
* are centred on Bloom & Wild and Bergamotte and start-aligned on bloomon;
|
|
3322
|
+
* `functional-*` headings are start-aligned everywhere. Use
|
|
3323
|
+
* `heading_alignment_override` to force one.
|
|
3324
|
+
*
|
|
3325
|
+
* Text colour is inherited, so inside a dark `<ui-box>` that already switches
|
|
3326
|
+
* to on-dark text the heading follows. Set `heading_on_dark` when the heading
|
|
3327
|
+
* sits on a dark surface that does not, such as an image.
|
|
3328
|
+
*
|
|
3329
|
+
* @import import { OasysHeadingComponent } from 'oasys-lib';
|
|
3330
|
+
* @knownIssue The string `"false"` on `heading_on_dark` turns on-dark
|
|
3331
|
+
* (light) text on. Workaround: bind a real boolean, for example
|
|
3332
|
+
* `[heading_on_dark]="true"`, or leave the input out.
|
|
3333
|
+
* @knownIssue The heading level, alignment and spacing are worked out once,
|
|
3334
|
+
* on first render, so later changes to `heading_level`, `heading_priority`,
|
|
3335
|
+
* `heading_seo_priority`, `heading_alignment_override` or `heading_type` do
|
|
3336
|
+
* not update them. Workaround: set these inputs to their final values before
|
|
3337
|
+
* the heading renders, or re-create the heading (for example with `@if`) when
|
|
3338
|
+
* they need to change.
|
|
3339
|
+
*/
|
|
2053
3340
|
class OasysHeadingComponent {
|
|
2054
3341
|
tokenService = inject(TokenService);
|
|
3342
|
+
/**
|
|
3343
|
+
* Visual style. `hero` for the largest page-top moment, `primary` for page
|
|
3344
|
+
* titles, `secondary` for section titles, `functional-primary` and
|
|
3345
|
+
* `functional-secondary` for compact UI headings such as card or form
|
|
3346
|
+
* titles. Does not change the HTML level.
|
|
3347
|
+
*/
|
|
2055
3348
|
heading_type = 'primary';
|
|
3349
|
+
/**
|
|
3350
|
+
* Use light text for a dark background. Only needed when the heading is not
|
|
3351
|
+
* inside a dark `<ui-box>` that already sets on-dark text. Bind a real
|
|
3352
|
+
* boolean: the string `"false"` turns it on.
|
|
3353
|
+
*/
|
|
2056
3354
|
heading_on_dark;
|
|
3355
|
+
/** The heading text. Plain text only. */
|
|
2057
3356
|
heading_title;
|
|
3357
|
+
/** Legacy way to render an `<h1>`. Prefer `heading_level="h1"`. */
|
|
2058
3358
|
heading_seo_priority = false;
|
|
3359
|
+
/**
|
|
3360
|
+
* Legacy numeric level (1 to 6). Prefer `heading_level`; only use this for
|
|
3361
|
+
* `h4` to `h6`, which `heading_level` does not offer. `heading_level` wins
|
|
3362
|
+
* when both are set.
|
|
3363
|
+
*/
|
|
2059
3364
|
heading_priority;
|
|
3365
|
+
/** Force `start` or `center` alignment instead of the brand default for this `heading_type`. */
|
|
2060
3366
|
heading_alignment_override;
|
|
3367
|
+
/**
|
|
3368
|
+
* Supporting text below the title. Rendered as a heading one level below the
|
|
3369
|
+
* title (a `<p>` under an `<h6>`). Accepts simple HTML such as links or a
|
|
3370
|
+
* list (sanitised by Angular).
|
|
3371
|
+
*/
|
|
2061
3372
|
heading_subtitle = '';
|
|
3373
|
+
/** Small text above the title, such as a category or eyebrow label. Rendered as a `<p>`. */
|
|
2062
3374
|
heading_surtitle = '';
|
|
3375
|
+
/**
|
|
3376
|
+
* HTML level of the title: `h2` by default. Use `h1` only for the page's
|
|
3377
|
+
* main title and `h3` under an existing `<h2>`. Takes precedence over
|
|
3378
|
+
* `heading_priority` and `heading_seo_priority`.
|
|
3379
|
+
*/
|
|
2063
3380
|
heading_level;
|
|
3381
|
+
/** @ignore */
|
|
2064
3382
|
computed_heading_level;
|
|
3383
|
+
/** @ignore */
|
|
2065
3384
|
headingAlignment;
|
|
3385
|
+
/** @ignore */
|
|
2066
3386
|
headingGap;
|
|
3387
|
+
/** @ignore */
|
|
2067
3388
|
get class() {
|
|
2068
3389
|
return `
|
|
2069
3390
|
${this.heading_on_dark ? 'text-color--on-dark' : ''}
|
|
2070
3391
|
ui-heading-alignment-${this.headingAlignment}
|
|
2071
3392
|
`;
|
|
2072
3393
|
}
|
|
3394
|
+
/** @ignore */
|
|
2073
3395
|
setComputedHeadingLevel() {
|
|
2074
3396
|
if (this.heading_level) {
|
|
2075
3397
|
this.computed_heading_level = this.heading_level;
|
|
@@ -2084,9 +3406,11 @@ class OasysHeadingComponent {
|
|
|
2084
3406
|
this.computed_heading_level = 'h2';
|
|
2085
3407
|
}
|
|
2086
3408
|
}
|
|
3409
|
+
/** @ignore */
|
|
2087
3410
|
headingTypeIsFunctional(headingType) {
|
|
2088
3411
|
return (headingType || '').indexOf('functional') !== -1;
|
|
2089
3412
|
}
|
|
3413
|
+
/** @ignore */
|
|
2090
3414
|
setupHeadingStackAlignment(headingType) {
|
|
2091
3415
|
if (this.heading_alignment_override) {
|
|
2092
3416
|
this.headingAlignment = this.heading_alignment_override;
|
|
@@ -2098,6 +3422,7 @@ class OasysHeadingComponent {
|
|
|
2098
3422
|
? functionalAlignment
|
|
2099
3423
|
: alignment;
|
|
2100
3424
|
}
|
|
3425
|
+
/** @ignore */
|
|
2101
3426
|
setupHeadingStackGap(headingType) {
|
|
2102
3427
|
if (this.headingTypeIsFunctional(headingType)) {
|
|
2103
3428
|
this.headingGap = this.tokenService.getTokenValue('--oasys-component-heading-gap-functional');
|
|
@@ -2114,6 +3439,7 @@ class OasysHeadingComponent {
|
|
|
2114
3439
|
// Hero gap
|
|
2115
3440
|
this.headingGap = this.tokenService.getTokenValue('--oasys-component-heading-gap-default');
|
|
2116
3441
|
}
|
|
3442
|
+
/** @ignore */
|
|
2117
3443
|
ngOnInit() {
|
|
2118
3444
|
this.setupHeadingStackAlignment(this.heading_type);
|
|
2119
3445
|
this.setupHeadingStackGap(this.heading_type);
|
|
@@ -2162,41 +3488,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2162
3488
|
}]
|
|
2163
3489
|
}] });
|
|
2164
3490
|
|
|
3491
|
+
/**
|
|
3492
|
+
* A page or section hero (`<ui-hero>`): a heading block with up to two CTAs
|
|
3493
|
+
* on one side and a large image (or projected video) on the other. Use it at
|
|
3494
|
+
* the top of landing and campaign pages, usually driven by CMS content.
|
|
3495
|
+
*
|
|
3496
|
+
* Layout: a 5/7 two-column grid that collapses to one column below tablet.
|
|
3497
|
+
* Text sits left and media right by default (`image_left_desktop` swaps them);
|
|
3498
|
+
* on mobile the image sits on top by default (`image_top_mobile`).
|
|
3499
|
+
*
|
|
3500
|
+
* Content:
|
|
3501
|
+
* - The heading block is an `<ui-heading>` built from `heading_surtitle`,
|
|
3502
|
+
* `heading_title` and `heading_subtitle`. `heading_subtitle` is rendered as
|
|
3503
|
+
* HTML and as a heading one level below the title.
|
|
3504
|
+
* - CTAs are `<ui-button>` links: the primary shows when `primary_cta_text`
|
|
3505
|
+
* is set, the secondary only when both CTA texts are set. Always set the
|
|
3506
|
+
* matching `href_*` too; the hero has no click output.
|
|
3507
|
+
* - `media_type="video"` hides the image and projects your content into the
|
|
3508
|
+
* media column instead.
|
|
3509
|
+
* - The image is a native `<picture>` with Contentful-style query parameters
|
|
3510
|
+
* (`?w=&h=&fm=webp&q=`) appended to `image`, not `<ui-image>`. Pass a bare
|
|
3511
|
+
* image URL without its own query string. It loads with high fetch priority.
|
|
3512
|
+
*
|
|
3513
|
+
* Accessibility:
|
|
3514
|
+
* - The title is an `h1` by default. Keep it only when the hero is the top of
|
|
3515
|
+
* the page and nothing else on the page is an `h1`. Use `h2` when the hero
|
|
3516
|
+
* titles a section under an existing `h1`, and `h3` under an `h2`.
|
|
3517
|
+
* - Set `alt_text` for the image; use `''` only when the image is purely
|
|
3518
|
+
* decorative. See [W3C guidance on informative images](https://www.w3.org/WAI/tutorials/images/informative/).
|
|
3519
|
+
* - On a dark brand background, text and buttons switch to their on-dark
|
|
3520
|
+
* styles automatically. With `non_brand_background_colour` they do not:
|
|
3521
|
+
* set `text_on_dark_override="true"` for dark custom colours.
|
|
3522
|
+
*
|
|
3523
|
+
* Requires a `ROUTING_HANDLER` (the CTAs are links).
|
|
3524
|
+
*
|
|
3525
|
+
* @import import { OasysHeroComponent } from 'oasys-lib';
|
|
3526
|
+
* @knownIssue When `alt_text` is not set, the hero image renders with no `alt`
|
|
3527
|
+
* attribute at all, so screen readers may announce the file name. Workaround:
|
|
3528
|
+
* always set `alt_text`, using `alt_text=""` for a purely decorative image.
|
|
3529
|
+
* @knownIssue A CTA whose `href_primary_cta` / `href_secondary_cta` is empty
|
|
3530
|
+
* renders as a `<button>` that does nothing, because the hero has no click
|
|
3531
|
+
* output. Workaround: only set `primary_cta_text` / `secondary_cta_text` when
|
|
3532
|
+
* you also set the matching href.
|
|
3533
|
+
* @knownIssue `non_brand_background_colour` is applied once, after the first
|
|
3534
|
+
* render; later changes are ignored. Workaround: set it once up front, or
|
|
3535
|
+
* re-create the hero (for example with `@if`) when the colour changes.
|
|
3536
|
+
*/
|
|
2165
3537
|
class HeroComponent {
|
|
2166
3538
|
tokenService = inject(TokenService);
|
|
3539
|
+
/** @ignore */
|
|
2167
3540
|
herobox;
|
|
2168
|
-
|
|
3541
|
+
/** Minimum height of the hero in pixels. Unset lets the content decide. */
|
|
2169
3542
|
min_container_height;
|
|
3543
|
+
/** Put the media on the left and the text on the right from tablet up. */
|
|
2170
3544
|
image_left_desktop = false;
|
|
3545
|
+
/** On mobile (single column), show the media above the text. */
|
|
2171
3546
|
image_top_mobile = true;
|
|
3547
|
+
/**
|
|
3548
|
+
* Brand background for the whole hero. Dark backgrounds automatically switch
|
|
3549
|
+
* the heading and CTAs to their on-dark styles.
|
|
3550
|
+
*/
|
|
2172
3551
|
background_colour;
|
|
3552
|
+
/**
|
|
3553
|
+
* Any CSS colour, applied as an inline background over `background_colour`.
|
|
3554
|
+
* For content-authored colours that are not in the brand palette. Text does
|
|
3555
|
+
* not adapt: pair a dark colour with `text_on_dark_override="true"`. Read
|
|
3556
|
+
* once after the first render.
|
|
3557
|
+
*/
|
|
2173
3558
|
non_brand_background_colour;
|
|
2174
|
-
|
|
3559
|
+
/** The hero title. Rendered at `heading_level`. */
|
|
2175
3560
|
heading_title;
|
|
3561
|
+
/**
|
|
3562
|
+
* Supporting copy under the title. Rendered as HTML, as a heading one level
|
|
3563
|
+
* below the title (an `h2` under the default `h1`).
|
|
3564
|
+
*/
|
|
2176
3565
|
heading_subtitle;
|
|
3566
|
+
/** Short eyebrow text above the title, such as "New season". */
|
|
2177
3567
|
heading_surtitle;
|
|
3568
|
+
/** Label of the primary CTA. The CTA (and the secondary one) only renders when this is set. */
|
|
2178
3569
|
primary_cta_text;
|
|
3570
|
+
/** Label of the secondary CTA. Ignored unless `primary_cta_text` is also set. */
|
|
2179
3571
|
secondary_cta_text;
|
|
3572
|
+
/**
|
|
3573
|
+
* Image URL, without its own query string: width, height, format and quality
|
|
3574
|
+
* parameters are appended for each breakpoint. Used when `media_type` is `image`.
|
|
3575
|
+
*/
|
|
2180
3576
|
image;
|
|
3577
|
+
/** Alt text for the image. Always set it; use `''` only for a purely decorative image. */
|
|
2181
3578
|
alt_text;
|
|
3579
|
+
/**
|
|
3580
|
+
* `image` renders `image`. `video` renders nothing itself: project the video
|
|
3581
|
+
* (with its own accessible controls and text alternative) as content.
|
|
3582
|
+
*/
|
|
2182
3583
|
media_type = 'image';
|
|
3584
|
+
/**
|
|
3585
|
+
* Set to the string `'true'` to force on-dark text and inverse CTAs, for
|
|
3586
|
+
* dark `non_brand_background_colour` values. Any other value, including the
|
|
3587
|
+
* boolean `true`, is ignored.
|
|
3588
|
+
*/
|
|
2183
3589
|
text_on_dark_override;
|
|
3590
|
+
/**
|
|
3591
|
+
* Heading level of the title; the subtitle takes the next level down. Keep
|
|
3592
|
+
* `h1` only when the hero is the top of the page and there is no other `h1`.
|
|
3593
|
+
* Use `h2` under an existing `h1`, `h3` under an `h2`.
|
|
3594
|
+
*/
|
|
2184
3595
|
heading_level = 'h1';
|
|
2185
|
-
|
|
3596
|
+
/** Destination of the primary CTA. Required whenever `primary_cta_text` is set. */
|
|
2186
3597
|
href_primary_cta = '';
|
|
3598
|
+
/** Destination of the secondary CTA. Required whenever `secondary_cta_text` is set. */
|
|
2187
3599
|
href_secondary_cta = '';
|
|
2188
|
-
|
|
3600
|
+
/** @ignore */
|
|
2189
3601
|
heroCtaAlignment;
|
|
3602
|
+
/** @ignore */
|
|
2190
3603
|
heroInsetSpaceSmall;
|
|
3604
|
+
/** @ignore */
|
|
2191
3605
|
heroInsetSpaceLarge;
|
|
3606
|
+
/** @ignore */
|
|
2192
3607
|
setNonBrandBackgroundColour() {
|
|
2193
3608
|
this.herobox.nativeElement.style.background = this.non_brand_background_colour;
|
|
2194
3609
|
}
|
|
3610
|
+
/** @ignore */
|
|
2195
3611
|
ngAfterViewInit() {
|
|
2196
3612
|
if (this.non_brand_background_colour) {
|
|
2197
3613
|
this.setNonBrandBackgroundColour();
|
|
2198
3614
|
}
|
|
2199
3615
|
}
|
|
3616
|
+
/** @ignore */
|
|
2200
3617
|
ngOnInit() {
|
|
2201
3618
|
this.heroCtaAlignment = this.tokenService.getTokenValue('--oasys-component-hero-actions-alignment');
|
|
2202
3619
|
this.heroInsetSpaceSmall = this.tokenService.getTokenValue('--oasys-component-hero-inset-spacing-small');
|
|
@@ -2296,27 +3713,102 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2296
3713
|
}]
|
|
2297
3714
|
}] });
|
|
2298
3715
|
|
|
3716
|
+
/**
|
|
3717
|
+
* A ready-made content block (`<ui-section>`): an image beside a heading,
|
|
3718
|
+
* optional subtitle and up to two text links, on a brand or custom
|
|
3719
|
+
* background. Use it for editorial and promotional bands (the CMS "story
|
|
3720
|
+
* block"); build anything else from `<ui-box>`, `<ui-grid>` and `<ui-stack>`.
|
|
3721
|
+
*
|
|
3722
|
+
* Two looks, set by `section_type`:
|
|
3723
|
+
* - `inform` (default): padded block, functional heading, links aligned to
|
|
3724
|
+
* the start.
|
|
3725
|
+
* - `spotlight`: image runs to the block's edge, larger heading, content and
|
|
3726
|
+
* links centred.
|
|
3727
|
+
*
|
|
3728
|
+
* From tablet up the image and the content take half the width each; on
|
|
3729
|
+
* mobile the image sits above the content. Without `image` the content still
|
|
3730
|
+
* only takes half the width. The image aspect ratio and padding come from
|
|
3731
|
+
* brand tokens, so they differ between brands (e.g. square spotlight images on
|
|
3732
|
+
* Bloom & Wild, 3:4 on bloomon).
|
|
3733
|
+
*
|
|
3734
|
+
* Accessibility: the title is always an `<h2>`, so place the section where a
|
|
3735
|
+
* second-level heading fits. Give `alt_text` for informative images and leave
|
|
3736
|
+
* it empty for decorative ones. Links render as standalone text links with
|
|
3737
|
+
* the CTA text as their accessible name, so make the text say where it goes.
|
|
3738
|
+
*
|
|
3739
|
+
* The consuming app must provide `IMAGE_URL_PROVIDER` (for the image) and
|
|
3740
|
+
* `ROUTING_HANDLER` (for the links).
|
|
3741
|
+
*
|
|
3742
|
+
* @import import { OasysSectionComponent } from 'oasys-lib';
|
|
3743
|
+
* @knownIssue `image_on_left` is inverted: from tablet up, `true` puts the
|
|
3744
|
+
* image on the right and the default (`false`) puts it on the left. On mobile
|
|
3745
|
+
* the image is always on top. Workaround: set `[image_on_left]="true"` when you
|
|
3746
|
+
* want the image on the right, and leave it unset for an image on the left.
|
|
3747
|
+
* @knownIssue Text does not switch to the on-dark colour on the current dark
|
|
3748
|
+
* brand backgrounds (`tertiary`, `quaternary`), and `text_on_dark_override`
|
|
3749
|
+
* only works with `non_brand_background_colour`. Workaround: use the
|
|
3750
|
+
* deprecated `core-tertiary` / `core-quaternary` names, which switch
|
|
3751
|
+
* automatically per brand.
|
|
3752
|
+
*/
|
|
2299
3753
|
class SectionComponent {
|
|
2300
|
-
|
|
3754
|
+
/**
|
|
3755
|
+
* Background from the brand palette (same values as `<ui-box>`'s
|
|
3756
|
+
* `box_background`). Leave unset for no background.
|
|
3757
|
+
*/
|
|
2301
3758
|
brand_background_colour = input(...(ngDevMode ? [undefined, { debugName: "brand_background_colour" }] : /* istanbul ignore next */ []));
|
|
3759
|
+
/**
|
|
3760
|
+
* Any CSS colour for a one-off, non-brand background (e.g. from the CMS).
|
|
3761
|
+
* Overrides `brand_background_colour`. Pair a dark colour with
|
|
3762
|
+
* `text_on_dark_override`.
|
|
3763
|
+
*/
|
|
2302
3764
|
non_brand_background_colour = input(...(ngDevMode ? [undefined, { debugName: "non_brand_background_colour" }] : /* istanbul ignore next */ []));
|
|
2303
|
-
|
|
3765
|
+
/**
|
|
3766
|
+
* Use on-dark (light) text. Only applies with `non_brand_background_colour`;
|
|
3767
|
+
* brand backgrounds pick the text colour from their tokens.
|
|
3768
|
+
*/
|
|
3769
|
+
text_on_dark_override = input(false, ...(ngDevMode ? [{ debugName: "text_on_dark_override" }] : /* istanbul ignore next */ []));
|
|
3770
|
+
/**
|
|
3771
|
+
* Swaps the image to the other side from tablet up. Inverted: `true` puts
|
|
3772
|
+
* the image on the right (see known issues).
|
|
3773
|
+
*/
|
|
2304
3774
|
image_on_left = input(false, ...(ngDevMode ? [{ debugName: "image_on_left" }] : /* istanbul ignore next */ []));
|
|
3775
|
+
/**
|
|
3776
|
+
* `inform` (default) for a padded, start-aligned block; `spotlight` for an
|
|
3777
|
+
* edge-to-edge image with a larger, centred heading and links.
|
|
3778
|
+
*/
|
|
2305
3779
|
section_type = input('inform', ...(ngDevMode ? [{ debugName: "section_type" }] : /* istanbul ignore next */ []));
|
|
2306
|
-
|
|
3780
|
+
/** The heading, rendered as an `<h2>`. */
|
|
2307
3781
|
heading_title = input(...(ngDevMode ? [undefined, { debugName: "heading_title" }] : /* istanbul ignore next */ []));
|
|
3782
|
+
/** Supporting text under the heading. */
|
|
2308
3783
|
heading_subtitle = input(...(ngDevMode ? [undefined, { debugName: "heading_subtitle" }] : /* istanbul ignore next */ []));
|
|
3784
|
+
/**
|
|
3785
|
+
* Text of the first link. Only shown when `href_primary_cta` is also set.
|
|
3786
|
+
* Describe the destination ("Shop birthday flowers", not "Click here").
|
|
3787
|
+
*/
|
|
2309
3788
|
primary_cta_text = input(...(ngDevMode ? [undefined, { debugName: "primary_cta_text" }] : /* istanbul ignore next */ []));
|
|
3789
|
+
/** Text of the second link. Only shown when `href_secondary_cta` is also set. */
|
|
2310
3790
|
secondary_cta_text = input(...(ngDevMode ? [undefined, { debugName: "secondary_cta_text" }] : /* istanbul ignore next */ []));
|
|
3791
|
+
/** Image URL. Without it the image column is not rendered. */
|
|
2311
3792
|
image = input(...(ngDevMode ? [undefined, { debugName: "image" }] : /* istanbul ignore next */ []));
|
|
3793
|
+
/**
|
|
3794
|
+
* Image alt text. Describe what the image shows when it adds information;
|
|
3795
|
+
* leave empty for a decorative image (it is then hidden from screen readers).
|
|
3796
|
+
*/
|
|
2312
3797
|
alt_text = input(...(ngDevMode ? [undefined, { debugName: "alt_text" }] : /* istanbul ignore next */ []));
|
|
2313
|
-
|
|
3798
|
+
/** URL for the first link. Required for `primary_cta_text` to show. */
|
|
2314
3799
|
href_primary_cta = input('', ...(ngDevMode ? [{ debugName: "href_primary_cta" }] : /* istanbul ignore next */ []));
|
|
3800
|
+
/** URL for the second link. Required for `secondary_cta_text` to show. */
|
|
2315
3801
|
href_secondary_cta = input('', ...(ngDevMode ? [{ debugName: "href_secondary_cta" }] : /* istanbul ignore next */ []));
|
|
2316
3802
|
tokenService = inject(TokenService);
|
|
3803
|
+
/** @ignore */
|
|
2317
3804
|
uiBoxId = computed(() => `ui-box-${Date.now()}-${Math.random()}`, ...(ngDevMode ? [{ debugName: "uiBoxId" }] : /* istanbul ignore next */ []));
|
|
3805
|
+
/** @ignore */
|
|
2318
3806
|
displayBrandBackgroundColour = computed(() => this.non_brand_background_colour() ? undefined : this.brand_background_colour(), ...(ngDevMode ? [{ debugName: "displayBrandBackgroundColour" }] : /* istanbul ignore next */ []));
|
|
2319
|
-
/**
|
|
3807
|
+
/**
|
|
3808
|
+
* Non-brand fills: honour override only. Brand fills: leave undefined so ui-box uses tokens.
|
|
3809
|
+
*
|
|
3810
|
+
* @ignore
|
|
3811
|
+
*/
|
|
2320
3812
|
textOnDark = computed(() => {
|
|
2321
3813
|
if (!this.non_brand_background_colour()) {
|
|
2322
3814
|
return undefined;
|
|
@@ -2324,10 +3816,15 @@ class SectionComponent {
|
|
|
2324
3816
|
const override = this.text_on_dark_override();
|
|
2325
3817
|
return override === true || override === 'true';
|
|
2326
3818
|
}, ...(ngDevMode ? [{ debugName: "textOnDark" }] : /* istanbul ignore next */ []));
|
|
3819
|
+
/** @ignore */
|
|
2327
3820
|
containerInsetSpaceSmall = computed(() => this.tokenService.getTokenValue(`--oasys-component-section-inset-spacing-container-small`), ...(ngDevMode ? [{ debugName: "containerInsetSpaceSmall" }] : /* istanbul ignore next */ []));
|
|
3821
|
+
/** @ignore */
|
|
2328
3822
|
containerInsetSpaceLarge = computed(() => this.tokenService.getTokenValue(`--oasys-component-section-inset-spacing-container-large`), ...(ngDevMode ? [{ debugName: "containerInsetSpaceLarge" }] : /* istanbul ignore next */ []));
|
|
3823
|
+
/** @ignore */
|
|
2329
3824
|
contentInsetSpaceSmall = computed(() => this.tokenService.getTokenValue(`--oasys-component-section-inset-spacing-content-small-${this.section_type()}`), ...(ngDevMode ? [{ debugName: "contentInsetSpaceSmall" }] : /* istanbul ignore next */ []));
|
|
3825
|
+
/** @ignore */
|
|
2330
3826
|
contentInsetSpaceLarge = computed(() => this.tokenService.getTokenValue(`--oasys-component-section-inset-spacing-content-large-${this.section_type()}`), ...(ngDevMode ? [{ debugName: "contentInsetSpaceLarge" }] : /* istanbul ignore next */ []));
|
|
3827
|
+
/** @ignore */
|
|
2331
3828
|
imageAspectRatio = computed(() => this.tokenService.getTokenValue(`--oasys-component-section-image-aspect-ratio-${this.section_type()}`), ...(ngDevMode ? [{ debugName: "imageAspectRatio" }] : /* istanbul ignore next */ []));
|
|
2332
3829
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2333
3830
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: SectionComponent, isStandalone: true, selector: "ui-section", inputs: { brand_background_colour: { classPropertyName: "brand_background_colour", publicName: "brand_background_colour", isSignal: true, isRequired: false, transformFunction: null }, non_brand_background_colour: { classPropertyName: "non_brand_background_colour", publicName: "non_brand_background_colour", isSignal: true, isRequired: false, transformFunction: null }, text_on_dark_override: { classPropertyName: "text_on_dark_override", publicName: "text_on_dark_override", isSignal: true, isRequired: false, transformFunction: null }, image_on_left: { classPropertyName: "image_on_left", publicName: "image_on_left", isSignal: true, isRequired: false, transformFunction: null }, section_type: { classPropertyName: "section_type", publicName: "section_type", isSignal: true, isRequired: false, transformFunction: null }, heading_title: { classPropertyName: "heading_title", publicName: "heading_title", isSignal: true, isRequired: false, transformFunction: null }, heading_subtitle: { classPropertyName: "heading_subtitle", publicName: "heading_subtitle", isSignal: true, isRequired: false, transformFunction: null }, primary_cta_text: { classPropertyName: "primary_cta_text", publicName: "primary_cta_text", isSignal: true, isRequired: false, transformFunction: null }, secondary_cta_text: { classPropertyName: "secondary_cta_text", publicName: "secondary_cta_text", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, alt_text: { classPropertyName: "alt_text", publicName: "alt_text", isSignal: true, isRequired: false, transformFunction: null }, href_primary_cta: { classPropertyName: "href_primary_cta", publicName: "href_primary_cta", isSignal: true, isRequired: false, transformFunction: null }, href_secondary_cta: { classPropertyName: "href_secondary_cta", publicName: "href_secondary_cta", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TokenService], ngImport: i0, template: "<ui-box\n [id]=\"uiBoxId()\"\n [box_background]=\"displayBrandBackgroundColour()\"\n [box_text_on_dark]=\"textOnDark()\"\n [style.background]=\"non_brand_background_colour() ?? null\"\n [box_space_left]=\"section_type() === 'spotlight' && !image_on_left() ? 'none' : undefined\"\n [box_space_right]=\"section_type() === 'spotlight' && image_on_left() ? 'none' : undefined\"\n [box_space]=\"\n section_type() === 'spotlight'\n ? 'none'\n : {\n mobile: containerInsetSpaceSmall(),\n tablet: containerInsetSpaceLarge(),\n laptop: containerInsetSpaceLarge(),\n desktop: containerInsetSpaceLarge(),\n }\n \"\n>\n <ui-grid [grid_gap]=\"section_type() === 'spotlight' ? 'none' : 'default'\">\n @if (image(); as resolvedImage) {\n <ui-column\n [columns]=\"6\"\n [class]=\"{ 'image-left': image_on_left(), 'image-top-mobile': image_on_left() }\"\n >\n <ui-box box_space=\"none\" box_background=\"transparent\" box_align_y=\"center\">\n <ui-image\n [image_src]=\"resolvedImage\"\n [image_alt_text]=\"alt_text() ?? ''\"\n [preload_aspect_ratio]=\"imageAspectRatio()\"\n ></ui-image>\n </ui-box>\n </ui-column>\n }\n <ui-column [columns]=\"6\">\n <ui-box\n [box_background]=\"displayBrandBackgroundColour()\"\n [box_text_on_dark]=\"textOnDark()\"\n box_align_y=\"center\"\n [box_space]=\"\n section_type() === 'spotlight'\n ? {\n mobile: contentInsetSpaceSmall(),\n tablet: contentInsetSpaceLarge(),\n laptop: contentInsetSpaceLarge(),\n desktop: contentInsetSpaceLarge(),\n }\n : {\n mobile: contentInsetSpaceSmall(),\n tablet: contentInsetSpaceSmall(),\n laptop: contentInsetSpaceLarge(),\n desktop: contentInsetSpaceLarge(),\n }\n \"\n >\n @if (heading_title() || primary_cta_text() || secondary_cta_text()) {\n <ui-stack\n stack_direction=\"y\"\n stack_align=\"center\"\n stack_distribute=\"center\"\n [stack_wrap]=\"true\"\n >\n @if (heading_title(); as title) {\n <ui-heading\n [heading_type]=\"section_type() === 'spotlight' ? 'primary' : 'functional-primary'\"\n [heading_title]=\"title\"\n [heading_subtitle]=\"heading_subtitle() ?? ''\"\n >\n </ui-heading>\n }\n\n @if (primary_cta_text() || secondary_cta_text()) {\n <ui-stack\n stack_direction=\"x\"\n stack_align=\"start\"\n [stack_distribute]=\"section_type() === 'spotlight' ? 'center' : 'start'\"\n [stack_wrap]=\"true\"\n stack_gap=\"near\"\n >\n @if (primary_cta_text(); as primaryCtaText) {\n @if (href_primary_cta(); as hrefPrimaryCta) {\n <a\n class=\"text-link text-link--standalone\"\n [href]=\"hrefPrimaryCta\"\n bwtrackas=\"oasys.story-block.primary-cta\"\n >{{ primaryCtaText }}</a\n >\n }\n }\n @if (secondary_cta_text(); as secondaryCtaText) {\n @if (href_secondary_cta(); as hrefSecondaryCta) {\n <a\n class=\"text-link text-link--standalone\"\n [href]=\"hrefSecondaryCta\"\n bwtrackas=\"oasys.story-block.secondary-cta\"\n >{{ secondaryCtaText }}</a\n >\n }\n }\n </ui-stack>\n }\n </ui-stack>\n }\n </ui-box>\n </ui-column>\n </ui-grid>\n</ui-box>\n", styles: ["ui-grid ui-column img{width:100%;display:block}ui-grid .image-left{order:1}@media only screen and (max-width:766px){ui-grid .image-top-mobile{order:0}}\n"], dependencies: [{ kind: "component", type: LayoutBoxComponent, selector: "ui-box", inputs: ["box_space", "box_role", "box_space_top", "box_space_right", "box_space_bottom", "box_space_left", "box_align_x", "box_align_y", "box_fill_mode", "box_background", "box_text_on_dark", "box_content_fill_width", "box_border_color", "box_border_width", "box_border_style", "box_border_radius"] }, { kind: "component", type: LayoutGridComponent, selector: "ui-grid", inputs: ["grid_auto", "grid_collapse_below", "grid_gap", "grid_base"] }, { kind: "component", type: LayoutGridColumnComponent, selector: "ui-column", inputs: ["columns", "column_inset"] }, { kind: "component", type: ImageComponent, selector: "ui-image", inputs: ["image_src", "image_alt_text", "image_aria_describedby", "image_fill", "fetchpriority", "loading", "preload_aspect_ratio", "image_width", "image_sizes"], outputs: ["image_loaded"] }, { kind: "component", type: LayoutStackComponent, selector: "ui-stack", inputs: ["stack_gap", "stack_align", "stack_direction", "stack_distribute", "stack_wrap", "stack_collapse_below", "stack_as_list"] }, { kind: "component", type: OasysHeadingComponent, selector: "ui-heading", inputs: ["heading_type", "heading_on_dark", "heading_title", "heading_seo_priority", "heading_priority", "heading_alignment_override", "heading_subtitle", "heading_surtitle", "heading_level"] }, { kind: "directive", type: OasysHrefDirective, selector: "a, uiHref, [uiHref]" }] });
|
|
@@ -2359,21 +3856,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2359
3856
|
}]
|
|
2360
3857
|
}] });
|
|
2361
3858
|
|
|
3859
|
+
/**
|
|
3860
|
+
* A full-width promotional strip (`<ui-banner>`): a short heading on a
|
|
3861
|
+
* coloured background with one optional call to action. Use it for offers and
|
|
3862
|
+
* prompts that sit between page sections, such as "Take £10 off your first
|
|
3863
|
+
* order". For a status or error message use `<ui-alert>` instead.
|
|
3864
|
+
*
|
|
3865
|
+
* Renders a `<ui-heading>` (`functional-primary` style) with optional
|
|
3866
|
+
* surtitle and subtitle, and a large `<ui-button>` that sits beside the text
|
|
3867
|
+
* from tablet up and below it on mobile. Content is set through inputs; there
|
|
3868
|
+
* is no content projection.
|
|
3869
|
+
*
|
|
3870
|
+
* The CTA is one of two things:
|
|
3871
|
+
* - `cta_link` set: an `<a href>` link. Use for navigation. The consuming app
|
|
3872
|
+
* must provide `ROUTING_HANDLER`, as for any Oasys link. `cta_clicked` does
|
|
3873
|
+
* not fire.
|
|
3874
|
+
* - `cta_link` empty: a `<button>` that emits `cta_clicked`. Use for in-page
|
|
3875
|
+
* actions such as opening a modal.
|
|
3876
|
+
*
|
|
3877
|
+
* Accessibility:
|
|
3878
|
+
* - The title is always an `<h2>` and the subtitle an `<h3>`, so place the
|
|
3879
|
+
* banner where a second-level heading fits the page outline.
|
|
3880
|
+
* - The CTA's accessible name is `cta_text`, so make it say where it goes or
|
|
3881
|
+
* what it does ("Claim offer", not "Click here").
|
|
3882
|
+
* - On dark backgrounds the text and button switch to their on-dark styles
|
|
3883
|
+
* automatically (see known issues for the background names that do not).
|
|
3884
|
+
*
|
|
3885
|
+
* @import import { OasysBannerComponent } from 'oasys-lib';
|
|
3886
|
+
* @knownIssue The `tertiary` and `quaternary` values of `background_colour`
|
|
3887
|
+
* never switch the text and CTA to their on-dark styles, so on brands where
|
|
3888
|
+
* those colours are dark (for example `quaternary` on Bloom & Wild) the banner
|
|
3889
|
+
* renders dark text and a dark `primary` button on a dark background.
|
|
3890
|
+
* Workaround: for dark banners use the matching `core-tertiary` or
|
|
3891
|
+
* `core-quaternary` value, which renders the same colour and does switch to
|
|
3892
|
+
* on-dark styles.
|
|
3893
|
+
*/
|
|
2362
3894
|
class BannerComponent {
|
|
2363
3895
|
tokenService = inject(TokenService);
|
|
2364
|
-
|
|
3896
|
+
/** @ignore */
|
|
2365
3897
|
mobilePadding;
|
|
3898
|
+
/**
|
|
3899
|
+
* Background colour. Prefer the semantic names (`highlight`, `secondary`,
|
|
3900
|
+
* `tertiary`, `quaternary`, `rewards-*`); the `core-*` and `tint-highlight`
|
|
3901
|
+
* names are deprecated aliases of the same colours, except as a workaround
|
|
3902
|
+
* for dark backgrounds (see known issues).
|
|
3903
|
+
*/
|
|
2366
3904
|
background_colour = 'highlight';
|
|
3905
|
+
/** Label of the call-to-action button. Leave empty for a banner with no CTA. */
|
|
2367
3906
|
cta_text;
|
|
3907
|
+
/** Main message, rendered as an `<h2>`. Keep it short: it is the offer or prompt itself. */
|
|
2368
3908
|
banner_title;
|
|
3909
|
+
/** Small supporting line above the title, for context such as "Seen our TV advert?". */
|
|
2369
3910
|
banner_surtitle;
|
|
3911
|
+
/**
|
|
3912
|
+
* Supporting sentence below the title, for terms or detail. Rendered as an
|
|
3913
|
+
* `<h3>`; accepts simple HTML such as a link (sanitised by Angular).
|
|
3914
|
+
*/
|
|
2370
3915
|
banner_subtitle;
|
|
2371
|
-
|
|
3916
|
+
/**
|
|
3917
|
+
* URL for the CTA. When set, the CTA renders as an `<a href>` link and
|
|
3918
|
+
* `cta_clicked` does not fire. Leave empty to render a `<button>` instead.
|
|
3919
|
+
*/
|
|
2372
3920
|
cta_link;
|
|
3921
|
+
/** Emitted when the CTA button is clicked. Only fires when `cta_link` is empty. */
|
|
2373
3922
|
cta_clicked = new EventEmitter();
|
|
3923
|
+
/** @ignore */
|
|
2374
3924
|
ngOnInit() {
|
|
2375
3925
|
this.mobilePadding = this.tokenService.getTokenValue('--oasys-component-banner-spacing-mobile');
|
|
2376
3926
|
}
|
|
3927
|
+
/** @ignore */
|
|
2377
3928
|
onCtaClicked() {
|
|
2378
3929
|
this.cta_clicked.emit();
|
|
2379
3930
|
}
|
|
@@ -2420,9 +3971,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2420
3971
|
}]
|
|
2421
3972
|
}] });
|
|
2422
3973
|
|
|
3974
|
+
/**
|
|
3975
|
+
* A small rounded label (`<ui-pill>`) that shows a short status or attribute,
|
|
3976
|
+
* such as "Shipped", "Paused" or "Default". Put the text inside the element.
|
|
3977
|
+
*
|
|
3978
|
+
* Use `tone` to match the meaning: `positive` for good or active states,
|
|
3979
|
+
* `negative` for problems or cancellations, `neutral` for everything else.
|
|
3980
|
+
* Don't rely on colour alone: the text must say what the state is.
|
|
3981
|
+
*
|
|
3982
|
+
* Keep the text to one or two words. Pills never wrap, so long text makes the
|
|
3983
|
+
* pill wider than its container on small screens.
|
|
3984
|
+
*
|
|
3985
|
+
* Pills are not interactive. For a selectable option use `<ui-chip>`, and for
|
|
3986
|
+
* a promotional badge use `<ui-label>`.
|
|
3987
|
+
*
|
|
3988
|
+
* Accessibility: the text is rendered inside an element with `role="status"`,
|
|
3989
|
+
* a polite live region. Several pills next to each other can be grouped with
|
|
3990
|
+
* `<ui-pill-group>`.
|
|
3991
|
+
*
|
|
3992
|
+
* @import import { OasysPillComponent } from 'oasys-lib';
|
|
3993
|
+
* @knownIssue `pill_role` has no effect: the host `role` is read once when the
|
|
3994
|
+
* pill is created, so it is always `role="none"`, and a static `role="..."`
|
|
3995
|
+
* attribute is overwritten too. This means pills inside `<ui-pill-group>`
|
|
3996
|
+
* (a `role="list"`) are never list items. Workaround: none in the component
|
|
3997
|
+
* yet; don't rely on `pill_role`, and see `<ui-pill-group>` for list semantics.
|
|
3998
|
+
*/
|
|
2423
3999
|
class OasysPillComponent {
|
|
4000
|
+
/**
|
|
4001
|
+
* Colour that matches the meaning: `positive` for good or active states,
|
|
4002
|
+
* `negative` for problems or cancellations, `neutral` for everything else.
|
|
4003
|
+
*/
|
|
2424
4004
|
tone = 'neutral';
|
|
4005
|
+
/**
|
|
4006
|
+
* Intended to set the `role` of the host element (for example `listitem`
|
|
4007
|
+
* inside `<ui-pill-group>`). Currently ignored: the host always gets
|
|
4008
|
+
* `role="none"` (see known issues).
|
|
4009
|
+
*/
|
|
2425
4010
|
pill_role = 'none';
|
|
4011
|
+
/** @ignore */
|
|
2426
4012
|
role = this.pill_role;
|
|
2427
4013
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: OasysPillComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2428
4014
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.25", type: OasysPillComponent, isStandalone: true, selector: "ui-pill", inputs: { tone: "tone", pill_role: "pill_role" }, host: { properties: { "class": "\"ui-pill-\" + tone", "attr.role": "this.role" } }, ngImport: i0, template: "<div role=\"status\" class=\"text-body--supporting text-body--emphasis\"><ng-content></ng-content></div>\n", styles: [":host{border-radius:var(--oasys-radius-round);display:inline-flex;padding:var(--oasys-spacing-tiny) var(--oasys-spacing-near);text-align:center;text-wrap:nowrap}:host.ui-pill-positive{background-color:var(--oasys-color-system-background-positive);color:var(--oasys-color-system-foreground-positive)}:host.ui-pill-negative{background-color:var(--oasys-color-system-background-negative);color:var(--oasys-color-system-foreground-negative)}:host.ui-pill-neutral{background-color:var(--oasys-color-system-background-neutral);color:var(--oasys-color-brand-foreground-primary)}\n"] });
|
|
@@ -2455,10 +4041,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2455
4041
|
}]
|
|
2456
4042
|
}] });
|
|
2457
4043
|
|
|
4044
|
+
/**
|
|
4045
|
+
* Lays out several `<ui-pill>`s in a wrapping row with consistent spacing
|
|
4046
|
+
* (`<ui-pill-group>`), for example the attributes of an order or a card.
|
|
4047
|
+
*
|
|
4048
|
+
* Only `<ui-pill>` children are shown: any other element placed inside is
|
|
4049
|
+
* hidden with `display: none`.
|
|
4050
|
+
*
|
|
4051
|
+
* By default the pills stack vertically on mobile (below `tablet`). Set
|
|
4052
|
+
* `pill_group_collapse_below="none"` to keep them in a wrapping row at every
|
|
4053
|
+
* size, which is usually what you want for short pills.
|
|
4054
|
+
*
|
|
4055
|
+
* Accessibility: the group renders as `role="list"`, so screen readers
|
|
4056
|
+
* announce it as a list with a count of items.
|
|
4057
|
+
*
|
|
4058
|
+
* @import import { OasysPillGroupComponent } from 'oasys-lib';
|
|
4059
|
+
* @knownIssue The group is a `role="list"` but its pills are never list items
|
|
4060
|
+
* (`pill_role="listitem"` is ignored, every pill gets `role="none"`), so the
|
|
4061
|
+
* list semantics are invalid and fail automated accessibility checks (axe
|
|
4062
|
+
* `aria-required-children`). Workaround: where this matters, lay the
|
|
4063
|
+
* pills out with `<ui-stack stack_direction="x" stack_gap="near"
|
|
4064
|
+
* [stack_wrap]="true">` instead, which has no list role.
|
|
4065
|
+
* @knownIssue Children that are not `<ui-pill>` are hidden with
|
|
4066
|
+
* `display: none`, with no warning. Workaround: put only `<ui-pill>`s inside
|
|
4067
|
+
* the group and place any other content outside it.
|
|
4068
|
+
*/
|
|
2458
4069
|
class OasysPillGroupComponent {
|
|
2459
4070
|
breakpointService = inject(BreakpointService);
|
|
4071
|
+
/**
|
|
4072
|
+
* Horizontal alignment of the row. `end` also reverses the order, so the
|
|
4073
|
+
* first pill in the markup sits furthest right.
|
|
4074
|
+
*/
|
|
2460
4075
|
pill_group_align = 'start';
|
|
4076
|
+
/**
|
|
4077
|
+
* Stack the pills vertically below this breakpoint: `tablet` (under 768px),
|
|
4078
|
+
* `laptop` (under 1080px) or `desktop` (under 1440px). `none` keeps a
|
|
4079
|
+
* wrapping row at every size.
|
|
4080
|
+
*/
|
|
2461
4081
|
pill_group_collapse_below = 'tablet';
|
|
4082
|
+
/**
|
|
4083
|
+
* True when the screen is below `pill_group_collapse_below`. Read it through
|
|
4084
|
+
* a template reference if surrounding layout needs to follow the stacking.
|
|
4085
|
+
*/
|
|
2462
4086
|
get shouldCollapse() {
|
|
2463
4087
|
switch (this.pill_group_collapse_below) {
|
|
2464
4088
|
case 'tablet':
|
|
@@ -2512,31 +4136,83 @@ const PROMO_CARD_LAYOUTS = {
|
|
|
2512
4136
|
spacing: 'near',
|
|
2513
4137
|
},
|
|
2514
4138
|
};
|
|
4139
|
+
/**
|
|
4140
|
+
* A marketing tile (`<ui-promo-card>`): a full-width image, a title, a short
|
|
4141
|
+
* subtitle and one text-link CTA, on a background colour chosen by the content
|
|
4142
|
+
* author. Use it to drop a campaign or promotion into a product grid or a row
|
|
4143
|
+
* of cards.
|
|
4144
|
+
*
|
|
4145
|
+
* - The CTA is a plain `<a>` styled as a standalone text link, not a
|
|
4146
|
+
* `<ui-button>`. Set `href_primary_cta` for the destination; `cta_clicked`
|
|
4147
|
+
* also fires on click (for tracking or custom navigation).
|
|
4148
|
+
* - The title is always an `<h3>`. Place the card under an `h2` section
|
|
4149
|
+
* heading so the outline stays in order.
|
|
4150
|
+
* - `background_colour` and `font_colour` are raw CSS colours applied as
|
|
4151
|
+
* inline styles. Nothing checks contrast: choose a pair that meets WCAG AA
|
|
4152
|
+
* (4.5:1 for the subtitle and link).
|
|
4153
|
+
* - Image aspect ratio and text alignment come from the
|
|
4154
|
+
* `--oasys-component-promo-card-*` tokens, so they differ per brand.
|
|
4155
|
+
* - The card fills the width of its parent.
|
|
4156
|
+
*
|
|
4157
|
+
* Requires an `IMAGE_URL_PROVIDER` (for the image) and a `ROUTING_HANDLER`
|
|
4158
|
+
* (for the CTA link).
|
|
4159
|
+
*
|
|
4160
|
+
* @import import { OasysPromoCardComponent } from 'oasys-lib';
|
|
4161
|
+
* @knownIssue The CTA link always renders, even without `primary_cta_text` or
|
|
4162
|
+
* `href_primary_cta`, leaving an empty link (no accessible name) or a link to
|
|
4163
|
+
* the current page. Workaround: always set both `primary_cta_text` and
|
|
4164
|
+
* `href_primary_cta`.
|
|
4165
|
+
* @knownIssue `layout` is read once on init; changing it later has no effect.
|
|
4166
|
+
* Workaround: set it up front, or re-create the card (for example with `@if`)
|
|
4167
|
+
* when the layout must change.
|
|
4168
|
+
*/
|
|
2515
4169
|
class PromoCardComponent {
|
|
2516
4170
|
tokenService = inject(TokenService);
|
|
2517
|
-
|
|
4171
|
+
/** Image URL, passed to `<ui-image>` (and so through the app's `IMAGE_URL_PROVIDER`). */
|
|
2518
4172
|
image;
|
|
4173
|
+
/**
|
|
4174
|
+
* Alt text for the image. Leave it unset or `''` when the image is
|
|
4175
|
+
* decorative; don't repeat the title, which screen readers already announce.
|
|
4176
|
+
*/
|
|
2519
4177
|
alt_text;
|
|
2520
|
-
|
|
4178
|
+
/** Card title, rendered as an `<h3>`. */
|
|
2521
4179
|
title;
|
|
4180
|
+
/** One or two sentences of supporting copy under the title. */
|
|
2522
4181
|
subtitle;
|
|
2523
|
-
|
|
4182
|
+
/**
|
|
4183
|
+
* CTA link text. Make it meaningful out of context ("Shop birthday flowers",
|
|
4184
|
+
* not "Click here"). Always set it: the link renders even when empty.
|
|
4185
|
+
*/
|
|
2524
4186
|
primary_cta_text;
|
|
4187
|
+
/** CTA link destination. Always set it: an empty value links to the current page. */
|
|
2525
4188
|
href_primary_cta = '';
|
|
2526
|
-
|
|
4189
|
+
/** Any CSS colour for the card background. Check contrast against `font_colour`. */
|
|
2527
4190
|
background_colour;
|
|
4191
|
+
/** Any CSS colour for the card text. Check contrast against `background_colour`. */
|
|
2528
4192
|
font_colour;
|
|
2529
|
-
|
|
4193
|
+
/**
|
|
4194
|
+
* `default` uses a secondary heading and default body text. `compact` uses
|
|
4195
|
+
* smaller type and tighter spacing, for narrow grid cells. Read once on init.
|
|
4196
|
+
*/
|
|
2530
4197
|
layout = 'default';
|
|
4198
|
+
/**
|
|
4199
|
+
* Emits when the CTA link is clicked. The link still navigates to
|
|
4200
|
+
* `href_primary_cta` unless the app's routing handler prevents it.
|
|
4201
|
+
*/
|
|
2531
4202
|
cta_clicked = new EventEmitter();
|
|
4203
|
+
/** @ignore */
|
|
2532
4204
|
aspectRatio;
|
|
4205
|
+
/** @ignore */
|
|
2533
4206
|
alignment;
|
|
4207
|
+
/** @ignore */
|
|
2534
4208
|
layoutConfig = PROMO_CARD_LAYOUTS['default'];
|
|
4209
|
+
/** @ignore */
|
|
2535
4210
|
ngOnInit() {
|
|
2536
4211
|
this.layoutConfig = PROMO_CARD_LAYOUTS[this.layout] ?? PROMO_CARD_LAYOUTS['default'];
|
|
2537
4212
|
this.aspectRatio = this.tokenService.getTokenValue('--oasys-component-promo-card-image-aspect-ratio');
|
|
2538
4213
|
this.alignment = this.tokenService.getTokenValue('--oasys-component-promo-card-heading-alignment');
|
|
2539
4214
|
}
|
|
4215
|
+
/** @ignore */
|
|
2540
4216
|
ctaClicked() {
|
|
2541
4217
|
this.cta_clicked.emit();
|
|
2542
4218
|
}
|
|
@@ -2610,37 +4286,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2610
4286
|
type: Input
|
|
2611
4287
|
}] } });
|
|
2612
4288
|
|
|
4289
|
+
/**
|
|
4290
|
+
* A selectable card (`<ui-select-card>`) for picking one option from a visual
|
|
4291
|
+
* set, such as a greeting card at checkout or a subscription bouquet. Two
|
|
4292
|
+
* layouts, chosen by `select_card_type`:
|
|
4293
|
+
* - `gift-card` (default): image, title and price.
|
|
4294
|
+
* - `product-card`: image, title, price (plus a tag icon when discounted),
|
|
4295
|
+
* supporting copy and a description, inside a bordered card.
|
|
4296
|
+
*
|
|
4297
|
+
* Selection: the whole card is a native `<button>` with `aria-pressed`, so it
|
|
4298
|
+
* works with Tab, Enter and Space and announces as a toggle button. It has no
|
|
4299
|
+
* internal state and no form integration: listen to `clicked`, store the
|
|
4300
|
+
* selection in the parent, and pass `selected` back in. For single-choice
|
|
4301
|
+
* sets, set `selected` on exactly one card.
|
|
4302
|
+
*
|
|
4303
|
+
* Accessibility:
|
|
4304
|
+
* - The button's accessible name is all of its text in order: the image alt
|
|
4305
|
+
* text, any projected content, the title, the price and (for
|
|
4306
|
+
* `product-card`) the copy. Keep the alt text `''` when the title already
|
|
4307
|
+
* names the option, so it isn't read twice.
|
|
4308
|
+
* - The struck-through original price is hidden from screen readers by
|
|
4309
|
+
* `<ui-price>`; put any discount wording that matters in `title` or the copy.
|
|
4310
|
+
* - Don't put links, buttons or other interactive content in the projected
|
|
4311
|
+
* content: it would be nested inside the card's `<button>`.
|
|
4312
|
+
*
|
|
4313
|
+
* Images: set `image` for a `<ui-image>`, or leave it unset and project your
|
|
4314
|
+
* own image as content (it renders in the image area). `image_format` only
|
|
4315
|
+
* applies to `image`.
|
|
4316
|
+
*
|
|
4317
|
+
* Requires an `IMAGE_URL_PROVIDER` when `image` is set.
|
|
4318
|
+
*
|
|
4319
|
+
* @import import { OasysSelectCardComponent } from 'oasys-lib';
|
|
4320
|
+
* @knownIssue `image_format` is read once on init (and only when `image` is
|
|
4321
|
+
* set then); later changes have no effect. Workaround: set `image` and
|
|
4322
|
+
* `image_format` up front, or re-create the card (for example with `@if`) when
|
|
4323
|
+
* they change.
|
|
4324
|
+
*/
|
|
2613
4325
|
class SelectCardComponent {
|
|
2614
4326
|
tokenService = inject(TokenService);
|
|
2615
|
-
|
|
4327
|
+
/**
|
|
4328
|
+
* Image URL, rendered with `<ui-image>`. Optional: leave unset and project an
|
|
4329
|
+
* image as content instead.
|
|
4330
|
+
*/
|
|
2616
4331
|
image;
|
|
4332
|
+
/**
|
|
4333
|
+
* Alt text for `image`. It becomes part of the button's accessible name, so
|
|
4334
|
+
* leave it `''` when the title already identifies the option.
|
|
4335
|
+
*/
|
|
2617
4336
|
alt_text = '';
|
|
4337
|
+
/**
|
|
4338
|
+
* Image aspect ratio: `portrait` (default) or `square`. Any other value falls
|
|
4339
|
+
* back to `portrait`. Only applies to `image`, and is read once on init.
|
|
4340
|
+
*/
|
|
2618
4341
|
image_format;
|
|
2619
|
-
|
|
4342
|
+
/** Name of the option, such as the greeting card or bouquet name. */
|
|
2620
4343
|
title;
|
|
4344
|
+
/** `product-card` only: description shown at the bottom of the card. */
|
|
2621
4345
|
primary_copy;
|
|
4346
|
+
/** `product-card` only: short supporting text above the description, such as the stem count. */
|
|
2622
4347
|
secondary_copy;
|
|
4348
|
+
/**
|
|
4349
|
+
* Price to pay, as a pre-formatted string including the currency (for
|
|
4350
|
+
* example `'£3.50'`). It is displayed as given.
|
|
4351
|
+
*/
|
|
2623
4352
|
price;
|
|
4353
|
+
/**
|
|
4354
|
+
* Pre-formatted original price. When set, it is shown struck through before
|
|
4355
|
+
* `price` (hidden from screen readers), and `product-card` adds a tag icon.
|
|
4356
|
+
* Leave unset or `''` when there is no discount.
|
|
4357
|
+
*/
|
|
2624
4358
|
price_before_discount;
|
|
4359
|
+
/** Whether this card is the current selection. Sets the selected style and `aria-pressed`. */
|
|
2625
4360
|
selected = false;
|
|
4361
|
+
/** Which layout to render: compact `gift-card` or the fuller, bordered `product-card`. */
|
|
2626
4362
|
select_card_type = 'gift-card';
|
|
4363
|
+
/**
|
|
4364
|
+
* Emits when the card is activated by click, Enter or Space. Update the
|
|
4365
|
+
* parent's selection here; the card doesn't change `selected` itself.
|
|
4366
|
+
*/
|
|
2627
4367
|
clicked = new EventEmitter();
|
|
4368
|
+
/** @ignore */
|
|
2628
4369
|
aspectRatio;
|
|
4370
|
+
/** @ignore */
|
|
2629
4371
|
alignment;
|
|
4372
|
+
/** @ignore */
|
|
2630
4373
|
ngOnInit() {
|
|
2631
4374
|
if (!this.image) {
|
|
2632
4375
|
return;
|
|
2633
4376
|
}
|
|
2634
4377
|
this.aspectRatio = this.setImageAspectRatio(this.image_format);
|
|
2635
4378
|
}
|
|
4379
|
+
/** @ignore */
|
|
2636
4380
|
onClick() {
|
|
2637
4381
|
this.clicked.emit();
|
|
2638
4382
|
}
|
|
2639
|
-
/**
|
|
2640
|
-
*
|
|
2641
|
-
* @param format
|
|
2642
|
-
* @returns
|
|
2643
|
-
*/
|
|
4383
|
+
/** @ignore */
|
|
2644
4384
|
setImageAspectRatio(format) {
|
|
2645
4385
|
switch (format) {
|
|
2646
4386
|
case 'square':
|
|
@@ -2735,84 +4475,221 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
2735
4475
|
type: Input
|
|
2736
4476
|
}] } });
|
|
2737
4477
|
|
|
4478
|
+
/**
|
|
4479
|
+
* The Oasys combobox (`<ui-combobox>`): a labelled field that opens a list of
|
|
4480
|
+
* options to pick one from. Two modes, set with `type`:
|
|
4481
|
+
* - `options` (default): a read-only, select-style field. Use it instead of a
|
|
4482
|
+
* native `<select>` for choices such as delivery day or subscription
|
|
4483
|
+
* frequency. For two to five options that should stay visible, use radios
|
|
4484
|
+
* or chips instead.
|
|
4485
|
+
* - `autocomplete`: a text field that filters the options as the user types
|
|
4486
|
+
* (matches are emphasised), with a clear button, an optional `header` above
|
|
4487
|
+
* the list and an optional `footer` button (emits `didEdit`, for example
|
|
4488
|
+
* "Enter address manually"). The user can also keep free text that matches
|
|
4489
|
+
* no option.
|
|
4490
|
+
*
|
|
4491
|
+
* Each option is an object `{ value, label, subtext?, icon_name? }` (the
|
|
4492
|
+
* `ComboboxOption` shape; the type is not exported from `oasys-lib`). To use
|
|
4493
|
+
* your own objects, name their fields with `valueKey`, `displayKey`,
|
|
4494
|
+
* `iconNameKey` and `subtextKey`. Options are matched by their value field.
|
|
4495
|
+
* `subtext` is only shown in autocomplete mode.
|
|
4496
|
+
*
|
|
4497
|
+
* Value: `didChange` emits the selected option object. With Angular forms
|
|
4498
|
+
* (`formControlName`, `formControl`, `ngModel`), the control holds the text
|
|
4499
|
+
* in the field: the selected option's label, or what the user typed. Preselect
|
|
4500
|
+
* an option with `selected`.
|
|
4501
|
+
*
|
|
4502
|
+
* Errors and hint: project `<ui-form-errors>` as content; it is shown once the
|
|
4503
|
+
* control is touched, invalid and no longer focused. `hint` is shown below.
|
|
4504
|
+
*
|
|
4505
|
+
* Accessibility: the input has `role="combobox"` with `aria-expanded`,
|
|
4506
|
+
* `aria-controls` pointing at the `role="listbox"`, and
|
|
4507
|
+
* `aria-activedescendant` following the highlighted option, so focus stays in
|
|
4508
|
+
* the field. Each option's accessible name includes its subtext and, when
|
|
4509
|
+
* selected, `selectedLabel`. In localised apps, pass translated `clearLabel`
|
|
4510
|
+
* and `selectedLabel`. The `hint` and projected errors are not linked to the
|
|
4511
|
+
* input with `aria-describedby`, so keep anything essential in `label`.
|
|
4512
|
+
*
|
|
4513
|
+
* Keyboard (`options`): Enter, Space or an arrow key opens the list with the
|
|
4514
|
+
* selected option highlighted; arrows move (the field previews the option);
|
|
4515
|
+
* Enter, Space or Tab picks it; Escape closes and keeps the previous choice.
|
|
4516
|
+
* Keyboard (`autocomplete`): typing opens and filters the list; arrows move
|
|
4517
|
+
* and preview; Enter picks; Escape closes; Tab moves to the clear and footer
|
|
4518
|
+
* buttons while the list is open.
|
|
4519
|
+
*
|
|
4520
|
+
* Template reference API: `panelOpen()`, `selectedOption()`, `closePanel()` and
|
|
4521
|
+
* `cleanInput()` can be used through a `viewChild` or template reference.
|
|
4522
|
+
*
|
|
4523
|
+
* @import import { OasysComboboxComponent } from 'oasys-lib';
|
|
4524
|
+
* @knownIssue The form control value is the selected option's display label
|
|
4525
|
+
* (a string), not its `value`, and writing a value to the control only changes
|
|
4526
|
+
* the text shown; it does not select an option. Writing an option object
|
|
4527
|
+
* without `selected` set shows "[object Object]". Workaround: read the choice
|
|
4528
|
+
* from `didChange` (emits the whole option), preselect with `selected`, and
|
|
4529
|
+
* only write strings to the control.
|
|
4530
|
+
* @knownIssue `selected` is only read when the component initialises; changing
|
|
4531
|
+
* it later does not change the selection. Workaround: render the combobox
|
|
4532
|
+
* (for example inside `@if`) only once the selected option is known.
|
|
4533
|
+
* @knownIssue Autocomplete filtering only searches the display label: text in
|
|
4534
|
+
* `subtext` (for example an address line) never matches while the option has a
|
|
4535
|
+
* label. Workaround: put the searchable text in the label, or filter yourself
|
|
4536
|
+
* on `didSearch` and pass the results as `options`.
|
|
4537
|
+
* @knownIssue In autocomplete mode, the clear button, `cleanInput()` and
|
|
4538
|
+
* Escape (with the list closed) empty the field without updating the form
|
|
4539
|
+
* control, so the control keeps the old text. Workaround: when `didSearch`
|
|
4540
|
+
* emits `''` (clear button and `cleanInput()`), reset the control yourself.
|
|
4541
|
+
* @knownIssue Disabling the form control (`control.disable()` or
|
|
4542
|
+
* `new FormControl({ value: '', disabled: true })`) does not disable the
|
|
4543
|
+
* combobox, because the component does not implement `setDisabledState`.
|
|
4544
|
+
* Workaround: also bind `[disabled]` (Angular logs a dev-mode warning about
|
|
4545
|
+
* `disabled` on a reactive form directive; it is safe to ignore here).
|
|
4546
|
+
* @knownIssue In autocomplete mode the input renders `autocomplete="list"`,
|
|
4547
|
+
* which is not a valid autocomplete value, so automated accessibility checks
|
|
4548
|
+
* fail (axe `autocomplete-valid`) and browsers may show their own autofill
|
|
4549
|
+
* suggestions over the options list. Workaround: none in consumer code.
|
|
4550
|
+
*/
|
|
2738
4551
|
class OasysComboboxComponent {
|
|
2739
|
-
|
|
4552
|
+
/** Visible field label and the field's accessible name. Required. */
|
|
2740
4553
|
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2741
|
-
|
|
4554
|
+
/**
|
|
4555
|
+
* `options` for a select-style pick list; `autocomplete` for a searchable text
|
|
4556
|
+
* field with suggestions, a clear button and optional header and footer.
|
|
4557
|
+
*/
|
|
2742
4558
|
type = input('options', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
4559
|
+
/**
|
|
4560
|
+
* The choices: `{ value, label, subtext?, icon_name? }` objects, or your own objects with
|
|
4561
|
+
* `valueKey`/`displayKey`/`iconNameKey`/`subtextKey` set. In autocomplete
|
|
4562
|
+
* mode, replacing the array after init reopens the list (for drill-down
|
|
4563
|
+
* searches such as postcode then address); after a one-off async load, call
|
|
4564
|
+
* `closePanel()` if the list should stay closed.
|
|
4565
|
+
*/
|
|
2743
4566
|
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
4567
|
+
/**
|
|
4568
|
+
* Set `false` to mark the field required. This sets the native `required`
|
|
4569
|
+
* attribute, which drives the error styling; it does not validate your form
|
|
4570
|
+
* control, so add `Validators.required` as well.
|
|
4571
|
+
*/
|
|
2744
4572
|
optional = input(true, ...(ngDevMode ? [{ debugName: "optional" }] : /* istanbul ignore next */ []));
|
|
4573
|
+
/** Help text shown under the field. */
|
|
2745
4574
|
hint = input(undefined, ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
4575
|
+
/** Autocomplete only. Heading shown above the list, such as "Saved recipients". */
|
|
2746
4576
|
header = input(undefined, ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
|
|
4577
|
+
/**
|
|
4578
|
+
* Autocomplete only. Label of a button below the list that emits `didEdit`,
|
|
4579
|
+
* for an escape hatch such as "Enter address manually".
|
|
4580
|
+
*/
|
|
2747
4581
|
footer = input(undefined, ...(ngDevMode ? [{ debugName: "footer" }] : /* istanbul ignore next */ []));
|
|
4582
|
+
/** Focuses the field on load. Use sparingly, only as the first field of a focused task. */
|
|
2748
4583
|
autofocus = input(false, ...(ngDevMode ? [{ debugName: "autofocus" }] : /* istanbul ignore next */ []));
|
|
4584
|
+
/**
|
|
4585
|
+
* Disables the field. Bind it even when using reactive forms: disabling the
|
|
4586
|
+
* form control alone does not disable the combobox.
|
|
4587
|
+
*/
|
|
2749
4588
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
4589
|
+
/**
|
|
4590
|
+
* Option selected on load, matched to `options` by its value field. Only read
|
|
4591
|
+
* on init.
|
|
4592
|
+
*/
|
|
2750
4593
|
selected = input(undefined, ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
2751
|
-
|
|
4594
|
+
/** Field of your option objects to show as the label. Defaults to `label`. */
|
|
2752
4595
|
displayKey = input(undefined, ...(ngDevMode ? [{ debugName: "displayKey" }] : /* istanbul ignore next */ []));
|
|
2753
|
-
|
|
4596
|
+
/** Field of your option objects holding an icon name. Defaults to `icon_name`. */
|
|
2754
4597
|
iconNameKey = input(undefined, ...(ngDevMode ? [{ debugName: "iconNameKey" }] : /* istanbul ignore next */ []));
|
|
2755
|
-
|
|
4598
|
+
/** Field of your option objects that identifies each option. Defaults to `value`. */
|
|
2756
4599
|
valueKey = input(undefined, ...(ngDevMode ? [{ debugName: "valueKey" }] : /* istanbul ignore next */ []));
|
|
2757
|
-
|
|
4600
|
+
/** Autocomplete only. Field of your option objects shown as secondary text. Defaults to `subtext`. */
|
|
2758
4601
|
subtextKey = input(undefined, ...(ngDevMode ? [{ debugName: "subtextKey" }] : /* istanbul ignore next */ []));
|
|
4602
|
+
/** Text shown in the empty field. Not a substitute for `label` or `hint`. */
|
|
2759
4603
|
placeholder = input(undefined, ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2760
|
-
|
|
4604
|
+
/** Opens the list on load, without selecting anything. */
|
|
2761
4605
|
showOptions = input(false, ...(ngDevMode ? [{ debugName: "showOptions" }] : /* istanbul ignore next */ []));
|
|
2762
4606
|
// Accessibility labels — pass translated strings here when consuming in a localised app.
|
|
2763
|
-
|
|
4607
|
+
/**
|
|
4608
|
+
* Autocomplete only. Accessible name of the clear button. Pass a translated
|
|
4609
|
+
* string in localised apps.
|
|
4610
|
+
*/
|
|
2764
4611
|
clearLabel = input('Clear', ...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
2765
|
-
|
|
4612
|
+
/**
|
|
4613
|
+
* Appended to the selected option's accessible name, as in "Tuesdays is
|
|
4614
|
+
* selected". Pass a translated string in localised apps.
|
|
4615
|
+
*/
|
|
2766
4616
|
selectedLabel = input('is selected', ...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
2767
|
-
|
|
4617
|
+
/**
|
|
4618
|
+
* Emits the selected option object when the user picks one. Also emits on
|
|
4619
|
+
* blur and on every keystroke in autocomplete mode, with the current selection
|
|
4620
|
+
* (or `undefined`).
|
|
4621
|
+
*/
|
|
2768
4622
|
didChange = output();
|
|
4623
|
+
/**
|
|
4624
|
+
* Autocomplete only. Emits the field text on every keystroke, and `''` when
|
|
4625
|
+
* cleared. Use it to fetch results and pass them back as `options`.
|
|
4626
|
+
*/
|
|
2769
4627
|
didSearch = output();
|
|
4628
|
+
/** Autocomplete only. Emits when the `footer` button is pressed. */
|
|
2770
4629
|
didEdit = output();
|
|
2771
|
-
|
|
4630
|
+
/** @ignore */
|
|
2772
4631
|
textInput = viewChild('textinput', { ...(ngDevMode ? { debugName: "textInput" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
4632
|
+
/** @ignore */
|
|
2773
4633
|
combobox = viewChild('combobox', { ...(ngDevMode ? { debugName: "combobox" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
4634
|
+
/** @ignore */
|
|
2774
4635
|
comboboxContainer = viewChild('comboboxContainer', { ...(ngDevMode ? { debugName: "comboboxContainer" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
4636
|
+
/** @ignore */
|
|
2775
4637
|
footerButton = viewChild('footerButton', { ...(ngDevMode ? { debugName: "footerButton" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
4638
|
+
/** @ignore */
|
|
2776
4639
|
optionsList = viewChildren('option', { ...(ngDevMode ? { debugName: "optionsList" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
2777
4640
|
// Internal mutable state as signals
|
|
4641
|
+
/** @ignore */
|
|
2778
4642
|
textValue = signal('', ...(ngDevMode ? [{ debugName: "textValue" }] : /* istanbul ignore next */ []));
|
|
2779
4643
|
// only show validation after a change event (ie. blur)
|
|
4644
|
+
/** @ignore */
|
|
2780
4645
|
inputDidChange = signal(false, ...(ngDevMode ? [{ debugName: "inputDidChange" }] : /* istanbul ignore next */ []));
|
|
4646
|
+
/** @ignore */
|
|
2781
4647
|
displayOptions = signal([], ...(ngDevMode ? [{ debugName: "displayOptions" }] : /* istanbul ignore next */ []));
|
|
2782
4648
|
_selectedOption = signal(undefined, ...(ngDevMode ? [{ debugName: "_selectedOption" }] : /* istanbul ignore next */ []));
|
|
2783
4649
|
_focusedOption = signal(undefined, ...(ngDevMode ? [{ debugName: "_focusedOption" }] : /* istanbul ignore next */ []));
|
|
2784
4650
|
_focusedOptionId = signal(0, ...(ngDevMode ? [{ debugName: "_focusedOptionId" }] : /* istanbul ignore next */ []));
|
|
4651
|
+
/** @ignore */
|
|
2785
4652
|
id = signal('', ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2786
|
-
/** Whether
|
|
4653
|
+
/** Whether the list is open. Read it through a `viewChild` to react to the list opening or closing. */
|
|
2787
4654
|
panelOpen = signal(false, ...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
|
|
2788
4655
|
openedViaKeyboard = signal(false, ...(ngDevMode ? [{ debugName: "openedViaKeyboard" }] : /* istanbul ignore next */ []));
|
|
2789
|
-
/**
|
|
4656
|
+
/** The selected option, or `undefined`. Read it through a `viewChild`. */
|
|
2790
4657
|
selectedOption = this._selectedOption.asReadonly();
|
|
2791
|
-
/**
|
|
4658
|
+
/** @ignore */
|
|
2792
4659
|
focusedOption = this._focusedOption.asReadonly();
|
|
2793
|
-
/**
|
|
4660
|
+
/** @ignore */
|
|
2794
4661
|
focusedId = this._focusedOptionId.asReadonly();
|
|
4662
|
+
/** @ignore */
|
|
2795
4663
|
shouldShowFocus = computed(() => this.openedViaKeyboard() && this.panelOpen(), ...(ngDevMode ? [{ debugName: "shouldShowFocus" }] : /* istanbul ignore next */ []));
|
|
4664
|
+
/** @ignore */
|
|
2796
4665
|
valueOptionKey = computed(() => this.valueKey() ?? 'value', ...(ngDevMode ? [{ debugName: "valueOptionKey" }] : /* istanbul ignore next */ []));
|
|
4666
|
+
/** @ignore */
|
|
2797
4667
|
displayOptionKey = computed(() => this.displayKey() ?? 'label', ...(ngDevMode ? [{ debugName: "displayOptionKey" }] : /* istanbul ignore next */ []));
|
|
4668
|
+
/** @ignore */
|
|
2798
4669
|
subtextOptionKey = computed(() => this.subtextKey() ?? 'subtext', ...(ngDevMode ? [{ debugName: "subtextOptionKey" }] : /* istanbul ignore next */ []));
|
|
4670
|
+
/** @ignore */
|
|
2799
4671
|
listboxId = computed(() => `${this.id()}-list`, ...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
4672
|
+
/** @ignore */
|
|
2800
4673
|
activeDescendantId = computed(() => {
|
|
2801
4674
|
if (!this.panelOpen() || this.focusedId() < 0) {
|
|
2802
4675
|
return null;
|
|
2803
4676
|
}
|
|
2804
4677
|
return `${this.id()}-opt-${this.focusedId()}`;
|
|
2805
4678
|
}, ...(ngDevMode ? [{ debugName: "activeDescendantId" }] : /* istanbul ignore next */ []));
|
|
4679
|
+
/** @ignore */
|
|
2806
4680
|
optionId(index) {
|
|
2807
4681
|
return `${this.id()}-opt-${index}`;
|
|
2808
4682
|
}
|
|
2809
4683
|
document = inject(DOCUMENT);
|
|
4684
|
+
/** @ignore */
|
|
2810
4685
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
2811
4686
|
onChange = (_) => { };
|
|
4687
|
+
/** @ignore */
|
|
2812
4688
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2813
4689
|
onTouched = () => { };
|
|
2814
4690
|
/**
|
|
2815
4691
|
* Click outside combobox close the panel
|
|
4692
|
+
* @ignore
|
|
2816
4693
|
*/
|
|
2817
4694
|
onClick(targetElement) {
|
|
2818
4695
|
const containerEl = this.comboboxContainer()?.nativeElement;
|
|
@@ -2823,7 +4700,10 @@ class OasysComboboxComponent {
|
|
|
2823
4700
|
}
|
|
2824
4701
|
}
|
|
2825
4702
|
}
|
|
2826
|
-
/**
|
|
4703
|
+
/**
|
|
4704
|
+
* Accessible name for an autocomplete list option.
|
|
4705
|
+
* @ignore
|
|
4706
|
+
*/
|
|
2827
4707
|
autocompleteOptionAriaLabel(option) {
|
|
2828
4708
|
const displayKey = this.displayOptionKey();
|
|
2829
4709
|
const subtextKey = this.subtextOptionKey();
|
|
@@ -2837,7 +4717,10 @@ class OasysComboboxComponent {
|
|
|
2837
4717
|
}
|
|
2838
4718
|
return name;
|
|
2839
4719
|
}
|
|
2840
|
-
/**
|
|
4720
|
+
/**
|
|
4721
|
+
* Accessible name for an options-type list option.
|
|
4722
|
+
* @ignore
|
|
4723
|
+
*/
|
|
2841
4724
|
optionsTypeOptionAriaLabel(option) {
|
|
2842
4725
|
const displayKey = this.displayOptionKey();
|
|
2843
4726
|
const record = option;
|
|
@@ -2847,6 +4730,7 @@ class OasysComboboxComponent {
|
|
|
2847
4730
|
}
|
|
2848
4731
|
return display;
|
|
2849
4732
|
}
|
|
4733
|
+
/** @ignore */
|
|
2850
4734
|
isOptionSelected(option) {
|
|
2851
4735
|
const selected = this._selectedOption();
|
|
2852
4736
|
if (!selected) {
|
|
@@ -2859,7 +4743,9 @@ class OasysComboboxComponent {
|
|
|
2859
4743
|
/**
|
|
2860
4744
|
* On Change
|
|
2861
4745
|
* @param changes
|
|
4746
|
+
* @ignore
|
|
2862
4747
|
*/
|
|
4748
|
+
/** @ignore */
|
|
2863
4749
|
ngOnChanges(changes) {
|
|
2864
4750
|
// Detects if the autocomplete options list is changed after a selection of an option.
|
|
2865
4751
|
// Example: Address search can have options assigned to a group of options. One postcode to have x number of addresses.
|
|
@@ -2875,6 +4761,7 @@ class OasysComboboxComponent {
|
|
|
2875
4761
|
}
|
|
2876
4762
|
}
|
|
2877
4763
|
}
|
|
4764
|
+
/** @ignore */
|
|
2878
4765
|
ngOnInit() {
|
|
2879
4766
|
this.id.set(`${this.label()}${Math.random()}`);
|
|
2880
4767
|
this.resetSelection();
|
|
@@ -2899,11 +4786,13 @@ class OasysComboboxComponent {
|
|
|
2899
4786
|
this.openPanelWithoutSelectingOption();
|
|
2900
4787
|
}
|
|
2901
4788
|
}
|
|
4789
|
+
/** @ignore */
|
|
2902
4790
|
ngAfterViewInit() {
|
|
2903
4791
|
this.setupValidationListener();
|
|
2904
4792
|
}
|
|
2905
4793
|
/**
|
|
2906
4794
|
* Select Option
|
|
4795
|
+
* @ignore
|
|
2907
4796
|
*/
|
|
2908
4797
|
selectOption(option, index) {
|
|
2909
4798
|
this._selectedOption.set(option);
|
|
@@ -2920,6 +4809,7 @@ class OasysComboboxComponent {
|
|
|
2920
4809
|
}
|
|
2921
4810
|
/**
|
|
2922
4811
|
* On Key Navigation
|
|
4812
|
+
* @ignore
|
|
2923
4813
|
*/
|
|
2924
4814
|
onKeyDown(event) {
|
|
2925
4815
|
// For 'options' type, keyboard navigation is handled by the combobox container
|
|
@@ -2997,11 +4887,13 @@ class OasysComboboxComponent {
|
|
|
2997
4887
|
break;
|
|
2998
4888
|
}
|
|
2999
4889
|
}
|
|
4890
|
+
/** @ignore */
|
|
3000
4891
|
onOptionsListKeyDown(event) {
|
|
3001
4892
|
if (this.type() === 'options') {
|
|
3002
4893
|
this.onKeyDown(event);
|
|
3003
4894
|
}
|
|
3004
4895
|
}
|
|
4896
|
+
/** @ignore */
|
|
3005
4897
|
onClearButtonKeyDown(event) {
|
|
3006
4898
|
if (event.key !== 'Tab' || this.type() !== 'autocomplete' || !this.panelOpen()) {
|
|
3007
4899
|
return;
|
|
@@ -3017,6 +4909,7 @@ class OasysComboboxComponent {
|
|
|
3017
4909
|
footerBtn.focus();
|
|
3018
4910
|
}
|
|
3019
4911
|
}
|
|
4912
|
+
/** @ignore */
|
|
3020
4913
|
onFooterButtonKeyDown(event) {
|
|
3021
4914
|
if (event.key !== 'Tab' || this.type() !== 'autocomplete' || !this.panelOpen()) {
|
|
3022
4915
|
return;
|
|
@@ -3056,6 +4949,7 @@ class OasysComboboxComponent {
|
|
|
3056
4949
|
/**
|
|
3057
4950
|
* Close the panel when focus leaves the combobox entirely (e.g. tabbing past
|
|
3058
4951
|
* the footer button to the next field on the page).
|
|
4952
|
+
* @ignore
|
|
3059
4953
|
*/
|
|
3060
4954
|
onContainerFocusOut(event) {
|
|
3061
4955
|
if (this.type() !== 'options' || !this.panelOpen()) {
|
|
@@ -3069,6 +4963,7 @@ class OasysComboboxComponent {
|
|
|
3069
4963
|
}
|
|
3070
4964
|
/**
|
|
3071
4965
|
* Escape from the footer closes the panel and returns focus to the input.
|
|
4966
|
+
* @ignore
|
|
3072
4967
|
*/
|
|
3073
4968
|
onFooterEscape(event) {
|
|
3074
4969
|
event.preventDefault();
|
|
@@ -3078,6 +4973,7 @@ class OasysComboboxComponent {
|
|
|
3078
4973
|
}
|
|
3079
4974
|
/**
|
|
3080
4975
|
* Toggle Options Panel
|
|
4976
|
+
* @ignore
|
|
3081
4977
|
*/
|
|
3082
4978
|
togglePanel() {
|
|
3083
4979
|
this.openedViaKeyboard.set(false);
|
|
@@ -3091,6 +4987,7 @@ class OasysComboboxComponent {
|
|
|
3091
4987
|
}
|
|
3092
4988
|
/**
|
|
3093
4989
|
* Open Options Panel
|
|
4990
|
+
* @ignore
|
|
3094
4991
|
*/
|
|
3095
4992
|
openPanelWithoutSelectingOption(event) {
|
|
3096
4993
|
event?.preventDefault();
|
|
@@ -3119,7 +5016,9 @@ class OasysComboboxComponent {
|
|
|
3119
5016
|
}
|
|
3120
5017
|
}
|
|
3121
5018
|
/**
|
|
3122
|
-
*
|
|
5019
|
+
* Closes the list, keeping the current selection. Call it through a
|
|
5020
|
+
* `viewChild`, for example after loading `options` asynchronously in
|
|
5021
|
+
* autocomplete mode.
|
|
3123
5022
|
*/
|
|
3124
5023
|
closePanel() {
|
|
3125
5024
|
this.panelOpen.set(false);
|
|
@@ -3129,6 +5028,7 @@ class OasysComboboxComponent {
|
|
|
3129
5028
|
}
|
|
3130
5029
|
/**
|
|
3131
5030
|
* Get Input display value
|
|
5031
|
+
* @ignore
|
|
3132
5032
|
*/
|
|
3133
5033
|
writeValue(textValue) {
|
|
3134
5034
|
const selectedOpt = this._selectedOption();
|
|
@@ -3142,14 +5042,17 @@ class OasysComboboxComponent {
|
|
|
3142
5042
|
this.textValue.set(textValue);
|
|
3143
5043
|
}
|
|
3144
5044
|
}
|
|
5045
|
+
/** @ignore */
|
|
3145
5046
|
registerOnChange(fn) {
|
|
3146
5047
|
this.onChange = fn;
|
|
3147
5048
|
}
|
|
5049
|
+
/** @ignore */
|
|
3148
5050
|
registerOnTouched(fn) {
|
|
3149
5051
|
this.onTouched = fn;
|
|
3150
5052
|
}
|
|
3151
5053
|
/**
|
|
3152
5054
|
* On Model Change (options type)
|
|
5055
|
+
* @ignore
|
|
3153
5056
|
*/
|
|
3154
5057
|
onModelChange(textValue) {
|
|
3155
5058
|
this.textValue.set(textValue);
|
|
@@ -3160,6 +5063,7 @@ class OasysComboboxComponent {
|
|
|
3160
5063
|
}
|
|
3161
5064
|
/**
|
|
3162
5065
|
* On Model Change (autocomplete type)
|
|
5066
|
+
* @ignore
|
|
3163
5067
|
*/
|
|
3164
5068
|
onModelChangeAutocomplete(textValue) {
|
|
3165
5069
|
this.textValue.set(textValue);
|
|
@@ -3171,6 +5075,7 @@ class OasysComboboxComponent {
|
|
|
3171
5075
|
}
|
|
3172
5076
|
/**
|
|
3173
5077
|
* Event handling for Input value
|
|
5078
|
+
* @ignore
|
|
3174
5079
|
*/
|
|
3175
5080
|
handleEvent() {
|
|
3176
5081
|
this.inputDidChange.set(true);
|
|
@@ -3178,7 +5083,9 @@ class OasysComboboxComponent {
|
|
|
3178
5083
|
inputElement?.removeEventListener('change', this);
|
|
3179
5084
|
}
|
|
3180
5085
|
/**
|
|
3181
|
-
*
|
|
5086
|
+
* Clears the field text and selection and closes the list, as the clear button
|
|
5087
|
+
* does. Emits `didSearch` with `''`. Call it through a `viewChild` to reset the
|
|
5088
|
+
* field. Does not update the form control: reset that yourself.
|
|
3182
5089
|
*/
|
|
3183
5090
|
cleanInput() {
|
|
3184
5091
|
this.textValue.set('');
|
|
@@ -3190,13 +5097,16 @@ class OasysComboboxComponent {
|
|
|
3190
5097
|
}
|
|
3191
5098
|
/**
|
|
3192
5099
|
* On footer action
|
|
5100
|
+
* @ignore
|
|
3193
5101
|
*/
|
|
3194
5102
|
onFooterAction() {
|
|
3195
5103
|
this.didEdit.emit(undefined);
|
|
3196
5104
|
}
|
|
5105
|
+
/** @ignore */
|
|
3197
5106
|
onTextInputClick() {
|
|
3198
5107
|
this.openPanelWithoutSelectingOption();
|
|
3199
5108
|
}
|
|
5109
|
+
/** @ignore */
|
|
3200
5110
|
onScreenReaderFocus() {
|
|
3201
5111
|
const isPanelOpen = this.panelOpen();
|
|
3202
5112
|
const hasOptions = this.displayOptions().length > 0;
|
|
@@ -3422,11 +5332,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3422
5332
|
args: ['document:click', ['$event.target']]
|
|
3423
5333
|
}] } });
|
|
3424
5334
|
|
|
5335
|
+
/**
|
|
5336
|
+
* One tab inside a `<ui-tab-group>` (`<ui-tab>`). Its `tab_label` is shown in
|
|
5337
|
+
* the tab row and its projected content is the panel shown while it is
|
|
5338
|
+
* active. Only use it as a direct child of `<ui-tab-group>`; on its own it
|
|
5339
|
+
* renders nothing.
|
|
5340
|
+
*
|
|
5341
|
+
* @import import { OasysTabComponent } from 'oasys-lib';
|
|
5342
|
+
*/
|
|
3425
5343
|
class OasysTabComponent {
|
|
5344
|
+
/**
|
|
5345
|
+
* Text (a string) shown in the tab row, also used as the tab's accessible
|
|
5346
|
+
* name. Keep it short (one or two words) and plain text; bind it
|
|
5347
|
+
* (`[tab_label]`) for translated strings.
|
|
5348
|
+
*/
|
|
3426
5349
|
tab_label = undefined;
|
|
5350
|
+
/**
|
|
5351
|
+
* Open this tab when the group first renders instead of the first tab. Set
|
|
5352
|
+
* it on one tab only; if several are set, the first wins. Only read on init.
|
|
5353
|
+
*/
|
|
3427
5354
|
tab_active = false;
|
|
5355
|
+
/**
|
|
5356
|
+
* Emitted when the user opens this tab (click or Enter), including when it
|
|
5357
|
+
* is already open. Not emitted for the tab shown initially.
|
|
5358
|
+
*/
|
|
3428
5359
|
clicked = new EventEmitter();
|
|
5360
|
+
/** @ignore */
|
|
3429
5361
|
template;
|
|
5362
|
+
/** @ignore */
|
|
3430
5363
|
ngAfterContentInit() {
|
|
3431
5364
|
if (!this.template) {
|
|
3432
5365
|
throw new Error(this.tab_label + ': <ui-tab> can`t be empty');
|
|
@@ -3533,13 +5466,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3533
5466
|
type: Output
|
|
3534
5467
|
}], tab_active: [{ type: i0.Input, args: [{ isSignal: true, alias: "tab_active", required: false }] }] } });
|
|
3535
5468
|
|
|
5469
|
+
/**
|
|
5470
|
+
* A row of tabs that switches between panels of related content in the same
|
|
5471
|
+
* place on the page (`<ui-tab-group>`). Use it for peer views of one subject,
|
|
5472
|
+
* such as "Current" and "Past" orders. Don't use it for navigating between
|
|
5473
|
+
* pages (use links) or for steps in a flow.
|
|
5474
|
+
*
|
|
5475
|
+
* Put one `<ui-tab>` per panel inside the group; each tab's `tab_label` is its
|
|
5476
|
+
* heading and its content is the panel. At least one `<ui-tab>` is required,
|
|
5477
|
+
* otherwise the group throws on init. The first tab is shown unless one has
|
|
5478
|
+
* `[tab_active]="true"`.
|
|
5479
|
+
*
|
|
5480
|
+
* Only the active panel is rendered. Switching tabs destroys the previous
|
|
5481
|
+
* panel's content and creates the new one, so component state inside a panel
|
|
5482
|
+
* (such as unsaved form input) is lost when the user switches away.
|
|
5483
|
+
*
|
|
5484
|
+
* Renders `role="tablist"`, a `role="tab"` element per tab with
|
|
5485
|
+
* `aria-selected`, and one `role="tabpanel"` for the active panel. Keyboard:
|
|
5486
|
+
* Tab moves between tabs, Left and Right arrows move focus along the row
|
|
5487
|
+
* (wrapping), and Enter activates the focused tab. React to a tab being opened
|
|
5488
|
+
* with each `<ui-tab>`'s `clicked` output.
|
|
5489
|
+
*
|
|
5490
|
+
* @import import { OasysTabGroupComponent, OasysTabComponent } from 'oasys-lib';
|
|
5491
|
+
* @knownIssue With more than one `<ui-tab-group>` on the page, the arrow keys
|
|
5492
|
+
* move focus to the wrong tabs, including tabs in the other group: the
|
|
5493
|
+
* keyboard handler looks up tabs across the whole document. Workaround: show
|
|
5494
|
+
* only one tab group on a page at a time.
|
|
5495
|
+
* @knownIssue `tab_active` is only read when the group initialises: changing
|
|
5496
|
+
* it later does not switch tabs. Workaround: decide the starting tab before
|
|
5497
|
+
* the group renders, or re-create the group (for example inside an `@if`) to
|
|
5498
|
+
* reset it.
|
|
5499
|
+
* @knownIssue The keyboard pattern is incomplete: Space does not activate a
|
|
5500
|
+
* tab, Home and End do nothing, and every tab is a separate Tab stop instead
|
|
5501
|
+
* of the tab list being one. Workaround: none in consumer code; Enter and
|
|
5502
|
+
* click work.
|
|
5503
|
+
* @knownIssue Tabs and the panel are not linked (no `aria-controls`,
|
|
5504
|
+
* `aria-labelledby` or `id`), so the panel has no accessible name.
|
|
5505
|
+
* Workaround: start each panel's content with a heading or text that names
|
|
5506
|
+
* it.
|
|
5507
|
+
* @knownIssue `OasysTabsModule` exports nothing, so importing it does not
|
|
5508
|
+
* make `<ui-tab-group>` or `<ui-tab>` available. Workaround: import the
|
|
5509
|
+
* standalone `OasysTabGroupComponent` and `OasysTabComponent` instead.
|
|
5510
|
+
*/
|
|
3536
5511
|
class OasysTabGroupComponent {
|
|
5512
|
+
/**
|
|
5513
|
+
* Width of the line under the active tab: `small` (30px) for compact rows
|
|
5514
|
+
* and filters, `large` (60px) for page-level tabs. Tab labels are the same
|
|
5515
|
+
* size either way.
|
|
5516
|
+
*/
|
|
3537
5517
|
tab_size = 'small';
|
|
5518
|
+
/** @ignore */
|
|
3538
5519
|
tabs;
|
|
5520
|
+
/** @ignore */
|
|
3539
5521
|
activeComponent;
|
|
5522
|
+
/** @ignore */
|
|
3540
5523
|
getIndicatorClass() {
|
|
3541
5524
|
return this.tab_size === 'small' ? 'nav-item_indicator line' : 'nav-item_indicator large line';
|
|
3542
5525
|
}
|
|
5526
|
+
/** @ignore */
|
|
3543
5527
|
ngAfterContentInit() {
|
|
3544
5528
|
if (this.tabs.length === 0) {
|
|
3545
5529
|
throw new Error('<ui-tab-group> requires at least one <ui-tab>');
|
|
@@ -3547,6 +5531,7 @@ class OasysTabGroupComponent {
|
|
|
3547
5531
|
const selectedTab = this.tabs?.find((tab) => !!tab.tab_active);
|
|
3548
5532
|
this.activeComponent = selectedTab ?? this.tabs?.first;
|
|
3549
5533
|
}
|
|
5534
|
+
/** @ignore */
|
|
3550
5535
|
activateTab(tab) {
|
|
3551
5536
|
this.activeComponent = tab;
|
|
3552
5537
|
this.activeComponent.clicked.emit();
|
|
@@ -3621,9 +5606,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3621
5606
|
}]
|
|
3622
5607
|
}] });
|
|
3623
5608
|
|
|
5609
|
+
/**
|
|
5610
|
+
* A horizontal bar that shows how far through something the customer is
|
|
5611
|
+
* (`<ui-progress-bar>`), for example delivery tracking or steps in a flow.
|
|
5612
|
+
*
|
|
5613
|
+
* The filled width is `currentValue / maxValue`, clamped between 0% and 100%,
|
|
5614
|
+
* and animates when it changes. It fills the width of its container and has
|
|
5615
|
+
* no text of its own: put a visible label next to it that says what the
|
|
5616
|
+
* progress is (for example "Out for delivery" or "Step 2 of 4").
|
|
5617
|
+
*
|
|
5618
|
+
* Accessibility: renders `role="progressbar"` with `aria-valuemin="0"`,
|
|
5619
|
+
* `aria-valuemax="100"` and `aria-valuenow` set to the percentage (not the raw
|
|
5620
|
+
* `currentValue`).
|
|
5621
|
+
*
|
|
5622
|
+
* @import import { OasysProgressBarComponent } from 'oasys-lib';
|
|
5623
|
+
* @knownIssue The progress bar has no accessible name and there is no input to
|
|
5624
|
+
* give it one (the role is on an inner element, so `aria-label` on
|
|
5625
|
+
* `<ui-progress-bar>` doesn't reach it). Screen readers announce only
|
|
5626
|
+
* "progress bar, N%" and axe reports `aria-progressbar-name`. Workaround: always
|
|
5627
|
+
* show the progress as visible text right next to the bar so the information is
|
|
5628
|
+
* available without it.
|
|
5629
|
+
*/
|
|
3624
5630
|
class ProgressBarComponent {
|
|
5631
|
+
/**
|
|
5632
|
+
* How much progress has been made, in the same units as `maxValue`. Values
|
|
5633
|
+
* below 0 or above `maxValue` are clamped.
|
|
5634
|
+
*/
|
|
3625
5635
|
currentValue = 0;
|
|
5636
|
+
/**
|
|
5637
|
+
* The value that means complete. Use it for step-based progress, e.g.
|
|
5638
|
+
* `currentValue` 3 of `maxValue` 5. A value of 0 or less shows an empty bar.
|
|
5639
|
+
*/
|
|
3626
5640
|
maxValue = 100;
|
|
5641
|
+
/** @ignore */
|
|
3627
5642
|
get percentage() {
|
|
3628
5643
|
if (this.maxValue <= 0) {
|
|
3629
5644
|
return 0;
|
|
@@ -3662,20 +5677,42 @@ const LOGO_NAMES = [
|
|
|
3662
5677
|
];
|
|
3663
5678
|
|
|
3664
5679
|
/**
|
|
3665
|
-
* Renders full-colour artwork from the shared logo sprite. Unlike
|
|
3666
|
-
* logos keep their own colours, so they look the same on every
|
|
3667
|
-
* payment provider badges exist so far
|
|
3668
|
-
*
|
|
5680
|
+
* Renders full-colour artwork from the shared logo sprite (`<ui-logo>`). Unlike
|
|
5681
|
+
* `<ui-icon>`, logos keep their own colours, so they look the same on every
|
|
5682
|
+
* brand. Only payment provider badges exist so far (the payment icons that used
|
|
5683
|
+
* to be in the icon sprite live here now); they render at a fixed 45 x 32 px
|
|
5684
|
+
* so rows of payment methods line up.
|
|
5685
|
+
*
|
|
5686
|
+
* Renders an inline `<svg viewBox="0 0 45 32">` that references
|
|
5687
|
+
* `./shared/assets/logos/logos.svg#logo-<logo_name>`. The consuming app must
|
|
5688
|
+
* serve `oasys-lib/src/assets/shared` at `shared/assets` relative to the
|
|
5689
|
+
* document base URL. An unknown `logo_name` renders nothing, silently.
|
|
5690
|
+
*
|
|
5691
|
+
* Accessibility: decorative by default (`aria-hidden="true"`), which is right
|
|
5692
|
+
* when visible text next to it names the provider. When the logo alone says
|
|
5693
|
+
* which payment methods are accepted, set `alt_text` to the provider's name
|
|
5694
|
+
* (for example "Visa"); it becomes the `aria-label` of a `role="img"`.
|
|
5695
|
+
*
|
|
5696
|
+
* Lay out a row of logos with `<ui-stack stack_direction="x" [stack_wrap]="true">`.
|
|
5697
|
+
*
|
|
5698
|
+
* @import import { OasysLogoComponent } from 'oasys-lib';
|
|
3669
5699
|
*/
|
|
3670
5700
|
class LogoComponent {
|
|
5701
|
+
/** Which logo to show. All names are listed in the exported `LOGO_NAMES`. */
|
|
3671
5702
|
logo_name;
|
|
3672
5703
|
/** Any CSS length, e.g. '4.8rem'. Sets the height; the width keeps the 45 x 32 ratio. */
|
|
3673
5704
|
logo_size_override;
|
|
3674
|
-
/**
|
|
5705
|
+
/**
|
|
5706
|
+
* Accessible name, usually the provider's name (for example "Visa"). Leave
|
|
5707
|
+
* empty when nearby text already names it; the logo is then hidden from
|
|
5708
|
+
* assistive technology.
|
|
5709
|
+
*/
|
|
3675
5710
|
alt_text = '';
|
|
5711
|
+
/** @ignore */
|
|
3676
5712
|
get isKnownLogo() {
|
|
3677
5713
|
return LOGO_NAMES.includes(this.logo_name);
|
|
3678
5714
|
}
|
|
5715
|
+
/** @ignore */
|
|
3679
5716
|
get logoPath() {
|
|
3680
5717
|
return `./shared/assets/logos/logos.svg#logo-${this.logo_name}`;
|
|
3681
5718
|
}
|
|
@@ -3694,11 +5731,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3694
5731
|
type: Input
|
|
3695
5732
|
}] } });
|
|
3696
5733
|
|
|
5734
|
+
/**
|
|
5735
|
+
* One field's entry in a `<ui-form-errors-summary>`
|
|
5736
|
+
* (`<ui-form-errors-summary-item>`). Shows the first error message of
|
|
5737
|
+
* `abstractControl` from `error_messages`, and nothing when the control is
|
|
5738
|
+
* valid or the key has no message.
|
|
5739
|
+
*
|
|
5740
|
+
* Clicking it or pressing Enter on it focuses the matching `<ui-text-input>`
|
|
5741
|
+
* and scrolls it into view; Shift+Tab from that input returns to the item. Only
|
|
5742
|
+
* `<ui-text-input>` is supported, not textarea, combobox or other controls.
|
|
5743
|
+
* See the known issues on `<ui-form-errors-summary>` before relying on this.
|
|
5744
|
+
*
|
|
5745
|
+
* @import import { OasysFormErrorsSummaryItemComponent } from 'oasys-lib';
|
|
5746
|
+
*/
|
|
3697
5747
|
class OasysFormErrorsSummaryItemComponent {
|
|
3698
5748
|
elementRef = inject(ElementRef);
|
|
5749
|
+
/** @ignore */
|
|
3699
5750
|
itemId = signal('errors-summary-item', ...(ngDevMode ? [{ debugName: "itemId" }] : /* istanbul ignore next */ []));
|
|
5751
|
+
/** The control this item reports on, e.g. `form.get('email')`. Must belong to the summary's `formGroup` for click-to-focus to find it. */
|
|
3700
5752
|
abstractControl = input(...(ngDevMode ? [undefined, { debugName: "abstractControl" }] : /* istanbul ignore next */ []));
|
|
5753
|
+
/** Translated messages keyed by validator error key, the same map as the field's `<ui-form-errors>`. */
|
|
3701
5754
|
error_messages = input({}, ...(ngDevMode ? [{ debugName: "error_messages" }] : /* istanbul ignore next */ []));
|
|
5755
|
+
/** @ignore */
|
|
3702
5756
|
focusOnControl() {
|
|
3703
5757
|
const control = this.abstractControl();
|
|
3704
5758
|
// Log the control name - it's stored in the parent FormGroup
|
|
@@ -3740,6 +5794,7 @@ class OasysFormErrorsSummaryItemComponent {
|
|
|
3740
5794
|
inputElement.addEventListener('keydown', onShiftTab);
|
|
3741
5795
|
inputElement.addEventListener('blur', cleanup);
|
|
3742
5796
|
}
|
|
5797
|
+
/** @ignore */
|
|
3743
5798
|
errorMessage = computed(() => {
|
|
3744
5799
|
const currentErrors = this.abstractControl()?.errors;
|
|
3745
5800
|
const messages = this.error_messages() ?? {};
|
|
@@ -3760,9 +5815,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3760
5815
|
}, template: "@if (errorMessage() && !!abstractControl()?.errors) {\n <li\n class=\"text-link--paragraph text-body--supporting\"\n (click)=\"focusOnControl()\"\n (keydown.enter)=\"focusOnControl()\"\n tabindex=\"0\"\n aria-live=\"polite\"\n [attr.aria-labelledby]=\"'errors-summary-title ' + itemId()\"\n >\n <span [id]=\"itemId()\">\n {{ errorMessage() }}\n </span>\n </li>\n}\n" }]
|
|
3761
5816
|
}], propDecorators: { abstractControl: [{ type: i0.Input, args: [{ isSignal: true, alias: "abstractControl", required: false }] }], error_messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "error_messages", required: false }] }] } });
|
|
3762
5817
|
|
|
5818
|
+
/**
|
|
5819
|
+
* Lists every error in a form in one box (`<ui-form-errors-summary>`), so
|
|
5820
|
+
* users submitting a form know what to fix and can jump to each field. Use it
|
|
5821
|
+
* at the top of forms with more than one or two fields, alongside the inline
|
|
5822
|
+
* `<ui-form-errors>` on each field.
|
|
5823
|
+
*
|
|
5824
|
+
* Built from three components, all needed:
|
|
5825
|
+
* - `<ui-form-errors-summary [formGroup]>`: the box. Shown whenever the form
|
|
5826
|
+
* group is invalid and has at least one item.
|
|
5827
|
+
* - `<ui-form-errors-summary-title>`: the heading, e.g. "There's a problem
|
|
5828
|
+
* with your details".
|
|
5829
|
+
* - `<ui-form-errors-summary-item [abstractControl] [error_messages]>`: one per
|
|
5830
|
+
* field. Shows that control's first error message and nothing when the
|
|
5831
|
+
* control is valid.
|
|
5832
|
+
*
|
|
5833
|
+
* Usage rules:
|
|
5834
|
+
* - It shows as soon as the form is invalid, including on first load. Wrap it
|
|
5835
|
+
* in `@if (submitted)` so it only appears after the user submits.
|
|
5836
|
+
* - It has no live region and does not move focus. After submit, move focus to
|
|
5837
|
+
* the title (it has `tabindex="-1"`) or a focusable wrapper so screen readers
|
|
5838
|
+
* announce it and keyboard users land on it.
|
|
5839
|
+
* - Use the same messages as the inline `<ui-form-errors>` so both match.
|
|
5840
|
+
* - Only use one summary per page: the title has a fixed `id`.
|
|
5841
|
+
*
|
|
5842
|
+
* Logs a console error if it has no items.
|
|
5843
|
+
*
|
|
5844
|
+
* @import import { OasysFormErrorsSummaryComponent, OasysFormErrorsSummaryTitleComponent, OasysFormErrorsSummaryItemComponent } from 'oasys-lib';
|
|
5845
|
+
* @knownIssue Clicking a `<ui-form-errors-summary-item>` does nothing unless
|
|
5846
|
+
* the target `<ui-text-input>` has an `ng-reflect-name` attribute equal to its
|
|
5847
|
+
* control name. Angular no longer outputs these attributes (never in
|
|
5848
|
+
* production, and not in development since v20 by default). Workaround: add a
|
|
5849
|
+
* static attribute matching `formControlName`, e.g.
|
|
5850
|
+
* `<ui-text-input formControlName="email" ng-reflect-name="email">`.
|
|
5851
|
+
* @knownIssue A `<ui-form-errors-summary-item>` works out its message when it
|
|
5852
|
+
* first renders and does not follow later changes to the control's errors: a
|
|
5853
|
+
* control that was valid at that point never appears, and one whose error
|
|
5854
|
+
* changes (for example from `required` to `email`) keeps the first message. It
|
|
5855
|
+
* does disappear once the control is valid. Workaround: only render the summary
|
|
5856
|
+
* after submit, and render the items with `@for` over the fields that are
|
|
5857
|
+
* invalid now, tracking by field name and error key, so an item is re-created
|
|
5858
|
+
* when its error changes.
|
|
5859
|
+
* @knownIssue The error list is not a valid list: each `<li>` sits inside a
|
|
5860
|
+
* `<ui-form-errors-summary-item>` element rather than directly in the `<ul>`, so
|
|
5861
|
+
* screen readers may not announce it as a list or say how many errors there
|
|
5862
|
+
* are, and automated accessibility checks fail (axe `list` / `listitem`).
|
|
5863
|
+
* Workaround: none in consumer code; keep the summary title explicit about the
|
|
5864
|
+
* number of errors where you can.
|
|
5865
|
+
*/
|
|
3763
5866
|
class OasysFormErrorsSummaryComponent {
|
|
5867
|
+
/** The form to summarise. The box shows while it is invalid; pass the same `FormGroup` your `<form [formGroup]>` uses. */
|
|
3764
5868
|
formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
5869
|
+
/** @ignore */
|
|
3765
5870
|
errorsSummaryItems = contentChildren(OasysFormErrorsSummaryItemComponent, ...(ngDevMode ? [{ debugName: "errorsSummaryItems" }] : /* istanbul ignore next */ []));
|
|
5871
|
+
/** @ignore */
|
|
3766
5872
|
hasErrorsSummaryItems = computed(() => this.errorsSummaryItems().length > 0, ...(ngDevMode ? [{ debugName: "hasErrorsSummaryItems" }] : /* istanbul ignore next */ []));
|
|
3767
5873
|
constructor() {
|
|
3768
5874
|
effect(() => {
|
|
@@ -3783,6 +5889,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
3783
5889
|
args: [{ selector: 'ui-form-errors-summary', standalone: true, imports: [LayoutBoxComponent, LayoutStackComponent, IconComponent], template: "<div #errorsSummary>\n @if (!formGroup().valid && hasErrorsSummaryItems()) {\n <ui-box class=\"ui-form-errors-summary\" box_space=\"near\" box_align_x=\"center\">\n <ui-stack stack_direction=\"x\" stack_gap=\"near\">\n <div class=\"badge\">\n <ui-icon icon_name=\"error\" icon_size_override=\"2\"></ui-icon>\n </div>\n\n <ui-stack stack_gap=\"near\">\n <ui-stack stack_gap=\"tight\" class=\"content\" stack_direction=\"y\">\n <div class=\"text-label--secondary\" id=\"errors-summary-title\">\n <ng-content select=\"ui-form-errors-summary-title\"></ng-content>\n </div>\n <ul>\n <ng-content></ng-content>\n </ul>\n </ui-stack>\n </ui-stack>\n </ui-stack>\n </ui-box>\n }\n</div>\n", styles: [":host{display:contents}.ui-form-errors-summary{margin-bottom:var(--oasys-spacing-near);background-color:var(--oasys-color-system-background-negative)}.ui-form-errors-summary .badge{padding:2px;border-radius:9999px;color:var(--oasys-color-brand-foreground-primary-on-dark);background-color:var(--oasys-color-system-foreground-negative)}.ui-form-errors-summary .badge ui-icon{fill:currentColor}.ui-form-errors-summary .content{gap:var(--oasys-spacing-tiny)}.ui-form-errors-summary ul{margin:0}\n"] }]
|
|
3784
5890
|
}], ctorParameters: () => [], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], errorsSummaryItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OasysFormErrorsSummaryItemComponent), { isSignal: true }] }] } });
|
|
3785
5891
|
|
|
5892
|
+
/**
|
|
5893
|
+
* Heading of a `<ui-form-errors-summary>` (`<ui-form-errors-summary-title>`).
|
|
5894
|
+
* Project the text, e.g. "There's a problem with your details". It is
|
|
5895
|
+
* programmatically focusable (`tabindex="-1"`): move focus here after a failed
|
|
5896
|
+
* submit so screen readers announce the summary. Each item's accessible name
|
|
5897
|
+
* starts with this title.
|
|
5898
|
+
*
|
|
5899
|
+
* @import import { OasysFormErrorsSummaryTitleComponent } from 'oasys-lib';
|
|
5900
|
+
*/
|
|
3786
5901
|
class OasysFormErrorsSummaryTitleComponent {
|
|
3787
5902
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: OasysFormErrorsSummaryTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3788
5903
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.25", type: OasysFormErrorsSummaryTitleComponent, isStandalone: true, selector: "ui-form-errors-summary-title", host: { attributes: { "tabindex": "-1" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
@@ -3806,8 +5921,45 @@ const THEME_VALUE = {
|
|
|
3806
5921
|
TIER_2: 'loyalty-tier-2',
|
|
3807
5922
|
};
|
|
3808
5923
|
const SCOPED_THEME_CLASSES = [THEME_VALUE.TIER_1, THEME_VALUE.TIER_2];
|
|
5924
|
+
/**
|
|
5925
|
+
* Switches part of the page to a loyalty theme (`ui-theme` / `uiTheme`
|
|
5926
|
+
* attribute). Put it on any element or Oasys component; that element and
|
|
5927
|
+
* everything inside it then use the chosen theme's design tokens, so one view
|
|
5928
|
+
* can mix the normal brand look with loyalty-tier sections.
|
|
5929
|
+
*
|
|
5930
|
+
* - `loyalty-tier-1` / `loyalty-tier-2` add that class to the element.
|
|
5931
|
+
* - `default` resets the subtree back to the page brand inside a themed
|
|
5932
|
+
* section: it copies the nearest ancestor's `brand-tokens-*` class onto the
|
|
5933
|
+
* element. Use it for e.g. a normal product card inside a loyalty panel.
|
|
5934
|
+
*
|
|
5935
|
+
* Requirements:
|
|
5936
|
+
* - Import the directive (`OasysThemeDirective` or `OasysDirectivesModule`).
|
|
5937
|
+
* A static `ui-theme="loyalty-tier-1"` on an element whose template does not
|
|
5938
|
+
* import it does nothing, with no error.
|
|
5939
|
+
* - The page needs a base brand class (`brand-tokens-bloomandwild`,
|
|
5940
|
+
* `brand-tokens-bloomon` or `brand-tokens-bergamotte`) on an ancestor, and
|
|
5941
|
+
* the matching `<brand>-loyalty-tier-1/2/variables.css` must be loaded. The
|
|
5942
|
+
* tier tokens are scoped as `.brand-tokens-<brand> .loyalty-tier-N`, so they
|
|
5943
|
+
* do nothing under a whole-page loyalty brand class such as
|
|
5944
|
+
* `brand-tokens-bloomandwild-loyalty-tier-1`.
|
|
5945
|
+
*
|
|
5946
|
+
* Theming only changes colours and other tokens. It carries no meaning for
|
|
5947
|
+
* assistive technology, so never rely on the theme alone to tell users which
|
|
5948
|
+
* tier they are in: say it in text too.
|
|
5949
|
+
*
|
|
5950
|
+
* @import import { OasysThemeDirective } from 'oasys-lib';
|
|
5951
|
+
*/
|
|
3809
5952
|
class OasysThemeDirective {
|
|
5953
|
+
/**
|
|
5954
|
+
* Theme for this element and its subtree, written `ui-theme="..."`. Leave it
|
|
5955
|
+
* off to inherit from the parent; `default` explicitly resets to the page
|
|
5956
|
+
* brand. Bind it (`[ui-theme]="tierThemeName()"`) to follow the user's tier.
|
|
5957
|
+
*/
|
|
3810
5958
|
uiThemeDashed = input(THEME_VALUE.DEFAULT, { ...(ngDevMode ? { debugName: "uiThemeDashed" } : /* istanbul ignore next */ {}), alias: 'ui-theme' });
|
|
5959
|
+
/**
|
|
5960
|
+
* Same as `ui-theme`, written `uiTheme`. When both are set, `uiTheme` wins;
|
|
5961
|
+
* when it is `undefined`, `ui-theme` is used.
|
|
5962
|
+
*/
|
|
3811
5963
|
uiThemeCamel = input(undefined, { ...(ngDevMode ? { debugName: "uiThemeCamel" } : /* istanbul ignore next */ {}), alias: 'uiTheme' });
|
|
3812
5964
|
elementRef = inject(ElementRef);
|
|
3813
5965
|
appliedDefaultBrandClass;
|