@sentry/scraps 0.1.0 → 0.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.
Files changed (188) hide show
  1. package/README.md +13 -21
  2. package/dist/alert/alert.d.ts +25 -0
  3. package/dist/alert/alert.js +262 -0
  4. package/dist/alert/alertLink.d.ts +32 -0
  5. package/dist/alert/alertLink.js +94 -0
  6. package/dist/alert/index.d.ts +2 -0
  7. package/dist/alert/index.js +2 -0
  8. package/dist/backdrop/backdrop.d.ts +9 -0
  9. package/dist/backdrop/backdrop.js +28 -0
  10. package/dist/backdrop/index.d.ts +1 -0
  11. package/dist/backdrop/index.js +1 -0
  12. package/dist/badge/badge.d.ts +12 -0
  13. package/dist/badge/badge.js +80 -0
  14. package/dist/badge/featureBadge.d.ts +6 -0
  15. package/dist/badge/featureBadge.js +86 -0
  16. package/dist/badge/index.d.ts +3 -0
  17. package/dist/badge/index.js +3 -0
  18. package/dist/badge/tag.d.ts +15 -0
  19. package/dist/badge/tag.js +119 -0
  20. package/dist/boundaryContext.d.ts +2 -0
  21. package/dist/boundaryContext.js +5 -0
  22. package/dist/button/button.d.ts +3 -0
  23. package/dist/button/button.js +83 -0
  24. package/dist/button/buttonBar.d.ts +10 -0
  25. package/dist/button/buttonBar.js +135 -0
  26. package/dist/button/index.d.ts +5 -0
  27. package/dist/button/index.js +4 -0
  28. package/dist/button/linkButton.d.ts +3 -0
  29. package/dist/button/linkButton.js +110 -0
  30. package/dist/button/styles.d.ts +10 -0
  31. package/dist/button/styles.js +247 -0
  32. package/dist/button/types.d.ts +77 -0
  33. package/dist/button/types.js +0 -0
  34. package/dist/button/useButtonFunctionality.d.ts +5 -0
  35. package/dist/button/useButtonFunctionality.js +9 -0
  36. package/dist/checkbox/checkbox.d.ts +20 -0
  37. package/dist/checkbox/checkbox.js +193 -0
  38. package/dist/checkbox/index.d.ts +1 -0
  39. package/dist/checkbox/index.js +1 -0
  40. package/dist/chip/chip.d.ts +128 -0
  41. package/dist/chip/chip.js +364 -0
  42. package/dist/chip/index.d.ts +1 -0
  43. package/dist/chip/index.js +1 -0
  44. package/dist/code/inlineCode.d.ts +1 -0
  45. package/dist/datetime.d.ts +39 -0
  46. package/dist/datetime.js +20 -0
  47. package/dist/descriptionList/descriptionList.d.ts +69 -0
  48. package/dist/descriptionList/descriptionList.js +76 -0
  49. package/dist/descriptionList/index.d.ts +1 -0
  50. package/dist/descriptionList/index.js +1 -0
  51. package/dist/disclosure/disclosure.d.ts +37 -0
  52. package/dist/disclosure/disclosure.js +155 -0
  53. package/dist/disclosure/index.d.ts +1 -0
  54. package/dist/disclosure/index.js +1 -0
  55. package/dist/emptyState/emptyState.d.ts +10 -0
  56. package/dist/emptyState/emptyState.js +81 -0
  57. package/dist/emptyState/index.d.ts +1 -0
  58. package/dist/emptyState/index.js +1 -0
  59. package/dist/hotkey/hotkey.d.ts +22 -0
  60. package/dist/hotkey/hotkey.js +41 -0
  61. package/dist/hotkey/index.d.ts +4 -0
  62. package/dist/hotkey/index.js +3 -0
  63. package/dist/hotkey/kbd.d.ts +1 -0
  64. package/dist/hotkey/keyMappings.d.ts +23 -0
  65. package/dist/hotkey/keyMappings.js +223 -0
  66. package/dist/hotkey/useHotkeys.d.ts +47 -0
  67. package/dist/hotkey/useHotkeys.js +44 -0
  68. package/dist/image/image.d.ts +21 -0
  69. package/dist/image/image.js +20 -0
  70. package/dist/image/index.d.ts +1 -0
  71. package/dist/image/index.js +1 -0
  72. package/dist/info/index.d.ts +2 -0
  73. package/dist/info/index.js +2 -0
  74. package/dist/info/infoText.d.ts +15 -0
  75. package/dist/info/infoText.js +43 -0
  76. package/dist/info/infoTip.d.ts +10 -0
  77. package/dist/info/infoTip.js +54 -0
  78. package/dist/interactionStateLayer/index.d.ts +1 -0
  79. package/dist/interactionStateLayer/index.js +1 -0
  80. package/dist/interactionStateLayer/interactionStateLayer.d.ts +23 -0
  81. package/dist/interactionStateLayer/interactionStateLayer.js +67 -0
  82. package/dist/layout/flex.d.ts +1 -0
  83. package/dist/layout/grid.d.ts +1 -0
  84. package/dist/layout/index.d.ts +1 -1
  85. package/dist/layout/index.js +1 -1
  86. package/dist/layout/stack.d.ts +1 -0
  87. package/dist/layout/styles.d.ts +1 -1
  88. package/dist/layout/surface.d.ts +1 -0
  89. package/dist/link/index.d.ts +2 -0
  90. package/dist/link/index.js +2 -0
  91. package/dist/link/link.d.ts +43 -0
  92. package/dist/link/link.js +71 -0
  93. package/dist/link/linkBehaviorContext.d.ts +14 -0
  94. package/dist/link/linkBehaviorContext.js +31 -0
  95. package/dist/loader/indeterminateLoader.d.ts +1 -0
  96. package/dist/overlay.d.ts +59 -0
  97. package/dist/overlay.js +113 -0
  98. package/dist/overlayArrow.d.ts +9 -0
  99. package/dist/overlayArrow.js +55 -0
  100. package/dist/overlayPositioning.d.ts +61 -0
  101. package/dist/overlayPositioning.js +126 -0
  102. package/dist/panelProvider.d.ts +8 -0
  103. package/dist/panelProvider.js +20 -0
  104. package/dist/quote/quote.js +1 -1
  105. package/dist/radio/index.d.ts +1 -0
  106. package/dist/radio/index.js +1 -0
  107. package/dist/radio/radio.d.ts +9 -0
  108. package/dist/radio/radio.js +77 -0
  109. package/dist/renderToString.d.ts +2 -0
  110. package/dist/renderToString.js +25 -0
  111. package/dist/revealOnHover/index.d.ts +1 -0
  112. package/dist/revealOnHover/index.js +1 -0
  113. package/dist/revealOnHover/revealOnHover.d.ts +20 -0
  114. package/dist/revealOnHover/revealOnHover.js +62 -0
  115. package/dist/segmentedControl/index.d.ts +1 -0
  116. package/dist/segmentedControl/index.js +1 -0
  117. package/dist/segmentedControl/segmentedControl.d.ts +41 -0
  118. package/dist/segmentedControl/segmentedControl.js +217 -0
  119. package/dist/separator/separator.d.ts +4 -3
  120. package/dist/separator/separator.js +1 -1
  121. package/dist/sizeContext.d.ts +9 -0
  122. package/dist/sizeContext.js +13 -0
  123. package/dist/slider/index.d.ts +1 -0
  124. package/dist/slider/index.js +1 -0
  125. package/dist/slider/slider.d.ts +41 -0
  126. package/dist/slider/slider.js +386 -0
  127. package/dist/slot/index.d.ts +1 -0
  128. package/dist/slot/index.js +1 -0
  129. package/dist/slot/knownContexts.d.ts +1 -0
  130. package/dist/slot/knownContexts.js +7 -0
  131. package/dist/slot/slot.d.ts +26 -0
  132. package/dist/slot/slot.js +274 -0
  133. package/dist/statusIndicator/index.d.ts +1 -0
  134. package/dist/statusIndicator/index.js +1 -0
  135. package/dist/statusIndicator/statusIndicator.d.ts +24 -0
  136. package/dist/statusIndicator/statusIndicator.js +130 -0
  137. package/dist/switch/index.d.ts +1 -0
  138. package/dist/switch/index.js +1 -0
  139. package/dist/switch/switch.d.ts +6 -0
  140. package/dist/switch/switch.js +172 -0
  141. package/dist/text/heading.d.ts +1 -0
  142. package/dist/text/index.d.ts +1 -0
  143. package/dist/text/index.js +1 -0
  144. package/dist/text/prose.d.ts +8 -0
  145. package/dist/text/prose.js +45 -0
  146. package/dist/text/text.d.ts +1 -0
  147. package/dist/theme/dark.d.ts +129 -10
  148. package/dist/theme/dark.js +41 -13
  149. package/dist/theme/index.d.ts +3 -12
  150. package/dist/theme/index.js +2 -2
  151. package/dist/theme/light.d.ts +129 -10
  152. package/dist/theme/light.js +42 -14
  153. package/dist/theme/swatch.d.ts +27 -0
  154. package/dist/theme/swatch.js +37 -0
  155. package/dist/theme/theme.d.ts +648 -0
  156. package/dist/theme/theme.js +780 -0
  157. package/dist/theme/types.d.ts +1 -0
  158. package/dist/theme/useInvertedTheme.d.ts +1 -0
  159. package/dist/theme/useInvertedTheme.js +7 -0
  160. package/dist/tooltip/index.d.ts +2 -0
  161. package/dist/tooltip/index.js +2 -0
  162. package/dist/tooltip/tooltip.d.ts +166 -0
  163. package/dist/tooltip/tooltip.js +181 -0
  164. package/dist/tooltip/useDisabledTooltip.d.ts +22 -0
  165. package/dist/tooltip/useDisabledTooltip.js +24 -0
  166. package/dist/trackingContext.d.ts +34 -0
  167. package/dist/trackingContext.js +29 -0
  168. package/dist/translation/index.d.ts +4 -0
  169. package/dist/translation/index.js +4 -0
  170. package/dist/translation/translationContext.d.ts +6 -0
  171. package/dist/translation/translationContext.js +6 -0
  172. package/dist/translation/useTranslation.d.ts +1 -0
  173. package/dist/translation/useTranslation.js +6 -0
  174. package/dist/unreachable.d.ts +1 -0
  175. package/dist/unreachable.js +4 -0
  176. package/dist/useHoverOverlay.d.ts +113 -0
  177. package/dist/useHoverOverlay.js +370 -0
  178. package/dist/useIsInsideInteractiveElement.d.ts +6 -0
  179. package/dist/useIsInsideInteractiveElement.js +31 -0
  180. package/dist/useOverlay.d.ts +82 -0
  181. package/dist/useOverlay.js +216 -0
  182. package/dist/useScrollLock.d.ts +5 -0
  183. package/dist/useScrollLock.js +100 -0
  184. package/dist/useStableMergeRef.d.ts +9 -0
  185. package/dist/useStableMergeRef.js +18 -0
  186. package/package.json +193 -11
  187. package/dist/index.d.ts +0 -9
  188. package/dist/index.js +0 -9
