@xplortech/apollo-core 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +42 -1
- package/build/style.css +972 -372
- package/dist/apollo-core/apollo-core.css +23 -9
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/p-00996870.js +1 -0
- package/dist/apollo-core/{p-1fc2ec24.entry.js → p-1e6a342a.entry.js} +4 -3
- package/dist/apollo-core/p-21872e0f.entry.js +1 -0
- package/dist/apollo-core/p-d8ea7d80.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +3 -3
- package/dist/cjs/{index-d0d9877d.js → index-716d8f57.js} +106 -29
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{xpl-button_3.cjs.entry.js → xpl-avatar_7.cjs.entry.js} +139 -68
- package/dist/cjs/xpl-choicelist.cjs.entry.js +16 -0
- package/dist/cjs/xpl-pagination.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +8 -2
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +158 -0
- package/dist/collection/components/xpl-badge/xpl-badge.js +50 -0
- package/dist/collection/components/xpl-button/xpl-button.js +37 -5
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +139 -0
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +9 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js +122 -0
- package/dist/collection/components/xpl-table/xpl-table.js +9 -5
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +10 -0
- package/dist/custom-elements/index.d.ts +36 -0
- package/dist/custom-elements/index.js +174 -10
- package/dist/esm/apollo-core.js +3 -3
- package/dist/esm/{index-252a5f91.js → index-4c8962a5.js} +106 -29
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{xpl-button_3.entry.js → xpl-avatar_7.entry.js} +135 -68
- package/dist/esm/xpl-choicelist.entry.js +12 -0
- package/dist/esm/xpl-pagination.entry.js +72 -0
- package/dist/stories/avatar.stories.js +173 -0
- package/dist/stories/badge.stories.js +48 -0
- package/dist/stories/button.stories.js +98 -0
- package/dist/stories/checkbox.stories.js +66 -0
- package/dist/stories/pagination.stories.js +84 -0
- package/dist/stories/radio.stories.js +56 -0
- package/dist/stories/table.stories.js +107 -0
- package/dist/stories/tabs.stories.js +24 -0
- package/dist/stories/utility-bar.stories.js +94 -0
- package/dist/types/components/xpl-avatar/xpl-avatar.d.ts +11 -0
- package/dist/types/components/xpl-badge/xpl-badge.d.ts +5 -0
- package/dist/types/{.stencil → components}/xpl-button/xpl-button.d.ts +3 -1
- package/dist/types/components/xpl-checkbox/xpl-checkbox.d.ts +11 -0
- package/dist/types/components/xpl-choicelist/xpl-choicelist.d.ts +3 -0
- package/dist/types/components/xpl-radio/xpl-radio.d.ts +10 -0
- package/dist/types/{.stencil → components}/xpl-table/xpl-table.d.ts +2 -2
- package/dist/types/components/xpl-utility-bar/xpl-utility-bar.d.ts +3 -0
- package/dist/types/components.d.ts +132 -4
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/avatar.stories.d.ts +91 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/badge.stories.d.ts +48 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/button.stories.d.ts +74 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/checkbox.stories.d.ts +64 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/pagination.stories.d.ts +0 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/radio.stories.d.ts +56 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/table.stories.d.ts +50 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/tabs.stories.d.ts +0 -0
- package/dist/types/home/runner/work/apollo/apollo/.stencil/stories/utility-bar.stories.d.ts +20 -0
- package/dist/types/stencil-public-runtime.d.ts +183 -182
- package/package.json +42 -13
- package/dist/apollo-core/p-3f7da885.js +0 -1
- /package/dist/types/{.stencil → components}/xpl-pagination/xpl-pagination.d.ts +0 -0
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-716d8f57.js');
|
|
6
|
+
|
|
7
|
+
const XplAvatar = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.disabled = false;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
let className = "xpl-avatar";
|
|
14
|
+
if (this.size)
|
|
15
|
+
className += ` xpl-avatar--${this.size}`;
|
|
16
|
+
if (this.color)
|
|
17
|
+
className += ` xpl-avatar--${this.color}`;
|
|
18
|
+
const inner = (index.h("div", null, this.src ? (index.h("img", { alt: this.name, src: this.src })) : (index.h("div", { class: "xpl-avatar__placeholder" }, index.h("slot", null))), this.status && index.h("div", { class: `xpl-avatar__dot--${this.status}` })));
|
|
19
|
+
return (index.h(index.Host, null, this.href && !this.disabled ? (index.h("a", { href: this.href, class: className, target: this.target }, inner)) : this.href && this.disabled ? (index.h("div", { class: className + " xpl-avatar--disabled" }, inner)) : (index.h("div", { class: className }, inner))));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const XplBadge = class {
|
|
24
|
+
constructor(hostRef) {
|
|
25
|
+
index.registerInstance(this, hostRef);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
let className = "xpl-badge";
|
|
29
|
+
if (this.dot)
|
|
30
|
+
className += " xpl-badge--dot";
|
|
31
|
+
if (this.variant)
|
|
32
|
+
className += " xpl-badge--" + this.variant;
|
|
33
|
+
return (index.h(index.Host, null, index.h("div", { class: className }, index.h("slot", null))));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
6
36
|
|
|
7
37
|
/*!
|
|
8
38
|
* Font Awesome Pro 5.15.3 by @fontawesome - https://fontawesome.com
|
|
@@ -16049,7 +16079,6 @@ const index = require('./index-d0d9877d.js');
|
|
|
16049
16079
|
const XplButton = class {
|
|
16050
16080
|
constructor(hostRef) {
|
|
16051
16081
|
index.registerInstance(this, hostRef);
|
|
16052
|
-
this.disabled = undefined;
|
|
16053
16082
|
this.size = "default";
|
|
16054
16083
|
this.variant = "primary";
|
|
16055
16084
|
}
|
|
@@ -16073,76 +16102,101 @@ const XplButton = class {
|
|
|
16073
16102
|
* Conditionally render either an <a> or <button> element
|
|
16074
16103
|
* depending on if there's an `href` or not
|
|
16075
16104
|
*/
|
|
16076
|
-
this.href ? (index.h("a", { class: className, href: this.href, role: "button" }, !this.iconTrailing && icon, this.iconOnly ? (index.h("span", { class: "sr-only" }, index.h("slot", null))) : (index.h("slot", null)), this.iconTrailing && icon)) : (index.h("button", { class: className, disabled: this.disabled, type: this.type }, !this.iconTrailing && icon, this.iconOnly ? (index.h("span", { class: "sr-only" }, index.h("slot", null))) : (index.h("slot", null)), this.iconTrailing && icon))));
|
|
16105
|
+
this.href ? (index.h("a", { class: className, href: this.href, role: "button" }, !this.iconTrailing && icon, this.iconOnly ? (index.h("span", { class: "sr-only" }, index.h("slot", null))) : (index.h("slot", null)), this.iconTrailing && icon)) : (index.h("button", { class: className, disabled: this.disabled, name: this.name, type: this.type, value: this.value }, !this.iconTrailing && icon, this.iconOnly ? (index.h("span", { class: "sr-only" }, index.h("slot", null))) : (index.h("slot", null)), this.iconTrailing && icon))));
|
|
16077
16106
|
}
|
|
16078
16107
|
};
|
|
16079
16108
|
|
|
16080
|
-
|
|
16109
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
16110
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
16111
|
+
// generators (like Math.random()).
|
|
16112
|
+
var getRandomValues;
|
|
16113
|
+
var rnds8 = new Uint8Array(16);
|
|
16114
|
+
function rng() {
|
|
16115
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
16116
|
+
if (!getRandomValues) {
|
|
16117
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
|
|
16118
|
+
// find the complete implementation of crypto (msCrypto) on IE11.
|
|
16119
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
16120
|
+
|
|
16121
|
+
if (!getRandomValues) {
|
|
16122
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
16123
|
+
}
|
|
16124
|
+
}
|
|
16125
|
+
|
|
16126
|
+
return getRandomValues(rnds8);
|
|
16127
|
+
}
|
|
16128
|
+
|
|
16129
|
+
const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
16130
|
+
|
|
16131
|
+
function validate(uuid) {
|
|
16132
|
+
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
16133
|
+
}
|
|
16134
|
+
|
|
16135
|
+
/**
|
|
16136
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
16137
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
16138
|
+
*/
|
|
16139
|
+
|
|
16140
|
+
var byteToHex = [];
|
|
16141
|
+
|
|
16142
|
+
for (var i = 0; i < 256; ++i) {
|
|
16143
|
+
byteToHex.push((i + 0x100).toString(16).substr(1));
|
|
16144
|
+
}
|
|
16145
|
+
|
|
16146
|
+
function stringify(arr) {
|
|
16147
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
16148
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
16149
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
16150
|
+
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
16151
|
+
// of the following:
|
|
16152
|
+
// - One or more input array values don't map to a hex octet (leading to
|
|
16153
|
+
// "undefined" in the uuid)
|
|
16154
|
+
// - Invalid input values for the RFC `version` or `variant` fields
|
|
16155
|
+
|
|
16156
|
+
if (!validate(uuid)) {
|
|
16157
|
+
throw TypeError('Stringified UUID is invalid');
|
|
16158
|
+
}
|
|
16159
|
+
|
|
16160
|
+
return uuid;
|
|
16161
|
+
}
|
|
16162
|
+
|
|
16163
|
+
function v4(options, buf, offset) {
|
|
16164
|
+
options = options || {};
|
|
16165
|
+
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
16166
|
+
|
|
16167
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
16168
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
16169
|
+
|
|
16170
|
+
if (buf) {
|
|
16171
|
+
offset = offset || 0;
|
|
16172
|
+
|
|
16173
|
+
for (var i = 0; i < 16; ++i) {
|
|
16174
|
+
buf[offset + i] = rnds[i];
|
|
16175
|
+
}
|
|
16176
|
+
|
|
16177
|
+
return buf;
|
|
16178
|
+
}
|
|
16179
|
+
|
|
16180
|
+
return stringify(rnds);
|
|
16181
|
+
}
|
|
16182
|
+
|
|
16183
|
+
const XplCheckbox = class {
|
|
16081
16184
|
constructor(hostRef) {
|
|
16082
16185
|
index.registerInstance(this, hostRef);
|
|
16083
|
-
this.
|
|
16084
|
-
this.current = 1;
|
|
16085
|
-
/**
|
|
16086
|
-
* Private `_goto` method respects the `waitForCallback` prop --
|
|
16087
|
-
* it will always emit the `page` event, but won't actually update
|
|
16088
|
-
* the state of what the current page is, leaving that to the caller
|
|
16089
|
-
* to update once (presumably) some other data has loaded.
|
|
16090
|
-
*/
|
|
16091
|
-
this._goto = (n) => {
|
|
16092
|
-
this.page.emit(n);
|
|
16093
|
-
if (!this.waitForCallback) {
|
|
16094
|
-
this.current = n;
|
|
16095
|
-
}
|
|
16096
|
-
};
|
|
16097
|
-
this.goPrev = () => {
|
|
16098
|
-
if (this.current > 1)
|
|
16099
|
-
this._goto(this.current - 1);
|
|
16100
|
-
};
|
|
16101
|
-
this.goNext = () => {
|
|
16102
|
-
const numPages = Math.ceil(this.total / this.perPage);
|
|
16103
|
-
if (this.current < numPages)
|
|
16104
|
-
this._goto(this.current + 1);
|
|
16105
|
-
};
|
|
16186
|
+
this.id = v4();
|
|
16106
16187
|
}
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
this
|
|
16188
|
+
render() {
|
|
16189
|
+
return (index.h(index.Host, { class: "xpl-checkbox-container" }, index.h("input", { class: "xpl-checkbox", type: "checkbox", checked: this.checked, disabled: this.disabled, id: this.id, indeterminate: this.indeterminate, name: this.name, required: this.required, value: this.value }), index.h("label", { htmlFor: this.id }, index.h("slot", null), this.description && index.h("small", null, this.description))));
|
|
16190
|
+
}
|
|
16191
|
+
};
|
|
16192
|
+
|
|
16193
|
+
const XplRadio = class {
|
|
16194
|
+
constructor(hostRef) {
|
|
16195
|
+
index.registerInstance(this, hostRef);
|
|
16196
|
+
this.id = v4();
|
|
16115
16197
|
}
|
|
16116
16198
|
render() {
|
|
16117
|
-
|
|
16118
|
-
let showing = [1];
|
|
16119
|
-
if (numPages < 7)
|
|
16120
|
-
showing = [1, 2, 3, 4, 5, 6];
|
|
16121
|
-
if (this.current <= 3 || this.current >= numPages - 2) {
|
|
16122
|
-
showing = [1, 2, 3, "...", numPages - 2, numPages - 1, numPages];
|
|
16123
|
-
}
|
|
16124
|
-
else {
|
|
16125
|
-
showing = [
|
|
16126
|
-
1,
|
|
16127
|
-
"...",
|
|
16128
|
-
this.current - 1,
|
|
16129
|
-
this.current,
|
|
16130
|
-
this.current + 1,
|
|
16131
|
-
"...",
|
|
16132
|
-
numPages,
|
|
16133
|
-
];
|
|
16134
|
-
}
|
|
16135
|
-
const showingFirst = (this.current - 1) * this.perPage + 1;
|
|
16136
|
-
const showingLast = Math.min(showingFirst + this.perPage - 1, this.total);
|
|
16137
|
-
return (index.h(index.Host, null, index.h("div", { class: "xpl-pagination" }, index.h("div", null, index.h("p", null, "Showing ", index.h("span", null, showingFirst), " to ", index.h("span", null, showingLast), " ", "of ", index.h("span", null, this.total), " results")), index.h("div", null, index.h("nav", { "aria-label": "Pagination" }, index.h("button", { onClick: this.goPrev, class: "xpl-pagination-prev" }, index.h("span", null, "Previous"), index.h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, index.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" }))), showing.map((n) => {
|
|
16138
|
-
if (n === "...") {
|
|
16139
|
-
return index.h("span", { class: "xpl-pagination-ellipsis" }, "...");
|
|
16140
|
-
}
|
|
16141
|
-
if (n === this.current) {
|
|
16142
|
-
return (index.h("button", { "aria-current": "page", class: "xpl-pagination-current" }, n));
|
|
16143
|
-
}
|
|
16144
|
-
return index.h("button", { onClick: () => this._goto(n) }, n);
|
|
16145
|
-
}), index.h("button", { onClick: this.goNext, class: "xpl-pagination-next" }, index.h("span", null, "Next"), index.h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, index.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" }))))))));
|
|
16199
|
+
return (index.h(index.Host, { class: "xpl-radio-container" }, index.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 }), index.h("label", { htmlFor: this.id }, index.h("slot", null), this.description && index.h("small", null, this.description))));
|
|
16146
16200
|
}
|
|
16147
16201
|
};
|
|
16148
16202
|
|
|
@@ -16211,19 +16265,36 @@ const XplTable = class {
|
|
|
16211
16265
|
if (this.hasScrolled)
|
|
16212
16266
|
className += " xpl-table--has-scrolled";
|
|
16213
16267
|
return (index.h(index.Host, null, index.h("div", { class: "xpl-table-container", onScroll: this.onScroll, ref: (el) => (this.container = el) }, index.h("table", { class: className }, this.columns && (index.h("thead", null, this.columns.map((column, i) => {
|
|
16214
|
-
return (index.h("th", null, this.multiselect && i === 0 ? (index.h("label", { htmlFor: "__xpl-table-th" }, index.h("input", { id: "__xpl-table-th",
|
|
16268
|
+
return (index.h("th", null, this.multiselect && i === 0 ? (index.h("label", { htmlFor: "__xpl-table-th" }, index.h("input", { checked: this.areAllSelected, id: "__xpl-table-th",
|
|
16269
|
+
// appear indeterminate when at least one but not all
|
|
16270
|
+
// are selected
|
|
16271
|
+
indeterminate: !this.areAllSelected &&
|
|
16272
|
+
this.selected.some((a) => a), onChange: (e) => {
|
|
16215
16273
|
this.selectAll(e);
|
|
16216
|
-
},
|
|
16274
|
+
}, type: "checkbox" }), column)) : (column)));
|
|
16217
16275
|
}))), index.h("tbody", null, this.rowData.map((row, rowNum) => {
|
|
16218
16276
|
return (index.h("tr", { class: this.selected && this.selected[rowNum]
|
|
16219
16277
|
? "xpl-table-row-selected"
|
|
16220
16278
|
: "" }, row.map((cell, i) => {
|
|
16221
|
-
return (index.h("td", null, this.multiselect && i === 0 ? (index.h("label", { htmlFor: "__xpl-table-row-" + rowNum }, index.h("input", { id: "__xpl-table-row-" + rowNum, checked: this.selected[rowNum], type: "checkbox", onChange: (e) => this.selectOne(e, rowNum) }), cell)) : (cell)));
|
|
16279
|
+
return (index.h("td", null, this.multiselect && i === 0 ? (index.h("label", { htmlFor: "__xpl-table-row-" + rowNum }, index.h("input", { id: "__xpl-table-row-" + rowNum, checked: this.selected[rowNum], type: "checkbox", onChange: (e) => this.selectOne(e, rowNum) }), index.h("div", { innerHTML: cell }))) : (index.h("div", { innerHTML: cell }))));
|
|
16222
16280
|
})));
|
|
16223
16281
|
}))))));
|
|
16224
16282
|
}
|
|
16225
16283
|
};
|
|
16226
16284
|
|
|
16285
|
+
const XplUtilityBar = class {
|
|
16286
|
+
constructor(hostRef) {
|
|
16287
|
+
index.registerInstance(this, hostRef);
|
|
16288
|
+
}
|
|
16289
|
+
render() {
|
|
16290
|
+
return (index.h(index.Host, null, index.h("nav", { "aria-label": "utility navigation bar", class: "xpl-utility-bar" }, index.h("slot", { name: "main" }), index.h("slot", { name: "aside" }))));
|
|
16291
|
+
}
|
|
16292
|
+
};
|
|
16293
|
+
|
|
16294
|
+
exports.xpl_avatar = XplAvatar;
|
|
16295
|
+
exports.xpl_badge = XplBadge;
|
|
16227
16296
|
exports.xpl_button = XplButton;
|
|
16228
|
-
exports.
|
|
16297
|
+
exports.xpl_checkbox = XplCheckbox;
|
|
16298
|
+
exports.xpl_radio = XplRadio;
|
|
16229
16299
|
exports.xpl_table = XplTable;
|
|
16300
|
+
exports.xpl_utility_bar = XplUtilityBar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-716d8f57.js');
|
|
6
|
+
|
|
7
|
+
const XplChoicelist = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
return (index.h(index.Host, null, index.h("slot", null)));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.xpl_choicelist = XplChoicelist;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-716d8f57.js');
|
|
6
|
+
|
|
7
|
+
const XplPagination = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.page = index.createEvent(this, "page", 7);
|
|
11
|
+
this.current = 1;
|
|
12
|
+
/**
|
|
13
|
+
* Private `_goto` method respects the `waitForCallback` prop --
|
|
14
|
+
* it will always emit the `page` event, but won't actually update
|
|
15
|
+
* the state of what the current page is, leaving that to the caller
|
|
16
|
+
* to update once (presumably) some other data has loaded.
|
|
17
|
+
*/
|
|
18
|
+
this._goto = (n) => {
|
|
19
|
+
this.page.emit(n);
|
|
20
|
+
if (!this.waitForCallback) {
|
|
21
|
+
this.current = n;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.goPrev = () => {
|
|
25
|
+
if (this.current > 1)
|
|
26
|
+
this._goto(this.current - 1);
|
|
27
|
+
};
|
|
28
|
+
this.goNext = () => {
|
|
29
|
+
const numPages = Math.ceil(this.total / this.perPage);
|
|
30
|
+
if (this.current < numPages)
|
|
31
|
+
this._goto(this.current + 1);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Calling `goto` with a page number (which should probably be
|
|
36
|
+
* taken from the `page` event) updates the pagination's state
|
|
37
|
+
* and re-renders it, showing the appropriate buttons given the current page.
|
|
38
|
+
* @param n
|
|
39
|
+
*/
|
|
40
|
+
async goto(n) {
|
|
41
|
+
this.current = n;
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
const numPages = Math.ceil(this.total / this.perPage);
|
|
45
|
+
let showing = [1];
|
|
46
|
+
if (numPages < 7)
|
|
47
|
+
showing = [1, 2, 3, 4, 5, 6];
|
|
48
|
+
if (this.current <= 3 || this.current >= numPages - 2) {
|
|
49
|
+
showing = [1, 2, 3, "...", numPages - 2, numPages - 1, numPages];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
showing = [
|
|
53
|
+
1,
|
|
54
|
+
"...",
|
|
55
|
+
this.current - 1,
|
|
56
|
+
this.current,
|
|
57
|
+
this.current + 1,
|
|
58
|
+
"...",
|
|
59
|
+
numPages,
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
const showingFirst = (this.current - 1) * this.perPage + 1;
|
|
63
|
+
const showingLast = Math.min(showingFirst + this.perPage - 1, this.total);
|
|
64
|
+
return (index.h(index.Host, null, index.h("div", { class: "xpl-pagination" }, index.h("div", null, index.h("p", null, "Showing ", index.h("span", null, showingFirst), " to ", index.h("span", null, showingLast), " ", "of ", index.h("span", null, this.total), " results")), index.h("div", null, index.h("nav", { "aria-label": "Pagination" }, index.h("button", { onClick: this.goPrev, class: "xpl-pagination-prev" }, index.h("span", null, "Previous"), index.h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, index.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" }))), showing.map((n) => {
|
|
65
|
+
if (n === "...") {
|
|
66
|
+
return index.h("span", { class: "xpl-pagination-ellipsis" }, "...");
|
|
67
|
+
}
|
|
68
|
+
if (n === this.current) {
|
|
69
|
+
return (index.h("button", { "aria-current": "page", class: "xpl-pagination-current" }, n));
|
|
70
|
+
}
|
|
71
|
+
return index.h("button", { onClick: () => this._goto(n) }, n);
|
|
72
|
+
}), index.h("button", { onClick: this.goNext, class: "xpl-pagination-next" }, index.h("span", null, "Next"), index.h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, index.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" }))))))));
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
exports.xpl_pagination = XplPagination;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
"./components/xpl-avatar/xpl-avatar.js",
|
|
4
|
+
"./components/xpl-badge/xpl-badge.js",
|
|
3
5
|
"./components/xpl-button/xpl-button.js",
|
|
6
|
+
"./components/xpl-checkbox/xpl-checkbox.js",
|
|
7
|
+
"./components/xpl-choicelist/xpl-choicelist.js",
|
|
4
8
|
"./components/xpl-pagination/xpl-pagination.js",
|
|
5
|
-
"./components/xpl-
|
|
9
|
+
"./components/xpl-radio/xpl-radio.js",
|
|
10
|
+
"./components/xpl-table/xpl-table.js",
|
|
11
|
+
"./components/xpl-utility-bar/xpl-utility-bar.js"
|
|
6
12
|
],
|
|
7
13
|
"compiler": {
|
|
8
14
|
"name": "@stencil/core",
|
|
9
|
-
"version": "2.
|
|
15
|
+
"version": "2.8.0",
|
|
10
16
|
"typescriptVersion": "4.2.3"
|
|
11
17
|
},
|
|
12
18
|
"collections": [],
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Component, Host, h, Prop } from "@stencil/core";
|
|
2
|
+
export class XplAvatar {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.disabled = false;
|
|
5
|
+
}
|
|
6
|
+
render() {
|
|
7
|
+
let className = "xpl-avatar";
|
|
8
|
+
if (this.size)
|
|
9
|
+
className += ` xpl-avatar--${this.size}`;
|
|
10
|
+
if (this.color)
|
|
11
|
+
className += ` xpl-avatar--${this.color}`;
|
|
12
|
+
const inner = (h("div", null,
|
|
13
|
+
this.src ? (h("img", { alt: this.name, src: this.src })) : (h("div", { class: "xpl-avatar__placeholder" },
|
|
14
|
+
h("slot", null))),
|
|
15
|
+
this.status && h("div", { class: `xpl-avatar__dot--${this.status}` })));
|
|
16
|
+
return (h(Host, null, this.href && !this.disabled ? (h("a", { href: this.href, class: className, target: this.target }, inner)) : this.href && this.disabled ? (h("div", { class: className + " xpl-avatar--disabled" }, inner)) : (h("div", { class: className }, inner))));
|
|
17
|
+
}
|
|
18
|
+
static get is() { return "xpl-avatar"; }
|
|
19
|
+
static get properties() { return {
|
|
20
|
+
"color": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"mutable": false,
|
|
23
|
+
"complexType": {
|
|
24
|
+
"original": "\"green\" | \"yellow\" | \"pink\" | \"primary\" | \"secondary\"",
|
|
25
|
+
"resolved": "\"green\" | \"pink\" | \"primary\" | \"secondary\" | \"yellow\"",
|
|
26
|
+
"references": {}
|
|
27
|
+
},
|
|
28
|
+
"required": false,
|
|
29
|
+
"optional": true,
|
|
30
|
+
"docs": {
|
|
31
|
+
"tags": [],
|
|
32
|
+
"text": ""
|
|
33
|
+
},
|
|
34
|
+
"attribute": "color",
|
|
35
|
+
"reflect": false
|
|
36
|
+
},
|
|
37
|
+
"disabled": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"mutable": false,
|
|
40
|
+
"complexType": {
|
|
41
|
+
"original": "boolean",
|
|
42
|
+
"resolved": "boolean",
|
|
43
|
+
"references": {}
|
|
44
|
+
},
|
|
45
|
+
"required": false,
|
|
46
|
+
"optional": true,
|
|
47
|
+
"docs": {
|
|
48
|
+
"tags": [],
|
|
49
|
+
"text": ""
|
|
50
|
+
},
|
|
51
|
+
"attribute": "disabled",
|
|
52
|
+
"reflect": false,
|
|
53
|
+
"defaultValue": "false"
|
|
54
|
+
},
|
|
55
|
+
"href": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"mutable": false,
|
|
58
|
+
"complexType": {
|
|
59
|
+
"original": "string",
|
|
60
|
+
"resolved": "string",
|
|
61
|
+
"references": {}
|
|
62
|
+
},
|
|
63
|
+
"required": false,
|
|
64
|
+
"optional": true,
|
|
65
|
+
"docs": {
|
|
66
|
+
"tags": [],
|
|
67
|
+
"text": ""
|
|
68
|
+
},
|
|
69
|
+
"attribute": "href",
|
|
70
|
+
"reflect": false
|
|
71
|
+
},
|
|
72
|
+
"name": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "string",
|
|
77
|
+
"resolved": "string",
|
|
78
|
+
"references": {}
|
|
79
|
+
},
|
|
80
|
+
"required": false,
|
|
81
|
+
"optional": true,
|
|
82
|
+
"docs": {
|
|
83
|
+
"tags": [],
|
|
84
|
+
"text": ""
|
|
85
|
+
},
|
|
86
|
+
"attribute": "name",
|
|
87
|
+
"reflect": false
|
|
88
|
+
},
|
|
89
|
+
"size": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "\"md\" | \"sm\"",
|
|
94
|
+
"resolved": "\"md\" | \"sm\"",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": true,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"attribute": "size",
|
|
104
|
+
"reflect": false
|
|
105
|
+
},
|
|
106
|
+
"src": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"mutable": false,
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "string",
|
|
111
|
+
"resolved": "string",
|
|
112
|
+
"references": {}
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"optional": true,
|
|
116
|
+
"docs": {
|
|
117
|
+
"tags": [],
|
|
118
|
+
"text": ""
|
|
119
|
+
},
|
|
120
|
+
"attribute": "src",
|
|
121
|
+
"reflect": false
|
|
122
|
+
},
|
|
123
|
+
"status": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "\"active\" | \"warning\" | \"inactive\"",
|
|
128
|
+
"resolved": "\"active\" | \"inactive\" | \"warning\"",
|
|
129
|
+
"references": {}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": true,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": ""
|
|
136
|
+
},
|
|
137
|
+
"attribute": "status",
|
|
138
|
+
"reflect": false
|
|
139
|
+
},
|
|
140
|
+
"target": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"mutable": false,
|
|
143
|
+
"complexType": {
|
|
144
|
+
"original": "string",
|
|
145
|
+
"resolved": "string",
|
|
146
|
+
"references": {}
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"optional": true,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": ""
|
|
153
|
+
},
|
|
154
|
+
"attribute": "target",
|
|
155
|
+
"reflect": false
|
|
156
|
+
}
|
|
157
|
+
}; }
|
|
158
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Component, Host, h, Prop } from "@stencil/core";
|
|
2
|
+
export class XplBadge {
|
|
3
|
+
render() {
|
|
4
|
+
let className = "xpl-badge";
|
|
5
|
+
if (this.dot)
|
|
6
|
+
className += " xpl-badge--dot";
|
|
7
|
+
if (this.variant)
|
|
8
|
+
className += " xpl-badge--" + this.variant;
|
|
9
|
+
return (h(Host, null,
|
|
10
|
+
h("div", { class: className },
|
|
11
|
+
h("slot", null))));
|
|
12
|
+
}
|
|
13
|
+
static get is() { return "xpl-badge"; }
|
|
14
|
+
static get properties() { return {
|
|
15
|
+
"dot": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"mutable": false,
|
|
18
|
+
"complexType": {
|
|
19
|
+
"original": "boolean",
|
|
20
|
+
"resolved": "boolean",
|
|
21
|
+
"references": {}
|
|
22
|
+
},
|
|
23
|
+
"required": false,
|
|
24
|
+
"optional": true,
|
|
25
|
+
"docs": {
|
|
26
|
+
"tags": [],
|
|
27
|
+
"text": ""
|
|
28
|
+
},
|
|
29
|
+
"attribute": "dot",
|
|
30
|
+
"reflect": false
|
|
31
|
+
},
|
|
32
|
+
"variant": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"mutable": false,
|
|
35
|
+
"complexType": {
|
|
36
|
+
"original": "\"success\" | \"warning\" | \"inactive\" | \"error\"",
|
|
37
|
+
"resolved": "\"error\" | \"inactive\" | \"success\" | \"warning\"",
|
|
38
|
+
"references": {}
|
|
39
|
+
},
|
|
40
|
+
"required": false,
|
|
41
|
+
"optional": true,
|
|
42
|
+
"docs": {
|
|
43
|
+
"tags": [],
|
|
44
|
+
"text": ""
|
|
45
|
+
},
|
|
46
|
+
"attribute": "variant",
|
|
47
|
+
"reflect": false
|
|
48
|
+
}
|
|
49
|
+
}; }
|
|
50
|
+
}
|
|
@@ -3,7 +3,6 @@ import "../../../font-awesome/fontawesome";
|
|
|
3
3
|
import "../../../font-awesome/regular";
|
|
4
4
|
export class XplButton {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.disabled = undefined;
|
|
7
6
|
this.size = "default";
|
|
8
7
|
this.variant = "primary";
|
|
9
8
|
}
|
|
@@ -31,7 +30,7 @@ export class XplButton {
|
|
|
31
30
|
!this.iconTrailing && icon,
|
|
32
31
|
this.iconOnly ? (h("span", { class: "sr-only" },
|
|
33
32
|
h("slot", null))) : (h("slot", null)),
|
|
34
|
-
this.iconTrailing && icon)) : (h("button", { class: className, disabled: this.disabled, type: this.type },
|
|
33
|
+
this.iconTrailing && icon)) : (h("button", { class: className, disabled: this.disabled, name: this.name, type: this.type, value: this.value },
|
|
35
34
|
!this.iconTrailing && icon,
|
|
36
35
|
this.iconOnly ? (h("span", { class: "sr-only" },
|
|
37
36
|
h("slot", null))) : (h("slot", null)),
|
|
@@ -54,8 +53,7 @@ export class XplButton {
|
|
|
54
53
|
"text": ""
|
|
55
54
|
},
|
|
56
55
|
"attribute": "disabled",
|
|
57
|
-
"reflect": false
|
|
58
|
-
"defaultValue": "undefined"
|
|
56
|
+
"reflect": false
|
|
59
57
|
},
|
|
60
58
|
"href": {
|
|
61
59
|
"type": "string",
|
|
@@ -125,6 +123,23 @@ export class XplButton {
|
|
|
125
123
|
"attribute": "icon-trailing",
|
|
126
124
|
"reflect": false
|
|
127
125
|
},
|
|
126
|
+
"name": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": true,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": ""
|
|
139
|
+
},
|
|
140
|
+
"attribute": "name",
|
|
141
|
+
"reflect": false
|
|
142
|
+
},
|
|
128
143
|
"size": {
|
|
129
144
|
"type": "string",
|
|
130
145
|
"mutable": false,
|
|
@@ -144,6 +159,23 @@ export class XplButton {
|
|
|
144
159
|
"defaultValue": "\"default\""
|
|
145
160
|
},
|
|
146
161
|
"type": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "\"submit\" | \"reset\" | \"button\"",
|
|
166
|
+
"resolved": "\"button\" | \"reset\" | \"submit\"",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": true,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": ""
|
|
174
|
+
},
|
|
175
|
+
"attribute": "type",
|
|
176
|
+
"reflect": false
|
|
177
|
+
},
|
|
178
|
+
"value": {
|
|
147
179
|
"type": "string",
|
|
148
180
|
"mutable": false,
|
|
149
181
|
"complexType": {
|
|
@@ -157,7 +189,7 @@ export class XplButton {
|
|
|
157
189
|
"tags": [],
|
|
158
190
|
"text": ""
|
|
159
191
|
},
|
|
160
|
-
"attribute": "
|
|
192
|
+
"attribute": "value",
|
|
161
193
|
"reflect": false
|
|
162
194
|
},
|
|
163
195
|
"variant": {
|