@haiilo/catalyst 5.2.3 → 5.3.0
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/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/p-ba081831.entry.js +10 -0
- package/dist/catalyst/p-ba081831.entry.js.map +1 -0
- package/dist/catalyst/scss/_snippets/_form-label.scss +2 -1
- package/dist/cjs/{cat-alert_24.cjs.entry.js → cat-alert_25.cjs.entry.js} +170 -28
- package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-button/cat-button.css +20 -2
- package/dist/collection/components/cat-button/cat-button.js +21 -1
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-button-group/cat-button-group.css +15 -0
- package/dist/collection/components/cat-button-group/cat-button-group.js +51 -0
- package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -0
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +14 -2
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +28 -0
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +8 -4
- package/dist/collection/components/cat-label/cat-label.js +19 -0
- package/dist/collection/components/cat-label/cat-label.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.css +90 -0
- package/dist/collection/components/cat-select/cat-select.js +31 -6
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +8 -4
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +0 -7
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +22 -18
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/scss/_snippets/_form-label.scss +2 -1
- package/dist/components/cat-button-group.d.ts +11 -0
- package/dist/components/cat-button-group.js +46 -0
- package/dist/components/cat-button-group.js.map +1 -0
- package/dist/components/cat-button2.js +6 -2
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-dropdown2.js +475 -3
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.js +10 -1
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-input.js +1 -1
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-label.js +2 -0
- package/dist/components/cat-label.js.map +1 -1
- package/dist/components/cat-select2.js +11 -3
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-textarea.js +1 -1
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-tooltip.js +24 -20
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +85 -1
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/esm/{cat-alert_24.entry.js → cat-alert_25.entry.js} +170 -29
- package/dist/esm/cat-alert_25.entry.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-button/cat-button.d.ts +4 -0
- package/dist/types/components/cat-button-group/cat-button-group.d.ts +11 -0
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +5 -0
- package/dist/types/components/cat-label/cat-label.d.ts +4 -0
- package/dist/types/components/cat-select/cat-select.d.ts +4 -0
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +2 -2
- package/dist/types/components.d.ts +53 -0
- package/package.json +2 -2
- package/dist/catalyst/p-d135d677.entry.js +0 -10
- package/dist/catalyst/p-d135d677.entry.js.map +0 -1
- package/dist/cjs/cat-alert_24.cjs.entry.js.map +0 -1
- package/dist/components/first-tabbable.js +0 -464
- package/dist/components/first-tabbable.js.map +0 -1
- package/dist/esm/cat-alert_24.entry.js.map +0 -1
|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,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC,mBAAmB,EAAE,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;MACnC,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;GACF;EAEO,UAAU;IAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;GAClC;EAGO,mBAAmB;IACzB,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,WAAW,KAAK,IAAI,EAAE;MACxB,OAAO,IAAI,CAAC,oBAAoB,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;MAChG,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;MACpF,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;GACd;EAEO,mBAAmB;IACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,CAAC;IACzG,IAAI,CAAC,QAAQ,EAAE;MACb,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatTextarea","log","autosize","i18n"],"sources":["../node_modules/autosize/dist/autosize.esm.js","./src/components/cat-textarea/cat-textarea.scss?tag=cat-textarea&encapsulation=shadow","./src/components/cat-textarea/cat-textarea.tsx"],"sourcesContent":["var e=new Map;function t(t){var r=e.get(t);r&&r.destroy()}function r(t){var r=e.get(t);r&&r.update()}var o=null;\"undefined\"==typeof window?((o=function(e){return e}).destroy=function(e){return e},o.update=function(e){return e}):((o=function(t,r){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&\"TEXTAREA\"===t.nodeName&&!e.has(t)){var r=null,o=window.getComputedStyle(t),n=function(r){window.removeEventListener(\"resize\",l,!1),t.removeEventListener(\"input\",l,!1),t.removeEventListener(\"keyup\",l,!1),t.removeEventListener(\"autosize:destroy\",n,!1),t.removeEventListener(\"autosize:update\",l,!1),Object.keys(r).forEach(function(e){return t.style[e]=r[e]}),e.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener(\"autosize:destroy\",n,!1),window.addEventListener(\"resize\",l,!1),t.addEventListener(\"input\",l,!1),t.addEventListener(\"autosize:update\",l,!1),t.style.overflowX=\"hidden\",t.style.wordWrap=\"break-word\",e.set(t,{destroy:n,update:l}),l()}function l(e){void 0===e&&(e=null);var n=o.overflowY;if(0!==t.scrollHeight){var i,a=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],r=e[1];t.style.scrollBehavior=\"auto\",t.scrollTop=r,t.style.scrollBehavior=null})}}(t);if(t.style.height=\"\",\"vertical\"===o.resize?t.style.resize=\"none\":\"both\"===o.resize&&(t.style.resize=\"horizontal\"),i=\"content-box\"===o.boxSizing?t.scrollHeight-(parseFloat(o.paddingTop)+parseFloat(o.paddingBottom)):t.scrollHeight+parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth),\"none\"!==o.maxHeight&&i>parseFloat(o.maxHeight)?(\"hidden\"===o.overflowY&&(t.style.overflow=\"scroll\"),i=parseFloat(o.maxHeight)):\"hidden\"!==o.overflowY&&(t.style.overflow=\"hidden\"),t.style.height=i+\"px\",e&&(t.style.textAlign=e),a(),r!==i&&(t.dispatchEvent(new Event(\"autosize:resized\",{bubbles:!0})),r=i),n!==o.overflow&&!e){var s=o.textAlign;\"hidden\"===o.overflow&&(t.style.textAlign=\"start\"===s?\"end\":\"start\"),l(s)}}}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},o.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e});var n=o;export default n;\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n@use 'utils/color';\n@use '_snippets/form-label';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.textarea-field,\n.textarea-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n flex: 1 1 auto;\n}\n\n.textarea-field.textarea-horizontal {\n flex-direction: row;\n gap: 1rem;\n}\n\n.textarea-wrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.icon-suffix {\n position: absolute;\n top: calc(0.625rem - 2px);\n right: 0.75rem;\n background: cat-token('color.ui.background.input', 0.75);\n border-radius: 100rem;\n\n .textarea-disabled & {\n background: cat-token('color.ui.background.muted', 0.75);\n }\n}\n\ntextarea {\n margin: 0;\n padding: 0.625rem 0.75rem;\n min-height: form-label.$cat-input-height;\n font: inherit;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n border: none;\n box-shadow: 0 0 0 1px cat-token('color.ui.border.dark');\n transition: box-shadow cat-token('time.transition.s') linear;\n resize: vertical;\n\n &:disabled {\n background: cat-token('color.ui.background.muted');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n resize: none;\n }\n\n .textarea-invalid & {\n box-shadow: 0 0 0 1px cat-token('color.theme.danger.bg', 0.2);\n }\n\n &:hover:not(:disabled) {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.dark');\n }\n\n .textarea-invalid &:hover:not(:disabled) {\n box-shadow: 0 0 0 2px cat-token('color.theme.danger.bg', 0.2);\n }\n\n &:focus {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n\n .textarea-invalid &:focus {\n outline: 2px solid cat-token('color.theme.danger.bg', 0.2);\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n\n /* stylelint-disable property-no-vendor-prefix */\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n -webkit-box-shadow: 0 0 0 9999px cat-token('color.ui.background.inputAutofill') inset;\n }\n }\n /* stylelint-enable property-no-vendor-prefix */\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport autosize from 'autosize';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Textarea specifies a control that allows user to write text over multiple\n * rows. Used when the expected user input is long. For shorter input, use the\n * input component.\n *\n * @slot hint - Optional hint element to be displayed with the textarea.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-textarea',\n styleUrl: 'cat-textarea.scss',\n shadow: true\n})\nexport class CatTextarea {\n private readonly _id = `cat-textarea-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private textarea!: HTMLTextAreaElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\n\n /**\n * Whether the label need a marker to shown if the textarea is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Whether the textarea is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the textarea.\n */\n @Prop() hint?: string | string[];\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the textarea.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Specifies the initial number of lines in the textarea.\n */\n @Prop() rows = 3;\n\n /**\n * The initial value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML textarea element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the textarea received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the textarea loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on textarea', this);\n }\n }\n\n componentDidLoad(): void {\n autosize(this.textarea);\n }\n\n /**\n * Programmatically move focus to the textarea. Use this method instead of\n * `textarea.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.textarea.focus(options);\n }\n\n /**\n * Programmatically remove focus from the textarea. Use this method instead of\n * `textarea.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.textarea.blur();\n }\n\n /**\n * Programmatically simulate a click on the textarea.\n */\n @Method()\n async doClick(): Promise<void> {\n this.textarea.click();\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'textarea-field': true,\n 'textarea-horizontal': this.horizontal\n }}\n >\n <div\n class={{\n hidden: this.labelHidden,\n 'label-container': true\n }}\n >\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"textarea-container\">\n <div\n class={{\n 'textarea-wrapper': true,\n 'textarea-disabled': this.disabled,\n 'textarea-invalid': this.invalid\n }}\n >\n <textarea\n {...this.nativeAttributes}\n ref={el => (this.textarea = el as HTMLTextAreaElement)}\n id={this.id}\n disabled={this.disabled}\n maxlength={this.maxLength}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n rows={this.rows}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></textarea>\n {this.invalid && (\n <cat-icon\n icon=\"alert-circle-outlined\"\n class=\"icon-suffix cat-text-danger\"\n size=\"l\"\n onClick={() => this.textarea.focus()}\n ></cat-icon>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n </Host>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput(event: InputEvent) {\n this.value = this.textarea.value;\n this.catChange.emit(event);\n this.showErrorsIfTimeout();\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.textarea;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"cat-textarea.js","mappings":";;;;;;;AAAA,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,GAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,UAAU,GA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,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,CAAC;IACzG,IAAI,CAAC,QAAQ,EAAE;MACb,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatTextarea","log","autosize","i18n"],"sources":["../node_modules/autosize/dist/autosize.esm.js","./src/components/cat-textarea/cat-textarea.scss?tag=cat-textarea&encapsulation=shadow","./src/components/cat-textarea/cat-textarea.tsx"],"sourcesContent":["var e=new Map;function t(t){var r=e.get(t);r&&r.destroy()}function r(t){var r=e.get(t);r&&r.update()}var o=null;\"undefined\"==typeof window?((o=function(e){return e}).destroy=function(e){return e},o.update=function(e){return e}):((o=function(t,r){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&\"TEXTAREA\"===t.nodeName&&!e.has(t)){var r=null,o=window.getComputedStyle(t),n=function(r){window.removeEventListener(\"resize\",l,!1),t.removeEventListener(\"input\",l,!1),t.removeEventListener(\"keyup\",l,!1),t.removeEventListener(\"autosize:destroy\",n,!1),t.removeEventListener(\"autosize:update\",l,!1),Object.keys(r).forEach(function(e){return t.style[e]=r[e]}),e.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener(\"autosize:destroy\",n,!1),window.addEventListener(\"resize\",l,!1),t.addEventListener(\"input\",l,!1),t.addEventListener(\"autosize:update\",l,!1),t.style.overflowX=\"hidden\",t.style.wordWrap=\"break-word\",e.set(t,{destroy:n,update:l}),l()}function l(e){void 0===e&&(e=null);var n=o.overflowY;if(0!==t.scrollHeight){var i,a=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],r=e[1];t.style.scrollBehavior=\"auto\",t.scrollTop=r,t.style.scrollBehavior=null})}}(t);if(t.style.height=\"\",\"vertical\"===o.resize?t.style.resize=\"none\":\"both\"===o.resize&&(t.style.resize=\"horizontal\"),i=\"content-box\"===o.boxSizing?t.scrollHeight-(parseFloat(o.paddingTop)+parseFloat(o.paddingBottom)):t.scrollHeight+parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth),\"none\"!==o.maxHeight&&i>parseFloat(o.maxHeight)?(\"hidden\"===o.overflowY&&(t.style.overflow=\"scroll\"),i=parseFloat(o.maxHeight)):\"hidden\"!==o.overflowY&&(t.style.overflow=\"hidden\"),t.style.height=i+\"px\",e&&(t.style.textAlign=e),a(),r!==i&&(t.dispatchEvent(new Event(\"autosize:resized\",{bubbles:!0})),r=i),n!==o.overflow&&!e){var s=o.textAlign;\"hidden\"===o.overflow&&(t.style.textAlign=\"start\"===s?\"end\":\"start\"),l(s)}}}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},o.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e});var n=o;export default n;\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n@use 'utils/color';\n@use '_snippets/form-label';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.textarea-field,\n.textarea-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n flex: 1 1 auto;\n}\n\n.textarea-field.textarea-horizontal {\n flex-direction: row;\n gap: 1rem;\n}\n\n.textarea-wrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.icon-suffix {\n position: absolute;\n top: calc(0.625rem - 2px);\n right: 0.75rem;\n background: cat-token('color.ui.background.input', 0.75);\n border-radius: 100rem;\n\n .textarea-disabled & {\n background: cat-token('color.ui.background.muted', 0.75);\n }\n}\n\ntextarea {\n margin: 0;\n padding: 0.625rem 0.75rem;\n min-height: form-label.$cat-input-height;\n font: inherit;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n border: none;\n box-shadow: 0 0 0 1px cat-token('color.ui.border.dark');\n transition: box-shadow cat-token('time.transition.s') linear;\n resize: vertical;\n\n &:disabled {\n background: cat-token('color.ui.background.muted');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n resize: none;\n }\n\n .textarea-invalid & {\n box-shadow: 0 0 0 1px cat-token('color.theme.danger.bg', 0.2);\n }\n\n &:hover:not(:disabled) {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.dark');\n }\n\n .textarea-invalid &:hover:not(:disabled) {\n box-shadow: 0 0 0 2px cat-token('color.theme.danger.bg', 0.2);\n }\n\n &:focus {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n\n .textarea-invalid &:focus {\n outline: 2px solid cat-token('color.theme.danger.bg', 0.2);\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n\n /* stylelint-disable property-no-vendor-prefix */\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n -webkit-box-shadow: 0 0 0 9999px cat-token('color.ui.background.inputAutofill') inset;\n }\n }\n /* stylelint-enable property-no-vendor-prefix */\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport autosize from 'autosize';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Textarea specifies a control that allows user to write text over multiple\n * rows. Used when the expected user input is long. For shorter input, use the\n * input component.\n *\n * @slot hint - Optional hint element to be displayed with the textarea.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-textarea',\n styleUrl: 'cat-textarea.scss',\n shadow: true\n})\nexport class CatTextarea {\n private readonly _id = `cat-textarea-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private textarea!: HTMLTextAreaElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\n\n /**\n * Whether the label need a marker to shown if the textarea is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Whether the textarea is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the textarea.\n */\n @Prop() hint?: string | string[];\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the textarea.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Specifies the initial number of lines in the textarea.\n */\n @Prop() rows = 3;\n\n /**\n * The initial value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML textarea element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the textarea received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the textarea loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on textarea', this);\n }\n }\n\n componentDidLoad(): void {\n autosize(this.textarea);\n }\n\n /**\n * Programmatically move focus to the textarea. Use this method instead of\n * `textarea.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.textarea.focus(options);\n }\n\n /**\n * Programmatically remove focus from the textarea. Use this method instead of\n * `textarea.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.textarea.blur();\n }\n\n /**\n * Programmatically simulate a click on the textarea.\n */\n @Method()\n async doClick(): Promise<void> {\n this.textarea.click();\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'textarea-field': true,\n 'textarea-horizontal': this.horizontal\n }}\n >\n <div\n class={{\n hidden: this.labelHidden,\n 'label-container': true\n }}\n >\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"textarea-container\">\n <div\n class={{\n 'textarea-wrapper': true,\n 'textarea-disabled': this.disabled,\n 'textarea-invalid': this.invalid\n }}\n >\n <textarea\n {...this.nativeAttributes}\n ref={el => (this.textarea = el as HTMLTextAreaElement)}\n id={this.id}\n disabled={this.disabled}\n maxlength={this.maxLength}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n rows={this.rows}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></textarea>\n {this.invalid && (\n <cat-icon\n icon=\"alert-circle-outlined\"\n class=\"icon-suffix cat-text-danger\"\n size=\"l\"\n onClick={() => this.textarea.focus()}\n ></cat-icon>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n </Host>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput(event: InputEvent) {\n this.value = this.textarea.value;\n this.catChange.emit(event);\n this.showErrorsIfTimeout();\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.textarea;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"],"version":3}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
3
|
-
import { b as firstTabbable } from './first-tabbable.js';
|
|
2
|
+
import { c as computePosition, a as autoUpdate, o as offset, f as flip, b as shift } from './floating-ui.dom.esm.js';
|
|
4
3
|
|
|
5
4
|
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
6
5
|
|
|
7
|
-
const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{--cat-font-color-head:cat-token(\"color.ui.font.tooltip\", $wrap: false);--cat-font-color-body:cat-token(\"color.ui.font.tooltip\", $wrap: false);position:fixed;width:max-content;top:0;left:0;box-sizing:border-box;font-size:0.875rem;line-height:1rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:min(100vw - 0.5rem, 20rem)}.tooltip-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}
|
|
6
|
+
const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{--cat-font-color-head:cat-token(\"color.ui.font.tooltip\", $wrap: false);--cat-font-color-body:cat-token(\"color.ui.font.tooltip\", $wrap: false);position:fixed;width:max-content;top:0;left:0;box-sizing:border-box;font-size:0.875rem;line-height:1rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:min(100vw - 0.5rem, 20rem)}.tooltip-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}";
|
|
8
7
|
|
|
9
8
|
let nextUniqueId = 0;
|
|
10
9
|
const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -28,24 +27,22 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
28
27
|
key === 'Escape' && this.hideListener();
|
|
29
28
|
}
|
|
30
29
|
componentDidLoad() {
|
|
31
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this.trigger && this.tooltip) {
|
|
37
|
-
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
31
|
+
const slot = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
32
|
+
this.trigger = (_c = (_b = slot === null || slot === void 0 ? void 0 : slot.assignedElements) === null || _b === void 0 ? void 0 : _b.call(slot)) === null || _c === void 0 ? void 0 : _c[0];
|
|
33
|
+
if (this.trigger && !this.trigger.hasAttribute('aria-describedby')) {
|
|
34
|
+
this.trigger.setAttribute('aria-describedby', this.id);
|
|
38
35
|
}
|
|
39
36
|
if (isTouchDevice) {
|
|
40
37
|
window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
41
|
-
(
|
|
42
|
-
(
|
|
38
|
+
(_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
39
|
+
(_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
43
40
|
}
|
|
44
41
|
else {
|
|
45
|
-
(
|
|
46
|
-
(
|
|
47
|
-
(
|
|
48
|
-
(
|
|
42
|
+
(_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('focusin', this.showListener.bind(this));
|
|
43
|
+
(_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('focusout', this.hideListener.bind(this));
|
|
44
|
+
(_h = this.trigger) === null || _h === void 0 ? void 0 : _h.addEventListener('mouseenter', this.showListener.bind(this));
|
|
45
|
+
(_j = this.trigger) === null || _j === void 0 ? void 0 : _j.addEventListener('mouseleave', this.hideListener.bind(this));
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
componentWillRender() {
|
|
@@ -67,16 +64,13 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
render() {
|
|
70
|
-
return (h(Host, null, h("
|
|
67
|
+
return (h(Host, null, h("slot", null), h("div", { ref: el => (this.tooltip = el), id: this.id, "aria-hidden": this.hidden, class: {
|
|
71
68
|
tooltip: true,
|
|
72
69
|
'tooltip-hidden': this.hidden,
|
|
73
70
|
'tooltip-round': this.round,
|
|
74
71
|
[`tooltip-${this.size}`]: Boolean(this.size)
|
|
75
72
|
} }, this.hasSlottedContent ? h("slot", { name: "content" }) : this.content)));
|
|
76
73
|
}
|
|
77
|
-
get isTabbable() {
|
|
78
|
-
return firstTabbable(this.trigger);
|
|
79
|
-
}
|
|
80
74
|
async update() {
|
|
81
75
|
if (this.trigger && this.tooltip) {
|
|
82
76
|
await computePosition(this.trigger, this.tooltip, {
|
|
@@ -104,6 +98,7 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
104
98
|
this.hideTimeout = window.setTimeout(() => {
|
|
105
99
|
var _a;
|
|
106
100
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
101
|
+
this.hideTooltip();
|
|
107
102
|
}, this.hideDelay);
|
|
108
103
|
}
|
|
109
104
|
touchStartListener(event) {
|
|
@@ -115,6 +110,7 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
115
110
|
touchEndListener() {
|
|
116
111
|
if (this.touchTimeout) {
|
|
117
112
|
window.clearTimeout(this.touchTimeout);
|
|
113
|
+
this.hideTooltip();
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
windowTouchStartListener() {
|
|
@@ -123,8 +119,16 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
123
119
|
}
|
|
124
120
|
showTooltip() {
|
|
125
121
|
var _a;
|
|
122
|
+
if (this.trigger && this.tooltip) {
|
|
123
|
+
this.cleanupFloatingUi = autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
124
|
+
}
|
|
126
125
|
!this.hidden && ((_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show'));
|
|
127
126
|
}
|
|
127
|
+
hideTooltip() {
|
|
128
|
+
if (this.cleanupFloatingUi) {
|
|
129
|
+
this.cleanupFloatingUi();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
128
132
|
get hostElement() { return this; }
|
|
129
133
|
static get style() { return catTooltipCss; }
|
|
130
134
|
}, [1, "cat-tooltip", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-tooltip.js","mappings":";;;;AAAA,MAAM,aAAa,GAAG,cAAc,IAAI,MAAM,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC;;ACA9E,MAAM,aAAa,GAAG,swCAAswC;;ACM5xC,IAAI,YAAY,GAAG,CAAC,CAAC;MAORA,YAAU;;;;;IAGJ,OAAE,GAAG,eAAe,YAAY,EAAE,EAAE,CAAC;IAO9C,WAAM,GAAG,KAAK,CAAC;6BAIM,KAAK;mBAKhB,EAAE;oBAMD,KAAK;qBAKO,KAAK;iBAKpB,KAAK;gBAKW,GAAG;qBAKf,GAAG;qBAKH,CAAC;6BAKO,IAAI;;EAGhC,aAAa,CAAC,EAAE,GAAG,EAAiB;IAClC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;GACzC;EAED,gBAAgB;;IACd,IAAI,CAAC,OAAO,GAAG,aAAa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Aa,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;","names":["CatTooltip","isTouchScreen"],"sources":["./src/utils/is-touch-screen.ts","./src/components/cat-tooltip/cat-tooltip.scss?tag=cat-tooltip&encapsulation=shadow","./src/components/cat-tooltip/cat-tooltip.tsx"],"sourcesContent":["const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n\nexport default isTouchDevice;\n","@use 'variables' as *;\n@use 'mixins' as *;\n\n$-max-width: 20rem;\n$-box-shadow: rgb(0 0 0 / 8%) 0 1px 8px 0;\n$-shift-padding: 0.25rem; // padding given to the shift() middleware\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.tooltip {\n --cat-font-color-head: cat-token('color.ui.font.tooltip', $wrap: false);\n --cat-font-color-body: cat-token('color.ui.font.tooltip', $wrap: false);\n position: fixed;\n width: max-content;\n top: 0;\n left: 0;\n box-sizing: border-box;\n @include cat-body('s', 500);\n background-color: cat-token('color.ui.background.tooltip');\n border-radius: cat-border-radius('m');\n color: cat-token('color.ui.font.tooltip');\n transition: opacity cat-token('time.transition.m') linear, visibility cat-token('time.transition.m') linear;\n visibility: hidden;\n opacity: 0;\n box-shadow: $-box-shadow;\n z-index: $cat-tooltip-z-index;\n max-width: min(calc(100vw - 2 * $-shift-padding), $-max-width);\n\n &-hidden {\n @include cat-visually-hidden;\n }\n\n &-show {\n opacity: 1;\n visibility: visible;\n }\n}\n\n// ----- round\n\n.tooltip-round {\n border-radius: 10rem;\n}\n\n// ----- size\n\n.tooltip-s {\n padding: 0.375rem 0.5rem;\n\n &.tooltip-round {\n padding: 0.375rem 0.75rem;\n }\n}\n\n.tooltip-m {\n padding: 0.75rem;\n\n &.tooltip-round {\n padding: 0.75rem 1rem;\n }\n}\n\n.tooltip-l {\n padding: 1rem;\n\n &.tooltip-round {\n padding: 1rem 1.5rem;\n }\n}\n\n// ----- trigger\n\n.tooltip-trigger {\n display: inline-block;\n\n &:focus {\n outline: none;\n }\n}\n","import { autoUpdate, computePosition, flip, offset, Placement, shift } from '@floating-ui/dom';\nimport { Component, Element, h, Host, Listen, Prop, State } from '@stencil/core';\nimport { FocusableElement } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\nimport isTouchScreen from '../../utils/is-touch-screen';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private static readonly SHIFT_PADDING = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private triggerElement?: HTMLElement;\n private trigger?: FocusableElement;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n private hidden = false;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedContent = false;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * Use round tooltip edges.\n */\n @Prop() round = false;\n\n /**\n * The size of the tooltip.\n */\n @Prop() size: 's' | 'm' | 'l' = 'm';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 250;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;\n if (!this.isTabbable) {\n this.trigger?.setAttribute('tabindex', '0');\n }\n\n if (this.trigger && this.tooltip) {\n autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n\n if (isTouchScreen) {\n window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedContent = !!this.hostElement.querySelector('[slot=\"content\"]');\n this.hidden = this.disabled || (!this.content && !this.hasSlottedContent);\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <div ref={el => (this.triggerElement = el)} aria-describedby={this.id} class=\"tooltip-trigger\">\n <slot />\n </div>\n <div\n ref={el => (this.tooltip = el)}\n id={this.id}\n aria-hidden={this.hidden}\n class={{\n tooltip: true,\n 'tooltip-hidden': this.hidden,\n 'tooltip-round': this.round,\n [`tooltip-${this.size}`]: Boolean(this.size)\n }}\n >\n {this.hasSlottedContent ? <slot name=\"content\" /> : this.content}\n </div>\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private async update() {\n if (this.trigger && this.tooltip) {\n await computePosition(this.trigger, this.tooltip, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip(), shift({ padding: CatTooltip.SHIFT_PADDING })]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.tooltip?.classList.remove('tooltip-show');\n }, this.hideDelay);\n }\n\n private touchStartListener(event: Event) {\n event.stopPropagation();\n this.touchTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n if (this.touchTimeout) {\n window.clearTimeout(this.touchTimeout);\n }\n }\n\n private windowTouchStartListener() {\n this.tooltip?.classList.remove('tooltip-show');\n }\n\n private showTooltip() {\n !this.hidden && this.tooltip?.classList.add('tooltip-show');\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"cat-tooltip.js","mappings":";;;AAAA,MAAM,aAAa,GAAG,cAAc,IAAI,MAAM,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC;;ACA9E,MAAM,aAAa,GAAG,4rCAA4rC;;ACIltC,IAAI,YAAY,GAAG,CAAC,CAAC;MAORA,YAAU;;;;;IAGJ,OAAE,GAAG,eAAe,YAAY,EAAE,EAAE,CAAC;IAM9C,WAAM,GAAG,KAAK,CAAC;6BAKM,KAAK;mBAKhB,EAAE;oBAMD,KAAK;qBAKO,KAAK;iBAKpB,KAAK;gBAKW,GAAG;qBAKf,GAAG;qBAKH,CAAC;6BAKO,IAAI;;EAGhC,aAAa,CAAC,EAAE,GAAG,EAAiB;IAClC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;GACzC;EAED,gBAAgB;;IACd,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,WAAW,CAAC,UAAU,0CAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,GAAG,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,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;;AApLuBA,mBAAM,GAAG,CAAC,CAAC;AACXA,0BAAa,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;","names":["CatTooltip","isTouchScreen"],"sources":["./src/utils/is-touch-screen.ts","./src/components/cat-tooltip/cat-tooltip.scss?tag=cat-tooltip&encapsulation=shadow","./src/components/cat-tooltip/cat-tooltip.tsx"],"sourcesContent":["const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n\nexport default isTouchDevice;\n","@use 'variables' as *;\n@use 'mixins' as *;\n\n$-max-width: 20rem;\n$-box-shadow: rgb(0 0 0 / 8%) 0 1px 8px 0;\n$-shift-padding: 0.25rem; // padding given to the shift() middleware\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.tooltip {\n --cat-font-color-head: cat-token('color.ui.font.tooltip', $wrap: false);\n --cat-font-color-body: cat-token('color.ui.font.tooltip', $wrap: false);\n position: fixed;\n width: max-content;\n top: 0;\n left: 0;\n box-sizing: border-box;\n @include cat-body('s', 500);\n background-color: cat-token('color.ui.background.tooltip');\n border-radius: cat-border-radius('m');\n color: cat-token('color.ui.font.tooltip');\n transition: opacity cat-token('time.transition.m') linear, visibility cat-token('time.transition.m') linear;\n visibility: hidden;\n opacity: 0;\n box-shadow: $-box-shadow;\n z-index: $cat-tooltip-z-index;\n max-width: min(calc(100vw - 2 * $-shift-padding), $-max-width);\n\n &-hidden {\n @include cat-visually-hidden;\n }\n\n &-show {\n opacity: 1;\n visibility: visible;\n }\n}\n\n// ----- round\n\n.tooltip-round {\n border-radius: 10rem;\n}\n\n// ----- size\n\n.tooltip-s {\n padding: 0.375rem 0.5rem;\n\n &.tooltip-round {\n padding: 0.375rem 0.75rem;\n }\n}\n\n.tooltip-m {\n padding: 0.75rem;\n\n &.tooltip-round {\n padding: 0.75rem 1rem;\n }\n}\n\n.tooltip-l {\n padding: 1rem;\n\n &.tooltip-round {\n padding: 1rem 1.5rem;\n }\n}\n","import { autoUpdate, computePosition, flip, offset, Placement, shift } from '@floating-ui/dom';\nimport { Component, Element, h, Host, Listen, Prop, State } from '@stencil/core';\nimport isTouchScreen from '../../utils/is-touch-screen';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private static readonly SHIFT_PADDING = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private trigger?: Element;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n private hidden = false;\n private cleanupFloatingUi?: () => void;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedContent = false;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * Use round tooltip edges.\n */\n @Prop() round = false;\n\n /**\n * The size of the tooltip.\n */\n @Prop() size: 's' | 'm' | 'l' = 'm';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 250;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n const slot = this.hostElement.shadowRoot?.querySelector('slot');\n this.trigger = slot?.assignedElements?.()?.[0];\n if (this.trigger && !this.trigger.hasAttribute('aria-describedby')) {\n this.trigger.setAttribute('aria-describedby', this.id);\n }\n\n if (isTouchScreen) {\n window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedContent = !!this.hostElement.querySelector('[slot=\"content\"]');\n this.hidden = this.disabled || (!this.content && !this.hasSlottedContent);\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n ref={el => (this.tooltip = el)}\n id={this.id}\n aria-hidden={this.hidden}\n class={{\n tooltip: true,\n 'tooltip-hidden': this.hidden,\n 'tooltip-round': this.round,\n [`tooltip-${this.size}`]: Boolean(this.size)\n }}\n >\n {this.hasSlottedContent ? <slot name=\"content\" /> : this.content}\n </div>\n </Host>\n );\n }\n\n private async update() {\n if (this.trigger && this.tooltip) {\n await computePosition(this.trigger, this.tooltip, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip(), shift({ padding: CatTooltip.SHIFT_PADDING })]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.tooltip?.classList.remove('tooltip-show');\n this.hideTooltip();\n }, this.hideDelay);\n }\n\n private touchStartListener(event: Event) {\n event.stopPropagation();\n this.touchTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n if (this.touchTimeout) {\n window.clearTimeout(this.touchTimeout);\n this.hideTooltip();\n }\n }\n\n private windowTouchStartListener() {\n this.tooltip?.classList.remove('tooltip-show');\n }\n\n private showTooltip() {\n if (this.trigger && this.tooltip) {\n this.cleanupFloatingUi = autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n !this.hidden && this.tooltip?.classList.add('tooltip-show');\n }\n\n private hideTooltip() {\n if (this.cleanupFloatingUi) {\n this.cleanupFloatingUi();\n }\n }\n}\n"],"version":3}
|
|
@@ -587,6 +587,90 @@ const shift = function (options) {
|
|
|
587
587
|
};
|
|
588
588
|
};
|
|
589
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Provides data that allows you to change the size of the floating element —
|
|
592
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
593
|
+
* width of the reference element.
|
|
594
|
+
* @see https://floating-ui.com/docs/size
|
|
595
|
+
*/
|
|
596
|
+
const size = function (options) {
|
|
597
|
+
if (options === void 0) {
|
|
598
|
+
options = {};
|
|
599
|
+
}
|
|
600
|
+
return {
|
|
601
|
+
name: 'size',
|
|
602
|
+
options,
|
|
603
|
+
async fn(state) {
|
|
604
|
+
const {
|
|
605
|
+
placement,
|
|
606
|
+
rects,
|
|
607
|
+
platform,
|
|
608
|
+
elements
|
|
609
|
+
} = state;
|
|
610
|
+
const {
|
|
611
|
+
apply = () => {},
|
|
612
|
+
...detectOverflowOptions
|
|
613
|
+
} = options;
|
|
614
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
615
|
+
const side = getSide(placement);
|
|
616
|
+
const alignment = getAlignment(placement);
|
|
617
|
+
const axis = getMainAxisFromPlacement(placement);
|
|
618
|
+
const isXAxis = axis === 'x';
|
|
619
|
+
const {
|
|
620
|
+
width,
|
|
621
|
+
height
|
|
622
|
+
} = rects.floating;
|
|
623
|
+
let heightSide;
|
|
624
|
+
let widthSide;
|
|
625
|
+
if (side === 'top' || side === 'bottom') {
|
|
626
|
+
heightSide = side;
|
|
627
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
628
|
+
} else {
|
|
629
|
+
widthSide = side;
|
|
630
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
631
|
+
}
|
|
632
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
633
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
634
|
+
let availableHeight = overflowAvailableHeight;
|
|
635
|
+
let availableWidth = overflowAvailableWidth;
|
|
636
|
+
if (isXAxis) {
|
|
637
|
+
availableWidth = min$1(
|
|
638
|
+
// Maximum clipping viewport width
|
|
639
|
+
width - overflow.right - overflow.left, overflowAvailableWidth);
|
|
640
|
+
} else {
|
|
641
|
+
availableHeight = min$1(
|
|
642
|
+
// Maximum clipping viewport height
|
|
643
|
+
height - overflow.bottom - overflow.top, overflowAvailableHeight);
|
|
644
|
+
}
|
|
645
|
+
if (!state.middlewareData.shift && !alignment) {
|
|
646
|
+
const xMin = max$1(overflow.left, 0);
|
|
647
|
+
const xMax = max$1(overflow.right, 0);
|
|
648
|
+
const yMin = max$1(overflow.top, 0);
|
|
649
|
+
const yMax = max$1(overflow.bottom, 0);
|
|
650
|
+
if (isXAxis) {
|
|
651
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
|
|
652
|
+
} else {
|
|
653
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
await apply({
|
|
657
|
+
...state,
|
|
658
|
+
availableWidth,
|
|
659
|
+
availableHeight
|
|
660
|
+
});
|
|
661
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
662
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
663
|
+
return {
|
|
664
|
+
reset: {
|
|
665
|
+
rects: true
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
return {};
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
|
|
590
674
|
function getWindow(node) {
|
|
591
675
|
var _node$ownerDocument;
|
|
592
676
|
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
@@ -1250,6 +1334,6 @@ const computePosition = (reference, floating, options) => {
|
|
|
1250
1334
|
});
|
|
1251
1335
|
};
|
|
1252
1336
|
|
|
1253
|
-
export { autoUpdate as a, computePosition as c, flip as f, offset as o,
|
|
1337
|
+
export { autoUpdate as a, shift as b, computePosition as c, flip as f, offset as o, size as s };
|
|
1254
1338
|
|
|
1255
1339
|
//# sourceMappingURL=floating-ui.dom.esm.js.map
|