@easypost/easy-ui 1.0.0-alpha.5 → 1.0.0-alpha.6
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/Badge/index.js +16 -16
- package/Badge/index.mjs +14 -14
- package/Banner/index.js +7 -7
- package/Banner/index.mjs +5 -5
- package/Button/Button.d.ts +61 -0
- package/Button/Button.d.ts.map +1 -1
- package/Button/index.js +23 -23
- package/Button/index.mjs +20 -20
- package/CHANGELOG.md +8 -0
- package/Card/index.js +84 -5
- package/Card/index.mjs +84 -5
- package/Checkbox/index.js +26 -26
- package/Checkbox/index.mjs +24 -24
- package/CodeBlock/index.js +4 -4
- package/CodeBlock/index.mjs +4 -4
- package/DropdownButton/DropdownButton.d.ts +48 -0
- package/DropdownButton/DropdownButton.d.ts.map +1 -1
- package/DropdownButton/index.js +17 -17
- package/DropdownButton/index.mjs +15 -15
- package/HorizontalGrid/index.js +1 -1
- package/HorizontalGrid/index.mjs +1 -1
- package/HorizontalStack/index.js +48 -4
- package/HorizontalStack/index.mjs +48 -4
- package/Icon/Icon.d.ts +51 -0
- package/Icon/Icon.d.ts.map +1 -1
- package/Icon/index.js +38 -4
- package/Icon/index.mjs +38 -4
- package/IconButton/IconButton.d.ts +62 -0
- package/IconButton/IconButton.d.ts.map +1 -1
- package/IconButton/index.js +18 -18
- package/IconButton/index.mjs +15 -15
- package/InputField/index.js +282 -11
- package/InputField/index.mjs +266 -11
- package/Menu/index.js +57 -15
- package/Menu/index.mjs +58 -16
- package/Notification/index.js +1534 -14
- package/Notification/index.mjs +1518 -14
- package/Provider/index.js +8 -8
- package/Provider/index.mjs +8 -8
- package/RadioGroup/index.js +24 -24
- package/RadioGroup/index.mjs +22 -22
- package/Select/index.js +71 -29
- package/Select/index.mjs +71 -29
- package/SelectorErrorTooltip/index.js +99 -8
- package/SelectorErrorTooltip/index.mjs +85 -10
- package/Text/index.js +85 -4
- package/Text/index.mjs +85 -4
- package/TextField/index.js +7 -7
- package/TextField/index.mjs +8 -8
- package/Textarea/index.js +7 -7
- package/Textarea/index.mjs +8 -8
- package/Theme/index.js +145 -9
- package/Theme/index.mjs +145 -9
- package/Toggle/index.js +14 -14
- package/Toggle/index.mjs +14 -14
- package/Tooltip/index.js +297 -8
- package/Tooltip/index.mjs +298 -9
- package/UnstyledButton/index.js +3 -3
- package/UnstyledButton/index.mjs +3 -3
- package/VerticalStack/index.js +3 -3
- package/VerticalStack/index.mjs +3 -3
- package/__chunks__/{InputIcon-4a8e5243.mjs → InputIcon-2317befd.mjs} +26 -26
- package/__chunks__/{InputIcon-70dad3e5.js → InputIcon-d3963cf8.js} +29 -29
- package/__chunks__/{import-9c958e32.mjs → import-0561e1ba.mjs} +2 -2
- package/__chunks__/{import-fbe7cc7e.mjs → import-19bc38ac.mjs} +26 -26
- package/__chunks__/{import-d2e79ac1.mjs → import-29af6941.mjs} +3 -3
- package/__chunks__/{import-9581a2dc.js → import-2b302763.js} +43 -1
- package/__chunks__/{import-a6cadfe8.mjs → import-3d962a94.mjs} +57 -15
- package/__chunks__/{import-d52cd5cf.js → import-8b6c0bc7.js} +1 -1
- package/__chunks__/{import-87c465c9.js → import-a2023d8f.js} +1 -1
- package/__chunks__/{import-29edaaea.mjs → import-f1f4792a.mjs} +9 -9
- package/__chunks__/{UnstyledButton-981cd9af.mjs → index-29d7bca9.mjs} +2 -2
- package/__chunks__/{UnstyledButton-5bbb3c5e.js → index-3985350a.js} +1 -1
- package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
- package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
- package/__chunks__/{real-module-2f165429.mjs → real-module-515df21d.mjs} +4 -4
- package/__chunks__/{useTriggerWidth-9528009c.js → useTriggerWidth-156b038a.js} +48 -6
- package/__chunks__/{useTriggerWidth-29becc21.mjs → useTriggerWidth-addcd1d6.mjs} +71 -29
- package/package.json +6 -6
- package/style.css +1437 -1436
- package/__chunks__/Card-2bd533c4.js +0 -85
- package/__chunks__/Card-4ad318ba.mjs +0 -86
- package/__chunks__/HorizontalStack-65adb570.mjs +0 -50
- package/__chunks__/HorizontalStack-f331bfc7.js +0 -49
- package/__chunks__/Icon-1a25dcae.js +0 -39
- package/__chunks__/Icon-6eb724b4.mjs +0 -40
- package/__chunks__/InputField-cc829736.mjs +0 -268
- package/__chunks__/InputField-f5072e37.js +0 -283
- package/__chunks__/Notification-8d749bd1.mjs +0 -1533
- package/__chunks__/Notification-b7a2c277.js +0 -1548
- package/__chunks__/SelectorErrorTooltip-4d820c45.mjs +0 -83
- package/__chunks__/SelectorErrorTooltip-b7bb5b9d.js +0 -98
- package/__chunks__/Text-2efbe1fe.js +0 -86
- package/__chunks__/Text-ec2b8d8a.mjs +0 -87
- package/__chunks__/Theme-123ba2c3.mjs +0 -147
- package/__chunks__/Theme-57f8311c.js +0 -146
- package/__chunks__/Tooltip-b4e23b78.mjs +0 -299
- package/__chunks__/Tooltip-c5076ca7.js +0 -298
package/Theme/index.mjs
CHANGED
|
@@ -1,11 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "../
|
|
4
|
-
import "../utilities/
|
|
5
|
-
|
|
1
|
+
import React__default, { createContext, useContext, useState, useMemo } from "react";
|
|
2
|
+
import { e as ezuiTokens } from "../__chunks__/tokens-6be8e137.mjs";
|
|
3
|
+
import { getTokenAliases } from "../utilities/tokens.mjs";
|
|
4
|
+
import { tokenSafeKebabCase } from "../utilities/css.mjs";
|
|
5
|
+
const defaultTheme = createTheme(() => {
|
|
6
|
+
return getThemeFromTokens("theme.base");
|
|
7
|
+
});
|
|
8
|
+
const invertedColorSchemes = {
|
|
9
|
+
light: "dark",
|
|
10
|
+
dark: "light",
|
|
11
|
+
system: "inverted",
|
|
12
|
+
inverted: "system"
|
|
13
|
+
};
|
|
14
|
+
function NoopComponent(props) {
|
|
15
|
+
return React__default.createElement(React__default.Fragment, null, props.children);
|
|
16
|
+
}
|
|
17
|
+
const TrackerContext = createContext(0);
|
|
18
|
+
const ThemeContext = createContext(null);
|
|
19
|
+
const ColorSchemeContext = createContext(null);
|
|
20
|
+
function ThemeProvider({ children, colorScheme: colorSchemeFromUser, theme: themeFromUser }) {
|
|
21
|
+
const parentTheme = useContext(ThemeContext);
|
|
22
|
+
const isRoot = !parentTheme;
|
|
23
|
+
if (!isRoot && !themeFromUser && !colorSchemeFromUser) {
|
|
24
|
+
throw new Error("Must supply theme or colorScheme to ThemeProvider");
|
|
25
|
+
}
|
|
26
|
+
const parentContext = useContext(TrackerContext);
|
|
27
|
+
const [count] = useState(() => parentContext + 1);
|
|
28
|
+
const ThemeContextComponent = isRoot || themeFromUser ? ThemeContextProvider : NoopComponent;
|
|
29
|
+
const ColorSchemeContextComponent = isRoot || colorSchemeFromUser ? ColorSchemeContextProvider : NoopComponent;
|
|
30
|
+
const theme = themeFromUser ? themeFromUser : defaultTheme;
|
|
31
|
+
const colorScheme = colorSchemeFromUser ? colorSchemeFromUser : "system";
|
|
32
|
+
return React__default.createElement(TrackerContext.Provider, {
|
|
33
|
+
value: count
|
|
34
|
+
}, React__default.createElement(ThemeContextComponent, {
|
|
35
|
+
theme
|
|
36
|
+
}, React__default.createElement(ColorSchemeContextComponent, {
|
|
37
|
+
colorScheme
|
|
38
|
+
}, React__default.createElement(React__default.Fragment, null, React__default.createElement(Style, {
|
|
39
|
+
isRoot
|
|
40
|
+
}), children))));
|
|
41
|
+
}
|
|
42
|
+
function createTheme(themeCreator) {
|
|
43
|
+
return themeCreator;
|
|
44
|
+
}
|
|
45
|
+
function useTheme() {
|
|
46
|
+
const themeContext = useContext(ThemeContext);
|
|
47
|
+
if (!themeContext) {
|
|
48
|
+
throw new Error("useTheme() must be used within a ThemeProvier");
|
|
49
|
+
}
|
|
50
|
+
return themeContext;
|
|
51
|
+
}
|
|
52
|
+
function useColorScheme() {
|
|
53
|
+
const colorSchemeContext = useContext(ColorSchemeContext);
|
|
54
|
+
if (!colorSchemeContext) {
|
|
55
|
+
throw new Error("useColorScheme() must be used within a ThemeProvider");
|
|
56
|
+
}
|
|
57
|
+
return colorSchemeContext;
|
|
58
|
+
}
|
|
59
|
+
function Style({ isRoot }) {
|
|
60
|
+
const parentContext = useContext(TrackerContext);
|
|
61
|
+
const themeCreator = useTheme();
|
|
62
|
+
const { resolvedColorScheme } = useColorScheme();
|
|
63
|
+
const fingerprint = useMemo(() => {
|
|
64
|
+
return `ezui-theme-style-level-${parentContext}`;
|
|
65
|
+
}, [parentContext]);
|
|
66
|
+
const selector = isRoot ? ":root" : `#${fingerprint} ~ *`;
|
|
67
|
+
const css = useMemo(() => {
|
|
68
|
+
return resolvedColorScheme === "system" ? `${selector} {
|
|
69
|
+
${renderThemeVariables(themeCreator({
|
|
70
|
+
colorScheme: "light"
|
|
71
|
+
}))}
|
|
72
|
+
}
|
|
73
|
+
@media (prefers-color-scheme: dark) {
|
|
74
|
+
${selector} {
|
|
75
|
+
${renderThemeVariables(themeCreator({
|
|
76
|
+
colorScheme: "dark"
|
|
77
|
+
}))}
|
|
78
|
+
}
|
|
79
|
+
}` : resolvedColorScheme === "inverted" ? `${selector} {
|
|
80
|
+
${renderThemeVariables(themeCreator({
|
|
81
|
+
colorScheme: "dark"
|
|
82
|
+
}))}
|
|
83
|
+
}
|
|
84
|
+
@media (prefers-color-scheme: dark) {
|
|
85
|
+
${selector} {
|
|
86
|
+
${renderThemeVariables(themeCreator({
|
|
87
|
+
colorScheme: "light"
|
|
88
|
+
}))}
|
|
89
|
+
}
|
|
90
|
+
}` : `${selector} {
|
|
91
|
+
${renderThemeVariables(themeCreator({
|
|
92
|
+
colorScheme: resolvedColorScheme
|
|
93
|
+
}))}
|
|
94
|
+
}`;
|
|
95
|
+
}, [resolvedColorScheme, selector, themeCreator]);
|
|
96
|
+
return React__default.createElement("style", {
|
|
97
|
+
id: fingerprint,
|
|
98
|
+
dangerouslySetInnerHTML: {
|
|
99
|
+
__html: css
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function ThemeContextProvider({ theme, children }) {
|
|
104
|
+
return React__default.createElement(ThemeContext.Provider, {
|
|
105
|
+
value: theme
|
|
106
|
+
}, children);
|
|
107
|
+
}
|
|
108
|
+
function ColorSchemeContextProvider({ colorScheme, children }) {
|
|
109
|
+
const parentColorSchemeContext = useContext(ColorSchemeContext);
|
|
110
|
+
const colorSchemeContextValue = useMemo(() => {
|
|
111
|
+
const resolvedColorScheme = colorScheme === "inverted" && parentColorSchemeContext ? invertedColorSchemes[parentColorSchemeContext.resolvedColorScheme] : colorScheme;
|
|
112
|
+
return {
|
|
113
|
+
userColorScheme: colorScheme,
|
|
114
|
+
resolvedColorScheme
|
|
115
|
+
};
|
|
116
|
+
}, [colorScheme, parentColorSchemeContext]);
|
|
117
|
+
return React__default.createElement(ColorSchemeContext.Provider, {
|
|
118
|
+
value: colorSchemeContextValue
|
|
119
|
+
}, children);
|
|
120
|
+
}
|
|
121
|
+
function getThemeInstanceVariables(theme) {
|
|
122
|
+
return Object.fromEntries(Object.entries(theme).map(([key, value]) => {
|
|
123
|
+
const property = tokenSafeKebabCase(key);
|
|
124
|
+
return [`--ezui-t-${property}`, value];
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
function renderThemeVariables(theme) {
|
|
128
|
+
const variables = getThemeInstanceVariables(theme);
|
|
129
|
+
const css = Object.entries(variables).map((entry) => entry.join(": ") + ";").join("\n");
|
|
130
|
+
return css;
|
|
131
|
+
}
|
|
132
|
+
function getThemeFromTokens(prefix) {
|
|
133
|
+
const theme = Object.fromEntries(Object.keys(ezuiTokens).filter((key) => key.startsWith(`${prefix}.`)).map((key) => key.replace(new RegExp(`^${prefix}.`), "")).map((key) => {
|
|
134
|
+
const value = `var(--ezui-${tokenSafeKebabCase(prefix)}-${tokenSafeKebabCase(key)})`;
|
|
135
|
+
return [key, value];
|
|
136
|
+
}));
|
|
137
|
+
return theme;
|
|
138
|
+
}
|
|
139
|
+
function getThemeTokenAliases(pattern) {
|
|
140
|
+
return getTokenAliases(getThemeFromTokens("theme.base"), pattern);
|
|
141
|
+
}
|
|
6
142
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
143
|
+
ThemeProvider,
|
|
144
|
+
createTheme,
|
|
145
|
+
defaultTheme,
|
|
146
|
+
getThemeTokenAliases
|
|
11
147
|
};
|
package/Toggle/index.js
CHANGED
|
@@ -20,10 +20,10 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
21
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
22
22
|
const React = require("react");
|
|
23
|
-
const
|
|
23
|
+
const Text_index = require("../Text/index.js");
|
|
24
24
|
const utilities_css = require("../utilities/css.js");
|
|
25
|
-
const _import = require("../__chunks__/import-
|
|
26
|
-
const _import$1 = require("../__chunks__/import-
|
|
25
|
+
const _import = require("../__chunks__/import-8b6c0bc7.js");
|
|
26
|
+
const _import$1 = require("../__chunks__/import-2b302763.js");
|
|
27
27
|
const _import$2 = require("../__chunks__/import-a1e0f814.js");
|
|
28
28
|
require("../__chunks__/import-dea5a24d.js");
|
|
29
29
|
function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
|
|
@@ -39,13 +39,13 @@ function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
|
|
|
39
39
|
isReadOnly
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
const Switch$1 = "
|
|
43
|
-
const focusVisible = "
|
|
44
|
-
const track = "
|
|
45
|
-
const thumb = "
|
|
46
|
-
const hovered = "
|
|
47
|
-
const disabled = "
|
|
48
|
-
const selected = "
|
|
42
|
+
const Switch$1 = "_Switch_1au2a_5";
|
|
43
|
+
const focusVisible = "_focusVisible_1au2a_13";
|
|
44
|
+
const track = "_track_1au2a_25";
|
|
45
|
+
const thumb = "_thumb_1au2a_29";
|
|
46
|
+
const hovered = "_hovered_1au2a_33";
|
|
47
|
+
const disabled = "_disabled_1au2a_33";
|
|
48
|
+
const selected = "_selected_1au2a_37";
|
|
49
49
|
const styles$1 = {
|
|
50
50
|
Switch: Switch$1,
|
|
51
51
|
focusVisible,
|
|
@@ -78,9 +78,9 @@ function Switch(props) {
|
|
|
78
78
|
r: 6
|
|
79
79
|
})));
|
|
80
80
|
}
|
|
81
|
-
const Toggle$1 = "
|
|
82
|
-
const text = "
|
|
83
|
-
const input = "
|
|
81
|
+
const Toggle$1 = "_Toggle_sl5qh_5";
|
|
82
|
+
const text = "_text_sl5qh_24";
|
|
83
|
+
const input = "_input_sl5qh_25";
|
|
84
84
|
const styles = {
|
|
85
85
|
Toggle: Toggle$1,
|
|
86
86
|
text,
|
|
@@ -111,7 +111,7 @@ function Toggle(props) {
|
|
|
111
111
|
isSelected
|
|
112
112
|
}), children && React.createElement("span", {
|
|
113
113
|
className: styles.text
|
|
114
|
-
}, React.createElement(
|
|
114
|
+
}, React.createElement(Text_index.Text, {
|
|
115
115
|
variant: "body1",
|
|
116
116
|
color: textColor
|
|
117
117
|
}, children)));
|
package/Toggle/index.mjs
CHANGED
|
@@ -18,11 +18,11 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import React__default from "react";
|
|
21
|
-
import {
|
|
21
|
+
import { Text } from "../Text/index.mjs";
|
|
22
22
|
import { classNames } from "../utilities/css.mjs";
|
|
23
|
-
import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577, a as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "../__chunks__/import-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
23
|
+
import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577, a as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "../__chunks__/import-0561e1ba.mjs";
|
|
24
|
+
import { e as $f7dceffc5ad7768b$export$4e328f61c538687f, f as $6179b936705e76d3$export$ae780daf29e6d456 } from "../__chunks__/import-3d962a94.mjs";
|
|
25
|
+
import { a as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "../__chunks__/import-19bc38ac.mjs";
|
|
26
26
|
import "../__chunks__/import-6a831ca1.mjs";
|
|
27
27
|
function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
|
|
28
28
|
let { inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref);
|
|
@@ -37,13 +37,13 @@ function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
|
|
|
37
37
|
isReadOnly
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
const Switch$1 = "
|
|
41
|
-
const focusVisible = "
|
|
42
|
-
const track = "
|
|
43
|
-
const thumb = "
|
|
44
|
-
const hovered = "
|
|
45
|
-
const disabled = "
|
|
46
|
-
const selected = "
|
|
40
|
+
const Switch$1 = "_Switch_1au2a_5";
|
|
41
|
+
const focusVisible = "_focusVisible_1au2a_13";
|
|
42
|
+
const track = "_track_1au2a_25";
|
|
43
|
+
const thumb = "_thumb_1au2a_29";
|
|
44
|
+
const hovered = "_hovered_1au2a_33";
|
|
45
|
+
const disabled = "_disabled_1au2a_33";
|
|
46
|
+
const selected = "_selected_1au2a_37";
|
|
47
47
|
const styles$1 = {
|
|
48
48
|
Switch: Switch$1,
|
|
49
49
|
focusVisible,
|
|
@@ -76,9 +76,9 @@ function Switch(props) {
|
|
|
76
76
|
r: 6
|
|
77
77
|
})));
|
|
78
78
|
}
|
|
79
|
-
const Toggle$1 = "
|
|
80
|
-
const text = "
|
|
81
|
-
const input = "
|
|
79
|
+
const Toggle$1 = "_Toggle_sl5qh_5";
|
|
80
|
+
const text = "_text_sl5qh_24";
|
|
81
|
+
const input = "_input_sl5qh_25";
|
|
82
82
|
const styles = {
|
|
83
83
|
Toggle: Toggle$1,
|
|
84
84
|
text,
|
package/Tooltip/index.js
CHANGED
|
@@ -1,13 +1,302 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2
21
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
require("
|
|
5
|
-
require("../
|
|
6
|
-
require("../
|
|
7
|
-
require("../__chunks__/import-
|
|
8
|
-
require("../__chunks__/import-
|
|
9
|
-
require("../__chunks__/import-9581a2dc.js");
|
|
22
|
+
const React = require("react");
|
|
23
|
+
const Text_index = require("../Text/index.js");
|
|
24
|
+
const utilities_css = require("../utilities/css.js");
|
|
25
|
+
const _import$2 = require("../__chunks__/import-a2023d8f.js");
|
|
26
|
+
const _import = require("../__chunks__/import-a1e0f814.js");
|
|
27
|
+
const _import$1 = require("../__chunks__/import-2b302763.js");
|
|
10
28
|
require("react-dom");
|
|
11
29
|
require("../__chunks__/import-dea5a24d.js");
|
|
12
30
|
require("../__chunks__/real-module-e36b1436.js");
|
|
13
|
-
|
|
31
|
+
function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
|
|
32
|
+
let domProps = _import.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
33
|
+
labelable: true
|
|
34
|
+
});
|
|
35
|
+
let { hoverProps } = _import$1.$6179b936705e76d3$export$ae780daf29e6d456({
|
|
36
|
+
onHoverStart: () => {
|
|
37
|
+
return state === null || state === void 0 ? void 0 : state.open(true);
|
|
38
|
+
},
|
|
39
|
+
onHoverEnd: () => {
|
|
40
|
+
return state === null || state === void 0 ? void 0 : state.close();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
tooltipProps: _import.$3ef42575df84b30b$export$9d1611c77c2fe928(domProps, hoverProps, {
|
|
45
|
+
role: "tooltip"
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
|
|
50
|
+
let { isDisabled, trigger } = props;
|
|
51
|
+
let tooltipId = _import.$bdb11010cef70236$export$f680877a34711e37();
|
|
52
|
+
let isHovered = React.useRef(false);
|
|
53
|
+
let isFocused = React.useRef(false);
|
|
54
|
+
let handleShow = () => {
|
|
55
|
+
if (isHovered.current || isFocused.current)
|
|
56
|
+
state.open(isFocused.current);
|
|
57
|
+
};
|
|
58
|
+
let handleHide = (immediate) => {
|
|
59
|
+
if (!isHovered.current && !isFocused.current)
|
|
60
|
+
state.close(immediate);
|
|
61
|
+
};
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
let onKeyDown = (e) => {
|
|
64
|
+
if (ref && ref.current) {
|
|
65
|
+
if (e.key === "Escape") {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
state.close(true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
if (state.isOpen) {
|
|
72
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
73
|
+
return () => {
|
|
74
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}, [
|
|
78
|
+
ref,
|
|
79
|
+
state
|
|
80
|
+
]);
|
|
81
|
+
let onHoverStart = () => {
|
|
82
|
+
if (trigger === "focus")
|
|
83
|
+
return;
|
|
84
|
+
if (_import$1.$507fabe10e71c6fb$export$630ff653c5ada6a9() === "pointer")
|
|
85
|
+
isHovered.current = true;
|
|
86
|
+
else
|
|
87
|
+
isHovered.current = false;
|
|
88
|
+
handleShow();
|
|
89
|
+
};
|
|
90
|
+
let onHoverEnd = () => {
|
|
91
|
+
if (trigger === "focus")
|
|
92
|
+
return;
|
|
93
|
+
isFocused.current = false;
|
|
94
|
+
isHovered.current = false;
|
|
95
|
+
handleHide();
|
|
96
|
+
};
|
|
97
|
+
let onPressStart = () => {
|
|
98
|
+
isFocused.current = false;
|
|
99
|
+
isHovered.current = false;
|
|
100
|
+
handleHide(true);
|
|
101
|
+
};
|
|
102
|
+
let onFocus = () => {
|
|
103
|
+
let isVisible = _import$1.$507fabe10e71c6fb$export$b9b3dfddab17db27();
|
|
104
|
+
if (isVisible) {
|
|
105
|
+
isFocused.current = true;
|
|
106
|
+
handleShow();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
let onBlur = () => {
|
|
110
|
+
isFocused.current = false;
|
|
111
|
+
isHovered.current = false;
|
|
112
|
+
handleHide(true);
|
|
113
|
+
};
|
|
114
|
+
let { hoverProps } = _import$1.$6179b936705e76d3$export$ae780daf29e6d456({
|
|
115
|
+
isDisabled,
|
|
116
|
+
onHoverStart,
|
|
117
|
+
onHoverEnd
|
|
118
|
+
});
|
|
119
|
+
let { pressProps } = _import$1.$f6c31cce2adf654f$export$45712eceda6fad21({
|
|
120
|
+
onPressStart
|
|
121
|
+
});
|
|
122
|
+
let { focusableProps } = _import$1.$e6afbd83fe6ebbd2$export$4c014de7c8940b4c({
|
|
123
|
+
isDisabled,
|
|
124
|
+
onFocus,
|
|
125
|
+
onBlur
|
|
126
|
+
}, ref);
|
|
127
|
+
return {
|
|
128
|
+
triggerProps: __spreadValues({
|
|
129
|
+
"aria-describedby": state.isOpen ? tooltipId : void 0
|
|
130
|
+
}, _import.$3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, hoverProps, pressProps)),
|
|
131
|
+
tooltipProps: {
|
|
132
|
+
id: tooltipId
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const $8796f90736e175cb$var$TOOLTIP_DELAY = 1500;
|
|
137
|
+
const $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500;
|
|
138
|
+
let $8796f90736e175cb$var$tooltips = {};
|
|
139
|
+
let $8796f90736e175cb$var$tooltipId = 0;
|
|
140
|
+
let $8796f90736e175cb$var$globalWarmedUp = false;
|
|
141
|
+
let $8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
142
|
+
let $8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
143
|
+
function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
144
|
+
let { delay = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
|
|
145
|
+
let { isOpen, open, close } = _import$2.$fc909762b330b746$export$61c6a8c84e605fb6(props);
|
|
146
|
+
let id = React.useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []);
|
|
147
|
+
let closeTimeout = React.useRef();
|
|
148
|
+
let ensureTooltipEntry = () => {
|
|
149
|
+
$8796f90736e175cb$var$tooltips[id] = hideTooltip;
|
|
150
|
+
};
|
|
151
|
+
let closeOpenTooltips = () => {
|
|
152
|
+
for (let hideTooltipId in $8796f90736e175cb$var$tooltips)
|
|
153
|
+
if (hideTooltipId !== id) {
|
|
154
|
+
$8796f90736e175cb$var$tooltips[hideTooltipId](true);
|
|
155
|
+
delete $8796f90736e175cb$var$tooltips[hideTooltipId];
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
let showTooltip = () => {
|
|
159
|
+
clearTimeout(closeTimeout.current);
|
|
160
|
+
closeTimeout.current = null;
|
|
161
|
+
closeOpenTooltips();
|
|
162
|
+
ensureTooltipEntry();
|
|
163
|
+
$8796f90736e175cb$var$globalWarmedUp = true;
|
|
164
|
+
open();
|
|
165
|
+
if ($8796f90736e175cb$var$globalWarmUpTimeout) {
|
|
166
|
+
clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
|
|
167
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
168
|
+
}
|
|
169
|
+
if ($8796f90736e175cb$var$globalCooldownTimeout) {
|
|
170
|
+
clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
|
|
171
|
+
$8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
let hideTooltip = (immediate) => {
|
|
175
|
+
if (immediate || closeDelay <= 0) {
|
|
176
|
+
clearTimeout(closeTimeout.current);
|
|
177
|
+
closeTimeout.current = null;
|
|
178
|
+
close();
|
|
179
|
+
} else if (!closeTimeout.current)
|
|
180
|
+
closeTimeout.current = setTimeout(() => {
|
|
181
|
+
closeTimeout.current = null;
|
|
182
|
+
close();
|
|
183
|
+
}, closeDelay);
|
|
184
|
+
if ($8796f90736e175cb$var$globalWarmUpTimeout) {
|
|
185
|
+
clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
|
|
186
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
187
|
+
}
|
|
188
|
+
if ($8796f90736e175cb$var$globalWarmedUp) {
|
|
189
|
+
if ($8796f90736e175cb$var$globalCooldownTimeout)
|
|
190
|
+
clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
|
|
191
|
+
$8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => {
|
|
192
|
+
delete $8796f90736e175cb$var$tooltips[id];
|
|
193
|
+
$8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
194
|
+
$8796f90736e175cb$var$globalWarmedUp = false;
|
|
195
|
+
}, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay));
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
let warmupTooltip = () => {
|
|
199
|
+
closeOpenTooltips();
|
|
200
|
+
ensureTooltipEntry();
|
|
201
|
+
if (!isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp)
|
|
202
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => {
|
|
203
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
204
|
+
$8796f90736e175cb$var$globalWarmedUp = true;
|
|
205
|
+
showTooltip();
|
|
206
|
+
}, delay);
|
|
207
|
+
else if (!isOpen)
|
|
208
|
+
showTooltip();
|
|
209
|
+
};
|
|
210
|
+
React.useEffect(() => {
|
|
211
|
+
return () => {
|
|
212
|
+
clearTimeout(closeTimeout.current);
|
|
213
|
+
let tooltip = $8796f90736e175cb$var$tooltips[id];
|
|
214
|
+
if (tooltip)
|
|
215
|
+
delete $8796f90736e175cb$var$tooltips[id];
|
|
216
|
+
};
|
|
217
|
+
}, [
|
|
218
|
+
id
|
|
219
|
+
]);
|
|
220
|
+
return {
|
|
221
|
+
isOpen,
|
|
222
|
+
open: (immediate) => {
|
|
223
|
+
if (!immediate && delay > 0 && !closeTimeout.current)
|
|
224
|
+
warmupTooltip();
|
|
225
|
+
else
|
|
226
|
+
showTooltip();
|
|
227
|
+
},
|
|
228
|
+
close: hideTooltip
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
const Tooltip$1 = "_Tooltip_1yly1_5";
|
|
232
|
+
const text = "_text_1yly1_21";
|
|
233
|
+
const arrow = "_arrow_1yly1_27";
|
|
234
|
+
const top = "_top_1yly1_36";
|
|
235
|
+
const bottom = "_bottom_1yly1_37";
|
|
236
|
+
const left = "_left_1yly1_41";
|
|
237
|
+
const right = "_right_1yly1_42";
|
|
238
|
+
const styles = {
|
|
239
|
+
Tooltip: Tooltip$1,
|
|
240
|
+
text,
|
|
241
|
+
arrow,
|
|
242
|
+
top,
|
|
243
|
+
bottom,
|
|
244
|
+
left,
|
|
245
|
+
right
|
|
246
|
+
};
|
|
247
|
+
const CONTAINER_PADDING = 12;
|
|
248
|
+
const ARROW_BOUNDARY_OFFSET = 12;
|
|
249
|
+
const OFFSET = 12;
|
|
250
|
+
const DEFAULT_PLACEMENT = "top";
|
|
251
|
+
const OPEN_DELAY = 1e3;
|
|
252
|
+
const CLOSE_DELAY = 250;
|
|
253
|
+
function Tooltip(props) {
|
|
254
|
+
const { children, isImmediate } = props;
|
|
255
|
+
const triggerRef = React.useRef(null);
|
|
256
|
+
const triggerInputProps = __spreadProps(__spreadValues({}, props), {
|
|
257
|
+
delay: isImmediate ? 0 : OPEN_DELAY,
|
|
258
|
+
closeDelay: CLOSE_DELAY
|
|
259
|
+
});
|
|
260
|
+
const tooltipTriggerState = $8796f90736e175cb$export$4d40659c25ecb50b(triggerInputProps);
|
|
261
|
+
const { triggerProps, tooltipProps: tooltipPropsFromTrigger } = $4e1b34546679e357$export$a6da6c504e4bba8b(triggerInputProps, tooltipTriggerState, triggerRef);
|
|
262
|
+
return React.createElement(React.Fragment, null, React.cloneElement(children, __spreadProps(__spreadValues({}, _import.$3ef42575df84b30b$export$9d1611c77c2fe928(triggerProps, children.props)), {
|
|
263
|
+
ref: triggerRef
|
|
264
|
+
})), tooltipTriggerState.isOpen && React.createElement(_import$2.$f57aed4a881a3485$export$b47c3594eab58386, null, React.createElement(TooltipInner, __spreadProps(__spreadValues({}, props), {
|
|
265
|
+
triggerRef,
|
|
266
|
+
tooltipPropsFromTrigger,
|
|
267
|
+
tooltipTriggerState
|
|
268
|
+
}))));
|
|
269
|
+
}
|
|
270
|
+
function TooltipInner(props) {
|
|
271
|
+
const { content, placement: targetPlacement = DEFAULT_PLACEMENT, triggerRef, tooltipTriggerState, tooltipPropsFromTrigger } = props;
|
|
272
|
+
const tooltipRef = React.useRef(null);
|
|
273
|
+
const { overlayProps, arrowProps, placement, updatePosition } = _import$2.$2a41e45df1593e64$export$d39e1813b3bdd0e1({
|
|
274
|
+
arrowBoundaryOffset: ARROW_BOUNDARY_OFFSET,
|
|
275
|
+
containerPadding: CONTAINER_PADDING,
|
|
276
|
+
isOpen: tooltipTriggerState.isOpen,
|
|
277
|
+
offset: OFFSET,
|
|
278
|
+
overlayRef: tooltipRef,
|
|
279
|
+
placement: targetPlacement,
|
|
280
|
+
targetRef: triggerRef
|
|
281
|
+
});
|
|
282
|
+
const { tooltipProps: tooltipPropsFromTooltip } = $326e436e94273fe1$export$1c4b08e0eca38426(_import.$3ef42575df84b30b$export$9d1611c77c2fe928(overlayProps, props), tooltipTriggerState);
|
|
283
|
+
const tooltipProps = _import.$3ef42575df84b30b$export$9d1611c77c2fe928(overlayProps, tooltipPropsFromTooltip, tooltipPropsFromTrigger);
|
|
284
|
+
const style = __spreadValues(__spreadValues({}, tooltipProps.style), utilities_css.getComponentToken("tooltip", "container_padding", `${utilities_css.pxToRem(CONTAINER_PADDING)}rem`));
|
|
285
|
+
React.useEffect(() => {
|
|
286
|
+
updatePosition();
|
|
287
|
+
}, [content, updatePosition]);
|
|
288
|
+
return React.createElement("span", __spreadProps(__spreadValues({
|
|
289
|
+
ref: tooltipRef
|
|
290
|
+
}, tooltipProps), {
|
|
291
|
+
className: utilities_css.classNames(styles.Tooltip, styles[placement]),
|
|
292
|
+
"data-placement": placement,
|
|
293
|
+
style
|
|
294
|
+
}), React.createElement("span", {
|
|
295
|
+
className: styles.text
|
|
296
|
+
}, React.createElement(Text_index.Text, {
|
|
297
|
+
variant: "subtitle2"
|
|
298
|
+
}, content)), React.createElement("span", __spreadValues({
|
|
299
|
+
className: styles.arrow
|
|
300
|
+
}, arrowProps)));
|
|
301
|
+
}
|
|
302
|
+
exports.Tooltip = Tooltip;
|