@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
@@ -0,0 +1,21 @@
1
+ import type * as React from 'react';
2
+ import type { CSS } from '../cssTypes.js';
3
+ import type { Responsive } from '../layout/index.js';
4
+ import type { RadiusSize } from '../theme/index.js';
5
+ export interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'height' | 'width'> {
6
+ alt: string;
7
+ src: string;
8
+ aspectRatio?: CSS['aspectRatio'];
9
+ height?: Responsive<CSS['height']>;
10
+ /**
11
+ * Determines if the image should be loaded eagerly or lazily.
12
+ * @default 'lazy'
13
+ */
14
+ loading?: 'eager' | 'lazy';
15
+ objectFit?: 'contain' | 'cover';
16
+ objectPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right' | (string & {});
17
+ radius?: Responsive<RadiusSize>;
18
+ ref?: React.Ref<HTMLImageElement>;
19
+ width?: Responsive<CSS['width']>;
20
+ }
21
+ export declare function Image({ loading, width, height, ...props }: ImageProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { getRadius, rc } from "../layout/index.js";
4
+ function Image({ loading, width, height, ...props }) {
5
+ return /*#__PURE__*/ jsx(Img, {
6
+ loading: loading ?? 'lazy',
7
+ w: width,
8
+ h: height,
9
+ ...props
10
+ });
11
+ }
12
+ const Img = styled('img')`
13
+ ${(p)=>rc('width', p.w ?? '100%', p.theme)};
14
+ ${(p)=>rc('height', p.h ?? 'auto', p.theme)};
15
+ object-fit: ${(p)=>p.objectFit};
16
+ object-position: ${(p)=>p.objectPosition};
17
+ aspect-ratio: ${(p)=>p.aspectRatio};
18
+ ${(p)=>rc('border-radius', p.radius, p.theme, getRadius)};
19
+ `;
20
+ export { Image };
@@ -0,0 +1 @@
1
+ export { Image, type ImageProps } from './image.js';
@@ -0,0 +1 @@
1
+ export { Image } from "./image.js";
@@ -0,0 +1,2 @@
1
+ export { InfoText, type InfoTextProps } from './infoText.js';
2
+ export { InfoTip, DisabledTip } from './infoTip.js';
@@ -0,0 +1,2 @@
1
+ export { InfoText } from "./infoText.js";
2
+ export { DisabledTip, InfoTip } from "./infoTip.js";
@@ -0,0 +1,15 @@
1
+ import type * as React from 'react';
2
+ import type { DistributedOmit } from 'type-fest';
3
+ import { type TextProps } from '../text/index.js';
4
+ import { type TooltipProps } from '../tooltip/index.js';
5
+ type InfoTextBaseProps<T extends 'span' | 'p' | 'label' | 'div' | 'time'> = DistributedOmit<TextProps<T>, 'title' | 'variant' | 'underline'> & {
6
+ title: React.ReactNode;
7
+ variant?: TooltipProps['underlineColor'] | 'inherit';
8
+ } & Pick<TooltipProps, 'position' | 'maxWidth' | 'delay'>;
9
+ export type InfoTextProps<T extends 'span' | 'p' | 'label' | 'div' | 'time'> = (InfoTextBaseProps<T> & {
10
+ mode?: undefined;
11
+ }) | (DistributedOmit<InfoTextBaseProps<T>, 'display' | 'wrap'> & {
12
+ mode: 'overflowOnly';
13
+ });
14
+ export declare function InfoText<T extends 'span' | 'p' | 'label' | 'div' | 'time' = 'span'>({ title, children, position, maxWidth, delay, mode, ...textProps }: InfoTextProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import styled from "@emotion/styled";
4
+ import { Text } from "../text/index.js";
5
+ import { Tooltip } from "../tooltip/index.js";
6
+ function InfoText({ title, children, position, maxWidth, delay, mode, ...textProps }) {
7
+ const isOverflowOnly = 'overflowOnly' === mode;
8
+ const [isOverflowing, setIsOverflowing] = useState(false);
9
+ const textPropsWithMode = {
10
+ ...textProps,
11
+ ...isOverflowOnly ? {
12
+ ellipsis: true
13
+ } : {}
14
+ };
15
+ if (!title) return /*#__PURE__*/ jsx(Text, {
16
+ ...textPropsWithMode,
17
+ children: children
18
+ });
19
+ return /*#__PURE__*/ jsx(Tooltip, {
20
+ title: title,
21
+ position: position,
22
+ maxWidth: maxWidth,
23
+ delay: delay,
24
+ showOnlyOnOverflow: isOverflowOnly,
25
+ onOverflowChange: isOverflowOnly ? setIsOverflowing : void 0,
26
+ skipWrapper: true,
27
+ showUnderline: !isOverflowOnly,
28
+ underlineColor: 'inherit' === textProps.variant ? void 0 : textProps.variant,
29
+ children: /*#__PURE__*/ jsx(StyledText, {
30
+ ...textPropsWithMode,
31
+ tabIndex: isOverflowOnly && !isOverflowing ? void 0 : 0,
32
+ children: children
33
+ })
34
+ });
35
+ }
36
+ const StyledText = styled(Text)`
37
+ outline: none;
38
+
39
+ &:focus-visible {
40
+ ${(p)=>p.theme.focusRing()}
41
+ }
42
+ `;
43
+ export { InfoText };
@@ -0,0 +1,10 @@
1
+ import type * as React from 'react';
2
+ import type { SVGIconProps } from '@sentry/icons/svgIcon';
3
+ import { type TooltipProps } from '../tooltip/index.js';
4
+ interface InfoTooltipProps extends SVGIconProps {
5
+ title: React.ReactNode;
6
+ position?: TooltipProps['position'];
7
+ }
8
+ export declare function InfoTip(props: InfoTooltipProps): import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare function DisabledTip(props: InfoTooltipProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,54 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { IconLock } from "@sentry/icons/lock";
4
+ import { IconQuestion } from "@sentry/icons/question";
5
+ import { Tooltip } from "../tooltip/index.js";
6
+ import { useTranslation } from "../translation/useTranslation.js";
7
+ function IconWithTooltip({ title, position, icon: Icon, 'aria-label': ariaLabel, ...props }) {
8
+ return /*#__PURE__*/ jsx(Tooltip, {
9
+ title: title,
10
+ skipWrapper: true,
11
+ position: position,
12
+ children: /*#__PURE__*/ jsx(StyledIconWrapper, {
13
+ tabIndex: 0,
14
+ role: "img",
15
+ "aria-label": ariaLabel,
16
+ children: /*#__PURE__*/ jsx(Icon, {
17
+ ...props,
18
+ "aria-hidden": true
19
+ })
20
+ })
21
+ });
22
+ }
23
+ const StyledIconWrapper = styled('span')`
24
+ display: inline-flex;
25
+ border-radius: 50%;
26
+ outline: none;
27
+
28
+ &:focus-visible {
29
+ ${(p)=>p.theme.focusRing()}
30
+ }
31
+ `;
32
+ function InfoTip(props) {
33
+ const { t } = useTranslation();
34
+ return /*#__PURE__*/ jsx(IconWithTooltip, {
35
+ ...props,
36
+ icon: IconQuestion,
37
+ "aria-label": t('More information')
38
+ });
39
+ }
40
+ function LockIcon(props) {
41
+ return /*#__PURE__*/ jsx(IconLock, {
42
+ locked: true,
43
+ ...props
44
+ });
45
+ }
46
+ function DisabledTip(props) {
47
+ const { t } = useTranslation();
48
+ return /*#__PURE__*/ jsx(IconWithTooltip, {
49
+ ...props,
50
+ icon: LockIcon,
51
+ "aria-label": t('Disabled')
52
+ });
53
+ }
54
+ export { DisabledTip, InfoTip };
@@ -0,0 +1 @@
1
+ export { InteractionStateLayer as default } from './interactionStateLayer.js';
@@ -0,0 +1 @@
1
+ export { InteractionStateLayer as default } from "./interactionStateLayer.js";
@@ -0,0 +1,23 @@
1
+ import type * as React from 'react';
2
+ interface StateLayerProps extends React.HTMLAttributes<HTMLSpanElement> {
3
+ as?: React.ElementType;
4
+ color?: string;
5
+ /**
6
+ * Controls if the opacity is increased when the element is in a
7
+ * selected or expanded state (aria-selected='true' or aria-expanded='true')
8
+ *
9
+ * @default true
10
+ */
11
+ hasSelectedBackground?: boolean;
12
+ higherOpacity?: boolean;
13
+ isHovered?: boolean;
14
+ isPressed?: boolean;
15
+ }
16
+ /**
17
+ * use core components with built-in interaction states
18
+ * @deprecated
19
+ */
20
+ export declare const InteractionStateLayer: import("@emotion/styled").StyledComponent<StateLayerProps & {
21
+ theme?: import("@emotion/react").Theme;
22
+ }, {}, {}>;
23
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import is_prop_valid from "@emotion/is-prop-valid";
3
+ import { css } from "@emotion/react";
4
+ import styled from "@emotion/styled";
5
+ function defined(value) {
6
+ return null != value;
7
+ }
8
+ const defaultProps = {
9
+ hasSelectedBackground: true
10
+ };
11
+ const InteractionStateLayer = styled((props)=>{
12
+ const { children, as: Element = 'span', ...rest } = props;
13
+ return /*#__PURE__*/ jsx(Element, {
14
+ ...rest,
15
+ role: "presentation",
16
+ children: children
17
+ });
18
+ }, {
19
+ shouldForwardProp: (p)=>is_prop_valid(p) || 'as' === p
20
+ })`
21
+ position: absolute;
22
+ top: 50%;
23
+ left: 50%;
24
+ width: 100%;
25
+ height: 100%;
26
+ transform: translate(-50%, -50%);
27
+
28
+ box-sizing: content-box;
29
+ border-radius: inherit;
30
+ border: inherit;
31
+ color: ${(p)=>p.color ? p.theme[p.color] ?? p.color : 'currentcolor'};
32
+ background-color: currentcolor;
33
+ border-color: currentcolor;
34
+ pointer-events: none;
35
+
36
+ opacity: 0;
37
+
38
+ ${(p)=>defined(p.isHovered) ? p.isHovered && css`
39
+ opacity: ${p.higherOpacity ? 0.085 : 0.06};
40
+ ` : css`
41
+ *:hover:not(:focus-visible) > & {
42
+ opacity: ${p.higherOpacity ? 0.085 : 0.06};
43
+ }
44
+ `}
45
+
46
+ ${(p)=>defined(p.isPressed) ? p.isPressed && css`
47
+ &&& {
48
+ opacity: ${p.higherOpacity ? 0.12 : 0.09};
49
+ }
50
+ ` : css`
51
+ *:active > && {
52
+ opacity: ${p.higherOpacity ? 0.12 : 0.09};
53
+ }
54
+ ${(p.hasSelectedBackground ?? defaultProps.hasSelectedBackground) && css`
55
+ *[aria-expanded='true'] > &&,
56
+ *[aria-selected='true'] > && {
57
+ opacity: ${p.higherOpacity ? 0.12 : 0.09};
58
+ }
59
+ `}
60
+ `}
61
+
62
+ *:disabled &&,
63
+ *[aria-disabled='true'] && {
64
+ opacity: 0;
65
+ }
66
+ `;
67
+ export { InteractionStateLayer };
@@ -1,3 +1,4 @@
1
+ import type * as React from 'react';
1
2
  import type { CSS } from '../cssTypes.js';
2
3
  import type { SpaceSize } from '../theme/index.js';
3
4
  import { type ContainerElement, type ContainerProps, type ContainerPropsWithRenderFunction } from './container.js';
@@ -1,3 +1,4 @@
1
+ import type * as React from 'react';
1
2
  import type { CSS } from '../cssTypes.js';
2
3
  import type { SpaceSize } from '../theme/index.js';
3
4
  import { type ContainerElement, type ContainerProps, type ContainerPropsWithRenderFunction } from './container.js';
@@ -6,7 +6,7 @@ export { Stack, type StackProps } from './stack.js';
6
6
  /**
7
7
  * @TODO: these should probably be private to scraps
8
8
  */
9
- export { ContainerQueryProvider, rc, type Responsive, type ResponsiveKey,
9
+ export { ContainerQueryContext, ContainerQueryProvider, rc, type Responsive, type ResponsiveKey,
10
10
  /** @public */
11
11
  useContainerBreakpoint, useHasContainerQuery, useResponsivePropResolver, useResponsivePropValue, } from './styles.js';
12
12
  export { getBorder, getMargin, getRadius, getSpacing } from './styles.js';
@@ -3,4 +3,4 @@ export { Surface } from "./surface.js";
3
3
  export { Flex } from "./flex.js";
4
4
  export { Grid } from "./grid.js";
5
5
  export { Stack } from "./stack.js";
6
- export { ContainerQueryProvider, FLEX_JUSTIFY_CONTENT, getBorder, getMargin, getRadius, getSpacing, rc, useContainerBreakpoint, useHasContainerQuery, useResponsivePropResolver, useResponsivePropValue } from "./styles.js";
6
+ export { ContainerQueryContext, ContainerQueryProvider, FLEX_JUSTIFY_CONTENT, getBorder, getMargin, getRadius, getSpacing, rc, useContainerBreakpoint, useHasContainerQuery, useResponsivePropResolver, useResponsivePropValue } from "./styles.js";
@@ -1,3 +1,4 @@
1
+ import type * as React from 'react';
1
2
  import { type SeparatorProps } from '../separator/index.js';
2
3
  import type { ContainerElement } from './container.js';
3
4
  import { type FlexProps, type FlexPropsWithRenderFunction } from './flex.js';
@@ -77,7 +77,7 @@ export declare function useActiveBreakpoint(): BreakpointSize;
77
77
  * CSS-only responsive props don't need this — they resolve natively via
78
78
  * `@container` queries. This context exists purely for the JS resolution path.
79
79
  */
80
- export declare const ContainerQueryContext: import("react").Context<"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "zero" | "3xs" | "5xl" | null>;
80
+ export declare const ContainerQueryContext: import("react").Context<"xs" | "sm" | "md" | "2xs" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "zero" | "3xs" | "5xl" | null>;
81
81
  /**
82
82
  * The JS equivalent of a CSS container query: returns the active breakpoint of
83
83
  * the nearest ancestor query container (read from `ContainerQueryContext`),
@@ -1,3 +1,4 @@
1
+ import type * as React from 'react';
1
2
  import { type ContainerElement, type ContainerProps } from './container.js';
2
3
  import type { SurfaceVariant } from '../theme/index.js';
3
4
  interface FlatSurfaceProps<T extends ContainerElement = 'div'> extends Omit<ContainerProps<T>, 'background' | 'border'> {
@@ -0,0 +1,2 @@
1
+ export { Link, type LinkDestination, type LinkProps, ExternalLink } from './link.js';
2
+ export { LinkBehaviorContextProvider } from './linkBehaviorContext.js';
@@ -0,0 +1,2 @@
1
+ export { ExternalLink, Link } from "./link.js";
2
+ export { LinkBehaviorContextProvider } from "./linkBehaviorContext.js";
@@ -0,0 +1,43 @@
1
+ import type * as React from 'react';
2
+ import { type AnalyticsProps } from '../trackingContext.js';
3
+ export interface LinkProps extends React.RefAttributes<HTMLAnchorElement>, AnalyticsProps, Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, 'href' | 'target' | 'as' | 'css'> {
4
+ [key: `data-${string}`]: string | undefined;
5
+ /**
6
+ * The string path or destination object. A LinkBehaviorContextProvider can
7
+ * normalize destinations and handle client-side routing.
8
+ */
9
+ to: string | {
10
+ hash?: string;
11
+ pathname?: string;
12
+ query?: Record<string, unknown>;
13
+ search?: string;
14
+ state?: unknown;
15
+ };
16
+ /**
17
+ * Indicator if the link should be disabled
18
+ */
19
+ disabled?: boolean;
20
+ preventScrollReset?: boolean;
21
+ reloadDocument?: boolean;
22
+ replace?: boolean;
23
+ state?: unknown;
24
+ }
25
+ /**
26
+ * Where something leads: a route inside the product, or an external URL
27
+ * outside it. The two are mutually exclusive, so a component can pick `Link`
28
+ * or `ExternalLink` from whichever one it was handed.
29
+ */
30
+ export type LinkDestination = {
31
+ to: LinkProps['to'];
32
+ externalHref?: never;
33
+ } | {
34
+ externalHref: string;
35
+ to?: never;
36
+ };
37
+ export declare function Link(props: LinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
38
+ interface ExternalLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
39
+ disabled?: LinkProps['disabled'];
40
+ openInNewTab?: boolean;
41
+ }
42
+ export declare function ExternalLink({ openInNewTab, ...props }: ExternalLinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
43
+ export {};
@@ -0,0 +1,71 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import is_prop_valid from "@emotion/is-prop-valid";
3
+ import { css } from "@emotion/react";
4
+ import styled from "@emotion/styled";
5
+ import { getTextStyles } from "../text/text.js";
6
+ import { useClickTracking } from "../trackingContext.js";
7
+ import { useLinkBehavior } from "./linkBehaviorContext.js";
8
+ const getLinkStyles = ({ disabled, theme })=>css`
9
+ border-radius: 2px;
10
+ pointer-events: ${disabled ? 'none' : void 0};
11
+ color: ${disabled ? theme.tokens.content.disabled : void 0};
12
+
13
+ &:hover {
14
+ color: ${disabled ? theme.tokens.content.disabled : void 0};
15
+ }
16
+
17
+ &:focus-visible {
18
+ text-decoration: none;
19
+ ${theme.focusRing()}
20
+ }
21
+ `;
22
+ const getLinkTextStyles = ({ theme })=>css`
23
+ ${getTextStyles({
24
+ theme,
25
+ variant: 'inherit'
26
+ })}
27
+ font-family: inherit;
28
+ `;
29
+ const Anchor = styled('a', {
30
+ shouldForwardProp: (prop)=>is_prop_valid(prop) && 'disabled' !== prop
31
+ })`
32
+ ${getLinkTextStyles}
33
+ ${getLinkStyles}
34
+ `;
35
+ function LinkBase(props) {
36
+ const { Component, behavior } = useLinkBehavior(props);
37
+ const propsWithBehavior = behavior();
38
+ const { handleClick } = useClickTracking(propsWithBehavior, 'link');
39
+ const { analyticsEventKey: _analyticsEventKey, analyticsEventName: _analyticsEventName, analyticsParams: _analyticsParams, busy: _busy, variant: _variant, ...linkProps } = props.disabled ? props : propsWithBehavior;
40
+ if (props.disabled) {
41
+ const { to: _to, replace: _replace, preventScrollReset: _preventScrollReset, reloadDocument: _reloadDocument, state: _state, ...restProps } = linkProps;
42
+ return /*#__PURE__*/ jsx(Anchor, {
43
+ ...restProps
44
+ });
45
+ }
46
+ return /*#__PURE__*/ jsx(Component, {
47
+ ...linkProps,
48
+ onClick: handleClick
49
+ });
50
+ }
51
+ const StyledLink = styled(LinkBase)`
52
+ ${getLinkTextStyles}
53
+ ${getLinkStyles}
54
+ `;
55
+ function Link(props) {
56
+ return /*#__PURE__*/ jsx(StyledLink, {
57
+ ...props
58
+ });
59
+ }
60
+ function ExternalLink({ openInNewTab = true, ...props }) {
61
+ if (openInNewTab) return /*#__PURE__*/ jsx(Anchor, {
62
+ ...props,
63
+ target: "_blank",
64
+ rel: "noreferrer noopener"
65
+ });
66
+ return /*#__PURE__*/ jsx(Anchor, {
67
+ ...props,
68
+ href: props.href
69
+ });
70
+ }
71
+ export { ExternalLink, Link };
@@ -0,0 +1,14 @@
1
+ import type * as React from 'react';
2
+ import { type FunctionComponent } from 'react';
3
+ import type { LinkProps } from './link.js';
4
+ type LinkBehavior<T extends LinkProps> = {
5
+ behavior: (props: T) => T;
6
+ component: FunctionComponent<T>;
7
+ };
8
+ declare function AnchorLink({ to, replace: _replace, preventScrollReset: _preventScrollReset, reloadDocument: _reloadDocument, state: _state, ...props }: LinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const LinkBehaviorContextProvider: React.Provider<LinkBehavior<LinkProps> | null>;
10
+ export declare const useLinkBehavior: <T extends LinkProps>(props: T) => {
11
+ Component: typeof AnchorLink | React.FunctionComponent<T>;
12
+ behavior: () => T;
13
+ };
14
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ import * as __rspack_external_query_string_78b5d812 from "query-string";
4
+ const LinkBehaviorContext = /*#__PURE__*/ createContext(null);
5
+ function AnchorLink({ to, replace: _replace, preventScrollReset: _preventScrollReset, reloadDocument: _reloadDocument, state: _state, ...props }) {
6
+ if ('string' == typeof to) return /*#__PURE__*/ jsx("a", {
7
+ ...props,
8
+ href: to
9
+ });
10
+ const { pathname = '', hash = '', search = '', query } = to;
11
+ const querySearch = query ? __rspack_external_query_string_78b5d812.stringify(query) : search;
12
+ const href = `${pathname}${querySearch && !querySearch.startsWith('?') ? '?' : ''}${querySearch}${hash && !hash.startsWith('#') ? '#' : ''}${hash}`;
13
+ return /*#__PURE__*/ jsx("a", {
14
+ ...props,
15
+ href: href
16
+ });
17
+ }
18
+ const defaultLinkBehavior = ()=>({
19
+ component: AnchorLink,
20
+ behavior: (props)=>props
21
+ });
22
+ const LinkBehaviorContextProvider = LinkBehaviorContext.Provider;
23
+ const useLinkBehavior = (props)=>{
24
+ const linkBehavior = useContext(LinkBehaviorContext);
25
+ const { component, behavior } = linkBehavior ?? defaultLinkBehavior();
26
+ return {
27
+ Component: component,
28
+ behavior: ()=>behavior(props)
29
+ };
30
+ };
31
+ export { LinkBehaviorContextProvider, useLinkBehavior };
@@ -1,3 +1,4 @@
1
+ import type * as React from 'react';
1
2
  interface IndeterminateLoaderProps extends React.HTMLAttributes<HTMLDivElement> {
2
3
  variant?: 'vibrant' | 'monochrome';
3
4
  }
@@ -0,0 +1,59 @@
1
+ import type * as React from 'react';
2
+ import type { Placement } from '@floating-ui/react-dom';
3
+ import type { HTMLMotionProps } from 'framer-motion';
4
+ import type { OverlayArrowProps } from './overlayArrow.js';
5
+ type OriginPoint = Partial<{
6
+ x: number;
7
+ y: number;
8
+ }>;
9
+ export interface OverlayProps extends HTMLMotionProps<'div'>, React.RefAttributes<HTMLDivElement> {
10
+ /**
11
+ * Whether the overlay should animate in/out. If true, we'll also need
12
+ * the `placement` and `originPoint` props.
13
+ */
14
+ animated?: boolean;
15
+ /**
16
+ * Props to be passed into <OverlayArrow />. If undefined, the overlay will
17
+ * render with no arrow.
18
+ */
19
+ arrowProps?: OverlayArrowProps;
20
+ children?: React.ReactNode;
21
+ /**
22
+ * The CSS styles for the "origin point" over the overlay. Typically this
23
+ * would be the arrow (or tip).
24
+ */
25
+ originPoint?: OriginPoint;
26
+ /**
27
+ * Indicates where the overlay is placed. This is useful for the animation to
28
+ * be animated 'towards' the placment origin, giving it a pleasing effect.
29
+ */
30
+ placement?: Placement;
31
+ }
32
+ /**
33
+ * A overlay component that has an optional nice ease in animation along with
34
+ * a scale-down animation that animates towards an origin (think a tooltip
35
+ * pointing at something).
36
+ *
37
+ * If animated (`animated` prop is true), should be used within a
38
+ * `<AnimatePresence />`.
39
+ */
40
+ export declare function Overlay({ ref, children, arrowProps, animated, placement, originPoint, style, ...props }: OverlayProps): import("@emotion/react/jsx-runtime").JSX.Element;
41
+ interface PositionWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
42
+ /**
43
+ * Determines the zindex over the position wrapper
44
+ */
45
+ zIndex: number;
46
+ ref?: React.Ref<HTMLDivElement>;
47
+ }
48
+ /**
49
+ * The PositionWrapper should be used when you're using the AnimatedOverlay as
50
+ * part of dynamically positioned component (useOverlayPosition). Generally
51
+ * this component will receive the `overlayProps`.
52
+ *
53
+ * This component ensures the wrapped AnimatedOverlay will not receive pointer
54
+ * events while it is being animated out. Especially useful since the
55
+ * `overlayProps` includes a onMouseEnter to allow the overlay to be hovered,
56
+ * which we would not want while its fading away.
57
+ */
58
+ export declare function PositionWrapper({ ref, onAnimationStart: _onAnimationStart, onDragStart: _onDragStart, onDragEnd: _onDragEnd, onDrag: _onDrag, zIndex, style, ...props }: PositionWrapperProps): import("@emotion/react/jsx-runtime").JSX.Element;
59
+ export {};