@api-client/ui 0.5.48 → 0.5.50
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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/md/collapse/internals/Collapse.styles.ts +1 -0
- package/src/md/collapse/internals/Collapse.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.d.ts","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS;IAC/C;;;OAGG;IACyC,QAAQ,CAAC,QAAQ,UAAQ;IAErE;;;OAGG;IACyC,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAA;IAErF;;;OAGG;IAC0B,QAAQ,CAAC,UAAU,UAAQ;IAExD;;;OAGG;IACyC,QAAQ,CAAC,IAAI,UAAQ;IAEjE,IAAI,SAAS,IAAI,OAAO,GAAG,QAAQ,CAElC;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,UAAU,GAAG,WAAW,CAE3C;IAED;;;OAGG;IACH,IAAI,eAAe,IAAI,WAAW,GAAG,YAAY,CAEhD;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,SAAS,CAAC,qBAAqB,UAAQ;IAEvC;;;OAGG;IACH,IAAI,aAAa,I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MAAM,IAAI,IAAI;IAKd;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI;IA2C5D,SAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAInD;;OAEG;IACH,SAAS,CAAC,QAAQ,IAAI,MAAM;IAK5B,SAAS,CAAC,aAAa,IAAI,IAAI;IAU/B,SAAS,CAAC,YAAY,IAAI,IAAI;IAI9B,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAO7C,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAelC,SAAS,CAAC,sBAAsB,IAAI,IAAI;IAO/B,MAAM,IAAI,cAAc;CAGlC"}
|
|
@@ -130,7 +130,7 @@ let UiCollapse = (() => {
|
|
|
130
130
|
*/
|
|
131
131
|
toggle() {
|
|
132
132
|
this.open = !this.open;
|
|
133
|
-
this.dispatchEvent(new Event('
|
|
133
|
+
this.dispatchEvent(new Event('toggle'));
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Updates the size of the element.
|
|
@@ -151,8 +151,11 @@ let UiCollapse = (() => {
|
|
|
151
151
|
// After the transition is done, _transitionEnd will set the size back to
|
|
152
152
|
// `auto`.
|
|
153
153
|
if (sizeValue === '') {
|
|
154
|
+
// Temporarily remove constraint to measure natural size
|
|
155
|
+
const currentMaxDimension = this.style[this.dimensionMax];
|
|
154
156
|
this.style[this.dimensionMax] = '';
|
|
155
157
|
sizeValue = this.calcSize();
|
|
158
|
+
this.style[this.dimensionMax] = currentMaxDimension;
|
|
156
159
|
}
|
|
157
160
|
// Go to startSize without animation.
|
|
158
161
|
this.style[this.dimensionMax] = startSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.js","sourceRoot":"","sources":["../../../../../src/md/collapse/internals/Collapse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MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAA;YAClF,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;YAC/B,IAAI,CAAC,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;;;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,mBA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,CAAC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAA;YACpD,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAA;YAClF,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;YAC/B,IAAI,CAAC,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"]}
|