@api-client/ui 0.3.1 → 0.3.3
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/button.styles.js +4 -4
- package/build/src/md/button/internals/button.styles.js.map +1 -1
- 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/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/build/src/md/text-field/internals/common.styles.d.ts.map +1 -1
- package/build/src/md/text-field/internals/common.styles.js +0 -3
- package/build/src/md/text-field/internals/common.styles.js.map +1 -1
- package/build/src/styles/m3/native.css +270 -0
- package/build/src/styles/m3/theme.css +155 -0
- package/build/src/styles/m3/tokens.css +512 -0
- package/demo/md/tabs/tabs.html +19 -0
- package/demo/md/tabs/tabs.ts +133 -83
- package/package.json +20 -4
- package/scripts/copy-assets.js +21 -0
- 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/button.styles.ts +4 -4
- package/src/md/motion/animation.ts +4 -2
- package/src/md/ripple/internals/ripple.styles.ts +20 -8
- 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/src/md/text-field/internals/common.styles.ts +0 -3
- package/test/elements/har/HarViewerElement.test.ts +1 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAG7C,OAAO,EAAE,MAAM,EA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O,IAAI,CAAA,wCAAwC,QAAQ,gBAAgB,CAAA;QAC7E,CAAC,CAAA;QAES,eAAe;YACvB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;YACpC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,OAAO,CAAA;YAChB,CAAC;YACD,MAAM,OAAO,GAAc;gBACzB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,QAAQ,KAAK,SAAS;aAChC,CAAA;YACD,OAAO,IAAI,CAAA,eAAe,QAAQ,CAAC,OAAO,CAAC;;WAEpC,CAAA;QACT,CAAC;;;AAjKH,qBAkKC","sourcesContent":["import { html, nothing, TemplateResult } from 'lit'\nimport { property, queryAsync, state } from 'lit/decorators.js'\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js'\nimport { when } from 'lit/directives/when.js'\nimport { EndPressConfig } from '../../../controllers/ActionController.js'\nimport UiRipple from '../../ripple/internals/ripple.js'\nimport { ripple } from '../../effects/rippleDirective.js'\nimport { isDisabled, setDisabled } from '../../../lib/disabled.js'\nimport { UiElement } from '../../UiElement.js'\nimport type { TabsPriority } from './Tabs.js'\nimport { Easing } from '../../motion/animation.js'\nimport '../../ripple/ui-ripple.js'\n\nexport default class UiTab extends UiElement {\n get disabled(): boolean {\n return isDisabled(this)\n }\n\n /**\n * When set, the button is a disabled state.\n * @attribute\n */\n @property({ reflect: true, type: Boolean })\n set disabled(value: boolean) {\n const old = isDisabled(this)\n setDisabled(this, value)\n this.requestUpdate('disabled', old)\n }\n\n /**\n * Whether the tab is selected. Note, this does not correspond to the `selected` state\n * in the `ui-tabs`. This is only to render the tab in the selected state.\n * @attribute\n */\n @property({ reflect: true, type: Boolean }) accessor selected = false\n\n /**\n * @attribute\n */\n @property({ reflect: true, type: Boolean }) accessor priority: TabsPriority = 'primary'\n\n /**\n * @attribute\n */\n @property({ reflect: true, type: Boolean }) accessor indicated = false\n\n @state() protected accessor hasIcon = false\n\n @state() protected accessor showRipple = false\n\n @queryAsync('ui-ripple') protected accessor ripple!: Promise<UiRipple | null>\n\n protected readonly getRipple = (): Promise<UiRipple | null> => {\n this.showRipple = true\n return this.ripple\n }\n\n constructor() {\n super()\n this.actionController.cancelKeyboardEvents = true\n this.addEventListener('keydown', this.handleKeyDown.bind(this))\n this.addEventListener('keyup', this.handleKeyUp.bind(this))\n this.addEventListener('click', this.handleClick.bind(this))\n this.addEventListener('pointerdown', this.handlePointerDown.bind(this))\n this.addEventListener('pointerup', this.handlePointerUp.bind(this))\n this.addEventListener('pointercancel', this.handlePointerCancel.bind(this))\n this.addEventListener('pointerleave', this.handlePointerLeave.bind(this))\n this.addEventListener('contextmenu', this.handleContextMenu.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'tab')\n }\n if (!this.hasAttribute('aria-selected')) {\n this.setAttribute('aria-selected', 'false')\n }\n }\n\n override endPress(config: EndPressConfig): void {\n super.endPress(config)\n const { cancelled, reason } = config\n if (cancelled) {\n return\n }\n if (reason === 'enter' || reason === 'space') {\n this.click()\n }\n }\n\n /**\n * Sets the `_hasIcon` state property when the \"icon\" slot change event is dispatched.\n */\n protected handleIconChange(e: Event): void {\n const slot = e.target as HTMLSlotElement\n this.hasIcon = !!slot.assignedNodes().length\n }\n\n /**\n * When `indicated` is `true` it animates the indicator to highlight the position of the tab.\n */\n highlight(): void {\n if (!this.indicated) {\n return\n }\n const pointer = this.shadowRoot?.querySelector('.pointer')\n if (!pointer) {\n return\n }\n const frames: Keyframe[] = [\n {\n width: `40px`,\n },\n {\n width: `80px`,\n },\n {\n width: `40px`,\n },\n ]\n\n pointer.animate(frames, {\n duration: 360,\n iterations: 1,\n easing: Easing.STANDARD,\n })\n }\n\n protected override render(): TemplateResult {\n const { pressed = false } = this\n const containerClasses = classMap({\n surface: true,\n withIcon: this.hasIcon,\n pressed,\n })\n return html`\n <div class=\"${containerClasses}\" ${ripple(this.getRipple)}>\n <div class=\"container\"></div>\n ${when(this.showRipple, this.renderRipple)}\n <div class=\"content\">\n ${this.renderIcon()}\n <div class=\"tab-content\"><slot></slot></div>\n </div>\n ${this.renderIndicator()}\n </div>\n `\n }\n\n protected renderIcon(): TemplateResult {\n return html`\n <div class=\"icon\">\n <slot name=\"icon\" @slotchange=\"${this.handleIconChange}\"></slot>\n </div>\n `\n }\n\n protected renderRipple = (): TemplateResult => {\n const { disabled } = this\n return html`<ui-ripple class=\"ripple\" ?disabled=\"${disabled}\"></ui-ripple>`\n }\n\n protected renderIndicator(): TemplateResult | typeof nothing {\n const { indicated, priority } = this\n if (!indicated) {\n return nothing\n }\n const classes: ClassInfo = {\n indicator: true,\n primary: priority === 'primary',\n }\n return html`<div class=\"${classMap(classes)}\">\n <span role=\"presentation\" class=\"pointer\"></span>\n </div>`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,2BAA2B,CAAA;;sBAEC,SAAS;;;;;;;;;;;;;;;;;;;;;iBAAvB,KAAM,SAAQ,WAAS;;;wCASzC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCAY1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCAK1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B,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;YACpC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,OAAO,CAAA;YAChB,CAAC;YACD,MAAM,OAAO,GAAc;gBACzB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,QAAQ,KAAK,SAAS;aAChC,CAAA;YACD,OAAO,IAAI,CAAA,eAAe,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;QACvD,CAAC;;;AAtPH,qBAuPC","sourcesContent":["import { html, nothing, PropertyValues, TemplateResult } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js'\nimport type { BeginPressConfig, EndPressConfig } from '../../../controllers/ActionController.js'\nimport type UiRipple from '../../ripple/internals/ripple.js'\nimport { isDisabled, setDisabled } from '../../../lib/disabled.js'\nimport { UiElement } from '../../UiElement.js'\nimport type { SizingInfo, TabsPriority } from './Tabs.js'\nimport { Easing } from '../../motion/animation.js'\nimport '../../ripple/ui-ripple.js'\n\nexport default class UiTab extends UiElement {\n get disabled(): boolean {\n return isDisabled(this)\n }\n\n /**\n * When set, the button is a disabled state.\n * @attribute\n */\n @property({ reflect: true, type: Boolean })\n set disabled(value: boolean) {\n const old = isDisabled(this)\n setDisabled(this, value)\n this.requestUpdate('disabled', old)\n }\n\n /**\n * Whether the tab is selected. Note, this does not correspond to the `selected` state\n * in the `ui-tabs`. This is only to render the tab in the selected state.\n * @attribute\n */\n @property({ reflect: true, type: Boolean }) accessor selected\n\n /**\n * @attribute\n */\n @property({ reflect: true, type: String }) accessor priority: TabsPriority\n\n /**\n * @attribute\n */\n @property({ reflect: true, type: Boolean }) accessor indicated\n\n /**\n * Indicates whether the tab has an icon.\n * This is set automatically when the \"icon\" slot is populated.\n */\n @state() protected accessor hasIcon\n /**\n * Indicates whether the tab only has an icon and no text.\n * This is set automatically when the default slot is populated with only an icon.\n */\n @state() protected accessor iconOnly\n\n @query('ui-ripple') protected accessor ripple!: UiRipple | null\n\n constructor() {\n super()\n this.priority = 'primary'\n this.selected = false\n this.indicated = false\n this.hasIcon = false\n this.iconOnly = true\n this.actionController.cancelKeyboardEvents = true\n this.addEventListener('keydown', this.handleKeyDown.bind(this))\n this.addEventListener('keyup', this.handleKeyUp.bind(this))\n this.addEventListener('click', this.handleClick.bind(this))\n this.addEventListener('pointerdown', this.handlePointerDown.bind(this))\n this.addEventListener('pointerup', this.handlePointerUp.bind(this))\n this.addEventListener('pointercancel', this.handlePointerCancel.bind(this))\n this.addEventListener('pointerleave', this.handlePointerLeave.bind(this))\n this.addEventListener('pointerenter', this.handlePointerEnter.bind(this))\n this.addEventListener('contextmenu', this.handleContextMenu.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'tab')\n }\n if (!this.hasAttribute('aria-selected')) {\n this.setAttribute('aria-selected', 'false')\n }\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n super.willUpdate(cp)\n if (cp.has('selected')) {\n this.setAttribute('aria-selected', String(this.selected))\n }\n }\n\n override beginPress(options: BeginPressConfig): void {\n super.beginPress(options)\n this.classList.add('pressed')\n this.ripple?.beginPress(options.positionEvent)\n }\n\n override endPress(config: EndPressConfig): void {\n super.endPress(config)\n this.classList.remove('pressed')\n this.ripple?.endPress()\n const { cancelled, reason } = config\n if (cancelled) {\n return\n }\n if (reason === 'enter' || reason === 'space') {\n this.click()\n }\n }\n\n override handleClick(e: MouseEvent): void {\n super.handleClick(e)\n if (this.disabled) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n this.endPress({ cancelled: false, actionData: { event: e } })\n }\n\n override handlePointerEnter(e: PointerEvent): void {\n super.handlePointerEnter(e)\n if (this.ripple) {\n this.ripple.beginHover(e)\n }\n }\n\n override handlePointerLeave(e: PointerEvent): void {\n super.handlePointerLeave(e)\n if (this.ripple) {\n this.ripple.endHover()\n }\n }\n\n override handleKeyUp(e: KeyboardEvent): void {\n super.handleKeyUp(e)\n if (this.disabled) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n }\n\n /**\n * Sets the `_hasIcon` state property when the \"icon\" slot change event is dispatched.\n */\n protected handleIconSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement\n this.hasIcon = !!slot.assignedNodes().length\n }\n\n protected handleSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement\n // Check if there's any label text or elements. If not, then there is only\n // an icon.\n for (const node of slot.assignedNodes()) {\n const hasTextContent = node.nodeType === Node.TEXT_NODE && !!(node as Text).wholeText.match(/\\S/)\n if (node.nodeType === Node.ELEMENT_NODE || hasTextContent) {\n this.iconOnly = false\n return\n }\n }\n this.iconOnly = true\n }\n\n public getIndicatorSizing(): SizingInfo {\n const element = this.priority === 'primary' ? this.shadowRoot?.querySelector('.tab-content') : this\n if (!element) {\n return { width: 0, left: 0 }\n }\n const rect = element.getBoundingClientRect()\n return {\n width: rect.width,\n left: rect.left,\n }\n }\n\n /**\n * When `indicated` is `true` it animates the indicator to highlight the position of the tab.\n */\n public highlight(): void {\n if (!this.indicated) {\n return\n }\n const pointer = this.shadowRoot?.querySelector('.pointer')\n if (!pointer) {\n return\n }\n const frames: Keyframe[] = [\n {\n width: `40px`,\n },\n {\n width: `80px`,\n },\n {\n width: `40px`,\n },\n ]\n\n pointer.animate(frames, {\n duration: 360,\n iterations: 1,\n easing: Easing.STANDARD,\n })\n }\n\n protected override render(): TemplateResult {\n const isPrimary = this.priority === 'primary'\n const containerClasses = classMap({\n 'surface': true,\n 'has-icon': this.hasIcon,\n 'has-label': !this.iconOnly,\n 'stacked': isPrimary,\n })\n return html`\n ${this.renderFocusRing()} ${this.renderRipple()}\n <div class=\"${containerClasses}\">\n <div class=\"tab-content\">\n ${this.renderIcon()}\n <slot @slotchange=\"${this.handleSlotChange}\"></slot>\n </div>\n ${isPrimary ? this.renderIndicator() : nothing}\n </div>\n ${!isPrimary ? this.renderIndicator() : nothing}\n `\n }\n\n protected renderFocusRing(): TemplateResult {\n return html`<md-focus-ring\n part=\"focus-ring\"\n class=\"focus-ring\"\n inward\n .control=\"${this as HTMLElement}\"\n ></md-focus-ring>`\n }\n\n protected renderRipple(): TemplateResult {\n return html`<ui-ripple class=\"ripple\" ?disabled=\"${this.disabled}\"></ui-ripple>`\n }\n\n protected renderIcon(): TemplateResult {\n return html` <slot name=\"icon\" @slotchange=\"${this.handleIconSlotChange}\"></slot> `\n }\n\n protected renderIndicator(): TemplateResult | typeof nothing {\n const { indicated, priority } = this\n if (!indicated) {\n return nothing\n }\n const classes: ClassInfo = {\n indicator: true,\n primary: priority === 'primary',\n }\n return html`<div class=\"${classMap(classes)}\"></div>`\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.styles.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"Tab.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.styles.ts"],"names":[],"mappings":";AAEA,wBAyIC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
export default css `
|
|
3
3
|
:host {
|
|
4
|
-
display: inline-
|
|
5
|
-
vertical-align:
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
|
|
9
|
+
position: relative;
|
|
6
10
|
box-sizing: content-box;
|
|
11
|
+
padding: 0 16px;
|
|
12
|
+
|
|
7
13
|
outline: none;
|
|
8
14
|
text-rendering: auto;
|
|
9
15
|
cursor: default;
|
|
@@ -17,55 +23,48 @@ export default css `
|
|
|
17
23
|
letter-spacing: var(--md-sys-typescale-title-small-tracking);
|
|
18
24
|
line-height: var(--md-sys-typescale-title-small-height);
|
|
19
25
|
|
|
20
|
-
--md-ripple-hover-state-layer-color:
|
|
21
|
-
--md-ripple-focus-state-layer-color:
|
|
22
|
-
--md-ripple-pressed-state-layer-color:
|
|
23
|
-
|
|
24
|
-
color: var(--md-sys-color-
|
|
26
|
+
--md-ripple-hover-state-layer-color: currentColor;
|
|
27
|
+
--md-ripple-focus-state-layer-color: currentColor;
|
|
28
|
+
--md-ripple-pressed-state-layer-color: currentColor;
|
|
29
|
+
|
|
30
|
+
--_background-color: var(--md-sys-color-surface);
|
|
31
|
+
--_color: var(--md-sys-color-on-surface-variant);
|
|
32
|
+
--_container-height: 48px;
|
|
33
|
+
--_active-indicator-color: var(--md-sys-color-primary);
|
|
34
|
+
--_active-indicator-shape: var(--md-primary-tab-active-indicator-shape, 3px 3px 0px 0px);
|
|
35
|
+
--_active-indicator-height: 2px;
|
|
36
|
+
--_active-indicator-opacity: 0;
|
|
37
|
+
--_with-icon-and-label-text-container-height: var(--md-primary-tab-with-icon-and-label-text-container-height, 64px);
|
|
38
|
+
--_icon-size: var(--md-secondary-tab-icon-size, 24px);
|
|
39
|
+
|
|
40
|
+
background-color: var(--_background-color);
|
|
41
|
+
color: var(--_color);
|
|
25
42
|
}
|
|
26
43
|
|
|
27
44
|
:host([hidden]) {
|
|
28
45
|
display: none;
|
|
29
46
|
}
|
|
30
47
|
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
height: inherit;
|
|
34
|
-
position: relative;
|
|
35
|
-
border-radius: inherit;
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
height: 48px;
|
|
48
|
+
.ripple.activated {
|
|
49
|
+
z-index: 1;
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
.
|
|
43
|
-
|
|
52
|
+
.focus-ring {
|
|
53
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
54
|
+
transition: margin-bottom var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
|
|
44
55
|
}
|
|
45
56
|
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
inset: 0;
|
|
49
|
-
z-index: 1;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.content {
|
|
53
|
-
z-index: 2;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
align-items: center;
|
|
58
|
-
padding: 0px 20px;
|
|
57
|
+
:host([selected]) .focus-ring {
|
|
58
|
+
margin-bottom: calc(var(--_active-indicator-height) + 1px);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.tab-content {
|
|
62
62
|
display: flex;
|
|
63
63
|
align-items: center;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
z-index: 3;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
flex-direction: row;
|
|
66
|
+
gap: 8px;
|
|
67
|
+
height: var(--_container-height);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
.icon ::slotted(*) {
|
|
@@ -81,55 +80,61 @@ export default css `
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
:host([selected]) {
|
|
84
|
-
|
|
83
|
+
--_active-indicator-opacity: 1;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
bottom: 0px;
|
|
90
|
-
left: 0px;
|
|
91
|
-
right: 0px;
|
|
92
|
-
height: 2px;
|
|
93
|
-
display: flex;
|
|
94
|
-
justify-content: center;
|
|
86
|
+
:host([priority='primary']) {
|
|
87
|
+
--_color: var(--md-primary-tab-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
95
88
|
}
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
:host([priority='secondary']) {
|
|
91
|
+
--_color: var(--md-secondary-tab-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
display: block;
|
|
104
|
-
background-color: var(--md-sys-color-primary);
|
|
94
|
+
:host([selected][priority='primary']) {
|
|
95
|
+
--_color: var(--md-primary-tab-active-label-text-color, var(--md-sys-color-primary));
|
|
105
96
|
}
|
|
106
97
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
width: 40px;
|
|
98
|
+
:host([selected][priority='secondary']) {
|
|
99
|
+
--_color: var(--md-secondary-tab-active-label-text-color, var(--md-sys-color-on-surface));
|
|
110
100
|
}
|
|
111
101
|
|
|
112
|
-
.
|
|
113
|
-
|
|
102
|
+
.surface {
|
|
103
|
+
position: relative;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.indicator {
|
|
107
|
+
position: absolute;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
transform-origin: bottom left;
|
|
110
|
+
background: var(--_active-indicator-color);
|
|
111
|
+
border-radius: var(--_active-indicator-shape);
|
|
112
|
+
height: var(--_active-indicator-height);
|
|
113
|
+
inset: auto 0 0 0;
|
|
114
|
+
opacity: var(--_active-indicator-opacity);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([priority='primary']) {
|
|
118
|
+
--_active-indicator-height: 3px;
|
|
119
|
+
--_active-indicator-shape: 3px 3px 0px 0px;
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
:host([disabled]) {
|
|
117
123
|
pointer-events: none;
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
:host([disabled])
|
|
121
|
-
|
|
126
|
+
:host([disabled]) {
|
|
127
|
+
--_color: var(--md-sys-color-on-surface);
|
|
122
128
|
opacity: 0.38;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
.stacked .tab-content {
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 2px;
|
|
128
134
|
}
|
|
129
135
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
opacity: var(--md-sys-state-focus-state-layer-opacity);
|
|
136
|
+
.stacked.has-icon.has-label .tab-content {
|
|
137
|
+
height: var(--_with-icon-and-label-text-container-height);
|
|
133
138
|
}
|
|
134
139
|
`;
|
|
135
140
|
//# sourceMappingURL=Tab.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.styles.js","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"Tab.styles.js","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tab.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n align-items: center;\n justify-content: center;\n\n position: relative;\n box-sizing: content-box;\n padding: 0 16px;\n\n outline: none;\n text-rendering: auto;\n cursor: default;\n user-select: none;\n width: auto;\n -webkit-tap-highlight-color: transparent;\n\n font-family: var(--md-sys-typescale-title-small-font);\n font-weight: var(--md-sys-typescale-title-small-weight);\n font-size: var(--md-sys-typescale-title-small-size);\n letter-spacing: var(--md-sys-typescale-title-small-tracking);\n line-height: var(--md-sys-typescale-title-small-height);\n\n --md-ripple-hover-state-layer-color: currentColor;\n --md-ripple-focus-state-layer-color: currentColor;\n --md-ripple-pressed-state-layer-color: currentColor;\n\n --_background-color: var(--md-sys-color-surface);\n --_color: var(--md-sys-color-on-surface-variant);\n --_container-height: 48px;\n --_active-indicator-color: var(--md-sys-color-primary);\n --_active-indicator-shape: var(--md-primary-tab-active-indicator-shape, 3px 3px 0px 0px);\n --_active-indicator-height: 2px;\n --_active-indicator-opacity: 0;\n --_with-icon-and-label-text-container-height: var(--md-primary-tab-with-icon-and-label-text-container-height, 64px);\n --_icon-size: var(--md-secondary-tab-icon-size, 24px);\n\n background-color: var(--_background-color);\n color: var(--_color);\n }\n\n :host([hidden]) {\n display: none;\n }\n\n .ripple.activated {\n z-index: 1;\n }\n\n .focus-ring {\n border-radius: var(--md-sys-shape-corner-small);\n transition: margin-bottom var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);\n }\n\n :host([selected]) .focus-ring {\n margin-bottom: calc(var(--_active-indicator-height) + 1px);\n }\n\n .tab-content {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: row;\n gap: 8px;\n height: var(--_container-height);\n }\n\n .icon ::slotted(*) {\n color: var(--md-sys-color-on-surface-variant);\n fill: var(--md-sys-color-on-surface-variant);\n width: 24px;\n height: 24px;\n }\n\n :host([selected]) .icon ::slotted(*) {\n color: var(--md-sys-color-primary);\n fill: var(--md-sys-color-primary);\n }\n\n :host([selected]) {\n --_active-indicator-opacity: 1;\n }\n\n :host([priority='primary']) {\n --_color: var(--md-primary-tab-label-text-color, var(--md-sys-color-on-surface-variant));\n }\n\n :host([priority='secondary']) {\n --_color: var(--md-secondary-tab-label-text-color, var(--md-sys-color-on-surface-variant));\n }\n\n :host([selected][priority='primary']) {\n --_color: var(--md-primary-tab-active-label-text-color, var(--md-sys-color-primary));\n }\n\n :host([selected][priority='secondary']) {\n --_color: var(--md-secondary-tab-active-label-text-color, var(--md-sys-color-on-surface));\n }\n\n .surface {\n position: relative;\n }\n\n .indicator {\n position: absolute;\n box-sizing: border-box;\n transform-origin: bottom left;\n background: var(--_active-indicator-color);\n border-radius: var(--_active-indicator-shape);\n height: var(--_active-indicator-height);\n inset: auto 0 0 0;\n opacity: var(--_active-indicator-opacity);\n }\n\n :host([priority='primary']) {\n --_active-indicator-height: 3px;\n --_active-indicator-shape: 3px 3px 0px 0px;\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n :host([disabled]) {\n --_color: var(--md-sys-color-on-surface);\n opacity: 0.38;\n }\n\n .stacked .tab-content {\n flex-direction: column;\n gap: 2px;\n }\n\n .stacked.has-icon.has-label .tab-content {\n height: var(--_with-icon-and-label-text-container-height);\n }\n`\n"]}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { LitElement,
|
|
2
|
-
import { StyleInfo } from 'lit/directives/style-map.js';
|
|
1
|
+
import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
3
2
|
import UiTab from './Tab.js';
|
|
4
3
|
import '../../icon-button/ui-icon-button.js';
|
|
5
4
|
import '../../divider/ui-divider.js';
|
|
6
5
|
import '../../icons/ui-icon.js';
|
|
7
6
|
export type TabsPriority = 'primary' | 'secondary';
|
|
8
7
|
export interface TabSelectionDetail {
|
|
8
|
+
/**
|
|
9
|
+
* The selected tab.
|
|
10
|
+
*/
|
|
9
11
|
item: UiTab;
|
|
12
|
+
/**
|
|
13
|
+
* The index of the selected tab.
|
|
14
|
+
*/
|
|
10
15
|
index: number;
|
|
11
|
-
|
|
16
|
+
}
|
|
17
|
+
export interface SizingInfo {
|
|
18
|
+
left: number;
|
|
19
|
+
width: number;
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
22
|
* Calculates value in percentages
|
|
@@ -20,88 +28,78 @@ export declare function calcPercent(w: number, w0: number): number;
|
|
|
20
28
|
/**
|
|
21
29
|
* A container for tabs.
|
|
22
30
|
*
|
|
23
|
-
* @fires
|
|
24
|
-
* The `event.detail` object contains the `item` and `index` properties.
|
|
25
|
-
* It also has the `select` property with the value of the `selectedAttribute` on the tab.
|
|
31
|
+
* @fires change - A non bubbling event when selection change through user interaction.
|
|
26
32
|
*/
|
|
27
33
|
export default class UiTabs extends LitElement {
|
|
28
|
-
items: UiTab[];
|
|
29
34
|
activeItem: UiTab | null;
|
|
30
35
|
previousItem: UiTab | null;
|
|
31
|
-
protected accessor assignedElements: HTMLElement[];
|
|
32
|
-
protected accessor pointer: HTMLElement;
|
|
33
|
-
protected accessor content: HTMLElement;
|
|
34
36
|
/**
|
|
35
|
-
* The
|
|
36
|
-
*
|
|
37
|
-
* @default primary
|
|
38
|
-
* @attribute
|
|
37
|
+
* The currently selected tab, `null` only when there are no tab children.
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
get activeTab(): UiTab | null;
|
|
40
|
+
set activeTab(tab: UiTab | null);
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @attribute
|
|
42
|
+
* The index of the currently selected tab.
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
get activeTabIndex(): number;
|
|
46
45
|
/**
|
|
47
|
-
*
|
|
48
|
-
* This is matched with the `aria-controls` of the tab.
|
|
49
|
-
* @attribute
|
|
46
|
+
* Sets the active tab by index.
|
|
50
47
|
*/
|
|
51
|
-
|
|
48
|
+
set activeTabIndex(index: number);
|
|
49
|
+
get focusedTab(): UiTab | undefined;
|
|
50
|
+
private accessor tabs;
|
|
51
|
+
private accessor tabsScrollerElement;
|
|
52
|
+
private accessor slotElement;
|
|
53
|
+
private accessor pointer;
|
|
52
54
|
/**
|
|
53
|
-
* The
|
|
54
|
-
* corresponds to which tab.
|
|
55
|
+
* The priority of the tabs.
|
|
55
56
|
*
|
|
56
|
-
* @default
|
|
57
|
+
* @default primary
|
|
57
58
|
* @attribute
|
|
58
59
|
*/
|
|
59
|
-
accessor
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
protected observer: IntersectionObserver;
|
|
60
|
+
accessor priority: TabsPriority;
|
|
61
|
+
private accessor pointerStyles;
|
|
62
|
+
private accessor indicated;
|
|
63
|
+
private observer;
|
|
64
64
|
/**
|
|
65
65
|
* This is set by the intersection observer. Once the tabs are in the view it turns to `true`.
|
|
66
66
|
* This we can properly visualize selection.
|
|
67
67
|
*/
|
|
68
68
|
accessor isVisible: boolean | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Whether or not to automatically select a tab when it is focused.
|
|
71
|
+
*/
|
|
72
|
+
accessor autoActivate: boolean;
|
|
73
|
+
private readonly internals;
|
|
69
74
|
constructor();
|
|
70
75
|
protected willUpdate(cp: PropertyValues<this>): void;
|
|
71
76
|
connectedCallback(): void;
|
|
72
77
|
disconnectedCallback(): void;
|
|
73
78
|
protected intersectionCallback(entries: IntersectionObserverEntry[]): void;
|
|
74
|
-
protected updateItems(): Promise<void>;
|
|
75
79
|
/**
|
|
76
|
-
*
|
|
80
|
+
* Scrolls the toolbar, if overflowing, to the active tab, or the provided
|
|
81
|
+
* tab.
|
|
82
|
+
*
|
|
83
|
+
* @param tabToScrollTo The tab that should be scrolled to. Defaults to the
|
|
84
|
+
* active tab.
|
|
85
|
+
* @return A Promise that resolves after the tab has been scrolled to.
|
|
77
86
|
*/
|
|
78
|
-
|
|
79
|
-
protected isSelectable(element: UiTab): boolean;
|
|
80
|
-
protected ensureSelection(): void;
|
|
81
|
-
protected makeSelection(tab?: UiTab, focus?: boolean): void;
|
|
82
|
-
notifySelect(item: UiTab): void;
|
|
83
|
-
protected selectItem(tab: UiTab, focus?: boolean): void;
|
|
84
|
-
protected deselectItem(tab: UiTab): void;
|
|
87
|
+
scrollToTab(tabToScrollTo?: UiTab | null): Promise<void>;
|
|
85
88
|
protected handleVisibility(): void;
|
|
86
89
|
protected positionPointer(tab: UiTab, old?: UiTab | null): Promise<void>;
|
|
87
90
|
protected moveAnimation?: Animation;
|
|
88
|
-
protected
|
|
89
|
-
protected
|
|
90
|
-
protected
|
|
91
|
-
protected
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
protected handleKeyDown(e: KeyboardEvent): void;
|
|
99
|
-
getPreviousItem(item: UiTab): UiTab;
|
|
100
|
-
getNextItem(item: UiTab): UiTab;
|
|
91
|
+
protected getTabSizing(tab: UiTab): SizingInfo;
|
|
92
|
+
protected getPrimaryKeyframes(start: SizingInfo, final: SizingInfo): Keyframe[];
|
|
93
|
+
protected getSecondaryKeyframes(start: SizingInfo, final: SizingInfo): Keyframe[];
|
|
94
|
+
protected handleTabClick(e: PointerEvent): Promise<void>;
|
|
95
|
+
private activateTab;
|
|
96
|
+
private updateFocusableTab;
|
|
97
|
+
private handleKeydown;
|
|
98
|
+
private handleKeyup;
|
|
99
|
+
private handleFocusout;
|
|
100
|
+
private handleSlotChange;
|
|
101
101
|
render(): TemplateResult;
|
|
102
102
|
protected renderSlot(): TemplateResult;
|
|
103
103
|
protected renderIndicator(): TemplateResult;
|
|
104
|
-
protected renderLeftScrollControl(): TemplateResult | typeof nothing;
|
|
105
|
-
protected rightScrollControl(): TemplateResult | typeof nothing;
|
|
106
104
|
}
|
|
107
105
|
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../src/md/tabs/internals/Tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAKtE,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,qCAAqC,CAAA;AAC5C,OAAO,6BAA6B,CAAA;AACpC,OAAO,wBAAwB,CAAA;AAE/B,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,CAAA;AAElD,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MA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