@haiilo/catalyst 0.3.2 → 0.4.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.
Files changed (39) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/p-89a97b7b.entry.js +10 -0
  4. package/dist/catalyst/p-89a97b7b.entry.js.map +1 -0
  5. package/dist/cjs/{cat-alert_8.cjs.entry.js → cat-alert_9.cjs.entry.js} +158 -51
  6. package/dist/cjs/cat-alert_9.cjs.entry.js.map +1 -0
  7. package/dist/cjs/catalyst.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/collection-manifest.json +2 -1
  10. package/dist/collection/components/cat-menu/cat-menu.js +3 -5
  11. package/dist/collection/components/cat-menu/cat-menu.js.map +1 -1
  12. package/dist/collection/components/cat-tooltip/cat-tooltip.css +37 -0
  13. package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
  14. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
  15. package/dist/collection/utils/first-tabbable.js +6 -0
  16. package/dist/collection/utils/first-tabbable.js.map +1 -0
  17. package/dist/collection/utils/is-touch-screen.js +3 -0
  18. package/dist/collection/utils/is-touch-screen.js.map +1 -0
  19. package/dist/components/cat-menu.js +11 -1519
  20. package/dist/components/cat-menu.js.map +1 -1
  21. package/dist/components/cat-tooltip.d.ts +11 -0
  22. package/dist/components/cat-tooltip.js +154 -0
  23. package/dist/components/cat-tooltip.js.map +1 -0
  24. package/dist/components/first-tabbable.js +1495 -0
  25. package/dist/components/first-tabbable.js.map +1 -0
  26. package/dist/esm/{cat-alert_8.entry.js → cat-alert_9.entry.js} +158 -52
  27. package/dist/esm/cat-alert_9.entry.js.map +1 -0
  28. package/dist/esm/catalyst.js +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/types/components/cat-menu/cat-menu.d.ts +0 -1
  31. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
  32. package/dist/types/components.d.ts +61 -0
  33. package/dist/types/utils/first-tabbable.d.ts +4 -0
  34. package/dist/types/utils/is-touch-screen.d.ts +2 -0
  35. package/package.json +7 -7
  36. package/dist/catalyst/p-31b500c7.entry.js +0 -10
  37. package/dist/catalyst/p-31b500c7.entry.js.map +0 -1
  38. package/dist/cjs/cat-alert_8.cjs.entry.js.map +0 -1
  39. package/dist/esm/cat-alert_8.entry.js.map +0 -1
