@haiilo/catalyst 0.6.0 → 0.7.2
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-12486027.js.map +1 -1
- package/dist/catalyst/p-12b96af6.js +2 -0
- package/dist/catalyst/p-12b96af6.js.map +1 -0
- package/dist/catalyst/p-4254363e.entry.js +2 -0
- package/dist/catalyst/p-4254363e.entry.js.map +1 -0
- package/dist/catalyst/p-5616e2cd.js +2 -0
- package/dist/catalyst/p-5616e2cd.js.map +1 -0
- package/dist/catalyst/p-dda85567.entry.js +10 -0
- package/dist/catalyst/p-dda85567.entry.js.map +1 -0
- package/dist/catalyst/scss/_mixins.scss +9 -0
- package/dist/catalyst/scss/_variables.scss +64 -0
- package/dist/catalyst/scss/_variables.tokens.scss +84 -0
- package/dist/catalyst/scss/core/_base.scss +12 -0
- package/dist/catalyst/scss/core/_nav.scss +23 -0
- package/dist/catalyst/scss/core/_typography.scss +237 -0
- package/dist/catalyst/scss/fonts/_fonts.mixins.azeret.scss +14 -0
- package/dist/catalyst/scss/fonts/_fonts.mixins.dm.scss +53 -0
- package/dist/catalyst/scss/fonts/_fonts.mixins.lato.scss +185 -0
- package/dist/catalyst/scss/fonts/_fonts.mixins.scss +3 -0
- package/dist/catalyst/scss/fonts/_fonts.scss +13 -0
- package/dist/catalyst/scss/index.scss +32 -0
- package/dist/catalyst/scss/utils/_color.scss +52 -0
- package/dist/catalyst/scss/utils/_disabled.mixins.scss +7 -0
- package/dist/catalyst/scss/utils/_display.scss +20 -0
- package/dist/catalyst/scss/utils/_elevation.mixins.scss +10 -0
- package/dist/catalyst/scss/utils/_elevation.scss +19 -0
- package/dist/catalyst/scss/utils/_layout.scss +78 -0
- package/dist/catalyst/scss/utils/_media.mixins.scss +37 -0
- package/dist/catalyst/scss/utils/_ratio.mixins.scss +12 -0
- package/dist/catalyst/scss/utils/_ratio.scss +20 -0
- package/dist/catalyst/scss/utils/_sizing.mixins.scss +15 -0
- package/dist/catalyst/scss/utils/_sizing.scss +16 -0
- package/dist/catalyst/scss/utils/_spacing.mixins.scss +5 -0
- package/dist/catalyst/scss/utils/_spacing.scss +49 -0
- package/dist/catalyst/scss/utils/_toast.scss +77 -0
- package/dist/catalyst/scss/utils/_typography.mixins.scss +102 -0
- package/dist/catalyst/scss/utils/_typography.scss +34 -0
- package/dist/catalyst/scss/utils/_visibility.mixins.scss +29 -0
- package/dist/catalyst/scss/utils/_visibility.scss +13 -0
- package/dist/cjs/app-globals-aa29ad72.js.map +1 -1
- package/dist/cjs/{cat-alert_16.cjs.entry.js → cat-alert_18.cjs.entry.js} +174 -44
- package/dist/cjs/cat-alert_18.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-form-hint-93a6936b.js +22 -0
- package/dist/cjs/cat-form-hint-93a6936b.js.map +1 -0
- package/dist/cjs/cat-textarea.cjs.entry.js +13 -12
- package/dist/cjs/cat-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +2 -2
- package/dist/cjs/{index-5d72f0e4.js → index-499bad41.js} +44 -1
- package/dist/cjs/index-499bad41.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +14 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +44 -11
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.js +16 -0
- package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon.css +4 -1
- package/dist/collection/components/cat-input/cat-input.css +12 -6
- package/dist/collection/components/cat-input/cat-input.js +24 -25
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +14 -0
- package/dist/collection/components/cat-radio/cat-radio.js +41 -8
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.css +12 -0
- package/dist/collection/components/cat-tab/cat-tab.js +203 -0
- package/dist/collection/components/cat-tab/cat-tab.js.map +1 -0
- package/dist/collection/components/cat-tabs/cat-tabs.css +33 -0
- package/dist/collection/components/cat-tabs/cat-tabs.js +122 -0
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -0
- package/dist/collection/components/cat-textarea/cat-textarea.css +12 -6
- package/dist/collection/components/cat-textarea/cat-textarea.js +24 -18
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +14 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +40 -7
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +13 -8
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/scss/_mixins.scss +9 -0
- package/dist/collection/scss/_variables.scss +64 -0
- package/dist/collection/scss/_variables.tokens.scss +84 -0
- package/dist/collection/scss/core/_base.scss +12 -0
- package/dist/collection/scss/core/_nav.scss +23 -0
- package/dist/collection/scss/core/_typography.scss +237 -0
- package/dist/collection/scss/fonts/_fonts.mixins.azeret.scss +14 -0
- package/dist/collection/scss/fonts/_fonts.mixins.dm.scss +53 -0
- package/dist/collection/scss/fonts/_fonts.mixins.lato.scss +185 -0
- package/dist/collection/scss/fonts/_fonts.mixins.scss +3 -0
- package/dist/collection/scss/fonts/_fonts.scss +13 -0
- package/dist/collection/scss/index.scss +32 -0
- package/dist/collection/scss/utils/_color.scss +52 -0
- package/dist/collection/scss/utils/_disabled.mixins.scss +7 -0
- package/dist/collection/scss/utils/_display.scss +20 -0
- package/dist/collection/scss/utils/_elevation.mixins.scss +10 -0
- package/dist/collection/scss/utils/_elevation.scss +19 -0
- package/dist/collection/scss/utils/_layout.scss +78 -0
- package/dist/collection/scss/utils/_media.mixins.scss +37 -0
- package/dist/collection/scss/utils/_ratio.mixins.scss +12 -0
- package/dist/collection/scss/utils/_ratio.scss +20 -0
- package/dist/collection/scss/utils/_sizing.mixins.scss +15 -0
- package/dist/collection/scss/utils/_sizing.scss +16 -0
- package/dist/collection/scss/utils/_spacing.mixins.scss +5 -0
- package/dist/collection/scss/utils/_spacing.scss +49 -0
- package/dist/collection/scss/utils/_toast.scss +77 -0
- package/dist/collection/scss/utils/_typography.mixins.scss +102 -0
- package/dist/collection/scss/utils/_typography.scss +34 -0
- package/dist/collection/scss/utils/_visibility.mixins.scss +29 -0
- package/dist/collection/scss/utils/_visibility.scss +13 -0
- package/dist/components/cat-checkbox.js +16 -5
- package/dist/components/cat-checkbox.js.map +1 -1
- package/dist/components/cat-form-hint.js +20 -0
- package/dist/components/cat-form-hint.js.map +1 -0
- package/dist/components/cat-icon2.js +1 -1
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +16 -18
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-radio.js +16 -5
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-tab.d.ts +11 -0
- package/dist/components/cat-tab.js +70 -0
- package/dist/components/cat-tab.js.map +1 -0
- package/dist/components/cat-tabs.d.ts +11 -0
- package/dist/components/cat-tabs.js +107 -0
- package/dist/components/cat-tabs.js.map +1 -0
- package/dist/components/cat-textarea.js +14 -12
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.js +16 -5
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +13 -8
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/esm/app-globals-cf55f7f5.js.map +1 -1
- package/dist/esm/{cat-alert_16.entry.js → cat-alert_18.entry.js} +173 -45
- package/dist/esm/cat-alert_18.entry.js.map +1 -0
- package/dist/esm/cat-form-hint-dc443c7c.js +20 -0
- package/dist/esm/cat-form-hint-dc443c7c.js.map +1 -0
- package/dist/esm/cat-textarea.entry.js +13 -12
- package/dist/esm/cat-textarea.entry.js.map +1 -1
- package/dist/esm/catalyst.js +2 -2
- package/dist/esm/{index-fd12be19.js → index-039e6f5f.js} +44 -2
- package/dist/esm/index-039e6f5f.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +9 -0
- package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +19 -0
- package/dist/types/components/cat-input/cat-input.d.ts +7 -5
- package/dist/types/components/cat-radio/cat-radio.d.ts +9 -0
- package/dist/types/components/cat-tab/cat-tab.d.ts +43 -0
- package/dist/types/components/cat-tabs/cat-tabs.d.ts +25 -0
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +7 -2
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +9 -0
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +1 -0
- package/dist/types/components.d.ts +134 -8
- package/package.json +2 -2
- package/dist/catalyst/p-6a5f0d4a.entry.js +0 -10
- package/dist/catalyst/p-6a5f0d4a.entry.js.map +0 -1
- package/dist/catalyst/p-a8629c54.entry.js +0 -2
- package/dist/catalyst/p-a8629c54.entry.js.map +0 -1
- package/dist/catalyst/p-bfc656ca.js +0 -2
- package/dist/catalyst/p-bfc656ca.js.map +0 -1
- package/dist/cjs/cat-alert_16.cjs.entry.js.map +0 -1
- package/dist/cjs/index-5d72f0e4.js.map +0 -1
- package/dist/esm/cat-alert_16.entry.js.map +0 -1
- package/dist/esm/index-fd12be19.js.map +0 -1
|
@@ -51,6 +51,7 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
51
51
|
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
52
52
|
}
|
|
53
53
|
if (isTouchDevice) {
|
|
54
|
+
window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
54
55
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
55
56
|
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
56
57
|
}
|
|
@@ -64,6 +65,7 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
64
65
|
disconnectedCallback() {
|
|
65
66
|
var _a, _b, _c, _d, _e, _f;
|
|
66
67
|
if (isTouchDevice) {
|
|
68
|
+
window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
67
69
|
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
|
|
68
70
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
|
|
69
71
|
}
|
|
@@ -98,28 +100,31 @@ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
98
100
|
showListener() {
|
|
99
101
|
window.clearTimeout(this.hideTimeout);
|
|
100
102
|
this.showTimeout = window.setTimeout(() => {
|
|
101
|
-
var _a
|
|
102
|
-
(_a = this.
|
|
103
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
|
|
103
|
+
var _a;
|
|
104
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
104
105
|
}, this.showDelay);
|
|
105
106
|
}
|
|
106
107
|
hideListener() {
|
|
107
108
|
window.clearTimeout(this.showTimeout);
|
|
108
109
|
this.hideTimeout = window.setTimeout(() => {
|
|
109
|
-
var _a
|
|
110
|
-
(_a = this.
|
|
111
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
|
|
110
|
+
var _a;
|
|
111
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
112
112
|
}, this.hideDelay);
|
|
113
113
|
}
|
|
114
|
-
touchStartListener() {
|
|
114
|
+
touchStartListener(event) {
|
|
115
|
+
event.stopPropagation();
|
|
115
116
|
this.touchTimeout = window.setTimeout(() => {
|
|
116
117
|
var _a;
|
|
117
118
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
118
119
|
}, this.longTouchDuration);
|
|
119
120
|
}
|
|
120
121
|
touchEndListener() {
|
|
122
|
+
if (this.touchTimeout) {
|
|
123
|
+
window.clearTimeout(this.touchTimeout);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
windowTouchStartListener() {
|
|
121
127
|
var _a;
|
|
122
|
-
window.clearTimeout(this.touchTimeout);
|
|
123
128
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
124
129
|
}
|
|
125
130
|
static get style() { return catTooltipCss; }
|
|
@@ -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,wfAAwf;;ACM9gB,IAAI,YAAY,GAAG,CAAC,CAAC;MAORA,YAAU;EALvB;;;;IAOmB,OAAE,GAAG,eAAe,YAAY,EAAE,EAAE,CAAC;;;;IAW9C,YAAO,GAAG,EAAE,CAAC;;;;;IAMb,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,cAAS,GAAc,KAAK,CAAC;;;;IAK7B,cAAS,GAAG,GAAG,CAAC;;;;IAKhB,cAAS,GAAG,CAAC,CAAC;;;;IAKd,sBAAiB,GAAG,IAAI,CAAC;GAoGlC;EAjGC,aAAa,CAAC,EAAE,GAAG,EAAiB;IAClC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;GACzC;EAED,gBAAgB;;IACd,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IA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AAC,UAAU,CAAC;;MACpC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;KAC7C,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;GAC5B;EAEO,gBAAgB;;IACtB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;GAChD;;;;;;;;;;AAzIuBA,mBAAM,GAAG,CAAE,CAAA;;;;;;;;;;;;;;;;;;;;","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: 16rem;\n$-box-shadow: rgb(0 0 0 / 8%) 0 1px 8px 0;\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.tooltip {\n position: absolute;\n @include cat-body('s', 500);\n padding: 0.75rem;\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 border: 1px solid cat-token('color.ui.border.default');\n z-index: $cat-tooltip-z-index;\n max-width: $-max-width;\n\n &-show {\n opacity: 1;\n visibility: visible;\n }\n}\n\n.tooltip-trigger {\n display: inline-block;\n\n &:focus {\n outline: none;\n }\n}\n","import { Component, h, Host, Listen, Prop } from '@stencil/core';\nimport { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport isTouchScreen from '../../utils/is-touch-screen';\nimport firstTabbable from '../../utils/first-tabbable';\nimport { FocusableElement } from 'tabbable';\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 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\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 * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 500;\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 if (this.trigger && this.tooltip) {\n autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n\n if (isTouchScreen) {\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 disconnectedCallback(): void {\n if (isTouchScreen) {\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 {this.content && !this.disabled && (\n <div ref={el => (this.tooltip = el)} id={this.id} class=\"tooltip\">\n {this.content}\n </div>\n )}\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private update() {\n if (this.trigger && this.tooltip) {\n computePosition(this.trigger, this.tooltip, {\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip()]\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.trigger?.focus();\n this.tooltip?.classList.add('tooltip-show');\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.trigger?.blur();\n this.tooltip?.classList.remove('tooltip-show');\n }, this.hideDelay);\n }\n\n private touchStartListener() {\n this.touchTimeout = window.setTimeout(() => {\n this.tooltip?.classList.add('tooltip-show');\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n window.clearTimeout(this.touchTimeout);\n this.tooltip?.classList.remove('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,wfAAwf;;ACM9gB,IAAI,YAAY,GAAG,CAAC,CAAC;MA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CAAC,CAAC;KACJ;GACF;EAEO,YAAY;IAClB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;MACnC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;KAC7C,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;GACpB;EAEO,YAAY;IAClB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;MACnC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KAChD,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;GACpB;EAEO,kBAAkB,CAAC,KAAY;IACrC,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC;;MACpC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;KAC7C,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;GAC5B;EAEO,gBAAgB;IACtB,IAAI,IAAI,CAAC,YAAY,EAAE;MACrB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACxC;GACF;EAEO,wBAAwB;;IAC9B,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;GAChD;;;;;;;;;;AA/IuBA,mBAAM,GAAG,CAAE,CAAA;;;;;;;;;;;;;;;;;;;;","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: 16rem;\n$-box-shadow: rgb(0 0 0 / 8%) 0 1px 8px 0;\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.tooltip {\n position: absolute;\n @include cat-body('s', 500);\n padding: 0.75rem;\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 border: 1px solid cat-token('color.ui.border.default');\n z-index: $cat-tooltip-z-index;\n max-width: $-max-width;\n\n &-show {\n opacity: 1;\n visibility: visible;\n }\n}\n\n.tooltip-trigger {\n display: inline-block;\n\n &:focus {\n outline: none;\n }\n}\n","import { Component, h, Host, Listen, Prop } from '@stencil/core';\nimport { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport isTouchScreen from '../../utils/is-touch-screen';\nimport firstTabbable from '../../utils/first-tabbable';\nimport { FocusableElement } from 'tabbable';\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 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\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 * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 500;\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 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 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 {this.content && !this.disabled && (\n <div ref={el => (this.tooltip = el)} id={this.id} class=\"tooltip\">\n {this.content}\n </div>\n )}\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private update() {\n if (this.trigger && this.tooltip) {\n computePosition(this.trigger, this.tooltip, {\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip()]\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.tooltip?.classList.add('tooltip-show');\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.tooltip?.classList.add('tooltip-show');\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"],"version":3}
|