@@ -73,6 +73,7 @@ export type TagVariant = 'muted' | 'info' | 'success' | 'warning' | 'danger' | '
73
73
  * Alert/status color scheme.
74
74
  */
75
75
  export type AlertVariant = 'muted' | 'info' | 'warning' | 'success' | 'danger';
76
+ export type ButtonVariant = 'secondary' | 'primary' | 'danger' | 'warning' | 'link' | 'transparent';
76
77
  type SizeKeys = readonly ['0', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'];
77
78
  type Size = SizeKeys[number];
78
79
  type ExtractRange<T extends readonly string[], Start extends string, End extends string, Collecting extends boolean = false, Acc extends string = never> = T extends readonly [infer Head extends string, ...infer Tail extends string[]] ? Head extends Start ? Head extends End ? Acc | Head : ExtractRange<Tail, Start, End, true, Acc | Head> : Collecting extends true ? Head extends End ? Acc | Head : ExtractRange<Tail, Start, End, true, Acc | Head> : ExtractRange<Tail, Start, End, false, Acc> : Acc;
@@ -0,0 +1 @@
1
+ export declare const useInvertedTheme: () => import("./theme.js").SentryTheme;
@@ -0,0 +1,7 @@
1
+ import { useTheme } from "@emotion/react";
2
+ import { darkTheme, lightTheme } from "./theme.js";
3
+ const useInvertedTheme = ()=>{
4
+ const theme = useTheme();
5
+ return 'light' === theme.type ? darkTheme : lightTheme;
6
+ };
7
+ export { useInvertedTheme };
@@ -0,0 +1,2 @@
1
+ export { Tooltip, TooltipContext, type TooltipProps } from './tooltip.js';
2
+ export { useDisabledTooltip } from './useDisabledTooltip.js';
@@ -0,0 +1,2 @@
1
+ export { Tooltip, TooltipContext } from "./tooltip.js";
2
+ export { useDisabledTooltip } from "./useDisabledTooltip.js";
@@ -0,0 +1,166 @@
1
+ import type * as React from 'react';
2
+ import { type GridProps } from '../layout/index.js';
3
+ import type { UseHoverOverlayProps } from '../useHoverOverlay.js';
4
+ interface TooltipContextProps {
5
+ /**
6
+ * Specifies the DOM node where the tooltip should be rendered.
7
+ * This is particularly useful for making the tooltip interactive within specific contexts,
8
+ * such as inside a modal. By default the tooltip is rendered in the 'document.body'.
9
+ */
10
+ container: Element | DocumentFragment | null;
11
+ }
12
+ export declare const TooltipContext: React.Context<TooltipContextProps>;
13
+ export interface TooltipProps extends UseHoverOverlayProps {
14
+ /**
15
+ * The content to show in the tooltip popover.
16
+ */
17
+ title: React.ReactNode;
18
+ children?: React.ReactNode;
19
+ /**
20
+ * Disable the tooltip display entirely.
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * The max width the tooltip is allowed to grow, or `'none'` to let it size
25
+ * to its content.
26
+ */
27
+ maxWidth?: number | 'none';
28
+ }
29
+ declare function TooltipComponent({ children, title, disabled, maxWidth, ...hoverOverlayProps }: TooltipProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("@emotion/react/jsx-runtime").JSX.Element | null | undefined;
30
+ /** @internal */
31
+ export declare const TooltipContent: import("@emotion/styled").StyledComponent<import("../overlay.js").OverlayProps & {
32
+ theme?: import("@emotion/react").Theme;
33
+ } & {
34
+ maxWidth?: number | "none";
35
+ }, {}, {}>;
36
+ interface TooltipHeaderProps {
37
+ /**
38
+ * What the section describes, e.g. "Last Seen".
39
+ */
40
+ children: React.ReactNode;
41
+ /**
42
+ * Rendered before the label, e.g. an icon identifying what the section is
43
+ * about. Rendered as given, so that a graphic is not forced into text styles.
44
+ */
45
+ leadingItems?: React.ReactNode;
46
+ /**
47
+ * Value pinned to the opposite edge of the header, e.g. the relative time the
48
+ * rows below resolve.
49
+ */
50
+ trailingItems?: React.ReactNode;
51
+ }
52
+ /**
53
+ * Names what the section below it describes. Written in sentence case — weight
54
+ * and position carry the hierarchy, so it is deliberately not uppercased and
55
+ * carries no bottom border.
56
+ */
57
+ declare function TooltipHeader({ children, leadingItems, trailingItems }: TooltipHeaderProps): import("@emotion/react/jsx-runtime").JSX.Element;
58
+ interface TooltipGridProps {
59
+ children: React.ReactNode;
60
+ /**
61
+ * The column tracks rows are laid out in. `Tooltip.Row` renders its cells
62
+ * straight into these tracks, so a column stays aligned across every row even
63
+ * when one row's cell is wider than the same cell in the row above.
64
+ *
65
+ * A row with both `leadingItems` and `trailingItems` occupies three tracks,
66
+ * which is `'max-content 1fr max-content'`.
67
+ *
68
+ * @default '1fr'
69
+ */
70
+ columns?: GridProps['columns'];
71
+ /**
72
+ * @default '2xs sm'
73
+ */
74
+ gap?: GridProps['gap'];
75
+ }
76
+ /**
77
+ * The padded region a tooltip's rows are laid out in, and the grid those rows
78
+ * share.
79
+ *
80
+ * Text reads from the left here, undoing the centring the overlay applies for
81
+ * the sentence case. A cell that wants otherwise, a value pinned to the right
82
+ * edge say, sets that on itself.
83
+ */
84
+ declare function TooltipGrid({ children, columns, gap }: TooltipGridProps): import("@emotion/react/jsx-runtime").JSX.Element;
85
+ interface TooltipRowProps {
86
+ /**
87
+ * The row's main cell.
88
+ */
89
+ children: React.ReactNode;
90
+ /**
91
+ * Cell before the main one, e.g. what the row's value is labelled by.
92
+ */
93
+ leadingItems?: React.ReactNode;
94
+ /**
95
+ * Cell after the main one.
96
+ */
97
+ trailingItems?: React.ReactNode;
98
+ }
99
+ /**
100
+ * One row of a `Tooltip.Grid`, as up to three cells.
101
+ *
102
+ * Renders as `display: contents` so that those cells become grid items of the
103
+ * grid itself rather than of a nested box — a row that established its own
104
+ * layout box would align its columns only against itself, which is the whole
105
+ * thing a shared grid is for. Rows in one grid should therefore fill the same
106
+ * tracks as each other.
107
+ */
108
+ declare function TooltipRow({ children, leadingItems, trailingItems }: TooltipRowProps): import("@emotion/react/jsx-runtime").JSX.Element;
109
+ interface TooltipFooterProps {
110
+ children: React.ReactNode;
111
+ /**
112
+ * Rendered before the label, e.g. an icon. Rendered as given, so that a
113
+ * graphic is not forced into text styles.
114
+ */
115
+ leadingItems?: React.ReactNode;
116
+ /**
117
+ * Value pinned to the opposite edge of the footer.
118
+ */
119
+ trailingItems?: React.ReactNode;
120
+ }
121
+ /**
122
+ * Trailing note for a tooltip, e.g. what the rows above are qualified by. Muted
123
+ * so it reads as secondary to them.
124
+ */
125
+ declare function TooltipFooter({ children, leadingItems, trailingItems }: TooltipFooterProps): import("@emotion/react/jsx-runtime").JSX.Element;
126
+ /**
127
+ * Tooltips show contextual information about an element on hover.
128
+ *
129
+ * For content that is a row of labelled values rather than a sentence, compose
130
+ * it from the sections rather than passing a block of markup. Sections pull back
131
+ * out to the overlay's edges and re-apply the padding themselves, so a full
132
+ * width row reaches the edges while its content stays inset. Nothing to pass:
133
+ *
134
+ * ```tsx
135
+ * <Tooltip
136
+ * title={
137
+ * <Fragment>
138
+ * <Tooltip.Header trailingItems="8mo ago">Last Seen</Tooltip.Header>
139
+ * <Tooltip.Grid columns="max-content 1fr max-content">
140
+ * <Tooltip.Row leadingItems={<Tag>UTC</Tag>} trailingItems={time}>
141
+ * {date}
142
+ * </Tooltip.Row>
143
+ * </Tooltip.Grid>
144
+ * </Fragment>
145
+ * }
146
+ * >
147
+ * {trigger}
148
+ * </Tooltip>
149
+ * ```
150
+ *
151
+ * That holds wherever the sections are rendered from. A component that renders
152
+ * them internally is covered too, because its sections are still the overlay's
153
+ * own children in the DOM.
154
+ *
155
+ * Sections set their own text alignment, because a tooltip centers its content
156
+ * by default — right for a sentence, wrong for a row of labelled values. Cells
157
+ * passed to a `Tooltip.Row` are yours to align. They set no font size, so they
158
+ * inherit the tooltip's.
159
+ */
160
+ export declare const Tooltip: typeof TooltipComponent & {
161
+ Header: typeof TooltipHeader;
162
+ Grid: typeof TooltipGrid;
163
+ Row: typeof TooltipRow;
164
+ Footer: typeof TooltipFooter;
165
+ };
166
+ export {};
@@ -0,0 +1,181 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Fragment, createContext, useContext, useLayoutEffect } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import { useTheme } from "@emotion/react";
5
+ import styled from "@emotion/styled";
6
+ import { AnimatePresence } from "framer-motion";
7
+ import { Container, Flex, Grid } from "../layout/index.js";
8
+ import { Overlay, PositionWrapper } from "../overlay.js";
9
+ import { Text } from "../text/text.js";
10
+ import { useHoverOverlay } from "../useHoverOverlay.js";
11
+ const TooltipContext = /*#__PURE__*/ createContext({
12
+ container: null
13
+ });
14
+ function TooltipComponent({ children, title, disabled = false, maxWidth, ...hoverOverlayProps }) {
15
+ const theme = useTheme();
16
+ const { container } = useContext(TooltipContext);
17
+ const { wrapTrigger, isOpen, snapClosed, overlayProps, placement, arrowData, arrowProps, reset } = useHoverOverlay({
18
+ ...hoverOverlayProps
19
+ });
20
+ useLayoutEffect(()=>{
21
+ if (disabled && isOpen) reset();
22
+ }, [
23
+ reset,
24
+ disabled,
25
+ isOpen
26
+ ]);
27
+ if (disabled || !title) return children;
28
+ return /*#__PURE__*/ jsxs(Fragment, {
29
+ children: [
30
+ wrapTrigger(children),
31
+ "u" > typeof document && /*#__PURE__*/ createPortal(snapClosed ? null : /*#__PURE__*/ jsx(AnimatePresence, {
32
+ children: isOpen ? /*#__PURE__*/ jsx(PositionWrapper, {
33
+ zIndex: theme.zIndex.tooltip,
34
+ ...overlayProps,
35
+ onClick: stopPropagation,
36
+ onMouseDown: stopPropagation,
37
+ onPointerDown: stopPropagation,
38
+ children: /*#__PURE__*/ jsx(TooltipContent, {
39
+ animated: true,
40
+ maxWidth: maxWidth,
41
+ arrowProps: arrowProps,
42
+ originPoint: arrowData,
43
+ placement: placement,
44
+ "data-tooltip": true,
45
+ children: title
46
+ })
47
+ }) : null
48
+ }), container ?? document.body)
49
+ ]
50
+ });
51
+ }
52
+ function stopPropagation(e) {
53
+ e.stopPropagation();
54
+ }
55
+ const TooltipContent = styled(Overlay, {
56
+ shouldForwardProp: (prop)=>'maxWidth' !== prop
57
+ })`
58
+ padding: ${(p)=>p.theme.space.md} ${(p)=>p.theme.space.lg};
59
+
60
+ /*
61
+ * Sections pull back out to the overlay's edges, cancelling the padding above
62
+ * so that a full width row or separator can reach them, and re-applying it
63
+ * themselves so their own content stays inset.
64
+ */
65
+ > [data-tooltip-section] {
66
+ margin-inline: calc(-1 * ${(p)=>p.theme.space.lg});
67
+ margin-block-start: calc(-1 * ${(p)=>p.theme.space.md});
68
+ }
69
+
70
+ /*
71
+ * Only the outermost sections cancel the block padding — doing it on every
72
+ * one would collapse the space between two of them, since adjacent negative
73
+ * margins compound. This cannot key off the first child, because the overlay
74
+ * renders its arrow ahead of the content, so a section is never first.
75
+ */
76
+ > [data-tooltip-section] ~ [data-tooltip-section] {
77
+ margin-block-start: 0;
78
+ }
79
+
80
+ > [data-tooltip-section]:last-child {
81
+ margin-block-end: calc(-1 * ${(p)=>p.theme.space.md});
82
+ }
83
+
84
+ overflow-wrap: break-word;
85
+ max-width: ${(p)=>'none' === p.maxWidth ? 'none' : `${p.maxWidth ?? 225}px`};
86
+ color: ${(p)=>p.theme.tokens.content.primary};
87
+ font-size: ${(p)=>p.theme.font.size.sm};
88
+ line-height: 1.2;
89
+ text-align: center;
90
+ `;
91
+ function TooltipHeader({ children, leadingItems, trailingItems }) {
92
+ return /*#__PURE__*/ jsxs(Flex, {
93
+ align: "center",
94
+ justify: "between",
95
+ gap: "xs",
96
+ padding: "md lg",
97
+ "data-tooltip-section": true,
98
+ children: [
99
+ /*#__PURE__*/ jsxs(Flex, {
100
+ align: "center",
101
+ gap: "xs",
102
+ children: [
103
+ leadingItems,
104
+ /*#__PURE__*/ jsx(Text, {
105
+ bold: true,
106
+ align: "left",
107
+ children: children
108
+ })
109
+ ]
110
+ }),
111
+ defined(trailingItems) && /*#__PURE__*/ jsx(Text, {
112
+ bold: true,
113
+ align: "right",
114
+ wrap: "nowrap",
115
+ children: trailingItems
116
+ })
117
+ ]
118
+ });
119
+ }
120
+ function TooltipGrid({ children, columns = '1fr', gap = '2xs sm' }) {
121
+ return /*#__PURE__*/ jsx(GridSection, {
122
+ columns: columns,
123
+ gap: gap,
124
+ align: "center",
125
+ padding: "md lg",
126
+ "data-tooltip-section": true,
127
+ children: children
128
+ });
129
+ }
130
+ const GridSection = styled(Grid)`
131
+ text-align: left;
132
+ `;
133
+ function TooltipRow({ children, leadingItems, trailingItems }) {
134
+ return /*#__PURE__*/ jsxs(Container, {
135
+ display: "contents",
136
+ children: [
137
+ leadingItems,
138
+ children,
139
+ trailingItems
140
+ ]
141
+ });
142
+ }
143
+ function TooltipFooter({ children, leadingItems, trailingItems }) {
144
+ return /*#__PURE__*/ jsxs(Flex, {
145
+ align: "center",
146
+ justify: "between",
147
+ gap: "xs",
148
+ padding: "md lg",
149
+ "data-tooltip-section": true,
150
+ children: [
151
+ /*#__PURE__*/ jsxs(Flex, {
152
+ align: "center",
153
+ gap: "xs",
154
+ children: [
155
+ leadingItems,
156
+ /*#__PURE__*/ jsx(Text, {
157
+ variant: "muted",
158
+ align: "left",
159
+ children: children
160
+ })
161
+ ]
162
+ }),
163
+ defined(trailingItems) && /*#__PURE__*/ jsx(Text, {
164
+ variant: "muted",
165
+ align: "right",
166
+ wrap: "nowrap",
167
+ children: trailingItems
168
+ })
169
+ ]
170
+ });
171
+ }
172
+ const Tooltip = Object.assign(TooltipComponent, {
173
+ Header: TooltipHeader,
174
+ Grid: TooltipGrid,
175
+ Row: TooltipRow,
176
+ Footer: TooltipFooter
177
+ });
178
+ function defined(value) {
179
+ return null != value;
180
+ }
181
+ export { Tooltip, TooltipContent, TooltipContext };
@@ -0,0 +1,22 @@
1
+ import type * as React from 'react';
2
+ import type { TooltipProps } from './tooltip.js';
3
+ interface DisabledTooltipOptions<Element extends HTMLElement> extends Pick<React.HTMLAttributes<Element>, 'aria-disabled' | 'onKeyDown'> {
4
+ disabled?: boolean;
5
+ tooltipProps?: Pick<TooltipProps, 'title' | 'disabled'>;
6
+ }
7
+ /**
8
+ * Keeps disabled controls focusable when they have a tooltip and prevents keyboard activation.
9
+ *
10
+ * `aria-disabled` does not stop native behavior, so when `isFocusableDisabled` is true
11
+ * callers must also block any other interaction their element supports (for example
12
+ * click/change events and form participation for inputs).
13
+ */
14
+ export declare function useDisabledTooltip<Element extends HTMLElement>({ disabled, tooltipProps, onKeyDown, 'aria-disabled': ariaDisabled, }: DisabledTooltipOptions<Element>): {
15
+ isFocusableDisabled: boolean;
16
+ disabledProps: {
17
+ disabled: boolean | undefined;
18
+ 'aria-disabled': (boolean | "true" | "false") | undefined;
19
+ onKeyDown: (event: React.KeyboardEvent<Element>) => void;
20
+ };
21
+ };
22
+ export {};
@@ -0,0 +1,24 @@
1
+ import { useCallback } from "react";
2
+ function useDisabledTooltip({ disabled, tooltipProps, onKeyDown, 'aria-disabled': ariaDisabled }) {
3
+ const isFocusableDisabled = Boolean(disabled && tooltipProps?.title && !tooltipProps.disabled);
4
+ const handleKeyDown = useCallback((event)=>{
5
+ if (isFocusableDisabled && ('Enter' === event.key || ' ' === event.key)) {
6
+ event.preventDefault();
7
+ event.stopPropagation();
8
+ return;
9
+ }
10
+ onKeyDown?.(event);
11
+ }, [
12
+ isFocusableDisabled,
13
+ onKeyDown
14
+ ]);
15
+ return {
16
+ isFocusableDisabled,
17
+ disabledProps: {
18
+ disabled: isFocusableDisabled ? void 0 : disabled,
19
+ 'aria-disabled': isFocusableDisabled || ariaDisabled,
20
+ onKeyDown: handleKeyDown
21
+ }
22
+ };
23
+ }
24
+ export { useDisabledTooltip };
@@ -0,0 +1,34 @@
1
+ import type * as React from 'react';
2
+ import type { ButtonVariant } from './theme/index.js';
3
+ export interface AnalyticsProps {
4
+ /**
5
+ * Used when you want to overwrite the default Reload event key for analytics
6
+ */
7
+ analyticsEventKey?: string;
8
+ /**
9
+ * Used when you want to send an Amplitude Event. By default, Amplitude events are not sent so
10
+ * you must pass in a eventName to send an Amplitude event.
11
+ */
12
+ analyticsEventName?: string;
13
+ /**
14
+ * Adds extra parameters to the analytics tracking
15
+ */
16
+ analyticsParams?: Record<string, unknown>;
17
+ }
18
+ type ClickTrackingType = 'button' | 'link';
19
+ interface ClickableProps<Element extends HTMLElement> extends AnalyticsProps {
20
+ 'aria-label'?: string;
21
+ busy?: boolean;
22
+ children?: React.ReactNode;
23
+ disabled?: boolean;
24
+ onClick?: React.MouseEventHandler<Element>;
25
+ variant?: ButtonVariant;
26
+ }
27
+ export type TrackingProps = AnalyticsProps & Record<string, unknown> & {
28
+ clickType: ClickTrackingType;
29
+ };
30
+ export declare const TrackingContextProvider: React.Provider<(props: TrackingProps) => void>;
31
+ export declare const useClickTracking: <Element extends HTMLElement>(props: ClickableProps<Element>, clickType: ClickTrackingType) => {
32
+ handleClick: (e: React.MouseEvent<Element>) => void;
33
+ };
34
+ export {};
@@ -0,0 +1,29 @@
1
+ import { createContext, useContext } from "react";
2
+ const TrackingContext = /*#__PURE__*/ createContext(()=>{});
3
+ const TrackingContextProvider = TrackingContext.Provider;
4
+ const useClickTracking = (props, clickType)=>{
5
+ const clickTracking = useContext(TrackingContext);
6
+ const accessibleLabel = props['aria-label'] ?? ('string' == typeof props.children ? props.children : void 0);
7
+ const handleClick = (e)=>{
8
+ if (props.disabled || 'busy' in props && props.busy) {
9
+ e.preventDefault();
10
+ e.stopPropagation();
11
+ return;
12
+ }
13
+ clickTracking({
14
+ clickType,
15
+ analyticsEventName: props.analyticsEventName,
16
+ analyticsEventKey: props.analyticsEventKey,
17
+ analyticsParams: {
18
+ variant: 'variant' in props ? props.variant : void 0,
19
+ ...props.analyticsParams
20
+ },
21
+ 'aria-label': accessibleLabel || ''
22
+ });
23
+ props.onClick?.(e);
24
+ };
25
+ return {
26
+ handleClick
27
+ };
28
+ };
29
+ export { TrackingContextProvider, useClickTracking };
@@ -0,0 +1,4 @@
1
+ /** @public */
2
+ export type { TranslationContextValue } from './translationContext.js';
3
+ export declare const TranslationContextProvider: import("react").Provider<import("./translationContext.js").TranslationContextValue>;
4
+ export { useTranslation } from './useTranslation.js';
@@ -0,0 +1,4 @@
1
+ import { TranslationContext } from "./translationContext.js";
2
+ const TranslationContextProvider = TranslationContext.Provider;
3
+ export { useTranslation } from "./useTranslation.js";
4
+ export { TranslationContextProvider };
@@ -0,0 +1,6 @@
1
+ import type * as React from 'react';
2
+ export type TranslationContextValue = {
3
+ t: (string: string, ...args: Array<React.ReactNode | Record<string, React.ReactNode>>) => string;
4
+ tct: (template: string, components: Record<string, React.ReactNode>) => React.ReactNode;
5
+ };
6
+ export declare const TranslationContext: React.Context<TranslationContextValue>;
@@ -0,0 +1,6 @@
1
+ import { createContext } from "react";
2
+ const TranslationContext = /*#__PURE__*/ createContext({
3
+ t: (string)=>string,
4
+ tct: (template)=>template
5
+ });
6
+ export { TranslationContext };
@@ -0,0 +1 @@
1
+ export declare function useTranslation(): import("./translationContext.js").TranslationContextValue;
@@ -0,0 +1,6 @@
1
+ import { useContext } from "react";
2
+ import { TranslationContext } from "./translationContext.js";
3
+ function useTranslation() {
4
+ return useContext(TranslationContext);
5
+ }
6
+ export { useTranslation };
@@ -0,0 +1 @@
1
+ export declare function unreachable(value: never): never;
@@ -0,0 +1,4 @@
1
+ function unreachable(value) {
2
+ return value;
3
+ }
4
+ export { unreachable };
@@ -0,0 +1,113 @@
1
+ import type * as React from 'react';
2
+ import type { CSS } from './cssTypes.js';
3
+ import type { OverlayPlacement } from './overlayPositioning.js';
4
+ /**
5
+ * Scopes a delay group to a React subtree. Overlays inside the provider share
6
+ * warmth and snap-close coordination only with each other. Intended for tests
7
+ * (each `render()` gets a fresh group automatically) and any future scenario
8
+ * that needs isolated groups (e.g. a fullscreen modal).
9
+ */
10
+ export declare function HoverOverlayGroupProvider({ children }: {
11
+ children: React.ReactNode;
12
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
13
+ type UnderlineColor = 'warning' | 'danger' | 'success' | 'muted' | 'primary';
14
+ interface UseHoverOverlayProps {
15
+ /**
16
+ * className for when a wrapper is used. Does nothing using skipWrapper.
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Display mode for the container element. Does nothing using skipWrapper.
21
+ */
22
+ containerDisplayMode?: CSS['display'];
23
+ /**
24
+ * Time to wait (in milliseconds) before showing the overlay
25
+ */
26
+ delay?: number;
27
+ /**
28
+ * Time in ms until the overlay is hidden. This is the time allowed for the
29
+ * user to move their cursor into the overlay.
30
+ */
31
+ displayTimeout?: number;
32
+ /**
33
+ * Force the overlay to be visible without hovering. `true` opens
34
+ * immediately, while `delayed` uses the normal open delay.
35
+ */
36
+ forceVisible?: boolean | 'delayed';
37
+ /**
38
+ * Offset along the main axis.
39
+ */
40
+ offset?: number;
41
+ /**
42
+ * Callback whenever the hovercard is blurred
43
+ * See also `onHover`
44
+ */
45
+ onBlur?: () => void;
46
+ /**
47
+ * Callback whenever the hovercard is hovered
48
+ * See also `onBlur`
49
+ */
50
+ onHover?: () => void;
51
+ /**
52
+ * Called when the trigger changes between overflowing and fitting.
53
+ */
54
+ onOverflowChange?: (isOverflowing: boolean) => void;
55
+ /**
56
+ * Position for the overlay.
57
+ */
58
+ position?: OverlayPlacement;
59
+ /**
60
+ * Only display the overlay only if the content overflows
61
+ */
62
+ showOnlyOnOverflow?: boolean;
63
+ /**
64
+ * Whether to add a dotted underline to the trigger element, to indicate the
65
+ * presence of an overlay.
66
+ */
67
+ showUnderline?: boolean;
68
+ /**
69
+ * If child node supports ref forwarding, you can skip apply a wrapper
70
+ */
71
+ skipWrapper?: boolean;
72
+ /**
73
+ * style for when a wrapper is used. Does nothing using skipWrapper.
74
+ */
75
+ style?: React.CSSProperties;
76
+ /**
77
+ * Color of the dotted underline, if available. See also: showUnderline.
78
+ */
79
+ underlineColor?: UnderlineColor;
80
+ }
81
+ export declare function isOverflown(el: Element): boolean;
82
+ /**
83
+ * A hook used to trigger a positioned overlay on hover.
84
+ */
85
+ declare function useHoverOverlay({ className, style, delay, displayTimeout, showUnderline, underlineColor, showOnlyOnOverflow, onOverflowChange, skipWrapper, forceVisible, offset, position, containerDisplayMode, onHover, onBlur, }: UseHoverOverlayProps): {
86
+ wrapTrigger: (triggerChildren: React.ReactNode) => import("@emotion/react/jsx-runtime").JSX.Element;
87
+ isOpen: boolean;
88
+ snapClosed: boolean;
89
+ overlayProps: {
90
+ id: string;
91
+ ref: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
92
+ style: React.CSSProperties;
93
+ onMouseEnter: () => void;
94
+ onMouseLeave: () => void;
95
+ };
96
+ arrowProps: {
97
+ style: {
98
+ top?: string | undefined;
99
+ left?: string | undefined;
100
+ position: "absolute";
101
+ };
102
+ placement: import("@floating-ui/react-dom").Placement;
103
+ };
104
+ placement: import("@floating-ui/react-dom").Placement;
105
+ arrowData: (Partial<import("@floating-ui/react-dom").Coords> & {
106
+ centerOffset: number;
107
+ alignmentOffset?: number | undefined;
108
+ }) | undefined;
109
+ update: () => void;
110
+ reset: () => void;
111
+ };
112
+ export type { UseHoverOverlayProps };
113
+ export { useHoverOverlay };