@@ -0,0 +1,154 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { b as firstTabbable, c as autoUpdate, d as computePosition, o as offset, e as flip } from './first-tabbable.js';
3
+
4
+ const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
5
+
6
+ const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{position:absolute;font-size:0.875rem;line-height:1rem;padding:0.25rem;background-color:rgba(0, 0, 0, 0.7);border-radius:0.125rem;color:white;white-space:nowrap;transition:0.13s linear;visibility:hidden;opacity:0}.tooltip-show{opacity:1;visibility:visible}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
7
+
8
+ let nextUniqueId = 0;
9
+ const CatTooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.__attachShadow();
14
+ this.id = `cat-tooltip-${nextUniqueId++}`;
15
+ /**
16
+ * The content of the tooltip.
17
+ */
18
+ this.content = '';
19
+ /**
20
+ * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,
21
+ * and invisible. Corresponds with the native HTML disabled attribute.
22
+ */
23
+ this.disabled = false;
24
+ /**
25
+ * The placement of the tooltip.
26
+ */
27
+ this.placement = 'top';
28
+ /**
29
+ * The delay time for showing tooltip in ms.
30
+ */
31
+ this.showDelay = 1000;
32
+ /**
33
+ * The delay time for hiding tooltip in ms.
34
+ */
35
+ this.hideDelay = 0;
36
+ /**
37
+ * The duration of tap to show the tooltip.
38
+ */
39
+ this.longTouchDuration = 1000;
40
+ }
41
+ handleKeyDown({ key }) {
42
+ key === 'Escape' && this.hideListener();
43
+ }
44
+ componentDidLoad() {
45
+ var _a, _b, _c, _d, _e, _f, _g;
46
+ this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;
47
+ if (!this.isTabbable) {
48
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
49
+ }
50
+ if (this.trigger && this.tooltip) {
51
+ autoUpdate(this.trigger, this.tooltip, () => this.update());
52
+ }
53
+ if (isTouchDevice) {
54
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
55
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
56
+ }
57
+ else {
58
+ (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('focusin', this.showListener.bind(this));
59
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('focusout', this.hideListener.bind(this));
60
+ (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('mouseenter', this.showListener.bind(this));
61
+ (_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('mouseleave', this.hideListener.bind(this));
62
+ }
63
+ }
64
+ disconnectedCallback() {
65
+ var _a, _b, _c, _d, _e, _f;
66
+ if (isTouchDevice) {
67
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
68
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
69
+ }
70
+ else {
71
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseenter', this.showListener.bind(this));
72
+ (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseleave', this.hideListener.bind(this));
73
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.removeEventListener('focusin', this.showListener.bind(this));
74
+ (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.removeEventListener('focusout', this.hideListener.bind(this));
75
+ }
76
+ }
77
+ render() {
78
+ return (h(Host, null, h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" }, h("slot", null)), this.content && !this.disabled && (h("div", { ref: el => (this.tooltip = el), id: this.id, class: "tooltip" }, this.content))));
79
+ }
80
+ get isTabbable() {
81
+ return firstTabbable(this.trigger);
82
+ }
83
+ update() {
84
+ if (this.trigger && this.tooltip) {
85
+ computePosition(this.trigger, this.tooltip, {
86
+ placement: this.placement,
87
+ middleware: [offset(CatTooltip$1.OFFSET), flip()]
88
+ }).then(({ x, y }) => {
89
+ if (this.tooltip) {
90
+ Object.assign(this.tooltip.style, {
91
+ left: `${Math.max(0, x)}px`,
92
+ top: `${y}px`
93
+ });
94
+ }
95
+ });
96
+ }
97
+ }
98
+ showListener() {
99
+ window.clearTimeout(this.hideTimeout);
100
+ this.showTimeout = window.setTimeout(() => {
101
+ var _a, _b;
102
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.focus();
103
+ (_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
104
+ }, this.showDelay);
105
+ }
106
+ hideListener() {
107
+ window.clearTimeout(this.showTimeout);
108
+ this.hideTimeout = window.setTimeout(() => {
109
+ var _a, _b;
110
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.blur();
111
+ (_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
112
+ }, this.hideDelay);
113
+ }
114
+ touchStartListener() {
115
+ this.touchTimeout = window.setTimeout(() => {
116
+ var _a;
117
+ (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
118
+ }, this.longTouchDuration);
119
+ }
120
+ touchEndListener() {
121
+ var _a;
122
+ window.clearTimeout(this.touchTimeout);
123
+ (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
124
+ }
125
+ static get style() { return catTooltipCss; }
126
+ }, [1, "cat-tooltip", {
127
+ "content": [1],
128
+ "disabled": [4],
129
+ "placement": [1],
130
+ "showDelay": [2, "show-delay"],
131
+ "hideDelay": [2, "hide-delay"],
132
+ "longTouchDuration": [2, "long-touch-duration"]
133
+ }, [[0, "keydown", "handleKeyDown"]]]);
134
+ CatTooltip$1.OFFSET = 4;
135
+ function defineCustomElement$1() {
136
+ if (typeof customElements === "undefined") {
137
+ return;
138
+ }
139
+ const components = ["cat-tooltip"];
140
+ components.forEach(tagName => { switch (tagName) {
141
+ case "cat-tooltip":
142
+ if (!customElements.get(tagName)) {
143
+ customElements.define(tagName, CatTooltip$1);
144
+ }
145
+ break;
146
+ } });
147
+ }
148
+
149
+ const CatTooltip = CatTooltip$1;
150
+ const defineCustomElement = defineCustomElement$1;
151
+
152
+ export { CatTooltip, defineCustomElement };
153
+
154
+ //# sourceMappingURL=cat-tooltip.js.map
@@ -0,0 +1 @@
1
+ {"file":"cat-tooltip.js","mappings":";;;AAAA,MAAM,aAAa,GAAG,cAAc,IAAI,MAAM,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC;;ACA9E,MAAM,aAAa,GAAG,wYAAwY;;ACM9Z,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,IAAI,CAAC;;;;IAKjB,cAAS,GAAG,CAAC,CAAC;;;;IAKd,sBAAiB,GAAG,IAAI,CAAC;GAoGlC;EAjGC,aAAa,CAAC,EAAE,GAAG,EAAiB;IAClC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAA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c,CAAC,CAAC;KAChD,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;GACpB;EAEO,kBAAkB;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,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:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.tooltip {\n position: absolute;\n @include cat-body('s');\n padding: 0.25rem;\n background-color: rgba(cat-token('color.ui.background.tooltip'), cat-token('opacity.tooltip'));\n border-radius: cat-border-radius('s');\n color: cat-token('color.ui.font.tooltip');\n white-space: nowrap;\n transition: cat-token('time.transition.s') linear;\n visibility: hidden;\n opacity: 0;\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 = 1000;\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}