@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
|
@@ -82,6 +82,10 @@ export default css `
|
|
|
82
82
|
transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.ripple.activated {
|
|
86
|
+
z-index: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
.focus-ring {
|
|
86
90
|
--md-focus-ring-shape-end-end: var(--ui-button-shape-end-end, var(--_pill-radius));
|
|
87
91
|
--md-focus-ring-shape-end-start: var(--ui-button-shape-end-start, var(--_pill-radius));
|
|
@@ -90,10 +94,6 @@ export default css `
|
|
|
90
94
|
transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
.ripple.activated {
|
|
94
|
-
z-index: 1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
97
|
/* Disabled state */
|
|
98
98
|
:host([disabled]) {
|
|
99
99
|
background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.styles.js","sourceRoot":"","sources":["../../../../../src/md/button/internals/button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,qEAAqE;AACrE,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2TjB,CAAA","sourcesContent":["import { css } from 'lit'\n\n/* Material Design 3 Expressive Button - CSS-Native Implementation */\nexport default css`\n :host {\n all: unset;\n\n /* Layout and positioning */\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n white-space: nowrap;\n\n /* Default sizing */\n min-height: 40px;\n min-width: 64px;\n padding-inline: 16px;\n gap: 8px;\n\n /* Typography from Material 3 tokens */\n font-family: var(--md-sys-typescale-label-large-font, var(--md-ref-typeface-plain, system-ui));\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n font-weight: var(--md-sys-typescale-label-large-weight, 500);\n line-height: var(--md-sys-typescale-label-large-height, 1.25);\n letter-spacing: var(--md-sys-typescale-label-large-tracking, 0.01em);\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 /* CSS custom property for pill radius - half of the button height */\n --_pill-radius: 20px;\n /* Default icon size */\n --_icon-size: var(--md-button-icon-size, 20px);\n --_background-color: transparent;\n --_color: inherit;\n --_shadow: var(--md-sys-elevation-0);\n\n border-end-end-radius: var(--ui-button-shape-end-end, var(--_pill-radius));\n border-end-start-radius: var(--ui-button-shape-end-start, var(--_pill-radius));\n border-start-end-radius: var(--ui-button-shape-start-end, var(--_pill-radius));\n border-start-start-radius: var(--ui-button-shape-start-start, var(--_pill-radius));\n background-color: var(--_background-color);\n color: var(--_color);\n box-shadow: var(--_shadow);\n\n /* Interaction styles */\n cursor: pointer;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n outline: none;\n\n transition:\n background-color var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n color var(--md-sys-motion-duration-short2, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n box-shadow var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n border-color var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n /* Icon styling */\n ::slotted([slot='icon']) {\n flex-shrink: 0;\n width: var(--_icon-size);\n height: var(--_icon-size);\n font-size: inherit;\n }\n\n /* Modern CSS: Container queries for responsive sizing */\n @container (min-width: 320px) {\n :host {\n min-width: 80px;\n }\n }\n\n .ripple {\n border-radius: inherit;\n transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n .focus-ring {\n --md-focus-ring-shape-end-end: var(--ui-button-shape-end-end, var(--_pill-radius));\n --md-focus-ring-shape-end-start: var(--ui-button-shape-end-start, var(--_pill-radius));\n --md-focus-ring-shape-start-end: var(--ui-button-shape-start-end, var(--_pill-radius));\n --md-focus-ring-shape-start-start: var(--ui-button-shape-start-start, var(--_pill-radius));\n transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n .ripple.activated {\n z-index: 1;\n }\n\n /* Disabled state */\n :host([disabled]) {\n background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);\n color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n box-shadow: none;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Size Variations */\n :host([size='xs']) {\n min-height: 32px;\n padding-inline: 12px;\n font-size: var(--md-sys-typescale-label-medium-size, 0.75rem);\n gap: 6px;\n --_icon-size: 20px;\n }\n\n :host([size='s']) {\n min-height: 40px;\n padding-inline: 16px;\n --_icon-size: 20px;\n }\n\n :host([size='m']) {\n min-height: 56px;\n padding-inline: 24px;\n font-size: var(--md-sys-typescale-label-large-size, 1rem);\n gap: 10px;\n --_icon-size: 24px;\n }\n\n :host([size='l']) {\n min-height: 96px;\n padding-inline: 48px;\n font-size: var(--md-sys-typescale-title-medium-size, 1.125rem);\n gap: 12px;\n --_icon-size: 32px;\n }\n\n :host([size='xl']) {\n min-height: 136px;\n padding-inline: 64px;\n font-size: var(--md-sys-typescale-title-large-size, 1.375rem);\n gap: 16px;\n --_icon-size: 40px;\n }\n\n /* Pressed state is the same to all combinations of shape and size */\n :host([size='xs'].pressed),\n :host([size='s'].pressed) {\n --_pill-radius: 8px !important;\n }\n :host([size='m'].pressed) {\n --_pill-radius: 12px !important;\n }\n :host([size='xl'].pressed),\n :host([size='l'].pressed) {\n --_pill-radius: 16px !important;\n }\n\n /* Shape setup */\n /* For the round shape, we can't use the \"--md-sys-shape-corner-full\" value as it has a value of 999px and it would make animations impossible so see. */\n :host([toggle][selected][shape='square'][size='xs']),\n :host([shape='round'][size='xs']) {\n --_pill-radius: 16px; /* Half of 32px height */\n }\n :host([toggle][selected][shape='square'][size='s']),\n :host([shape='round'][size='s']) {\n --_pill-radius: 20px; /* Half of 40px height */\n }\n :host([toggle][selected][shape='square'][size='m']),\n :host([shape='round'][size='m']) {\n --_pill-radius: 28px; /* Half of 56px height */\n }\n :host([toggle][selected][shape='square'][size='l']),\n :host([shape='round'][size='l']) {\n --_pill-radius: 48px; /* Half of 96px height */\n }\n :host([toggle][selected][shape='square'][size='xl']),\n :host([shape='round'][size='xl']) {\n --_pill-radius: 68px; /* Half of 136px height */\n }\n\n :host([shape='square'][size='xs']),\n :host([shape='square'][size='s']) {\n --_pill-radius: var(--md-sys-shape-corner-medium);\n }\n\n :host([shape='square'][size='m']) {\n --_pill-radius: var(--md-sys-shape-corner-large);\n }\n\n :host([shape='square'][size='l']),\n :host([shape='square'][size='xl']) {\n --_pill-radius: var(--md-sys-shape-corner-extra-large);\n }\n\n /* Button Color Variants - Material 3 Expressive */\n\n /* Elevated Button */\n :host([color='elevated']) {\n --_background-color: var(--md-sys-color-surface-container-low);\n --_color: var(--md-sys-color-primary);\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='elevated'][toggle][selected]) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='elevated']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-2);\n }\n\n :host([color='elevated'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n --_shadow: var(--md-sys-elevation-0);\n }\n\n /* Filled Button */\n :host([color='filled']) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='filled'][toggle]) {\n --_background-color: var(--md-sys-color-surface-container);\n --_color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([color='filled'][toggle][selected]) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='filled']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='filled'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Filled Tonal Button */\n :host([color='tonal']) {\n --_background-color: var(--md-sys-color-secondary-container);\n --_color: var(--md-sys-color-on-secondary-container);\n }\n\n :host([color='tonal'][toggle]) {\n --_background-color: var(--md-sys-color-secondary-container);\n --_color: var(--md-sys-color-on-secondary-container);\n }\n\n :host([color='tonal'][toggle][selected]) {\n --_background-color: var(--md-sys-color-secondary);\n --_color: var(--md-sys-color-on-secondary);\n }\n\n :host([color='tonal']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='tonal'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Outlined Button */\n :host([color='outlined']) {\n border: 1px var(--md-sys-color-outline-variant) solid;\n --_color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([color='outlined'][toggle][selected]) {\n --_background-color: var(--md-sys-color-inverse-surface);\n --_color: var(--md-sys-color-inverse-on-surface);\n }\n\n :host([color='outlined'][disabled]) {\n border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Text Button */\n :host([color='text']) {\n --_color: var(--md-sys-color-primary);\n }\n\n :host([color='text'][disabled]) {\n color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n :host([toggle][selected][shape='round']) {\n --_pill-radius: var(--md-sys-shape-corner-medium);\n }\n\n /* Preference-based animations */\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0.01ms;\n animation-duration: 0.01ms;\n }\n }\n\n /* High contrast mode support */\n @media (prefers-contrast: high) {\n :host {\n border-width: 2px;\n }\n\n :host([color='text']),\n :host([color='outlined']) {\n border-width: 2px;\n border-style: solid;\n }\n }\n`\n"]}
|
|
1
|
+
{"version":3,"file":"button.styles.js","sourceRoot":"","sources":["../../../../../src/md/button/internals/button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,qEAAqE;AACrE,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2TjB,CAAA","sourcesContent":["import { css } from 'lit'\n\n/* Material Design 3 Expressive Button - CSS-Native Implementation */\nexport default css`\n :host {\n all: unset;\n\n /* Layout and positioning */\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n white-space: nowrap;\n\n /* Default sizing */\n min-height: 40px;\n min-width: 64px;\n padding-inline: 16px;\n gap: 8px;\n\n /* Typography from Material 3 tokens */\n font-family: var(--md-sys-typescale-label-large-font, var(--md-ref-typeface-plain, system-ui));\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n font-weight: var(--md-sys-typescale-label-large-weight, 500);\n line-height: var(--md-sys-typescale-label-large-height, 1.25);\n letter-spacing: var(--md-sys-typescale-label-large-tracking, 0.01em);\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 /* CSS custom property for pill radius - half of the button height */\n --_pill-radius: 20px;\n /* Default icon size */\n --_icon-size: var(--md-button-icon-size, 20px);\n --_background-color: transparent;\n --_color: inherit;\n --_shadow: var(--md-sys-elevation-0);\n\n border-end-end-radius: var(--ui-button-shape-end-end, var(--_pill-radius));\n border-end-start-radius: var(--ui-button-shape-end-start, var(--_pill-radius));\n border-start-end-radius: var(--ui-button-shape-start-end, var(--_pill-radius));\n border-start-start-radius: var(--ui-button-shape-start-start, var(--_pill-radius));\n background-color: var(--_background-color);\n color: var(--_color);\n box-shadow: var(--_shadow);\n\n /* Interaction styles */\n cursor: pointer;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n outline: none;\n\n transition:\n background-color var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n color var(--md-sys-motion-duration-short2, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n box-shadow var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n border-color var(--md-sys-motion-duration-short2, 200ms)\n var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)),\n border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n /* Icon styling */\n ::slotted([slot='icon']) {\n flex-shrink: 0;\n width: var(--_icon-size);\n height: var(--_icon-size);\n font-size: inherit;\n }\n\n /* Modern CSS: Container queries for responsive sizing */\n @container (min-width: 320px) {\n :host {\n min-width: 80px;\n }\n }\n\n .ripple {\n border-radius: inherit;\n transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n .ripple.activated {\n z-index: 1;\n }\n\n .focus-ring {\n --md-focus-ring-shape-end-end: var(--ui-button-shape-end-end, var(--_pill-radius));\n --md-focus-ring-shape-end-start: var(--ui-button-shape-end-start, var(--_pill-radius));\n --md-focus-ring-shape-start-end: var(--ui-button-shape-start-end, var(--_pill-radius));\n --md-focus-ring-shape-start-start: var(--ui-button-shape-start-start, var(--_pill-radius));\n transition: border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);\n }\n\n /* Disabled state */\n :host([disabled]) {\n background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);\n color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n box-shadow: none;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Size Variations */\n :host([size='xs']) {\n min-height: 32px;\n padding-inline: 12px;\n font-size: var(--md-sys-typescale-label-medium-size, 0.75rem);\n gap: 6px;\n --_icon-size: 20px;\n }\n\n :host([size='s']) {\n min-height: 40px;\n padding-inline: 16px;\n --_icon-size: 20px;\n }\n\n :host([size='m']) {\n min-height: 56px;\n padding-inline: 24px;\n font-size: var(--md-sys-typescale-label-large-size, 1rem);\n gap: 10px;\n --_icon-size: 24px;\n }\n\n :host([size='l']) {\n min-height: 96px;\n padding-inline: 48px;\n font-size: var(--md-sys-typescale-title-medium-size, 1.125rem);\n gap: 12px;\n --_icon-size: 32px;\n }\n\n :host([size='xl']) {\n min-height: 136px;\n padding-inline: 64px;\n font-size: var(--md-sys-typescale-title-large-size, 1.375rem);\n gap: 16px;\n --_icon-size: 40px;\n }\n\n /* Pressed state is the same to all combinations of shape and size */\n :host([size='xs'].pressed),\n :host([size='s'].pressed) {\n --_pill-radius: 8px !important;\n }\n :host([size='m'].pressed) {\n --_pill-radius: 12px !important;\n }\n :host([size='xl'].pressed),\n :host([size='l'].pressed) {\n --_pill-radius: 16px !important;\n }\n\n /* Shape setup */\n /* For the round shape, we can't use the \"--md-sys-shape-corner-full\" value as it has a value of 999px and it would make animations impossible so see. */\n :host([toggle][selected][shape='square'][size='xs']),\n :host([shape='round'][size='xs']) {\n --_pill-radius: 16px; /* Half of 32px height */\n }\n :host([toggle][selected][shape='square'][size='s']),\n :host([shape='round'][size='s']) {\n --_pill-radius: 20px; /* Half of 40px height */\n }\n :host([toggle][selected][shape='square'][size='m']),\n :host([shape='round'][size='m']) {\n --_pill-radius: 28px; /* Half of 56px height */\n }\n :host([toggle][selected][shape='square'][size='l']),\n :host([shape='round'][size='l']) {\n --_pill-radius: 48px; /* Half of 96px height */\n }\n :host([toggle][selected][shape='square'][size='xl']),\n :host([shape='round'][size='xl']) {\n --_pill-radius: 68px; /* Half of 136px height */\n }\n\n :host([shape='square'][size='xs']),\n :host([shape='square'][size='s']) {\n --_pill-radius: var(--md-sys-shape-corner-medium);\n }\n\n :host([shape='square'][size='m']) {\n --_pill-radius: var(--md-sys-shape-corner-large);\n }\n\n :host([shape='square'][size='l']),\n :host([shape='square'][size='xl']) {\n --_pill-radius: var(--md-sys-shape-corner-extra-large);\n }\n\n /* Button Color Variants - Material 3 Expressive */\n\n /* Elevated Button */\n :host([color='elevated']) {\n --_background-color: var(--md-sys-color-surface-container-low);\n --_color: var(--md-sys-color-primary);\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='elevated'][toggle][selected]) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='elevated']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-2);\n }\n\n :host([color='elevated'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n --_shadow: var(--md-sys-elevation-0);\n }\n\n /* Filled Button */\n :host([color='filled']) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='filled'][toggle]) {\n --_background-color: var(--md-sys-color-surface-container);\n --_color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([color='filled'][toggle][selected]) {\n --_background-color: var(--md-sys-color-primary);\n --_color: var(--md-sys-color-on-primary);\n }\n\n :host([color='filled']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='filled'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Filled Tonal Button */\n :host([color='tonal']) {\n --_background-color: var(--md-sys-color-secondary-container);\n --_color: var(--md-sys-color-on-secondary-container);\n }\n\n :host([color='tonal'][toggle]) {\n --_background-color: var(--md-sys-color-secondary-container);\n --_color: var(--md-sys-color-on-secondary-container);\n }\n\n :host([color='tonal'][toggle][selected]) {\n --_background-color: var(--md-sys-color-secondary);\n --_color: var(--md-sys-color-on-secondary);\n }\n\n :host([color='tonal']:hover:not([disabled])) {\n --_shadow: var(--md-sys-elevation-1);\n }\n\n :host([color='tonal'][disabled]) {\n --_background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Outlined Button */\n :host([color='outlined']) {\n border: 1px var(--md-sys-color-outline-variant) solid;\n --_color: var(--md-sys-color-on-surface-variant);\n }\n\n :host([color='outlined'][toggle][selected]) {\n --_background-color: var(--md-sys-color-inverse-surface);\n --_color: var(--md-sys-color-inverse-on-surface);\n }\n\n :host([color='outlined'][disabled]) {\n border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);\n --_color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n /* Text Button */\n :host([color='text']) {\n --_color: var(--md-sys-color-primary);\n }\n\n :host([color='text'][disabled]) {\n color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);\n }\n\n :host([toggle][selected][shape='round']) {\n --_pill-radius: var(--md-sys-shape-corner-medium);\n }\n\n /* Preference-based animations */\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0.01ms;\n animation-duration: 0.01ms;\n }\n }\n\n /* High contrast mode support */\n @media (prefers-contrast: high) {\n :host {\n border-width: 2px;\n }\n\n :host([color='text']),\n :host([color='outlined']) {\n border-width: 2px;\n border-style: solid;\n }\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"]}
|
|
@@ -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
|
})();
|