@cngx/common 0.0.1-rc.0 → 0.1.0-rc.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/a11y/README.md +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +140 -40
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2025 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1258 -60
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +247 -41
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +5 -4
- package/popover/README.md +8 -34
- package/stepper/README.md +49 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +136 -36
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1862 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1110 -38
- package/types/cngx-common-tabs.d.ts +306 -32
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -9,11 +9,11 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
9
9
|
* Semantic card component that adapts its host element role based on the `as` input.
|
|
10
10
|
*
|
|
11
11
|
* Three archetypes:
|
|
12
|
-
* - `'article'` (default)
|
|
13
|
-
* - `'button'`
|
|
14
|
-
* - `'link'`
|
|
12
|
+
* - `'article'` (default) - display card, no primary action
|
|
13
|
+
* - `'button'` - the entire card is a clickable button
|
|
14
|
+
* - `'link'` - the entire card is a navigation link
|
|
15
15
|
*
|
|
16
|
-
* The host element **is** the semantic element
|
|
16
|
+
* The host element **is** the semantic element - no inner wrapper.
|
|
17
17
|
* This eliminates double focus rings and wrapper problems for screen readers.
|
|
18
18
|
*
|
|
19
19
|
* ### Action card with selection
|
|
@@ -30,6 +30,19 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
30
30
|
* <img cngxCardMedia alt="Photo" />
|
|
31
31
|
* </cngx-card>
|
|
32
32
|
* ```
|
|
33
|
+
*
|
|
34
|
+
* @category common/card
|
|
35
|
+
* @docsKind primary
|
|
36
|
+
* @wcag AA
|
|
37
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card.component.ts
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
* @relatedTo CngxCardGrid, CngxCardHeader, CngxCardBody, CngxCardFooter, CngxCardSkeleton
|
|
40
|
+
* <example-url>http://localhost:4200/#/common/card/card-with-disclosure-expand-collapse</example-url>
|
|
41
|
+
* <example-url>http://localhost:4200/#/common/card/card-with-expandable-text</example-url>
|
|
42
|
+
|
|
43
|
+
* <example-url>http://localhost:4200/#/common/card/card-with-speak-badge</example-url>
|
|
44
|
+
* <example-url>http://localhost:4200/#/common/card/disabled-with-reason</example-url>
|
|
45
|
+
|
|
33
46
|
*/
|
|
34
47
|
class CngxCard {
|
|
35
48
|
uid = nextUid('cngx-card');
|
|
@@ -71,7 +84,7 @@ class CngxCard {
|
|
|
71
84
|
/**
|
|
72
85
|
* @internal Tabindex management.
|
|
73
86
|
* When inside a CngxRovingTabindex parent (e.g. CngxCardGrid), the roving
|
|
74
|
-
* controller manages tabindex via CngxRovingItem
|
|
87
|
+
* controller manages tabindex via CngxRovingItem - card does not set its own.
|
|
75
88
|
* When standalone, interactive cards get tabindex="0".
|
|
76
89
|
*/
|
|
77
90
|
hostTabindex = computed(() => {
|
|
@@ -84,7 +97,7 @@ class CngxCard {
|
|
|
84
97
|
disabledReasonId = `${this.uid}-disabled-reason`;
|
|
85
98
|
/** @internal */
|
|
86
99
|
liveRegionId = `${this.uid}-live`;
|
|
87
|
-
/** @internal IDs for `aria-describedby`
|
|
100
|
+
/** @internal IDs for `aria-describedby` - always present, aria-hidden controls what SR reads. */
|
|
88
101
|
describedByIds = computed(() => {
|
|
89
102
|
const ids = [this.disabledReasonId];
|
|
90
103
|
return ids.join(' ');
|
|
@@ -155,17 +168,11 @@ class CngxCard {
|
|
|
155
168
|
<span [id]="liveRegionId" aria-live="polite" aria-atomic="true" class="cngx-sr-only">
|
|
156
169
|
{{ liveAnnouncement() }}
|
|
157
170
|
</span>
|
|
158
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
171
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-card-padding{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@property --cngx-card-radius{syntax: \"<length>\"; inherits: false; initial-value: 12px;}@property --cngx-card-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-card-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.81 .005 250);}@property --cngx-card-min-width{syntax: \"<length>\"; inherits: false; initial-value: 120px;}@property --cngx-card-hover-shadow{syntax: \"*\"; inherits: false; initial-value: 0 2px 8px 0 oklch(0 0 0 / .12);}@property --cngx-card-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .88;}@property --cngx-card-focus-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-card-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-card-focus-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-selected-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-selected-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .04 50);}@property --cngx-card-selected-bar-width{syntax: \"<length>\"; inherits: false; initial-value: 3px;}@property --cngx-card-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-card-loading-shimmer{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0 / .4);}@property --cngx-card-loading-overlay{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0 / .3);}@property --cngx-card-title-size{syntax: \"*\"; inherits: true; initial-value: 1rem;}@property --cngx-card-title-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-card-title-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-card-subtitle-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-card-subtitle-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-card-subtitle-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-card-divider{syntax: \"<color>\"; inherits: true; initial-value: oklch(.81 .005 250);}@property --cngx-card-accent-width{syntax: \"<length>\"; inherits: false; initial-value: 3px;}@property --cngx-card-accent-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-card-accent-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .03 250);}@property --cngx-card-accent-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .04 145);}@property --cngx-card-accent-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .04 75);}@property --cngx-card-accent-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .03 25);}@property --cngx-card-badge-offset{syntax: \"<length>\"; inherits: false; initial-value: -6px;}@property --cngx-card-badge-size-sm{syntax: \"<length>\"; inherits: false; initial-value: 10px;}@property --cngx-card-badge-size-md{syntax: \"<length>\"; inherits: false; initial-value: 22px;}@property --cngx-card-badge-size-lg{syntax: \"<length>\"; inherits: false; initial-value: 28px;}@property --cngx-card-badge-padding-inline{syntax: \"<length>\"; inherits: false; initial-value: 5px;}@property --cngx-card-badge-font-size-sm{syntax: \"*\"; inherits: false; initial-value: .625rem;}@property --cngx-card-badge-font-size-md{syntax: \"*\"; inherits: false; initial-value: .7rem;}@property --cngx-card-badge-font-size-lg{syntax: \"*\"; inherits: false; initial-value: .8125rem;}@property --cngx-card-badge-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-card-badge-border{syntax: \"*\"; inherits: true; initial-value: 2px solid oklch(1 0 0);}@property --cngx-card-badge-primary-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-badge-primary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .22 25);}@property --cngx-card-badge-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@property --cngx-card-badge-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-card-badge-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-card-badge-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-neutral-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-card-badge-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}:root{--cngx-card-bg: var(--cngx-color-surface);--cngx-card-color: var(--cngx-color-text);--cngx-card-border: 1px solid var(--cngx-color-border);--cngx-card-divider: var(--cngx-color-border);--cngx-card-title-color: var(--cngx-color-text)}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-card-subtitle-color: oklch(.72 .02 290);--cngx-card-selected-bg: oklch(.36 .06 50);--cngx-card-accent-info-bg: oklch(.32 .05 250);--cngx-card-accent-success-bg: oklch(.32 .06 145);--cngx-card-accent-warning-bg: oklch(.32 .06 75);--cngx-card-accent-danger-bg: oklch(.32 .05 25);--cngx-card-badge-border: 2px solid oklch(.2 .01 250)}}[data-color-scheme=dark],.dark{--cngx-card-subtitle-color: oklch(.72 .02 290);--cngx-card-selected-bg: oklch(.36 .06 50);--cngx-card-accent-info-bg: oklch(.32 .05 250);--cngx-card-accent-success-bg: oklch(.32 .06 145);--cngx-card-accent-warning-bg: oklch(.32 .06 75);--cngx-card-accent-danger-bg: oklch(.32 .05 25);--cngx-card-badge-border: 2px solid oklch(.2 .01 250)}[data-color-scheme=light],.light{--cngx-card-subtitle-color: oklch(.36 .02 290);--cngx-card-selected-bg: oklch(.96 .04 50);--cngx-card-accent-info-bg: oklch(.97 .03 250);--cngx-card-accent-success-bg: oklch(.97 .04 145);--cngx-card-accent-warning-bg: oklch(.97 .04 75);--cngx-card-accent-danger-bg: oklch(.97 .03 25);--cngx-card-badge-border: 2px solid oklch(1 0 0)}}@layer cngx.components{@scope(.cngx-card){:scope{display:block;position:relative;padding:var(--cngx-card-padding, var(--cngx-space-md, 16px));border-radius:var(--cngx-card-radius, var(--cngx-radius-lg, 12px));background:var(--cngx-card-bg, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-card-border, 1px solid var(--cngx-color-border, oklch(.81 .005 250)));color:var(--cngx-card-color, var(--cngx-color-text, oklch(.2 .01 290)));transition:box-shadow var(--cngx-duration-fast, .15s) ease,border-color var(--cngx-duration-fast, .15s) ease,background var(--cngx-duration-fast, .15s) ease;min-height:44px;min-width:var(--cngx-card-min-width, 120px);touch-action:manipulation}:scope.cngx-card--interactive{cursor:pointer;-webkit-tap-highlight-color:transparent}:scope.cngx-card--interactive:hover{box-shadow:var(--cngx-card-hover-shadow, 0 2px 8px 0 oklch(0 0 0 / .12))}@media(hover:none){:scope.cngx-card--interactive:active{opacity:var(--cngx-card-active-opacity, .88)}}:scope:focus-visible{outline:var(--cngx-card-focus-width, 2px) solid var(--cngx-card-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-card-focus-offset, 2px)}:scope:has(:focus-visible):not(:focus-visible){outline:var(--cngx-card-focus-width, 2px) solid var(--cngx-card-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-card-focus-offset, 2px)}:scope.cngx-card--selected{border-color:var( --cngx-card-selected-border, var(--cngx-color-primary, oklch(.66 .19 50)) );background:var( --cngx-card-selected-bg, color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--selected:before{content:\"\";position:absolute;inset-inline-start:0;inset-block:var(--cngx-card-radius, 12px);width:var(--cngx-card-selected-bar-width, 3px);background:var(--cngx-card-selected-border, var(--cngx-color-primary, oklch(.66 .19 50)));border-radius:999px}:scope.cngx-card--disabled{opacity:var(--cngx-card-disabled-opacity, .5);pointer-events:none}:scope.cngx-card--loading{pointer-events:none;cursor:wait}:scope.cngx-card--loading:after{content:\"\";position:absolute;inset:0;border-radius:inherit;background:linear-gradient(90deg,transparent 25%,var(--cngx-card-loading-shimmer, oklch(1 0 0 / .4)) 50%,transparent 75%);background-size:200% 100%;animation:cngx-card-shimmer 1.5s ease-in-out infinite}@media(prefers-reduced-motion:reduce){:scope.cngx-card--loading:after{animation:none;background:var(--cngx-card-loading-overlay, oklch(1 0 0 / .3))}}.cngx-card__media{margin:calc(-1 * var(--cngx-card-padding, var(--cngx-space-md, 16px)));margin-bottom:0;overflow:hidden;border-radius:var(--cngx-card-radius, var(--cngx-radius-lg, 12px)) var(--cngx-card-radius, var(--cngx-radius-lg, 12px)) 0 0}.cngx-card__media img,.cngx-card__media video{display:block;width:100%;height:100%;object-fit:cover}.cngx-card__header{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--cngx-space-sm, 8px);padding-block:var(--cngx-space-xs, 4px)}.cngx-card__title{margin:0;font-size:var(--cngx-card-title-size, 1rem);font-weight:var(--cngx-card-title-weight, 600);color:var(--cngx-card-title-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.3}.cngx-card__subtitle{width:100%;margin:0;font-size:var(--cngx-card-subtitle-size, .8125rem);font-weight:var(--cngx-card-subtitle-weight, 400);color:var(--cngx-card-subtitle-color, oklch(.36 .02 290));line-height:1.4}.cngx-card__body{padding-block:var(--cngx-space-xs, 4px)}.cngx-card__footer{margin-top:auto;padding-block-start:var(--cngx-space-sm, 8px)}.cngx-card__actions{display:flex;align-items:center;gap:var(--cngx-space-sm, 8px);padding-block-start:var(--cngx-space-sm, 8px);border-top:1px solid var(--cngx-card-divider, var(--cngx-color-border, oklch(.81 .005 250)))}.cngx-card__actions--end{justify-content:flex-end}:scope.cngx-card--accent{border-top:var(--cngx-card-accent-width, 3px) solid var(--cngx-card-accent-color, transparent)}:scope.cngx-card--accent-info{--cngx-card-accent-color: var(--cngx-color-info, oklch(.65 .12 240));background:var( --cngx-card-accent-info-bg, color-mix( in oklch, var(--cngx-color-info, oklch(.65 .12 240)) 6%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-success{--cngx-card-accent-color: var(--cngx-color-success, oklch(.6 .15 145));background:var( --cngx-card-accent-success-bg, color-mix( in oklch, var(--cngx-color-success, oklch(.6 .15 145)) 6%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-warning{--cngx-card-accent-color: var(--cngx-color-warning, oklch(.72 .15 75));background:var( --cngx-card-accent-warning-bg, color-mix( in oklch, var(--cngx-color-warning, oklch(.72 .15 75)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-danger{--cngx-card-accent-color: var(--cngx-color-danger, oklch(.6 .18 25));background:var( --cngx-card-accent-danger-bg, color-mix( in oklch, var(--cngx-color-danger, oklch(.6 .18 25)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-neutral{--cngx-card-accent-color: var(--cngx-color-border, oklch(.81 .005 250))}.cngx-card__badge{position:absolute;z-index:1;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-card-badge-size-md, 22px);height:var(--cngx-card-badge-size-md, 22px);padding:0 var(--cngx-card-badge-padding-inline, 5px);border-radius:var(--cngx-card-badge-radius, var(--cngx-radius-pill, 999px));border:var(--cngx-card-badge-border, 2px solid oklch(1 0 0));font-size:var(--cngx-card-badge-font-size-md, .7rem);font-weight:700;line-height:1;-webkit-user-select:none;user-select:none}.cngx-card__badge--top-end{inset-block-start:var(--cngx-card-badge-offset, -6px);inset-inline-end:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--top-start{inset-block-start:var(--cngx-card-badge-offset, -6px);inset-inline-start:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--bottom-end{inset-block-end:var(--cngx-card-badge-offset, -6px);inset-inline-end:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--bottom-start{inset-block-end:var(--cngx-card-badge-offset, -6px);inset-inline-start:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--size-sm{min-width:var(--cngx-card-badge-size-sm, 10px);height:var(--cngx-card-badge-size-sm, 10px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-sm, .625rem)}.cngx-card__badge--size-md{min-width:var(--cngx-card-badge-size-md, 22px);height:var(--cngx-card-badge-size-md, 22px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-md, .7rem)}.cngx-card__badge--size-lg{min-width:var(--cngx-card-badge-size-lg, 28px);height:var(--cngx-card-badge-size-lg, 28px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-lg, .8125rem)}.cngx-card__badge--intent-primary{background:var( --cngx-card-badge-primary-bg, var(--cngx-badge-primary-bg, var(--cngx-color-primary, oklch(.66 .19 50))) );color:var(--cngx-card-badge-primary-color, oklch(1 0 0))}.cngx-card__badge--intent-danger{background:var( --cngx-card-badge-danger-bg, var(--cngx-badge-error-bg, var(--cngx-color-danger, oklch(.62 .22 25))) );color:var(--cngx-card-badge-danger-color, oklch(1 0 0))}.cngx-card__badge--intent-warning{background:var( --cngx-card-badge-warning-bg, var(--cngx-badge-warning-bg, var(--cngx-color-warning, oklch(.72 .18 70))) );color:var(--cngx-card-badge-warning-color, oklch(.2 .01 250))}.cngx-card__badge--intent-success{background:var(--cngx-card-badge-success-bg, var(--cngx-color-success, oklch(.6 .15 145)));color:var(--cngx-card-badge-success-color, oklch(1 0 0))}.cngx-card__badge--intent-neutral{background:var( --cngx-card-badge-neutral-bg, var(--cngx-badge-neutral-bg, var(--cngx-color-text-muted, oklch(.68 .01 240))) );color:var(--cngx-card-badge-neutral-color, oklch(1 0 0))}.cngx-card__badge:empty{min-width:var(--cngx-card-badge-size-sm, 10px);width:var(--cngx-card-badge-size-sm, 10px);height:var(--cngx-card-badge-size-sm, 10px);padding:0}}@keyframes cngx-card-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
159
172
|
}
|
|
160
173
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCard, decorators: [{
|
|
161
174
|
type: Component,
|
|
162
|
-
args: [{
|
|
163
|
-
selector: 'cngx-card',
|
|
164
|
-
standalone: true,
|
|
165
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
166
|
-
encapsulation: ViewEncapsulation.None,
|
|
167
|
-
hostDirectives: [{ directive: CngxRovingItem, inputs: [], outputs: [] }],
|
|
168
|
-
host: {
|
|
175
|
+
args: [{ selector: 'cngx-card', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [{ directive: CngxRovingItem, inputs: [], outputs: [] }], host: {
|
|
169
176
|
class: 'cngx-card',
|
|
170
177
|
'[attr.role]': 'hostRole()',
|
|
171
178
|
'[attr.tabindex]': 'hostTabindex()',
|
|
@@ -182,8 +189,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
182
189
|
'(click)': 'handleHostClick($event)',
|
|
183
190
|
'(keydown.enter)': 'handleHostKeydown($event)',
|
|
184
191
|
'(keydown.space)': 'handleHostKeydown($event)',
|
|
185
|
-
},
|
|
186
|
-
template: `
|
|
192
|
+
}, template: `
|
|
187
193
|
<ng-content select="[cngxCardMedia]" />
|
|
188
194
|
<ng-content select="header[cngxCardHeader]" />
|
|
189
195
|
<ng-content select="[cngxCardBody]" />
|
|
@@ -202,14 +208,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
202
208
|
<span [id]="liveRegionId" aria-live="polite" aria-atomic="true" class="cngx-sr-only">
|
|
203
209
|
{{ liveAnnouncement() }}
|
|
204
210
|
</span>
|
|
205
|
-
`,
|
|
206
|
-
}]
|
|
211
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-card-padding{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@property --cngx-card-radius{syntax: \"<length>\"; inherits: false; initial-value: 12px;}@property --cngx-card-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-card-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.81 .005 250);}@property --cngx-card-min-width{syntax: \"<length>\"; inherits: false; initial-value: 120px;}@property --cngx-card-hover-shadow{syntax: \"*\"; inherits: false; initial-value: 0 2px 8px 0 oklch(0 0 0 / .12);}@property --cngx-card-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .88;}@property --cngx-card-focus-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-card-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-card-focus-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-selected-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-selected-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .04 50);}@property --cngx-card-selected-bar-width{syntax: \"<length>\"; inherits: false; initial-value: 3px;}@property --cngx-card-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-card-loading-shimmer{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0 / .4);}@property --cngx-card-loading-overlay{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0 / .3);}@property --cngx-card-title-size{syntax: \"*\"; inherits: true; initial-value: 1rem;}@property --cngx-card-title-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-card-title-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-card-subtitle-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-card-subtitle-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-card-subtitle-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-card-divider{syntax: \"<color>\"; inherits: true; initial-value: oklch(.81 .005 250);}@property --cngx-card-accent-width{syntax: \"<length>\"; inherits: false; initial-value: 3px;}@property --cngx-card-accent-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-card-accent-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .03 250);}@property --cngx-card-accent-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .04 145);}@property --cngx-card-accent-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .04 75);}@property --cngx-card-accent-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .03 25);}@property --cngx-card-badge-offset{syntax: \"<length>\"; inherits: false; initial-value: -6px;}@property --cngx-card-badge-size-sm{syntax: \"<length>\"; inherits: false; initial-value: 10px;}@property --cngx-card-badge-size-md{syntax: \"<length>\"; inherits: false; initial-value: 22px;}@property --cngx-card-badge-size-lg{syntax: \"<length>\"; inherits: false; initial-value: 28px;}@property --cngx-card-badge-padding-inline{syntax: \"<length>\"; inherits: false; initial-value: 5px;}@property --cngx-card-badge-font-size-sm{syntax: \"*\"; inherits: false; initial-value: .625rem;}@property --cngx-card-badge-font-size-md{syntax: \"*\"; inherits: false; initial-value: .7rem;}@property --cngx-card-badge-font-size-lg{syntax: \"*\"; inherits: false; initial-value: .8125rem;}@property --cngx-card-badge-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-card-badge-border{syntax: \"*\"; inherits: true; initial-value: 2px solid oklch(1 0 0);}@property --cngx-card-badge-primary-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-card-badge-primary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .22 25);}@property --cngx-card-badge-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@property --cngx-card-badge-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-card-badge-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-card-badge-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-card-badge-neutral-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-card-badge-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}:root{--cngx-card-bg: var(--cngx-color-surface);--cngx-card-color: var(--cngx-color-text);--cngx-card-border: 1px solid var(--cngx-color-border);--cngx-card-divider: var(--cngx-color-border);--cngx-card-title-color: var(--cngx-color-text)}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-card-subtitle-color: oklch(.72 .02 290);--cngx-card-selected-bg: oklch(.36 .06 50);--cngx-card-accent-info-bg: oklch(.32 .05 250);--cngx-card-accent-success-bg: oklch(.32 .06 145);--cngx-card-accent-warning-bg: oklch(.32 .06 75);--cngx-card-accent-danger-bg: oklch(.32 .05 25);--cngx-card-badge-border: 2px solid oklch(.2 .01 250)}}[data-color-scheme=dark],.dark{--cngx-card-subtitle-color: oklch(.72 .02 290);--cngx-card-selected-bg: oklch(.36 .06 50);--cngx-card-accent-info-bg: oklch(.32 .05 250);--cngx-card-accent-success-bg: oklch(.32 .06 145);--cngx-card-accent-warning-bg: oklch(.32 .06 75);--cngx-card-accent-danger-bg: oklch(.32 .05 25);--cngx-card-badge-border: 2px solid oklch(.2 .01 250)}[data-color-scheme=light],.light{--cngx-card-subtitle-color: oklch(.36 .02 290);--cngx-card-selected-bg: oklch(.96 .04 50);--cngx-card-accent-info-bg: oklch(.97 .03 250);--cngx-card-accent-success-bg: oklch(.97 .04 145);--cngx-card-accent-warning-bg: oklch(.97 .04 75);--cngx-card-accent-danger-bg: oklch(.97 .03 25);--cngx-card-badge-border: 2px solid oklch(1 0 0)}}@layer cngx.components{@scope(.cngx-card){:scope{display:block;position:relative;padding:var(--cngx-card-padding, var(--cngx-space-md, 16px));border-radius:var(--cngx-card-radius, var(--cngx-radius-lg, 12px));background:var(--cngx-card-bg, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-card-border, 1px solid var(--cngx-color-border, oklch(.81 .005 250)));color:var(--cngx-card-color, var(--cngx-color-text, oklch(.2 .01 290)));transition:box-shadow var(--cngx-duration-fast, .15s) ease,border-color var(--cngx-duration-fast, .15s) ease,background var(--cngx-duration-fast, .15s) ease;min-height:44px;min-width:var(--cngx-card-min-width, 120px);touch-action:manipulation}:scope.cngx-card--interactive{cursor:pointer;-webkit-tap-highlight-color:transparent}:scope.cngx-card--interactive:hover{box-shadow:var(--cngx-card-hover-shadow, 0 2px 8px 0 oklch(0 0 0 / .12))}@media(hover:none){:scope.cngx-card--interactive:active{opacity:var(--cngx-card-active-opacity, .88)}}:scope:focus-visible{outline:var(--cngx-card-focus-width, 2px) solid var(--cngx-card-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-card-focus-offset, 2px)}:scope:has(:focus-visible):not(:focus-visible){outline:var(--cngx-card-focus-width, 2px) solid var(--cngx-card-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-card-focus-offset, 2px)}:scope.cngx-card--selected{border-color:var( --cngx-card-selected-border, var(--cngx-color-primary, oklch(.66 .19 50)) );background:var( --cngx-card-selected-bg, color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--selected:before{content:\"\";position:absolute;inset-inline-start:0;inset-block:var(--cngx-card-radius, 12px);width:var(--cngx-card-selected-bar-width, 3px);background:var(--cngx-card-selected-border, var(--cngx-color-primary, oklch(.66 .19 50)));border-radius:999px}:scope.cngx-card--disabled{opacity:var(--cngx-card-disabled-opacity, .5);pointer-events:none}:scope.cngx-card--loading{pointer-events:none;cursor:wait}:scope.cngx-card--loading:after{content:\"\";position:absolute;inset:0;border-radius:inherit;background:linear-gradient(90deg,transparent 25%,var(--cngx-card-loading-shimmer, oklch(1 0 0 / .4)) 50%,transparent 75%);background-size:200% 100%;animation:cngx-card-shimmer 1.5s ease-in-out infinite}@media(prefers-reduced-motion:reduce){:scope.cngx-card--loading:after{animation:none;background:var(--cngx-card-loading-overlay, oklch(1 0 0 / .3))}}.cngx-card__media{margin:calc(-1 * var(--cngx-card-padding, var(--cngx-space-md, 16px)));margin-bottom:0;overflow:hidden;border-radius:var(--cngx-card-radius, var(--cngx-radius-lg, 12px)) var(--cngx-card-radius, var(--cngx-radius-lg, 12px)) 0 0}.cngx-card__media img,.cngx-card__media video{display:block;width:100%;height:100%;object-fit:cover}.cngx-card__header{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--cngx-space-sm, 8px);padding-block:var(--cngx-space-xs, 4px)}.cngx-card__title{margin:0;font-size:var(--cngx-card-title-size, 1rem);font-weight:var(--cngx-card-title-weight, 600);color:var(--cngx-card-title-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.3}.cngx-card__subtitle{width:100%;margin:0;font-size:var(--cngx-card-subtitle-size, .8125rem);font-weight:var(--cngx-card-subtitle-weight, 400);color:var(--cngx-card-subtitle-color, oklch(.36 .02 290));line-height:1.4}.cngx-card__body{padding-block:var(--cngx-space-xs, 4px)}.cngx-card__footer{margin-top:auto;padding-block-start:var(--cngx-space-sm, 8px)}.cngx-card__actions{display:flex;align-items:center;gap:var(--cngx-space-sm, 8px);padding-block-start:var(--cngx-space-sm, 8px);border-top:1px solid var(--cngx-card-divider, var(--cngx-color-border, oklch(.81 .005 250)))}.cngx-card__actions--end{justify-content:flex-end}:scope.cngx-card--accent{border-top:var(--cngx-card-accent-width, 3px) solid var(--cngx-card-accent-color, transparent)}:scope.cngx-card--accent-info{--cngx-card-accent-color: var(--cngx-color-info, oklch(.65 .12 240));background:var( --cngx-card-accent-info-bg, color-mix( in oklch, var(--cngx-color-info, oklch(.65 .12 240)) 6%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-success{--cngx-card-accent-color: var(--cngx-color-success, oklch(.6 .15 145));background:var( --cngx-card-accent-success-bg, color-mix( in oklch, var(--cngx-color-success, oklch(.6 .15 145)) 6%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-warning{--cngx-card-accent-color: var(--cngx-color-warning, oklch(.72 .15 75));background:var( --cngx-card-accent-warning-bg, color-mix( in oklch, var(--cngx-color-warning, oklch(.72 .15 75)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-danger{--cngx-card-accent-color: var(--cngx-color-danger, oklch(.6 .18 25));background:var( --cngx-card-accent-danger-bg, color-mix( in oklch, var(--cngx-color-danger, oklch(.6 .18 25)) 8%, var(--cngx-card-bg, oklch(1 0 0)) ) )}:scope.cngx-card--accent-neutral{--cngx-card-accent-color: var(--cngx-color-border, oklch(.81 .005 250))}.cngx-card__badge{position:absolute;z-index:1;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-card-badge-size-md, 22px);height:var(--cngx-card-badge-size-md, 22px);padding:0 var(--cngx-card-badge-padding-inline, 5px);border-radius:var(--cngx-card-badge-radius, var(--cngx-radius-pill, 999px));border:var(--cngx-card-badge-border, 2px solid oklch(1 0 0));font-size:var(--cngx-card-badge-font-size-md, .7rem);font-weight:700;line-height:1;-webkit-user-select:none;user-select:none}.cngx-card__badge--top-end{inset-block-start:var(--cngx-card-badge-offset, -6px);inset-inline-end:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--top-start{inset-block-start:var(--cngx-card-badge-offset, -6px);inset-inline-start:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--bottom-end{inset-block-end:var(--cngx-card-badge-offset, -6px);inset-inline-end:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--bottom-start{inset-block-end:var(--cngx-card-badge-offset, -6px);inset-inline-start:var(--cngx-card-badge-offset, -6px)}.cngx-card__badge--size-sm{min-width:var(--cngx-card-badge-size-sm, 10px);height:var(--cngx-card-badge-size-sm, 10px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-sm, .625rem)}.cngx-card__badge--size-md{min-width:var(--cngx-card-badge-size-md, 22px);height:var(--cngx-card-badge-size-md, 22px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-md, .7rem)}.cngx-card__badge--size-lg{min-width:var(--cngx-card-badge-size-lg, 28px);height:var(--cngx-card-badge-size-lg, 28px);padding:0 var(--cngx-card-badge-padding-inline, 5px);font-size:var(--cngx-card-badge-font-size-lg, .8125rem)}.cngx-card__badge--intent-primary{background:var( --cngx-card-badge-primary-bg, var(--cngx-badge-primary-bg, var(--cngx-color-primary, oklch(.66 .19 50))) );color:var(--cngx-card-badge-primary-color, oklch(1 0 0))}.cngx-card__badge--intent-danger{background:var( --cngx-card-badge-danger-bg, var(--cngx-badge-error-bg, var(--cngx-color-danger, oklch(.62 .22 25))) );color:var(--cngx-card-badge-danger-color, oklch(1 0 0))}.cngx-card__badge--intent-warning{background:var( --cngx-card-badge-warning-bg, var(--cngx-badge-warning-bg, var(--cngx-color-warning, oklch(.72 .18 70))) );color:var(--cngx-card-badge-warning-color, oklch(.2 .01 250))}.cngx-card__badge--intent-success{background:var(--cngx-card-badge-success-bg, var(--cngx-color-success, oklch(.6 .15 145)));color:var(--cngx-card-badge-success-color, oklch(1 0 0))}.cngx-card__badge--intent-neutral{background:var( --cngx-card-badge-neutral-bg, var(--cngx-badge-neutral-bg, var(--cngx-color-text-muted, oklch(.68 .01 240))) );color:var(--cngx-card-badge-neutral-color, oklch(1 0 0))}.cngx-card__badge:empty{min-width:var(--cngx-card-badge-size-sm, 10px);width:var(--cngx-card-badge-size-sm, 10px);height:var(--cngx-card-badge-size-sm, 10px);padding:0}}@keyframes cngx-card-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}\n"] }]
|
|
207
212
|
}], propDecorators: { cardType: [{ type: i0.Input, args: [{ isSignal: true, alias: "as", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }] } });
|
|
208
213
|
|
|
209
214
|
/**
|
|
210
215
|
* Structural slot directive for the card header region.
|
|
211
216
|
*
|
|
212
|
-
* Must be placed on a native `<header>` element
|
|
217
|
+
* Must be placed on a native `<header>` element - the selector enforces
|
|
213
218
|
* semantic correctness at compile time.
|
|
214
219
|
*
|
|
215
220
|
* ```html
|
|
@@ -219,6 +224,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
219
224
|
* </header>
|
|
220
225
|
* </cngx-card>
|
|
221
226
|
* ```
|
|
227
|
+
*
|
|
228
|
+
* @category common/card
|
|
229
|
+
* @wcag AA
|
|
230
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-header.directive.ts
|
|
231
|
+
* @since 0.1.0
|
|
232
|
+
* @relatedTo CngxCard, CngxCardTitle, CngxCardSubtitle, CngxCardFooter
|
|
222
233
|
*/
|
|
223
234
|
class CngxCardHeader {
|
|
224
235
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -247,6 +258,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
247
258
|
* </header>
|
|
248
259
|
* </cngx-card>
|
|
249
260
|
* ```
|
|
261
|
+
*
|
|
262
|
+
* @category common/card
|
|
263
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-title.directive.ts
|
|
264
|
+
* @since 0.1.0
|
|
265
|
+
* @relatedTo CngxCard, CngxCardHeader, CngxCardSubtitle
|
|
250
266
|
*/
|
|
251
267
|
class CngxCardTitle {
|
|
252
268
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -262,7 +278,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
262
278
|
}] });
|
|
263
279
|
|
|
264
280
|
/**
|
|
265
|
-
* Marks an element as the card's subtitle
|
|
281
|
+
* Marks an element as the card's subtitle - secondary text below the title.
|
|
266
282
|
*
|
|
267
283
|
* ```html
|
|
268
284
|
* <cngx-card>
|
|
@@ -272,6 +288,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
272
288
|
* </header>
|
|
273
289
|
* </cngx-card>
|
|
274
290
|
* ```
|
|
291
|
+
*
|
|
292
|
+
* @category common/card
|
|
293
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-subtitle.directive.ts
|
|
294
|
+
* @since 0.1.0
|
|
295
|
+
* @relatedTo CngxCard, CngxCardHeader, CngxCardTitle
|
|
275
296
|
*/
|
|
276
297
|
class CngxCardSubtitle {
|
|
277
298
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSubtitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -294,6 +315,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
294
315
|
* <div cngxCardBody>Main content here</div>
|
|
295
316
|
* </cngx-card>
|
|
296
317
|
* ```
|
|
318
|
+
*
|
|
319
|
+
* @category common/card
|
|
320
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-body.directive.ts
|
|
321
|
+
* @since 0.1.0
|
|
322
|
+
* @relatedTo CngxCard, CngxCardHeader, CngxCardFooter
|
|
297
323
|
*/
|
|
298
324
|
class CngxCardBody {
|
|
299
325
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBody, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -319,6 +345,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
319
345
|
* <img cngxCardMedia [decorative]="false" alt="Photo of patient" />
|
|
320
346
|
* </cngx-card>
|
|
321
347
|
* ```
|
|
348
|
+
*
|
|
349
|
+
* @category common/card
|
|
350
|
+
* @wcag AA
|
|
351
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-media.directive.ts
|
|
352
|
+
* @since 0.1.0
|
|
353
|
+
* @relatedTo CngxCard, CngxCardHeader, CngxCardBody
|
|
354
|
+
* <example-url>http://localhost:4200/#/common/card/card-with-image</example-url>
|
|
355
|
+
|
|
322
356
|
*/
|
|
323
357
|
class CngxCardMedia {
|
|
324
358
|
/** Whether this media is purely decorative (hidden from SR). */
|
|
@@ -345,7 +379,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
345
379
|
/**
|
|
346
380
|
* Structural slot directive for the card footer region.
|
|
347
381
|
*
|
|
348
|
-
* Must be placed on a native `<footer>` element
|
|
382
|
+
* Must be placed on a native `<footer>` element - the selector enforces
|
|
349
383
|
* semantic correctness at compile time.
|
|
350
384
|
*
|
|
351
385
|
* ```html
|
|
@@ -353,6 +387,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
353
387
|
* <footer cngxCardFooter>Footer content</footer>
|
|
354
388
|
* </cngx-card>
|
|
355
389
|
* ```
|
|
390
|
+
*
|
|
391
|
+
* @category common/card
|
|
392
|
+
* @wcag AA
|
|
393
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-footer.directive.ts
|
|
394
|
+
* @since 0.1.0
|
|
395
|
+
* @relatedTo CngxCard, CngxCardHeader, CngxCardActions, CngxCardTimestamp
|
|
396
|
+
* <example-url>http://localhost:4200/#/common/card/title-subtitle-footer</example-url>
|
|
356
397
|
*/
|
|
357
398
|
class CngxCardFooter {
|
|
358
399
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -381,6 +422,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
381
422
|
* </div>
|
|
382
423
|
* </cngx-card>
|
|
383
424
|
* ```
|
|
425
|
+
*
|
|
426
|
+
* @category common/card
|
|
427
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-actions.directive.ts
|
|
428
|
+
* @since 0.1.0
|
|
429
|
+
* @relatedTo CngxCard, CngxCardFooter, CngxCardBody
|
|
430
|
+
* <example-url>http://localhost:4200/#/common/card/action-card-with-selection</example-url>
|
|
384
431
|
*/
|
|
385
432
|
class CngxCardActions {
|
|
386
433
|
/** Horizontal alignment of actions. */
|
|
@@ -401,23 +448,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
401
448
|
}], propDecorators: { align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } });
|
|
402
449
|
|
|
403
450
|
/**
|
|
404
|
-
* Positions a badge element at a corner of its parent card
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* that float in the card's top-right corner.
|
|
451
|
+
* Positions a badge element at a corner of its parent card and projects
|
|
452
|
+
* intent + size variants onto the host class so a bare element renders
|
|
453
|
+
* a usable pill without any inline styles.
|
|
408
454
|
*
|
|
409
455
|
* ```html
|
|
410
456
|
* <cngx-card>
|
|
411
|
-
* <
|
|
457
|
+
* <span cngxCardBadge position="top-end" intent="danger" size="md">P</span>
|
|
412
458
|
* <header cngxCardHeader>Pflegeplan</header>
|
|
413
459
|
* </cngx-card>
|
|
414
460
|
* ```
|
|
461
|
+
*
|
|
462
|
+
* Empty content collapses to a fixed-diameter dot via `:empty` (status
|
|
463
|
+
* indicator pattern). Theme via the `--cngx-card-badge-*` tokens on
|
|
464
|
+
* `card.component.css`; fallbacks chain through `--cngx-badge-*` then
|
|
465
|
+
* the foundation palette.
|
|
466
|
+
*
|
|
467
|
+
* @category common/card
|
|
468
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-badge.directive.ts
|
|
469
|
+
* @since 0.1.0
|
|
470
|
+
* @relatedTo CngxCard, CngxCardAccent, CngxCardHeader
|
|
471
|
+
* <example-url>http://localhost:4200/#/common/card/card-with-badge</example-url>
|
|
415
472
|
*/
|
|
416
473
|
class CngxCardBadge {
|
|
417
474
|
/** Corner position using logical properties. */
|
|
418
475
|
position = input('top-end', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
476
|
+
/**
|
|
477
|
+
* Tone of the badge surface. Resolves to
|
|
478
|
+
* `--cngx-card-badge-<intent>-bg` / `-color`; cascades through
|
|
479
|
+
* `--cngx-badge-<intent>-bg` then `--cngx-color-<system>`.
|
|
480
|
+
*/
|
|
481
|
+
intent = input('primary', ...(ngDevMode ? [{ debugName: "intent" }] : /* istanbul ignore next */ []));
|
|
482
|
+
/**
|
|
483
|
+
* Pill diameter and font-size. Empty content always renders as a
|
|
484
|
+
* fixed dot at the `sm` token regardless of this input (`:empty`
|
|
485
|
+
* fallback for status indicators).
|
|
486
|
+
*/
|
|
487
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
419
488
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBadge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
420
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardBadge, isStandalone: true, selector: "[cngxCardBadge]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-card__badge--top-start": "position() === \"top-start\"", "class.cngx-card__badge--top-end": "position() === \"top-end\"", "class.cngx-card__badge--bottom-start": "position() === \"bottom-start\"", "class.cngx-card__badge--bottom-end": "position() === \"bottom-end\"" }, classAttribute: "cngx-card__badge" }, ngImport: i0 });
|
|
489
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardBadge, isStandalone: true, selector: "[cngxCardBadge]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, intent: { classPropertyName: "intent", publicName: "intent", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-card__badge--top-start": "position() === \"top-start\"", "class.cngx-card__badge--top-end": "position() === \"top-end\"", "class.cngx-card__badge--bottom-start": "position() === \"bottom-start\"", "class.cngx-card__badge--bottom-end": "position() === \"bottom-end\"", "class.cngx-card__badge--intent-primary": "intent() === \"primary\"", "class.cngx-card__badge--intent-danger": "intent() === \"danger\"", "class.cngx-card__badge--intent-warning": "intent() === \"warning\"", "class.cngx-card__badge--intent-success": "intent() === \"success\"", "class.cngx-card__badge--intent-neutral": "intent() === \"neutral\"", "class.cngx-card__badge--size-sm": "size() === \"sm\"", "class.cngx-card__badge--size-md": "size() === \"md\"", "class.cngx-card__badge--size-lg": "size() === \"lg\"" }, classAttribute: "cngx-card__badge" }, ngImport: i0 });
|
|
421
490
|
}
|
|
422
491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBadge, decorators: [{
|
|
423
492
|
type: Directive,
|
|
@@ -430,16 +499,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
430
499
|
'[class.cngx-card__badge--top-end]': 'position() === "top-end"',
|
|
431
500
|
'[class.cngx-card__badge--bottom-start]': 'position() === "bottom-start"',
|
|
432
501
|
'[class.cngx-card__badge--bottom-end]': 'position() === "bottom-end"',
|
|
502
|
+
'[class.cngx-card__badge--intent-primary]': 'intent() === "primary"',
|
|
503
|
+
'[class.cngx-card__badge--intent-danger]': 'intent() === "danger"',
|
|
504
|
+
'[class.cngx-card__badge--intent-warning]': 'intent() === "warning"',
|
|
505
|
+
'[class.cngx-card__badge--intent-success]': 'intent() === "success"',
|
|
506
|
+
'[class.cngx-card__badge--intent-neutral]': 'intent() === "neutral"',
|
|
507
|
+
'[class.cngx-card__badge--size-sm]': 'size() === "sm"',
|
|
508
|
+
'[class.cngx-card__badge--size-md]': 'size() === "md"',
|
|
509
|
+
'[class.cngx-card__badge--size-lg]': 'size() === "lg"',
|
|
433
510
|
},
|
|
434
511
|
}]
|
|
435
|
-
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }] } });
|
|
512
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], intent: [{ type: i0.Input, args: [{ isSignal: true, alias: "intent", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
436
513
|
|
|
437
514
|
/**
|
|
438
515
|
* Adds a color-coded severity accent to a card.
|
|
439
516
|
*
|
|
440
517
|
* Renders as a colored top border + tinted background to communicate
|
|
441
518
|
* status visually. Differentiates by both color and border width
|
|
442
|
-
* (not just color
|
|
519
|
+
* (not just color - WCAG 1.4.1).
|
|
443
520
|
*
|
|
444
521
|
* ```html
|
|
445
522
|
* <cngx-card cngxCardAccent="warning">
|
|
@@ -448,6 +525,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
448
525
|
* </header>
|
|
449
526
|
* </cngx-card>
|
|
450
527
|
* ```
|
|
528
|
+
*
|
|
529
|
+
* @category common/card
|
|
530
|
+
* @wcag AA
|
|
531
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-accent.directive.ts
|
|
532
|
+
* @since 0.1.0
|
|
533
|
+
* @relatedTo CngxCard, CngxCardBadge, CngxCardHeader
|
|
534
|
+
* <example-url>http://localhost:4200/#/common/card/severity-accent</example-url>
|
|
451
535
|
*/
|
|
452
536
|
class CngxCardAccent {
|
|
453
537
|
/** Severity level controlling the accent color. */
|
|
@@ -487,6 +571,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
487
571
|
* }
|
|
488
572
|
* </cngx-card>
|
|
489
573
|
* ```
|
|
574
|
+
*
|
|
575
|
+
* @category common/card
|
|
576
|
+
* @wcag AA
|
|
577
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-skeleton.component.ts
|
|
578
|
+
* @since 0.1.0
|
|
579
|
+
* @relatedTo CngxCard, CngxCardBody, CngxCardMedia
|
|
580
|
+
* <example-url>http://localhost:4200/#/common/card/loading-state</example-url>
|
|
490
581
|
*/
|
|
491
582
|
class CngxCardSkeleton {
|
|
492
583
|
/** Number of body text lines to show. */
|
|
@@ -504,20 +595,14 @@ class CngxCardSkeleton {
|
|
|
504
595
|
@for (_ of lineArray(); track $index; let last = $last) {
|
|
505
596
|
<div class="cngx-card-skeleton__line" [style.width]="last ? '60%' : '100%'"></div>
|
|
506
597
|
}
|
|
507
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
598
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-skeleton-gap{syntax: \"<length>\"; inherits: false; initial-value: 10px;}@property --cngx-skeleton-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-skeleton-shimmer{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .005 250);}@property --cngx-skeleton-media-height{syntax: \"<length>\"; inherits: false; initial-value: 120px;}@property --cngx-skeleton-title-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-skeleton-line-height{syntax: \"*\"; inherits: false; initial-value: .875rem;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]){--cngx-skeleton-bg: oklch(.32 .005 250);--cngx-skeleton-shimmer: oklch(.42 .005 250)}}[data-color-scheme=dark]{--cngx-skeleton-bg: oklch(.32 .005 250);--cngx-skeleton-shimmer: oklch(.42 .005 250)}[data-color-scheme=light]{--cngx-skeleton-bg: oklch(.88 .005 250);--cngx-skeleton-shimmer: oklch(.96 .005 250)}}@layer cngx.components{@scope(.cngx-card-skeleton){:scope{display:flex;flex-direction:column;gap:var(--cngx-skeleton-gap, 10px)}.cngx-card-skeleton__media,.cngx-card-skeleton__title,.cngx-card-skeleton__line{background:linear-gradient(90deg,var(--cngx-skeleton-bg, oklch(.88 .005 250)) 25%,var(--cngx-skeleton-shimmer, oklch(.96 .005 250)) 50%,var(--cngx-skeleton-bg, oklch(.88 .005 250)) 75%);background-size:200% 100%;animation:cngx-skeleton-shimmer 1.5s ease-in-out infinite;border-radius:var(--cngx-radius-sm, 4px)}.cngx-card-skeleton__media{height:var(--cngx-skeleton-media-height, 120px)}.cngx-card-skeleton__title{height:var(--cngx-skeleton-title-height, 1.25rem);width:55%}.cngx-card-skeleton__line{height:var(--cngx-skeleton-line-height, .875rem)}@media(prefers-reduced-motion:reduce){.cngx-card-skeleton__media,.cngx-card-skeleton__title,.cngx-card-skeleton__line{animation:none;opacity:.7}}}@keyframes cngx-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
508
599
|
}
|
|
509
600
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSkeleton, decorators: [{
|
|
510
601
|
type: Component,
|
|
511
|
-
args: [{
|
|
512
|
-
selector: 'cngx-card-skeleton',
|
|
513
|
-
standalone: true,
|
|
514
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
515
|
-
encapsulation: ViewEncapsulation.None,
|
|
516
|
-
host: {
|
|
602
|
+
args: [{ selector: 'cngx-card-skeleton', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
517
603
|
class: 'cngx-card-skeleton',
|
|
518
604
|
'aria-hidden': 'true',
|
|
519
|
-
},
|
|
520
|
-
template: `
|
|
605
|
+
}, template: `
|
|
521
606
|
@if (showMedia()) {
|
|
522
607
|
<div class="cngx-card-skeleton__media"></div>
|
|
523
608
|
}
|
|
@@ -525,8 +610,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
525
610
|
@for (_ of lineArray(); track $index; let last = $last) {
|
|
526
611
|
<div class="cngx-card-skeleton__line" [style.width]="last ? '60%' : '100%'"></div>
|
|
527
612
|
}
|
|
528
|
-
`,
|
|
529
|
-
}]
|
|
613
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-skeleton-gap{syntax: \"<length>\"; inherits: false; initial-value: 10px;}@property --cngx-skeleton-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-skeleton-shimmer{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .005 250);}@property --cngx-skeleton-media-height{syntax: \"<length>\"; inherits: false; initial-value: 120px;}@property --cngx-skeleton-title-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-skeleton-line-height{syntax: \"*\"; inherits: false; initial-value: .875rem;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]){--cngx-skeleton-bg: oklch(.32 .005 250);--cngx-skeleton-shimmer: oklch(.42 .005 250)}}[data-color-scheme=dark]{--cngx-skeleton-bg: oklch(.32 .005 250);--cngx-skeleton-shimmer: oklch(.42 .005 250)}[data-color-scheme=light]{--cngx-skeleton-bg: oklch(.88 .005 250);--cngx-skeleton-shimmer: oklch(.96 .005 250)}}@layer cngx.components{@scope(.cngx-card-skeleton){:scope{display:flex;flex-direction:column;gap:var(--cngx-skeleton-gap, 10px)}.cngx-card-skeleton__media,.cngx-card-skeleton__title,.cngx-card-skeleton__line{background:linear-gradient(90deg,var(--cngx-skeleton-bg, oklch(.88 .005 250)) 25%,var(--cngx-skeleton-shimmer, oklch(.96 .005 250)) 50%,var(--cngx-skeleton-bg, oklch(.88 .005 250)) 75%);background-size:200% 100%;animation:cngx-skeleton-shimmer 1.5s ease-in-out infinite;border-radius:var(--cngx-radius-sm, 4px)}.cngx-card-skeleton__media{height:var(--cngx-skeleton-media-height, 120px)}.cngx-card-skeleton__title{height:var(--cngx-skeleton-title-height, 1.25rem);width:55%}.cngx-card-skeleton__line{height:var(--cngx-skeleton-line-height, .875rem)}@media(prefers-reduced-motion:reduce){.cngx-card-skeleton__media,.cngx-card-skeleton__title,.cngx-card-skeleton__line{animation:none;opacity:.7}}}@keyframes cngx-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}}\n"] }]
|
|
530
614
|
}], propDecorators: { lines: [{ type: i0.Input, args: [{ isSignal: true, alias: "lines", required: false }] }], showMedia: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMedia", required: false }] }] } });
|
|
531
615
|
|
|
532
616
|
/**
|
|
@@ -545,6 +629,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
545
629
|
* </ng-template>
|
|
546
630
|
* </cngx-card-grid>
|
|
547
631
|
* ```
|
|
632
|
+
*
|
|
633
|
+
* @category common/card
|
|
634
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-grid-empty.directive.ts
|
|
635
|
+
* @since 0.1.0
|
|
636
|
+
* @relatedTo CngxCardGrid
|
|
548
637
|
*/
|
|
549
638
|
class CngxCardGridEmpty {
|
|
550
639
|
/** Empty-state reason this template handles. Omit for a default fallback. */
|
|
@@ -566,7 +655,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
566
655
|
* Responsive card grid layout with intrinsic sizing, keyboard navigation,
|
|
567
656
|
* and reason-based empty-state template selection.
|
|
568
657
|
*
|
|
569
|
-
* Uses CSS Grid with `auto-fill` + `minmax` for intrinsic responsiveness
|
|
658
|
+
* Uses CSS Grid with `auto-fill` + `minmax` for intrinsic responsiveness -
|
|
570
659
|
* no breakpoint management required.
|
|
571
660
|
*
|
|
572
661
|
* Keyboard navigation is provided by `CngxRovingTabindex` as a host directive.
|
|
@@ -594,13 +683,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
594
683
|
* </ng-template>
|
|
595
684
|
* </cngx-card-grid>
|
|
596
685
|
* ```
|
|
686
|
+
*
|
|
687
|
+
* @category common/card
|
|
688
|
+
* @docsKind primary
|
|
689
|
+
* @wcag AA
|
|
690
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-grid.component.ts
|
|
691
|
+
* @since 0.1.0
|
|
692
|
+
* @relatedTo CngxCard, CngxCardGridEmpty, CngxRovingTabindex, CngxAsyncState
|
|
693
|
+
* <example-url>http://localhost:4200/#/common/card/card-grid/basic-grid</example-url>
|
|
694
|
+
* <example-url>http://localhost:4200/#/common/card/card-grid/density-variants</example-url>
|
|
695
|
+
* <example-url>http://localhost:4200/#/common/card/card-grid/empty-state-with-reason</example-url>
|
|
597
696
|
*/
|
|
598
697
|
class CngxCardGrid {
|
|
599
698
|
/** Minimum card width for the CSS Grid `minmax()` function. */
|
|
600
699
|
minWidth = input('280px', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
601
700
|
/** Gap between grid items. */
|
|
602
701
|
gap = input('var(--cngx-gap-md, 16px)', ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
603
|
-
/** Grid density level
|
|
702
|
+
/** Grid density level - controls gap and card padding via CSS custom properties. */
|
|
604
703
|
density = input('default', ...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
|
|
605
704
|
/** Whether the grid should have `role="list"`. Requires `role="listitem"` on each card. */
|
|
606
705
|
semanticList = input(false, ...(ngDevMode ? [{ debugName: "semanticList" }] : /* istanbul ignore next */ []));
|
|
@@ -609,10 +708,10 @@ class CngxCardGrid {
|
|
|
609
708
|
* empty-state template. When omitted, the grid is a pure layout tool.
|
|
610
709
|
*/
|
|
611
710
|
items = input(undefined, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
612
|
-
/** Reason why items are empty
|
|
711
|
+
/** Reason why items are empty - selects the matching `cngxCardGridEmpty` template. */
|
|
613
712
|
emptyReason = input(undefined, ...(ngDevMode ? [{ debugName: "emptyReason" }] : /* istanbul ignore next */ []));
|
|
614
713
|
/**
|
|
615
|
-
* Bind an async state
|
|
714
|
+
* Bind an async state - drives loading and empty from a single source.
|
|
616
715
|
* When set, `isLoading` derives from `state.isFirstLoad()` and
|
|
617
716
|
* `empty` derives from `state.isEmpty()` (overrides `[items]`).
|
|
618
717
|
*/
|
|
@@ -650,23 +749,16 @@ class CngxCardGrid {
|
|
|
650
749
|
} @else if (activeEmptyTemplate()) {
|
|
651
750
|
<ng-container [ngTemplateOutlet]="activeEmptyTemplate()!.templateRef" />
|
|
652
751
|
}
|
|
653
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
752
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-card-grid-min{syntax: \"<length>\"; inherits: false; initial-value: 280px;}@property --cngx-card-grid-gap{syntax: \"<length>\"; inherits: false; initial-value: 16px;}}@layer cngx.components{@scope(.cngx-card-grid){:scope{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--cngx-card-grid-min, 280px),1fr));gap:var(--cngx-card-grid-gap, var(--cngx-space-md, 16px))}:scope.cngx-card-grid--compact{--cngx-card-grid-gap: var(--cngx-space-sm, 8px);--cngx-card-padding: var(--cngx-space-sm, 8px)}:scope.cngx-card-grid--comfortable{--cngx-card-grid-gap: var(--cngx-space-lg, 24px);--cngx-card-padding: var(--cngx-space-lg, 24px)}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
654
753
|
}
|
|
655
754
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardGrid, decorators: [{
|
|
656
755
|
type: Component,
|
|
657
|
-
args: [{
|
|
658
|
-
selector: 'cngx-card-grid',
|
|
659
|
-
standalone: true,
|
|
660
|
-
imports: [NgTemplateOutlet],
|
|
661
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
662
|
-
encapsulation: ViewEncapsulation.None,
|
|
663
|
-
hostDirectives: [
|
|
756
|
+
args: [{ selector: 'cngx-card-grid', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [
|
|
664
757
|
{
|
|
665
758
|
directive: CngxRovingTabindex,
|
|
666
759
|
inputs: ['orientation', 'loop', 'activeIndex', 'virtualCount'],
|
|
667
760
|
},
|
|
668
|
-
],
|
|
669
|
-
host: {
|
|
761
|
+
], host: {
|
|
670
762
|
class: 'cngx-card-grid',
|
|
671
763
|
'[attr.role]': 'semanticList() ? "list" : null',
|
|
672
764
|
'[attr.aria-busy]': 'isLoading() || null',
|
|
@@ -674,15 +766,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
674
766
|
'[style.--cngx-card-grid-gap]': 'density() === "default" ? gap() : null',
|
|
675
767
|
'[class.cngx-card-grid--compact]': 'density() === "compact"',
|
|
676
768
|
'[class.cngx-card-grid--comfortable]': 'density() === "comfortable"',
|
|
677
|
-
},
|
|
678
|
-
template: `
|
|
769
|
+
}, template: `
|
|
679
770
|
@if (!empty()) {
|
|
680
771
|
<ng-content />
|
|
681
772
|
} @else if (activeEmptyTemplate()) {
|
|
682
773
|
<ng-container [ngTemplateOutlet]="activeEmptyTemplate()!.templateRef" />
|
|
683
774
|
}
|
|
684
|
-
`,
|
|
685
|
-
}]
|
|
775
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-card-grid-min{syntax: \"<length>\"; inherits: false; initial-value: 280px;}@property --cngx-card-grid-gap{syntax: \"<length>\"; inherits: false; initial-value: 16px;}}@layer cngx.components{@scope(.cngx-card-grid){:scope{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--cngx-card-grid-min, 280px),1fr));gap:var(--cngx-card-grid-gap, var(--cngx-space-md, 16px))}:scope.cngx-card-grid--compact{--cngx-card-grid-gap: var(--cngx-space-sm, 8px);--cngx-card-padding: var(--cngx-space-sm, 8px)}:scope.cngx-card-grid--comfortable{--cngx-card-grid-gap: var(--cngx-space-lg, 24px);--cngx-card-padding: var(--cngx-space-lg, 24px)}}}\n"] }]
|
|
686
776
|
}], propDecorators: { minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], semanticList: [{ type: i0.Input, args: [{ isSignal: true, alias: "semanticList", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], emptyReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyReason", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], emptyTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxCardGridEmpty), { isSignal: true }] }] } });
|
|
687
777
|
|
|
688
778
|
/**
|
|
@@ -697,6 +787,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
697
787
|
* </footer>
|
|
698
788
|
* </cngx-card>
|
|
699
789
|
* ```
|
|
790
|
+
*
|
|
791
|
+
* @category common/card
|
|
792
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/card-timestamp.component.ts
|
|
793
|
+
* @since 0.1.0
|
|
794
|
+
* @relatedTo CngxCard, CngxCardFooter
|
|
700
795
|
*/
|
|
701
796
|
class CngxCardTimestamp {
|
|
702
797
|
locale = inject(LOCALE_ID);
|
|
@@ -730,27 +825,20 @@ class CngxCardTimestamp {
|
|
|
730
825
|
<time [attr.datetime]="isoDate()" class="cngx-card-timestamp__date">
|
|
731
826
|
{{ formattedDate() }}
|
|
732
827
|
</time>
|
|
733
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
828
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-card-timestamp-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-card-timestamp-size{syntax: \"*\"; inherits: true; initial-value: .75rem;}@property --cngx-card-timestamp-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-card-timestamp-prefix-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-card-timestamp-color: oklch(.72 .02 290)}}[data-color-scheme=dark],.dark{--cngx-card-timestamp-color: oklch(.72 .02 290)}[data-color-scheme=light],.light{--cngx-card-timestamp-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-card-timestamp){:scope{display:inline-flex;gap:var(--cngx-card-timestamp-gap, var(--cngx-space-xs, 4px));font-size:var(--cngx-card-timestamp-size, .75rem);color:var(--cngx-card-timestamp-color, oklch(.36 .02 290));line-height:1.4}.cngx-card-timestamp__prefix{font-weight:var(--cngx-card-timestamp-prefix-weight, 400)}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
734
829
|
}
|
|
735
830
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTimestamp, decorators: [{
|
|
736
831
|
type: Component,
|
|
737
|
-
args: [{
|
|
738
|
-
selector: 'cngx-card-timestamp',
|
|
739
|
-
standalone: true,
|
|
740
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
741
|
-
encapsulation: ViewEncapsulation.None,
|
|
742
|
-
host: {
|
|
832
|
+
args: [{ selector: 'cngx-card-timestamp', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
743
833
|
class: 'cngx-card-timestamp',
|
|
744
|
-
},
|
|
745
|
-
template: `
|
|
834
|
+
}, template: `
|
|
746
835
|
@if (prefix()) {
|
|
747
836
|
<span class="cngx-card-timestamp__prefix">{{ prefix() }}</span>
|
|
748
837
|
}
|
|
749
838
|
<time [attr.datetime]="isoDate()" class="cngx-card-timestamp__date">
|
|
750
839
|
{{ formattedDate() }}
|
|
751
840
|
</time>
|
|
752
|
-
`,
|
|
753
|
-
}]
|
|
841
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-card-timestamp-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-card-timestamp-size{syntax: \"*\"; inherits: true; initial-value: .75rem;}@property --cngx-card-timestamp-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-card-timestamp-prefix-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-card-timestamp-color: oklch(.72 .02 290)}}[data-color-scheme=dark],.dark{--cngx-card-timestamp-color: oklch(.72 .02 290)}[data-color-scheme=light],.light{--cngx-card-timestamp-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-card-timestamp){:scope{display:inline-flex;gap:var(--cngx-card-timestamp-gap, var(--cngx-space-xs, 4px));font-size:var(--cngx-card-timestamp-size, .75rem);color:var(--cngx-card-timestamp-color, oklch(.36 .02 290));line-height:1.4}.cngx-card-timestamp__prefix{font-weight:var(--cngx-card-timestamp-prefix-weight, 400)}}}\n"] }]
|
|
754
842
|
}], propDecorators: { date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: true }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }] } });
|
|
755
843
|
|
|
756
844
|
/**
|