@haiilo/catalyst 0.5.6 → 0.5.7
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/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- package/dist/catalyst/catalyst.css +1 -0
- package/dist/catalyst/catalyst.esm.js +2 -0
- package/dist/catalyst/catalyst.esm.js.map +1 -0
- package/dist/catalyst/index.cdn.js +21 -0
- package/dist/catalyst/index.esm.js +2 -0
- package/dist/catalyst/index.esm.js.map +1 -0
- package/dist/catalyst/p-9a3c2375.js +2 -0
- package/dist/catalyst/p-9a3c2375.js.map +1 -0
- package/dist/catalyst/p-a6b8ebe9.entry.js +10 -0
- package/dist/catalyst/p-a6b8ebe9.entry.js.map +1 -0
- package/dist/catalyst/p-bfc656ca.js +2 -0
- package/dist/catalyst/p-bfc656ca.js.map +1 -0
- package/dist/catalyst/p-e82b63e9.js +2 -0
- package/dist/catalyst/p-e82b63e9.js.map +1 -0
- package/dist/cjs/app-globals-2a30d681.js +256 -0
- package/dist/cjs/app-globals-2a30d681.js.map +1 -0
- package/dist/cjs/cat-alert_15.cjs.entry.js +4651 -0
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-icon-registry-b3a95a6b.js +442 -0
- package/dist/cjs/cat-icon-registry-b3a95a6b.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +24 -0
- package/dist/cjs/catalyst.cjs.js.map +1 -0
- package/dist/cjs/index-5d72f0e4.js +1347 -0
- package/dist/cjs/index-5d72f0e4.js.map +1 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +26 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/cat-alert/cat-alert.css +61 -0
- package/dist/collection/components/cat-alert/cat-alert.js +61 -0
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -0
- package/dist/collection/components/cat-badge/cat-badge.css +154 -0
- package/dist/collection/components/cat-badge/cat-badge.js +143 -0
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -0
- package/dist/collection/components/cat-button/cat-button.css +333 -0
- package/dist/collection/components/cat-button/cat-button.js +615 -0
- package/dist/collection/components/cat-button/cat-button.js.map +1 -0
- package/dist/collection/components/cat-card/cat-card.css +24 -0
- package/dist/collection/components/cat-card/cat-card.js +20 -0
- package/dist/collection/components/cat-card/cat-card.js.map +1 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +70 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon-registry.js +55 -0
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon.css +50 -0
- package/dist/collection/components/cat-icon/cat-icon.js +91 -0
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -0
- package/dist/collection/components/cat-input/cat-input.css +131 -0
- package/dist/collection/components/cat-input/cat-input.js +606 -0
- package/dist/collection/components/cat-input/cat-input.js.map +1 -0
- package/dist/collection/components/cat-menu/cat-menu.css +34 -0
- package/dist/collection/components/cat-menu/cat-menu.js +184 -0
- package/dist/collection/components/cat-menu/cat-menu.js.map +1 -0
- package/dist/collection/components/cat-radio/cat-radio.css +84 -0
- package/dist/collection/components/cat-radio/cat-radio.js +283 -0
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.css +69 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +311 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -0
- package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +131 -0
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -0
- package/dist/collection/components/cat-spinner/cat-spinner.css +63 -0
- package/dist/collection/components/cat-spinner/cat-spinner.js +65 -0
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -0
- package/dist/collection/components/cat-textarea/cat-textarea.css +72 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
- package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +41 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
- package/dist/collection/index.cdn.js +21 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/init.js +17 -0
- package/dist/collection/init.js.map +1 -0
- package/dist/collection/utils/breakpoints.js +12 -0
- package/dist/collection/utils/breakpoints.js.map +1 -0
- package/dist/collection/utils/first-tabbable.js +6 -0
- package/dist/collection/utils/first-tabbable.js.map +1 -0
- package/dist/collection/utils/is-touch-screen.js +3 -0
- package/dist/collection/utils/is-touch-screen.js.map +1 -0
- package/dist/collection/utils/media-matcher.js +55 -0
- package/dist/collection/utils/media-matcher.js.map +1 -0
- package/dist/collection/utils/platform.js +50 -0
- package/dist/collection/utils/platform.js.map +1 -0
- package/dist/components/cat-alert.d.ts +11 -0
- package/dist/components/cat-alert.js +53 -0
- package/dist/components/cat-alert.js.map +1 -0
- package/dist/components/cat-badge.d.ts +11 -0
- package/dist/components/cat-badge.js +68 -0
- package/dist/components/cat-badge.js.map +1 -0
- package/dist/components/cat-button.d.ts +11 -0
- package/dist/components/cat-button.js +8 -0
- package/dist/components/cat-button.js.map +1 -0
- package/dist/components/cat-button2.js +346 -0
- package/dist/components/cat-button2.js.map +1 -0
- package/dist/components/cat-card.d.ts +11 -0
- package/dist/components/cat-card.js +35 -0
- package/dist/components/cat-card.js.map +1 -0
- package/dist/components/cat-checkbox.d.ts +11 -0
- package/dist/components/cat-checkbox.js +103 -0
- package/dist/components/cat-checkbox.js.map +1 -0
- package/dist/components/cat-i18n-registry.js +74 -0
- package/dist/components/cat-i18n-registry.js.map +1 -0
- package/dist/components/cat-icon-registry.js +59 -0
- package/dist/components/cat-icon-registry.js.map +1 -0
- package/dist/components/cat-icon.d.ts +11 -0
- package/dist/components/cat-icon.js +8 -0
- package/dist/components/cat-icon.js.map +1 -0
- package/dist/components/cat-icon2.js +49 -0
- package/dist/components/cat-icon2.js.map +1 -0
- package/dist/components/cat-input.d.ts +11 -0
- package/dist/components/cat-input.js +172 -0
- package/dist/components/cat-input.js.map +1 -0
- package/dist/components/cat-menu.d.ts +11 -0
- package/dist/components/cat-menu.js +870 -0
- package/dist/components/cat-menu.js.map +1 -0
- package/dist/components/cat-radio.d.ts +11 -0
- package/dist/components/cat-radio.js +93 -0
- package/dist/components/cat-radio.js.map +1 -0
- package/dist/components/cat-scrollable.d.ts +11 -0
- package/dist/components/cat-scrollable.js +1362 -0
- package/dist/components/cat-scrollable.js.map +1 -0
- package/dist/components/cat-skeleton.d.ts +11 -0
- package/dist/components/cat-skeleton.js +78 -0
- package/dist/components/cat-skeleton.js.map +1 -0
- package/dist/components/cat-spinner.d.ts +11 -0
- package/dist/components/cat-spinner.js +8 -0
- package/dist/components/cat-spinner.js.map +1 -0
- package/dist/components/cat-spinner2.js +41 -0
- package/dist/components/cat-spinner2.js.map +1 -0
- package/dist/components/cat-textarea.d.ts +11 -0
- package/dist/components/cat-textarea.js +119 -0
- package/dist/components/cat-textarea.js.map +1 -0
- package/dist/components/cat-toggle.d.ts +11 -0
- package/dist/components/cat-toggle.js +93 -0
- package/dist/components/cat-toggle.js.map +1 -0
- package/dist/components/cat-tooltip.d.ts +11 -0
- package/dist/components/cat-tooltip.js +154 -0
- package/dist/components/cat-tooltip.js.map +1 -0
- package/dist/components/first-tabbable.js +1495 -0
- package/dist/components/first-tabbable.js.map +1 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +258 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/loglevel.js +315 -0
- package/dist/components/loglevel.js.map +1 -0
- package/dist/esm/app-globals-77cd8c8e.js +254 -0
- package/dist/esm/app-globals-77cd8c8e.js.map +1 -0
- package/dist/esm/cat-alert_15.entry.js +4633 -0
- package/dist/esm/cat-alert_15.entry.js.map +1 -0
- package/dist/esm/cat-icon-registry-a7acd6f7.js +438 -0
- package/dist/esm/cat-icon-registry-a7acd6f7.js.map +1 -0
- package/dist/esm/catalyst.js +22 -0
- package/dist/esm/catalyst.js.map +1 -0
- package/dist/esm/index-fd12be19.js +1320 -0
- package/dist/esm/index-fd12be19.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +22 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/cat-alert/cat-alert.d.ts +14 -0
- package/dist/types/components/cat-badge/cat-badge.d.ts +29 -0
- package/dist/types/components/cat-button/cat-button.d.ts +134 -0
- package/dist/types/components/cat-card/cat-card.d.ts +7 -0
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +15 -0
- package/dist/types/components/cat-icon/cat-icon.d.ts +23 -0
- package/dist/types/components/cat-input/cat-input.d.ts +130 -0
- package/dist/types/components/cat-menu/cat-menu.d.ts +31 -0
- package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +52 -0
- package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
- package/dist/types/components/cat-spinner/cat-spinner.d.ts +15 -0
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
- package/dist/types/components.d.ts +1167 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/init.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/breakpoints.d.ts +7 -0
- package/dist/types/utils/first-tabbable.d.ts +4 -0
- package/dist/types/utils/is-touch-screen.d.ts +2 -0
- package/dist/types/utils/media-matcher.d.ts +13 -0
- package/dist/types/utils/platform.d.ts +18 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file. Do not edit directly.
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable value-keyword-case */
|
|
5
|
+
/* stylelint-enable value-keyword-case */
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
margin-bottom: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([hidden]) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
label {
|
|
16
|
+
flex: 0 1 auto;
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: 0.5rem;
|
|
19
|
+
font-size: 0.9375rem;
|
|
20
|
+
line-height: 1.25rem;
|
|
21
|
+
/* stylelint-disable property-no-vendor-prefix */
|
|
22
|
+
-webkit-user-select: none;
|
|
23
|
+
-ms-user-select: none;
|
|
24
|
+
user-select: none;
|
|
25
|
+
/* stylelint-enable property-no-vendor-prefix */
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input {
|
|
30
|
+
position: absolute !important;
|
|
31
|
+
width: 1px !important;
|
|
32
|
+
height: 1px !important;
|
|
33
|
+
padding: 0 !important;
|
|
34
|
+
margin: -1px !important;
|
|
35
|
+
overflow: hidden !important;
|
|
36
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
37
|
+
white-space: nowrap !important;
|
|
38
|
+
border: 0 !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.toggle {
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
position: relative;
|
|
47
|
+
width: 2rem;
|
|
48
|
+
height: 1.25rem;
|
|
49
|
+
border-radius: 10rem;
|
|
50
|
+
background-color: #d7dbe0;
|
|
51
|
+
transition: background-color 0.13s ease;
|
|
52
|
+
}
|
|
53
|
+
:checked + .toggle {
|
|
54
|
+
background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
55
|
+
}
|
|
56
|
+
:focus-visible + .toggle {
|
|
57
|
+
outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
|
|
58
|
+
outline-offset: 1px;
|
|
59
|
+
}
|
|
60
|
+
.toggle::after {
|
|
61
|
+
content: "";
|
|
62
|
+
position: absolute;
|
|
63
|
+
width: 1rem;
|
|
64
|
+
height: 1rem;
|
|
65
|
+
background: #fff;
|
|
66
|
+
border-radius: 10rem;
|
|
67
|
+
transform: translateX(calc(2px - 0.5rem));
|
|
68
|
+
transition: transform 0.13s linear;
|
|
69
|
+
box-shadow: 0 1px 4px 0 rgba(16, 29, 48, 0.2);
|
|
70
|
+
}
|
|
71
|
+
:checked + .toggle::after {
|
|
72
|
+
transform: translateX(calc(-2px + 0.5rem));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.label {
|
|
76
|
+
flex: 1 1 auto;
|
|
77
|
+
}
|
|
78
|
+
.is-hidden .label {
|
|
79
|
+
position: absolute !important;
|
|
80
|
+
width: 1px !important;
|
|
81
|
+
height: 1px !important;
|
|
82
|
+
padding: 0 !important;
|
|
83
|
+
margin: -1px !important;
|
|
84
|
+
overflow: hidden !important;
|
|
85
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
86
|
+
white-space: nowrap !important;
|
|
87
|
+
border: 0 !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.is-disabled {
|
|
91
|
+
cursor: not-allowed;
|
|
92
|
+
color: rgb(var(--cat-font-color-muted, 105, 118, 135));
|
|
93
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Component, Event, h, Prop, Method } from '@stencil/core';
|
|
2
|
+
import log from 'loglevel';
|
|
3
|
+
let nextUniqueId = 0;
|
|
4
|
+
/**
|
|
5
|
+
* Toggles are graphical interface switches that give user control over a
|
|
6
|
+
* feature or option that can be turned on or off.
|
|
7
|
+
*
|
|
8
|
+
* @part toggle - The toggle element.
|
|
9
|
+
* @part label - The label content.
|
|
10
|
+
*/
|
|
11
|
+
export class CatToggle {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.id = `cat-toggle-${nextUniqueId++}`;
|
|
14
|
+
/**
|
|
15
|
+
* Checked state of the toggle.
|
|
16
|
+
*/
|
|
17
|
+
this.checked = false;
|
|
18
|
+
/**
|
|
19
|
+
* Disabled state of the toggle.
|
|
20
|
+
*/
|
|
21
|
+
this.disabled = false;
|
|
22
|
+
/**
|
|
23
|
+
* The label of the toggle that is visible.
|
|
24
|
+
*/
|
|
25
|
+
this.label = '';
|
|
26
|
+
/**
|
|
27
|
+
* Visually hide the label, but still show it to assistive technologies like screen readers.
|
|
28
|
+
*/
|
|
29
|
+
this.labelHidden = false;
|
|
30
|
+
/**
|
|
31
|
+
* Required state of the toggle
|
|
32
|
+
*/
|
|
33
|
+
this.required = false;
|
|
34
|
+
}
|
|
35
|
+
componentWillRender() {
|
|
36
|
+
if (!this.label) {
|
|
37
|
+
log.error('[A11y] Missing ARIA label on toggle', this);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets focus on the toggle. Use this method instead of `toggle.focus()`.
|
|
42
|
+
*
|
|
43
|
+
* @param options An optional object providing options to control aspects of
|
|
44
|
+
* the focusing process.
|
|
45
|
+
*/
|
|
46
|
+
async setFocus(options) {
|
|
47
|
+
this.input.focus(options);
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } },
|
|
51
|
+
h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }),
|
|
52
|
+
h("span", { class: "toggle", part: "toggle" }),
|
|
53
|
+
h("span", { class: "label", part: "label" }, this.label)));
|
|
54
|
+
}
|
|
55
|
+
onInput(event) {
|
|
56
|
+
this.catChange.emit(event);
|
|
57
|
+
}
|
|
58
|
+
onFocus(event) {
|
|
59
|
+
this.catFocus.emit(event);
|
|
60
|
+
}
|
|
61
|
+
onBlur(event) {
|
|
62
|
+
this.catBlur.emit(event);
|
|
63
|
+
}
|
|
64
|
+
static get is() { return "cat-toggle"; }
|
|
65
|
+
static get encapsulation() { return "shadow"; }
|
|
66
|
+
static get originalStyleUrls() { return {
|
|
67
|
+
"$": ["cat-toggle.scss"]
|
|
68
|
+
}; }
|
|
69
|
+
static get styleUrls() { return {
|
|
70
|
+
"$": ["cat-toggle.css"]
|
|
71
|
+
}; }
|
|
72
|
+
static get properties() { return {
|
|
73
|
+
"checked": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "boolean",
|
|
78
|
+
"resolved": "boolean",
|
|
79
|
+
"references": {}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": "Checked state of the toggle."
|
|
86
|
+
},
|
|
87
|
+
"attribute": "checked",
|
|
88
|
+
"reflect": false,
|
|
89
|
+
"defaultValue": "false"
|
|
90
|
+
},
|
|
91
|
+
"disabled": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"mutable": false,
|
|
94
|
+
"complexType": {
|
|
95
|
+
"original": "boolean",
|
|
96
|
+
"resolved": "boolean",
|
|
97
|
+
"references": {}
|
|
98
|
+
},
|
|
99
|
+
"required": false,
|
|
100
|
+
"optional": false,
|
|
101
|
+
"docs": {
|
|
102
|
+
"tags": [],
|
|
103
|
+
"text": "Disabled state of the toggle."
|
|
104
|
+
},
|
|
105
|
+
"attribute": "disabled",
|
|
106
|
+
"reflect": false,
|
|
107
|
+
"defaultValue": "false"
|
|
108
|
+
},
|
|
109
|
+
"label": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "The label of the toggle that is visible."
|
|
122
|
+
},
|
|
123
|
+
"attribute": "label",
|
|
124
|
+
"reflect": false,
|
|
125
|
+
"defaultValue": "''"
|
|
126
|
+
},
|
|
127
|
+
"labelHidden": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "boolean",
|
|
132
|
+
"resolved": "boolean",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Visually hide the label, but still show it to assistive technologies like screen readers."
|
|
140
|
+
},
|
|
141
|
+
"attribute": "label-hidden",
|
|
142
|
+
"reflect": false,
|
|
143
|
+
"defaultValue": "false"
|
|
144
|
+
},
|
|
145
|
+
"name": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string | undefined",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "The name of the input"
|
|
158
|
+
},
|
|
159
|
+
"attribute": "name",
|
|
160
|
+
"reflect": false
|
|
161
|
+
},
|
|
162
|
+
"required": {
|
|
163
|
+
"type": "boolean",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "boolean",
|
|
167
|
+
"resolved": "boolean",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": "Required state of the toggle"
|
|
175
|
+
},
|
|
176
|
+
"attribute": "required",
|
|
177
|
+
"reflect": false,
|
|
178
|
+
"defaultValue": "false"
|
|
179
|
+
},
|
|
180
|
+
"value": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "string",
|
|
185
|
+
"resolved": "string | undefined",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": true,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "The value of the toggle"
|
|
193
|
+
},
|
|
194
|
+
"attribute": "value",
|
|
195
|
+
"reflect": false
|
|
196
|
+
}
|
|
197
|
+
}; }
|
|
198
|
+
static get events() { return [{
|
|
199
|
+
"method": "catChange",
|
|
200
|
+
"name": "catChange",
|
|
201
|
+
"bubbles": true,
|
|
202
|
+
"cancelable": true,
|
|
203
|
+
"composed": true,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "Emitted when the checked status of the toggle is changed."
|
|
207
|
+
},
|
|
208
|
+
"complexType": {
|
|
209
|
+
"original": "any",
|
|
210
|
+
"resolved": "any",
|
|
211
|
+
"references": {}
|
|
212
|
+
}
|
|
213
|
+
}, {
|
|
214
|
+
"method": "catFocus",
|
|
215
|
+
"name": "catFocus",
|
|
216
|
+
"bubbles": true,
|
|
217
|
+
"cancelable": true,
|
|
218
|
+
"composed": true,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": "Emitted when the toggle received focus."
|
|
222
|
+
},
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "FocusEvent",
|
|
225
|
+
"resolved": "FocusEvent",
|
|
226
|
+
"references": {
|
|
227
|
+
"FocusEvent": {
|
|
228
|
+
"location": "global"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
"method": "catBlur",
|
|
234
|
+
"name": "catBlur",
|
|
235
|
+
"bubbles": true,
|
|
236
|
+
"cancelable": true,
|
|
237
|
+
"composed": true,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": "Emitted when the toggle loses focus."
|
|
241
|
+
},
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "FocusEvent",
|
|
244
|
+
"resolved": "FocusEvent",
|
|
245
|
+
"references": {
|
|
246
|
+
"FocusEvent": {
|
|
247
|
+
"location": "global"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}]; }
|
|
252
|
+
static get methods() { return {
|
|
253
|
+
"setFocus": {
|
|
254
|
+
"complexType": {
|
|
255
|
+
"signature": "(options?: FocusOptions | undefined) => Promise<void>",
|
|
256
|
+
"parameters": [{
|
|
257
|
+
"tags": [{
|
|
258
|
+
"name": "param",
|
|
259
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
260
|
+
}],
|
|
261
|
+
"text": "An optional object providing options to control aspects of\nthe focusing process."
|
|
262
|
+
}],
|
|
263
|
+
"references": {
|
|
264
|
+
"Promise": {
|
|
265
|
+
"location": "global"
|
|
266
|
+
},
|
|
267
|
+
"FocusOptions": {
|
|
268
|
+
"location": "global"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"return": "Promise<void>"
|
|
272
|
+
},
|
|
273
|
+
"docs": {
|
|
274
|
+
"text": "Sets focus on the toggle. Use this method instead of `toggle.focus()`.",
|
|
275
|
+
"tags": [{
|
|
276
|
+
"name": "param",
|
|
277
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
278
|
+
}]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}; }
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=cat-toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;GAMG;AAMH,MAAM,OAAO,SAAS;EALtB;IAMmB,OAAE,GAAG,cAAc,YAAY,EAAE,EAAE,CAAC;IAGrD;;OAEG;IACK,YAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAO5B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;GA4E1B;EAtDC,mBAAmB;IACjB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACf,GAAG,CAAC,KAAK,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;KACxD;EACH,CAAC;EAED;;;;;KAKG;EAEH,KAAK,CAAC,QAAQ,CAAC,OAAsB;IACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;EAC5B,CAAC;EAED,MAAM;IACJ,OAAO,CACL,aAAO,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE;MAC7F,aACE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,EAAsB,CAAC,EAChD,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAC,kBAAkB,EACxB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAChC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAChC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAC9B;MACF,YAAM,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,GAAQ;MAC1C,YAAM,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,IAC7B,IAAI,CAAC,KAAK,CACN,CACD,CACT,CAAC;EACJ,CAAC;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC7B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Prop, Method } from '@stencil/core';\nimport log from 'loglevel';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly id = `cat-toggle-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n /**\n * Checked state of the toggle.\n */\n @Prop() checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the toggle that is visible.\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 * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle\n */\n @Prop() value?: string;\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n if (!this.label) {\n log.error('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Sets focus on the toggle. Use this method instead of `toggle.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <label htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {this.label}\n </span>\n </label>\n );\n }\n\n private onInput(event: Event) {\n this.catChange.emit(event);\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 }\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file. Do not edit directly.
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable value-keyword-case */
|
|
5
|
+
/* stylelint-enable value-keyword-case */
|
|
6
|
+
:host {
|
|
7
|
+
display: contents;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([hidden]) {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltip {
|
|
15
|
+
position: absolute;
|
|
16
|
+
font-size: 0.875rem;
|
|
17
|
+
line-height: 1rem;
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
padding: 0.75rem;
|
|
20
|
+
background-color: white;
|
|
21
|
+
border-radius: 0.25rem;
|
|
22
|
+
color: black;
|
|
23
|
+
transition: opacity 0.25s linear, visibility 0.25s linear;
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
box-shadow: rgba(0, 0, 0, 0.08) 0 1px 8px 0;
|
|
27
|
+
border: 1px solid #ebecf0;
|
|
28
|
+
z-index: 200;
|
|
29
|
+
max-width: 16rem;
|
|
30
|
+
}
|
|
31
|
+
.tooltip-show {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
visibility: visible;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tooltip-trigger {
|
|
37
|
+
display: inline-block;
|
|
38
|
+
}
|
|
39
|
+
.tooltip-trigger:focus {
|
|
40
|
+
outline: none;
|
|
41
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Component, h, Host, Listen, Prop } from '@stencil/core';
|
|
2
|
+
import { autoUpdate, computePosition, flip, offset } from '@floating-ui/dom';
|
|
3
|
+
import isTouchScreen from '../../utils/is-touch-screen';
|
|
4
|
+
import firstTabbable from '../../utils/first-tabbable';
|
|
5
|
+
let nextUniqueId = 0;
|
|
6
|
+
export class CatTooltip {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.id = `cat-tooltip-${nextUniqueId++}`;
|
|
9
|
+
/**
|
|
10
|
+
* The content of the tooltip.
|
|
11
|
+
*/
|
|
12
|
+
this.content = '';
|
|
13
|
+
/**
|
|
14
|
+
* Specifies that the tooltip should be disabled. A disabled tooltip is unusable,
|
|
15
|
+
* and invisible. Corresponds with the native HTML disabled attribute.
|
|
16
|
+
*/
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
/**
|
|
19
|
+
* The placement of the tooltip.
|
|
20
|
+
*/
|
|
21
|
+
this.placement = 'top';
|
|
22
|
+
/**
|
|
23
|
+
* The delay time for showing tooltip in ms.
|
|
24
|
+
*/
|
|
25
|
+
this.showDelay = 500;
|
|
26
|
+
/**
|
|
27
|
+
* The delay time for hiding tooltip in ms.
|
|
28
|
+
*/
|
|
29
|
+
this.hideDelay = 0;
|
|
30
|
+
/**
|
|
31
|
+
* The duration of tap to show the tooltip.
|
|
32
|
+
*/
|
|
33
|
+
this.longTouchDuration = 1000;
|
|
34
|
+
}
|
|
35
|
+
handleKeyDown({ key }) {
|
|
36
|
+
key === 'Escape' && this.hideListener();
|
|
37
|
+
}
|
|
38
|
+
componentDidLoad() {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
40
|
+
this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;
|
|
41
|
+
if (!this.isTabbable) {
|
|
42
|
+
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
|
|
43
|
+
}
|
|
44
|
+
if (this.trigger && this.tooltip) {
|
|
45
|
+
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
46
|
+
}
|
|
47
|
+
if (isTouchScreen) {
|
|
48
|
+
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
49
|
+
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
(_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('focusin', this.showListener.bind(this));
|
|
53
|
+
(_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('focusout', this.hideListener.bind(this));
|
|
54
|
+
(_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('mouseenter', this.showListener.bind(this));
|
|
55
|
+
(_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('mouseleave', this.hideListener.bind(this));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
disconnectedCallback() {
|
|
59
|
+
var _a, _b, _c, _d, _e, _f;
|
|
60
|
+
if (isTouchScreen) {
|
|
61
|
+
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
|
|
62
|
+
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseenter', this.showListener.bind(this));
|
|
66
|
+
(_d = this.trigger) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseleave', this.hideListener.bind(this));
|
|
67
|
+
(_e = this.trigger) === null || _e === void 0 ? void 0 : _e.removeEventListener('focusin', this.showListener.bind(this));
|
|
68
|
+
(_f = this.trigger) === null || _f === void 0 ? void 0 : _f.removeEventListener('focusout', this.hideListener.bind(this));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return (h(Host, null,
|
|
73
|
+
h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" },
|
|
74
|
+
h("slot", null)),
|
|
75
|
+
this.content && !this.disabled && (h("div", { ref: el => (this.tooltip = el), id: this.id, class: "tooltip" }, this.content))));
|
|
76
|
+
}
|
|
77
|
+
get isTabbable() {
|
|
78
|
+
return firstTabbable(this.trigger);
|
|
79
|
+
}
|
|
80
|
+
update() {
|
|
81
|
+
if (this.trigger && this.tooltip) {
|
|
82
|
+
computePosition(this.trigger, this.tooltip, {
|
|
83
|
+
placement: this.placement,
|
|
84
|
+
middleware: [offset(CatTooltip.OFFSET), flip()]
|
|
85
|
+
}).then(({ x, y }) => {
|
|
86
|
+
if (this.tooltip) {
|
|
87
|
+
Object.assign(this.tooltip.style, {
|
|
88
|
+
left: `${Math.max(0, x)}px`,
|
|
89
|
+
top: `${y}px`
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
showListener() {
|
|
96
|
+
window.clearTimeout(this.hideTimeout);
|
|
97
|
+
this.showTimeout = window.setTimeout(() => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.focus();
|
|
100
|
+
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
|
|
101
|
+
}, this.showDelay);
|
|
102
|
+
}
|
|
103
|
+
hideListener() {
|
|
104
|
+
window.clearTimeout(this.showTimeout);
|
|
105
|
+
this.hideTimeout = window.setTimeout(() => {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.blur();
|
|
108
|
+
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
|
|
109
|
+
}, this.hideDelay);
|
|
110
|
+
}
|
|
111
|
+
touchStartListener() {
|
|
112
|
+
this.touchTimeout = window.setTimeout(() => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
115
|
+
}, this.longTouchDuration);
|
|
116
|
+
}
|
|
117
|
+
touchEndListener() {
|
|
118
|
+
var _a;
|
|
119
|
+
window.clearTimeout(this.touchTimeout);
|
|
120
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
121
|
+
}
|
|
122
|
+
static get is() { return "cat-tooltip"; }
|
|
123
|
+
static get encapsulation() { return "shadow"; }
|
|
124
|
+
static get originalStyleUrls() { return {
|
|
125
|
+
"$": ["cat-tooltip.scss"]
|
|
126
|
+
}; }
|
|
127
|
+
static get styleUrls() { return {
|
|
128
|
+
"$": ["cat-tooltip.css"]
|
|
129
|
+
}; }
|
|
130
|
+
static get properties() { return {
|
|
131
|
+
"content": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "string",
|
|
136
|
+
"resolved": "string",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": "The content of the tooltip."
|
|
144
|
+
},
|
|
145
|
+
"attribute": "content",
|
|
146
|
+
"reflect": false,
|
|
147
|
+
"defaultValue": "''"
|
|
148
|
+
},
|
|
149
|
+
"disabled": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\nand invisible. Corresponds with the native HTML disabled attribute."
|
|
162
|
+
},
|
|
163
|
+
"attribute": "disabled",
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"defaultValue": "false"
|
|
166
|
+
},
|
|
167
|
+
"placement": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "Placement",
|
|
172
|
+
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
173
|
+
"references": {
|
|
174
|
+
"Placement": {
|
|
175
|
+
"location": "import",
|
|
176
|
+
"path": "@floating-ui/dom"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": "The placement of the tooltip."
|
|
185
|
+
},
|
|
186
|
+
"attribute": "placement",
|
|
187
|
+
"reflect": false,
|
|
188
|
+
"defaultValue": "'top'"
|
|
189
|
+
},
|
|
190
|
+
"showDelay": {
|
|
191
|
+
"type": "number",
|
|
192
|
+
"mutable": false,
|
|
193
|
+
"complexType": {
|
|
194
|
+
"original": "number",
|
|
195
|
+
"resolved": "number",
|
|
196
|
+
"references": {}
|
|
197
|
+
},
|
|
198
|
+
"required": false,
|
|
199
|
+
"optional": false,
|
|
200
|
+
"docs": {
|
|
201
|
+
"tags": [],
|
|
202
|
+
"text": "The delay time for showing tooltip in ms."
|
|
203
|
+
},
|
|
204
|
+
"attribute": "show-delay",
|
|
205
|
+
"reflect": false,
|
|
206
|
+
"defaultValue": "500"
|
|
207
|
+
},
|
|
208
|
+
"hideDelay": {
|
|
209
|
+
"type": "number",
|
|
210
|
+
"mutable": false,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "number",
|
|
213
|
+
"resolved": "number",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": false,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": "The delay time for hiding tooltip in ms."
|
|
221
|
+
},
|
|
222
|
+
"attribute": "hide-delay",
|
|
223
|
+
"reflect": false,
|
|
224
|
+
"defaultValue": "0"
|
|
225
|
+
},
|
|
226
|
+
"longTouchDuration": {
|
|
227
|
+
"type": "number",
|
|
228
|
+
"mutable": false,
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "number",
|
|
231
|
+
"resolved": "number",
|
|
232
|
+
"references": {}
|
|
233
|
+
},
|
|
234
|
+
"required": false,
|
|
235
|
+
"optional": false,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": "The duration of tap to show the tooltip."
|
|
239
|
+
},
|
|
240
|
+
"attribute": "long-touch-duration",
|
|
241
|
+
"reflect": false,
|
|
242
|
+
"defaultValue": "1000"
|
|
243
|
+
}
|
|
244
|
+
}; }
|
|
245
|
+
static get listeners() { return [{
|
|
246
|
+
"name": "keydown",
|
|
247
|
+
"method": "handleKeyDown",
|
|
248
|
+
"target": undefined,
|
|
249
|
+
"capture": false,
|
|
250
|
+
"passive": false
|
|
251
|
+
}]; }
|
|
252
|
+
}
|
|
253
|
+
CatTooltip.OFFSET = 4;
|
|
254
|
+
//# sourceMappingURL=cat-tooltip.js.map
|