@tmorrow/cre8-wc 2.0.4 → 2.0.5
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/a2ui/build-knowledge-graph.py +297 -0
- package/a2ui/catalog +240 -0
- package/a2ui/catalog-kg.json +6704 -0
- package/a2ui/catalog.json +576 -84
- package/a2ui/catalog.svg +3295 -0
- package/a2ui/demo.html +5 -49
- package/a2ui/examples/card-gallery.json +786 -0
- package/a2ui/examples/dating-grid.json +456 -0
- package/a2ui/examples/llm-observability.json +1719 -0
- package/a2ui/examples/portfolio.json +341 -0
- package/a2ui/generate-catalog.mjs +3 -0
- package/cdn/cre8-wc.esm.js +3057 -2438
- package/cdn/cre8-wc.esm.js.map +1 -1
- package/cdn/cre8-wc.min.js +1801 -1204
- package/cdn/cre8-wc.min.js.map +1 -1
- package/lib/components/accordion/accordion.d.ts +1 -0
- package/lib/components/accordion/accordion.d.ts.map +1 -1
- package/lib/components/accordion/accordion.js +1 -0
- package/lib/components/accordion/accordion.js.map +1 -1
- package/lib/components/accordion-item/accordion-item.d.ts +1 -0
- package/lib/components/accordion-item/accordion-item.d.ts.map +1 -1
- package/lib/components/accordion-item/accordion-item.js +1 -0
- package/lib/components/accordion-item/accordion-item.js.map +1 -1
- package/lib/components/alert/alert.d.ts +6 -0
- package/lib/components/alert/alert.d.ts.map +1 -1
- package/lib/components/alert/alert.js +6 -0
- package/lib/components/alert/alert.js.map +1 -1
- package/lib/components/button/button.d.ts +2 -0
- package/lib/components/button/button.d.ts.map +1 -1
- package/lib/components/button/button.js +2 -0
- package/lib/components/button/button.js.map +1 -1
- package/lib/components/button/button.styles.d.ts.map +1 -1
- package/lib/components/button/button.styles.js +1120 -557
- package/lib/components/button/button.styles.js.map +1 -1
- package/lib/components/button-group/button-group.d.ts +9 -0
- package/lib/components/button-group/button-group.d.ts.map +1 -1
- package/lib/components/button-group/button-group.js +8 -0
- package/lib/components/button-group/button-group.js.map +1 -1
- package/lib/components/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/button-group/button-group.styles.js +12 -0
- package/lib/components/button-group/button-group.styles.js.map +1 -1
- package/lib/components/card/card.d.ts +1 -1
- package/lib/components/card/card.d.ts.map +1 -1
- package/lib/components/card/card.js +1 -0
- package/lib/components/card/card.js.map +1 -1
- package/lib/components/card/card.styles.d.ts.map +1 -1
- package/lib/components/card/card.styles.js +8 -0
- package/lib/components/card/card.styles.js.map +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.d.ts +6 -0
- package/lib/components/checkbox-field-item/checkbox-field-item.d.ts.map +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.js +6 -0
- package/lib/components/checkbox-field-item/checkbox-field-item.js.map +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js.map +1 -1
- package/lib/components/date-picker/date-picker.d.ts +5 -0
- package/lib/components/date-picker/date-picker.d.ts.map +1 -1
- package/lib/components/date-picker/date-picker.js +12 -10
- package/lib/components/date-picker/date-picker.js.map +1 -1
- package/lib/components/dropdown/dropdown.d.ts +2 -0
- package/lib/components/dropdown/dropdown.d.ts.map +1 -1
- package/lib/components/dropdown/dropdown.js +2 -0
- package/lib/components/dropdown/dropdown.js.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.d.ts +8 -0
- package/lib/components/dropdown-item/dropdown-item.d.ts.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.js +15 -2
- package/lib/components/dropdown-item/dropdown-item.js.map +1 -1
- package/lib/components/feature/feature.d.ts +4 -0
- package/lib/components/feature/feature.d.ts.map +1 -1
- package/lib/components/feature/feature.js +4 -1
- package/lib/components/feature/feature.js.map +1 -1
- package/lib/components/field/field.d.ts +2 -0
- package/lib/components/field/field.d.ts.map +1 -1
- package/lib/components/field/field.js +3 -0
- package/lib/components/field/field.js.map +1 -1
- package/lib/components/global-nav-item/global-nav-item.d.ts +2 -0
- package/lib/components/global-nav-item/global-nav-item.d.ts.map +1 -1
- package/lib/components/global-nav-item/global-nav-item.js +2 -0
- package/lib/components/global-nav-item/global-nav-item.js.map +1 -1
- package/lib/components/header/header.d.ts +2 -0
- package/lib/components/header/header.d.ts.map +1 -1
- package/lib/components/header/header.js +2 -0
- package/lib/components/header/header.js.map +1 -1
- package/lib/components/hero/hero.d.ts +4 -0
- package/lib/components/hero/hero.d.ts.map +1 -1
- package/lib/components/hero/hero.js +4 -0
- package/lib/components/hero/hero.js.map +1 -1
- package/lib/components/hero/hero.styles.d.ts.map +1 -1
- package/lib/components/hero/hero.styles.js +13 -0
- package/lib/components/hero/hero.styles.js.map +1 -1
- package/lib/components/icon/icon.d.ts +3 -0
- package/lib/components/icon/icon.d.ts.map +1 -1
- package/lib/components/icon/icon.js +7 -5
- package/lib/components/icon/icon.js.map +1 -1
- package/lib/components/link/link.d.ts +2 -0
- package/lib/components/link/link.d.ts.map +1 -1
- package/lib/components/link/link.js +2 -0
- package/lib/components/link/link.js.map +1 -1
- package/lib/components/link-list-item/link-list-item.d.ts +2 -0
- package/lib/components/link-list-item/link-list-item.d.ts.map +1 -1
- package/lib/components/link-list-item/link-list-item.js +2 -0
- package/lib/components/link-list-item/link-list-item.js.map +1 -1
- package/lib/components/modal/modal.d.ts +4 -0
- package/lib/components/modal/modal.d.ts.map +1 -1
- package/lib/components/modal/modal.js +4 -0
- package/lib/components/modal/modal.js.map +1 -1
- package/lib/components/multi-select/multi-select.d.ts +4 -0
- package/lib/components/multi-select/multi-select.d.ts.map +1 -1
- package/lib/components/multi-select/multi-select.js +5 -2
- package/lib/components/multi-select/multi-select.js.map +1 -1
- package/lib/components/page-header/page-header.d.ts +1 -0
- package/lib/components/page-header/page-header.d.ts.map +1 -1
- package/lib/components/page-header/page-header.js +3 -2
- package/lib/components/page-header/page-header.js.map +1 -1
- package/lib/components/pagination/pagination.d.ts +7 -0
- package/lib/components/pagination/pagination.d.ts.map +1 -1
- package/lib/components/pagination/pagination.js +7 -0
- package/lib/components/pagination/pagination.js.map +1 -1
- package/lib/components/percent-bar/percent-bar.d.ts.map +1 -1
- package/lib/components/percent-bar/percent-bar.js +1 -0
- package/lib/components/percent-bar/percent-bar.js.map +1 -1
- package/lib/components/popover/popover.d.ts +6 -0
- package/lib/components/popover/popover.d.ts.map +1 -1
- package/lib/components/popover/popover.js +7 -1
- package/lib/components/popover/popover.js.map +1 -1
- package/lib/components/primary-nav-item/primary-nav-item.d.ts +2 -0
- package/lib/components/primary-nav-item/primary-nav-item.d.ts.map +1 -1
- package/lib/components/primary-nav-item/primary-nav-item.js +2 -0
- package/lib/components/primary-nav-item/primary-nav-item.js.map +1 -1
- package/lib/components/remove-tag/remove-tag.d.ts +2 -0
- package/lib/components/remove-tag/remove-tag.d.ts.map +1 -1
- package/lib/components/remove-tag/remove-tag.js +3 -1
- package/lib/components/remove-tag/remove-tag.js.map +1 -1
- package/lib/components/section/section.d.ts +1 -0
- package/lib/components/section/section.d.ts.map +1 -1
- package/lib/components/section/section.js +1 -0
- package/lib/components/section/section.js.map +1 -1
- package/lib/components/select/select.d.ts +2 -0
- package/lib/components/select/select.d.ts.map +1 -1
- package/lib/components/select/select.js +5 -1
- package/lib/components/select/select.js.map +1 -1
- package/lib/components/split-button/split-button.d.ts +3 -0
- package/lib/components/split-button/split-button.d.ts.map +1 -1
- package/lib/components/split-button/split-button.js.map +1 -1
- package/lib/components/tab/tab.d.ts +2 -0
- package/lib/components/tab/tab.d.ts.map +1 -1
- package/lib/components/tab/tab.js +2 -0
- package/lib/components/tab/tab.js.map +1 -1
- package/lib/components/table-object/table-object.d.ts +2 -0
- package/lib/components/table-object/table-object.d.ts.map +1 -1
- package/lib/components/table-object/table-object.js +2 -0
- package/lib/components/table-object/table-object.js.map +1 -1
- package/lib/components/table-row/table-row.d.ts +1 -0
- package/lib/components/table-row/table-row.d.ts.map +1 -1
- package/lib/components/table-row/table-row.js +1 -0
- package/lib/components/table-row/table-row.js.map +1 -1
- package/lib/components/tag/tag.d.ts +5 -0
- package/lib/components/tag/tag.d.ts.map +1 -1
- package/lib/components/tag/tag.js +2 -0
- package/lib/components/tag/tag.js.map +1 -1
- package/lib/components/tag-list/tag-list.d.ts +2 -0
- package/lib/components/tag-list/tag-list.d.ts.map +1 -1
- package/lib/components/tag-list/tag-list.js +2 -0
- package/lib/components/tag-list/tag-list.js.map +1 -1
- package/lib/components/text-link/text-link.d.ts +1 -0
- package/lib/components/text-link/text-link.d.ts.map +1 -1
- package/lib/components/text-link/text-link.js +1 -0
- package/lib/components/text-link/text-link.js.map +1 -1
- package/lib/components/tooltip/tooltip.d.ts +6 -0
- package/lib/components/tooltip/tooltip.d.ts.map +1 -1
- package/lib/components/tooltip/tooltip.js +3 -0
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_brand.css +85 -0
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_claude-terracotta.css +1 -0
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_claude-terracotta.module.d.ts +3 -0
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_claude-terracotta.module.d.ts.map +1 -0
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_claude-terracotta.module.js +90 -0
- package/lib/design-tokens/brands/claude-terracotta/css/tokens_claude-terracotta.module.js.map +1 -0
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_brand.css +1 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_brand.css +87 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_cre8-teal.css +1 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_cre8-teal.module.d.ts +3 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_cre8-teal.module.d.ts.map +1 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_cre8-teal.module.js +90 -0
- package/lib/design-tokens/brands/cre8-teal/css/tokens_cre8-teal.module.js.map +1 -0
- package/lib/scripts/generate-react-manifest.d.ts +20 -0
- package/lib/scripts/generate-react-manifest.d.ts.map +1 -0
- package/lib/scripts/generate-react-manifest.js +154 -0
- package/lib/scripts/generate-react-manifest.js.map +1 -0
- package/mcp-manifest.json +203 -38
- package/package.json +10 -4
- package/react-manifest.json +3594 -0
- package/dist/leaf.png +0 -0
- package/dist/leafDS.png +0 -0
- package/dist/leafLogo.svg +0 -1
|
@@ -10,6 +10,7 @@ import { Cre8Element } from '../cre8-element';
|
|
|
10
10
|
import styles from './page-header.styles.js';
|
|
11
11
|
/**
|
|
12
12
|
* @slot - The page header content
|
|
13
|
+
* @slot titleAfter - Content rendered after the heading text, inside the title element
|
|
13
14
|
*/
|
|
14
15
|
export class Cre8PageHeader extends Cre8Element {
|
|
15
16
|
constructor() {
|
|
@@ -25,9 +26,9 @@ export class Cre8PageHeader extends Cre8Element {
|
|
|
25
26
|
<div class="${componentClassName}">
|
|
26
27
|
<h1 class="cre8-c-page-header__title">
|
|
27
28
|
${this.heading}
|
|
28
|
-
${this.slotNotEmpty('
|
|
29
|
+
${this.slotNotEmpty('titleAfter') && html `
|
|
29
30
|
<div class="cre8-c-page-header__title-after">
|
|
30
|
-
<slot name="
|
|
31
|
+
<slot name="titleAfter"></slot>
|
|
31
32
|
</div>`}
|
|
32
33
|
</h1>
|
|
33
34
|
<div class="cre8-c-page-header__description">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-header.js","sourceRoot":"","sources":["../../../components/page-header/page-header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"page-header.js","sourceRoot":"","sources":["../../../components/page-header/page-header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAE7C;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAA/C;;QAGE;;WAEG;QAEC,YAAO,GAAW,mBAAmB,CAAC;IAoB5C,CAAC;IAlBC,MAAM;QACF,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAA;oBACG,kBAAkB;;YAE1B,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,IAAI,CAAA;;;iBAGlC;;;;;;KAMZ,CAAC;IACJ,CAAC;;AAzBQ,qBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAMvB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACe;AAsB5C,IAAI,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;IACvD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAC9D,CAAC;AAQD,eAAe,cAAc,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport styles from './page-header.styles.js';\n\n/**\n * @slot - The page header content\n * @slot titleAfter - Content rendered after the heading text, inside the title element\n */\nexport class Cre8PageHeader extends Cre8Element {\n static styles = [styles];\n\n /**\n * Page header title\n */\n @property({ type: String })\n heading: string = 'Page header title';\n\n render() {\n const componentClassName = this.componentClassNames('cre8-c-page-header', {});\n\n return html`\n <div class=\"${componentClassName}\">\n <h1 class=\"cre8-c-page-header__title\">\n ${this.heading}\n ${this.slotNotEmpty('titleAfter') && html`\n <div class=\"cre8-c-page-header__title-after\">\n <slot name=\"titleAfter\"></slot>\n </div>`}\n </h1>\n <div class=\"cre8-c-page-header__description\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-page-header') === undefined) {\n customElements.define('cre8-page-header', Cre8PageHeader);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-page-header': Cre8PageHeader;\n }\n}\n\nexport default Cre8PageHeader;\n"]}
|
|
@@ -51,6 +51,10 @@ import './page-counter/page-counter';
|
|
|
51
51
|
* @cssproperty "--pagination-display" - controls the display css property
|
|
52
52
|
* @cssproperty "--pagination-justify-content" - controls horizontal alignment of pagination
|
|
53
53
|
* @cssproperty "--pagination-align-items" - controls vertical alignment of pagination
|
|
54
|
+
*
|
|
55
|
+
* @slot - Optional content rendered alongside the pagination controls
|
|
56
|
+
*
|
|
57
|
+
* @fires pagination.click - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.
|
|
54
58
|
*/
|
|
55
59
|
export declare class Cre8Pagination extends Cre8Element {
|
|
56
60
|
static styles: import("lit").CSSResult[];
|
|
@@ -99,6 +103,9 @@ export declare class Cre8Pagination extends Cre8Element {
|
|
|
99
103
|
* @optional
|
|
100
104
|
*/
|
|
101
105
|
hideLastAndFirstButtons?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The currently active page (1-based). Setting it programmatically navigates the pagination.
|
|
108
|
+
*/
|
|
102
109
|
get currentPage(): number;
|
|
103
110
|
set currentPage(newPage: number);
|
|
104
111
|
connectedCallBack(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../components/pagination/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EACG,kBAAkB,EAC3B,MAAM,KAAK,CAAC;AAQb,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,6BAA6B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AAE,CAOlC;cAEe,YAAY;IAuB5B,oBAAoB;IAKpB,YAAY,IAAI,kBAAkB;IAUlC,OAAO,CAAC,cAAc,CAIpB;IAEF,OAAO,CAAC,SAAS,CAkBf;IAEK,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAI1C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,OA9Be,aAAa;IAkClF,MAAM;CA0IT;AAMD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,iBAAiB,EAAE,cAAc,CAAC;KACrC;CACJ"}
|
|
@@ -68,6 +68,10 @@ import styles from './pagination.styles.js';
|
|
|
68
68
|
* @cssproperty "--pagination-display" - controls the display css property
|
|
69
69
|
* @cssproperty "--pagination-justify-content" - controls horizontal alignment of pagination
|
|
70
70
|
* @cssproperty "--pagination-align-items" - controls vertical alignment of pagination
|
|
71
|
+
*
|
|
72
|
+
* @slot - Optional content rendered alongside the pagination controls
|
|
73
|
+
*
|
|
74
|
+
* @fires pagination.click - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.
|
|
71
75
|
*/
|
|
72
76
|
export class Cre8Pagination extends Cre8Element {
|
|
73
77
|
constructor() {
|
|
@@ -115,6 +119,9 @@ export class Cre8Pagination extends Cre8Element {
|
|
|
115
119
|
this._pageSize = newSize;
|
|
116
120
|
this.requestUpdate('pageSize', oldSize);
|
|
117
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* The currently active page (1-based). Setting it programmatically navigates the pagination.
|
|
124
|
+
*/
|
|
118
125
|
get currentPage() {
|
|
119
126
|
return this._currentPage;
|
|
120
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../components/pagination/pagination.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAiD;AACjD,wCAAwC;AACxC,OAAO,EACH,IAAI,EAAsB,OAAO,GACp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AGzC;AASD;IADC,KAAK,EAAE;iDACO;AAUf;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAChB;AAY1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACI;AAO9C;IADC,KAAK,EAAE;mDACa;AAGrB;IADC,QAAQ,CAAC,aAAa,CAAC;+CACK;AAO7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+DACT;AAGlC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAGzC;AAgRL,IAAI,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\n/* eslint-disable lit/no-template-map */\nimport {\n html, HTMLTemplateResult, nothing,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, queryAll, state } from 'lit/decorators.js';\nimport svgCaretLeft from '@tmorrow/cre8-wc/icons/Caret_Left.svg?raw';\nimport svgFirstPage from '@tmorrow/cre8-wc/icons/Caret_Double_Left.svg?raw';\nimport svgLastPage from '@tmorrow/cre8-wc/icons/Caret_Double_Right.svg?raw';\nimport svgCaretRight from '@tmorrow/cre8-wc/icons/Caret_Right.svg?raw';\nimport svgEllipsis from '@tmorrow/cre8-wc/icons/Ellipsis.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport { Cre8Button } from '../button/button';\nimport { isMobile, screenSizes } from '../../utilities/is-mobile';\nimport './page-counter/page-counter';\nimport styles from './pagination.styles.js';\n\n/**\n * The Pagination component is used to split up a large amount of results\n * by showing only a certain amount on each page. You can cycle through\n * the pages using Page Numbers, Next and Previous Buttons, or optional\n * First Page and Last Page Buttons. This component is also used by Table\n * to cycle through rows of results. Pagination has 3 display options:\n *\n * **default**: Can contain up to seven Page Numbers (ellipses included)\n * at a time flanked by Next and Previous Buttons. When there are more than\n * seven pages, numbers start getting replaced by ellipses. Use this option\n * when you have a lot of horizontal space in a layout. It should not be used\n * for mobile web layouts since its buttons are smaller than the minimum touch target of 44px.\n * The component has built in responsivity to mobile page size so you dont have tohandle this\n * seperately\n *\n *\n * **compact** : Best used as a summary of where you are among pages or table rows flanked by\n * Previous and Next Buttons. Use this option when you have limited horizontal space but still\n * need to show where users are among results. Great for mobile layouts.\n *\n *\n * **icon-only** : Use this option in very tight spaces when it’s not required to show users\n * where they are among results. Great for mobile layouts.\n *\n *\n * ## HOW TO USE\n *\n * Select an option from the “display” dropdown depending on layout width\n * Select where your current page is from the “Page” dropdown\n * To show less pages when using Full Numbers, use the \"visiblePages” toggles\n * To hide the First Page and Last Page Buttons, turn on the “hideFirstLastButton” toggle\n * To change the states of page numbers or buttons, interact with the buttond to invoke each “State”\n * When using Compact Numbers, you can choose between “compact” and “icon-only” formats\n *\n *\n * ## ACCESSIBILITY NOTE\n *\n * To best orient people using screen readers, push focus to the top of\n * the list of results after any of the pagination buttons have been triggered,\n * **except for the currently selected one**. Focus target could be a visual results heading,\n * or the top heading of the results container of the page selected\n * via a programmatic selector, e.g. < section id=“results” aria-label=\"results-section\" > or\n * < div role= “group” aria-label=“results” >.\n *\n * @dependency cre8-button, cre8-icon, cre8-pagination-counter\n * @csspart icon - distinguishes the page buttons from the icon buttons\n * @cssproperty \"--pagination-display\" - controls the display css property\n * @cssproperty \"--pagination-justify-content\" - controls horizontal alignment of pagination\n * @cssproperty \"--pagination-align-items\" - controls vertical alignment of pagination\n */\n\nexport class Cre8Pagination extends Cre8Element {\n static styles = [styles];\n\n static elementDefinitions = {\n 'cre8-button': Cre8Button,\n };\n\n @state()\n _currentPage: number = 99;\n\n /**\n * Input the total number of elements are returned from consuming app e.g. search results\n * @attr number\n * @required\n */\n @property({ reflect: true, type: Number })\n totalResults!: number;\n\n\n /**\n * how many elements will displayVariant per page, indicated by business to typically be 20\n * @attr number\n */\n @property({ type: Number, reflect: true })\n get pageSize() {\n return this._pageSize;\n }\n\n set pageSize(newSize: number) {\n const oldSize = this._pageSize;\n this._pageSize = newSize;\n this.requestUpdate('pageSize', oldSize);\n }\n\n @state()\n _pageSize = 10;\n\n\n /**\n * Controls how many page buttons are displayVarianted on the page\n * at once, if container size permits. recommended max = 5 pages\n *\n * @attr number\n */\n @property({ reflect: true, type: Number })\n visiblePages?: number = 5;\n\n /**\n * (optional) prop that allows for a compact and icon-only variant both\n * for mobile screen-sizes and for use in certain contexts as guided by design,\n * the component size will show 'default' in the absence of a value on desktop and\n * 'compact' on smaller views.\n *\n * @attr 'compact' | 'icon-only' | 'default'\n * @optional\n */\n @property({ type: String, reflect: true })\n display?: 'compact' | 'icon-only' | 'default';\n\n /**\n *\n *@state watches the width of the window and responds to show the accessibility approved variant.\n */\n @state()\n windowWidth!: number;\n\n @queryAll('cre8-button')\n buttons: typeof Cre8Button[];\n\n /**\n *\n * @optional\n */\n @property({ type: Boolean, reflect: true })\n hideLastAndFirstButtons?: boolean;\n\n @property({ reflect: true, type: Number })\n get currentPage() {\n return this._currentPage;\n }\n\n set currentPage(newPage: number) {\n const oldPage = this._currentPage;\n this._currentPage = newPage;\n this.requestUpdate('currentPage', oldPage);\n }\n\n connectedCallBack() {\n super.connectedCallback();\n }\n\n get maxVisiblePages() {\n const allowedVisiblePages = {\n md: 5,\n };\n\n // lg and up\n\n if (!isMobile(screenSizes.lg.toString())) {\n return this.visiblePages;\n }\n\n if (!isMobile(screenSizes.md.toString())) {\n return Math.min(allowedVisiblePages.md, this.visiblePages);\n }\n return 0;\n }\n\n\n private get totalPages(): number {\n return Math.ceil(this.totalResults / this.pageSize);\n }\n\n private get hasNoPreviousPage() {\n return this._currentPage <= 1;\n }\n\n private get hasNoNextPage() {\n return this._currentPage >= this.totalPages;\n }\n\n private _onHandleResize() {\n this.requestUpdate();\n }\n\n handleResize() {\n this._onHandleResize.bind(this);\n }\n\n // get range of pages to display [3, 4, 5], [2, 3, 4, 5]\n protected get pageRange(): number[] {\n const left = Math.floor(this.maxVisiblePages / 2);\n let startPage = this.currentPage - left;\n startPage = Math.min(startPage, this.totalPages - this.maxVisiblePages + 1);\n startPage = Math.max(startPage, 1);\n const endPage = Math.min(startPage + this.maxVisiblePages - 1, this.totalPages);\n return [...Array(this.totalPages)].map((_, index) => index + 1).slice(startPage - 1, endPage);\n }\n\n protected async firstUpdated() {\n await this.updateComplete;\n if (this._pageSize !== this.pageSize) {\n const old = this._pageSize;\n this._pageSize = this.pageSize;\n this.requestUpdate('pageSize', old);\n }\n this.windowWidth = window.innerWidth;\n window.addEventListener('resize', () => {\n if (this.windowWidth !== window.innerWidth) {\n const oldWidth = this.windowWidth;\n this.windowWidth = window.innerWidth;\n this.handleResize();\n this.requestUpdate('isResponsive', oldWidth);\n }\n });\n if (this._currentPage !== this.currentPage) {\n const old = this._currentPage;\n this._currentPage = this.currentPage;\n this.requestUpdate('currentPage', old);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n super.disconnectedCallback();\n }\n\n displayTypes(): HTMLTemplateResult {\n return html`<cre8-page-counter\n currentPage=${this.currentPage}\n style=\"display:${this.display === 'compact' ? 'flex' : 'none'};\"\n totalResults=${this.totalResults}\n pageSize=${this._pageSize}\n display=${this.display}>\n </cre8-page-counter>`;\n }\n\n private _handleKeydown = (page: number, _buttonName?: string) => (e: KeyboardEvent) => {\n if (e.code === 'Enter') {\n this._goToPage(page, _buttonName); /* 2 */\n }\n };\n\n private _goToPage = (page: number, _buttonName?: string) => () => {\n const old = this._currentPage;\n let focusButton: Cre8Button;\n this.buttons.forEach((_: typeof Cre8Button) => {\n const b = new Cre8Button();\n if (b.hideText && (b.text === _buttonName)) {\n focusButton = b;\n (focusButton.shadowRoot!.querySelector('.cre8-c-button') as HTMLButtonElement).blur();\n }\n return null;\n });\n this._currentPage = page;\n this.currentPage = this._currentPage;\n this.requestUpdate('currentPage', old);\n this.dispatchEvent(new CustomEvent(\n 'pagination.click',\n { detail: { buttonName: _buttonName ?? this.currentPage.toString(), value: this.currentPage } }\n ));\n };\n\n public goToPage(page: number, buttonName?: string) {\n return this._goToPage(page, buttonName).bind(this);\n }\n\n public handleKeydown(page: number, buttonName?: string) {\n return this._handleKeydown(page, buttonName);\n }\n\n render() {\n const classNames = this.componentClassNames('cre8-c-pagination', {\n 'cre8-c-pagination--compact': this.display !== undefined && this.display === 'compact',\n 'cre8-c-pagination--icon-only': this.display !== undefined && this.display === 'icon-only',\n });\n\n\n return html`<nav\n aria-label=\"pagination\"\n class=${classNames}>\n <slot></slot>\n ${!this.hideLastAndFirstButtons ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"\"\n hideText\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(1, 'First Page')}\n @keydown=${this.handleKeydown(1, 'First Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"First Page\"\n svg=${svgFirstPage}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>` : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(this._currentPage - 1, 'Previous Page')}\n @keydown=${this.handleKeydown(this.currentPage - 1, 'Previous Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"Previous Page\"\n slot=\"before\"\n svg=${svgCaretLeft}\n size=\"24\"\n\n >\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${this.displayTypes()}\n ${!this.display || this.display === 'default'\n ? html`${this.pageRange[this.pageRange.length - 1] > 1 && this.pageRange[0] !== 1\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}\n ${this.pageRange.map((page) => (page === this.currentPage\n ? html`<cre8-button variant=\"tertiary\" tab-index=\"-1\" text=\"${page}\" class=\"icon-only\" size=\"sm\" id=\"current\"></cre8-button>`\n : html`<cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"${page}\"\n class=\"icon-only\"\n id=\"${page}\"\n @click=${this.goToPage(page, page.toString())}\n @keydown=${this.handleKeydown(page, page.toString())}>\n </cre8-button>`\n ))}\n ${this.pageRange[this.pageRange.length - 1] < this.totalPages\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}`\n : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n part=\"icon\"\n hideText\n text=\"\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.currentPage + 1, 'Next Page')}\n @keydown=${this.handleKeydown(this.currentPage + 1, 'Next Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Next Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgCaretRight}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${!this.hideLastAndFirstButtons\n ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.totalPages, 'Last Page')}\n @keydown=${this.handleKeydown(this.totalPages, 'Last Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Last Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\"\n svg=${svgLastPage}\n size=\"24\"\n >\n </cre8-icon>\n </span>\n </cre8-button>`\n : nothing}\n\n </nav>`;\n }\n}\n\nif (customElements.get('cre8-pagination') === undefined) {\n customElements.define('cre8-pagination', Cre8Pagination);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-pagination': Cre8Pagination;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../components/pagination/pagination.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAiD;AACjD,wCAAwC;AACxC,OAAO,EACH,IAAI,EAAsB,OAAO,GACpC,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,YAAY,MAAM,kDAAkD,CAAC;AAC5E,OAAO,WAAW,MAAM,mDAAmD,CAAC;AAC5E,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,6BAA6B,CAAC;AACrC,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAA/C;;QAQI,iBAAY,GAAW,EAAE,CAAC;QA2B1B,cAAS,GAAG,EAAE,CAAC;QAGf;;;;;WAKG;QAEH,iBAAY,GAA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CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC;;;;;;;;sBAQnD,WAAW;;;;;2BAKN;YACX,CAAC,CAAC,OAAO;;aAEZ,CAAC;IACV,CAAC;;AA9VM,qBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAElB,iCAAkB,GAAG;IACxB,aAAa,EAAE,UAAU;CAC5B,AAFwB,CAEvB;AAGF;IADC,KAAK,EAAE;oDACkB;AAQ1B;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDACpB;AAQtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAGzC;AASD;IADC,KAAK,EAAE;iDACO;AAUf;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAChB;AAY1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACI;AAO9C;IADC,KAAK,EAAE;mDACa;AAGrB;IADC,QAAQ,CAAC,aAAa,CAAC;+CACK;AAO7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+DACT;AAMlC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAGzC;AAgRL,IAAI,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\n/* eslint-disable lit/no-template-map */\nimport {\n html, HTMLTemplateResult, nothing,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, queryAll, state } from 'lit/decorators.js';\nimport svgCaretLeft from '@tmorrow/cre8-wc/icons/Caret_Left.svg?raw';\nimport svgFirstPage from '@tmorrow/cre8-wc/icons/Caret_Double_Left.svg?raw';\nimport svgLastPage from '@tmorrow/cre8-wc/icons/Caret_Double_Right.svg?raw';\nimport svgCaretRight from '@tmorrow/cre8-wc/icons/Caret_Right.svg?raw';\nimport svgEllipsis from '@tmorrow/cre8-wc/icons/Ellipsis.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport { Cre8Button } from '../button/button';\nimport { isMobile, screenSizes } from '../../utilities/is-mobile';\nimport './page-counter/page-counter';\nimport styles from './pagination.styles.js';\n\n/**\n * The Pagination component is used to split up a large amount of results\n * by showing only a certain amount on each page. You can cycle through\n * the pages using Page Numbers, Next and Previous Buttons, or optional\n * First Page and Last Page Buttons. This component is also used by Table\n * to cycle through rows of results. Pagination has 3 display options:\n *\n * **default**: Can contain up to seven Page Numbers (ellipses included)\n * at a time flanked by Next and Previous Buttons. When there are more than\n * seven pages, numbers start getting replaced by ellipses. Use this option\n * when you have a lot of horizontal space in a layout. It should not be used\n * for mobile web layouts since its buttons are smaller than the minimum touch target of 44px.\n * The component has built in responsivity to mobile page size so you dont have tohandle this\n * seperately\n *\n *\n * **compact** : Best used as a summary of where you are among pages or table rows flanked by\n * Previous and Next Buttons. Use this option when you have limited horizontal space but still\n * need to show where users are among results. Great for mobile layouts.\n *\n *\n * **icon-only** : Use this option in very tight spaces when it’s not required to show users\n * where they are among results. Great for mobile layouts.\n *\n *\n * ## HOW TO USE\n *\n * Select an option from the “display” dropdown depending on layout width\n * Select where your current page is from the “Page” dropdown\n * To show less pages when using Full Numbers, use the \"visiblePages” toggles\n * To hide the First Page and Last Page Buttons, turn on the “hideFirstLastButton” toggle\n * To change the states of page numbers or buttons, interact with the buttond to invoke each “State”\n * When using Compact Numbers, you can choose between “compact” and “icon-only” formats\n *\n *\n * ## ACCESSIBILITY NOTE\n *\n * To best orient people using screen readers, push focus to the top of\n * the list of results after any of the pagination buttons have been triggered,\n * **except for the currently selected one**. Focus target could be a visual results heading,\n * or the top heading of the results container of the page selected\n * via a programmatic selector, e.g. < section id=“results” aria-label=\"results-section\" > or\n * < div role= “group” aria-label=“results” >.\n *\n * @dependency cre8-button, cre8-icon, cre8-pagination-counter\n * @csspart icon - distinguishes the page buttons from the icon buttons\n * @cssproperty \"--pagination-display\" - controls the display css property\n * @cssproperty \"--pagination-justify-content\" - controls horizontal alignment of pagination\n * @cssproperty \"--pagination-align-items\" - controls vertical alignment of pagination\n *\n * @slot - Optional content rendered alongside the pagination controls\n *\n * @fires pagination.click - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.\n */\n\nexport class Cre8Pagination extends Cre8Element {\n static styles = [styles];\n\n static elementDefinitions = {\n 'cre8-button': Cre8Button,\n };\n\n @state()\n _currentPage: number = 99;\n\n /**\n * Input the total number of elements are returned from consuming app e.g. search results\n * @attr number\n * @required\n */\n @property({ reflect: true, type: Number })\n totalResults!: number;\n\n\n /**\n * how many elements will displayVariant per page, indicated by business to typically be 20\n * @attr number\n */\n @property({ type: Number, reflect: true })\n get pageSize() {\n return this._pageSize;\n }\n\n set pageSize(newSize: number) {\n const oldSize = this._pageSize;\n this._pageSize = newSize;\n this.requestUpdate('pageSize', oldSize);\n }\n\n @state()\n _pageSize = 10;\n\n\n /**\n * Controls how many page buttons are displayVarianted on the page\n * at once, if container size permits. recommended max = 5 pages\n *\n * @attr number\n */\n @property({ reflect: true, type: Number })\n visiblePages?: number = 5;\n\n /**\n * (optional) prop that allows for a compact and icon-only variant both\n * for mobile screen-sizes and for use in certain contexts as guided by design,\n * the component size will show 'default' in the absence of a value on desktop and\n * 'compact' on smaller views.\n *\n * @attr 'compact' | 'icon-only' | 'default'\n * @optional\n */\n @property({ type: String, reflect: true })\n display?: 'compact' | 'icon-only' | 'default';\n\n /**\n *\n *@state watches the width of the window and responds to show the accessibility approved variant.\n */\n @state()\n windowWidth!: number;\n\n @queryAll('cre8-button')\n buttons: typeof Cre8Button[];\n\n /**\n *\n * @optional\n */\n @property({ type: Boolean, reflect: true })\n hideLastAndFirstButtons?: boolean;\n\n /**\n * The currently active page (1-based). Setting it programmatically navigates the pagination.\n */\n @property({ reflect: true, type: Number })\n get currentPage() {\n return this._currentPage;\n }\n\n set currentPage(newPage: number) {\n const oldPage = this._currentPage;\n this._currentPage = newPage;\n this.requestUpdate('currentPage', oldPage);\n }\n\n connectedCallBack() {\n super.connectedCallback();\n }\n\n get maxVisiblePages() {\n const allowedVisiblePages = {\n md: 5,\n };\n\n // lg and up\n\n if (!isMobile(screenSizes.lg.toString())) {\n return this.visiblePages;\n }\n\n if (!isMobile(screenSizes.md.toString())) {\n return Math.min(allowedVisiblePages.md, this.visiblePages);\n }\n return 0;\n }\n\n\n private get totalPages(): number {\n return Math.ceil(this.totalResults / this.pageSize);\n }\n\n private get hasNoPreviousPage() {\n return this._currentPage <= 1;\n }\n\n private get hasNoNextPage() {\n return this._currentPage >= this.totalPages;\n }\n\n private _onHandleResize() {\n this.requestUpdate();\n }\n\n handleResize() {\n this._onHandleResize.bind(this);\n }\n\n // get range of pages to display [3, 4, 5], [2, 3, 4, 5]\n protected get pageRange(): number[] {\n const left = Math.floor(this.maxVisiblePages / 2);\n let startPage = this.currentPage - left;\n startPage = Math.min(startPage, this.totalPages - this.maxVisiblePages + 1);\n startPage = Math.max(startPage, 1);\n const endPage = Math.min(startPage + this.maxVisiblePages - 1, this.totalPages);\n return [...Array(this.totalPages)].map((_, index) => index + 1).slice(startPage - 1, endPage);\n }\n\n protected async firstUpdated() {\n await this.updateComplete;\n if (this._pageSize !== this.pageSize) {\n const old = this._pageSize;\n this._pageSize = this.pageSize;\n this.requestUpdate('pageSize', old);\n }\n this.windowWidth = window.innerWidth;\n window.addEventListener('resize', () => {\n if (this.windowWidth !== window.innerWidth) {\n const oldWidth = this.windowWidth;\n this.windowWidth = window.innerWidth;\n this.handleResize();\n this.requestUpdate('isResponsive', oldWidth);\n }\n });\n if (this._currentPage !== this.currentPage) {\n const old = this._currentPage;\n this._currentPage = this.currentPage;\n this.requestUpdate('currentPage', old);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n super.disconnectedCallback();\n }\n\n displayTypes(): HTMLTemplateResult {\n return html`<cre8-page-counter\n currentPage=${this.currentPage}\n style=\"display:${this.display === 'compact' ? 'flex' : 'none'};\"\n totalResults=${this.totalResults}\n pageSize=${this._pageSize}\n display=${this.display}>\n </cre8-page-counter>`;\n }\n\n private _handleKeydown = (page: number, _buttonName?: string) => (e: KeyboardEvent) => {\n if (e.code === 'Enter') {\n this._goToPage(page, _buttonName); /* 2 */\n }\n };\n\n private _goToPage = (page: number, _buttonName?: string) => () => {\n const old = this._currentPage;\n let focusButton: Cre8Button;\n this.buttons.forEach((_: typeof Cre8Button) => {\n const b = new Cre8Button();\n if (b.hideText && (b.text === _buttonName)) {\n focusButton = b;\n (focusButton.shadowRoot!.querySelector('.cre8-c-button') as HTMLButtonElement).blur();\n }\n return null;\n });\n this._currentPage = page;\n this.currentPage = this._currentPage;\n this.requestUpdate('currentPage', old);\n this.dispatchEvent(new CustomEvent(\n 'pagination.click',\n { detail: { buttonName: _buttonName ?? this.currentPage.toString(), value: this.currentPage } }\n ));\n };\n\n public goToPage(page: number, buttonName?: string) {\n return this._goToPage(page, buttonName).bind(this);\n }\n\n public handleKeydown(page: number, buttonName?: string) {\n return this._handleKeydown(page, buttonName);\n }\n\n render() {\n const classNames = this.componentClassNames('cre8-c-pagination', {\n 'cre8-c-pagination--compact': this.display !== undefined && this.display === 'compact',\n 'cre8-c-pagination--icon-only': this.display !== undefined && this.display === 'icon-only',\n });\n\n\n return html`<nav\n aria-label=\"pagination\"\n class=${classNames}>\n <slot></slot>\n ${!this.hideLastAndFirstButtons ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"\"\n hideText\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(1, 'First Page')}\n @keydown=${this.handleKeydown(1, 'First Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"First Page\"\n svg=${svgFirstPage}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>` : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(this._currentPage - 1, 'Previous Page')}\n @keydown=${this.handleKeydown(this.currentPage - 1, 'Previous Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"Previous Page\"\n slot=\"before\"\n svg=${svgCaretLeft}\n size=\"24\"\n\n >\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${this.displayTypes()}\n ${!this.display || this.display === 'default'\n ? html`${this.pageRange[this.pageRange.length - 1] > 1 && this.pageRange[0] !== 1\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}\n ${this.pageRange.map((page) => (page === this.currentPage\n ? html`<cre8-button variant=\"tertiary\" tab-index=\"-1\" text=\"${page}\" class=\"icon-only\" size=\"sm\" id=\"current\"></cre8-button>`\n : html`<cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"${page}\"\n class=\"icon-only\"\n id=\"${page}\"\n @click=${this.goToPage(page, page.toString())}\n @keydown=${this.handleKeydown(page, page.toString())}>\n </cre8-button>`\n ))}\n ${this.pageRange[this.pageRange.length - 1] < this.totalPages\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}`\n : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n part=\"icon\"\n hideText\n text=\"\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.currentPage + 1, 'Next Page')}\n @keydown=${this.handleKeydown(this.currentPage + 1, 'Next Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Next Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgCaretRight}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${!this.hideLastAndFirstButtons\n ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.totalPages, 'Last Page')}\n @keydown=${this.handleKeydown(this.totalPages, 'Last Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Last Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\"\n svg=${svgLastPage}\n size=\"24\"\n >\n </cre8-icon>\n </span>\n </cre8-button>`\n : nothing}\n\n </nav>`;\n }\n}\n\nif (customElements.get('cre8-pagination') === undefined) {\n customElements.define('cre8-pagination', Cre8Pagination);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-pagination': Cre8Pagination;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent-bar.d.ts","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,8BAA8B,CAAC;AACtC,OAAO,kCAAkC,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,CAAC,MAAM,4BAAY;IAOzB,KAAK,EAAE,MAAM,CAAC;IAMd,GAAG,EAAE,MAAM,CAAC;IAMZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,WAAW;IAInB,MAAM;
|
|
1
|
+
{"version":3,"file":"percent-bar.d.ts","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,8BAA8B,CAAC;AACtC,OAAO,kCAAkC,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,CAAC,MAAM,4BAAY;IAOzB,KAAK,EAAE,MAAM,CAAC;IAMd,GAAG,EAAE,MAAM,CAAC;IAMZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,WAAW;IAInB,MAAM;CAoCP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent-bar.js","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,UAAU,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,8BAA8B,CAAC;AACtC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,MAAM,MAAM,yBAAyB,C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AiB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IACnD,CAAC;IAEO,WAAW;QACjB,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAE/E,OAAO,IAAI,CAAA;oBACK,mBAAmB;;;kBAGrB,IAAI,CAAC,WAAW,EAAE;YAClB,CAAC,CAAC,IAAI,CAAA;kCACU,IAAI;;6BAET,UAAU;;;kCAGL,IAAI,CAAC,iBAAiB;gCACxB,IAAI,CAAC,YAAY;;mCAEd;YACjB,CAAC,CAAC,OAAO;;;;;;;oBAOP,IAAI,CAAC,iBAAiB,EAAE;;;;;mBAKzB,IAAI,CAAC,KAAK;iBACZ,IAAI,CAAC,GAAG;;;KAGpB,CAAC;IACJ,CAAC;;AApEM,qBAAM,GAAG,CAAC,MAAM,CAAC,CAAC;AAOzB;IADC,QAAQ,EAAE;6CACG;AAMd;IADC,QAAQ,EAAE;2CACC;AAMZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDACf;AAoD9B,IAAI,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;IACzD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC;AAQD,eAAe,cAAc,CAAC","sourcesContent":["/* eslint-disable indent */\nimport { html, nothing, } from 'lit';\nimport svgCaretUp from '@tmorrow/cre8-wc/icons/Caret_Up.svg?raw';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../button/button';\nimport '../text-passage/text-passage';\nimport '../progress-meter/progress-meter';\nimport styles from './percent-bar.styles.js';\n\n/**\n * The percent bar visually indicates a user's current progress and has a few features: a basic display bar with\n * a percentage, an actionable icon that allows a user to revisit a prior step and an actionable link that\n * allows a user save their progress before exiting.\n */\nexport class Cre8PercentBar extends Cre8Element {\n static styles = [styles];\n\n\n /*\n * The current step the user is on.\n */\n @property()\n value: number;\n\n /*\n * The total number of steps in the multistep process.\n */\n @property()\n max: number;\n\n /*\n * The action-left icon-only tertiary button in the percent bar controls can be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disableActionLeft?: boolean;\n\n private _handleClick(e: MouseEvent) {\n this.dispatchEvent(new Event('leftActionButtonClick', e));\n }\n\n private fractionAsPercent(): number {\n return Math.round((this.value / this.max) * 100);\n }\n\n private isFirstStep(): boolean {\n return this.value > 1;\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-percent-bar', {});\n\n return html`\n <div class=\"${componentClassNames}\">\n <div class=\"cre8-c-percent-bar__controls\">\n <div lass=\"cre8-c-percent-bar__left-controls\">\n ${this.isFirstStep()\n ? html` <cre8-button\n ?hideText=${true}\n text=\"Previous step\"\n svg=\"${svgCaretUp}\"\n iconRotateDegree=\"-90\"\n variant=\"tertiary\"\n ?disabled=${this.disableActionLeft}\n @click=\"${this._handleClick}\"\n >\n </cre8-button>`\n : nothing}\n </div>\n <div class=\"cre8-c-percent-bar__right-controls\">\n <cre8-text-passage\n size=\"small\"\n class=\"cre8-c-percent-bar__text-passage\"\n >\n ${this.fractionAsPercent()}%\n </cre8-text-passage>\n </div>\n </div>\n <cre8-progress-meter\n value=\"${this.value}\"\n max=\"${this.max}\"\n ></cre8-progress-meter>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-percent-bar') === undefined) {\n customElements.define('cre8-percent-bar', Cre8PercentBar);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-percent-bar': Cre8PercentBar;\n }\n}\n\nexport default Cre8PercentBar;\n"]}
|
|
@@ -4,6 +4,12 @@ import '../heading/heading';
|
|
|
4
4
|
* The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.
|
|
5
5
|
* Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.
|
|
6
6
|
* @slot - The component content
|
|
7
|
+
* @slot trigger - The element that toggles the popover open and closed
|
|
8
|
+
* @slot header - Custom header content for the popover panel
|
|
9
|
+
* @slot footer - Custom footer content for the popover panel
|
|
10
|
+
*
|
|
11
|
+
* @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
12
|
+
* @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
7
13
|
*/
|
|
8
14
|
export declare class Cre8Popover extends Cre8Element {
|
|
9
15
|
static styles: import("lit").CSSResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAI5B
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAI5B;;;;;;;;;;GAUG;AAEH,qBAAa,WAAY,SAAQ,WAAW;IACxC,MAAM,CAAC,MAAM,4BAAY;IAE3B;;;OAGG;IAEC,OAAO,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;IAEC,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAExC;;;OAGG;IAEC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IAEC,SAAS,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IAEC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;;;OAOG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGvB;;OAEG;IAEC,YAAY,EAAE,WAAW,CAAC;IAE9B;;OAEG;IAEC,iBAAiB,EAAE,WAAW,CAAC;IAEnC;;OAEG;IAEC,mBAAmB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAE5C;;OAEG;IAEC,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3C;;;OAGG;IACH,IAAI,KAAK,YAER;IAED;;;;;;OAMG;IACH,iBAAiB;IAQjB;;;;;;OAMG;IACH,oBAAoB;IAQpB;;;OAGG;IACH,YAAY;IAIZ;;;;;OAKG;IACH,OAAO;IAaP;;OAEG;IACH,eAAe;IAyCf;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IA8BrB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,4BAA4B;IAKpC;;;;;;;;;;;OAWG;IACH,oBAAoB,GAAI,GAAG,UAAU,UAoBnC;IAEF;;;;OAIG;IACH,oBAAoB,aAYlB;IAEF;;;OAGG;IACH,YAAY,aAIV;IAEF,MAAM;CAsCP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -13,6 +13,12 @@ import styles from './popover.styles.js';
|
|
|
13
13
|
* The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.
|
|
14
14
|
* Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.
|
|
15
15
|
* @slot - The component content
|
|
16
|
+
* @slot trigger - The element that toggles the popover open and closed
|
|
17
|
+
* @slot header - Custom header content for the popover panel
|
|
18
|
+
* @slot footer - Custom footer content for the popover panel
|
|
19
|
+
*
|
|
20
|
+
* @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
21
|
+
* @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
16
22
|
*/
|
|
17
23
|
export class Cre8Popover extends Cre8Element {
|
|
18
24
|
constructor() {
|
|
@@ -125,7 +131,7 @@ export class Cre8Popover extends Cre8Element {
|
|
|
125
131
|
addAria() {
|
|
126
132
|
/* 1 */
|
|
127
133
|
let popoverTrigger;
|
|
128
|
-
if (this._Cre8PopoverTrigger[0].tagName === '
|
|
134
|
+
if (this._Cre8PopoverTrigger[0].tagName === 'CRE8-BUTTON') {
|
|
129
135
|
popoverTrigger = this._Cre8PopoverTrigger[0];
|
|
130
136
|
popoverTrigger.buttonAriaExpanded = this.isActive ? this.isActive : false;
|
|
131
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC;;;;GAIG;AAEH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QAgRE;;;;;;;;;;;WAWG;QACH,yBAAoB,GAAG,CAAC,CAAa,EAAE,EAAE;YACvC,OAAO;YACL,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACjB,OAAO;YACX,CAAC;YAEH,OAAO;YACL,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;gBACzB,MAAM,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC1E,CAAC;YAEH,OAAO;YACL,MAAM,cAAc,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEz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ACnB;AAQpB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACb;AAW1B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAOnB;IADH,KAAK,CAAC,iBAAiB,CAAC;iDACK;AAM1B;IADH,KAAK,CAAC,wBAAwB,CAAC;sDACG;AAM/B;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;wDACC;AAMxC;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;uDACC;AAwS7C,IAAI,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAQD,eAAe,WAAW,CAAC","sourcesContent":["import { html, nothing, } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../heading/heading';\nimport styles from './popover.styles.js';\nimport { Cre8Button } from '../button/button';\n\n/**\n * The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.\n * Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.\n * @slot - The component content\n */\n\nexport class Cre8Popover extends Cre8Element {\n static styles = [styles];\n\n /**\n * The heading text that appears at the top of the popover panel. Should only be 2-3 lines max.\n * @attr {string | undefined}\n */\n @property()\n heading?: string;\n\n /**\n * Positions the popover panel absolutely to the trigger\n * - **default** positions the popover panel below the trigger\n * - **top** positions the popover panel below the trigger\n * - **left** positions the popover panel below the trigger\n * - **right** positions the popover panel below the trigger\n * @attr {string | undefined}\n */\n @property()\n position?: 'top' | 'left' | 'right';\n\n /**\n * Set to prevent the popover panel from hiding on scroll\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isVisibleOnScroll?: boolean;\n\n /**\n * The dynamic state for the popover\n * - If true, the popover panel placement is determined by its position in the viewport\n * - If false, the popover panel placement will be placed according to the position value\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isDynamic?: boolean;\n\n /**\n * The dynamic active state\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActiveDynamic?: boolean;\n\n /**\n * The active state for the popover\n * - If true, the popover panel is visible\n * - If false, the popover panel is hidden\n *\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover')\n _Cre8Popover: HTMLElement;\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover__panel')\n _Cre8PopoverPanel: HTMLElement;\n\n /**\n * Query the assigned elements in the trigger slot\n */\n @queryAssignedElements({ slot: 'trigger' })\n _Cre8PopoverTrigger: Array<HTMLElement>;\n\n /**\n * Query the assigned elements in the footer slot\n */\n @queryAssignedElements({ slot: 'footer' })\n _Cre8PopoverFooter: Array<HTMLElement>;\n\n /**\n * Query the document direction value\n * <br/><br/> _*This property is dynamically set_\n */\n get isRTL() {\n return document.dir === 'rtl';\n }\n\n /**\n * Connected Callback Lifecycle\n * 1. Add window resize event listener\n * 2. Add window scroll event listener\n * 3. Add window orientation change event listener\n * 4. Add mousedown event listener\n */\n connectedCallback() {\n super.connectedCallback();\n globalThis.window.addEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.addEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.addEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.addEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * Disconnected Callback Lifecycle\n * 1. Remove window resize event listener\n * 2. Remove window scroll event listener\n * 3. Remove window orientation change event listener\n * 4. Remove mousedown event listener\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n globalThis.window.removeEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.removeEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.removeEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.removeEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * First Updated Lifecycle\n * 1. Set attribute since aria expanded can't be passed down through the slot\n */\n firstUpdated() {\n this.addAria(); /* 1 */\n }\n\n /**\n * Add aria attributes on the trigger button\n * 1. Select the element within the trigger slot\n * 2. Set aria-expanded on the popover trigger to the active state if provided. Otherwise, set to false.\n * 3 Set the type to button.\n */\n addAria() {\n /* 1 */\n let popoverTrigger;\n if (this._Cre8PopoverTrigger[0].tagName === 'cre8-BUTTON') {\n popoverTrigger = this._Cre8PopoverTrigger[0] as Cre8Button;\n popoverTrigger.buttonAriaExpanded = this.isActive ? this.isActive : false;\n } else {\n popoverTrigger = this._Cre8PopoverTrigger[0];\n popoverTrigger.setAttribute('aria-expanded', `${this.isActive ? this.isActive : false}`); /* 2 */\n popoverTrigger.setAttribute('type', 'button'); /* 3 */\n }\n }\n\n /**\n * Handle all dynamic placement\n */\n dynamicPosition() {\n // TODO: Temporarily keep eslint complexity as warning. Update during specific story for this rule.\n /* eslint complexity: [\"warn\", 10] */\n if (this.isDynamic && this._Cre8PopoverPanel) {\n const body = document.querySelector('body').getBoundingClientRect();\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n\n /**\n * If popover panel breaks out the left side of the window, position it to the right\n */\n if (popoverPanel.left < 0) {\n this.position = this.isRTL ? 'left' : 'right';\n }\n\n /**\n * If popover panel breaks out the right side of the window, position it to the left\n */\n if (popoverPanel.right >= body.width) {\n this.position = this.isRTL ? 'right' : 'left';\n }\n\n /**\n * If popover panel breaks out the top side of the window only, position it to the bottom\n */\n if (popoverPanel.top < 0 && popoverPanel.left > 0 && popoverPanel.right < body.width) {\n this.position = null;\n }\n\n /**\n * If popover panel breaks out the bottom side of the window only, position it to the top\n */\n if (\n popoverPanel.bottom >= window.innerHeight\n && popoverPanel.left >= 0\n && popoverPanel.right <= body.width\n ) {\n this.position = 'top';\n }\n }\n }\n\n /**\n * Set Popover Active State\n * 1. Toggle the active state between true and false\n * 2. Set attribute since aria expanded can't be passed down through the slot\n * 3. If the active state is toggled to false, close the panel and return focus to the dropdown trigger.\n * This accounts for both design system buttons and native HTML buttons\n */\n private _toggleActive() {\n this.isActive = !this.isActive; /* 1 */\n this.addAria(); /* 2 */\n\n if (this.isActive) {\n requestAnimationFrame(() => {\n this.dynamicPosition();\n });\n this.dispatchEvent(\n new CustomEvent('open', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n } else {\n /* 3 */\n this.dispatchEvent(\n new CustomEvent('close', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n }\n\n /**\n * Toggle the active state for dynamic. This prevents a flash of the popover in the orginal position\n */\n setTimeout(() => {\n if (this.isActive) {\n this.isActiveDynamic = true;\n } else {\n this.isActiveDynamic = false;\n }\n }, 2);\n }\n\n /**\n * Handle Keydown\n * 1. If the panel is open and escape is keyed, close the popover panel and return focus to the trigger button\n * 2. If the panel is opened, tab away closes the popover panel\n * 3. The panel can be opened and closed by Enter or Space keys.\n */\n private _handleKeydown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._toggleActive();\n } else if (e.key === 'Tab') {\n this._handleTabNavigation(e);\n }\n }\n\n private _handleTabNavigation(e: KeyboardEvent) {\n if (this.isActive) {\n this._navigateInsidePopover(e);\n }\n }\n\n private _navigateInsidePopover(e: KeyboardEvent) {\n const focusableElements = this._getFocusableElements();\n if (focusableElements.length === 0) {\n this._closePopoverAndFocusTrigger(e);\n return;\n }\n\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (document.activeElement === lastFocusableElement) {\n this._closePopoverAndFocusTrigger(e);\n e.preventDefault();\n }\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const panelFocusableElements = Array.from(this._Cre8PopoverFooter);\n return [...panelFocusableElements];\n }\n\n private _closePopoverAndFocusTrigger(e: KeyboardEvent) {\n this._toggleActive();\n e.preventDefault();\n }\n\n /**\n * Handle click outside the component\n * 1. Close the show/hide popover panel on click outside\n * 2. If the popover panel is already closed then we don't care about outside clicks and we can bail early\n * 3. By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4. Check to see if we clicked inside the active panel\n * 5. If the panel is active and we've clicked outside of the panel then it should be closed.\n */\n handleOnClickOutside = (e: MouseEvent) => {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine panel context during click handler');\n }\n\n /* 4 */\n const didClickInside = e.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (!(e.target === document.querySelector('html') && e.clientX >= document.documentElement.offsetWidth)) {\n if (this.isActive && !didClickInside) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State on Scroll\n * 1. If a scroll event is fired and visibileOnScroll is not true, remove the active state\n * 2. If the popover height is less than the window height, then allow the active to remove on scroll\n */\n removeActiveOnScroll = () => {\n /* 1 */\n if (this.isActive && !this.isVisibleOnScroll) {\n /* 2 */\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n const popoverTrigger = this._Cre8Popover;\n const popoverHeight = popoverTrigger.clientHeight + popoverPanel.height + popoverPanel.top;\n\n if (popoverHeight < window.innerHeight) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State\n * 1. If a specific event is fired, remove the active state.\n */\n removeActive = () => {\n if (this.isActive) {\n this._toggleActive();\n }\n };\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-popover', {\n 'cre8-c-popover--top': this.position === 'top',\n 'cre8-c-popover--left': this.position === 'left',\n 'cre8-c-popover--right': this.position === 'right',\n 'cre8-is-active': this.isActive,\n 'cre8-is-dynamic': this.isDynamic,\n 'cre8-is-dynamic-active': this.isActiveDynamic,\n });\n\n return html`\n <div class=\"${componentClassNames}\">\n ${this.slotNotEmpty('trigger')\n && html` <slot name=\"trigger\" @keydown=${this._handleKeydown} @click=${this._toggleActive}></slot> `}\n ${this.isActive\n ? html`\n <div tabindex=\"0\" class=\"cre8-c-popover__panel\" @keydown=${this._handleKeydown}>\n ${(this.slotNotEmpty('header') || this.heading)\n && html`\n <div class=\"cre8-c-popover__header\">\n ${this.heading\n ? html`<div class=\"cre8-c-popover__heading\">${this.heading}</div>`\n : html`<slot name=\"header\"></slot>`}\n </div>\n `}\n <slot></slot>\n ${this.slotNotEmpty('footer')\n && html`\n <div class=\"cre8-c-popover__footer\">\n <slot name=\"footer\"></slot>\n </div>\n `}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-popover') === undefined) {\n customElements.define('cre8-popover', Cre8Popover);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-popover': Cre8Popover;\n }\n}\n\nexport default Cre8Popover;\n"]}
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QAgRE;;;;;;;;;;;WAWG;QACH,yBAAoB,GAAG,CAAC,CAAa,EAAE,EAAE;YACvC,OAAO;YACL,IAAI,CAAC,IAAI,CAAC,QAAQ,EA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,kBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAOvB;IADH,QAAQ,EAAE;4CACU;AAWjB;IADH,QAAQ,EAAE;6CAC6B;AAOpC;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDACX;AAS5B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACnB;AAQpB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACb;AAW1B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAOnB;IADH,KAAK,CAAC,iBAAiB,CAAC;iDACK;AAM1B;IADH,KAAK,CAAC,wBAAwB,CAAC;sDACG;AAM/B;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;wDACC;AAMxC;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;uDACC;AAwS7C,IAAI,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAQD,eAAe,WAAW,CAAC","sourcesContent":["import { html, nothing, } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../heading/heading';\nimport styles from './popover.styles.js';\nimport { Cre8Button } from '../button/button';\n\n/**\n * The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.\n * Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.\n * @slot - The component content\n * @slot trigger - The element that toggles the popover open and closed\n * @slot header - Custom header content for the popover panel\n * @slot footer - Custom footer content for the popover panel\n *\n * @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.\n * @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.\n */\n\nexport class Cre8Popover extends Cre8Element {\n static styles = [styles];\n\n /**\n * The heading text that appears at the top of the popover panel. Should only be 2-3 lines max.\n * @attr {string | undefined}\n */\n @property()\n heading?: string;\n\n /**\n * Positions the popover panel absolutely to the trigger\n * - **default** positions the popover panel below the trigger\n * - **top** positions the popover panel below the trigger\n * - **left** positions the popover panel below the trigger\n * - **right** positions the popover panel below the trigger\n * @attr {string | undefined}\n */\n @property()\n position?: 'top' | 'left' | 'right';\n\n /**\n * Set to prevent the popover panel from hiding on scroll\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isVisibleOnScroll?: boolean;\n\n /**\n * The dynamic state for the popover\n * - If true, the popover panel placement is determined by its position in the viewport\n * - If false, the popover panel placement will be placed according to the position value\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isDynamic?: boolean;\n\n /**\n * The dynamic active state\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActiveDynamic?: boolean;\n\n /**\n * The active state for the popover\n * - If true, the popover panel is visible\n * - If false, the popover panel is hidden\n *\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover')\n _Cre8Popover: HTMLElement;\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover__panel')\n _Cre8PopoverPanel: HTMLElement;\n\n /**\n * Query the assigned elements in the trigger slot\n */\n @queryAssignedElements({ slot: 'trigger' })\n _Cre8PopoverTrigger: Array<HTMLElement>;\n\n /**\n * Query the assigned elements in the footer slot\n */\n @queryAssignedElements({ slot: 'footer' })\n _Cre8PopoverFooter: Array<HTMLElement>;\n\n /**\n * Query the document direction value\n * <br/><br/> _*This property is dynamically set_\n */\n get isRTL() {\n return document.dir === 'rtl';\n }\n\n /**\n * Connected Callback Lifecycle\n * 1. Add window resize event listener\n * 2. Add window scroll event listener\n * 3. Add window orientation change event listener\n * 4. Add mousedown event listener\n */\n connectedCallback() {\n super.connectedCallback();\n globalThis.window.addEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.addEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.addEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.addEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * Disconnected Callback Lifecycle\n * 1. Remove window resize event listener\n * 2. Remove window scroll event listener\n * 3. Remove window orientation change event listener\n * 4. Remove mousedown event listener\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n globalThis.window.removeEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.removeEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.removeEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.removeEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * First Updated Lifecycle\n * 1. Set attribute since aria expanded can't be passed down through the slot\n */\n firstUpdated() {\n this.addAria(); /* 1 */\n }\n\n /**\n * Add aria attributes on the trigger button\n * 1. Select the element within the trigger slot\n * 2. Set aria-expanded on the popover trigger to the active state if provided. Otherwise, set to false.\n * 3 Set the type to button.\n */\n addAria() {\n /* 1 */\n let popoverTrigger;\n if (this._Cre8PopoverTrigger[0].tagName === 'CRE8-BUTTON') {\n popoverTrigger = this._Cre8PopoverTrigger[0] as Cre8Button;\n popoverTrigger.buttonAriaExpanded = this.isActive ? this.isActive : false;\n } else {\n popoverTrigger = this._Cre8PopoverTrigger[0];\n popoverTrigger.setAttribute('aria-expanded', `${this.isActive ? this.isActive : false}`); /* 2 */\n popoverTrigger.setAttribute('type', 'button'); /* 3 */\n }\n }\n\n /**\n * Handle all dynamic placement\n */\n dynamicPosition() {\n // TODO: Temporarily keep eslint complexity as warning. Update during specific story for this rule.\n /* eslint complexity: [\"warn\", 10] */\n if (this.isDynamic && this._Cre8PopoverPanel) {\n const body = document.querySelector('body').getBoundingClientRect();\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n\n /**\n * If popover panel breaks out the left side of the window, position it to the right\n */\n if (popoverPanel.left < 0) {\n this.position = this.isRTL ? 'left' : 'right';\n }\n\n /**\n * If popover panel breaks out the right side of the window, position it to the left\n */\n if (popoverPanel.right >= body.width) {\n this.position = this.isRTL ? 'right' : 'left';\n }\n\n /**\n * If popover panel breaks out the top side of the window only, position it to the bottom\n */\n if (popoverPanel.top < 0 && popoverPanel.left > 0 && popoverPanel.right < body.width) {\n this.position = null;\n }\n\n /**\n * If popover panel breaks out the bottom side of the window only, position it to the top\n */\n if (\n popoverPanel.bottom >= window.innerHeight\n && popoverPanel.left >= 0\n && popoverPanel.right <= body.width\n ) {\n this.position = 'top';\n }\n }\n }\n\n /**\n * Set Popover Active State\n * 1. Toggle the active state between true and false\n * 2. Set attribute since aria expanded can't be passed down through the slot\n * 3. If the active state is toggled to false, close the panel and return focus to the dropdown trigger.\n * This accounts for both design system buttons and native HTML buttons\n */\n private _toggleActive() {\n this.isActive = !this.isActive; /* 1 */\n this.addAria(); /* 2 */\n\n if (this.isActive) {\n requestAnimationFrame(() => {\n this.dynamicPosition();\n });\n this.dispatchEvent(\n new CustomEvent('open', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n } else {\n /* 3 */\n this.dispatchEvent(\n new CustomEvent('close', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n }\n\n /**\n * Toggle the active state for dynamic. This prevents a flash of the popover in the orginal position\n */\n setTimeout(() => {\n if (this.isActive) {\n this.isActiveDynamic = true;\n } else {\n this.isActiveDynamic = false;\n }\n }, 2);\n }\n\n /**\n * Handle Keydown\n * 1. If the panel is open and escape is keyed, close the popover panel and return focus to the trigger button\n * 2. If the panel is opened, tab away closes the popover panel\n * 3. The panel can be opened and closed by Enter or Space keys.\n */\n private _handleKeydown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._toggleActive();\n } else if (e.key === 'Tab') {\n this._handleTabNavigation(e);\n }\n }\n\n private _handleTabNavigation(e: KeyboardEvent) {\n if (this.isActive) {\n this._navigateInsidePopover(e);\n }\n }\n\n private _navigateInsidePopover(e: KeyboardEvent) {\n const focusableElements = this._getFocusableElements();\n if (focusableElements.length === 0) {\n this._closePopoverAndFocusTrigger(e);\n return;\n }\n\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (document.activeElement === lastFocusableElement) {\n this._closePopoverAndFocusTrigger(e);\n e.preventDefault();\n }\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const panelFocusableElements = Array.from(this._Cre8PopoverFooter);\n return [...panelFocusableElements];\n }\n\n private _closePopoverAndFocusTrigger(e: KeyboardEvent) {\n this._toggleActive();\n e.preventDefault();\n }\n\n /**\n * Handle click outside the component\n * 1. Close the show/hide popover panel on click outside\n * 2. If the popover panel is already closed then we don't care about outside clicks and we can bail early\n * 3. By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4. Check to see if we clicked inside the active panel\n * 5. If the panel is active and we've clicked outside of the panel then it should be closed.\n */\n handleOnClickOutside = (e: MouseEvent) => {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine panel context during click handler');\n }\n\n /* 4 */\n const didClickInside = e.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (!(e.target === document.querySelector('html') && e.clientX >= document.documentElement.offsetWidth)) {\n if (this.isActive && !didClickInside) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State on Scroll\n * 1. If a scroll event is fired and visibileOnScroll is not true, remove the active state\n * 2. If the popover height is less than the window height, then allow the active to remove on scroll\n */\n removeActiveOnScroll = () => {\n /* 1 */\n if (this.isActive && !this.isVisibleOnScroll) {\n /* 2 */\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n const popoverTrigger = this._Cre8Popover;\n const popoverHeight = popoverTrigger.clientHeight + popoverPanel.height + popoverPanel.top;\n\n if (popoverHeight < window.innerHeight) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State\n * 1. If a specific event is fired, remove the active state.\n */\n removeActive = () => {\n if (this.isActive) {\n this._toggleActive();\n }\n };\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-popover', {\n 'cre8-c-popover--top': this.position === 'top',\n 'cre8-c-popover--left': this.position === 'left',\n 'cre8-c-popover--right': this.position === 'right',\n 'cre8-is-active': this.isActive,\n 'cre8-is-dynamic': this.isDynamic,\n 'cre8-is-dynamic-active': this.isActiveDynamic,\n });\n\n return html`\n <div class=\"${componentClassNames}\">\n ${this.slotNotEmpty('trigger')\n && html` <slot name=\"trigger\" @keydown=${this._handleKeydown} @click=${this._toggleActive}></slot> `}\n ${this.isActive\n ? html`\n <div tabindex=\"0\" class=\"cre8-c-popover__panel\" @keydown=${this._handleKeydown}>\n ${(this.slotNotEmpty('header') || this.heading)\n && html`\n <div class=\"cre8-c-popover__header\">\n ${this.heading\n ? html`<div class=\"cre8-c-popover__heading\">${this.heading}</div>`\n : html`<slot name=\"header\"></slot>`}\n </div>\n `}\n <slot></slot>\n ${this.slotNotEmpty('footer')\n && html`\n <div class=\"cre8-c-popover__footer\">\n <slot name=\"footer\"></slot>\n </div>\n `}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-popover') === undefined) {\n customElements.define('cre8-popover', Cre8Popover);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-popover': Cre8Popover;\n }\n}\n\nexport default Cre8Popover;\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Cre8Element } from '../cre8-element';
|
|
2
2
|
/**
|
|
3
3
|
* @slot - The label for the navigation item
|
|
4
|
+
* @slot itemBefore - Content rendered before the item label, such as an icon
|
|
5
|
+
* @slot itemAfter - Content rendered after the item label, such as an icon
|
|
4
6
|
*/
|
|
5
7
|
export declare class Cre8PrimaryNavItem extends Cre8Element {
|
|
6
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primary-nav-item.d.ts","sourceRoot":"","sources":["../../../components/primary-nav-item/primary-nav-item.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG1C
|
|
1
|
+
{"version":3,"file":"primary-nav-item.d.ts","sourceRoot":"","sources":["../../../components/primary-nav-item/primary-nav-item.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG1C;;;;GAIG;AACP,qBAAa,kBAAmB,SAAQ,WAAW;IAC/C;;OAEG;IAEC,IAAI,SAAc;IAEtB;;OAEG;IAEC,IAAI,SAAO;IAEf;;OAEG;IAEC,QAAQ,CAAC,EAAE,MAAM,CAAgB;IAErC;;OAEG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,MAAM,4BAAY;IAEzB;;OAEG;;IAOH;;OAEG;IACH,iBAAiB;IAOjB;;;OAGG;IACH,oBAAoB;IAKpB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,gBAAgB;IAcxB,MAAM;CAyDT;AAMD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,uBAAuB,EAAE,kBAAkB,CAAC;KAC/C;CACJ;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -11,6 +11,8 @@ import { Cre8Element } from '../cre8-element';
|
|
|
11
11
|
import styles from './primary-nav-item.styles.js';
|
|
12
12
|
/**
|
|
13
13
|
* @slot - The label for the navigation item
|
|
14
|
+
* @slot itemBefore - Content rendered before the item label, such as an icon
|
|
15
|
+
* @slot itemAfter - Content rendered after the item label, such as an icon
|
|
14
16
|
*/
|
|
15
17
|
export class Cre8PrimaryNavItem extends Cre8Element {
|
|
16
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primary-nav-item.js","sourceRoot":"","sources":["../../../components/primary-nav-item/primary-nav-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAE9C;;GAEG;AACP,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IAiC/C;;OAEG;IACH;QACI,KAAK,EAAE,CAAC;QApCZ;;WAEG;QAEC,SAAI,GAAG,UAAU,CAAC;QAEtB;;WAEG;QAEC,SAAI,GAAG,GAAG,CAAC;QAEf;;WAEG;QAEC,aAAQ,GAAY,YAAY,CAAC;QAqBjC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACtC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,qBAAqB,EAAE,KAAK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CAAC,IAAI;0BACT,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,IAAI,CAAA;;;;yBAIvC;;;;SAIhB,CAAC;IACN,CAAC;;AA5JM,yBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AA1BrB;IADH,QAAQ,EAAE;gDACW;AAMlB;IADH,QAAQ,EAAE;gDACI;AAMX;IADH,QAAQ,EAAE;oDAC0B;AAMjC;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACpB;AAMnB;IADH,KAAK,EAAE;oDACe;AAiK3B,IAAI,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC5D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;AACvE,CAAC;AAQD,eAAe,kBAAkB,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { property, state } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport styles from './primary-nav-item.styles.js';\n\n /**\n * @slot - The label for the navigation item\n */\nexport class Cre8PrimaryNavItem extends Cre8Element {\n /**\n * Primary nav item text\n */\n @property()\n text = 'Nav item';\n\n /**\n * Primary nav item href\n */\n @property()\n href = '#';\n\n /**\n * Icon name\n */\n @property()\n iconName?: string = 'caret-down';\n\n /**\n * Append to the class name. Used for passing in utility classes\n */\n @property({ type: Boolean, reflect: true })\n megaMenu?: boolean;\n\n /**\n * Append to the class name. Used for passing in utility classes\n */\n @state()\n isActive?: boolean;\n\n static styles = [styles];\n\n /**\n * Initialize functions\n */\n constructor() {\n super();\n this._handleOnClickOutside = this._handleOnClickOutside.bind(this);\n this._clickHandler = this._clickHandler.bind(this);\n }\n\n /**\n * Connected Callback lifecycle\n */\n connectedCallback() {\n this.setAttribute('role', 'listitem');\n super.connectedCallback();\n\n document.addEventListener('mousedown', this._handleOnClickOutside, false);\n }\n\n /**\n * Disconnected callback lifecycle\n * 1) Remove window resize event listener\n */\n disconnectedCallback() {\n document.removeEventListener('mousedown', this._handleOnClickOutside, false);\n super.disconnectedCallback();\n }\n\n /**\n * Handle click outside the component\n * 1) Close the show hide panel on click outside\n * 2) If the nav is already closed then we don't care about outside clicks and we\n * can bail early\n * 3) By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4) Check to see if we clicked inside the active navigation item\n * 5) If the navigation is active and we've clicked outside of the nav then it should\n * be closed.\n */\n private _handleOnClickOutside(event: MouseEvent) {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine navigation context during click handler');\n }\n\n /* 4 */\n const didClickInside = event.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (this.isActive && !didClickInside) {\n this.isActive = false;\n }\n }\n\n /**\n * Toggle active state of primary nav item\n * 1) Remove isActive state from all sibling elements\n * 2) Toggle active state of element selected\n */\n private _clickHandler(e: MouseEvent) {\n e.preventDefault();\n if (this.parentNode) {\n const navItems = this.parentNode.querySelectorAll('cre8-primary-nav-item');\n navItems.forEach((element: Cre8PrimaryNavItem) => {\n if (element !== this) {\n element.isActive = false; /* 1 */\n }\n });\n }\n this.isActive = !this.isActive; /* 2 */\n }\n\n private _closePanel() {\n this.isActive = false;\n }\n\n private _handleOnKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._closePanel();\n const navLink = this.shadowRoot?.querySelector<HTMLButtonElement | HTMLAnchorElement>(\n '.cre8-c-primary-nav__link'\n );\n if (navLink) {\n setTimeout(() => {\n navLink.focus();\n }, 1);\n }\n }\n }\n\n render() {\n const componentClassName = this.componentClassNames('cre8-c-primary-nav__item', {\n 'cre8-is-active': this.isActive === true,\n 'cre8-c-primary-nav__item--megamenu': this.megaMenu === true,\n });\n\n if (this.megaMenu) {\n return html`\n <div class=\"${componentClassName}\" @keydown=${this._handleOnKeyDown}>\n <div class=\"cre8-c-primary-nav__item-content\">\n <button\n class=\"cre8-c-primary-nav__link\"\n @click=${this._clickHandler}\n aria-expanded=${this.isActive === true}\n >\n ${this.slotNotEmpty('itemBefore') && html`\n <div class=\"cre8-c-primary-nav__item-before\">\n <slot name=\"itemBefore\"></slot>\n </div>\n `}\n ${this.text}\n ${this.slotNotEmpty('itemAfter') && html`\n <div class=\"cre8-c-primary-nav__item-after\">\n <slot name=\"itemAfter\"></slot>\n </div>\n `}\n <cre8-icon-legacy aria-hidden=\"true\" name=\"${ifDefined(this.iconName)}\"></cre8-icon-legacy>\n </button>\n </div>\n <div class=\"cre8-c-primary-nav__item-panel\">\n <div class=\"cre8-c-primary-nav__item-panel-inner\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n return html`\n <div class=\"${componentClassName}\">\n <div class=\"cre8-c-primary-nav__item-content\">\n <a class=\"cre8-c-primary-nav__link\" href=\"${this.href}\">\n ${this.slotNotEmpty('itemBefore') && html`\n <div class=\"cre8-c-primary-nav__item-before\">\n <slot name=\"itemBefore\"></slot>\n </div>\n `}\n ${this.text}\n ${this.slotNotEmpty('itemAfter') && html`\n <div class=\"cre8-c-primary-nav__item-after\">\n <slot name=\"itemAfter\"></slot>\n </div>\n `}\n </a>\n </div>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-primary-nav-item') === undefined) {\n customElements.define('cre8-primary-nav-item', Cre8PrimaryNavItem);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-primary-nav-item': Cre8PrimaryNavItem;\n }\n}\n\nexport default Cre8PrimaryNavItem;\n"]}
|
|
1
|
+
{"version":3,"file":"primary-nav-item.js","sourceRoot":"","sources":["../../../components/primary-nav-item/primary-nav-item.ts"],"names":[],"mappings":";;;;;;AAAA,O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,KAAK,EAAE;oDACe;AAiK3B,IAAI,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC5D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;AACvE,CAAC;AAQD,eAAe,kBAAkB,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { property, state } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport styles from './primary-nav-item.styles.js';\n\n /**\n * @slot - The label for the navigation item\n * @slot itemBefore - Content rendered before the item label, such as an icon\n * @slot itemAfter - Content rendered after the item label, such as an icon\n */\nexport class Cre8PrimaryNavItem extends Cre8Element {\n /**\n * Primary nav item text\n */\n @property()\n text = 'Nav item';\n\n /**\n * Primary nav item href\n */\n @property()\n href = '#';\n\n /**\n * Icon name\n */\n @property()\n iconName?: string = 'caret-down';\n\n /**\n * Append to the class name. Used for passing in utility classes\n */\n @property({ type: Boolean, reflect: true })\n megaMenu?: boolean;\n\n /**\n * Append to the class name. Used for passing in utility classes\n */\n @state()\n isActive?: boolean;\n\n static styles = [styles];\n\n /**\n * Initialize functions\n */\n constructor() {\n super();\n this._handleOnClickOutside = this._handleOnClickOutside.bind(this);\n this._clickHandler = this._clickHandler.bind(this);\n }\n\n /**\n * Connected Callback lifecycle\n */\n connectedCallback() {\n this.setAttribute('role', 'listitem');\n super.connectedCallback();\n\n document.addEventListener('mousedown', this._handleOnClickOutside, false);\n }\n\n /**\n * Disconnected callback lifecycle\n * 1) Remove window resize event listener\n */\n disconnectedCallback() {\n document.removeEventListener('mousedown', this._handleOnClickOutside, false);\n super.disconnectedCallback();\n }\n\n /**\n * Handle click outside the component\n * 1) Close the show hide panel on click outside\n * 2) If the nav is already closed then we don't care about outside clicks and we\n * can bail early\n * 3) By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4) Check to see if we clicked inside the active navigation item\n * 5) If the navigation is active and we've clicked outside of the nav then it should\n * be closed.\n */\n private _handleOnClickOutside(event: MouseEvent) {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine navigation context during click handler');\n }\n\n /* 4 */\n const didClickInside = event.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (this.isActive && !didClickInside) {\n this.isActive = false;\n }\n }\n\n /**\n * Toggle active state of primary nav item\n * 1) Remove isActive state from all sibling elements\n * 2) Toggle active state of element selected\n */\n private _clickHandler(e: MouseEvent) {\n e.preventDefault();\n if (this.parentNode) {\n const navItems = this.parentNode.querySelectorAll('cre8-primary-nav-item');\n navItems.forEach((element: Cre8PrimaryNavItem) => {\n if (element !== this) {\n element.isActive = false; /* 1 */\n }\n });\n }\n this.isActive = !this.isActive; /* 2 */\n }\n\n private _closePanel() {\n this.isActive = false;\n }\n\n private _handleOnKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._closePanel();\n const navLink = this.shadowRoot?.querySelector<HTMLButtonElement | HTMLAnchorElement>(\n '.cre8-c-primary-nav__link'\n );\n if (navLink) {\n setTimeout(() => {\n navLink.focus();\n }, 1);\n }\n }\n }\n\n render() {\n const componentClassName = this.componentClassNames('cre8-c-primary-nav__item', {\n 'cre8-is-active': this.isActive === true,\n 'cre8-c-primary-nav__item--megamenu': this.megaMenu === true,\n });\n\n if (this.megaMenu) {\n return html`\n <div class=\"${componentClassName}\" @keydown=${this._handleOnKeyDown}>\n <div class=\"cre8-c-primary-nav__item-content\">\n <button\n class=\"cre8-c-primary-nav__link\"\n @click=${this._clickHandler}\n aria-expanded=${this.isActive === true}\n >\n ${this.slotNotEmpty('itemBefore') && html`\n <div class=\"cre8-c-primary-nav__item-before\">\n <slot name=\"itemBefore\"></slot>\n </div>\n `}\n ${this.text}\n ${this.slotNotEmpty('itemAfter') && html`\n <div class=\"cre8-c-primary-nav__item-after\">\n <slot name=\"itemAfter\"></slot>\n </div>\n `}\n <cre8-icon-legacy aria-hidden=\"true\" name=\"${ifDefined(this.iconName)}\"></cre8-icon-legacy>\n </button>\n </div>\n <div class=\"cre8-c-primary-nav__item-panel\">\n <div class=\"cre8-c-primary-nav__item-panel-inner\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n return html`\n <div class=\"${componentClassName}\">\n <div class=\"cre8-c-primary-nav__item-content\">\n <a class=\"cre8-c-primary-nav__link\" href=\"${this.href}\">\n ${this.slotNotEmpty('itemBefore') && html`\n <div class=\"cre8-c-primary-nav__item-before\">\n <slot name=\"itemBefore\"></slot>\n </div>\n `}\n ${this.text}\n ${this.slotNotEmpty('itemAfter') && html`\n <div class=\"cre8-c-primary-nav__item-after\">\n <slot name=\"itemAfter\"></slot>\n </div>\n `}\n </a>\n </div>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-primary-nav-item') === undefined) {\n customElements.define('cre8-primary-nav-item', Cre8PrimaryNavItem);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-primary-nav-item': Cre8PrimaryNavItem;\n }\n}\n\nexport default Cre8PrimaryNavItem;\n"]}
|
|
@@ -12,6 +12,8 @@ export declare enum Color {
|
|
|
12
12
|
/**
|
|
13
13
|
* Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).
|
|
14
14
|
* These tags always display a "Close" icon.
|
|
15
|
+
*
|
|
16
|
+
* @fires removeTagClicked - Fires when the remove tag is clicked.
|
|
15
17
|
*/
|
|
16
18
|
export declare class Cre8RemoveTag extends Cre8Element {
|
|
17
19
|
static styles: import("lit").CSSResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-tag.d.ts","sourceRoot":"","sources":["../../../components/remove-tag/remove-tag.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,cAAc,CAAC;AAGtB,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,oBAAY,KAAK;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,aAAa,mBAAmB;CACjC;AAED
|
|
1
|
+
{"version":3,"file":"remove-tag.d.ts","sourceRoot":"","sources":["../../../components/remove-tag/remove-tag.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,cAAc,CAAC;AAGtB,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,oBAAY,KAAK;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,aAAa,mBAAmB;CACjC;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC1C,MAAM,CAAC,MAAM,4BAAY;IAE3B;;OAEG;IAEC,IAAI,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IAEC,KAAK,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAiB;IAE/E;;;;;OAKG;IAEC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAe;IAEpD;;OAEG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAS/B,MAAM;CAyBP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -25,6 +25,8 @@ export var Color;
|
|
|
25
25
|
/**
|
|
26
26
|
* Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).
|
|
27
27
|
* These tags always display a "Close" icon.
|
|
28
|
+
*
|
|
29
|
+
* @fires removeTagClicked - Fires when the remove tag is clicked.
|
|
28
30
|
*/
|
|
29
31
|
export class Cre8RemoveTag extends Cre8Element {
|
|
30
32
|
constructor() {
|
|
@@ -75,7 +77,7 @@ export class Cre8RemoveTag extends Cre8Element {
|
|
|
75
77
|
width="16"
|
|
76
78
|
height="16"
|
|
77
79
|
svg="${svgClose}"
|
|
78
|
-
aria-
|
|
80
|
+
aria-hidden="true"
|
|
79
81
|
></cre8-icon>
|
|
80
82
|
</div>
|
|
81
83
|
</button>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-tag.js","sourceRoot":"","sources":["../../../components/remove-tag/remove-tag.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,0BAAiB,CAAA;AACnB,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAED,MAAM,CAAN,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,4BAAmB,CAAA;IACnB,4BAAmB,CAAA;IACnB,yCAAgC,CAAA;AAClC,CAAC,EAJW,KAAK,KAAL,KAAK,QAIhB;AAED
|
|
1
|
+
{"version":3,"file":"remove-tag.js","sourceRoot":"","sources":["../../../components/remove-tag/remove-tag.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,M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SACvD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;eACF,kBAAkB;gBACjB,IAAI,CAAC,uBAAuB;kBAC1B,IAAI,CAAC,QAAQ;;cAEjB,IAAI,CAAC,IAAI;;;;;iBAKN,QAAQ;;;;cAIX,CAAC;IACb,CAAC;;AArEQ,oBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAMvB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACT;AAUd;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACoD;AAS3E;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACyB;AAMhD;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACL;AAyCzB,IAAI,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAC5D,CAAC;AAQD,eAAe,aAAa,CAAC","sourcesContent":["import classnames from 'classnames';\nimport { html, } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport svgClose from '@tmorrow/cre8-wc/icons/Close.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport '../icon/icon';\nimport styles from './remove-tag.styles.js';\n\nexport enum Shape {\n Round = 'round',\n Square = 'square',\n}\n\nexport enum Color {\n Neutral = 'neutral',\n Branded = 'branded',\n NeutralHybrid = 'neutral-hybrid',\n}\n\n/**\n * Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).\n * These tags always display a \"Close\" icon.\n *\n * @fires removeTagClicked - Fires when the remove tag is clicked.\n */\nexport class Cre8RemoveTag extends Cre8Element {\n static styles = [styles];\n\n /**\n * The tag text\n */\n @property({ type: String })\n text?: string;\n\n /**\n * The tag color scheme\n *\n * - **neutral** should be used when doing non-link actions such as filters or multi-select, within forms, etc.\n * - **neutral-hybrid** should be used for when tags are doing an action like a button or a link\n * - **branded** should be used like Neutral, but for marketing / actionable items\n */\n @property({ type: String })\n color: Color.Neutral | Color.Branded | Color.NeutralHybrid = Color.Neutral;\n\n /**\n * The tag shape\n *\n * - **round** will give the tag a rounded border\n * - **square** will give the tag a squared border\n */\n @property({ type: String })\n shape: Shape.Round | Shape.Square = Shape.Round;\n\n /**\n * Disabled state for remove tag\n */\n @property({ type: Boolean })\n disabled?: boolean;\n\n /**\n * Dispatches an event when the tag is clicked\n */\n private _handleRemoveTagClicked() {\n const customEvent = new CustomEvent('removeTagClicked', {\n detail: { message: 'Remove Tag clicked.' },\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(customEvent);\n }\n\n render() {\n const componentClassName = classnames('cre8-c-remove-tag', {\n 'cre8-c-remove-tag--neutral': this.color === 'neutral',\n 'cre8-c-remove-tag--branded': this.color === 'branded',\n 'cre8-c-remove-tag--neutral-hybrid': this.color === 'neutral-hybrid',\n 'cre8-c-remove-tag--round': this.shape === 'round',\n 'cre8-c-remove-tag--square': this.shape === 'square',\n });\n\n return html` <button\n class=\"${componentClassName}\"\n @click=\"${this._handleRemoveTagClicked}\"\n ?disabled=${this.disabled}\n >\n <span>${this.text}</span>\n <div class=\"cre8-c-remove-tag-item__icon\">\n <cre8-icon\n width=\"16\"\n height=\"16\"\n svg=\"${svgClose}\"\n aria-hidden=\"true\"\n ></cre8-icon>\n </div>\n </button>`;\n }\n}\n\nif (customElements.get('cre8-remove-tag') === undefined) {\n customElements.define('cre8-remove-tag', Cre8RemoveTag);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-remove-tag': Cre8RemoveTag;\n }\n}\n\nexport default Cre8RemoveTag;\n"]}
|
|
@@ -15,6 +15,7 @@ import { Cre8Element } from '../cre8-element';
|
|
|
15
15
|
*
|
|
16
16
|
* @slot The content of the section should go here.
|
|
17
17
|
* It could be a cre8-text-passage, a cre8-card or any other block level html.
|
|
18
|
+
* @slot header - Custom header content, rendered in place of the `headline` property
|
|
18
19
|
*/
|
|
19
20
|
export declare class Cre8Section extends Cre8Element {
|
|
20
21
|
static styles: import("lit").CSSResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../../components/section/section.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../../components/section/section.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AAEH,qBAAa,WAAY,SAAQ,WAAW;IACxC,MAAM,CAAC,MAAM,4BAAY;IAE3B;;OAEG;IAGC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEtB,MAAM;CAmBP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -24,6 +24,7 @@ import styles from './section.styles.js';
|
|
|
24
24
|
*
|
|
25
25
|
* @slot The content of the section should go here.
|
|
26
26
|
* It could be a cre8-text-passage, a cre8-card or any other block level html.
|
|
27
|
+
* @slot header - Custom header content, rendered in place of the `headline` property
|
|
27
28
|
*/
|
|
28
29
|
export class Cre8Section extends Cre8Element {
|
|
29
30
|
render() {
|