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