@kaizen/components 0.0.0-canary-versioned-tooltip-poc-20240619013415 → 0.0.0-canary-tooltip-poc-20240621045645
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/cjs/KaizenProvider/KaizenProvider.cjs +4 -1
- package/dist/cjs/reactAriaComponentsV3.cjs +11 -0
- package/dist/cjs/reactAriaV3.cjs +11 -0
- package/dist/esm/KaizenProvider/KaizenProvider.mjs +4 -1
- package/dist/esm/reactAriaComponentsV3.mjs +1 -0
- package/dist/esm/reactAriaV3.mjs +1 -0
- package/dist/styles.css +2 -2
- package/dist/types/__overlays__/Tooltip/v3/Tooltip.d.ts +10 -0
- package/dist/types/__react-aria-components__/index.d.ts +1 -0
- package/dist/types/__react-aria__/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/KaizenProvider/KaizenProvider.tsx +3 -2
- package/src/__overlays__/Tooltip/v2/_docs/Tooltip.mdx +2 -7
- package/src/__overlays__/Tooltip/v3/OverlayArrow.module.scss +16 -0
- package/src/__overlays__/Tooltip/v3/Tooltip.module.scss +1 -1
- package/src/__overlays__/Tooltip/v3/Tooltip.tsx +17 -0
- package/src/__overlays__/Tooltip/v3/_docs/API.mdx +55 -0
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.docs.stories.tsx +158 -0
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.mdx +135 -15
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.spec.stories.tsx +275 -0
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.stickersheet.stories.tsx +27 -49
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.stories.tsx +14 -248
- package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_anatomy.png +0 -0
- package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_variants.png +0 -0
- package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_when_to_use.png +0 -0
- package/src/__react-aria-components__/index.ts +1 -0
- package/src/__react-aria__/index.ts +1 -0
- package/v3/react-aria/package.json +5 -0
- package/v3/react-aria-components/package.json +5 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var reactAria = require('react-aria');
|
|
4
5
|
require('../Notification/InlineNotification/InlineNotification.cjs');
|
|
5
6
|
require('../Notification/GlobalNotification/GlobalNotification.cjs');
|
|
6
7
|
require('../Notification/ToastNotification/ToastNotification/ToastNotification.cjs');
|
|
@@ -34,7 +35,9 @@ var KaizenProvider = function (_a) {
|
|
|
34
35
|
}, [documentIsAvailable]);
|
|
35
36
|
return React__default.default.createElement(OptionalIntlProvider.OptionalIntlProvider, {
|
|
36
37
|
locale: locale
|
|
37
|
-
}, React__default.default.createElement(
|
|
38
|
+
}, React__default.default.createElement(reactAria.I18nProvider, {
|
|
39
|
+
locale: locale
|
|
40
|
+
}, React__default.default.createElement(ToastNotificationContext.ToastNotificationProvider, null, notificationsList, children), React__default.default.createElement(FontDefinitions.FontDefinitions, null)));
|
|
38
41
|
};
|
|
39
42
|
KaizenProvider.displayName = "KaizenProvider";
|
|
40
43
|
exports.KaizenProvider = KaizenProvider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactAriaComponents = require('react-aria-components');
|
|
4
|
+
Object.keys(reactAriaComponents).forEach(function (k) {
|
|
5
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return reactAriaComponents[k];
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactAria = require('react-aria');
|
|
4
|
+
Object.keys(reactAria).forEach(function (k) {
|
|
5
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return reactAria[k];
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { I18nProvider } from 'react-aria';
|
|
2
3
|
import '../Notification/InlineNotification/InlineNotification.mjs';
|
|
3
4
|
import '../Notification/GlobalNotification/GlobalNotification.mjs';
|
|
4
5
|
import '../Notification/ToastNotification/ToastNotification/ToastNotification.mjs';
|
|
@@ -27,7 +28,9 @@ const KaizenProvider = /*#__PURE__*/function () {
|
|
|
27
28
|
}, [documentIsAvailable]);
|
|
28
29
|
return /*#__PURE__*/React.createElement(OptionalIntlProvider, {
|
|
29
30
|
locale: locale
|
|
30
|
-
}, /*#__PURE__*/React.createElement(
|
|
31
|
+
}, /*#__PURE__*/React.createElement(I18nProvider, {
|
|
32
|
+
locale: locale
|
|
33
|
+
}, /*#__PURE__*/React.createElement(ToastNotificationProvider, null, notificationsList, children), /*#__PURE__*/React.createElement(FontDefinitions, null)));
|
|
31
34
|
};
|
|
32
35
|
KaizenProvider.displayName = "KaizenProvider";
|
|
33
36
|
return KaizenProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria-components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria';
|
package/dist/styles.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@layer tokens, normalize, reset;@layer tokens{:root{--theme-key:heart;--animation-easing-function-ease-in-out:cubic-bezier(0.455,0.03,0.515,0.955);--animation-easing-function-ease-in:cubic-bezier(0.55,0.085,0.68,0.53);--animation-easing-function-ease-out:cubic-bezier(0.25,0.46,0.45,0.94);--animation-easing-function-linear:linear;--animation-easing-function-bounce-in:cubic-bezier(0.485,0.155,0.24,1.245);--animation-easing-function-bounce-out:cubic-bezier(0.485,0.155,0.515,0.845);--animation-easing-function-bounce-in-out:cubic-bezier(0.76,-0.245,0.24,1.245);--animation-duration-instant:0ms;--animation-duration-immediate:100ms;--animation-duration-rapid:200ms;--animation-duration-fast:300ms;--animation-duration-slow:400ms;--animation-duration-deliberate:700ms;--border-solid-border-width:2px;--border-solid-border-radius:7px;--border-solid-border-style:solid;--border-solid-border-color:#e1e2ea;--border-solid-border-color-rgb:225,226,234;--border-dashed-border-width:2px;--border-dashed-border-radius:7px;--border-dashed-border-style:dashed;--border-borderless-border-width:2px;--border-borderless-border-radius:7px;--border-borderless-border-style:solid;--border-borderless-border-color:transparent;--border-borderless-border-color-rgb:0,0,0;--border-focus-ring-border-width:2px;--border-focus-ring-border-radius:10px;--border-focus-ring-border-style:solid;--color-purple-100:#f4edf8;--color-purple-100-rgb:244,237,248;--color-purple-200:#dfc9ea;--color-purple-200-rgb:223,201,234;--color-purple-300:#c9a5dd;--color-purple-300-rgb:201,165,221;--color-purple-400:#ae67b1;--color-purple-400-rgb:174,103,177;--color-purple-500:#844587;--color-purple-500-rgb:132,69,135;--color-purple-600:#5f3361;--color-purple-600-rgb:95,51,97;--color-purple-700:#4a234d;--color-purple-700-rgb:74,35,77;--color-purple-800:#2f2438;--color-purple-800-rgb:47,36,56;--color-blue-100:#e6f6ff;--color-blue-100-rgb:230,246,255;--color-blue-200:#bde2f5;--color-blue-200-rgb:189,226,245;--color-blue-300:#73c0e8;--color-blue-300-rgb:115,192,232;--color-blue-400:#008bd6;--color-blue-400-rgb:0,139,214;--color-blue-500:#0168b3;--color-blue-500-rgb:1,104,179;--color-blue-600:#004970;--color-blue-600-rgb:0,73,112;--color-blue-700:#003157;--color-blue-700-rgb:0,49,87;--color-green-100:#e8f8f4;--color-green-100-rgb:232,248,244;--color-green-200:#c4ede2;--color-green-200-rgb:196,237,226;--color-green-300:#8fdbc7;--color-green-300-rgb:143,219,199;--color-green-400:#5dcaad;--color-green-400-rgb:93,202,173;--color-green-500:#44a289;--color-green-500-rgb:68,162,137;--color-green-600:#2c7d67;--color-green-600-rgb:44,125,103;--color-green-700:#22594a;--color-green-700-rgb:34,89,74;--color-yellow-100:#fff9e4;--color-yellow-100-rgb:255,249,228;--color-yellow-200:#ffeeb3;--color-yellow-200-rgb:255,238,179;--color-yellow-300:#ffe36e;--color-yellow-300-rgb:255,227,110;--color-yellow-400:#ffca4d;--color-yellow-400-rgb:255,202,77;--color-yellow-500:#ffb600;--color-yellow-500-rgb:255,182,0;--color-yellow-600:#c68600;--color-yellow-600-rgb:198,134,0;--color-yellow-700:#876400;--color-yellow-700-rgb:135,100,0;--color-red-100:#fdeaee;--color-red-100-rgb:253,234,238;--color-red-200:#f9c2cb;--color-red-200-rgb:249,194,203;--color-red-300:#f597a8;--color-red-300-rgb:245,151,168;--color-red-400:#e0707d;--color-red-400-rgb:224,112,125;--color-red-500:#c93b55;--color-red-500-rgb:201,59,85;--color-red-600:#a82433;--color-red-600-rgb:168,36,51;--color-red-700:#6c1e20;--color-red-700-rgb:108,30,32;--color-orange-100:#fff0e8;--color-orange-100-rgb:255,240,232;--color-orange-200:#ffd1b9;--color-orange-200-rgb:255,209,185;--color-orange-300:#ffb08a;--color-orange-300-rgb:255,176,138;--color-orange-400:#ff9461;--color-orange-400-rgb:255,148,97;--color-orange-500:#e96c2f;--color-orange-500-rgb:233,108,47;--color-orange-600:#b74302;--color-orange-600-rgb:183,67,2;--color-orange-700:#903c00;--color-orange-700-rgb:144,60,0;--color-gray-100:#f9f9f9;--color-gray-100-rgb:249,249,249;--color-gray-200:#f4f4f5;--color-gray-200-rgb:244,244,245;--color-gray-300:#eaeaec;--color-gray-300-rgb:234,234,236;--color-gray-400:#cdcdd0;--color-gray-400-rgb:205,205,208;--color-gray-500:#878792;--color-gray-500-rgb:135,135,146;--color-gray-600:#524e56;--color-gray-600-rgb:82,78,86;--color-white:#fff;--color-white-rgb:255,255,255;--data-viz-favorable:#7dd5bd;--data-viz-favorable-rgb:125,213,189;--data-viz-unfavorable:#e68d97;--data-viz-unfavorable-rgb:230,141,151;--layout-content-max-width:1392px;--layout-content-max-width-with-sidebar:1080px;--layout-content-side-margin:72px;--layout-mobile-actions-drawer-height:60px;--layout-navigation-bar-height:72px;--layout-breakpoints-medium:768px;--layout-breakpoints-large:1080px;--shadow-small-box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06);--shadow-large-box-shadow:0 3px 9px 0 rgba(0,0,0,.1),0 8px 40px 0 rgba(0,0,0,.08);--spacing-0:0;--spacing-1:.0625rem;--spacing-2:.125rem;--spacing-4:.25rem;--spacing-6:.375rem;--spacing-8:.5rem;--spacing-12:.75rem;--spacing-16:1rem;--spacing-24:1.5rem;--spacing-32:2rem;--spacing-40:2.5rem;--spacing-48:3rem;--spacing-56:3.5rem;--spacing-64:4rem;--spacing-72:4.5rem;--spacing-80:5rem;--spacing-96:6rem;--spacing-112:7rem;--spacing-128:8rem;--spacing-160:10rem;--spacing-200:12.5rem;--spacing-240:15rem;--spacing-280:17.5rem;--spacing-320:20rem;--spacing-xs:0.375rem;--spacing-sm:0.75rem;--spacing-md:1.5rem;--spacing-lg:2.25rem;--spacing-xl:3rem;--spacing-xxl:3.75rem;--spacing-xxxl:4.5rem;--spacing-xxxxl:5.25rem;--spacing-xxxxxl:6rem;--typography-data-large-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-large-font-weight:700;--typography-data-large-font-size:5.25rem;--typography-data-large-line-height:5.25rem;--typography-data-large-letter-spacing:normal;--typography-data-large-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-large-units-font-weight:700;--typography-data-large-units-font-size:2.625rem;--typography-data-large-units-line-height:5.25rem;--typography-data-large-units-letter-spacing:normal;--typography-data-medium-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-medium-font-weight:700;--typography-data-medium-font-size:3rem;--typography-data-medium-line-height:5rem;--typography-data-medium-letter-spacing:normal;--typography-data-medium-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-medium-units-font-weight:700;--typography-data-medium-units-font-size:1.5rem;--typography-data-medium-units-line-height:5rem;--typography-data-medium-units-letter-spacing:normal;--typography-data-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-small-font-weight:700;--typography-data-small-font-size:1.5rem;--typography-data-small-line-height:1.5rem;--typography-data-small-letter-spacing:normal;--typography-data-small-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-small-units-font-weight:700;--typography-data-small-units-font-size:1.125rem;--typography-data-small-units-line-height:1.5rem;--typography-data-small-units-letter-spacing:normal;--typography-display-0-font-family:"Tiempos Headline",Georgia,serif;--typography-display-0-font-weight:800;--typography-display-0-font-size:4.5rem;--typography-display-0-line-height:5.25rem;--typography-display-0-letter-spacing:0em;--typography-heading-1-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-1-font-weight:700;--typography-heading-1-font-size:2.125rem;--typography-heading-1-line-height:2.625rem;--typography-heading-1-letter-spacing:normal;--typography-heading-2-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-2-font-weight:700;--typography-heading-2-font-size:1.75rem;--typography-heading-2-line-height:2.25rem;--typography-heading-2-letter-spacing:normal;--typography-heading-3-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-3-font-weight:700;--typography-heading-3-font-size:1.375rem;--typography-heading-3-line-height:1.875rem;--typography-heading-3-letter-spacing:normal;--typography-heading-4-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-4-font-weight:600;--typography-heading-4-font-size:1.125rem;--typography-heading-4-line-height:1.5rem;--typography-heading-4-letter-spacing:normal;--typography-heading-5-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-5-font-weight:600;--typography-heading-5-font-size:1rem;--typography-heading-5-line-height:1.5rem;--typography-heading-5-letter-spacing:normal;--typography-heading-6-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-6-font-weight:700;--typography-heading-6-font-size:0.875rem;--typography-heading-6-line-height:1.5rem;--typography-heading-6-letter-spacing:normal;--typography-paragraph-intro-lede-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-intro-lede-font-weight:400;--typography-paragraph-intro-lede-font-size:1.25rem;--typography-paragraph-intro-lede-line-height:1.875rem;--typography-paragraph-intro-lede-letter-spacing:0;--typography-paragraph-intro-lede-max-width:975px;--typography-paragraph-body-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-body-font-weight:400;--typography-paragraph-body-font-size:1rem;--typography-paragraph-body-line-height:1.5rem;--typography-paragraph-body-letter-spacing:normal;--typography-paragraph-body-max-width:780px;--typography-paragraph-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-small-font-weight:400;--typography-paragraph-small-font-size:0.875rem;--typography-paragraph-small-line-height:1.125rem;--typography-paragraph-small-letter-spacing:normal;--typography-paragraph-small-max-width:680px;--typography-paragraph-extra-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-extra-small-font-weight:400;--typography-paragraph-extra-small-font-size:0.75rem;--typography-paragraph-extra-small-line-height:1.125rem;--typography-paragraph-extra-small-letter-spacing:normal;--typography-paragraph-extra-small-max-width:600px;--typography-paragraph-bold-font-weight:600;--typography-button-primary-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-button-primary-font-weight:700;--typography-button-primary-font-size:1.125rem;--typography-button-primary-line-height:1.5rem;--typography-button-primary-letter-spacing:normal;--typography-button-secondary-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-button-secondary-font-weight:500;--typography-button-secondary-font-size:1rem;--typography-button-secondary-line-height:1.5rem;--typography-button-secondary-letter-spacing:normal}}@layer normalize{html{-webkit-text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}}@layer reset{@font-face{font-family:Tiempos Headline;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-bold.woff)}@font-face{font-family:Greycliff CF;font-weight:300;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-light.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:400;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-regular.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:500;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-medium.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:600;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-demi-bold.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:700;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-bold.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-extra-bold.woff) format("woff")}@font-face{font-family:Inter;font-weight:300;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-light.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-light.woff)}@font-face{font-family:Inter;font-weight:400;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-regular.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-regular.woff)}@font-face{font-family:Inter;font-weight:500;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-medium.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-medium.woff)}@font-face{font-family:Inter;font-weight:600;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-demi-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-demi-bold.woff)}@font-face{font-family:Inter;font-weight:700;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-bold.woff)}@font-face{font-family:Inter;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-extra-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-extra-bold.woff)}@font-face{font-family:IBM Plex Mono;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/ibm-plex-mono/ibm-plex-mono-regular.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/ibm-plex-mono/ibm-plex-mono-regular.woff)}}@layer reset{*,:after,:before{border-color:var(--border-solid-border-color,"currentColor");border-style:solid;border-width:0}}
|
|
2
|
-
.OverlayArrow-module_overlayArrow__hoDyK{display:flex}.OverlayArrow-module_overlayArrow__hoDyK path{fill:var(--color-purple-800,#2f2438);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06))}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg{transform:rotate(90deg)}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg{transform:rotate(180deg)}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg{transform:rotate(270deg)}.OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path{fill:var(--color-white,#fff)}
|
|
2
|
+
.OverlayArrow-module_overlayArrow__hoDyK{display:flex;padding:8px}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom],.OverlayArrow-module_overlayArrow__hoDyK[data-placement=top]{padding:0 8px}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left],.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right]{padding:8px 0}.OverlayArrow-module_overlayArrow__hoDyK path{fill:var(--color-purple-800,#2f2438);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06))}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg{transform:rotate(90deg)}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg{transform:rotate(180deg)}.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg{transform:rotate(270deg)}.OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path{fill:var(--color-white,#fff)}
|
|
3
3
|
.Focusable-module_focusableWrapper__TCysR{display:inline-flex}
|
|
4
|
-
.Tooltip-module_tooltip__efL1m{text-wrap:
|
|
4
|
+
.Tooltip-module_tooltip__efL1m{text-wrap:pretty;background-color:var(--color-purple-800,#2f2438);border-radius:var(--border-solid-border-radius,7px);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06));color:var(--color-white,#fff);font-family:var(--typography-paragraph-extra-small-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:var(--typography-paragraph-extra-small-font-size,.75rem);font-weight:var(--typography-paragraph-extra-small-font-weight,400);letter-spacing:var(--typography-paragraph-extra-small-letter-spacing,normal);line-height:var(--typography-paragraph-extra-small-line-height,1.125rem);max-width:200px;padding:var(--spacing-8,.5rem) var(--spacing-12,.75rem);text-align:center;transform:translateZ(0)}.Tooltip-module_tooltip__efL1m.Tooltip-module_reversed__NnCbZ{background-color:var(--color-white,#fff);color:var(--color-purple-800,#2f2438)}.Tooltip-module_tooltip__efL1m[data-placement=top]{--origin:translateY(4px)}.Tooltip-module_tooltip__efL1m[data-placement=bottom]{--origin:translateY(-4px)}.Tooltip-module_tooltip__efL1m[data-placement=right]{--origin:translateX(-4px)}.Tooltip-module_tooltip__efL1m[data-placement=left]{--origin:translateX(4px)}.Tooltip-module_tooltip__efL1m[data-entering]{animation:Tooltip-module_slide__lFdGA var(--animation-duration-fast,.3s)}.Tooltip-module_tooltip__efL1m[data-exiting]{animation:Tooltip-module_slide__lFdGA var(--animation-duration-fast,.3s) reverse var(--animation-easing-function-ease-in,cubic-bezier(.55,.085,.68,.53))}@keyframes Tooltip-module_slide__lFdGA{0%{opacity:0;transform:var(--origin)}to{opacity:1;transform:translateY(0)}}
|
|
5
5
|
.ToggleTip-module_toggleTip__IrY8Y{align-items:center;appearance:none;background:transparent;border:none;color:inherit;display:inline;display:inline-flex;font:inherit;justify-content:center;margin:0;min-height:1.5rem;min-width:1.5rem;padding:0}
|
|
6
6
|
.SVG-module_icon__8J5Ev{display:inline-block;height:20px;width:20px}.SVG-module_icon__8J5Ev>use{pointer-events:none}@media screen and (-ms-high-contrast:active){.SVG-module_icon__8J5Ev{color:#000}}@media screen and (-ms-high-contrast:white-on-black){.SVG-module_icon__8J5Ev{color:#fff}}@media screen and (-ms-high-contrast:black-on-white){.SVG-module_icon__8J5Ev{color:#000}}.SVG-module_inheritSize__Q8iam{display:block;height:inherit;width:inherit}
|
|
7
7
|
.Avatar-module_wrapper__LY2q2{align-items:center;background:var(--color-gray-300,#eaeaec);border-radius:100%;box-sizing:border-box;display:flex;justify-content:center;overflow:hidden}.Avatar-module_wrapper__LY2q2:not(.Avatar-module_small__PeksS){border:3px solid var(--color-white,#fff);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06))}.Avatar-module_wrapper__LY2q2.Avatar-module_personal__2U7--{background:var(--color-orange-100,#fff0e8)}.Avatar-module_wrapper__LY2q2.Avatar-module_otherUser__b-drl{background:var(--color-gray-300,#eaeaec)}.Avatar-module_wrapper__LY2q2.Avatar-module_company__2qtJE{background:var(--color-white,#fff);border:0;border-radius:var(--border-solid-border-radius,7px);padding:6px}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS{height:1.25rem;width:1.25rem}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{margin-bottom:-1px}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS.Avatar-module_company__2qtJE{padding:0}.Avatar-module_wrapper__LY2q2.Avatar-module_medium__Vy3V8{height:3rem;width:3rem}.Avatar-module_wrapper__LY2q2.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q{margin-bottom:-1px}.Avatar-module_wrapper__LY2q2.Avatar-module_large__qiNWs{height:4.5rem;width:4.5rem}.Avatar-module_wrapper__LY2q2.Avatar-module_xlarge__Vx4IG{height:6rem;width:6rem}.Avatar-module_wrapper__LY2q2.Avatar-module_xxlarge__oOoGq{height:7.75rem;width:7.75rem}.Avatar-module_wrapper__LY2q2 .Avatar-module_initials__VDY2Q{speak-as:spell-out;border-bottom:none;text-decoration:none}.Avatar-module_avatarImage__FuULy{height:100%;object-fit:cover;width:100%}.Avatar-module_loading__i9V-D .Avatar-module_avatarImage__FuULy{display:none}.Avatar-module_companyAvatarImage__7rlfG{border-radius:4px;box-sizing:border-box;object-fit:contain}.Avatar-module_fallbackIcon__MPWxq{color:rgba(var(--color-purple-800-rgb,47,36,56),.7);width:28px}.Avatar-module_xxlarge__oOoGq .Avatar-module_fallbackIcon__MPWxq{width:75px}.Avatar-module_xlarge__Vx4IG .Avatar-module_fallbackIcon__MPWxq{width:60px}.Avatar-module_large__qiNWs .Avatar-module_fallbackIcon__MPWxq{width:35px}.Avatar-module_medium__Vy3V8 .Avatar-module_fallbackIcon__MPWxq{margin-bottom:-1px;width:25px}.Avatar-module_small__PeksS .Avatar-module_fallbackIcon__MPWxq{margin-bottom:-1px;width:10px}.Avatar-module_initials__VDY2Q{box-sizing:border-box;color:var(--color-purple-800,#2f2438);font-family:var(--typography-heading-1-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:22px;font-weight:var(--typography-heading-1-font-weight,700);letter-spacing:var(--typography-heading-3-letter-spacing,normal);padding-left:5px;padding-right:5px;text-align:center;width:100%}.Avatar-module_initials__VDY2Q:not(.Avatar-module_longName__31Yuf):before{content:"";display:block;margin-top:-.001em}.Avatar-module_xlarge__Vx4IG .Avatar-module_initials__VDY2Q,.Avatar-module_xxlarge__oOoGq .Avatar-module_initials__VDY2Q{font-size:34px;letter-spacing:var(--typography-heading-1-letter-spacing,normal)}.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q{font-size:16px}.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q,.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{font-weight:var(--typography-heading-5-font-weight,600);letter-spacing:var(--typography-heading-5-letter-spacing,normal)}.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{font-size:8px}
|
|
@@ -8,6 +8,11 @@ export type TooltipProps = Omit<RACTooltipProps, "offset"> & {
|
|
|
8
8
|
* @default 8
|
|
9
9
|
*/
|
|
10
10
|
offset?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The placement of the tooltip relative to the trigger.
|
|
13
|
+
* + we're intentionally limiting the placement options to rtl friendly ones (start, end, top, bottom)
|
|
14
|
+
*/
|
|
15
|
+
placement?: "bottom" | "bottom start" | "bottom end" | "top" | "top start" | "top end" | "start" | "start top" | "start bottom" | "end" | "end top" | "end bottom";
|
|
11
16
|
};
|
|
12
17
|
/**
|
|
13
18
|
* A tooltip displays a description of an element on hover or focus.
|
|
@@ -19,4 +24,9 @@ export declare const Tooltip: React.ForwardRefExoticComponent<Omit<RACTooltipPro
|
|
|
19
24
|
* @default 8
|
|
20
25
|
*/
|
|
21
26
|
offset?: number | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The placement of the tooltip relative to the trigger.
|
|
29
|
+
* + we're intentionally limiting the placement options to rtl friendly ones (start, end, top, bottom)
|
|
30
|
+
*/
|
|
31
|
+
placement?: "end" | "start" | "bottom" | "top" | "bottom start" | "bottom end" | "top start" | "top end" | "start top" | "start bottom" | "end top" | "end bottom" | undefined;
|
|
22
32
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-aria-components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-aria";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-tooltip-poc-20240621045645",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
|
+
import { I18nProvider } from "react-aria"
|
|
2
3
|
import { ToastNotificationsList } from "~components/Notification"
|
|
3
4
|
import { ToastNotificationProvider } from "~components/Notification/ToastNotification/context/ToastNotificationContext"
|
|
4
5
|
import { FontDefinitions } from "./subcomponents/FontDefinitions"
|
|
@@ -27,13 +28,13 @@ export const KaizenProvider = ({
|
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
30
|
<OptionalIntlProvider locale={locale}>
|
|
30
|
-
|
|
31
|
+
<I18nProvider locale={locale}>
|
|
31
32
|
<ToastNotificationProvider>
|
|
32
33
|
{notificationsList}
|
|
33
34
|
{children}
|
|
34
35
|
</ToastNotificationProvider>
|
|
35
36
|
<FontDefinitions />
|
|
36
|
-
|
|
37
|
+
</I18nProvider>
|
|
37
38
|
</OptionalIntlProvider>
|
|
38
39
|
)
|
|
39
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Canvas, Controls, Meta } from "@storybook/blocks"
|
|
2
|
-
import { ResourceLinks,
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from "~storybook/components"
|
|
3
3
|
import * as TooltipStories from "./Tooltip.stories"
|
|
4
4
|
|
|
5
5
|
<Meta of={TooltipStories} />
|
|
@@ -9,14 +9,9 @@ import * as TooltipStories from "./Tooltip.stories"
|
|
|
9
9
|
<ResourceLinks
|
|
10
10
|
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
|
|
11
11
|
figma="https://www.figma.com/file/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-UI-Kit%3A-Heart?type=design&node-id=1929%3A32006&mode=design&t=LwTCBZ5E1uRvOA1l-1"
|
|
12
|
-
designGuidelines="https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3075604978/Tooltip"
|
|
13
|
-
className="!mb-8"
|
|
14
12
|
/>
|
|
15
13
|
|
|
16
|
-
<
|
|
17
|
-
installCommand="pnpm add @kaizen/components"
|
|
18
|
-
importStatement='import { Tooltip } from "@kaizen/components/v2/overlays"'
|
|
19
|
-
/>
|
|
14
|
+
<KAIOInstallation exportNames="Tooltip" family="overlays" version="2" />
|
|
20
15
|
|
|
21
16
|
## Overview
|
|
22
17
|
|
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
.overlayArrow {
|
|
5
5
|
display: flex;
|
|
6
6
|
|
|
7
|
+
// for correct arrow positioning with rounded corners we need to do bit trickery here
|
|
8
|
+
// the positioning is done in js in RAC and works by first getting size of arrow without data-placement, and isn't recomputed after update
|
|
9
|
+
// so we first set padding on arrow from all sides (that'll be used for start position computation)
|
|
10
|
+
// and then we remove it from the oposite axis
|
|
11
|
+
padding: 8px;
|
|
12
|
+
|
|
13
|
+
&[data-placement="top"],
|
|
14
|
+
&[data-placement="bottom"] {
|
|
15
|
+
padding: 0 8px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&[data-placement="left"],
|
|
19
|
+
&[data-placement="right"] {
|
|
20
|
+
padding: 8px 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
path {
|
|
8
24
|
fill: $color-purple-800;
|
|
9
25
|
box-shadow: $shadow-small-box-shadow;
|
|
@@ -21,6 +21,23 @@ export type TooltipProps = Omit<RACTooltipProps, "offset"> & {
|
|
|
21
21
|
* @default 8
|
|
22
22
|
*/
|
|
23
23
|
offset?: number
|
|
24
|
+
/**
|
|
25
|
+
* The placement of the tooltip relative to the trigger.
|
|
26
|
+
* + we're intentionally limiting the placement options to rtl friendly ones (start, end, top, bottom)
|
|
27
|
+
*/
|
|
28
|
+
placement?:
|
|
29
|
+
| "bottom"
|
|
30
|
+
| "bottom start"
|
|
31
|
+
| "bottom end"
|
|
32
|
+
| "top"
|
|
33
|
+
| "top start"
|
|
34
|
+
| "top end"
|
|
35
|
+
| "start"
|
|
36
|
+
| "start top"
|
|
37
|
+
| "start bottom"
|
|
38
|
+
| "end"
|
|
39
|
+
| "end top"
|
|
40
|
+
| "end bottom"
|
|
24
41
|
}
|
|
25
42
|
|
|
26
43
|
/**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Canvas, Controls, Meta } from "@storybook/blocks"
|
|
2
|
+
import { KAIOInstallation, ResourceLinks, SbText } from "~storybook/components"
|
|
3
|
+
import * as docStories from "./Tooltip.docs.stories"
|
|
4
|
+
import * as exampleStories from "./Tooltip.stories"
|
|
5
|
+
|
|
6
|
+
<Meta title="Overlays/Tooltip/v3/API Specification" />
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Tooltip API specifications (v3)
|
|
10
|
+
<SbText variant="extra-small">
|
|
11
|
+
Updated June X, 2024
|
|
12
|
+
</SbText>
|
|
13
|
+
|
|
14
|
+
<ResourceLinks
|
|
15
|
+
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
|
|
16
|
+
figma="https://www.figma.com/file/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-UI-Kit%3A-Heart?type=design&node-id=1929%3A32006&mode=design&t=LwTCBZ5E1uRvOA1l-1"
|
|
17
|
+
designGuidelines="/?path=/docs/overlays-tooltip-v3-usage-guidelines--docs"
|
|
18
|
+
className="!mb-8"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<KAIOInstallation exportNames="Tooltip" family="overlays" version="3" />
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
Tooltips are brief floating labels used to add additional contextual information when users hover, click or focus on an interactive element.
|
|
27
|
+
|
|
28
|
+
This component is built on top of [React Aria's Tooltip](https://react-spectrum.adobe.com/react-aria/Tooltip.html) and share similar [anatomy](https://react-spectrum.adobe.com/react-aria/Tooltip.html#anatomy) and functionality.
|
|
29
|
+
|
|
30
|
+
<Canvas of={exampleStories.OnButton} />
|
|
31
|
+
<Controls of={exampleStories.OnButton} />
|
|
32
|
+
|
|
33
|
+
### triggerRef
|
|
34
|
+
Notes on the `triggerRef`
|
|
35
|
+
|
|
36
|
+
### Placement
|
|
37
|
+
Notes on placement with examples, include `shouldFlip` and `offset`
|
|
38
|
+
|
|
39
|
+
<Canvas of={docStories.Placement} />
|
|
40
|
+
|
|
41
|
+
### Controlled state
|
|
42
|
+
Notes on the controlled states vs out of the box
|
|
43
|
+
|
|
44
|
+
### ToggleTip
|
|
45
|
+
|
|
46
|
+
<Canvas of={exampleStories.ToggleTip} />
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
Here are examples of how to use the Tooltip with compatible Kaizen components.
|
|
51
|
+
|
|
52
|
+
### On Button
|
|
53
|
+
|
|
54
|
+
<Canvas of={exampleStories.OnButton} />
|
|
55
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import isChromatic from "chromatic"
|
|
4
|
+
import { Button, IconButton } from "~components/Button"
|
|
5
|
+
import { FieldMessage } from "~components/FieldMessage"
|
|
6
|
+
import { AddIcon, QuestionIcon } from "~components/Icon"
|
|
7
|
+
import { Input } from "~components/Input"
|
|
8
|
+
import { Label } from "~components/Label"
|
|
9
|
+
import { Tooltip, TooltipTrigger } from "../index"
|
|
10
|
+
import * as TestStories from "./Tooltip.spec.stories"
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Overlays/Tooltip/v3/Docs Assets",
|
|
14
|
+
component: Tooltip,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered",
|
|
17
|
+
a11y: { disable: true },
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
defaultOpen: isChromatic(),
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
// eslint-disable-next-line camelcase
|
|
24
|
+
UNSTABLE_portalContainer: {
|
|
25
|
+
control: false,
|
|
26
|
+
table: { disable: true },
|
|
27
|
+
},
|
|
28
|
+
triggerRef: { control: false },
|
|
29
|
+
},
|
|
30
|
+
} satisfies Meta<typeof Tooltip>
|
|
31
|
+
|
|
32
|
+
export default meta
|
|
33
|
+
|
|
34
|
+
type Story = StoryObj<typeof meta>
|
|
35
|
+
|
|
36
|
+
export const Playground: Story = {
|
|
37
|
+
render: ({ defaultOpen: _, isOpen, ...args }) => (
|
|
38
|
+
<TooltipTrigger defaultOpen={true} isOpen={isOpen}>
|
|
39
|
+
<Button label="Button" />
|
|
40
|
+
<Tooltip {...args}>Tooltip content</Tooltip>
|
|
41
|
+
</TooltipTrigger>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Primary: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<TooltipTrigger>
|
|
48
|
+
<IconButton
|
|
49
|
+
label="Add something"
|
|
50
|
+
icon={<AddIcon role="presentation" />}
|
|
51
|
+
primary
|
|
52
|
+
// Negate the aria description (added by RAC) as it should be the
|
|
53
|
+
// same as the accessible name, therefore no need to duplicate it
|
|
54
|
+
aria-describedby={null}
|
|
55
|
+
/>
|
|
56
|
+
<Tooltip>Add something</Tooltip>
|
|
57
|
+
</TooltipTrigger>
|
|
58
|
+
),
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const Placement: Story = {
|
|
62
|
+
...TestStories.Placement,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const DoFieldTooltip: Story = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<div>
|
|
68
|
+
<Label>Password</Label>
|
|
69
|
+
<div className="flex gap-4">
|
|
70
|
+
<Input type="text" />
|
|
71
|
+
<TooltipTrigger>
|
|
72
|
+
<IconButton
|
|
73
|
+
label="Help"
|
|
74
|
+
icon={<QuestionIcon role="presentation" />}
|
|
75
|
+
// Negate the aria description (added by RAC) as it should be the
|
|
76
|
+
// same as the accessible name, therefore no need to duplicate it
|
|
77
|
+
aria-describedby={null}
|
|
78
|
+
/>
|
|
79
|
+
<Tooltip>Contact customer support for help</Tooltip>
|
|
80
|
+
</TooltipTrigger>
|
|
81
|
+
</div>
|
|
82
|
+
<FieldMessage message="Password must be at least 8 characters" />
|
|
83
|
+
</div>
|
|
84
|
+
),
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const DontFieldTooltip: Story = {
|
|
88
|
+
parameters: {
|
|
89
|
+
docs: {
|
|
90
|
+
source: { type: "dynamic" },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
render: () => (
|
|
94
|
+
<div>
|
|
95
|
+
<Label>Password</Label>
|
|
96
|
+
<div className="flex gap-4">
|
|
97
|
+
<Input type="text" />
|
|
98
|
+
<TooltipTrigger>
|
|
99
|
+
<IconButton
|
|
100
|
+
label="Help"
|
|
101
|
+
icon={<QuestionIcon role="presentation" />}
|
|
102
|
+
/>
|
|
103
|
+
<Tooltip>Password must be at least 8 characters</Tooltip>
|
|
104
|
+
</TooltipTrigger>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const DoConcise: Story = {
|
|
111
|
+
parameters: {
|
|
112
|
+
docs: {
|
|
113
|
+
source: { type: "dynamic" },
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
render: () => (
|
|
117
|
+
<div>
|
|
118
|
+
<Label>Email</Label>
|
|
119
|
+
<div className="flex gap-4">
|
|
120
|
+
<Input type="text" />
|
|
121
|
+
<TooltipTrigger>
|
|
122
|
+
<IconButton
|
|
123
|
+
label="Help"
|
|
124
|
+
icon={<QuestionIcon role="presentation" />}
|
|
125
|
+
/>
|
|
126
|
+
<Tooltip>Enter your email to help us find your account</Tooltip>
|
|
127
|
+
</TooltipTrigger>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
),
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const DontConcise: Story = {
|
|
134
|
+
parameters: {
|
|
135
|
+
docs: {
|
|
136
|
+
source: { type: "dynamic" },
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
render: () => (
|
|
140
|
+
<div>
|
|
141
|
+
<Label>Email</Label>
|
|
142
|
+
<div className="flex gap-4">
|
|
143
|
+
<Input type="text" />
|
|
144
|
+
<TooltipTrigger>
|
|
145
|
+
<IconButton
|
|
146
|
+
label="Help"
|
|
147
|
+
icon={<QuestionIcon role="presentation" />}
|
|
148
|
+
/>
|
|
149
|
+
<Tooltip>
|
|
150
|
+
The email field is required. Your email address will be used as an
|
|
151
|
+
identifier when we search for your account and we will also use it
|
|
152
|
+
to send you confirmation numbers via email.
|
|
153
|
+
</Tooltip>
|
|
154
|
+
</TooltipTrigger>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
),
|
|
158
|
+
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { Meta,
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Canvas, Meta, Unstyled, Controls } from "@storybook/blocks"
|
|
2
|
+
import { CheckIcon, ClearIcon } from "~components/Icon"
|
|
3
|
+
import { ResourceLinks, SbText, SbHeading, Installation } from "~storybook/components"
|
|
4
|
+
import * as TooltipStories from "./Tooltip.docs.stories"
|
|
5
|
+
import AnatomyPng from "./assets/tooltip_anatomy.png"
|
|
6
|
+
import VariantsPng from "./assets/tooltip_variants.png"
|
|
7
|
+
import WhenToUsePng from "./assets/tooltip_when_to_use.png"
|
|
4
8
|
|
|
5
|
-
<Meta
|
|
9
|
+
<Meta title="Overlays/Tooltip/v3/Usage Guidelines" />
|
|
6
10
|
|
|
7
11
|
# Tooltip (v3)
|
|
12
|
+
<SbText variant="extra-small">
|
|
13
|
+
Updated June X, 2024
|
|
14
|
+
</SbText>
|
|
15
|
+
|
|
8
16
|
|
|
9
|
-
{/*
|
|
10
|
-
* @todo:
|
|
11
|
-
* - Adjust Github link (if needed)
|
|
12
|
-
* - Add Figma and Design Guidelines (Confluence) link
|
|
13
|
-
*/}
|
|
14
17
|
<ResourceLinks
|
|
15
18
|
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
|
|
16
19
|
figma=""
|
|
17
|
-
designGuidelines=""
|
|
20
|
+
designGuidelines="/?path=/docs/overlays-tooltip-v3-usage-guidelines--docs"
|
|
21
|
+
apiSpecification="/?path=/docs/overlays-tooltip-v3-api-specifications--docs"
|
|
18
22
|
className="!mb-8"
|
|
19
23
|
/>
|
|
20
24
|
|
|
@@ -26,10 +30,126 @@ import * as TooltipStories from "./Tooltip.stories"
|
|
|
26
30
|
|
|
27
31
|
## Overview
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
<SbText>
|
|
34
|
+
Tooltips are brief floating labels used to add additional contextual information when users hover, click or focus on an interactive element. These should offer concise explanations, elaborating on the element they are associated with.
|
|
35
|
+
</SbText>
|
|
36
|
+
|
|
37
|
+
<Canvas of={TooltipStories.Playground} />
|
|
38
|
+
<Controls of={TooltipStories.Playground} include={["placement", "isOpen"]} className="mb-64" />
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Anatomy
|
|
42
|
+
|
|
43
|
+
<div className="mb-32">
|
|
44
|
+
<SbText>
|
|
45
|
+
- The anatomy of a tooltip is made up of a container, description and arrow.
|
|
46
|
+
- **They do not include a title or heading**. If you need to include a title, use a Popover
|
|
47
|
+
- A tooltip is connected to a trigger element, such as a button or icon, that shows the tooltip when the interactive trigger element is hovered or focused. (More details below.)
|
|
48
|
+
</ SbText>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<img src={AnatomyPng} alt="Indicates the anatomy of the Tooltip component, the Container, Label, zArrow and Trigger" className="mb-64" />
|
|
52
|
+
|
|
53
|
+
### When to use
|
|
54
|
+
|
|
55
|
+
<div className="mt-16 mb-32">
|
|
56
|
+
<SbText>
|
|
57
|
+
- Tooltips are used to provide additional information when space is tight.
|
|
58
|
+
- Tooltips must be concise with one or more lines of text.
|
|
59
|
+
- Tooltips must be accessible via hover and focus only.
|
|
60
|
+
- Trigger tooltips from Interactive elements (Buttons, Links, Icon buttons) or Non-interactive elements (Icons, Abbreviations Truncated text)—be mindful of keyboard accessibility
|
|
61
|
+
- **Never include any kind of error messages** in a tooltip
|
|
62
|
+
</ SbText>
|
|
63
|
+
</ div>
|
|
64
|
+
|
|
65
|
+
<img src={WhenToUsePng} alt="Illustration of when to use the Tooltip component" className="mb-32"/>
|
|
66
|
+
|
|
67
|
+
### Dos and don'ts
|
|
68
|
+
<Unstyled>
|
|
69
|
+
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
70
|
+
<div className="flex flex-col m-0 gap-16">
|
|
71
|
+
<SbHeading variant="heading-4">
|
|
72
|
+
#### Do use tooltips to describe icons
|
|
73
|
+
</SbHeading>
|
|
74
|
+
<SbText variant="body" tag="span">
|
|
75
|
+
Icons are not always easy to identify on their own. When you use components that don't have labels — for example, icon-only action buttons and tabs — make sure to use tooltips to provide context for the icons.
|
|
76
|
+
</SbText>
|
|
77
|
+
<div className="grid grid-cols-2 gap-16">
|
|
78
|
+
<div className="relative [&>*]:m-0">
|
|
79
|
+
<div className="bg-green-500 absolute top-6 left-6 z-10 py-4 px-6 font-bold text-white rounded flex gap-2 items-center justify-center">
|
|
80
|
+
<CheckIcon role="presentation" />
|
|
81
|
+
<SbText color="white">
|
|
82
|
+
<strong>Do</strong>
|
|
83
|
+
</SbText>
|
|
84
|
+
</div>
|
|
85
|
+
<Canvas of={TooltipStories.Primary} className="border-green-500 !rounded" />
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div className="flex flex-col gap-16">
|
|
91
|
+
<SbHeading variant="heading-4">
|
|
92
|
+
#### Don't use tooltips to communicate crucial information
|
|
93
|
+
</SbHeading>
|
|
94
|
+
<SbText>
|
|
95
|
+
Tooltips should never stop a user (or be a gate) from completing a task or performing an action. They disappear so they should never contain critical information that a user would absolutely need to proceed, or information without which a user may cause errors. If the information is crucial for a user to proceed, consider using a modal or inline notification instead.
|
|
96
|
+
</SbText>
|
|
97
|
+
<div className="grid grid-cols-2 gap-16">
|
|
98
|
+
<div className="relative [&>*]:m-0">
|
|
99
|
+
<div className="bg-green-500 absolute top-6 left-6 z-10 py-4 px-6 font-bold text-white rounded flex gap-2 items-center justify-center">
|
|
100
|
+
<CheckIcon role="presentation" />
|
|
101
|
+
<SbText color="white"><strong>Do</strong></SbText>
|
|
102
|
+
</div>
|
|
103
|
+
<Canvas of={TooltipStories.DoFieldTooltip} className="border-green-500 !rounded-[10px]" />
|
|
104
|
+
</div>
|
|
105
|
+
<div className="relative [&>*]:m-0">
|
|
106
|
+
<div className="bg-gray-500 absolute top-6 left-6 z-10 py-4 px-6 font-bold text-white rounded flex gap-2 items-center justify-center">
|
|
107
|
+
<ClearIcon role="presentation" />
|
|
108
|
+
<SbText color="white"><strong>Don't</strong></SbText>
|
|
109
|
+
</div>
|
|
110
|
+
<Canvas of={TooltipStories.DontFieldTooltip} className="border-gray-500 !rounded-[10px]" />
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div className="flex flex-col m-0 gap-16">
|
|
116
|
+
<SbHeading variant="heading-4">
|
|
117
|
+
#### Do be concise
|
|
118
|
+
</SbHeading>
|
|
119
|
+
<SbText>
|
|
120
|
+
Good tooltips contain concise and helpful information, keep it short. If you need more space, consider using a Popover. Don’t use it to duplicate information that already exists on the page. Instead, closely consider its placement and whether the disclosed copy will inform the action the user is about to perform.
|
|
121
|
+
</SbText>
|
|
122
|
+
<div className="grid grid-cols-2 gap-16">
|
|
123
|
+
<div className="relative [&>*]:m-0">
|
|
124
|
+
<div className="bg-green-500 absolute top-6 left-6 z-10 py-4 px-6 font-bold text-white rounded flex gap-2 items-center justify-center">
|
|
125
|
+
<CheckIcon role="presentation" />
|
|
126
|
+
<SbText color="white"><strong>Do</strong></SbText>
|
|
127
|
+
</div>
|
|
128
|
+
<Canvas of={TooltipStories.DoConcise} className="border-green-500 !rounded-[10px]" />
|
|
129
|
+
</div>
|
|
130
|
+
<div className="relative [&>*]:m-0">
|
|
131
|
+
<div className="bg-gray-500 absolute top-6 left-6 z-10 py-4 px-6 font-bold text-white rounded flex gap-2 items-center justify-center">
|
|
132
|
+
<ClearIcon role="presentation" />
|
|
133
|
+
<SbText color="white"><strong>Don't</strong></SbText>
|
|
134
|
+
</div>
|
|
135
|
+
<Canvas of={TooltipStories.DontConcise} className="border-gray-500 !rounded-[10px]" />
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</Unstyled>
|
|
141
|
+
|
|
142
|
+
### Variations
|
|
143
|
+
|
|
144
|
+
<img src={VariantsPng} alt="Indicates the anatomy of the Tooltip component, the Container, Label, zArrow and Trigger" className="my-16" />
|
|
31
145
|
|
|
32
|
-
<
|
|
33
|
-
<
|
|
146
|
+
<div className="mb-64">
|
|
147
|
+
<SbText>
|
|
148
|
+
- Type: Dropdown to choose from Default (dark tooltip) and Reverse (light tooltip)
|
|
149
|
+
- Direction: Dropdown to choose where the arrow points
|
|
150
|
+
- Tooltip label: Input field allows you to type in the label from the properties panel
|
|
151
|
+
- Use strong signifiers for trigger elements to ensure the tooltip is discoverable.
|
|
152
|
+
- The proximity of tooltips is always paired to the element with which they are associated.
|
|
153
|
+
</SbText>
|
|
154
|
+
</ div>
|
|
34
155
|
|
|
35
|
-
## API
|