@api-client/ui 0.5.47 → 0.5.49
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/data-table/DataTable.d.ts +1 -1
- package/build/src/elements/data-table/DataTable.js +3 -3
- package/build/src/elements/data-table/DataTable.js.map +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.d.ts +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.d.ts.map +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.js +3 -3
- package/build/src/elements/file-system/internals/Breadcrumbs.js.map +1 -1
- package/build/src/elements/navigation/internals/NavigationItem.d.ts +2 -0
- package/build/src/elements/navigation/internals/NavigationItem.d.ts.map +1 -1
- package/build/src/elements/navigation/internals/NavigationItem.js +4 -2
- package/build/src/elements/navigation/internals/NavigationItem.js.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.d.ts +26 -4
- package/build/src/elements/user/internals/UserAvatar.d.ts.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.js +125 -12
- package/build/src/elements/user/internals/UserAvatar.js.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.styles.d.ts.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.styles.js +6 -11
- package/build/src/elements/user/internals/UserAvatar.styles.js.map +1 -1
- package/build/src/md/button/internals/base.d.ts +1 -1
- package/build/src/md/button/internals/base.d.ts.map +1 -1
- package/build/src/md/button/internals/base.js +2 -2
- package/build/src/md/button/internals/base.js.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.js +2 -2
- package/build/src/md/checkbox/internals/CheckboxElement.js.map +1 -1
- package/build/src/md/collapse/internals/Collapse.d.ts.map +1 -1
- package/build/src/md/collapse/internals/Collapse.js +4 -1
- package/build/src/md/collapse/internals/Collapse.js.map +1 -1
- package/build/src/md/collapse/internals/Collapse.styles.d.ts.map +1 -1
- package/build/src/md/collapse/internals/Collapse.styles.js +1 -0
- package/build/src/md/collapse/internals/Collapse.styles.js.map +1 -1
- package/build/src/md/focus-ring/internals/focus-ring.d.ts +87 -0
- package/build/src/md/focus-ring/internals/focus-ring.d.ts.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.js +206 -0
- package/build/src/md/focus-ring/internals/focus-ring.js.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.d.ts +3 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.d.ts.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.js +109 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.js.map +1 -0
- package/build/src/md/focus-ring/ui-focus-ring.d.ts +42 -0
- package/build/src/md/focus-ring/ui-focus-ring.d.ts.map +1 -0
- package/build/src/md/focus-ring/ui-focus-ring.js +58 -0
- package/build/src/md/focus-ring/ui-focus-ring.js.map +1 -0
- package/build/src/md/list/internals/ListItem.d.ts +3 -3
- package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.js +7 -6
- package/build/src/md/list/internals/ListItem.js.map +1 -1
- package/build/src/md/menu/internal/MenuItem.d.ts +0 -2
- package/build/src/md/menu/internal/MenuItem.d.ts.map +1 -1
- package/build/src/md/menu/internal/MenuItem.js +0 -2
- package/build/src/md/menu/internal/MenuItem.js.map +1 -1
- package/build/src/md/radio/internals/Radio.styles.js +1 -1
- package/build/src/md/radio/internals/Radio.styles.js.map +1 -1
- package/build/src/md/radio/internals/RadioElement.d.ts +1 -0
- package/build/src/md/radio/internals/RadioElement.d.ts.map +1 -1
- package/build/src/md/radio/internals/RadioElement.js +2 -0
- package/build/src/md/radio/internals/RadioElement.js.map +1 -1
- package/build/src/md/select/internals/Select.d.ts +1 -1
- package/build/src/md/select/internals/Select.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.js +2 -2
- package/build/src/md/select/internals/Select.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.d.ts +1 -0
- package/build/src/md/tabs/internals/Tab.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.js +3 -2
- package/build/src/md/tabs/internals/Tab.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.js +4 -4
- package/build/src/md/tabs/internals/Tabs.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/src/elements/data-table/DataTable.ts +3 -3
- package/src/elements/file-system/internals/Breadcrumbs.ts +3 -3
- package/src/elements/navigation/internals/NavigationItem.ts +4 -2
- package/src/elements/user/internals/UserAvatar.styles.ts +6 -11
- package/src/elements/user/internals/UserAvatar.ts +115 -8
- package/src/md/button/internals/base.ts +2 -2
- package/src/md/checkbox/internals/CheckboxElement.ts +2 -2
- package/src/md/collapse/internals/Collapse.styles.ts +1 -0
- package/src/md/collapse/internals/Collapse.ts +4 -1
- package/src/md/focus-ring/internals/focus-ring.styles.ts +109 -0
- package/src/md/focus-ring/internals/focus-ring.ts +184 -0
- package/src/md/focus-ring/ui-focus-ring.ts +46 -0
- package/src/md/list/internals/ListItem.ts +5 -5
- package/src/md/menu/internal/MenuItem.ts +0 -2
- package/src/md/radio/internals/Radio.styles.ts +1 -1
- package/src/md/radio/internals/RadioElement.ts +2 -0
- package/src/md/select/internals/Select.ts +2 -2
- package/src/md/tabs/internals/Tab.ts +4 -2
- package/src/md/tabs/internals/Tabs.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.js","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;;sBAMd,SAAS;;;;;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AC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QACpD,CAAC;QAEQ,MAAM;YACb,OAAO,IAAI,CAAA,eAAe,CAAA;QAC5B,CAAC;;;AAlNH;;;GAGG;AACH,0BA+MC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { UiElement } from '../../UiElement.js'\nimport { setDisabled } from '../../../lib/disabled.js'\n\n/**\n * @fires transitioning - When the element is transitioning.\n * @slot - Main slot for the content\n */\nexport default class UiCollapse extends UiElement {\n /**\n * Whether the chip is disabled. The user can't interact with the chip when `true`.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Set noAnimation to true to disable animations.\n * @attr\n */\n @property({ type: Boolean, reflect: true }) accessor noAnimation: boolean | undefined\n\n /**\n * Renders the collapse horizontally when true and vertically otherwise\n * @attribute\n */\n @property({ type: Boolean }) accessor horizontal = false\n\n /**\n * Set opened to true to show the collapse element and to false to hide it.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n get dimension(): 'width' | 'height' {\n return this.horizontal ? 'width' : 'height'\n }\n\n /**\n * `maxWidth` or `maxHeight`.\n * @private\n */\n get dimensionMax(): 'maxWidth' | 'maxHeight' {\n return this.horizontal ? 'maxWidth' : 'maxHeight'\n }\n\n /**\n * `max-width` or `max-height`.\n * @private\n */\n get dimensionMaxCss(): 'max-width' | 'max-height' {\n return this.horizontal ? 'max-width' : 'max-height'\n }\n\n get isAttached(): boolean {\n return !!this.parentNode\n }\n\n protected transitioningInternal = false\n\n /**\n * @return When true, the element is transitioning its open state. When false,\n * the element has finished opening/closing.\n */\n get transitioning(): boolean {\n return this.transitioningInternal\n }\n\n /**\n * Stores the desired size of the collapse body.\n */\n protected desiredSize = ''\n\n constructor() {\n super()\n this.addEventListener('transitionend', this.handleTransitionEnd.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'group')\n }\n if (!this.hasAttribute('aria-hidden')) {\n this.setAttribute('aria-hidden', 'true')\n }\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('open')) {\n this.handleOpenChange()\n }\n if (cp.has('horizontal')) {\n this.handleHorizontalChange()\n }\n if (cp.has('disabled')) {\n setDisabled(this, cp.get('disabled'))\n }\n super.willUpdate(cp)\n }\n\n /**\n * Toggle the opened state.\n */\n toggle(): void {\n this.open = !this.open\n this.dispatchEvent(new Event('open'))\n }\n\n /**\n * Updates the size of the element.\n * @param size The new value for `maxWidth`/`maxHeight` as css property value, usually `auto` or `0px`.\n * @param animated if `true` updates the size with an animation, otherwise without.\n */\n protected updateSize(size: string, animated?: boolean): void {\n // Consider 'auto' as '', to take full size.\n let sizeValue = size === 'auto' ? '' : size\n\n let willAnimate = animated && !this.noAnimation && this.isAttached\n this.desiredSize = sizeValue\n\n this.updateTransition(false)\n // If we can animate, must do some prep work.\n if (willAnimate) {\n // Animation will start at the current size.\n const startSize = this.calcSize()\n // For `auto` we must calculate what is the final size for the animation.\n // After the transition is done, _transitionEnd will set the size back to\n // `auto`.\n if (sizeValue === '') {\n this.style[this.dimensionMax] = ''\n sizeValue = this.calcSize()\n }\n // Go to startSize without animation.\n\n this.style[this.dimensionMax] = startSize\n // Force layout to ensure transition will go. Set scrollTop to itself\n // so that compilers won't remove it.\n // eslint-disable-next-line no-self-assign\n this.scrollTop = this.scrollTop\n // Enable animation.\n this.updateTransition(true)\n // If final size is the same as startSize it will not animate.\n willAnimate = sizeValue !== startSize\n }\n // Set the final size.\n\n this.style[this.dimensionMax] = sizeValue\n // If it won't animate, call transitionEnd to set correct styles.\n if (!willAnimate) {\n this.transitionEnd()\n }\n }\n\n protected updateTransition(enabled?: boolean): void {\n this.style.transitionDuration = enabled && !this.noAnimation ? '' : '0s'\n }\n\n /**\n * Calculates the size of the element when opened.\n */\n protected calcSize(): string {\n const value = this.getBoundingClientRect()[this.dimension]\n return `${value}px`\n }\n\n protected transitionEnd(): void {\n this.style[this.dimensionMax] = this.desiredSize\n this.toggleAttribute('collapse-closed', !this.open)\n this.toggleAttribute('collapse-opened', this.open)\n this.updateTransition(false)\n this.notifyResize()\n this.transitioningInternal = false\n this.notifyTransitioning()\n }\n\n protected notifyResize(): void {\n this.dispatchEvent(new Event('resize', { bubbles: true, composed: true, cancelable: true }))\n }\n\n protected notifyTransitioning(): void {\n this.dispatchEvent(new Event('transitioning', { bubbles: true, composed: true, cancelable: true }))\n }\n\n protected handleTransitionEnd(e: Event): void {\n const target = e.composedPath().find((node) => node === this)\n if (target) {\n this.transitionEnd()\n }\n }\n\n protected handleOpenChange(): void {\n const { open } = this\n this.setAttribute('aria-hidden', String(!open))\n this.transitioningInternal = true\n this.notifyTransitioning()\n this.toggleAttribute('collapse-closed', false)\n this.toggleAttribute('collapse-opened', false)\n this.updateSize(open ? 'auto' : '0px', true)\n\n // Focus the current collapse.\n if (open) {\n this.focus()\n }\n }\n\n protected handleHorizontalChange(): void {\n this.style.transitionProperty = this.dimensionMaxCss\n const otherDimension = this.dimensionMax === 'maxWidth' ? 'maxHeight' : 'maxWidth'\n this.style[otherDimension] = ''\n this.updateSize(this.open ? 'auto' : '0px', false)\n }\n\n override render(): TemplateResult {\n return html`<slot></slot>`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Collapse.js","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;;sBAMd,SAAS;;;;;;;;;;;;;iBAA5B,UAAW,SAAQ,WAAS;;;oCAK9C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,E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,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QACpD,CAAC;QAEQ,MAAM;YACb,OAAO,IAAI,CAAA,eAAe,CAAA;QAC5B,CAAC;;;AArNH;;;GAGG;AACH,0BAkNC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { UiElement } from '../../UiElement.js'\nimport { setDisabled } from '../../../lib/disabled.js'\n\n/**\n * @fires transitioning - When the element is transitioning.\n * @slot - Main slot for the content\n */\nexport default class UiCollapse extends UiElement {\n /**\n * Whether the chip is disabled. The user can't interact with the chip when `true`.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Set noAnimation to true to disable animations.\n * @attr\n */\n @property({ type: Boolean, reflect: true }) accessor noAnimation: boolean | undefined\n\n /**\n * Renders the collapse horizontally when true and vertically otherwise\n * @attribute\n */\n @property({ type: Boolean }) accessor horizontal = false\n\n /**\n * Set opened to true to show the collapse element and to false to hide it.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n get dimension(): 'width' | 'height' {\n return this.horizontal ? 'width' : 'height'\n }\n\n /**\n * `maxWidth` or `maxHeight`.\n * @private\n */\n get dimensionMax(): 'maxWidth' | 'maxHeight' {\n return this.horizontal ? 'maxWidth' : 'maxHeight'\n }\n\n /**\n * `max-width` or `max-height`.\n * @private\n */\n get dimensionMaxCss(): 'max-width' | 'max-height' {\n return this.horizontal ? 'max-width' : 'max-height'\n }\n\n get isAttached(): boolean {\n return !!this.parentNode\n }\n\n protected transitioningInternal = false\n\n /**\n * @return When true, the element is transitioning its open state. When false,\n * the element has finished opening/closing.\n */\n get transitioning(): boolean {\n return this.transitioningInternal\n }\n\n /**\n * Stores the desired size of the collapse body.\n */\n protected desiredSize = ''\n\n constructor() {\n super()\n this.addEventListener('transitionend', this.handleTransitionEnd.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'group')\n }\n if (!this.hasAttribute('aria-hidden')) {\n this.setAttribute('aria-hidden', 'true')\n }\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('open')) {\n this.handleOpenChange()\n }\n if (cp.has('horizontal')) {\n this.handleHorizontalChange()\n }\n if (cp.has('disabled')) {\n setDisabled(this, cp.get('disabled'))\n }\n super.willUpdate(cp)\n }\n\n /**\n * Toggle the opened state.\n */\n toggle(): void {\n this.open = !this.open\n this.dispatchEvent(new Event('toggle'))\n }\n\n /**\n * Updates the size of the element.\n * @param size The new value for `maxWidth`/`maxHeight` as css property value, usually `auto` or `0px`.\n * @param animated if `true` updates the size with an animation, otherwise without.\n */\n protected updateSize(size: string, animated?: boolean): void {\n // Consider 'auto' as '', to take full size.\n let sizeValue = size === 'auto' ? '' : size\n\n let willAnimate = animated && !this.noAnimation && this.isAttached\n this.desiredSize = sizeValue\n\n this.updateTransition(false)\n // If we can animate, must do some prep work.\n if (willAnimate) {\n // Animation will start at the current size.\n const startSize = this.calcSize()\n // For `auto` we must calculate what is the final size for the animation.\n // After the transition is done, _transitionEnd will set the size back to\n // `auto`.\n if (sizeValue === '') {\n // Temporarily remove constraint to measure natural size\n const currentMaxDimension = this.style[this.dimensionMax]\n this.style[this.dimensionMax] = ''\n sizeValue = this.calcSize()\n this.style[this.dimensionMax] = currentMaxDimension\n }\n // Go to startSize without animation.\n\n this.style[this.dimensionMax] = startSize\n // Force layout to ensure transition will go. Set scrollTop to itself\n // so that compilers won't remove it.\n // eslint-disable-next-line no-self-assign\n this.scrollTop = this.scrollTop\n // Enable animation.\n this.updateTransition(true)\n // If final size is the same as startSize it will not animate.\n willAnimate = sizeValue !== startSize\n }\n // Set the final size.\n\n this.style[this.dimensionMax] = sizeValue\n // If it won't animate, call transitionEnd to set correct styles.\n if (!willAnimate) {\n this.transitionEnd()\n }\n }\n\n protected updateTransition(enabled?: boolean): void {\n this.style.transitionDuration = enabled && !this.noAnimation ? '' : '0s'\n }\n\n /**\n * Calculates the size of the element when opened.\n */\n protected calcSize(): string {\n const value = this.getBoundingClientRect()[this.dimension]\n return `${value}px`\n }\n\n protected transitionEnd(): void {\n this.style[this.dimensionMax] = this.desiredSize\n this.toggleAttribute('collapse-closed', !this.open)\n this.toggleAttribute('collapse-opened', this.open)\n this.updateTransition(false)\n this.notifyResize()\n this.transitioningInternal = false\n this.notifyTransitioning()\n }\n\n protected notifyResize(): void {\n this.dispatchEvent(new Event('resize', { bubbles: true, composed: true, cancelable: true }))\n }\n\n protected notifyTransitioning(): void {\n this.dispatchEvent(new Event('transitioning', { bubbles: true, composed: true, cancelable: true }))\n }\n\n protected handleTransitionEnd(e: Event): void {\n const target = e.composedPath().find((node) => node === this)\n if (target) {\n this.transitionEnd()\n }\n }\n\n protected handleOpenChange(): void {\n const { open } = this\n this.setAttribute('aria-hidden', String(!open))\n this.transitioningInternal = true\n this.notifyTransitioning()\n this.toggleAttribute('collapse-closed', false)\n this.toggleAttribute('collapse-opened', false)\n this.updateSize(open ? 'auto' : '0px', true)\n\n // Focus the current collapse.\n if (open) {\n this.focus()\n }\n }\n\n protected handleHorizontalChange(): void {\n this.style.transitionProperty = this.dimensionMaxCss\n const otherDimension = this.dimensionMax === 'maxWidth' ? 'maxHeight' : 'maxWidth'\n this.style[otherDimension] = ''\n this.updateSize(this.open ? 'auto' : '0px', false)\n }\n\n override render(): TemplateResult {\n return html`<slot></slot>`\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.styles.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"Collapse.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.styles.ts"],"names":[],"mappings":";AAEA,wBAgBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.styles.js","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"Collapse.styles.js","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;CAgBjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: block;\n transition-duration: var(--ui-collapse-transition-duration, 300ms);\n transition-timing-function: cubic-bezier(0.2, 0, 0, 1);\n transition-property: max-height, max-width;\n overflow: visible;\n }\n\n :host([collapse-closed]) {\n display: none;\n }\n\n :host(:not([collapse-opened])) {\n overflow: hidden;\n }\n`\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A focus ring component that provides a visible focus indicator.
|
|
4
|
+
* This component automatically manages the visibility of the focus ring
|
|
5
|
+
* based on the focus state of its control element.
|
|
6
|
+
*
|
|
7
|
+
* @fires visibility-changed - Dispatched when the focus ring visibility changes.
|
|
8
|
+
* - `detail`: An object with a `visible` property (boolean).
|
|
9
|
+
*/
|
|
10
|
+
export default class UiFocusRing extends LitElement {
|
|
11
|
+
/**
|
|
12
|
+
* The control element that this focus ring is associated with.
|
|
13
|
+
* When the control gains or loses focus, the focus ring will show or hide.
|
|
14
|
+
*/
|
|
15
|
+
accessor control: HTMLElement | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* An element to attach the focus ring to. Defaults to the parent element.
|
|
18
|
+
* This is typically used when the focus ring should be positioned relative
|
|
19
|
+
* to a different element than the control.
|
|
20
|
+
*/
|
|
21
|
+
accessor attach: HTMLElement | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* An ID of an element that this focus ring is for.
|
|
24
|
+
* Alternative to setting the `control` property directly.
|
|
25
|
+
* @attribute
|
|
26
|
+
*/
|
|
27
|
+
accessor for: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the focus ring should render inward instead of outward.
|
|
30
|
+
* When true, the focus ring will be positioned inside the control bounds.
|
|
31
|
+
* @attribute
|
|
32
|
+
*/
|
|
33
|
+
accessor inward: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The internal visibility state of the focus ring.
|
|
36
|
+
*/
|
|
37
|
+
accessor visible: boolean;
|
|
38
|
+
private abortController?;
|
|
39
|
+
constructor();
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
43
|
+
/**
|
|
44
|
+
* Sets up the control element and event listeners.
|
|
45
|
+
*/
|
|
46
|
+
private setupControl;
|
|
47
|
+
/**
|
|
48
|
+
* Cleans up event listeners.
|
|
49
|
+
*/
|
|
50
|
+
private cleanupListeners;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the control element from either the `control` property,
|
|
53
|
+
* the `for` attribute, or defaults to the parent element.
|
|
54
|
+
*/
|
|
55
|
+
private getControl;
|
|
56
|
+
/**
|
|
57
|
+
* Handles focus events from the control element.
|
|
58
|
+
*/
|
|
59
|
+
private handleFocus;
|
|
60
|
+
/**
|
|
61
|
+
* Handles blur events from the control element.
|
|
62
|
+
*/
|
|
63
|
+
private handleBlur;
|
|
64
|
+
/**
|
|
65
|
+
* Handles pointer down events to hide focus ring during mouse interaction.
|
|
66
|
+
*/
|
|
67
|
+
private handlePointerDown;
|
|
68
|
+
/**
|
|
69
|
+
* Determines if the focus ring should be shown based on the focus event.
|
|
70
|
+
* The focus ring should only show for keyboard navigation, not mouse clicks.
|
|
71
|
+
*/
|
|
72
|
+
private shouldShowFocusRing;
|
|
73
|
+
/**
|
|
74
|
+
* Shows the focus ring.
|
|
75
|
+
*/
|
|
76
|
+
show(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Hides the focus ring.
|
|
79
|
+
*/
|
|
80
|
+
hide(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Handles the visibility changed event.
|
|
83
|
+
*/
|
|
84
|
+
private onVisibilityChanged;
|
|
85
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=focus-ring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.d.ts","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAGrD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IACjD;;;OAGG;IACyB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAA;IAErE;;;;OAIG;IACyB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAEpE;;;;OAIG;IACyB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IAE5D;;;;OAIG;IACyC,QAAQ,CAAC,MAAM,UAAQ;IAEnE;;OAEG;IACyC,QAAQ,CAAC,OAAO,UAAQ;IAEpE,OAAO,CAAC,eAAe,CAAC,CAAiB;;IAOhC,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;cAKlB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAM5E;;OAEG;IACH,OAAO,CAAC,YAAY;IAkBpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAalB;;OAEG;IACH,OAAO,CAAC,WAAW,CAKlB;IAED;;OAEG;IACH,OAAO,CAAC,UAAU,CAEjB;IAED;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAExB;IAED;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAG1B;cAEkB,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;CAa1E"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
let UiFocusRing = (() => {
|
|
5
|
+
let _classSuper = LitElement;
|
|
6
|
+
let _control_decorators;
|
|
7
|
+
let _control_initializers = [];
|
|
8
|
+
let _control_extraInitializers = [];
|
|
9
|
+
let _attach_decorators;
|
|
10
|
+
let _attach_initializers = [];
|
|
11
|
+
let _attach_extraInitializers = [];
|
|
12
|
+
let _for_decorators;
|
|
13
|
+
let _for_initializers = [];
|
|
14
|
+
let _for_extraInitializers = [];
|
|
15
|
+
let _inward_decorators;
|
|
16
|
+
let _inward_initializers = [];
|
|
17
|
+
let _inward_extraInitializers = [];
|
|
18
|
+
let _visible_decorators;
|
|
19
|
+
let _visible_initializers = [];
|
|
20
|
+
let _visible_extraInitializers = [];
|
|
21
|
+
return class UiFocusRing extends _classSuper {
|
|
22
|
+
static {
|
|
23
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
24
|
+
_control_decorators = [property({ type: Object })];
|
|
25
|
+
_attach_decorators = [property({ type: Object })];
|
|
26
|
+
_for_decorators = [property({ type: String })];
|
|
27
|
+
_inward_decorators = [property({ type: Boolean, reflect: true })];
|
|
28
|
+
_visible_decorators = [property({ type: Boolean, reflect: true })];
|
|
29
|
+
__esDecorate(this, null, _control_decorators, { kind: "accessor", name: "control", static: false, private: false, access: { has: obj => "control" in obj, get: obj => obj.control, set: (obj, value) => { obj.control = value; } }, metadata: _metadata }, _control_initializers, _control_extraInitializers);
|
|
30
|
+
__esDecorate(this, null, _attach_decorators, { kind: "accessor", name: "attach", static: false, private: false, access: { has: obj => "attach" in obj, get: obj => obj.attach, set: (obj, value) => { obj.attach = value; } }, metadata: _metadata }, _attach_initializers, _attach_extraInitializers);
|
|
31
|
+
__esDecorate(this, null, _for_decorators, { kind: "accessor", name: "for", static: false, private: false, access: { has: obj => "for" in obj, get: obj => obj.for, set: (obj, value) => { obj.for = value; } }, metadata: _metadata }, _for_initializers, _for_extraInitializers);
|
|
32
|
+
__esDecorate(this, null, _inward_decorators, { kind: "accessor", name: "inward", static: false, private: false, access: { has: obj => "inward" in obj, get: obj => obj.inward, set: (obj, value) => { obj.inward = value; } }, metadata: _metadata }, _inward_initializers, _inward_extraInitializers);
|
|
33
|
+
__esDecorate(this, null, _visible_decorators, { kind: "accessor", name: "visible", static: false, private: false, access: { has: obj => "visible" in obj, get: obj => obj.visible, set: (obj, value) => { obj.visible = value; } }, metadata: _metadata }, _visible_initializers, _visible_extraInitializers);
|
|
34
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
35
|
+
}
|
|
36
|
+
#control_accessor_storage = __runInitializers(this, _control_initializers, void 0);
|
|
37
|
+
/**
|
|
38
|
+
* The control element that this focus ring is associated with.
|
|
39
|
+
* When the control gains or loses focus, the focus ring will show or hide.
|
|
40
|
+
*/
|
|
41
|
+
get control() { return this.#control_accessor_storage; }
|
|
42
|
+
set control(value) { this.#control_accessor_storage = value; }
|
|
43
|
+
#attach_accessor_storage = (__runInitializers(this, _control_extraInitializers), __runInitializers(this, _attach_initializers, void 0));
|
|
44
|
+
/**
|
|
45
|
+
* An element to attach the focus ring to. Defaults to the parent element.
|
|
46
|
+
* This is typically used when the focus ring should be positioned relative
|
|
47
|
+
* to a different element than the control.
|
|
48
|
+
*/
|
|
49
|
+
get attach() { return this.#attach_accessor_storage; }
|
|
50
|
+
set attach(value) { this.#attach_accessor_storage = value; }
|
|
51
|
+
#for_accessor_storage = (__runInitializers(this, _attach_extraInitializers), __runInitializers(this, _for_initializers, void 0));
|
|
52
|
+
/**
|
|
53
|
+
* An ID of an element that this focus ring is for.
|
|
54
|
+
* Alternative to setting the `control` property directly.
|
|
55
|
+
* @attribute
|
|
56
|
+
*/
|
|
57
|
+
get for() { return this.#for_accessor_storage; }
|
|
58
|
+
set for(value) { this.#for_accessor_storage = value; }
|
|
59
|
+
#inward_accessor_storage = (__runInitializers(this, _for_extraInitializers), __runInitializers(this, _inward_initializers, false
|
|
60
|
+
/**
|
|
61
|
+
* The internal visibility state of the focus ring.
|
|
62
|
+
*/
|
|
63
|
+
));
|
|
64
|
+
/**
|
|
65
|
+
* Whether the focus ring should render inward instead of outward.
|
|
66
|
+
* When true, the focus ring will be positioned inside the control bounds.
|
|
67
|
+
* @attribute
|
|
68
|
+
*/
|
|
69
|
+
get inward() { return this.#inward_accessor_storage; }
|
|
70
|
+
set inward(value) { this.#inward_accessor_storage = value; }
|
|
71
|
+
#visible_accessor_storage = (__runInitializers(this, _inward_extraInitializers), __runInitializers(this, _visible_initializers, false));
|
|
72
|
+
/**
|
|
73
|
+
* The internal visibility state of the focus ring.
|
|
74
|
+
*/
|
|
75
|
+
get visible() { return this.#visible_accessor_storage; }
|
|
76
|
+
set visible(value) { this.#visible_accessor_storage = value; }
|
|
77
|
+
abortController = __runInitializers(this, _visible_extraInitializers);
|
|
78
|
+
constructor() {
|
|
79
|
+
super();
|
|
80
|
+
this.addEventListener('visibility-changed', this.onVisibilityChanged);
|
|
81
|
+
}
|
|
82
|
+
connectedCallback() {
|
|
83
|
+
super.connectedCallback();
|
|
84
|
+
this.setupControl();
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
super.disconnectedCallback();
|
|
88
|
+
this.cleanupListeners();
|
|
89
|
+
}
|
|
90
|
+
willUpdate(changedProperties) {
|
|
91
|
+
if (changedProperties.has('for') || changedProperties.has('control')) {
|
|
92
|
+
this.setupControl();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets up the control element and event listeners.
|
|
97
|
+
*/
|
|
98
|
+
setupControl() {
|
|
99
|
+
this.cleanupListeners();
|
|
100
|
+
const control = this.getControl();
|
|
101
|
+
if (!control)
|
|
102
|
+
return;
|
|
103
|
+
this.abortController = new AbortController();
|
|
104
|
+
const { signal } = this.abortController;
|
|
105
|
+
// Listen for focus and blur events
|
|
106
|
+
control.addEventListener('focus', this.handleFocus, { signal });
|
|
107
|
+
control.addEventListener('blur', this.handleBlur, { signal });
|
|
108
|
+
control.addEventListener('pointerdown', this.handlePointerDown, { signal });
|
|
109
|
+
// Set initial state
|
|
110
|
+
this.visible = control.matches(':focus-visible');
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Cleans up event listeners.
|
|
114
|
+
*/
|
|
115
|
+
cleanupListeners() {
|
|
116
|
+
this.abortController?.abort();
|
|
117
|
+
this.abortController = undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Gets the control element from either the `control` property,
|
|
121
|
+
* the `for` attribute, or defaults to the parent element.
|
|
122
|
+
*/
|
|
123
|
+
getControl() {
|
|
124
|
+
if (this.control) {
|
|
125
|
+
return this.control;
|
|
126
|
+
}
|
|
127
|
+
if (this.for) {
|
|
128
|
+
const root = this.getRootNode();
|
|
129
|
+
return root.getElementById(this.for);
|
|
130
|
+
}
|
|
131
|
+
return this.parentElement;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Handles focus events from the control element.
|
|
135
|
+
*/
|
|
136
|
+
handleFocus = (event) => {
|
|
137
|
+
// Only show focus ring for keyboard navigation
|
|
138
|
+
if (this.shouldShowFocusRing(event)) {
|
|
139
|
+
this.show();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Handles blur events from the control element.
|
|
144
|
+
*/
|
|
145
|
+
handleBlur = () => {
|
|
146
|
+
this.hide();
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Handles pointer down events to hide focus ring during mouse interaction.
|
|
150
|
+
*/
|
|
151
|
+
handlePointerDown = () => {
|
|
152
|
+
this.hide();
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Determines if the focus ring should be shown based on the focus event.
|
|
156
|
+
* The focus ring should only show for keyboard navigation, not mouse clicks.
|
|
157
|
+
*/
|
|
158
|
+
shouldShowFocusRing(event) {
|
|
159
|
+
const control = event.target;
|
|
160
|
+
return control?.matches(':focus-visible') ?? false;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Shows the focus ring.
|
|
164
|
+
*/
|
|
165
|
+
show() {
|
|
166
|
+
if (this.visible)
|
|
167
|
+
return;
|
|
168
|
+
this.visible = true;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Hides the focus ring.
|
|
172
|
+
*/
|
|
173
|
+
hide() {
|
|
174
|
+
if (!this.visible)
|
|
175
|
+
return;
|
|
176
|
+
this.visible = false;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Handles the visibility changed event.
|
|
180
|
+
*/
|
|
181
|
+
onVisibilityChanged = (event) => {
|
|
182
|
+
// Stop propagation to prevent multiple focus rings from interfering
|
|
183
|
+
event.stopPropagation();
|
|
184
|
+
};
|
|
185
|
+
updated(changedProperties) {
|
|
186
|
+
super.updated(changedProperties);
|
|
187
|
+
if (changedProperties.has('visible')) {
|
|
188
|
+
this.dispatchEvent(new CustomEvent('visibility-changed', {
|
|
189
|
+
detail: { visible: this.visible },
|
|
190
|
+
bubbles: false,
|
|
191
|
+
composed: true,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
})();
|
|
197
|
+
/**
|
|
198
|
+
* A focus ring component that provides a visible focus indicator.
|
|
199
|
+
* This component automatically manages the visibility of the focus ring
|
|
200
|
+
* based on the focus state of its control element.
|
|
201
|
+
*
|
|
202
|
+
* @fires visibility-changed - Dispatched when the focus ring visibility changes.
|
|
203
|
+
* - `detail`: An object with a `visible` property (boolean).
|
|
204
|
+
*/
|
|
205
|
+
export default UiFocusRing;
|
|
206
|
+
//# sourceMappingURL=focus-ring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;;sBAUH,UAAU;;;;;;;;;;;;;;;;iBAA9B,WAAY,SAAQ,WAAU;;;mCAKhD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+BAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mCAK1C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YA1Bf,0KAAS,OAAO,6BAAP,OAAO,yFAAyB;YAOzC,uKAAS,MAAM,6BAAN,MAAM,uFAAyB;YAOxC,8JAAS,GAAG,6BAAH,GAAG,iFAAoB;YAOhB,uKAAS,MAAM,6BAAN,MAAM,uFAAQ;YAKvB,0KAAS,OAAO,6BAAP,OAAO,yFAAQ;;;QA1BxC,mFAAyC;QAJrE;;;WAGG;QACyB,IAAS,OAAO,6CAAyB;QAAzC,IAAS,OAAO,mDAAyB;QAOzC,wIAAwC;QALpE;;;;WAIG;QACyB,IAAS,MAAM,4CAAyB;QA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AM,OAAO,GAAG,KAAK,CAAC,MAAqB,CAAA;YAC3C,OAAO,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAA;QACpD,CAAC;QAED;;WAEG;QACH,IAAI;YACF,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAM;YACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACrB,CAAC;QAED;;WAEG;QACH,IAAI;YACF,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,OAAM;YACzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACtB,CAAC;QAED;;WAEG;QACK,mBAAmB,GAAG,CAAC,KAAY,EAAQ,EAAE;YACnD,oEAAoE;YACpE,KAAK,CAAC,eAAe,EAAE,CAAA;QACzB,CAAC,CAAA;QAEkB,OAAO,CAAC,iBAAuC;YAChE,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;YAEhC,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,oBAAoB,EAAE;oBACpC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;oBACjC,OAAO,EAAE,KAAK;oBACd,QAAQ,EAAE,IAAI;iBACf,CAAC,CACH,CAAA;YACH,CAAC;QACH,CAAC;;;AAnLH;;;;;;;GAOG;AACH,2BA4KC","sourcesContent":["import { LitElement, type PropertyValues } from 'lit'\nimport { property } from 'lit/decorators.js'\n\n/**\n * A focus ring component that provides a visible focus indicator.\n * This component automatically manages the visibility of the focus ring\n * based on the focus state of its control element.\n *\n * @fires visibility-changed - Dispatched when the focus ring visibility changes.\n * - `detail`: An object with a `visible` property (boolean).\n */\nexport default class UiFocusRing extends LitElement {\n /**\n * The control element that this focus ring is associated with.\n * When the control gains or loses focus, the focus ring will show or hide.\n */\n @property({ type: Object }) accessor control: HTMLElement | undefined\n\n /**\n * An element to attach the focus ring to. Defaults to the parent element.\n * This is typically used when the focus ring should be positioned relative\n * to a different element than the control.\n */\n @property({ type: Object }) accessor attach: HTMLElement | undefined\n\n /**\n * An ID of an element that this focus ring is for.\n * Alternative to setting the `control` property directly.\n * @attribute\n */\n @property({ type: String }) accessor for: string | undefined\n\n /**\n * Whether the focus ring should render inward instead of outward.\n * When true, the focus ring will be positioned inside the control bounds.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor inward = false\n\n /**\n * The internal visibility state of the focus ring.\n */\n @property({ type: Boolean, reflect: true }) accessor visible = false\n\n private abortController?: AbortController\n\n constructor() {\n super()\n this.addEventListener('visibility-changed', this.onVisibilityChanged as EventListener)\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setupControl()\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.cleanupListeners()\n }\n\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('for') || changedProperties.has('control')) {\n this.setupControl()\n }\n }\n\n /**\n * Sets up the control element and event listeners.\n */\n private setupControl(): void {\n this.cleanupListeners()\n\n const control = this.getControl()\n if (!control) return\n\n this.abortController = new AbortController()\n const { signal } = this.abortController\n\n // Listen for focus and blur events\n control.addEventListener('focus', this.handleFocus, { signal })\n control.addEventListener('blur', this.handleBlur, { signal })\n control.addEventListener('pointerdown', this.handlePointerDown, { signal })\n\n // Set initial state\n this.visible = control.matches(':focus-visible')\n }\n\n /**\n * Cleans up event listeners.\n */\n private cleanupListeners(): void {\n this.abortController?.abort()\n this.abortController = undefined\n }\n\n /**\n * Gets the control element from either the `control` property,\n * the `for` attribute, or defaults to the parent element.\n */\n private getControl(): HTMLElement | null {\n if (this.control) {\n return this.control\n }\n\n if (this.for) {\n const root = this.getRootNode() as Document | ShadowRoot\n return root.getElementById(this.for)\n }\n\n return this.parentElement\n }\n\n /**\n * Handles focus events from the control element.\n */\n private handleFocus = (event: FocusEvent): void => {\n // Only show focus ring for keyboard navigation\n if (this.shouldShowFocusRing(event)) {\n this.show()\n }\n }\n\n /**\n * Handles blur events from the control element.\n */\n private handleBlur = (): void => {\n this.hide()\n }\n\n /**\n * Handles pointer down events to hide focus ring during mouse interaction.\n */\n private handlePointerDown = (): void => {\n this.hide()\n }\n\n /**\n * Determines if the focus ring should be shown based on the focus event.\n * The focus ring should only show for keyboard navigation, not mouse clicks.\n */\n private shouldShowFocusRing(event: FocusEvent): boolean {\n const control = event.target as HTMLElement\n return control?.matches(':focus-visible') ?? false\n }\n\n /**\n * Shows the focus ring.\n */\n show(): void {\n if (this.visible) return\n this.visible = true\n }\n\n /**\n * Hides the focus ring.\n */\n hide(): void {\n if (!this.visible) return\n this.visible = false\n }\n\n /**\n * Handles the visibility changed event.\n */\n private onVisibilityChanged = (event: Event): void => {\n // Stop propagation to prevent multiple focus rings from interfering\n event.stopPropagation()\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('visible')) {\n this.dispatchEvent(\n new CustomEvent('visibility-changed', {\n detail: { visible: this.visible },\n bubbles: false,\n composed: true,\n })\n )\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.styles.ts"],"names":[],"mappings":";AAEA,wBA0GC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css `
|
|
3
|
+
:host {
|
|
4
|
+
animation-delay: 0s, calc(var(--md-focus-ring-duration, 600ms) * 0.25);
|
|
5
|
+
animation-duration:
|
|
6
|
+
calc(var(--md-focus-ring-duration, 600ms) * 0.25), calc(var(--md-focus-ring-duration, 600ms) * 0.75);
|
|
7
|
+
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
color: var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));
|
|
10
|
+
display: none;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([visible]) {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host(:not([inward])) {
|
|
20
|
+
animation-name: outward-grow, outward-shrink;
|
|
21
|
+
border-end-end-radius: calc(
|
|
22
|
+
var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
23
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
24
|
+
);
|
|
25
|
+
border-end-start-radius: calc(
|
|
26
|
+
var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
27
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
28
|
+
);
|
|
29
|
+
border-start-end-radius: calc(
|
|
30
|
+
var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
31
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
32
|
+
);
|
|
33
|
+
border-start-start-radius: calc(
|
|
34
|
+
var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
35
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
36
|
+
);
|
|
37
|
+
inset: calc(-1 * var(--md-focus-ring-outward-offset, 2px));
|
|
38
|
+
outline: var(--md-focus-ring-width, 3px) solid currentColor;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([inward]) {
|
|
42
|
+
animation-name: inward-grow, inward-shrink;
|
|
43
|
+
border-end-end-radius: calc(
|
|
44
|
+
var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
45
|
+
--md-focus-ring-inward-offset,
|
|
46
|
+
0px
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
border-end-start-radius: calc(
|
|
50
|
+
var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
51
|
+
--md-focus-ring-inward-offset,
|
|
52
|
+
0px
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
border-start-end-radius: calc(
|
|
56
|
+
var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
57
|
+
--md-focus-ring-inward-offset,
|
|
58
|
+
0px
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
border-start-start-radius: calc(
|
|
62
|
+
var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
63
|
+
--md-focus-ring-inward-offset,
|
|
64
|
+
0px
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
border: var(--md-focus-ring-width, 3px) solid currentColor;
|
|
68
|
+
inset: var(--md-focus-ring-inward-offset, 0px);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes outward-grow {
|
|
72
|
+
from {
|
|
73
|
+
outline-width: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
to {
|
|
77
|
+
outline-width: var(--md-focus-ring-active-width, 8px);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@keyframes outward-shrink {
|
|
82
|
+
from {
|
|
83
|
+
outline-width: var(--md-focus-ring-active-width, 8px);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes inward-grow {
|
|
88
|
+
from {
|
|
89
|
+
border-width: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
to {
|
|
93
|
+
border-width: var(--md-focus-ring-active-width, 8px);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes inward-shrink {
|
|
98
|
+
from {
|
|
99
|
+
border-width: var(--md-focus-ring-active-width, 8px);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (prefers-reduced-motion) {
|
|
104
|
+
:host {
|
|
105
|
+
animation: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
//# sourceMappingURL=focus-ring.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.styles.js","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n animation-delay: 0s, calc(var(--md-focus-ring-duration, 600ms) * 0.25);\n animation-duration:\n calc(var(--md-focus-ring-duration, 600ms) * 0.25), calc(var(--md-focus-ring-duration, 600ms) * 0.75);\n animation-timing-function: cubic-bezier(0.2, 0, 0, 1);\n box-sizing: border-box;\n color: var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));\n display: none;\n pointer-events: none;\n position: absolute;\n }\n\n :host([visible]) {\n display: flex;\n }\n\n :host(:not([inward])) {\n animation-name: outward-grow, outward-shrink;\n border-end-end-radius: calc(\n var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-end-start-radius: calc(\n var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-start-end-radius: calc(\n var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-start-start-radius: calc(\n var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n inset: calc(-1 * var(--md-focus-ring-outward-offset, 2px));\n outline: var(--md-focus-ring-width, 3px) solid currentColor;\n }\n\n :host([inward]) {\n animation-name: inward-grow, inward-shrink;\n border-end-end-radius: calc(\n var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-end-start-radius: calc(\n var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-start-end-radius: calc(\n var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-start-start-radius: calc(\n var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border: var(--md-focus-ring-width, 3px) solid currentColor;\n inset: var(--md-focus-ring-inward-offset, 0px);\n }\n\n @keyframes outward-grow {\n from {\n outline-width: 0;\n }\n\n to {\n outline-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes outward-shrink {\n from {\n outline-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes inward-grow {\n from {\n border-width: 0;\n }\n\n to {\n border-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes inward-shrink {\n from {\n border-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @media (prefers-reduced-motion) {\n :host {\n animation: none;\n }\n }\n`\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CSSResultOrNative } from 'lit';
|
|
2
|
+
import Element from './internals/focus-ring.js';
|
|
3
|
+
/**
|
|
4
|
+
* A focus ring component that provides a visible focus indicator.
|
|
5
|
+
*
|
|
6
|
+
* This component replaces the Material Design `md-focus-ring` component
|
|
7
|
+
* and provides the same functionality with customizable styling.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <!-- Basic usage -->
|
|
12
|
+
* <ui-focus-ring></ui-focus-ring>
|
|
13
|
+
*
|
|
14
|
+
* <!-- With specific control -->
|
|
15
|
+
* <ui-focus-ring .control="${buttonElement}"></ui-focus-ring>
|
|
16
|
+
*
|
|
17
|
+
* <!-- Using for attribute -->
|
|
18
|
+
* <ui-focus-ring for="my-button"></ui-focus-ring>
|
|
19
|
+
*
|
|
20
|
+
* <!-- Inward focus ring -->
|
|
21
|
+
* <ui-focus-ring inward></ui-focus-ring>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @cssprop --ui-focus-ring-color - The color of the focus ring border.
|
|
25
|
+
* @cssprop --ui-focus-ring-width - The width of the focus ring border.
|
|
26
|
+
* @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).
|
|
27
|
+
* @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.
|
|
28
|
+
* @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.
|
|
29
|
+
* @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.
|
|
30
|
+
* @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.
|
|
31
|
+
*
|
|
32
|
+
* @csspart focus-ring - The focus ring element.
|
|
33
|
+
*/
|
|
34
|
+
export declare class UiFocusRingElement extends Element {
|
|
35
|
+
static styles: CSSResultOrNative[];
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'ui-focus-ring': Element;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ui-focus-ring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-focus-ring.d.ts","sourceRoot":"","sources":["../../../../src/md/focus-ring/ui-focus-ring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,kBAAmB,SAAQ,OAAO;IAC7C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,OAAO,CAAA;KACzB;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import Element from './internals/focus-ring.js';
|
|
4
|
+
import styles from './internals/focus-ring.styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* A focus ring component that provides a visible focus indicator.
|
|
7
|
+
*
|
|
8
|
+
* This component replaces the Material Design `md-focus-ring` component
|
|
9
|
+
* and provides the same functionality with customizable styling.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <!-- Basic usage -->
|
|
14
|
+
* <ui-focus-ring></ui-focus-ring>
|
|
15
|
+
*
|
|
16
|
+
* <!-- With specific control -->
|
|
17
|
+
* <ui-focus-ring .control="${buttonElement}"></ui-focus-ring>
|
|
18
|
+
*
|
|
19
|
+
* <!-- Using for attribute -->
|
|
20
|
+
* <ui-focus-ring for="my-button"></ui-focus-ring>
|
|
21
|
+
*
|
|
22
|
+
* <!-- Inward focus ring -->
|
|
23
|
+
* <ui-focus-ring inward></ui-focus-ring>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @cssprop --ui-focus-ring-color - The color of the focus ring border.
|
|
27
|
+
* @cssprop --ui-focus-ring-width - The width of the focus ring border.
|
|
28
|
+
* @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).
|
|
29
|
+
* @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.
|
|
30
|
+
* @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.
|
|
31
|
+
* @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.
|
|
32
|
+
* @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.
|
|
33
|
+
*
|
|
34
|
+
* @csspart focus-ring - The focus ring element.
|
|
35
|
+
*/
|
|
36
|
+
let UiFocusRingElement = (() => {
|
|
37
|
+
let _classDecorators = [customElement('ui-focus-ring')];
|
|
38
|
+
let _classDescriptor;
|
|
39
|
+
let _classExtraInitializers = [];
|
|
40
|
+
let _classThis;
|
|
41
|
+
let _classSuper = Element;
|
|
42
|
+
var UiFocusRingElement = class extends _classSuper {
|
|
43
|
+
static { _classThis = this; }
|
|
44
|
+
static {
|
|
45
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
46
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
47
|
+
UiFocusRingElement = _classThis = _classDescriptor.value;
|
|
48
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
49
|
+
}
|
|
50
|
+
static styles = [styles];
|
|
51
|
+
static {
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return UiFocusRingElement = _classThis;
|
|
56
|
+
})();
|
|
57
|
+
export { UiFocusRingElement };
|
|
58
|
+
//# sourceMappingURL=ui-focus-ring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-focus-ring.js","sourceRoot":"","sources":["../../../../src/md/focus-ring/ui-focus-ring.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAC/C,OAAO,MAAM,MAAM,kCAAkC,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;IAEU,kBAAkB;4BAD9B,aAAa,CAAC,eAAe,CAAC;;;;sBACS,OAAO;kCAAf,SAAQ,WAAO;;;;YAA/C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAkB;;;;;SAAlB,kBAAkB","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/focus-ring.js'\nimport styles from './internals/focus-ring.styles.js'\n\n/**\n * A focus ring component that provides a visible focus indicator.\n *\n * This component replaces the Material Design `md-focus-ring` component\n * and provides the same functionality with customizable styling.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <ui-focus-ring></ui-focus-ring>\n *\n * <!-- With specific control -->\n * <ui-focus-ring .control=\"${buttonElement}\"></ui-focus-ring>\n *\n * <!-- Using for attribute -->\n * <ui-focus-ring for=\"my-button\"></ui-focus-ring>\n *\n * <!-- Inward focus ring -->\n * <ui-focus-ring inward></ui-focus-ring>\n * ```\n *\n * @cssprop --ui-focus-ring-color - The color of the focus ring border.\n * @cssprop --ui-focus-ring-width - The width of the focus ring border.\n * @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).\n * @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.\n * @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.\n * @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.\n * @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.\n *\n * @csspart focus-ring - The focus ring element.\n */\n@customElement('ui-focus-ring')\nexport class UiFocusRingElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-focus-ring': Element\n }\n}\n"]}
|