@scouterna/ui-webc 2.2.7 → 3.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/dist/cjs/{index-DpSUh0CA.js → index-BPpKjjvS.js} +51 -1
- package/dist/cjs/{inputMixin-BEUFwoun.js → inputMixin-D0IzcaXz.js} +27 -14
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/scout-app-bar.cjs.entry.js +1 -1
- package/dist/cjs/scout-bottom-bar-item.cjs.entry.js +1 -1
- package/dist/cjs/scout-bottom-bar.cjs.entry.js +1 -1
- package/dist/cjs/scout-button.cjs.entry.js +1 -1
- package/dist/cjs/scout-card.cjs.entry.js +1 -1
- package/dist/cjs/scout-checkbox_2.cjs.entry.js +16 -4
- package/dist/cjs/scout-divider.cjs.entry.js +1 -1
- package/dist/cjs/scout-field.cjs.entry.js +2 -2
- package/dist/cjs/scout-input.cjs.entry.js +9 -3
- package/dist/cjs/scout-link.cjs.entry.js +1 -1
- package/dist/cjs/scout-list-view-item.cjs.entry.js +1 -1
- package/dist/cjs/scout-list-view-subheader.cjs.entry.js +1 -1
- package/dist/cjs/scout-list-view.cjs.entry.js +1 -1
- package/dist/cjs/scout-loader.cjs.entry.js +1 -1
- package/dist/cjs/scout-select.cjs.entry.js +10 -4
- package/dist/cjs/scout-stack.cjs.entry.js +1 -1
- package/dist/cjs/scout-switch.cjs.entry.js +9 -3
- package/dist/cjs/scout-tabs-tab.cjs.entry.js +18 -0
- package/dist/cjs/scout-tabs.cjs.entry.js +74 -0
- package/dist/cjs/ui-webc.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/field/field.js +2 -2
- package/dist/collection/components/select/select.js +1 -1
- package/dist/collection/components/tabs/tabs.css +17 -0
- package/dist/collection/components/tabs/tabs.js +142 -0
- package/dist/collection/components/tabs-tab/tabs-tab.css +44 -0
- package/dist/collection/components/tabs-tab/tabs-tab.js +19 -0
- package/dist/collection/mixins/inputMixin.js +63 -22
- package/dist/components/index.js +1 -1
- package/dist/components/p-B72iGJNe.js +1 -0
- package/dist/components/{p-CmHrcz9s.js → p-CXXyN7aY.js} +1 -1
- package/dist/components/p-DxVqa2PR.js +1 -0
- package/dist/components/p-Qv5q0SGa.js +1 -0
- package/dist/components/scout-app-bar.js +1 -1
- package/dist/components/scout-bottom-bar-item.js +1 -1
- package/dist/components/scout-bottom-bar.js +1 -1
- package/dist/components/scout-button.js +1 -1
- package/dist/components/scout-card.js +1 -1
- package/dist/components/scout-checkbox.js +1 -1
- package/dist/components/scout-divider.js +1 -1
- package/dist/components/scout-field.js +1 -1
- package/dist/components/scout-input.js +1 -1
- package/dist/components/scout-link.js +1 -1
- package/dist/components/scout-list-view-item.js +1 -1
- package/dist/components/scout-list-view-subheader.js +1 -1
- package/dist/components/scout-list-view.js +1 -1
- package/dist/components/scout-loader.js +1 -1
- package/dist/components/scout-radio-button.js +1 -1
- package/dist/components/scout-select.js +1 -1
- package/dist/components/scout-stack.js +1 -1
- package/dist/components/scout-switch.js +1 -1
- package/dist/components/scout-tabs-tab.d.ts +11 -0
- package/dist/components/scout-tabs-tab.js +1 -0
- package/dist/components/scout-tabs.d.ts +11 -0
- package/dist/components/scout-tabs.js +1 -0
- package/dist/custom-elements.json +231 -42
- package/dist/esm/{index-xD2pOo_x.js → index-CBq_WkdR.js} +51 -1
- package/dist/esm/{inputMixin-BuDdNX3m.js → inputMixin-CArDsEiI.js} +27 -14
- package/dist/esm/loader.js +3 -3
- package/dist/esm/scout-app-bar.entry.js +1 -1
- package/dist/esm/scout-bottom-bar-item.entry.js +1 -1
- package/dist/esm/scout-bottom-bar.entry.js +1 -1
- package/dist/esm/scout-button.entry.js +1 -1
- package/dist/esm/scout-card.entry.js +1 -1
- package/dist/esm/scout-checkbox_2.entry.js +16 -4
- package/dist/esm/scout-divider.entry.js +1 -1
- package/dist/esm/scout-field.entry.js +2 -2
- package/dist/esm/scout-input.entry.js +9 -3
- package/dist/esm/scout-link.entry.js +1 -1
- package/dist/esm/scout-list-view-item.entry.js +1 -1
- package/dist/esm/scout-list-view-subheader.entry.js +1 -1
- package/dist/esm/scout-list-view.entry.js +1 -1
- package/dist/esm/scout-loader.entry.js +1 -1
- package/dist/esm/scout-select.entry.js +10 -4
- package/dist/esm/scout-stack.entry.js +1 -1
- package/dist/esm/scout-switch.entry.js +9 -3
- package/dist/esm/scout-tabs-tab.entry.js +16 -0
- package/dist/esm/scout-tabs.entry.js +72 -0
- package/dist/esm/ui-webc.js +3 -3
- package/dist/types/components/tabs/tabs.d.ts +31 -0
- package/dist/types/components/tabs-tab/tabs-tab.d.ts +3 -0
- package/dist/types/components.d.ts +183 -30
- package/dist/ui-webc/p-0e444b1f.entry.js +1 -0
- package/dist/ui-webc/p-189879c2.entry.js +1 -0
- package/dist/ui-webc/p-60cd6c7e.entry.js +1 -0
- package/dist/ui-webc/{p-8da4cdaa.entry.js → p-6287efe7.entry.js} +1 -1
- package/dist/ui-webc/{p-bf96d820.entry.js → p-6825e415.entry.js} +1 -1
- package/dist/ui-webc/p-6xDaXBJm.js +1 -0
- package/dist/ui-webc/{p-186ee2d2.entry.js → p-78126f74.entry.js} +1 -1
- package/dist/ui-webc/{p-cdce9596.entry.js → p-8f5965aa.entry.js} +1 -1
- package/dist/ui-webc/{p-xD2pOo_x.js → p-CBq_WkdR.js} +2 -2
- package/dist/ui-webc/p-a153023c.entry.js +1 -0
- package/dist/ui-webc/{p-94f1aa41.entry.js → p-a2c09e05.entry.js} +1 -1
- package/dist/ui-webc/{p-802ce20c.entry.js → p-b699617e.entry.js} +1 -1
- package/dist/ui-webc/p-c0696c1f.entry.js +1 -0
- package/dist/ui-webc/{p-f3ff75c8.entry.js → p-c4f7cfa2.entry.js} +1 -1
- package/dist/ui-webc/{p-594f0ba6.entry.js → p-cdc127de.entry.js} +1 -1
- package/dist/ui-webc/p-db40c987.entry.js +1 -0
- package/dist/ui-webc/{p-66f2d080.entry.js → p-ef34d84c.entry.js} +1 -1
- package/dist/ui-webc/{p-db9e3e2d.entry.js → p-f799b2d8.entry.js} +1 -1
- package/dist/ui-webc/{p-d7430470.entry.js → p-f8099e5b.entry.js} +1 -1
- package/dist/ui-webc/{p-eaec31f1.entry.js → p-f8a4ef3d.entry.js} +1 -1
- package/dist/ui-webc/{p-5b96b509.entry.js → p-ff537388.entry.js} +1 -1
- package/dist/ui-webc/ui-webc.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-CTivgs5a.js +0 -1
- package/dist/components/p-R-tzZ3cs.js +0 -1
- package/dist/components/p-vLvmwbzB.js +0 -1
- package/dist/ui-webc/p-061e3457.entry.js +0 -1
- package/dist/ui-webc/p-0dd7cda5.entry.js +0 -1
- package/dist/ui-webc/p-24ccd3fc.entry.js +0 -1
- package/dist/ui-webc/p-BuuT2Uz3.js +0 -1
- package/dist/ui-webc/p-a92dd367.entry.js +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BPpKjjvS.js');
|
|
4
|
+
|
|
5
|
+
const tabsCss = () => `:host{position:relative;width:100%;display:flex;height:var(--spacing-12);--tabs-indicator-height:2px}.indicator{position:absolute;bottom:0;left:0;width:0;height:var(--tabs-indicator-height);background-color:var(--color-background-brand-base);transition:all 0.3s ease}`;
|
|
6
|
+
|
|
7
|
+
const ScoutTabs = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.scoutChange = index.createEvent(this, "scoutChange");
|
|
11
|
+
}
|
|
12
|
+
get el() { return index.getElement(this); }
|
|
13
|
+
/**
|
|
14
|
+
* Zero-based index of the currently active tab.
|
|
15
|
+
*/
|
|
16
|
+
value = 0;
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when the active tab changes as a result of a user click.
|
|
19
|
+
* The `value` in the event detail is the zero-based index of the newly selected tab.
|
|
20
|
+
*/
|
|
21
|
+
scoutChange;
|
|
22
|
+
widths = [];
|
|
23
|
+
lefts = [];
|
|
24
|
+
render() {
|
|
25
|
+
return (index.h(index.Host, { key: 'dffbae0bba3543f50cbe7046bad52c7bdff7ba55' }, index.h("slot", { key: 'cad95b2ae6c8b2bc659bfa6510c0b193d2e08dd9' }), this.getIndicator()));
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.updateChildrenClasses();
|
|
29
|
+
this.calculateIndicatorSizes();
|
|
30
|
+
}
|
|
31
|
+
getIndicator() {
|
|
32
|
+
const width = this.widths[this.value] || 0;
|
|
33
|
+
const left = this.lefts[this.value] || 0;
|
|
34
|
+
const indicatorStyle = {
|
|
35
|
+
width: `${width}px`,
|
|
36
|
+
transform: `translateX(${left}px)`,
|
|
37
|
+
};
|
|
38
|
+
return index.h("div", { "aria-hidden": "true", class: "indicator", style: indicatorStyle });
|
|
39
|
+
}
|
|
40
|
+
handleClick(event) {
|
|
41
|
+
const target = event.target;
|
|
42
|
+
const tabs = Array.from(this.el.children);
|
|
43
|
+
const clickedIndex = tabs.indexOf(target);
|
|
44
|
+
if (clickedIndex !== -1 && clickedIndex !== this.value) {
|
|
45
|
+
this.scoutChange.emit({ value: clickedIndex });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
updateChildrenClasses() {
|
|
49
|
+
Array.from(this.el.children).forEach((child, index) => {
|
|
50
|
+
const tab = child;
|
|
51
|
+
if (index === this.value) {
|
|
52
|
+
tab.setAttribute("data-active", "true");
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
tab.removeAttribute("data-active");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
calculateIndicatorSizes() {
|
|
60
|
+
this.widths = Array.from(this.el.children).map((child) => child.offsetWidth);
|
|
61
|
+
this.lefts = this.widths.map((_, index) => this.widths.slice(0, index).reduce((acc, w) => acc + w, 0));
|
|
62
|
+
}
|
|
63
|
+
static get delegatesFocus() { return true; }
|
|
64
|
+
static get watchers() { return {
|
|
65
|
+
"value": [{
|
|
66
|
+
"updateChildrenClasses": 0
|
|
67
|
+
}, {
|
|
68
|
+
"calculateIndicatorSizes": 0
|
|
69
|
+
}]
|
|
70
|
+
}; }
|
|
71
|
+
};
|
|
72
|
+
ScoutTabs.style = tabsCss();
|
|
73
|
+
|
|
74
|
+
exports.scout_tabs = ScoutTabs;
|
package/dist/cjs/ui-webc.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BPpKjjvS.js');
|
|
4
4
|
|
|
5
5
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
6
|
/*
|
|
@@ -18,7 +18,7 @@ var patchBrowser = () => {
|
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(async (options) => {
|
|
20
20
|
await index.globalScripts();
|
|
21
|
-
return index.bootstrapLazy([["scout-list-view-item.cjs",[[529,"scout-list-view-item",{"icon":[1],"primary":[1],"secondary":[1],"type":[1],"href":[1],"target":[1],"rel":[1],"name":[1],"value":[1],"checked":[4],"disabled":[4]}]]],["scout-app-bar.cjs",[[785,"scout-app-bar",{"titleText":[1,"title-text"]}]]],["scout-bottom-bar.cjs",[[273,"scout-bottom-bar"]]],["scout-bottom-bar-item.cjs",[[529,"scout-bottom-bar-item",{"type":[1],"href":[1],"target":[1],"rel":[1],"icon":[1],"label":[1],"active":[4]}]]],["scout-button.cjs",[[772,"scout-button",{"type":[1],"href":[1],"target":[1],"rel":[1],"size":[1],"variant":[1],"icon":[1],"iconPosition":[1,"icon-position"],"iconOnly":[4,"icon-only"]}]]],["scout-card.cjs",[[273,"scout-card"]]],["scout-divider.cjs",[[17,"scout-divider"]]],["scout-field.cjs",[[774,"scout-field",{"label":[1],"helpText":[1,"help-text"],"inputId":[32],"errorText":[32],"errorHidden":[32]},[[0,"_scoutFieldId","catchFieldId"],[0,"
|
|
21
|
+
return index.bootstrapLazy([["scout-list-view-item.cjs",[[529,"scout-list-view-item",{"icon":[1],"primary":[1],"secondary":[1],"type":[1],"href":[1],"target":[1],"rel":[1],"name":[1],"value":[1],"checked":[4],"disabled":[4]}]]],["scout-app-bar.cjs",[[785,"scout-app-bar",{"titleText":[1,"title-text"]}]]],["scout-bottom-bar.cjs",[[273,"scout-bottom-bar"]]],["scout-bottom-bar-item.cjs",[[529,"scout-bottom-bar-item",{"type":[1],"href":[1],"target":[1],"rel":[1],"icon":[1],"label":[1],"active":[4]}]]],["scout-button.cjs",[[772,"scout-button",{"type":[1],"href":[1],"target":[1],"rel":[1],"size":[1],"variant":[1],"icon":[1],"iconPosition":[1,"icon-position"],"iconOnly":[4,"icon-only"]}]]],["scout-card.cjs",[[273,"scout-card"]]],["scout-divider.cjs",[[17,"scout-divider"]]],["scout-field.cjs",[[774,"scout-field",{"label":[1],"helpText":[1,"help-text"],"inputId":[32],"errorText":[32],"errorHidden":[32]},[[0,"_scoutFieldId","catchFieldId"],[0,"_scoutValidityChanged","handleValidation"],[0,"scoutBlur","showError"],[0,"_scoutInvalid","showError"]]]]],["scout-input.cjs",[[514,"scout-input",{"validity":[1],"size":[1],"variant":[1],"type":[1],"inputmode":[1],"pattern":[1],"value":[1],"name":[1],"disabled":[4],"placeholder":[1],"ariaId":[32]},null,{"validity":[{"runValidation":0}]}]]],["scout-link.cjs",[[529,"scout-link",{"href":[1],"label":[1],"rel":[1],"linkAriaLabel":[1,"link-aria-label"],"type":[1],"target":[1]}]]],["scout-list-view.cjs",[[273,"scout-list-view",null,[[0,"scoutChecked","onScoutChecked"]]]]],["scout-list-view-subheader.cjs",[[529,"scout-list-view-subheader",{"text":[1],"headingLevel":[1,"heading-level"]}]]],["scout-loader.cjs",[[513,"scout-loader",{"text":[1],"size":[1]}]]],["scout-select.cjs",[[774,"scout-select",{"validity":[1],"value":[1],"disabled":[4],"name":[1],"ariaId":[32]},null,{"validity":[{"runValidation":0}]}]]],["scout-stack.cjs",[[785,"scout-stack",{"direction":[1],"gapSize":[1,"gap-size"]}]]],["scout-switch.cjs",[[529,"scout-switch",{"validity":[1],"toggled":[4],"disabled":[4],"ariaLabelledby":[1,"aria-labelledby"],"label":[1],"ariaId":[32]},null,{"validity":[{"runValidation":0}]}]]],["scout-tabs.cjs",[[785,"scout-tabs",{"value":[2],"widths":[32],"lefts":[32]},[[2,"click","handleClick"]],{"value":[{"updateChildrenClasses":0},{"calculateIndicatorSizes":0}]}]]],["scout-tabs-tab.cjs",[[273,"scout-tabs-tab"]]],["scout-checkbox_2.cjs",[[514,"scout-checkbox",{"validity":[1],"checked":[4],"disabled":[4],"ariaLabelledby":[1,"aria-labelledby"],"label":[1],"value":[1],"name":[1],"ariaId":[32]},null,{"validity":[{"runValidation":0}]}],[514,"scout-radio-button",{"validity":[1],"checked":[4],"disabled":[4],"ariaLabelledby":[1,"aria-labelledby"],"label":[1],"value":[1],"name":[1],"ariaId":[32]},null,{"validity":[{"runValidation":0}]}]]]], options);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
exports.setNonce = index.setNonce;
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"components/radio-button/radio-button.js",
|
|
18
18
|
"components/select/select.js",
|
|
19
19
|
"components/stack/stack.js",
|
|
20
|
-
"components/switch/switch.js"
|
|
20
|
+
"components/switch/switch.js",
|
|
21
|
+
"components/tabs/tabs.js",
|
|
22
|
+
"components/tabs-tab/tabs-tab.js"
|
|
21
23
|
],
|
|
22
24
|
"compiler": {
|
|
23
25
|
"name": "@stencil/core",
|
|
@@ -35,7 +35,7 @@ export class ScoutField {
|
|
|
35
35
|
this.errorHidden = false;
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
|
-
return (h("div", { key: '
|
|
38
|
+
return (h("div", { key: 'b2b20acd9c1e41294bfbb8ce7e450e23142c5606', class: "field" }, h("label", { key: '7b375df7d5a5e4bbe44ae963775c58a6c27b5479', htmlFor: this.inputId, class: "label" }, this.label), h("slot", { key: 'c5783c044aa82977cd21a56df4f838af95bc0bf3' }), h("p", { key: '38df5a4f28432e046bb95fed66d6c1972e1d7adc', class: "error-text", "aria-live": "polite" }, !this.errorHidden && this.errorText), this.helpText && h("p", { key: '1f84da3fad92b45ac1cf3b8d1fad75276b7f8359', class: "help-text" }, this.helpText)));
|
|
39
39
|
}
|
|
40
40
|
static get is() { return "scout-field"; }
|
|
41
41
|
static get encapsulation() { return "scoped"; }
|
|
@@ -107,7 +107,7 @@ export class ScoutField {
|
|
|
107
107
|
"capture": false,
|
|
108
108
|
"passive": false
|
|
109
109
|
}, {
|
|
110
|
-
"name": "
|
|
110
|
+
"name": "_scoutValidityChanged",
|
|
111
111
|
"method": "handleValidation",
|
|
112
112
|
"target": undefined,
|
|
113
113
|
"capture": false,
|
|
@@ -21,7 +21,7 @@ export class ScoutSelect extends Mixin(inputMixin) {
|
|
|
21
21
|
disabled = false;
|
|
22
22
|
name;
|
|
23
23
|
render() {
|
|
24
|
-
return (h("div", { key: '12bf95188935ab6b11101c829970800199b53e9a', class: "select-wrapper" }, h("select", { key: '
|
|
24
|
+
return (h("div", { key: '12bf95188935ab6b11101c829970800199b53e9a', class: "select-wrapper" }, h("select", { key: '23b78d816a0f95c659ce2d97fadd7e7ca413c521', ref: (el) => this.setInputRef(el), id: this.ariaId, name: this.name, class: "select", disabled: this.disabled, onChange: () => this.onInput(), onBlur: () => this.onBlur(), onInvalid: () => this.onInvalid() }, h("slot", { key: '652f8938b7bc8c32e2a2976e024e36a07afc8f5a' })), h("span", { key: 'f2e2dd4d5266145c6a854a3e5610c887d7e1e259', class: "select-icon", style: { "--icon-chevron": `url(${chevronIcon})` }, "aria-hidden": "true" })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "scout-select"; }
|
|
27
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
height: var(--spacing-12);
|
|
6
|
+
--tabs-indicator-height: 2px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.indicator {
|
|
10
|
+
position: absolute;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
width: 0;
|
|
14
|
+
height: var(--tabs-indicator-height);
|
|
15
|
+
background-color: var(--color-background-brand-base);
|
|
16
|
+
transition: all 0.3s ease;
|
|
17
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* The tabs component is used to create a tabbed interface. It manages the state
|
|
4
|
+
* of which tab is active and displays an indicator under the active tab. Use
|
|
5
|
+
* `ScoutTabsTab` components to define the individual tabs.
|
|
6
|
+
*
|
|
7
|
+
* Currently there is no support for navigational tabs. Navigation has to be
|
|
8
|
+
* handled programmatically for now.
|
|
9
|
+
*/
|
|
10
|
+
export class ScoutTabs {
|
|
11
|
+
el;
|
|
12
|
+
/**
|
|
13
|
+
* Zero-based index of the currently active tab.
|
|
14
|
+
*/
|
|
15
|
+
value = 0;
|
|
16
|
+
/**
|
|
17
|
+
* Emitted when the active tab changes as a result of a user click.
|
|
18
|
+
* The `value` in the event detail is the zero-based index of the newly selected tab.
|
|
19
|
+
*/
|
|
20
|
+
scoutChange;
|
|
21
|
+
widths = [];
|
|
22
|
+
lefts = [];
|
|
23
|
+
render() {
|
|
24
|
+
return (h(Host, { key: 'dffbae0bba3543f50cbe7046bad52c7bdff7ba55' }, h("slot", { key: 'cad95b2ae6c8b2bc659bfa6510c0b193d2e08dd9' }), this.getIndicator()));
|
|
25
|
+
}
|
|
26
|
+
componentDidLoad() {
|
|
27
|
+
this.updateChildrenClasses();
|
|
28
|
+
this.calculateIndicatorSizes();
|
|
29
|
+
}
|
|
30
|
+
getIndicator() {
|
|
31
|
+
const width = this.widths[this.value] || 0;
|
|
32
|
+
const left = this.lefts[this.value] || 0;
|
|
33
|
+
const indicatorStyle = {
|
|
34
|
+
width: `${width}px`,
|
|
35
|
+
transform: `translateX(${left}px)`,
|
|
36
|
+
};
|
|
37
|
+
return h("div", { "aria-hidden": "true", class: "indicator", style: indicatorStyle });
|
|
38
|
+
}
|
|
39
|
+
handleClick(event) {
|
|
40
|
+
const target = event.target;
|
|
41
|
+
const tabs = Array.from(this.el.children);
|
|
42
|
+
const clickedIndex = tabs.indexOf(target);
|
|
43
|
+
if (clickedIndex !== -1 && clickedIndex !== this.value) {
|
|
44
|
+
this.scoutChange.emit({ value: clickedIndex });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
updateChildrenClasses() {
|
|
48
|
+
Array.from(this.el.children).forEach((child, index) => {
|
|
49
|
+
const tab = child;
|
|
50
|
+
if (index === this.value) {
|
|
51
|
+
tab.setAttribute("data-active", "true");
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
tab.removeAttribute("data-active");
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
calculateIndicatorSizes() {
|
|
59
|
+
this.widths = Array.from(this.el.children).map((child) => child.offsetWidth);
|
|
60
|
+
this.lefts = this.widths.map((_, index) => this.widths.slice(0, index).reduce((acc, w) => acc + w, 0));
|
|
61
|
+
}
|
|
62
|
+
static get is() { return "scout-tabs"; }
|
|
63
|
+
static get encapsulation() { return "shadow"; }
|
|
64
|
+
static get delegatesFocus() { return true; }
|
|
65
|
+
static get originalStyleUrls() {
|
|
66
|
+
return {
|
|
67
|
+
"$": ["tabs.css"]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static get styleUrls() {
|
|
71
|
+
return {
|
|
72
|
+
"$": ["tabs.css"]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
static get properties() {
|
|
76
|
+
return {
|
|
77
|
+
"value": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"mutable": false,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "number",
|
|
82
|
+
"resolved": "number",
|
|
83
|
+
"references": {}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": "Zero-based index of the currently active tab."
|
|
90
|
+
},
|
|
91
|
+
"getter": false,
|
|
92
|
+
"setter": false,
|
|
93
|
+
"reflect": false,
|
|
94
|
+
"attribute": "value",
|
|
95
|
+
"defaultValue": "0"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
static get states() {
|
|
100
|
+
return {
|
|
101
|
+
"widths": {},
|
|
102
|
+
"lefts": {}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static get events() {
|
|
106
|
+
return [{
|
|
107
|
+
"method": "scoutChange",
|
|
108
|
+
"name": "scoutChange",
|
|
109
|
+
"bubbles": true,
|
|
110
|
+
"cancelable": true,
|
|
111
|
+
"composed": true,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": "Emitted when the active tab changes as a result of a user click.\nThe `value` in the event detail is the zero-based index of the newly selected tab."
|
|
115
|
+
},
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "{ value: number }",
|
|
118
|
+
"resolved": "{ value: number; }",
|
|
119
|
+
"references": {}
|
|
120
|
+
}
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
123
|
+
static get elementRef() { return "el"; }
|
|
124
|
+
static get watchers() {
|
|
125
|
+
return [{
|
|
126
|
+
"propName": "value",
|
|
127
|
+
"methodName": "updateChildrenClasses"
|
|
128
|
+
}, {
|
|
129
|
+
"propName": "value",
|
|
130
|
+
"methodName": "calculateIndicatorSizes"
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
static get listeners() {
|
|
134
|
+
return [{
|
|
135
|
+
"name": "click",
|
|
136
|
+
"method": "handleClick",
|
|
137
|
+
"target": undefined,
|
|
138
|
+
"capture": true,
|
|
139
|
+
"passive": false
|
|
140
|
+
}];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
flex: 1;
|
|
3
|
+
display: block;
|
|
4
|
+
width: auto;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.button-native {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: block;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
color: var(--color-gray-600);
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
border: none;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
padding: var(--spacing-1) var(--spacing-1)
|
|
17
|
+
calc(var(--spacing-1) + var(--tabs-indicator-height)) var(--spacing-1);
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
text-transform: uppercase;
|
|
20
|
+
font-size: 0.875rem;
|
|
21
|
+
letter-spacing: 0.04em;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.inner-container {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
border-radius: var(--spacing-2);
|
|
31
|
+
background-color: transparent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.button-native:hover {
|
|
35
|
+
color: var(--color-text-base);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.button-native:hover .inner-container {
|
|
39
|
+
background-color: var(--color-background-brand-subtle-hovered);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([data-active]) .button-native {
|
|
43
|
+
color: var(--color-text-base);
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class ScoutTabsTab {
|
|
3
|
+
render() {
|
|
4
|
+
return (h("button", { key: '59f92f5a3d9b5a022a78d9adc7756bda10b68be3', class: "button-native", type: "button" }, h("div", { key: '96fc99711da308360451041dd44e21391c08d6eb', class: "inner-container" }, h("slot", { key: '83234bf67c2605179c7d80febbc6d0fbff730670' }))));
|
|
5
|
+
}
|
|
6
|
+
static get is() { return "scout-tabs-tab"; }
|
|
7
|
+
static get encapsulation() { return "shadow"; }
|
|
8
|
+
static get delegatesFocus() { return true; }
|
|
9
|
+
static get originalStyleUrls() {
|
|
10
|
+
return {
|
|
11
|
+
"$": ["tabs-tab.css"]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static get styleUrls() {
|
|
15
|
+
return {
|
|
16
|
+
"$": ["tabs-tab.css"]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -4,17 +4,28 @@ export const inputMixin = (Base) => {
|
|
|
4
4
|
super();
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Custom validation
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Custom validation message. If set, the input is considered invalid by the
|
|
8
|
+
* browser, and if wrapped by a field component, the message is displayed.
|
|
9
|
+
* If not set, the input is considered valid.
|
|
10
|
+
*/
|
|
11
|
+
validity;
|
|
12
|
+
/**
|
|
13
|
+
* Event emitted when the input value changes. If you want to do custom
|
|
14
|
+
* validation, use the `scoutValidate` event instead to ensure forms are
|
|
15
|
+
* blocked by the browser when invalid.
|
|
10
16
|
*/
|
|
11
|
-
validate;
|
|
12
17
|
scoutInputChange;
|
|
13
18
|
scoutBlur;
|
|
19
|
+
/**
|
|
20
|
+
* Event emitted when the input needs to be validated. This is where you
|
|
21
|
+
* implement your custom validation. Set any possible validation message
|
|
22
|
+
* using the `validity` prop.
|
|
23
|
+
*/
|
|
24
|
+
scoutValidate;
|
|
14
25
|
/**
|
|
15
26
|
* Internal event used for form field validation.
|
|
16
27
|
*/
|
|
17
|
-
|
|
28
|
+
_scoutValidityChanged;
|
|
18
29
|
/**
|
|
19
30
|
* Internal event used for form field validation.
|
|
20
31
|
*/
|
|
@@ -30,10 +41,10 @@ export const inputMixin = (Base) => {
|
|
|
30
41
|
this._scoutFieldId.emit(this.ariaId);
|
|
31
42
|
}
|
|
32
43
|
componentDidLoad() {
|
|
33
|
-
this.
|
|
44
|
+
this.emitValidityEvent();
|
|
34
45
|
}
|
|
35
46
|
onInput() {
|
|
36
|
-
this.
|
|
47
|
+
this.emitValidityEvent();
|
|
37
48
|
this.scoutInputChange.emit({
|
|
38
49
|
value: this.inputElement.value,
|
|
39
50
|
element: this.inputElement,
|
|
@@ -45,35 +56,39 @@ export const inputMixin = (Base) => {
|
|
|
45
56
|
onInvalid() {
|
|
46
57
|
this._scoutInvalid.emit();
|
|
47
58
|
}
|
|
59
|
+
emitValidityEvent() {
|
|
60
|
+
this.scoutValidate.emit({
|
|
61
|
+
value: this.inputElement.value,
|
|
62
|
+
element: this.inputElement,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
48
65
|
runValidation() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
const validationMessage = this.validate(this.inputElement.value);
|
|
53
|
-
this.inputElement.setCustomValidity(validationMessage ?? "");
|
|
54
|
-
this._scoutValidate.emit({ element: this.inputElement });
|
|
66
|
+
this.inputElement.setCustomValidity(this.validity ?? "");
|
|
67
|
+
this._scoutValidityChanged.emit({ element: this.inputElement });
|
|
55
68
|
}
|
|
56
69
|
setInputRef(el) {
|
|
57
70
|
this.inputElement = el;
|
|
58
71
|
}
|
|
59
72
|
static get properties() {
|
|
60
73
|
return {
|
|
61
|
-
"
|
|
62
|
-
"type": "
|
|
74
|
+
"validity": {
|
|
75
|
+
"type": "string",
|
|
63
76
|
"mutable": false,
|
|
64
77
|
"complexType": {
|
|
65
|
-
"original": "
|
|
66
|
-
"resolved": "
|
|
78
|
+
"original": "string",
|
|
79
|
+
"resolved": "string",
|
|
67
80
|
"references": {}
|
|
68
81
|
},
|
|
69
82
|
"required": false,
|
|
70
83
|
"optional": true,
|
|
71
84
|
"docs": {
|
|
72
85
|
"tags": [],
|
|
73
|
-
"text": "Custom validation
|
|
86
|
+
"text": "Custom validation message. If set, the input is considered invalid by the\nbrowser, and if wrapped by a field component, the message is displayed.\nIf not set, the input is considered valid."
|
|
74
87
|
},
|
|
75
88
|
"getter": false,
|
|
76
|
-
"setter": false
|
|
89
|
+
"setter": false,
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"attribute": "validity"
|
|
77
92
|
}
|
|
78
93
|
};
|
|
79
94
|
}
|
|
@@ -91,7 +106,7 @@ export const inputMixin = (Base) => {
|
|
|
91
106
|
"composed": true,
|
|
92
107
|
"docs": {
|
|
93
108
|
"tags": [],
|
|
94
|
-
"text": ""
|
|
109
|
+
"text": "Event emitted when the input value changes. If you want to do custom\nvalidation, use the `scoutValidate` event instead to ensure forms are\nblocked by the browser when invalid."
|
|
95
110
|
},
|
|
96
111
|
"complexType": {
|
|
97
112
|
"original": "{\n value: string;\n element: HTMLElement;\n }",
|
|
@@ -119,8 +134,28 @@ export const inputMixin = (Base) => {
|
|
|
119
134
|
"references": {}
|
|
120
135
|
}
|
|
121
136
|
}, {
|
|
122
|
-
"method": "
|
|
123
|
-
"name": "
|
|
137
|
+
"method": "scoutValidate",
|
|
138
|
+
"name": "scoutValidate",
|
|
139
|
+
"bubbles": true,
|
|
140
|
+
"cancelable": true,
|
|
141
|
+
"composed": true,
|
|
142
|
+
"docs": {
|
|
143
|
+
"tags": [],
|
|
144
|
+
"text": "Event emitted when the input needs to be validated. This is where you\nimplement your custom validation. Set any possible validation message\nusing the `validity` prop."
|
|
145
|
+
},
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "{\n value: string;\n element: HTMLElement;\n }",
|
|
148
|
+
"resolved": "{ value: string; element: HTMLElement; }",
|
|
149
|
+
"references": {
|
|
150
|
+
"HTMLElement": {
|
|
151
|
+
"location": "global",
|
|
152
|
+
"id": "global::HTMLElement"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
"method": "_scoutValidityChanged",
|
|
158
|
+
"name": "_scoutValidityChanged",
|
|
124
159
|
"bubbles": true,
|
|
125
160
|
"cancelable": true,
|
|
126
161
|
"composed": true,
|
|
@@ -170,6 +205,12 @@ export const inputMixin = (Base) => {
|
|
|
170
205
|
}
|
|
171
206
|
}];
|
|
172
207
|
}
|
|
208
|
+
static get watchers() {
|
|
209
|
+
return [{
|
|
210
|
+
"propName": "validity",
|
|
211
|
+
"methodName": "runValidation"
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
173
214
|
}
|
|
174
215
|
return InputMixin;
|
|
175
216
|
};
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-CXXyN7aY.js";function t(s,t,e){return(s||"")+(t?" "+t:"")+(e?" "+e:"")}export{t as format}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as o,M as a,c as t,h as e,t as r}from"./p-CXXyN7aY.js";import{i as s}from"./p-DxVqa2PR.js";const i=o(class extends(a(s)){constructor(o){super(!1),!1!==o&&this.__registerHost(),this.scoutInputChange=t(this,"scoutInputChange"),this.scoutBlur=t(this,"scoutBlur"),this.scoutValidate=t(this,"scoutValidate"),this._scoutValidityChanged=t(this,"_scoutValidityChanged"),this._scoutInvalid=t(this,"_scoutInvalid"),this._scoutFieldId=t(this,"_scoutFieldId"),this.scoutChecked=t(this,"scoutChecked")}checked=!1;disabled=!1;ariaLabelledby;label;value;name;scoutChecked;onChange(o){const a=o.target;this.scoutChecked.emit({checked:a.checked,element:a})}render(){return e(this.label?.length?"label":"div",{key:"22df090dcbf2f2b4b14b7cad8d34500295045f70"},e("input",{key:"3bcc5022fa6202fd1fe733c1a8430f7ed1a54cf4",ref:o=>this.setInputRef(o),id:this.ariaId,type:"radio",value:this.value,name:this.name,class:"radio","aria-labelledby":this.ariaLabelledby,"aria-disabled":this.disabled,disabled:this.disabled,checked:this.checked,onChange:o=>{this.onInput(),this.onChange(o)},onBlur:()=>this.onBlur(),onInvalid:()=>this.onInvalid()}),this.label)}static get watchers(){return{validity:[{runValidation:0}]}}static get style(){return'.radio.sc-scout-radio-button{width:var(--spacing-6);height:var(--spacing-6);-moz-appearance:none;appearance:none;-webkit-appearance:none;display:flex;align-content:center;justify-content:center;border-radius:100%;background-color:var(--color-white);border:2px solid var(--color-gray-300);position:relative}@media (hover: hover){.radio.sc-scout-radio-button:hover{border:2px solid var(--color-gray-400);box-shadow:inset 0px 0px 5px 5px var(--color-background-brand-subtle-hovered);cursor:pointer}}.radio.sc-scout-radio-button:active{background-color:var(--color-background-brand-subtle-pressed)}@media (hover: hover){.radio.sc-scout-radio-button:checked:hover{border-color:var(--color-background-brand-hovered);box-shadow:none}.radio.sc-scout-radio-button:checked:hover::before{background-color:var(--color-background-brand-hovered)}}.radio.sc-scout-radio-button:checked{border-color:var(--color-background-brand-base)}.radio.sc-scout-radio-button::after{content:"";position:absolute;width:var(--spacing-10);height:var(--spacing-10);top:50%;left:50%;transform:translate(-50%, -50%)}.radio.sc-scout-radio-button:checked::before{content:"";background-color:var(--color-background-brand-base);width:var(--spacing-4);height:var(--spacing-4);position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);border-radius:100%}.radio.sc-scout-radio-button:disabled{pointer-events:none;background-color:var(--color-gray-100);border-color:var(--color-gray-100)}label.sc-scout-radio-button{display:flex;align-items:center;gap:var(--spacing-2);font:var(--type-label-base);color:var(--color-text-base)}'}},[514,"scout-radio-button",{validity:[1],checked:[4],disabled:[4],ariaLabelledby:[1,"aria-labelledby"],label:[1],value:[1],name:[1],ariaId:[32]},void 0,{validity:[{runValidation:0}]}]);function c(){"undefined"!=typeof customElements&&["scout-radio-button"].forEach((o=>{"scout-radio-button"===o&&(customElements.get(r(o))||customElements.define(r(o),i))}))}export{i as S,c as d}
|