@api-client/ui 0.3.2 → 0.3.4
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/build/src/elements/environment/EnvironmentEditor.d.ts.map +1 -1
- package/build/src/elements/environment/EnvironmentEditor.js +8 -6
- package/build/src/elements/environment/EnvironmentEditor.js.map +1 -1
- package/build/src/elements/har/HarViewer.d.ts.map +1 -1
- package/build/src/elements/har/HarViewer.js +13 -15
- package/build/src/elements/har/HarViewer.js.map +1 -1
- package/build/src/elements/http/RequestEditor.d.ts +2 -1
- package/build/src/elements/http/RequestEditor.d.ts.map +1 -1
- package/build/src/elements/http/RequestEditor.js +17 -12
- package/build/src/elements/http/RequestEditor.js.map +1 -1
- package/build/src/elements/http/RequestLog.d.ts.map +1 -1
- package/build/src/elements/http/RequestLog.js +34 -8
- package/build/src/elements/http/RequestLog.js.map +1 -1
- package/build/src/md/button/internals/base.d.ts.map +1 -1
- package/build/src/md/button/internals/base.js +2 -6
- package/build/src/md/button/internals/base.js.map +1 -1
- package/build/src/md/button/internals/button.styles.js +4 -4
- package/build/src/md/button/internals/button.styles.js.map +1 -1
- package/build/src/md/chip/internals/Chip.d.ts +11 -15
- package/build/src/md/chip/internals/Chip.d.ts.map +1 -1
- package/build/src/md/chip/internals/Chip.js +66 -104
- package/build/src/md/chip/internals/Chip.js.map +1 -1
- package/build/src/md/chip/internals/Chip.styles.d.ts.map +1 -1
- package/build/src/md/chip/internals/Chip.styles.js +114 -101
- package/build/src/md/chip/internals/Chip.styles.js.map +1 -1
- package/build/src/md/chip/internals/ChipSet.d.ts +16 -0
- package/build/src/md/chip/internals/ChipSet.d.ts.map +1 -0
- package/build/src/md/chip/internals/ChipSet.js +138 -0
- package/build/src/md/chip/internals/ChipSet.js.map +1 -0
- package/build/src/md/chip/internals/ChipSet.styles.d.ts +3 -0
- package/build/src/md/chip/internals/ChipSet.styles.d.ts.map +1 -0
- package/build/src/md/chip/internals/ChipSet.styles.js +9 -0
- package/build/src/md/chip/internals/ChipSet.styles.js.map +1 -0
- package/build/src/md/chip/ui-chip-set.d.ts +11 -0
- package/build/src/md/chip/ui-chip-set.d.ts.map +1 -0
- package/build/src/md/chip/ui-chip-set.js +27 -0
- package/build/src/md/chip/ui-chip-set.js.map +1 -0
- package/build/src/md/motion/animation.d.ts +5 -3
- package/build/src/md/motion/animation.d.ts.map +1 -1
- package/build/src/md/motion/animation.js +4 -2
- package/build/src/md/motion/animation.js.map +1 -1
- package/build/src/md/ripple/internals/ripple.styles.d.ts.map +1 -1
- package/build/src/md/ripple/internals/ripple.styles.js +20 -8
- package/build/src/md/ripple/internals/ripple.styles.js.map +1 -1
- package/build/src/md/switch/internals/Switch.styles.js +1 -1
- package/build/src/md/switch/internals/Switch.styles.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.d.ts +25 -9
- package/build/src/md/tabs/internals/Tab.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.js +122 -53
- package/build/src/md/tabs/internals/Tab.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.styles.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.styles.js +69 -64
- package/build/src/md/tabs/internals/Tab.styles.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.d.ts +52 -54
- package/build/src/md/tabs/internals/Tabs.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tabs.js +270 -330
- package/build/src/md/tabs/internals/Tabs.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.styles.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tabs.styles.js +13 -17
- package/build/src/md/tabs/internals/Tabs.styles.js.map +1 -1
- package/demo/md/chip/chip.html +33 -6
- package/demo/md/chip/chip.ts +111 -56
- package/demo/md/tabs/tabs.html +19 -0
- package/demo/md/tabs/tabs.ts +133 -83
- package/package.json +1 -1
- package/src/elements/environment/EnvironmentEditor.ts +8 -6
- package/src/elements/har/HarViewer.ts +13 -15
- package/src/elements/http/RequestEditor.ts +18 -13
- package/src/elements/http/RequestLog.ts +34 -8
- package/src/md/button/internals/base.ts +2 -6
- package/src/md/button/internals/button.styles.ts +4 -4
- package/src/md/chip/internals/Chip.styles.ts +114 -101
- package/src/md/chip/internals/Chip.ts +58 -88
- package/src/md/chip/internals/ChipSet.styles.ts +9 -0
- package/src/md/chip/internals/ChipSet.ts +142 -0
- package/src/md/chip/ui-chip-set.ts +15 -0
- package/src/md/motion/animation.ts +4 -2
- package/src/md/ripple/internals/ripple.styles.ts +20 -8
- package/src/md/switch/internals/Switch.styles.ts +1 -1
- package/src/md/tabs/internals/Tab.styles.ts +69 -64
- package/src/md/tabs/internals/Tab.ts +126 -43
- package/src/md/tabs/internals/Tabs.styles.ts +13 -17
- package/src/md/tabs/internals/Tabs.ts +259 -305
- package/test/elements/har/HarViewerElement.test.ts +1 -55
- package/test/ui/chip/UiChip.test.ts +18 -67
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import Element from './internals/ChipSet.js';
|
|
4
|
+
import styles from './internals/ChipSet.styles.js';
|
|
5
|
+
let UiChipSetElement = (() => {
|
|
6
|
+
let _classDecorators = [customElement('ui-chip-set')];
|
|
7
|
+
let _classDescriptor;
|
|
8
|
+
let _classExtraInitializers = [];
|
|
9
|
+
let _classThis;
|
|
10
|
+
let _classSuper = Element;
|
|
11
|
+
var UiChipSetElement = class extends _classSuper {
|
|
12
|
+
static { _classThis = this; }
|
|
13
|
+
static {
|
|
14
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
15
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
16
|
+
UiChipSetElement = _classThis = _classDescriptor.value;
|
|
17
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
18
|
+
}
|
|
19
|
+
static styles = [styles];
|
|
20
|
+
static {
|
|
21
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return UiChipSetElement = _classThis;
|
|
25
|
+
})();
|
|
26
|
+
export { UiChipSetElement };
|
|
27
|
+
//# sourceMappingURL=ui-chip-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-chip-set.js","sourceRoot":"","sources":["../../../../src/md/chip/ui-chip-set.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,wBAAwB,CAAA;AAC5C,OAAO,MAAM,MAAM,+BAA+B,CAAA;IAGrC,gBAAgB;4BAD5B,aAAa,CAAC,aAAa,CAAC;;;;sBACS,OAAO;gCAAf,SAAQ,WAAO;;;;YAA7C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAgB;;;;;SAAhB,gBAAgB","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/ChipSet.js'\nimport styles from './internals/ChipSet.styles.js'\n\n@customElement('ui-chip-set')\nexport class UiChipSetElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-chip-set': UiChipSetElement\n }\n}\n"]}
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export declare enum Easing {
|
|
10
10
|
STANDARD = "cubic-bezier(0.2, 0, 0, 1)",
|
|
11
|
-
ACCELERATION = "cubic-bezier(0.
|
|
12
|
-
DECELERATION = "cubic-bezier(0, 0, 0
|
|
13
|
-
SHARP = "cubic-bezier(0.4, 0, 0.6, 1)"
|
|
11
|
+
ACCELERATION = "cubic-bezier(0.3, 0, 1, 1)",
|
|
12
|
+
DECELERATION = "cubic-bezier(0, 0, 0, 1)",
|
|
13
|
+
SHARP = "cubic-bezier(0.4, 0, 0.6, 1)",
|
|
14
|
+
EMPHASIZED_ACCELERATE = "cubic-bezier(0.3, 0, 0.8, 0.15)",
|
|
15
|
+
EMPHASIZED_DECELERATE = "cubic-bezier(0.05, 0.7, 0.1, 1)"
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* A signal that is used for abortable tasks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../src/md/motion/animation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,MAAM;IAChB,QAAQ,+BAA+B;IACvC,YAAY,+BAA+B;IAC3C,YAAY
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../src/md/motion/animation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,MAAM;IAChB,QAAQ,+BAA+B;IACvC,YAAY,+BAA+B;IAC3C,YAAY,6BAA6B;IACzC,KAAK,iCAAiC;IACtC,qBAAqB,oCAAoC;IACzD,qBAAqB,oCAAoC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,KAAK,IAAI,WAAW,CAAA;IACpB;;OAEG;IACH,MAAM,IAAI,IAAI,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAkBvD"}
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
export var Easing;
|
|
10
10
|
(function (Easing) {
|
|
11
11
|
Easing["STANDARD"] = "cubic-bezier(0.2, 0, 0, 1)";
|
|
12
|
-
Easing["ACCELERATION"] = "cubic-bezier(0.
|
|
13
|
-
Easing["DECELERATION"] = "cubic-bezier(0, 0, 0
|
|
12
|
+
Easing["ACCELERATION"] = "cubic-bezier(0.3, 0, 1, 1)";
|
|
13
|
+
Easing["DECELERATION"] = "cubic-bezier(0, 0, 0, 1)";
|
|
14
14
|
Easing["SHARP"] = "cubic-bezier(0.4, 0, 0.6, 1)";
|
|
15
|
+
Easing["EMPHASIZED_ACCELERATE"] = "cubic-bezier(0.3, 0, 0.8, 0.15)";
|
|
16
|
+
Easing["EMPHASIZED_DECELERATE"] = "cubic-bezier(0.05, 0.7, 0.1, 1)";
|
|
15
17
|
})(Easing || (Easing = {}));
|
|
16
18
|
/**
|
|
17
19
|
* Creates an `AnimationSignal` that can be used to cancel a previous task.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../../src/md/motion/animation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../../src/md/motion/animation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,MAOX;AAPD,WAAY,MAAM;IAChB,iDAAuC,CAAA;IACvC,qDAA2C,CAAA;IAC3C,mDAAyC,CAAA;IACzC,gDAAsC,CAAA;IACtC,mEAAyD,CAAA;IACzD,mEAAyD,CAAA;AAC3D,CAAC,EAPW,MAAM,KAAN,MAAM,QAOjB;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,qBAAqB;IACnC,0CAA0C;IAC1C,IAAI,wBAAwB,GAA2B,IAAI,CAAA;IAE3D,OAAO;QACL,KAAK;YACH,yCAAyC;YACzC,wBAAwB,EAAE,KAAK,EAAE,CAAA;YACjC,0DAA0D;YAC1D,wBAAwB,GAAG,IAAI,eAAe,EAAE,CAAA;YAChD,sEAAsE;YACtE,qBAAqB;YACrB,OAAO,wBAAwB,CAAC,MAAM,CAAA;QACxC,CAAC;QACD,MAAM;YACJ,wBAAwB,GAAG,IAAI,CAAA;QACjC,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Easing functions to use for web animations.\n */\nexport enum Easing {\n STANDARD = 'cubic-bezier(0.2, 0, 0, 1)',\n ACCELERATION = 'cubic-bezier(0.3, 0, 1, 1)',\n DECELERATION = 'cubic-bezier(0, 0, 0, 1)',\n SHARP = 'cubic-bezier(0.4, 0, 0.6, 1)',\n EMPHASIZED_ACCELERATE = 'cubic-bezier(0.3, 0, 0.8, 0.15)',\n EMPHASIZED_DECELERATE = 'cubic-bezier(0.05, 0.7, 0.1, 1)',\n}\n\n/**\n * A signal that is used for abortable tasks.\n */\nexport interface AnimationSignal {\n /**\n * Starts the abortable task. Any previous tasks started with this instance\n * will be aborted.\n *\n * @return An `AbortSignal` for the current task.\n */\n start(): AbortSignal\n /**\n * Complete the current task.\n */\n finish(): void\n}\n\n/**\n * Creates an `AnimationSignal` that can be used to cancel a previous task.\n *\n * @example\n * class MyClass {\n * private labelAnimationSignal = createAnimationSignal();\n *\n * private async animateLabel() {\n * // Start of the task. Previous tasks will be canceled.\n * const signal = this.labelAnimationSignal.start();\n *\n * // Do async work...\n * if (signal.aborted) {\n * // Use AbortSignal to check if a request was made to abort after some\n * // asynchronous work.\n * return;\n * }\n *\n * const animation = this.animate(...);\n * // Add event listeners to be notified when the task should be canceled.\n * signal.addEventListener('abort', () => {\n * animation.cancel();\n * });\n *\n * animation.addEventListener('finish', () => {\n * // Tell the signal that the current task is finished.\n * this.labelAnimationSignal.finish();\n * });\n * }\n * }\n *\n * @return An `AnimationSignal`.\n */\nexport function createAnimationSignal(): AnimationSignal {\n // The current animation's AbortController\n let animationAbortController: AbortController | null = null\n\n return {\n start(): AbortSignal {\n // Tell the previous animation to cancel.\n animationAbortController?.abort()\n // Set up a new AbortController for the current animation.\n animationAbortController = new AbortController()\n // Provide the AbortSignal so that the caller can check aborted status\n // and add listeners.\n return animationAbortController.signal\n },\n finish(): void {\n animationAbortController = null\n },\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/ripple/internals/ripple.styles.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"ripple.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/ripple/internals/ripple.styles.ts"],"names":[],"mappings":";AAEA,wBAoFC"}
|
|
@@ -21,7 +21,8 @@ export default css `
|
|
|
21
21
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.surface::before
|
|
24
|
+
.surface::before,
|
|
25
|
+
.surface::after {
|
|
25
26
|
position: absolute;
|
|
26
27
|
opacity: 0;
|
|
27
28
|
pointer-events: none;
|
|
@@ -36,10 +37,19 @@ export default css `
|
|
|
36
37
|
inset: 0;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
.surface::after {
|
|
41
|
+
transition: opacity 375ms linear;
|
|
42
|
+
transform-origin: center center;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
.focused::before {
|
|
40
46
|
transition-duration: 75ms;
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
.pressed::after {
|
|
50
|
+
transition-duration: 105ms;
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
.surface {
|
|
44
54
|
border-radius: var(--md-ripple-state-layer-shape, 0);
|
|
45
55
|
}
|
|
@@ -48,6 +58,14 @@ export default css `
|
|
|
48
58
|
background-color: var(--md-ripple-hover-state-layer-color, var(--md-sys-color-primary));
|
|
49
59
|
}
|
|
50
60
|
|
|
61
|
+
.surface::after {
|
|
62
|
+
background: radial-gradient(
|
|
63
|
+
closest-side,
|
|
64
|
+
var(--md-ripple-pressed-state-layer-color, var(--md-sys-color-primary)) max(100% - 70px, 65%),
|
|
65
|
+
transparent 100%
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
51
69
|
.surface.hovered::before {
|
|
52
70
|
opacity: var(--md-ripple-hover-state-layer-opacity, var(--md-sys-state-hover-state-layer-opacity));
|
|
53
71
|
background-color: var(--md-ripple-hover-state-layer-color, var(--md-sys-color-primary));
|
|
@@ -58,14 +76,8 @@ export default css `
|
|
|
58
76
|
background-color: var(--md-ripple-focus-state-layer-color, var(--md-sys-color-primary));
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
.surface.pressed::
|
|
79
|
+
.surface.pressed::after {
|
|
62
80
|
opacity: var(--md-ripple-pressed-state-layer-opacity, var(--md-sys-state-pressed-state-layer-opacity));
|
|
63
|
-
/* background-color: var(--md-ripple-pressed-state-layer-color, var(--md-sys-color-primary)); */
|
|
64
|
-
background: radial-gradient(
|
|
65
|
-
closest-side,
|
|
66
|
-
var(--md-ripple-pressed-state-layer-color, var(--md-sys-color-primary)) max(100% - 70px, 65%),
|
|
67
|
-
transparent 100%
|
|
68
|
-
);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
.surface.unbounded {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple.styles.js","sourceRoot":"","sources":["../../../../../src/md/ripple/internals/ripple.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"ripple.styles.js","sourceRoot":"","sources":["../../../../../src/md/ripple/internals/ripple.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: hidden;\n display: flex;\n }\n\n :host([disabled]) {\n opacity: 0;\n }\n\n .surface {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: hidden;\n outline: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n\n .surface::before,\n .surface::after {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n z-index: -1;\n content: '';\n }\n\n .surface::before {\n transition:\n opacity 15ms linear,\n background-color 15ms linear;\n inset: 0;\n }\n\n .surface::after {\n transition: opacity 375ms linear;\n transform-origin: center center;\n }\n\n .focused::before {\n transition-duration: 75ms;\n }\n\n .pressed::after {\n transition-duration: 105ms;\n }\n\n .surface {\n border-radius: var(--md-ripple-state-layer-shape, 0);\n }\n\n .surface::before {\n background-color: var(--md-ripple-hover-state-layer-color, var(--md-sys-color-primary));\n }\n\n .surface::after {\n background: radial-gradient(\n closest-side,\n var(--md-ripple-pressed-state-layer-color, var(--md-sys-color-primary)) max(100% - 70px, 65%),\n transparent 100%\n );\n }\n\n .surface.hovered::before {\n opacity: var(--md-ripple-hover-state-layer-opacity, var(--md-sys-state-hover-state-layer-opacity));\n background-color: var(--md-ripple-hover-state-layer-color, var(--md-sys-color-primary));\n }\n\n .surface.focused::before {\n opacity: var(--md-ripple-focus-state-layer-opacity, var(--md-sys-state-focus-state-layer-opacity));\n background-color: var(--md-ripple-focus-state-layer-color, var(--md-sys-color-primary));\n }\n\n .surface.pressed::after {\n opacity: var(--md-ripple-pressed-state-layer-opacity, var(--md-sys-state-pressed-state-layer-opacity));\n }\n\n .surface.unbounded {\n border-radius: var(--md-ripple-state-layer-shape, 9999px);\n }\n`\n"]}
|
|
@@ -34,7 +34,7 @@ export default css `
|
|
|
34
34
|
|
|
35
35
|
border: 2px var(--md-sys-color-outline) solid;
|
|
36
36
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
37
|
-
background-color: var(--md-sys-color-surface-
|
|
37
|
+
background-color: var(--md-sys-color-surface-container-highest);
|
|
38
38
|
|
|
39
39
|
transition:
|
|
40
40
|
opacity 90ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.styles.js","sourceRoot":"","sources":["../../../../../src/md/switch/internals/Switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmRjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: inline-block;\n vertical-align: middle;\n outline: none;\n width: 52px;\n height: 40px;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n .surface {\n position: relative;\n width: inherit;\n height: inherit;\n\n display: flex;\n align-items: center;\n }\n\n /* Track */\n .track {\n position: absolute;\n inset: 4px 0 0;\n z-index: 1;\n\n width: inherit;\n height: 32px;\n box-sizing: border-box;\n\n border: 2px var(--md-sys-color-outline) solid;\n border-radius: var(--md-sys-shape-corner-extra-large);\n background-color: var(--md-sys-color-surface-
|
|
1
|
+
{"version":3,"file":"Switch.styles.js","sourceRoot":"","sources":["../../../../../src/md/switch/internals/Switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmRjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: inline-block;\n vertical-align: middle;\n outline: none;\n width: 52px;\n height: 40px;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n .surface {\n position: relative;\n width: inherit;\n height: inherit;\n\n display: flex;\n align-items: center;\n }\n\n /* Track */\n .track {\n position: absolute;\n inset: 4px 0 0;\n z-index: 1;\n\n width: inherit;\n height: 32px;\n box-sizing: border-box;\n\n border: 2px var(--md-sys-color-outline) solid;\n border-radius: var(--md-sys-shape-corner-extra-large);\n background-color: var(--md-sys-color-surface-container-highest);\n\n transition:\n opacity 90ms cubic-bezier(0.4, 0, 0.2, 1),\n background-color 90ms cubic-bezier(0.4, 0, 0.2, 1),\n border-color 90ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .track.tracking,\n .thumb.tracking {\n transition: none;\n }\n\n .thumb {\n height: 20px;\n width: 20px;\n border-radius: var(--md-sys-shape-corner-full);\n background-color: var(--md-sys-color-outline);\n transform: translateX(6px) scale(0.8);\n transform-origin: center center;\n transition: transform 75ms cubic-bezier(0.4, 0, 0.2, 1) 0s;\n cursor: pointer;\n }\n\n :host([checked]) .thumb {\n background-color: var(--md-sys-color-on-primary);\n }\n\n .withIcon .thumb {\n transform: translateX(6px) scale(1.2);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n :host(:active) .thumb,\n .pressed .thumb {\n transform: translateX(6px) scale(1.4);\n }\n\n :host([checked]) .thumb,\n :host([checked]) .withIcon .thumb {\n transform: translateX(26px) scale(1.2);\n }\n\n :host([checked]:active) .thumb,\n :host([checked]) .pressed .thumb {\n transform: translateX(26px) scale(1.4);\n }\n\n .state {\n position: absolute;\n inset: 0;\n z-index: 2;\n width: 40px;\n height: 40px;\n border-radius: var(--md-sys-shape-corner-full);\n transform: translateX(-5px);\n transition: transform 90ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n :host([checked]) .state {\n transform: translateX(18px);\n cursor: pointer;\n }\n\n .content {\n z-index: 3;\n position: relative;\n }\n\n .icon {\n fill: var(--md-sys-color-surface-variant);\n width: 16px;\n height: 16px;\n }\n\n :host([checked]) .icon {\n fill: var(--md-sys-color-on-primary-container);\n }\n\n :host([checked]) .track {\n background-color: var(--md-sys-color-primary);\n border-width: 0;\n }\n\n /* Hover state */\n\n :host(:hover) .track {\n background-color: var(--md-sys-color-surface-variant);\n border-color: var(--md-sys-color-outline);\n }\n\n :host(:hover) .state {\n background-color: var(--md-sys-color-on-surface);\n opacity: var(--md-sys-state-hover-state-layer-opacity);\n }\n\n :host([checked]:hover) .track {\n background-color: var(--md-sys-color-primary);\n border-width: 0;\n }\n\n :host([checked]:hover) .state {\n background-color: var(--md-sys-color-primary);\n opacity: var(--md-sys-state-hover-state-layer-opacity);\n }\n\n :host(:hover) .thumb {\n background-color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([checked]:hover) .thumb {\n background-color: var(--md-sys-color-primary-container);\n }\n\n :host(:hover) .icon {\n fill: var(--md-sys-color-surface-variant);\n }\n\n :host([checked]:hover) .icon {\n fill: var(--md-sys-color-on-primary-container);\n }\n\n /* Focus state */\n\n :host(:focus) .track {\n background-color: var(--md-sys-color-surface-variant);\n border-color: var(--md-sys-color-outline);\n }\n\n :host([checked]:focus) .track {\n background-color: var(--md-sys-color-primary);\n border-width: 0;\n }\n\n :host(:focus) .state {\n background-color: var(--md-sys-color-on-surface);\n opacity: var(--md-sys-state-focus-state-layer-opacity);\n }\n\n :host([checked]:focus) .state {\n background-color: var(--md-sys-color-primary);\n opacity: var(--md-sys-state-focus-state-layer-opacity);\n }\n\n :host(:focus) .thumb {\n background-color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([checked]:focus) .thumb {\n background-color: var(--md-sys-color-primary-container);\n }\n\n :host(:focus) .icon {\n fill: var(--md-sys-color-surface-variant);\n }\n\n :host([checked]:focus) .icon {\n fill: var(--md-sys-color-on-primary-container);\n }\n\n /* Pressed state */\n\n :host(:active) .track,\n .pressed .track {\n background-color: var(--md-sys-color-surface-variant);\n border-color: var(--md-sys-color-outline);\n }\n\n :host([checked]:active) .track,\n :host([checked]) .pressed .track {\n background-color: var(--md-sys-color-primary);\n border-width: 0;\n }\n\n :host(:active) .state,\n .pressed .state {\n background-color: var(--md-sys-color-on-surface);\n opacity: var(--md-sys-state-pressed-state-layer-opacity);\n }\n\n :host([checked]:active) .state,\n :host([checked]) .pressed .state {\n background-color: var(--md-sys-color-primary);\n opacity: var(--md-sys-state-pressed-state-layer-opacity);\n }\n\n :host(:active) .thumb,\n .pressed .thumb {\n background-color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([checked]:active) .thumb,\n :host([checked]) .pressed .thumb {\n background-color: var(--md-sys-color-primary-container);\n }\n\n :host(:active) .icon,\n .pressed .icon {\n fill: var(--md-sys-color-surface-variant);\n }\n\n :host([checked]:active) .icon,\n :host([checked]) .pressed .icon {\n fill: var(--md-sys-color-on-primary-container);\n }\n\n /* Disabled state */\n\n :host([disabled]) .track {\n background-color: var(--md-sys-color-surface-variant);\n border-color: var(--md-sys-color-on-surface);\n opacity: 0.12;\n }\n\n :host([disabled][checked]) .track {\n background-color: var(--md-sys-color-on-surface);\n border-width: 0;\n }\n\n :host([disabled]) .thumb {\n background-color: var(--md-sys-color-on-surface);\n opacity: 0.38;\n }\n\n :host([disabled][checked]) .thumb {\n background-color: var(--md-sys-color-surface);\n opacity: 1;\n }\n\n :host([disabled]) .icon {\n fill: var(--md-sys-color-surface-variant);\n opacity: 0.38;\n }\n\n :host([disabled][checked]) .icon {\n fill: var(--md-sys-color-on-surface);\n opacity: 0.38;\n }\n`\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { nothing, TemplateResult } from 'lit';
|
|
2
|
-
import { EndPressConfig } from '../../../controllers/ActionController.js';
|
|
3
|
-
import UiRipple from '../../ripple/internals/ripple.js';
|
|
1
|
+
import { nothing, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import type { BeginPressConfig, EndPressConfig } from '../../../controllers/ActionController.js';
|
|
3
|
+
import type UiRipple from '../../ripple/internals/ripple.js';
|
|
4
4
|
import { UiElement } from '../../UiElement.js';
|
|
5
|
-
import type { TabsPriority } from './Tabs.js';
|
|
5
|
+
import type { SizingInfo, TabsPriority } from './Tabs.js';
|
|
6
6
|
import '../../ripple/ui-ripple.js';
|
|
7
7
|
export default class UiTab extends UiElement {
|
|
8
8
|
get disabled(): boolean;
|
|
@@ -25,24 +25,40 @@ export default class UiTab extends UiElement {
|
|
|
25
25
|
* @attribute
|
|
26
26
|
*/
|
|
27
27
|
accessor indicated: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether the tab has an icon.
|
|
30
|
+
* This is set automatically when the "icon" slot is populated.
|
|
31
|
+
*/
|
|
28
32
|
protected accessor hasIcon: boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Indicates whether the tab only has an icon and no text.
|
|
35
|
+
* This is set automatically when the default slot is populated with only an icon.
|
|
36
|
+
*/
|
|
37
|
+
protected accessor iconOnly: boolean;
|
|
38
|
+
protected accessor ripple: UiRipple | null;
|
|
32
39
|
constructor();
|
|
33
40
|
connectedCallback(): void;
|
|
41
|
+
protected willUpdate(cp: PropertyValues<this>): void;
|
|
42
|
+
beginPress(options: BeginPressConfig): void;
|
|
34
43
|
endPress(config: EndPressConfig): void;
|
|
44
|
+
handleClick(e: MouseEvent): void;
|
|
45
|
+
handlePointerEnter(e: PointerEvent): void;
|
|
46
|
+
handlePointerLeave(e: PointerEvent): void;
|
|
47
|
+
handleKeyUp(e: KeyboardEvent): void;
|
|
35
48
|
/**
|
|
36
49
|
* Sets the `_hasIcon` state property when the "icon" slot change event is dispatched.
|
|
37
50
|
*/
|
|
38
|
-
protected
|
|
51
|
+
protected handleIconSlotChange(e: Event): void;
|
|
52
|
+
protected handleSlotChange(e: Event): void;
|
|
53
|
+
getIndicatorSizing(): SizingInfo;
|
|
39
54
|
/**
|
|
40
55
|
* When `indicated` is `true` it animates the indicator to highlight the position of the tab.
|
|
41
56
|
*/
|
|
42
57
|
highlight(): void;
|
|
43
58
|
protected render(): TemplateResult;
|
|
59
|
+
protected renderFocusRing(): TemplateResult;
|
|
60
|
+
protected renderRipple(): TemplateResult;
|
|
44
61
|
protected renderIcon(): TemplateResult;
|
|
45
|
-
protected renderRipple: () => TemplateResult;
|
|
46
62
|
protected renderIndicator(): TemplateResult | typeof nothing;
|
|
47
63
|
}
|
|
48
64
|
//# sourceMappingURL=Tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAChG,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEzD,OAAO,2BAA2B,CAAA;AAElC,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,SAAS;IAC1C,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAI1B;IAED;;;;OAIG;IACyC,QAAQ,CAAC,QAAQ,UAAA;IAE7D;;OAEG;IACwC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAE1E;;OAEG;IACyC,QAAQ,CAAC,SAAS,UAAA;IAE9D;;;OAGG;IACM,SAAS,CAAC,QAAQ,CAAC,OAAO,UAAA;IACnC;;;OAGG;IACM,SAAS,CAAC,QAAQ,CAAC,QAAQ,UAAA;IAEhB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,QAAQ,GAAG,IAAI,CAAA;;IAqBtD,iBAAiB,IAAI,IAAI;cAUf,UAAU,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAOpD,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAM3C,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAatC,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAUhC,kBAAkB,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI;IAOzC,kBAAkB,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI;IAOzC,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAS5C;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAK9C,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAcnC,kBAAkB,IAAI,UAAU;IAYvC;;OAEG;IACI,SAAS,IAAI,IAAI;cA2BL,MAAM,IAAI,cAAc;IAqB3C,SAAS,CAAC,eAAe,IAAI,cAAc;IAS3C,SAAS,CAAC,YAAY,IAAI,cAAc;IAIxC,SAAS,CAAC,UAAU,IAAI,cAAc;IAItC,SAAS,CAAC,eAAe,IAAI,cAAc,GAAG,OAAO,OAAO;CAW7D"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
2
|
import { html, nothing } from 'lit';
|
|
3
|
-
import { property,
|
|
3
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
-
import { when } from 'lit/directives/when.js';
|
|
6
|
-
import { ripple } from '../../effects/rippleDirective.js';
|
|
7
5
|
import { isDisabled, setDisabled } from '../../../lib/disabled.js';
|
|
8
6
|
import { UiElement } from '../../UiElement.js';
|
|
9
7
|
import { Easing } from '../../motion/animation.js';
|
|
@@ -24,9 +22,9 @@ let UiTab = (() => {
|
|
|
24
22
|
let _hasIcon_decorators;
|
|
25
23
|
let _hasIcon_initializers = [];
|
|
26
24
|
let _hasIcon_extraInitializers = [];
|
|
27
|
-
let
|
|
28
|
-
let
|
|
29
|
-
let
|
|
25
|
+
let _iconOnly_decorators;
|
|
26
|
+
let _iconOnly_initializers = [];
|
|
27
|
+
let _iconOnly_extraInitializers = [];
|
|
30
28
|
let _ripple_decorators;
|
|
31
29
|
let _ripple_initializers = [];
|
|
32
30
|
let _ripple_extraInitializers = [];
|
|
@@ -35,17 +33,17 @@ let UiTab = (() => {
|
|
|
35
33
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
36
34
|
_set_disabled_decorators = [property({ reflect: true, type: Boolean })];
|
|
37
35
|
_selected_decorators = [property({ reflect: true, type: Boolean })];
|
|
38
|
-
_priority_decorators = [property({ reflect: true, type:
|
|
36
|
+
_priority_decorators = [property({ reflect: true, type: String })];
|
|
39
37
|
_indicated_decorators = [property({ reflect: true, type: Boolean })];
|
|
40
38
|
_hasIcon_decorators = [state()];
|
|
41
|
-
|
|
42
|
-
_ripple_decorators = [
|
|
39
|
+
_iconOnly_decorators = [state()];
|
|
40
|
+
_ripple_decorators = [query('ui-ripple')];
|
|
43
41
|
__esDecorate(this, null, _set_disabled_decorators, { kind: "setter", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
44
42
|
__esDecorate(this, null, _selected_decorators, { kind: "accessor", name: "selected", static: false, private: false, access: { has: obj => "selected" in obj, get: obj => obj.selected, set: (obj, value) => { obj.selected = value; } }, metadata: _metadata }, _selected_initializers, _selected_extraInitializers);
|
|
45
43
|
__esDecorate(this, null, _priority_decorators, { kind: "accessor", name: "priority", static: false, private: false, access: { has: obj => "priority" in obj, get: obj => obj.priority, set: (obj, value) => { obj.priority = value; } }, metadata: _metadata }, _priority_initializers, _priority_extraInitializers);
|
|
46
44
|
__esDecorate(this, null, _indicated_decorators, { kind: "accessor", name: "indicated", static: false, private: false, access: { has: obj => "indicated" in obj, get: obj => obj.indicated, set: (obj, value) => { obj.indicated = value; } }, metadata: _metadata }, _indicated_initializers, _indicated_extraInitializers);
|
|
47
45
|
__esDecorate(this, null, _hasIcon_decorators, { kind: "accessor", name: "hasIcon", static: false, private: false, access: { has: obj => "hasIcon" in obj, get: obj => obj.hasIcon, set: (obj, value) => { obj.hasIcon = value; } }, metadata: _metadata }, _hasIcon_initializers, _hasIcon_extraInitializers);
|
|
48
|
-
__esDecorate(this, null,
|
|
46
|
+
__esDecorate(this, null, _iconOnly_decorators, { kind: "accessor", name: "iconOnly", static: false, private: false, access: { has: obj => "iconOnly" in obj, get: obj => obj.iconOnly, set: (obj, value) => { obj.iconOnly = value; } }, metadata: _metadata }, _iconOnly_initializers, _iconOnly_extraInitializers);
|
|
49
47
|
__esDecorate(this, null, _ripple_decorators, { kind: "accessor", name: "ripple", static: false, private: false, access: { has: obj => "ripple" in obj, get: obj => obj.ripple, set: (obj, value) => { obj.ripple = value; } }, metadata: _metadata }, _ripple_initializers, _ripple_extraInitializers);
|
|
50
48
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
51
49
|
}
|
|
@@ -61,11 +59,7 @@ let UiTab = (() => {
|
|
|
61
59
|
setDisabled(this, value);
|
|
62
60
|
this.requestUpdate('disabled', old);
|
|
63
61
|
}
|
|
64
|
-
#selected_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _selected_initializers,
|
|
65
|
-
/**
|
|
66
|
-
* @attribute
|
|
67
|
-
*/
|
|
68
|
-
));
|
|
62
|
+
#selected_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _selected_initializers, void 0));
|
|
69
63
|
/**
|
|
70
64
|
* Whether the tab is selected. Note, this does not correspond to the `selected` state
|
|
71
65
|
* in the `ui-tabs`. This is only to render the tab in the selected state.
|
|
@@ -73,37 +67,43 @@ let UiTab = (() => {
|
|
|
73
67
|
*/
|
|
74
68
|
get selected() { return this.#selected_accessor_storage; }
|
|
75
69
|
set selected(value) { this.#selected_accessor_storage = value; }
|
|
76
|
-
#priority_accessor_storage = (__runInitializers(this, _selected_extraInitializers), __runInitializers(this, _priority_initializers,
|
|
77
|
-
/**
|
|
78
|
-
* @attribute
|
|
79
|
-
*/
|
|
80
|
-
));
|
|
70
|
+
#priority_accessor_storage = (__runInitializers(this, _selected_extraInitializers), __runInitializers(this, _priority_initializers, void 0));
|
|
81
71
|
/**
|
|
82
72
|
* @attribute
|
|
83
73
|
*/
|
|
84
74
|
get priority() { return this.#priority_accessor_storage; }
|
|
85
75
|
set priority(value) { this.#priority_accessor_storage = value; }
|
|
86
|
-
#indicated_accessor_storage = (__runInitializers(this, _priority_extraInitializers), __runInitializers(this, _indicated_initializers,
|
|
76
|
+
#indicated_accessor_storage = (__runInitializers(this, _priority_extraInitializers), __runInitializers(this, _indicated_initializers, void 0));
|
|
87
77
|
/**
|
|
88
78
|
* @attribute
|
|
89
79
|
*/
|
|
90
80
|
get indicated() { return this.#indicated_accessor_storage; }
|
|
91
81
|
set indicated(value) { this.#indicated_accessor_storage = value; }
|
|
92
|
-
#hasIcon_accessor_storage = (__runInitializers(this, _indicated_extraInitializers), __runInitializers(this, _hasIcon_initializers,
|
|
82
|
+
#hasIcon_accessor_storage = (__runInitializers(this, _indicated_extraInitializers), __runInitializers(this, _hasIcon_initializers, void 0));
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether the tab has an icon.
|
|
85
|
+
* This is set automatically when the "icon" slot is populated.
|
|
86
|
+
*/
|
|
93
87
|
get hasIcon() { return this.#hasIcon_accessor_storage; }
|
|
94
88
|
set hasIcon(value) { this.#hasIcon_accessor_storage = value; }
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
#iconOnly_accessor_storage = (__runInitializers(this, _hasIcon_extraInitializers), __runInitializers(this, _iconOnly_initializers, void 0));
|
|
90
|
+
/**
|
|
91
|
+
* Indicates whether the tab only has an icon and no text.
|
|
92
|
+
* This is set automatically when the default slot is populated with only an icon.
|
|
93
|
+
*/
|
|
94
|
+
get iconOnly() { return this.#iconOnly_accessor_storage; }
|
|
95
|
+
set iconOnly(value) { this.#iconOnly_accessor_storage = value; }
|
|
96
|
+
#ripple_accessor_storage = (__runInitializers(this, _iconOnly_extraInitializers), __runInitializers(this, _ripple_initializers, void 0));
|
|
99
97
|
get ripple() { return this.#ripple_accessor_storage; }
|
|
100
98
|
set ripple(value) { this.#ripple_accessor_storage = value; }
|
|
101
|
-
getRipple = (__runInitializers(this, _ripple_extraInitializers), () => {
|
|
102
|
-
this.showRipple = true;
|
|
103
|
-
return this.ripple;
|
|
104
|
-
});
|
|
105
99
|
constructor() {
|
|
106
100
|
super();
|
|
101
|
+
__runInitializers(this, _ripple_extraInitializers);
|
|
102
|
+
this.priority = 'primary';
|
|
103
|
+
this.selected = false;
|
|
104
|
+
this.indicated = false;
|
|
105
|
+
this.hasIcon = false;
|
|
106
|
+
this.iconOnly = true;
|
|
107
107
|
this.actionController.cancelKeyboardEvents = true;
|
|
108
108
|
this.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
109
109
|
this.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
@@ -112,6 +112,7 @@ let UiTab = (() => {
|
|
|
112
112
|
this.addEventListener('pointerup', this.handlePointerUp.bind(this));
|
|
113
113
|
this.addEventListener('pointercancel', this.handlePointerCancel.bind(this));
|
|
114
114
|
this.addEventListener('pointerleave', this.handlePointerLeave.bind(this));
|
|
115
|
+
this.addEventListener('pointerenter', this.handlePointerEnter.bind(this));
|
|
115
116
|
this.addEventListener('contextmenu', this.handleContextMenu.bind(this));
|
|
116
117
|
}
|
|
117
118
|
connectedCallback() {
|
|
@@ -123,8 +124,21 @@ let UiTab = (() => {
|
|
|
123
124
|
this.setAttribute('aria-selected', 'false');
|
|
124
125
|
}
|
|
125
126
|
}
|
|
127
|
+
willUpdate(cp) {
|
|
128
|
+
super.willUpdate(cp);
|
|
129
|
+
if (cp.has('selected')) {
|
|
130
|
+
this.setAttribute('aria-selected', String(this.selected));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
beginPress(options) {
|
|
134
|
+
super.beginPress(options);
|
|
135
|
+
this.classList.add('pressed');
|
|
136
|
+
this.ripple?.beginPress(options.positionEvent);
|
|
137
|
+
}
|
|
126
138
|
endPress(config) {
|
|
127
139
|
super.endPress(config);
|
|
140
|
+
this.classList.remove('pressed');
|
|
141
|
+
this.ripple?.endPress();
|
|
128
142
|
const { cancelled, reason } = config;
|
|
129
143
|
if (cancelled) {
|
|
130
144
|
return;
|
|
@@ -133,13 +147,66 @@ let UiTab = (() => {
|
|
|
133
147
|
this.click();
|
|
134
148
|
}
|
|
135
149
|
}
|
|
150
|
+
handleClick(e) {
|
|
151
|
+
super.handleClick(e);
|
|
152
|
+
if (this.disabled) {
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.endPress({ cancelled: false, actionData: { event: e } });
|
|
158
|
+
}
|
|
159
|
+
handlePointerEnter(e) {
|
|
160
|
+
super.handlePointerEnter(e);
|
|
161
|
+
if (this.ripple) {
|
|
162
|
+
this.ripple.beginHover(e);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
handlePointerLeave(e) {
|
|
166
|
+
super.handlePointerLeave(e);
|
|
167
|
+
if (this.ripple) {
|
|
168
|
+
this.ripple.endHover();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
handleKeyUp(e) {
|
|
172
|
+
super.handleKeyUp(e);
|
|
173
|
+
if (this.disabled) {
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
e.stopPropagation();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
136
179
|
/**
|
|
137
180
|
* Sets the `_hasIcon` state property when the "icon" slot change event is dispatched.
|
|
138
181
|
*/
|
|
139
|
-
|
|
182
|
+
handleIconSlotChange(e) {
|
|
140
183
|
const slot = e.target;
|
|
141
184
|
this.hasIcon = !!slot.assignedNodes().length;
|
|
142
185
|
}
|
|
186
|
+
handleSlotChange(e) {
|
|
187
|
+
const slot = e.target;
|
|
188
|
+
// Check if there's any label text or elements. If not, then there is only
|
|
189
|
+
// an icon.
|
|
190
|
+
for (const node of slot.assignedNodes()) {
|
|
191
|
+
const hasTextContent = node.nodeType === Node.TEXT_NODE && !!node.wholeText.match(/\S/);
|
|
192
|
+
if (node.nodeType === Node.ELEMENT_NODE || hasTextContent) {
|
|
193
|
+
this.iconOnly = false;
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
this.iconOnly = true;
|
|
198
|
+
}
|
|
199
|
+
getIndicatorSizing() {
|
|
200
|
+
const element = this.priority === 'primary' ? this.shadowRoot?.querySelector('.tab-content') : this;
|
|
201
|
+
if (!element) {
|
|
202
|
+
return { width: 0, left: 0 };
|
|
203
|
+
}
|
|
204
|
+
const rect = element.getBoundingClientRect();
|
|
205
|
+
return {
|
|
206
|
+
width: rect.width,
|
|
207
|
+
left: rect.left,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
143
210
|
/**
|
|
144
211
|
* When `indicated` is `true` it animates the indicator to highlight the position of the tab.
|
|
145
212
|
*/
|
|
@@ -169,35 +236,39 @@ let UiTab = (() => {
|
|
|
169
236
|
});
|
|
170
237
|
}
|
|
171
238
|
render() {
|
|
172
|
-
const
|
|
239
|
+
const isPrimary = this.priority === 'primary';
|
|
173
240
|
const containerClasses = classMap({
|
|
174
|
-
surface: true,
|
|
175
|
-
|
|
176
|
-
|
|
241
|
+
'surface': true,
|
|
242
|
+
'has-icon': this.hasIcon,
|
|
243
|
+
'has-label': !this.iconOnly,
|
|
244
|
+
'stacked': isPrimary,
|
|
177
245
|
});
|
|
178
246
|
return html `
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<div class="content">
|
|
247
|
+
${this.renderFocusRing()} ${this.renderRipple()}
|
|
248
|
+
<div class="${containerClasses}">
|
|
249
|
+
<div class="tab-content">
|
|
183
250
|
${this.renderIcon()}
|
|
184
|
-
<
|
|
251
|
+
<slot @slotchange="${this.handleSlotChange}"></slot>
|
|
185
252
|
</div>
|
|
186
|
-
${this.renderIndicator()}
|
|
253
|
+
${isPrimary ? this.renderIndicator() : nothing}
|
|
187
254
|
</div>
|
|
255
|
+
${!isPrimary ? this.renderIndicator() : nothing}
|
|
188
256
|
`;
|
|
189
257
|
}
|
|
258
|
+
renderFocusRing() {
|
|
259
|
+
return html `<md-focus-ring
|
|
260
|
+
part="focus-ring"
|
|
261
|
+
class="focus-ring"
|
|
262
|
+
inward
|
|
263
|
+
.control="${this}"
|
|
264
|
+
></md-focus-ring>`;
|
|
265
|
+
}
|
|
266
|
+
renderRipple() {
|
|
267
|
+
return html `<ui-ripple class="ripple" ?disabled="${this.disabled}"></ui-ripple>`;
|
|
268
|
+
}
|
|
190
269
|
renderIcon() {
|
|
191
|
-
return html `
|
|
192
|
-
<div class="icon">
|
|
193
|
-
<slot name="icon" @slotchange="${this.handleIconChange}"></slot>
|
|
194
|
-
</div>
|
|
195
|
-
`;
|
|
270
|
+
return html ` <slot name="icon" @slotchange="${this.handleIconSlotChange}"></slot> `;
|
|
196
271
|
}
|
|
197
|
-
renderRipple = () => {
|
|
198
|
-
const { disabled } = this;
|
|
199
|
-
return html `<ui-ripple class="ripple" ?disabled="${disabled}"></ui-ripple>`;
|
|
200
|
-
};
|
|
201
272
|
renderIndicator() {
|
|
202
273
|
const { indicated, priority } = this;
|
|
203
274
|
if (!indicated) {
|
|
@@ -207,9 +278,7 @@ let UiTab = (() => {
|
|
|
207
278
|
indicator: true,
|
|
208
279
|
primary: priority === 'primary',
|
|
209
280
|
};
|
|
210
|
-
return html `<div class="${classMap(classes)}"
|
|
211
|
-
<span role="presentation" class="pointer"></span>
|
|
212
|
-
</div>`;
|
|
281
|
+
return html `<div class="${classMap(classes)}"></div>`;
|
|
213
282
|
}
|
|
214
283
|
};
|
|
215
284
|
})();
|