@xplortech/apollo-core 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/style.css +39 -87
- package/dist/apollo-core/apollo-core.css +10 -5508
- package/dist/apollo-core/apollo-core.esm.js +1 -125
- package/dist/apollo-core/index.esm.js +0 -1
- package/dist/apollo-core/p-0203d4e8.entry.js +1 -0
- package/dist/apollo-core/p-0b2c612e.entry.js +1 -0
- package/dist/apollo-core/p-128a0240.entry.js +1 -0
- package/dist/apollo-core/p-2336aa4c.entry.js +1 -0
- package/dist/apollo-core/p-2f90296c.js +10 -0
- package/dist/apollo-core/p-30003b15.entry.js +1 -0
- package/dist/apollo-core/p-4e56a2ca.entry.js +1 -0
- package/dist/apollo-core/p-5854d1e4.entry.js +1 -0
- package/dist/apollo-core/p-611536d8.entry.js +1 -0
- package/dist/apollo-core/p-8b6633c7.js +1 -0
- package/dist/apollo-core/p-97cd1f73.entry.js +1 -0
- package/dist/apollo-core/p-9c5ca308.entry.js +1 -0
- package/dist/apollo-core/p-ad90fe4d.js +1 -0
- package/dist/apollo-core/p-bd4a7e3c.entry.js +1 -0
- package/dist/apollo-core/p-dab8e7a1.entry.js +1 -0
- package/dist/apollo-core/p-eb63b401.entry.js +1 -0
- package/dist/apollo-core/p-ee2f4422.entry.js +1 -0
- package/dist/apollo-core/p-f167aa05.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +19 -0
- package/dist/cjs/index-944adb2e.js +1609 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/{apollo-core/regular-133c23b5.js → cjs/regular-872f5226.js} +3 -12
- package/dist/cjs/v4-14140ff3.js +77 -0
- package/dist/cjs/xpl-application-shell_11.cjs.entry.js +232 -0
- package/dist/cjs/xpl-badge.cjs.entry.js +21 -0
- package/dist/cjs/xpl-button-row.cjs.entry.js +24 -0
- package/dist/cjs/xpl-checkbox_2.cjs.entry.js +51 -0
- package/dist/cjs/xpl-choicelist.cjs.entry.js +36 -0
- package/dist/cjs/xpl-divider.cjs.entry.js +18 -0
- package/dist/cjs/xpl-grid-item.cjs.entry.js +25 -0
- package/dist/cjs/xpl-grid.cjs.entry.js +35 -0
- package/dist/cjs/xpl-input.cjs.entry.js +2527 -0
- package/dist/cjs/xpl-list.cjs.entry.js +63 -0
- package/dist/cjs/xpl-pagination.cjs.entry.js +76 -0
- package/dist/cjs/xpl-select.cjs.entry.js +623 -0
- package/dist/cjs/xpl-table.cjs.entry.js +89 -0
- package/dist/cjs/xpl-tag.cjs.entry.js +21 -0
- package/dist/cjs/xpl-toggle.cjs.entry.js +34 -0
- package/dist/collection/collection-manifest.json +37 -0
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +145 -0
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +158 -0
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +41 -0
- package/dist/collection/components/xpl-badge/xpl-badge.js +50 -0
- package/dist/{apollo-core/xpl-breadcrumb-item.entry.js → collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js} +12 -9
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +15 -0
- package/dist/collection/components/xpl-button/xpl-button.js +214 -0
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +119 -0
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +185 -0
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +143 -0
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +39 -0
- package/dist/collection/components/xpl-divider/xpl-divider.js +30 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +32 -0
- package/dist/collection/components/xpl-grid/xpl-grid.js +26 -0
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +93 -0
- package/dist/collection/components/xpl-input/xpl-input.js +471 -0
- package/dist/collection/components/xpl-list/xpl-list.js +93 -0
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +72 -0
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +10 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +189 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js +168 -0
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +9 -0
- package/dist/collection/components/xpl-select/xpl-select.js +311 -0
- package/dist/collection/components/xpl-table/xpl-table.js +194 -0
- package/dist/collection/components/xpl-tag/xpl-tag.js +30 -0
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +157 -0
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +70 -0
- package/dist/custom-elements/index.js +19961 -0
- package/dist/esm/apollo-core.js +17 -0
- package/dist/esm/index-899dba3b.js +1580 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/regular-86225e9d.js +16041 -0
- package/dist/esm/v4-929670b7.js +75 -0
- package/dist/esm/xpl-application-shell_11.entry.js +218 -0
- package/dist/{apollo-core → esm}/xpl-badge.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-button-row.entry.js +1 -1
- package/dist/esm/xpl-checkbox_2.entry.js +46 -0
- package/dist/{apollo-core → esm}/xpl-choicelist.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-divider.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-grid-item.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-grid.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-input.entry.js +3 -20
- package/dist/{apollo-core → esm}/xpl-list.entry.js +2 -2
- package/dist/{apollo-core → esm}/xpl-pagination.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-select.entry.js +2 -43
- package/dist/{apollo-core → esm}/xpl-table.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-tag.entry.js +1 -1
- package/dist/{apollo-core → esm}/xpl-toggle.entry.js +2 -2
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stories/application-shell.stories.js +766 -0
- package/dist/stories/avatar.stories.js +173 -0
- package/dist/stories/backdrop.stories.js +18 -0
- package/dist/stories/badge.stories.js +48 -0
- package/dist/stories/breadcrumbs.stories.js +115 -0
- package/dist/stories/button-row.stories.js +64 -0
- package/dist/stories/button.stories.js +98 -0
- package/dist/stories/checkbox.stories.js +76 -0
- package/dist/stories/choicelist.stories.js +112 -0
- package/dist/stories/content-area.stories.js +53 -0
- package/dist/stories/divider.stories.js +34 -0
- package/dist/stories/grid.stories.js +100 -0
- package/dist/stories/input.stories.js +252 -0
- package/dist/stories/list.stories.js +134 -0
- package/dist/stories/main-nav.stories.js +308 -0
- package/dist/stories/pagination.stories.js +84 -0
- package/dist/stories/radio.stories.js +66 -0
- package/dist/stories/secondary-nav.stories.js +76 -0
- package/dist/stories/select.stories.js +111 -0
- package/dist/stories/table.stories.js +107 -0
- package/dist/stories/tabs.stories.js +24 -0
- package/dist/stories/toggle.stories.js +80 -0
- package/dist/stories/utility-bar.stories.js +94 -0
- package/package.json +1 -1
- package/dist/apollo-core/app-globals-0f993ce5.js +0 -3
- package/dist/apollo-core/css-shim-bbdf0cc6.js +0 -4
- package/dist/apollo-core/dom-1f98a75f.js +0 -73
- package/dist/apollo-core/index-3c9f25ef.js +0 -2938
- package/dist/apollo-core/index-3eb5568f.js +0 -2938
- package/dist/apollo-core/index-912d1a21.js +0 -584
- package/dist/apollo-core/shadow-css-67b66845.js +0 -389
- package/dist/apollo-core/xpl-application-shell.entry.js +0 -52
- package/dist/apollo-core/xpl-avatar.entry.js +0 -19
- package/dist/apollo-core/xpl-backdrop.entry.js +0 -21
- package/dist/apollo-core/xpl-breadcrumbs.entry.js +0 -14
- package/dist/apollo-core/xpl-button.entry.js +0 -34
- package/dist/apollo-core/xpl-checkbox.entry.js +0 -25
- package/dist/apollo-core/xpl-content-area.entry.js +0 -16
- package/dist/apollo-core/xpl-main-nav.entry.js +0 -26
- package/dist/apollo-core/xpl-nav-item.entry.js +0 -12
- package/dist/apollo-core/xpl-radio.entry.js +0 -25
- package/dist/apollo-core/xpl-secondary-nav.entry.js +0 -12
- package/dist/apollo-core/xpl-utility-bar.entry.js +0 -25
- package/dist/types/components/xpl-application-shell/test/xpl-application-shell.e2e.d.ts +0 -1
- package/dist/types/components/xpl-avatar/test/xpl-avatar.e2e.d.ts +0 -1
- package/dist/types/components/xpl-avatar/test/xpl-avatar.spec.d.ts +0 -1
- package/dist/types/components/xpl-backdrop/test/xpl-backdrop.e2e.d.ts +0 -1
- package/dist/types/components/xpl-badge/test/xpl-badge.e2e.d.ts +0 -1
- package/dist/types/components/xpl-badge/test/xpl-badge.spec.d.ts +0 -1
- package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumb-item/test/xpl-breadcrumb-item.e2e.d.ts +0 -1
- package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumbs/test/xpl-breadcrumbs.e2e.d.ts +0 -1
- package/dist/types/components/xpl-button/test/xpl-button.e2e.d.ts +0 -1
- package/dist/types/components/xpl-button/test/xpl-button.spec.d.ts +0 -1
- package/dist/types/components/xpl-button-row/test/xpl-button-row.e2e.d.ts +0 -1
- package/dist/types/components/xpl-button-row/test/xpl-button-row.spec.d.ts +0 -1
- package/dist/types/components/xpl-checkbox/test/xpl-checkbox.e2e.d.ts +0 -1
- package/dist/types/components/xpl-checkbox/test/xpl-checkbox.spec.d.ts +0 -1
- package/dist/types/components/xpl-choicelist/test/xpl-choicelist.e2e.d.ts +0 -1
- package/dist/types/components/xpl-choicelist/test/xpl-choicelist.spec.d.ts +0 -1
- package/dist/types/components/xpl-content-area/test/xpl-content-area.e2e.d.ts +0 -1
- package/dist/types/components/xpl-divider/test/xpl-divider.e2e.d.ts +0 -1
- package/dist/types/components/xpl-divider/test/xpl-divider.spec.d.ts +0 -1
- package/dist/types/components/xpl-grid/test/xpl-grid.e2e.d.ts +0 -1
- package/dist/types/components/xpl-grid/test/xpl-grid.spec.d.ts +0 -1
- package/dist/types/components/xpl-grid-item/test/xpl-grid-item.e2e.d.ts +0 -1
- package/dist/types/components/xpl-grid-item/test/xpl-grid-item.spec.d.ts +0 -1
- package/dist/types/components/xpl-input/test/xpl-input.e2e.d.ts +0 -1
- package/dist/types/components/xpl-input/test/xpl-input.spec.d.ts +0 -1
- package/dist/types/components/xpl-list/test/xpl-list.e2e.d.ts +0 -1
- package/dist/types/components/xpl-list/test/xpl-list.spec.d.ts +0 -1
- package/dist/types/components/xpl-main-nav/test/xpl-main-nav.e2e.d.ts +0 -1
- package/dist/types/components/xpl-nav-item/test/xpl-nav-item.e2e.d.ts +0 -1
- package/dist/types/components/xpl-pagination/test/xpl-pagination.e2e.d.ts +0 -1
- package/dist/types/components/xpl-pagination/test/xpl-pagination.spec.d.ts +0 -1
- package/dist/types/components/xpl-radio/test/xpl-radio.e2e.d.ts +0 -1
- package/dist/types/components/xpl-radio/test/xpl-radio.spec.d.ts +0 -1
- package/dist/types/components/xpl-secondary-nav/test/secondary-nav.e2e.d.ts +0 -1
- package/dist/types/components/xpl-select/test/xpl-select.e2e.d.ts +0 -1
- package/dist/types/components/xpl-select/test/xpl-select.spec.d.ts +0 -1
- package/dist/types/components/xpl-table/test/xpl-table.e2e.d.ts +0 -1
- package/dist/types/components/xpl-table/test/xpl-table.spec.d.ts +0 -1
- package/dist/types/components/xpl-tag/test/xpl-tag.e2e.d.ts +0 -1
- package/dist/types/components/xpl-tag/test/xpl-tag.spec.d.ts +0 -1
- package/dist/types/components/xpl-toggle/test/xpl-toggle.e2e.d.ts +0 -1
- package/dist/types/components/xpl-toggle/test/xpl-toggle.spec.d.ts +0 -1
- package/dist/types/components/xpl-utility-bar/test/xpl-utility-bar.e2e.d.ts +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/// <reference path="./listitem.d.ts"></reference>
|
|
2
|
+
import { Component, Host, h, Prop, Fragment } from "@stencil/core";
|
|
3
|
+
import "../../../font-awesome/fontawesome";
|
|
4
|
+
import "../../../font-awesome/regular";
|
|
5
|
+
const ListItemCpt = ({ avatar, avatars, badges, href, title, subtext, metadata }) => {
|
|
6
|
+
const hasRight = avatars || badges || subtext;
|
|
7
|
+
const inner = (h(Fragment, null,
|
|
8
|
+
avatar && (avatar.slice(0, 1) === "/" || avatar.slice(0, 4) === "http" ?
|
|
9
|
+
h("xpl-avatar", { src: avatar, name: title }) :
|
|
10
|
+
h("xpl-avatar", { name: title }, avatar)),
|
|
11
|
+
h("div", { class: "xpl-list-item-content" },
|
|
12
|
+
h("div", { class: "xpl-list-left" },
|
|
13
|
+
h("div", null,
|
|
14
|
+
h("h4", null, title),
|
|
15
|
+
metadata && (h("ul", { class: "xpl-list-item-metadata" }, metadata.map(d => {
|
|
16
|
+
if (typeof d === "string") {
|
|
17
|
+
return h("li", null, d);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return h("li", null,
|
|
21
|
+
h("span", { class: `far fa-${d.icon}` }),
|
|
22
|
+
" ",
|
|
23
|
+
d.text);
|
|
24
|
+
}
|
|
25
|
+
}))))),
|
|
26
|
+
hasRight && (h("div", { class: "xpl-list-right" },
|
|
27
|
+
subtext && h("div", { class: "xpl-list-item-subtext" }, subtext),
|
|
28
|
+
avatars && (h("div", { class: "xpl-avatar-group xpl-avatar-group--s" }, avatars.map(a => h("img", { src: a, alt: "" })))),
|
|
29
|
+
badges && badges.map(b => {
|
|
30
|
+
if (typeof b === "string") {
|
|
31
|
+
return h("xpl-badge", null, b);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return h("xpl-badge", { dot: b.dot, variant: b.variant }, b.text);
|
|
35
|
+
}
|
|
36
|
+
}))))));
|
|
37
|
+
return href ?
|
|
38
|
+
h("a", { class: "xpl-list-item", href: href }, inner) :
|
|
39
|
+
h("div", { class: "xpl-list-item" }, inner);
|
|
40
|
+
};
|
|
41
|
+
export class XplList {
|
|
42
|
+
constructor() {
|
|
43
|
+
/**
|
|
44
|
+
* `items` should be an array of objects with the following signature:
|
|
45
|
+
* {
|
|
46
|
+
* avatar?: string; // The URL of the avatar, or the placeholder initials (ex. "SPD").
|
|
47
|
+
* avatars?: string[]; // The URLs of multiple avatars to be displayed in a group on the right.
|
|
48
|
+
* badges?: string[] | { // An array of strings or badge-like objects to be displayed as badges
|
|
49
|
+
* dot?: boolean; // in a group on the right. See <xpl-badge> for more details.
|
|
50
|
+
* text: string;
|
|
51
|
+
* variant?: string;
|
|
52
|
+
* }[];
|
|
53
|
+
* href?: string; // A URL, if this list item is meant to link somewhere.
|
|
54
|
+
* title: string; // The text to be displayed for the list item.
|
|
55
|
+
* metadata?: string[] | { // An array of strings or strings with icons (reference the allowed
|
|
56
|
+
* icon: string; // Font Awesome icons) to be displayed as metadata below the title.
|
|
57
|
+
* text: string;
|
|
58
|
+
* }[];
|
|
59
|
+
* subtext?: string; // Subtext to be displayed on the right.
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* - Note that you should *only use one of* `avatars`, `badges`, or `subtext`, to avoid cluttering
|
|
63
|
+
* the right-hand side of the list item.
|
|
64
|
+
*/
|
|
65
|
+
this.items = [];
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return (h(Host, null, this.items.map(item => h(ListItemCpt, Object.assign({}, item)))));
|
|
69
|
+
}
|
|
70
|
+
static get is() { return "xpl-list"; }
|
|
71
|
+
static get properties() { return {
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "unknown",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "ListItem[]",
|
|
77
|
+
"resolved": "ListItem[]",
|
|
78
|
+
"references": {
|
|
79
|
+
"ListItem": {
|
|
80
|
+
"location": "global"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": true,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "`items` should be an array of objects with the following signature:\n{\n avatar?: string; // The URL of the avatar, or the placeholder initials (ex. \"SPD\").\n avatars?: string[]; // The URLs of multiple avatars to be displayed in a group on the right.\n badges?: string[] | { // An array of strings or badge-like objects to be displayed as badges\n dot?: boolean; // in a group on the right. See <xpl-badge> for more details.\n text: string;\n variant?: string;\n }[];\n href?: string; // A URL, if this list item is meant to link somewhere.\n title: string; // The text to be displayed for the list item.\n metadata?: string[] | { // An array of strings or strings with icons (reference the allowed\n icon: string; // Font Awesome icons) to be displayed as metadata below the title.\n text: string;\n }[];\n subtext?: string; // Subtext to be displayed on the right.\n}\n\n- Note that you should *only use one of* `avatars`, `badges`, or `subtext`, to avoid cluttering\n the right-hand side of the list item."
|
|
89
|
+
},
|
|
90
|
+
"defaultValue": "[]"
|
|
91
|
+
}
|
|
92
|
+
}; }
|
|
93
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Component, Host, h, Prop, Event } from '@stencil/core';
|
|
2
|
+
export class XplMainNav {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* @property {string} width - The width of the Main Nav.
|
|
6
|
+
*/
|
|
7
|
+
this.width = "default";
|
|
8
|
+
}
|
|
9
|
+
navWidthHandler() {
|
|
10
|
+
this.navWidth.emit(this.width);
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this.navWidthHandler();
|
|
14
|
+
}
|
|
15
|
+
componentDidUpdate() {
|
|
16
|
+
this.navWidthHandler();
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (h(Host, { class: `xpl-main-nav xpl-main-nav--${this.width}`, "aria-label": "Sidebar" },
|
|
20
|
+
h("nav", null,
|
|
21
|
+
h("header", { "aria-label": "Sidebar Header" },
|
|
22
|
+
h("slot", { name: "logo" }),
|
|
23
|
+
h("slot", { name: "brand-name" })),
|
|
24
|
+
h("div", { class: "xpl-main-nav__main_section" },
|
|
25
|
+
h("slot", { name: "navigation" })),
|
|
26
|
+
h("footer", { class: "xpl-main-nav__footer", "aria-label": "Sidebar Footer" },
|
|
27
|
+
h("slot", { name: "footer" })))));
|
|
28
|
+
}
|
|
29
|
+
static get is() { return "xpl-main-nav"; }
|
|
30
|
+
static get properties() { return {
|
|
31
|
+
"width": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"mutable": false,
|
|
34
|
+
"complexType": {
|
|
35
|
+
"original": "\"default\" | \"md\" | \"sm\"",
|
|
36
|
+
"resolved": "\"default\" | \"md\" | \"sm\"",
|
|
37
|
+
"references": {}
|
|
38
|
+
},
|
|
39
|
+
"required": false,
|
|
40
|
+
"optional": false,
|
|
41
|
+
"docs": {
|
|
42
|
+
"tags": [{
|
|
43
|
+
"text": "{string} width - The width of the Main Nav.",
|
|
44
|
+
"name": "property"
|
|
45
|
+
}],
|
|
46
|
+
"text": ""
|
|
47
|
+
},
|
|
48
|
+
"attribute": "width",
|
|
49
|
+
"reflect": false,
|
|
50
|
+
"defaultValue": "\"default\""
|
|
51
|
+
}
|
|
52
|
+
}; }
|
|
53
|
+
static get events() { return [{
|
|
54
|
+
"method": "navWidth",
|
|
55
|
+
"name": "navWidth",
|
|
56
|
+
"bubbles": true,
|
|
57
|
+
"cancelable": true,
|
|
58
|
+
"composed": true,
|
|
59
|
+
"docs": {
|
|
60
|
+
"tags": [{
|
|
61
|
+
"text": "{string} navWidth - Emits the `nav-width` prop set by the user\nwhen the component is attached to the DOM and when the component is updated.",
|
|
62
|
+
"name": "event"
|
|
63
|
+
}],
|
|
64
|
+
"text": ""
|
|
65
|
+
},
|
|
66
|
+
"complexType": {
|
|
67
|
+
"original": "string",
|
|
68
|
+
"resolved": "string",
|
|
69
|
+
"references": {}
|
|
70
|
+
}
|
|
71
|
+
}]; }
|
|
72
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component, Host, h } from '@stencil/core';
|
|
2
|
+
export class XplNavItem {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { class: "xpl-nav-item", role: "listitem" },
|
|
5
|
+
h("slot", { name: "link" },
|
|
6
|
+
h("slot", { name: "icon" }),
|
|
7
|
+
h("slot", null))));
|
|
8
|
+
}
|
|
9
|
+
static get is() { return "xpl-nav-item"; }
|
|
10
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Component, Host, h, Event, Prop, State, Method, } from "@stencil/core";
|
|
2
|
+
export class XplPagination {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.current = 1;
|
|
5
|
+
/**
|
|
6
|
+
* Private `_goto` method respects the `waitForCallback` prop --
|
|
7
|
+
* it will always emit the `page` event, but won't actually update
|
|
8
|
+
* the state of what the current page is, leaving that to the caller
|
|
9
|
+
* to update once (presumably) some other data has loaded.
|
|
10
|
+
*/
|
|
11
|
+
this._goto = (n) => {
|
|
12
|
+
this.page.emit(n);
|
|
13
|
+
if (!this.waitForCallback) {
|
|
14
|
+
this.current = n;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
this.goPrev = () => {
|
|
18
|
+
if (this.current > 1)
|
|
19
|
+
this._goto(this.current - 1);
|
|
20
|
+
};
|
|
21
|
+
this.goNext = () => {
|
|
22
|
+
const numPages = Math.ceil(this.total / this.perPage);
|
|
23
|
+
if (this.current < numPages)
|
|
24
|
+
this._goto(this.current + 1);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Calling `goto` with a page number (which should probably be
|
|
29
|
+
* taken from the `page` event) updates the pagination's state
|
|
30
|
+
* and re-renders it, showing the appropriate buttons given the current page.
|
|
31
|
+
* @param n
|
|
32
|
+
*/
|
|
33
|
+
async goto(n) {
|
|
34
|
+
this.current = n;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const numPages = Math.ceil(this.total / this.perPage);
|
|
38
|
+
let showing = [1];
|
|
39
|
+
if (numPages < 7)
|
|
40
|
+
showing = [1, 2, 3, 4, 5, 6];
|
|
41
|
+
if (this.current <= 3 || this.current >= numPages - 2) {
|
|
42
|
+
showing = [1, 2, 3, "...", numPages - 2, numPages - 1, numPages];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
showing = [
|
|
46
|
+
1,
|
|
47
|
+
"...",
|
|
48
|
+
this.current - 1,
|
|
49
|
+
this.current,
|
|
50
|
+
this.current + 1,
|
|
51
|
+
"...",
|
|
52
|
+
numPages,
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
const showingFirst = (this.current - 1) * this.perPage + 1;
|
|
56
|
+
const showingLast = Math.min(showingFirst + this.perPage - 1, this.total);
|
|
57
|
+
return (h(Host, null,
|
|
58
|
+
h("div", { class: "xpl-pagination" },
|
|
59
|
+
h("div", null,
|
|
60
|
+
h("p", null,
|
|
61
|
+
"Showing ",
|
|
62
|
+
h("span", null, showingFirst),
|
|
63
|
+
" to ",
|
|
64
|
+
h("span", null, showingLast),
|
|
65
|
+
" ",
|
|
66
|
+
"of ",
|
|
67
|
+
h("span", null, this.total),
|
|
68
|
+
" results")),
|
|
69
|
+
h("div", null,
|
|
70
|
+
h("nav", { "aria-label": "Pagination" },
|
|
71
|
+
h("button", { onClick: this.goPrev, class: "xpl-pagination-prev" },
|
|
72
|
+
h("span", null, "Previous"),
|
|
73
|
+
h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" },
|
|
74
|
+
h("path", { "fill-rule": "evenodd", d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", "clip-rule": "evenodd" }))),
|
|
75
|
+
showing.map((n) => {
|
|
76
|
+
if (n === "...") {
|
|
77
|
+
return h("span", { class: "xpl-pagination-ellipsis" }, "...");
|
|
78
|
+
}
|
|
79
|
+
if (n === this.current) {
|
|
80
|
+
return (h("button", { "aria-current": "page", class: "xpl-pagination-current" }, n));
|
|
81
|
+
}
|
|
82
|
+
return h("button", { onClick: () => this._goto(n) }, n);
|
|
83
|
+
}),
|
|
84
|
+
h("button", { onClick: this.goNext, class: "xpl-pagination-next" },
|
|
85
|
+
h("span", null, "Next"),
|
|
86
|
+
h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" },
|
|
87
|
+
h("path", { "fill-rule": "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "clip-rule": "evenodd" }))))))));
|
|
88
|
+
}
|
|
89
|
+
static get is() { return "xpl-pagination"; }
|
|
90
|
+
static get properties() { return {
|
|
91
|
+
"total": {
|
|
92
|
+
"type": "number",
|
|
93
|
+
"mutable": false,
|
|
94
|
+
"complexType": {
|
|
95
|
+
"original": "number",
|
|
96
|
+
"resolved": "number",
|
|
97
|
+
"references": {}
|
|
98
|
+
},
|
|
99
|
+
"required": false,
|
|
100
|
+
"optional": false,
|
|
101
|
+
"docs": {
|
|
102
|
+
"tags": [],
|
|
103
|
+
"text": ""
|
|
104
|
+
},
|
|
105
|
+
"attribute": "total",
|
|
106
|
+
"reflect": false
|
|
107
|
+
},
|
|
108
|
+
"perPage": {
|
|
109
|
+
"type": "number",
|
|
110
|
+
"mutable": false,
|
|
111
|
+
"complexType": {
|
|
112
|
+
"original": "number",
|
|
113
|
+
"resolved": "number",
|
|
114
|
+
"references": {}
|
|
115
|
+
},
|
|
116
|
+
"required": false,
|
|
117
|
+
"optional": false,
|
|
118
|
+
"docs": {
|
|
119
|
+
"tags": [],
|
|
120
|
+
"text": ""
|
|
121
|
+
},
|
|
122
|
+
"attribute": "per-page",
|
|
123
|
+
"reflect": false
|
|
124
|
+
},
|
|
125
|
+
"waitForCallback": {
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "boolean",
|
|
130
|
+
"resolved": "boolean",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"attribute": "wait-for-callback",
|
|
140
|
+
"reflect": false
|
|
141
|
+
}
|
|
142
|
+
}; }
|
|
143
|
+
static get states() { return {
|
|
144
|
+
"current": {}
|
|
145
|
+
}; }
|
|
146
|
+
static get events() { return [{
|
|
147
|
+
"method": "page",
|
|
148
|
+
"name": "page",
|
|
149
|
+
"bubbles": true,
|
|
150
|
+
"cancelable": true,
|
|
151
|
+
"composed": true,
|
|
152
|
+
"docs": {
|
|
153
|
+
"tags": [],
|
|
154
|
+
"text": ""
|
|
155
|
+
},
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "any",
|
|
158
|
+
"resolved": "any",
|
|
159
|
+
"references": {}
|
|
160
|
+
}
|
|
161
|
+
}]; }
|
|
162
|
+
static get methods() { return {
|
|
163
|
+
"goto": {
|
|
164
|
+
"complexType": {
|
|
165
|
+
"signature": "(n: number) => Promise<void>",
|
|
166
|
+
"parameters": [{
|
|
167
|
+
"tags": [{
|
|
168
|
+
"text": "n",
|
|
169
|
+
"name": "param"
|
|
170
|
+
}],
|
|
171
|
+
"text": ""
|
|
172
|
+
}],
|
|
173
|
+
"references": {
|
|
174
|
+
"Promise": {
|
|
175
|
+
"location": "global"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"return": "Promise<void>"
|
|
179
|
+
},
|
|
180
|
+
"docs": {
|
|
181
|
+
"text": "Calling `goto` with a page number (which should probably be\ntaken from the `page` event) updates the pagination's state\nand re-renders it, showing the appropriate buttons given the current page.",
|
|
182
|
+
"tags": [{
|
|
183
|
+
"name": "param",
|
|
184
|
+
"text": "n"
|
|
185
|
+
}]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}; }
|
|
189
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Component, Host, h, Prop, State, Event } from "@stencil/core";
|
|
2
|
+
import { v4 as uuid } from "uuid";
|
|
3
|
+
export class XplRadio {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.id = uuid();
|
|
6
|
+
}
|
|
7
|
+
render() {
|
|
8
|
+
return (h(Host, { class: {
|
|
9
|
+
"xpl-checkbox-radio-container": true,
|
|
10
|
+
"styled": this.styled,
|
|
11
|
+
"disabled": this.disabled,
|
|
12
|
+
} },
|
|
13
|
+
h("input", { class: "xpl-radio", type: "radio", checked: this.checked, disabled: this.disabled, id: this.id, name: this.name, required: this.required, value: this.value, onChange: () => this.radioChange.emit(true) }),
|
|
14
|
+
h("label", { class: {
|
|
15
|
+
"xpl-label": true,
|
|
16
|
+
"xpl-label--disabled": this.disabled
|
|
17
|
+
}, htmlFor: this.id },
|
|
18
|
+
h("slot", null),
|
|
19
|
+
this.description && h("small", { class: {
|
|
20
|
+
"xpl-description": true,
|
|
21
|
+
"xpl-description--disabled": this.disabled
|
|
22
|
+
} }, this.description))));
|
|
23
|
+
}
|
|
24
|
+
static get is() { return "xpl-radio"; }
|
|
25
|
+
static get properties() { return {
|
|
26
|
+
"checked": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"mutable": false,
|
|
29
|
+
"complexType": {
|
|
30
|
+
"original": "boolean",
|
|
31
|
+
"resolved": "boolean",
|
|
32
|
+
"references": {}
|
|
33
|
+
},
|
|
34
|
+
"required": false,
|
|
35
|
+
"optional": true,
|
|
36
|
+
"docs": {
|
|
37
|
+
"tags": [],
|
|
38
|
+
"text": ""
|
|
39
|
+
},
|
|
40
|
+
"attribute": "checked",
|
|
41
|
+
"reflect": false
|
|
42
|
+
},
|
|
43
|
+
"description": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"mutable": false,
|
|
46
|
+
"complexType": {
|
|
47
|
+
"original": "string",
|
|
48
|
+
"resolved": "string",
|
|
49
|
+
"references": {}
|
|
50
|
+
},
|
|
51
|
+
"required": false,
|
|
52
|
+
"optional": true,
|
|
53
|
+
"docs": {
|
|
54
|
+
"tags": [],
|
|
55
|
+
"text": ""
|
|
56
|
+
},
|
|
57
|
+
"attribute": "description",
|
|
58
|
+
"reflect": false
|
|
59
|
+
},
|
|
60
|
+
"disabled": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"mutable": false,
|
|
63
|
+
"complexType": {
|
|
64
|
+
"original": "boolean",
|
|
65
|
+
"resolved": "boolean",
|
|
66
|
+
"references": {}
|
|
67
|
+
},
|
|
68
|
+
"required": false,
|
|
69
|
+
"optional": true,
|
|
70
|
+
"docs": {
|
|
71
|
+
"tags": [],
|
|
72
|
+
"text": ""
|
|
73
|
+
},
|
|
74
|
+
"attribute": "disabled",
|
|
75
|
+
"reflect": false
|
|
76
|
+
},
|
|
77
|
+
"name": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"mutable": false,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "string",
|
|
82
|
+
"resolved": "string",
|
|
83
|
+
"references": {}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": true,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": ""
|
|
90
|
+
},
|
|
91
|
+
"attribute": "name",
|
|
92
|
+
"reflect": false
|
|
93
|
+
},
|
|
94
|
+
"required": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "boolean",
|
|
99
|
+
"resolved": "boolean",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": true,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"attribute": "required",
|
|
109
|
+
"reflect": false
|
|
110
|
+
},
|
|
111
|
+
"styled": {
|
|
112
|
+
"type": "boolean",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "boolean",
|
|
116
|
+
"resolved": "boolean",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": true,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": ""
|
|
124
|
+
},
|
|
125
|
+
"attribute": "styled",
|
|
126
|
+
"reflect": false
|
|
127
|
+
},
|
|
128
|
+
"value": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "string",
|
|
133
|
+
"resolved": "string",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": true,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": ""
|
|
141
|
+
},
|
|
142
|
+
"attribute": "value",
|
|
143
|
+
"reflect": false
|
|
144
|
+
}
|
|
145
|
+
}; }
|
|
146
|
+
static get states() { return {
|
|
147
|
+
"id": {}
|
|
148
|
+
}; }
|
|
149
|
+
static get events() { return [{
|
|
150
|
+
"method": "radioChange",
|
|
151
|
+
"name": "radioChange",
|
|
152
|
+
"bubbles": true,
|
|
153
|
+
"cancelable": true,
|
|
154
|
+
"composed": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [{
|
|
157
|
+
"text": undefined,
|
|
158
|
+
"name": "private"
|
|
159
|
+
}],
|
|
160
|
+
"text": ""
|
|
161
|
+
},
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "any",
|
|
164
|
+
"resolved": "any",
|
|
165
|
+
"references": {}
|
|
166
|
+
}
|
|
167
|
+
}]; }
|
|
168
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component, Host, h } from '@stencil/core';
|
|
2
|
+
export class XplSecondaryNav {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { class: "xpl-secondary-nav" },
|
|
5
|
+
h("nav", { "aria-label": "Secondary Nav" },
|
|
6
|
+
h("slot", null))));
|
|
7
|
+
}
|
|
8
|
+
static get is() { return "xpl-secondary-nav"; }
|
|
9
|
+
}
|