@common-origin/design-system 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +2622 -830
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.d.mts +2 -2
- package/dist/components/atoms/Badge/Badge.d.ts +2 -2
- package/dist/components/atoms/Badge/Badge.mjs +15 -9
- package/dist/components/atoms/Box/Box.d.mts +3 -2
- package/dist/components/atoms/Box/Box.d.ts +3 -2
- package/dist/components/atoms/Button/Button.mjs +1 -1
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +1 -1
- package/dist/components/atoms/IconButton/IconButton.mjs +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/Tag/Tag.d.mts +1 -1
- package/dist/components/atoms/Tag/Tag.d.ts +1 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.mts +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.d.ts +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs +214 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs.map +1 -0
- package/dist/components/atoms/Tooltip/index.d.mts +2 -0
- package/dist/components/atoms/Tooltip/index.d.ts +2 -0
- package/dist/components/atoms/index.d.mts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/index.d.mts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +3 -2
- package/dist/components/molecules/Alert/Alert.mjs +2 -2
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +1 -1
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +1 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs +1 -1
- package/dist/components/molecules/List/List.d.mts +2 -0
- package/dist/components/molecules/List/List.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.d.mts +2 -0
- package/dist/components/molecules/List/ListItem.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.mjs +7 -7
- package/dist/components/molecules/Menu/Menu.d.mts +124 -0
- package/dist/components/molecules/Menu/Menu.d.ts +124 -0
- package/dist/components/molecules/Menu/Menu.mjs +476 -0
- package/dist/components/molecules/Menu/Menu.mjs.map +1 -0
- package/dist/components/molecules/Menu/index.d.mts +2 -0
- package/dist/components/molecules/Menu/index.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.mjs +1 -1
- package/dist/components/molecules/NumberInput/NumberInput.mjs +2 -1
- package/dist/components/molecules/PasswordField/PasswordField.mjs +3 -2
- package/dist/components/molecules/SearchField/SearchField.mjs +5 -3
- package/dist/components/molecules/Sheet/Sheet.mjs +3 -3
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.mts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.ts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +235 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavItem/index.d.ts +2 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.mts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.ts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs +69 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.mts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.ts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +202 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavSection/index.d.ts +2 -0
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +1 -1
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.mts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.ts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +133 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs.map +1 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.mts +2 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.ts +2 -0
- package/dist/components/molecules/index.d.mts +4 -0
- package/dist/components/molecules/index.d.ts +4 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.mts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.ts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs +346 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs.map +1 -0
- package/dist/components/organisms/SidebarNav/index.d.mts +2 -0
- package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
- package/dist/components/organisms/index.d.mts +1 -0
- package/dist/components/organisms/index.d.ts +1 -0
- package/dist/data.js +155 -68
- package/dist/data.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/floatingPosition.d.mts +43 -0
- package/dist/lib/floatingPosition.d.ts +43 -0
- package/dist/lib/floatingPosition.mjs +86 -0
- package/dist/lib/floatingPosition.mjs.map +1 -0
- package/dist/lib/keyboardFocus.d.mts +6 -0
- package/dist/lib/keyboardFocus.d.ts +6 -0
- package/dist/lib/keyboardFocus.mjs +17 -0
- package/dist/lib/keyboardFocus.mjs.map +1 -0
- package/dist/lib/styleUtils.d.mts +4 -0
- package/dist/lib/styleUtils.d.ts +4 -0
- package/dist/lib/styleUtils.mjs +5 -1
- package/dist/lib/styleUtils.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +1 -0
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/lib/useFloatingLayer.d.mts +32 -0
- package/dist/lib/useFloatingLayer.d.ts +32 -0
- package/dist/lib/useFloatingLayer.mjs +95 -0
- package/dist/lib/useFloatingLayer.mjs.map +1 -0
- package/dist/styles/icons.json +30 -1
- package/dist/styles/icons.json.mjs +34 -3
- package/dist/styles/icons.json.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +139 -32
- package/dist/styles/tokens.d.ts +139 -32
- package/dist/styles/tokens.json +122 -66
- package/dist/styles/tokens.json.mjs +122 -66
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +122 -66
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +122 -66
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +139 -32
- package/dist/tokens/styles/tokens.d.ts +139 -32
- package/dist/tokens.css +1137 -86
- package/dist/types/icons.d.mts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.mjs.map +1 -1
- package/package.json +4 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Badge variants: `default`, the
|
|
3
|
+
* Badge variants: `default`, the count on the strongest neutral fill, and `accent`, the blue highlight (decision 0045).
|
|
4
4
|
*/
|
|
5
5
|
export type BadgeVariant = 'default' | 'accent';
|
|
6
6
|
export interface BadgeProps {
|
|
@@ -12,7 +12,7 @@ export interface BadgeProps {
|
|
|
12
12
|
max?: number;
|
|
13
13
|
/**
|
|
14
14
|
* Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
|
|
15
|
-
* the blue highlight, and `default` the
|
|
15
|
+
* the blue highlight, and `default` the count on the strongest neutral fill. A badge's colour alone can't carry a
|
|
16
16
|
* status, so a count of items with a status uses the status pattern instead ("3 failed" with
|
|
17
17
|
* StatusLabel).
|
|
18
18
|
* @default 'default'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Badge variants: `default`, the
|
|
3
|
+
* Badge variants: `default`, the count on the strongest neutral fill, and `accent`, the blue highlight (decision 0045).
|
|
4
4
|
*/
|
|
5
5
|
export type BadgeVariant = 'default' | 'accent';
|
|
6
6
|
export interface BadgeProps {
|
|
@@ -12,7 +12,7 @@ export interface BadgeProps {
|
|
|
12
12
|
max?: number;
|
|
13
13
|
/**
|
|
14
14
|
* Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
|
|
15
|
-
* the blue highlight, and `default` the
|
|
15
|
+
* the blue highlight, and `default` the count on the strongest neutral fill. A badge's colour alone can't carry a
|
|
16
16
|
* status, so a count of items with a status uses the status pattern instead ("3 failed" with
|
|
17
17
|
* StatusLabel).
|
|
18
18
|
* @default 'default'
|
|
@@ -5,7 +5,6 @@ import styled$module, { keyframes } from 'styled-components';
|
|
|
5
5
|
const styled = styled$module.default || styled$module;
|
|
6
6
|
import { reducedMotion, forcedColors, visuallyHidden } from '../../../lib/styleUtils.mjs';
|
|
7
7
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
-
import { Typography } from '../Typography/Typography.mjs';
|
|
9
8
|
|
|
10
9
|
var semantic = tokens.semantic;
|
|
11
10
|
var color = semantic.color;
|
|
@@ -25,7 +24,10 @@ var BadgeIndicator = /*#__PURE__*/styled.span.withConfig({
|
|
|
25
24
|
},
|
|
26
25
|
displayName: "Badge__BadgeIndicator",
|
|
27
26
|
componentId: "sc-tjz4pp-1"
|
|
28
|
-
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: ", ";\n white-space: nowrap;\n box-shadow: 0 0 0 ", " ", ";\n animation: ", " ", " ", ";\n\n ", " {\n animation: none;\n }\n\n /* Forced colours drop fills (decision 0038): a dot is only a fill, so it keeps one in the\n text colour; a count gets an edge around its number */\n ", "\n \n ", "\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: ", ";\n white-space: nowrap;\n box-shadow: 0 0 0 ", " ", ";\n animation: ", " ", " ", ";\n\n ", " {\n animation: none;\n }\n\n /* Forced colours drop fills (decision 0038): a dot is only a fill, so it keeps one in the\n text colour; a count gets an edge around its number */\n ", "\n \n ", "\n"
|
|
27
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: ", ";\n white-space: nowrap;\n box-shadow: 0 0 0 ", " ", ";\n animation: ", " ", " ", ";\n\n ", " {\n animation: none;\n }\n\n /* Forced colours drop fills (decision 0038): a dot is only a fill, so it keeps one in the\n text colour; a count gets an edge around its number */\n ", "\n \n ", "\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: ", ";\n white-space: nowrap;\n box-shadow: 0 0 0 ", " ", ";\n animation: ", " ", " ", ";\n\n ", " {\n animation: none;\n }\n\n /* Forced colours drop fills (decision 0038): a dot is only a fill, so it keeps one in the\n text colour; a count gets an edge around its number */\n ", "\n \n ", "\n"
|
|
28
|
+
// The count takes the indicator's colour, so each variant's content colour reaches it: inverse on
|
|
29
|
+
// the strong fill, on-fill on the accent fill (decision 0056)
|
|
30
|
+
])), function (props) {
|
|
29
31
|
return props.$isVisible ? 'flex' : 'none';
|
|
30
32
|
}, function (props) {
|
|
31
33
|
return props.$isDot ? dot.size : count.minWidth;
|
|
@@ -38,15 +40,21 @@ var BadgeIndicator = /*#__PURE__*/styled.span.withConfig({
|
|
|
38
40
|
}, function (props) {
|
|
39
41
|
switch (props.$variant) {
|
|
40
42
|
case 'accent':
|
|
41
|
-
return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text
|
|
43
|
+
return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text['on-fill'], ";\n ");
|
|
42
44
|
default:
|
|
43
45
|
return "\n background-color: ".concat(color.fill.emphasis, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
44
46
|
}
|
|
45
47
|
});
|
|
48
|
+
// The count takes the indicator's colour, so each variant's content colour reaches it: inverse on
|
|
49
|
+
// the strong fill, on-fill on the accent fill (decision 0056)
|
|
50
|
+
var Count = /*#__PURE__*/styled.span.withConfig({
|
|
51
|
+
displayName: "Badge__Count",
|
|
52
|
+
componentId: "sc-tjz4pp-2"
|
|
53
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font: ", ";\n text-transform: uppercase;\n"], ["\n font: ", ";\n text-transform: uppercase;\n"])), semantic.typography.caption);
|
|
46
54
|
var ScreenReaderOnly = /*#__PURE__*/styled.span.withConfig({
|
|
47
55
|
displayName: "Badge__ScreenReaderOnly",
|
|
48
|
-
componentId: "sc-tjz4pp-
|
|
49
|
-
})(
|
|
56
|
+
componentId: "sc-tjz4pp-3"
|
|
57
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), visuallyHidden);
|
|
50
58
|
var Badge = function Badge(_a) {
|
|
51
59
|
var children = _a.children,
|
|
52
60
|
_b = _a.count,
|
|
@@ -74,9 +82,7 @@ var Badge = function Badge(_a) {
|
|
|
74
82
|
"$isVisible": isVisible,
|
|
75
83
|
role: "status",
|
|
76
84
|
"aria-live": "polite",
|
|
77
|
-
children: [!dot && jsx(
|
|
78
|
-
variant: "caption",
|
|
79
|
-
color: "inverse",
|
|
85
|
+
children: [!dot && jsx(Count, {
|
|
80
86
|
children: displayCount
|
|
81
87
|
}), jsx(ScreenReaderOnly, {
|
|
82
88
|
children: label
|
|
@@ -84,7 +90,7 @@ var Badge = function Badge(_a) {
|
|
|
84
90
|
})]
|
|
85
91
|
});
|
|
86
92
|
};
|
|
87
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
93
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
88
94
|
|
|
89
95
|
export { Badge };
|
|
90
96
|
//# sourceMappingURL=Badge.mjs.map
|
|
@@ -47,8 +47,9 @@ export interface BoxProps {
|
|
|
47
47
|
borderBottom?: keyof Tokens['semantic']['color']['border'];
|
|
48
48
|
borderLeft?: keyof Tokens['semantic']['color']['border'];
|
|
49
49
|
/**
|
|
50
|
-
* Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards,
|
|
51
|
-
*
|
|
50
|
+
* Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards),
|
|
51
|
+
* `surface.overlay` (floating layers such as menus and dialogs), `surface.scrim`, or a
|
|
52
|
+
* `color.fill.*` fill such as `color.fill.muted`.
|
|
52
53
|
*/
|
|
53
54
|
bg?: BoxBackground;
|
|
54
55
|
color?: keyof Tokens['semantic']['color']['text'];
|
|
@@ -47,8 +47,9 @@ export interface BoxProps {
|
|
|
47
47
|
borderBottom?: keyof Tokens['semantic']['color']['border'];
|
|
48
48
|
borderLeft?: keyof Tokens['semantic']['color']['border'];
|
|
49
49
|
/**
|
|
50
|
-
* Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards,
|
|
51
|
-
*
|
|
50
|
+
* Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards),
|
|
51
|
+
* `surface.overlay` (floating layers such as menus and dialogs), `surface.scrim`, or a
|
|
52
|
+
* `color.fill.*` fill such as `color.fill.muted`.
|
|
52
53
|
*/
|
|
53
54
|
bg?: BoxBackground;
|
|
54
55
|
color?: keyof Tokens['semantic']['color']['text'];
|
|
@@ -15,7 +15,7 @@ var button = tokens.component.button,
|
|
|
15
15
|
var inset = semantic.space.inset;
|
|
16
16
|
var control = semantic.size.control;
|
|
17
17
|
// Base styles shared between button and link
|
|
18
|
-
var baseButtonStyles = "\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ".concat(tokens.semantic.space[100], ";\n height: max-content;\n cursor: pointer;\n border: none;\n text-decoration: none;\n transition: ").concat(semantic.motion.transition.feedback, ";\n white-space: nowrap;\n user-select: none;\n \n &:focus {\n outline: ").concat(button.focus.outline, ";\n outline-offset: ").concat(semantic.border.focusOffset, ";\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n ").concat(forcedColorsEdge, "\n");
|
|
18
|
+
var baseButtonStyles = "\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ".concat(tokens.semantic.space[100], ";\n height: max-content;\n cursor: pointer;\n border: none;\n text-decoration: none;\n transition: ").concat(semantic.motion.transition.feedback, ";\n white-space: nowrap;\n user-select: none;\n \n /* The system ring for keyboard focus only: a click doesn't leave it behind (P2, P5) */\n &:focus-visible {\n outline: ").concat(button.focus.outline, ";\n outline-offset: ").concat(semantic.border.focusOffset, ";\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n ").concat(forcedColorsEdge, "\n");
|
|
19
19
|
// Dynamic variant styles using component tokens
|
|
20
20
|
var getVariantStyles = function getVariantStyles(_a) {
|
|
21
21
|
var _b;
|
|
@@ -36,7 +36,7 @@ var CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
36
36
|
},
|
|
37
37
|
displayName: "ChipBase__CloseButton",
|
|
38
38
|
componentId: "sc-moa6zc-2"
|
|
39
|
-
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"])), tokens.semantic.space[200], chip.closeButton.size, chip.closeButton.size, tokens.semantic.space[0], semantic.size.label.medium, semantic.size.label.medium, tokens.semantic.radius.
|
|
39
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"])), tokens.semantic.space[200], chip.closeButton.size, chip.closeButton.size, tokens.semantic.space[0], semantic.size.label.medium, semantic.size.label.medium, tokens.semantic.radius.full, function (props) {
|
|
40
40
|
return props.$disabled ? 'not-allowed' : 'pointer';
|
|
41
41
|
}, semantic.motion.transition.feedback, tokens.semantic.color.fill['none-hover'], tokens.semantic.color.fill['none-pressed'], tokens.semantic.color.text.disabled, chip.focus.outline, semantic.border.focusOffset, chip["default"].borderRadius);
|
|
42
42
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -66,7 +66,7 @@ var IconButtonStyled = /*#__PURE__*/styled.button.withConfig({
|
|
|
66
66
|
},
|
|
67
67
|
displayName: "IconButton__IconButtonStyled",
|
|
68
68
|
componentId: "sc-k8b14t-0"
|
|
69
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n border: none;\n border-radius: ", ";\n transition: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n height: max-content;\n cursor: pointer;\n position: relative;\n\n min-width: ", ";\n min-height: ", ";\n padding: ", ";\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n ", "\n"], ["\n background-color: ", ";\n color: ", ";\n border: none;\n border-radius: ", ";\n transition: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n height: max-content;\n cursor: pointer;\n position: relative;\n\n min-width: ", ";\n min-height: ", ";\n padding: ", ";\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n ", "\n"])), function (_a) {
|
|
69
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n border: none;\n border-radius: ", ";\n transition: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n height: max-content;\n cursor: pointer;\n position: relative;\n\n min-width: ", ";\n min-height: ", ";\n padding: ", ";\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n /* The system ring for keyboard focus only: a click doesn't leave it behind (P2, P5) */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n ", "\n"], ["\n background-color: ", ";\n color: ", ";\n border: none;\n border-radius: ", ";\n transition: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n height: max-content;\n cursor: pointer;\n position: relative;\n\n min-width: ", ";\n min-height: ", ";\n padding: ", ";\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n /* The system ring for keyboard focus only: a click doesn't leave it behind (P2, P5) */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n ", "\n"])), function (_a) {
|
|
70
70
|
var $variant = _a.$variant;
|
|
71
71
|
return colours($variant).bg;
|
|
72
72
|
}, function (_a) {
|
|
@@ -4,7 +4,7 @@ export interface ProgressBarProps {
|
|
|
4
4
|
value: number;
|
|
5
5
|
/** Orientation of the progress bar */
|
|
6
6
|
variant?: 'horizontal' | 'vertical';
|
|
7
|
-
/** Fill colour: `default` is
|
|
7
|
+
/** Fill colour: `default` is the strongest neutral fill (`color.fill.emphasis`: near-black in light, near-white in dark); `success` and `error` use their status colours */
|
|
8
8
|
color?: 'success' | 'error' | 'default';
|
|
9
9
|
/** Height size for horizontal progress bar (default: md) */
|
|
10
10
|
height?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -4,7 +4,7 @@ export interface ProgressBarProps {
|
|
|
4
4
|
value: number;
|
|
5
5
|
/** Orientation of the progress bar */
|
|
6
6
|
variant?: 'horizontal' | 'vertical';
|
|
7
|
-
/** Fill colour: `default` is
|
|
7
|
+
/** Fill colour: `default` is the strongest neutral fill (`color.fill.emphasis`: near-black in light, near-white in dark); `success` and `error` use their status colours */
|
|
8
8
|
color?: 'success' | 'error' | 'default';
|
|
9
9
|
/** Height size for horizontal progress bar (default: md) */
|
|
10
10
|
height?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -5,7 +5,7 @@ export interface TagProps {
|
|
|
5
5
|
*/
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
/**
|
|
8
|
-
* Visual variant. Tag is neutral metadata: use `default`, or `emphasis` (
|
|
8
|
+
* Visual variant. Tag is neutral metadata: use `default`, or `emphasis` (the strongest neutral fill) to make a
|
|
9
9
|
* tag stand out. For a status, use `StatusLabel` (decision 0029).
|
|
10
10
|
* @default 'default'
|
|
11
11
|
*/
|
|
@@ -5,7 +5,7 @@ export interface TagProps {
|
|
|
5
5
|
*/
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
/**
|
|
8
|
-
* Visual variant. Tag is neutral metadata: use `default`, or `emphasis` (
|
|
8
|
+
* Visual variant. Tag is neutral metadata: use `default`, or `emphasis` (the strongest neutral fill) to make a
|
|
9
9
|
* tag stand out. For a status, use `StatusLabel` (decision 0029).
|
|
10
10
|
* @default 'default'
|
|
11
11
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FloatingAlign, type FloatingSide } from '../../../lib/floatingPosition.mjs';
|
|
3
|
+
export type TooltipSide = FloatingSide;
|
|
4
|
+
export type TooltipAlign = FloatingAlign;
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
/** The tooltip's text. In `label` mode it repeats the trigger's existing accessible name. */
|
|
7
|
+
text: string;
|
|
8
|
+
/**
|
|
9
|
+
* `label` (default) shows the name the trigger already has, such as an IconButton's
|
|
10
|
+
* `aria-label`, and is hidden from assistive technology so the name isn't announced twice.
|
|
11
|
+
* `description` adds non-essential help, linked to the trigger with `aria-describedby`. Hover
|
|
12
|
+
* text can't be reached on touch screens, so anything a user needs must be visible text.
|
|
13
|
+
* @default 'label'
|
|
14
|
+
*/
|
|
15
|
+
kind?: 'label' | 'description';
|
|
16
|
+
/**
|
|
17
|
+
* The side of the trigger it opens on. It flips to the opposite side when there's no room.
|
|
18
|
+
* @default 'top'
|
|
19
|
+
*/
|
|
20
|
+
side?: TooltipSide;
|
|
21
|
+
/**
|
|
22
|
+
* Where it lines up along the trigger's edge.
|
|
23
|
+
* @default 'center'
|
|
24
|
+
*/
|
|
25
|
+
align?: TooltipAlign;
|
|
26
|
+
/**
|
|
27
|
+
* Turns the tooltip off while keeping the trigger where it is, such as when the label it repeats
|
|
28
|
+
* is visible. Changing it never remounts the trigger.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** One focusable element: the trigger */
|
|
33
|
+
children: React.ReactElement;
|
|
34
|
+
/** Test identifier for the tooltip bubble */
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A short label or hint that appears beside a control on hover or keyboard focus (#326).
|
|
39
|
+
*
|
|
40
|
+
* Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
|
|
41
|
+
* moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
|
|
42
|
+
* blur, scroll and Escape. Doesn't open on touch.
|
|
43
|
+
*/
|
|
44
|
+
export declare const Tooltip: {
|
|
45
|
+
({ text, kind, side, align, disabled, children, "data-testid": dataTestId, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
displayName: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FloatingAlign, type FloatingSide } from '../../../lib/floatingPosition';
|
|
3
|
+
export type TooltipSide = FloatingSide;
|
|
4
|
+
export type TooltipAlign = FloatingAlign;
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
/** The tooltip's text. In `label` mode it repeats the trigger's existing accessible name. */
|
|
7
|
+
text: string;
|
|
8
|
+
/**
|
|
9
|
+
* `label` (default) shows the name the trigger already has, such as an IconButton's
|
|
10
|
+
* `aria-label`, and is hidden from assistive technology so the name isn't announced twice.
|
|
11
|
+
* `description` adds non-essential help, linked to the trigger with `aria-describedby`. Hover
|
|
12
|
+
* text can't be reached on touch screens, so anything a user needs must be visible text.
|
|
13
|
+
* @default 'label'
|
|
14
|
+
*/
|
|
15
|
+
kind?: 'label' | 'description';
|
|
16
|
+
/**
|
|
17
|
+
* The side of the trigger it opens on. It flips to the opposite side when there's no room.
|
|
18
|
+
* @default 'top'
|
|
19
|
+
*/
|
|
20
|
+
side?: TooltipSide;
|
|
21
|
+
/**
|
|
22
|
+
* Where it lines up along the trigger's edge.
|
|
23
|
+
* @default 'center'
|
|
24
|
+
*/
|
|
25
|
+
align?: TooltipAlign;
|
|
26
|
+
/**
|
|
27
|
+
* Turns the tooltip off while keeping the trigger where it is, such as when the label it repeats
|
|
28
|
+
* is visible. Changing it never remounts the trigger.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** One focusable element: the trigger */
|
|
33
|
+
children: React.ReactElement;
|
|
34
|
+
/** Test identifier for the tooltip bubble */
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A short label or hint that appears beside a control on hover or keyboard focus (#326).
|
|
39
|
+
*
|
|
40
|
+
* Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
|
|
41
|
+
* moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
|
|
42
|
+
* blur, scroll and Escape. Doesn't open on touch.
|
|
43
|
+
*/
|
|
44
|
+
export declare const Tooltip: {
|
|
45
|
+
({ text, kind, side, align, disabled, children, "data-testid": dataTestId, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
displayName: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import React, { useId, useRef, useState, useCallback, useEffect } from 'react';
|
|
5
|
+
import styled$module, { keyframes, css } from 'styled-components';
|
|
6
|
+
const styled = styled$module.default || styled$module;
|
|
7
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
+
import tokensJson from '../../../styles/tokens.json.mjs';
|
|
9
|
+
import { exitAnimation, forcedColorsEdge, visuallyHidden } from '../../../lib/styleUtils.mjs';
|
|
10
|
+
import { usePresence } from '../../../lib/usePresence.mjs';
|
|
11
|
+
import { useFloatingLayer } from '../../../lib/useFloatingLayer.mjs';
|
|
12
|
+
import { isKeyboardFocus } from '../../../lib/keyboardFocus.mjs';
|
|
13
|
+
|
|
14
|
+
var semantic = tokens.semantic;
|
|
15
|
+
var motion = tokensJson.semantic.motion;
|
|
16
|
+
// How long the pointer rests before the tooltip opens (#326)
|
|
17
|
+
var HINT_DELAY_MS = parseInt(motion.delay.hint, 10);
|
|
18
|
+
// Moving to another trigger within this window opens its tooltip at once, so a rail feels immediate
|
|
19
|
+
var SKIP_DELAY_MS = parseInt(motion.duration.slow, 10);
|
|
20
|
+
// The grace period for the pointer to cross from the trigger onto the tooltip (WCAG 1.4.13)
|
|
21
|
+
var CLOSE_GRACE_MS = parseInt(motion.duration.fast, 10);
|
|
22
|
+
// Shared by every Tooltip: only one is open at a time, and the next one opens at once while one
|
|
23
|
+
// is open or within the skip-delay window after it closed
|
|
24
|
+
var lastClosedAt = 0;
|
|
25
|
+
var active = null;
|
|
26
|
+
var fadeIn = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from { opacity: 0; }\n"], ["\n from { opacity: 0; }\n"
|
|
27
|
+
// A fade, so it needs no reduced-motion fallback (0015). Entrances decelerate (0037).
|
|
28
|
+
])));
|
|
29
|
+
// A fade, so it needs no reduced-motion fallback (0015). Entrances decelerate (0037).
|
|
30
|
+
var Bubble = /*#__PURE__*/styled.div.withConfig({
|
|
31
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
32
|
+
return !prop.startsWith('$');
|
|
33
|
+
},
|
|
34
|
+
displayName: "Tooltip__Bubble",
|
|
35
|
+
componentId: "sc-ajez94-0"
|
|
36
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /* Reset the popover defaults: it's placed with top and left */\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n overflow: visible;\n box-sizing: border-box;\n max-width: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n overflow-wrap: break-word;\n pointer-events: auto;\n animation: ", " ", " ", "\n ", ";\n\n ", "\n"], ["\n /* Reset the popover defaults: it's placed with top and left */\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n overflow: visible;\n box-sizing: border-box;\n max-width: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n overflow-wrap: break-word;\n pointer-events: auto;\n animation: ", " ", " ", "\n ", ";\n\n ", "\n"])), semantic.size[7500], semantic.space.inset.xs, semantic.space.inset.sm, semantic.radius.sm, semantic.color.fill.inverse, semantic.color.text.inverse, semantic.typography.small, fadeIn, semantic.motion.duration.fast, semantic.motion.easing.decelerate, function (_a) {
|
|
37
|
+
var $exiting = _a.$exiting;
|
|
38
|
+
return $exiting ? exitAnimation : css(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
39
|
+
}, forcedColorsEdge);
|
|
40
|
+
var Description = /*#__PURE__*/styled.span.withConfig({
|
|
41
|
+
displayName: "Tooltip__Description",
|
|
42
|
+
componentId: "sc-ajez94-1"
|
|
43
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"
|
|
44
|
+
// The trigger's wrapper takes no box of its own, so the trigger lays out as if unwrapped
|
|
45
|
+
])), visuallyHidden);
|
|
46
|
+
// The trigger's wrapper takes no box of its own, so the trigger lays out as if unwrapped
|
|
47
|
+
var Anchor = /*#__PURE__*/styled.span.withConfig({
|
|
48
|
+
displayName: "Tooltip__Anchor",
|
|
49
|
+
componentId: "sc-ajez94-2"
|
|
50
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: contents;\n"], ["\n display: contents;\n"
|
|
51
|
+
/**
|
|
52
|
+
* A short label or hint that appears beside a control on hover or keyboard focus (#326).
|
|
53
|
+
*
|
|
54
|
+
* Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
|
|
55
|
+
* moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
|
|
56
|
+
* blur, scroll and Escape. Doesn't open on touch.
|
|
57
|
+
*/])));
|
|
58
|
+
/**
|
|
59
|
+
* A short label or hint that appears beside a control on hover or keyboard focus (#326).
|
|
60
|
+
*
|
|
61
|
+
* Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
|
|
62
|
+
* moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
|
|
63
|
+
* blur, scroll and Escape. Doesn't open on touch.
|
|
64
|
+
*/
|
|
65
|
+
var Tooltip = function Tooltip(_a) {
|
|
66
|
+
var text = _a.text,
|
|
67
|
+
_b = _a.kind,
|
|
68
|
+
kind = _b === void 0 ? 'label' : _b,
|
|
69
|
+
_c = _a.side,
|
|
70
|
+
side = _c === void 0 ? 'top' : _c,
|
|
71
|
+
_d = _a.align,
|
|
72
|
+
align = _d === void 0 ? 'center' : _d,
|
|
73
|
+
_e = _a.disabled,
|
|
74
|
+
disabled = _e === void 0 ? false : _e,
|
|
75
|
+
children = _a.children,
|
|
76
|
+
dataTestId = _a["data-testid"];
|
|
77
|
+
var descriptionId = useId();
|
|
78
|
+
var anchorRef = useRef(null);
|
|
79
|
+
var bubbleRef = useRef(null);
|
|
80
|
+
var openTimer = useRef(undefined);
|
|
81
|
+
var closeTimer = useRef(undefined);
|
|
82
|
+
var owner = useState(function () {
|
|
83
|
+
return {};
|
|
84
|
+
})[0];
|
|
85
|
+
// Set by a press, so the focus that follows a click or tap doesn't reopen the tooltip
|
|
86
|
+
var pressed = useRef(false);
|
|
87
|
+
var _f = useState(false),
|
|
88
|
+
isOpen = _f[0],
|
|
89
|
+
setIsOpen = _f[1];
|
|
90
|
+
// Turned off while showing (its label became visible): close it on the same render
|
|
91
|
+
var _g = useState(disabled),
|
|
92
|
+
wasDisabled = _g[0],
|
|
93
|
+
setWasDisabled = _g[1];
|
|
94
|
+
if (wasDisabled !== disabled) {
|
|
95
|
+
setWasDisabled(disabled);
|
|
96
|
+
if (disabled) setIsOpen(false);
|
|
97
|
+
}
|
|
98
|
+
var _h = usePresence(isOpen),
|
|
99
|
+
isPresent = _h.isPresent,
|
|
100
|
+
isExiting = _h.isExiting;
|
|
101
|
+
var clearTimers = function clearTimers() {
|
|
102
|
+
clearTimeout(openTimer.current);
|
|
103
|
+
clearTimeout(closeTimer.current);
|
|
104
|
+
};
|
|
105
|
+
var close = useCallback(function () {
|
|
106
|
+
clearTimers();
|
|
107
|
+
if ((active === null || active === void 0 ? void 0 : active.owner) === owner) {
|
|
108
|
+
active = null;
|
|
109
|
+
lastClosedAt = Date.now();
|
|
110
|
+
}
|
|
111
|
+
setIsOpen(false);
|
|
112
|
+
}, [owner]);
|
|
113
|
+
var open = useCallback(function () {
|
|
114
|
+
clearTimers();
|
|
115
|
+
if (active && active.owner !== owner) active.close();
|
|
116
|
+
active = {
|
|
117
|
+
owner: owner,
|
|
118
|
+
close: close
|
|
119
|
+
};
|
|
120
|
+
setIsOpen(true);
|
|
121
|
+
}, [owner, close]);
|
|
122
|
+
var scheduleOpen = function scheduleOpen() {
|
|
123
|
+
clearTimeout(closeTimer.current);
|
|
124
|
+
if (isOpen || disabled) return;
|
|
125
|
+
// Moving straight from one trigger to the next (another tooltip still open) or just after one
|
|
126
|
+
// closed skips the delay, so a rail feels immediate
|
|
127
|
+
if (active || Date.now() - lastClosedAt < SKIP_DELAY_MS) return open();
|
|
128
|
+
clearTimeout(openTimer.current);
|
|
129
|
+
openTimer.current = setTimeout(open, HINT_DELAY_MS);
|
|
130
|
+
};
|
|
131
|
+
var scheduleClose = function scheduleClose() {
|
|
132
|
+
clearTimeout(openTimer.current);
|
|
133
|
+
clearTimeout(closeTimer.current);
|
|
134
|
+
closeTimer.current = setTimeout(close, CLOSE_GRACE_MS);
|
|
135
|
+
};
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
return function () {
|
|
138
|
+
clearTimers();
|
|
139
|
+
if ((active === null || active === void 0 ? void 0 : active.owner) === owner) active = null;
|
|
140
|
+
};
|
|
141
|
+
}, [owner]);
|
|
142
|
+
// While open: Escape closes it without moving focus, and before anything else hears the key
|
|
143
|
+
// (an Escape meant for the tooltip mustn't also close a Modal)
|
|
144
|
+
useEffect(function () {
|
|
145
|
+
if (!isOpen) return;
|
|
146
|
+
var onKeyDown = function onKeyDown(event) {
|
|
147
|
+
if (event.key !== 'Escape') return;
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
close();
|
|
150
|
+
};
|
|
151
|
+
window.addEventListener('keydown', onKeyDown, true);
|
|
152
|
+
return function () {
|
|
153
|
+
return window.removeEventListener('keydown', onKeyDown, true);
|
|
154
|
+
};
|
|
155
|
+
}, [isOpen, close]);
|
|
156
|
+
// In the top layer beside the trigger; scrolling or resizing closes it, since the trigger moves
|
|
157
|
+
useFloatingLayer({
|
|
158
|
+
isPresent: isPresent,
|
|
159
|
+
floatingRef: bubbleRef,
|
|
160
|
+
anchorRef: anchorRef,
|
|
161
|
+
side: side,
|
|
162
|
+
align: align,
|
|
163
|
+
onDetach: close
|
|
164
|
+
});
|
|
165
|
+
var child = React.Children.only(children);
|
|
166
|
+
var describedBy = [child.props['aria-describedby'], kind === 'description' ? descriptionId : undefined].filter(Boolean).join(' ') || undefined;
|
|
167
|
+
return jsxs(Anchor, {
|
|
168
|
+
ref: anchorRef,
|
|
169
|
+
onPointerEnter: function onPointerEnter(event) {
|
|
170
|
+
return event.pointerType !== 'touch' && scheduleOpen();
|
|
171
|
+
},
|
|
172
|
+
onPointerLeave: function onPointerLeave(event) {
|
|
173
|
+
return event.pointerType !== 'touch' && scheduleClose();
|
|
174
|
+
},
|
|
175
|
+
onFocus: function onFocus(event) {
|
|
176
|
+
// Keyboard focus opens it at once; a click's or tap's focus doesn't
|
|
177
|
+
if (pressed.current) {
|
|
178
|
+
pressed.current = false;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (!disabled && isKeyboardFocus(event.target)) open();
|
|
182
|
+
},
|
|
183
|
+
onBlur: function onBlur() {
|
|
184
|
+
// A press on an already focused trigger has no focus to skip; don't carry it over
|
|
185
|
+
pressed.current = false;
|
|
186
|
+
close();
|
|
187
|
+
},
|
|
188
|
+
// Pressing the trigger acts on it, so the hint has done its job
|
|
189
|
+
onPointerDown: function onPointerDown() {
|
|
190
|
+
pressed.current = true;
|
|
191
|
+
close();
|
|
192
|
+
},
|
|
193
|
+
children: [/*#__PURE__*/React.cloneElement(child, {
|
|
194
|
+
'aria-describedby': describedBy
|
|
195
|
+
}), kind === 'description' && jsx(Description, {
|
|
196
|
+
id: descriptionId,
|
|
197
|
+
children: text
|
|
198
|
+
}), isPresent &&
|
|
199
|
+
// Hidden from assistive technology: a label repeats the trigger's name, and a
|
|
200
|
+
// description reaches it through aria-describedby on the always-present text above
|
|
201
|
+
jsx(Bubble, {
|
|
202
|
+
ref: bubbleRef,
|
|
203
|
+
"aria-hidden": "true",
|
|
204
|
+
"$exiting": isExiting,
|
|
205
|
+
"data-testid": dataTestId,
|
|
206
|
+
children: text
|
|
207
|
+
})]
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
Tooltip.displayName = 'Tooltip';
|
|
211
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
212
|
+
|
|
213
|
+
export { Tooltip };
|
|
214
|
+
//# sourceMappingURL=Tooltip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -15,5 +15,6 @@ export * from './Divider/index.mjs';
|
|
|
15
15
|
export * from './Stack/index.mjs';
|
|
16
16
|
export * from './StatusLabel/index.mjs';
|
|
17
17
|
export * from './Tag/index.mjs';
|
|
18
|
+
export * from './Tooltip/index.mjs';
|
|
18
19
|
export * from './Typography/index.mjs';
|
|
19
20
|
export * from './AILabel/index.mjs';
|
|
@@ -32,7 +32,7 @@ var StyledOverlay = /*#__PURE__*/styled.div.withConfig({
|
|
|
32
32
|
var StyledActionSheet = /*#__PURE__*/styled.div.withConfig({
|
|
33
33
|
displayName: "ActionSheet__StyledActionSheet",
|
|
34
34
|
componentId: "sc-regbol-1"
|
|
35
|
-
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n box-shadow: ", ";\n max-height: 90vh;\n overflow-y: auto;\n z-index: ", ";\n animation: ", " ", " ", "", ";\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n"], ["\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n box-shadow: ", ";\n max-height: 90vh;\n overflow-y: auto;\n z-index: ", ";\n animation: ", " ", " ", "", ";\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n"])), tokens.semantic.surface.
|
|
35
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n box-shadow: ", ";\n max-height: 90vh;\n overflow-y: auto;\n z-index: ", ";\n animation: ", " ", " ", "", ";\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n"], ["\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n box-shadow: ", ";\n max-height: 90vh;\n overflow-y: auto;\n z-index: ", ";\n animation: ", " ", " ", "", ";\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n"])), tokens.semantic.surface.overlay, tokens.component.overlay.borderRadius, tokens.component.overlay.borderRadius, elevation.overlay, tokens.semantic.layer.modal, slideUp, motion.duration.slow, motion.easing.decelerate, function (_a) {
|
|
36
36
|
var $isExiting = _a.$isExiting;
|
|
37
37
|
return $isExiting && exitAnimation;
|
|
38
38
|
}, reducedMotion, fadeIn, motion.duration.slow, motion.easing.decelerate, function (_a) {
|
|
@@ -50,7 +50,7 @@ var StyledHeaderContent = /*#__PURE__*/styled.div.withConfig({
|
|
|
50
50
|
var StyledCloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
51
51
|
displayName: "ActionSheet__StyledCloseButton",
|
|
52
52
|
componentId: "sc-regbol-4"
|
|
53
|
-
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ", ";\n border: none;\n background: transparent;\n color: ", ";\n cursor: pointer;\n border-radius: ", ";\n transition: ", ";\n margin-left: ", ";\n \n &:hover {\n color: ", ";\n background-color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ", ";\n border: none;\n background: transparent;\n color: ", ";\n cursor: pointer;\n border-radius: ", ";\n transition: ", ";\n margin-left: ", ";\n \n &:hover {\n color: ", ";\n background-color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"])), space[200], color.icon.muted, tokens.semantic.radius.
|
|
53
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ", ";\n border: none;\n background: transparent;\n color: ", ";\n cursor: pointer;\n border-radius: ", ";\n transition: ", ";\n margin-left: ", ";\n \n &:hover {\n color: ", ";\n background-color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ", ";\n border: none;\n background: transparent;\n color: ", ";\n cursor: pointer;\n border-radius: ", ";\n transition: ", ";\n margin-left: ", ";\n \n &:hover {\n color: ", ";\n background-color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"])), space[200], color.icon.muted, tokens.semantic.radius.md, motion.transition.feedback, space[200], color.icon["default"], color.fill.muted, border.focus, border.focusOffset);
|
|
54
54
|
var StyledActionsList = /*#__PURE__*/styled.ul.withConfig({
|
|
55
55
|
displayName: "ActionSheet__StyledActionsList",
|
|
56
56
|
componentId: "sc-regbol-5"
|
|
@@ -269,6 +269,7 @@ var ActionSheet = function ActionSheet(_a) {
|
|
|
269
269
|
},
|
|
270
270
|
disabled: action.disabled,
|
|
271
271
|
destructive: action.destructive,
|
|
272
|
+
// Deprecated prop (0051), kept for this padding until 4.0 removes it
|
|
272
273
|
spacing: "compact"
|
|
273
274
|
})]
|
|
274
275
|
}, action.id);
|