@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,113 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { motion, useIsPresent } from "framer-motion";
4
+ import { OverlayArrow } from "./overlayArrow.js";
5
+ import { PanelProvider } from "./panelProvider.js";
6
+ const overlayAnimation = {
7
+ transition: {
8
+ duration: 0.2
9
+ },
10
+ initial: {
11
+ opacity: 0
12
+ },
13
+ animate: {
14
+ opacity: 1,
15
+ scale: 1,
16
+ transition: {
17
+ type: 'spring',
18
+ duration: 0.2
19
+ }
20
+ },
21
+ exit: {
22
+ opacity: 0,
23
+ scale: 0.95,
24
+ transition: {
25
+ type: 'spring',
26
+ delay: 0.1
27
+ }
28
+ }
29
+ };
30
+ function computeOriginFromArrow(placement, originPoint) {
31
+ const simplePlacement = placement?.split('-')[0];
32
+ const { y, x } = originPoint ?? {};
33
+ switch(simplePlacement){
34
+ case 'top':
35
+ return {
36
+ originX: x ? `${x}px` : '50%',
37
+ originY: '100%'
38
+ };
39
+ case 'bottom':
40
+ return {
41
+ originX: x ? `${x}px` : '50%',
42
+ originY: 0
43
+ };
44
+ case 'left':
45
+ return {
46
+ originX: '100%',
47
+ originY: y ? `${y}px` : '50%'
48
+ };
49
+ case 'right':
50
+ return {
51
+ originX: 0,
52
+ originY: y ? `${y}px` : '50%'
53
+ };
54
+ default:
55
+ return {
56
+ originX: '50%',
57
+ originY: '50%'
58
+ };
59
+ }
60
+ }
61
+ function Overlay({ ref, children, arrowProps, animated, placement, originPoint, style, ...props }) {
62
+ const isTestEnv = 'test' === process.env.NODE_ENV;
63
+ const animationProps = !isTestEnv && animated ? {
64
+ ...overlayAnimation,
65
+ style: {
66
+ ...style,
67
+ ...computeOriginFromArrow(placement, originPoint)
68
+ }
69
+ } : {
70
+ style
71
+ };
72
+ return /*#__PURE__*/ jsxs(OverlayInner, {
73
+ ...props,
74
+ ...animationProps,
75
+ "data-overlay": true,
76
+ ref: ref,
77
+ placement: placement,
78
+ children: [
79
+ null != arrowProps && /*#__PURE__*/ jsx(OverlayArrow, {
80
+ ...arrowProps
81
+ }),
82
+ /*#__PURE__*/ jsx(PanelProvider, {
83
+ children: children
84
+ })
85
+ ]
86
+ });
87
+ }
88
+ const OverlayInner = styled(motion.div)`
89
+ position: relative;
90
+ background: ${(p)=>p.theme.tokens.background.overlay};
91
+ border-radius: ${(p)=>p.theme.radius.md};
92
+ border: 1px solid ${(p)=>p.theme.tokens.border.primary};
93
+ /* oxlint-disable-next-line @sentry/scraps/use-semantic-token */
94
+ box-shadow: 0 2px 0 ${(p)=>p.theme.tokens.border.primary};
95
+ font-size: ${(p)=>p.theme.font.size.md};
96
+
97
+ /* Override z-index from useOverlayPosition */
98
+ z-index: ${(p)=>p.theme.zIndex.dropdown} !important;
99
+ will-change: transform, opacity;
100
+ `;
101
+ function PositionWrapper({ ref, onAnimationStart: _onAnimationStart, onDragStart: _onDragStart, onDragEnd: _onDragEnd, onDrag: _onDrag, zIndex, style, ...props }) {
102
+ const isPresent = useIsPresent();
103
+ return /*#__PURE__*/ jsx(motion.div, {
104
+ ...props,
105
+ ref: ref,
106
+ style: {
107
+ ...style,
108
+ zIndex,
109
+ pointerEvents: isPresent ? 'auto' : 'none'
110
+ }
111
+ });
112
+ }
113
+ export { Overlay, PositionWrapper };
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ import type { Placement } from '@floating-ui/react-dom';
3
+ export interface OverlayArrowProps extends React.ComponentPropsWithRef<'div'> {
4
+ placement?: Placement;
5
+ ref?: React.Ref<HTMLDivElement>;
6
+ size?: number;
7
+ strokeWidth?: number;
8
+ }
9
+ export declare function OverlayArrow({ placement, ref, size, ...props }: OverlayArrowProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ import styled from "@emotion/styled";
4
+ const sizeRatio = 0.5;
5
+ const heightRatio = 0.3;
6
+ function OverlayArrow({ placement, ref, size = 16, ...props }) {
7
+ const theme = useTheme();
8
+ const offset = placement?.startsWith('top') ? 3 : 1.5;
9
+ const topOffset = placement?.startsWith('top') ? 3 : 1;
10
+ return /*#__PURE__*/ jsx(OverlayArrowWrap, {
11
+ "data-overlay-arrow": true,
12
+ dimensions: size,
13
+ ref: ref,
14
+ placement: placement,
15
+ ...props,
16
+ children: /*#__PURE__*/ jsxs("svg", {
17
+ viewBox: `0 0 ${size} ${size * sizeRatio}`,
18
+ fill: "none",
19
+ style: {
20
+ display: 'block'
21
+ },
22
+ children: [
23
+ placement?.startsWith('left') || placement?.startsWith('right') ? /*#__PURE__*/ jsx("polygon", {
24
+ transform: `translate(${placement?.startsWith('right') ? 2 : 0}, 0)`,
25
+ points: `
26
+ -2,0
27
+ ${size},0
28
+ ${size / 2},${size * heightRatio + topOffset}
29
+ ${size / 2 - 2},${size * heightRatio + topOffset}`,
30
+ fill: theme.tokens.border.primary
31
+ }) : null,
32
+ /*#__PURE__*/ jsx("polygon", {
33
+ points: `0,0 ${size},0 ${size / 2},${size * heightRatio + topOffset}`,
34
+ fill: theme.tokens.border.primary
35
+ }),
36
+ /*#__PURE__*/ jsx("polygon", {
37
+ points: `${offset},0 ${size - offset}, 0 ${size / 2},${size * heightRatio}`,
38
+ fill: theme.tokens.background.primary
39
+ })
40
+ ]
41
+ })
42
+ });
43
+ }
44
+ const OverlayArrowWrap = styled('div')`
45
+ width: ${(p)=>p.dimensions}px;
46
+ height: ${(p)=>p.placement?.startsWith('left') || p.placement?.startsWith('right') ? p.dimensions : p.dimensions * sizeRatio}px;
47
+ position: absolute;
48
+ transform-origin: center;
49
+
50
+ ${(p)=>p.placement?.startsWith('top') && 'top: 100%; left: 50%; transform: rotate(0deg);'}
51
+ ${(p)=>p.placement?.startsWith('bottom') && 'bottom: 100%; left: 50%; transform: rotate(180deg);'}
52
+ ${(p)=>p.placement?.startsWith('left') && 'left: 100%; top: 50%; transform: rotate(-90deg);'}
53
+ ${(p)=>p.placement?.startsWith('right') && 'right: 100%; top: 50%; transform: rotate(90deg);'}
54
+ `;
55
+ export { OverlayArrow };
@@ -0,0 +1,61 @@
1
+ import type * as React from 'react';
2
+ import type { FlipOptions, Middleware, Padding, Placement, ShiftOptions } from '@floating-ui/react-dom';
3
+ /**
4
+ * Where to place an overlay relative to its trigger. The `auto` positions
5
+ * pick whichever side has the most space.
6
+ */
7
+ export type OverlayPlacement = Placement | 'auto' | 'auto-start' | 'auto-end';
8
+ /**
9
+ * Resolves a requested position to the placement passed to Floating UI and
10
+ * the middleware that may change it: `autoPlacement()` for the `auto`
11
+ * positions, otherwise `flipOverlay()`.
12
+ */
13
+ export declare function placementMiddleware(position: OverlayPlacement, flipOptions?: FlipOptions): {
14
+ middleware: Middleware;
15
+ placement: Placement;
16
+ };
17
+ /**
18
+ * Floating UI's `flip()`, but when no placement fits on its main axis the
19
+ * requested placement is kept instead of guessing the best fit.
20
+ */
21
+ export declare function flipOverlay(options?: FlipOptions): Middleware;
22
+ export interface OverlayAnchor {
23
+ bottom?: number;
24
+ right?: number;
25
+ }
26
+ /**
27
+ * Anchors the overlay by the edges nearest its trigger, the way Popper's
28
+ * adaptive styles did. An overlay whose content changes size, such as a
29
+ * hovercard that finishes loading, then grows away from its trigger instead of
30
+ * over it until it is repositioned. Apply the result with `anchoredStyles()`.
31
+ *
32
+ * Must be the last middleware, so it sees the final position.
33
+ */
34
+ export declare const anchorOverlay: Middleware;
35
+ /**
36
+ * Floating UI's `floatingStyles`, positioned by the edges `anchorOverlay()`
37
+ * chose.
38
+ */
39
+ export declare function anchoredStyles(floatingStyles: React.CSSProperties, anchor: OverlayAnchor | undefined): React.CSSProperties;
40
+ /**
41
+ * Floating UI's `arrow()`, pointing the overlay's `OverlayArrow` at its trigger.
42
+ */
43
+ export declare function arrowOverlay(options?: {
44
+ padding?: Padding;
45
+ }): Middleware;
46
+ export interface ShiftOverlayOptions extends ShiftOptions {
47
+ /**
48
+ * Stop the overlay from shifting so far that it detaches from its trigger.
49
+ * @default true
50
+ */
51
+ tether?: boolean;
52
+ }
53
+ /**
54
+ * Floating UI's `shift()`, by default limited so the overlay never shifts so
55
+ * far that it detaches from its trigger. With an arrow, enough of the overlay
56
+ * stays beside the trigger for the arrow to point at it.
57
+ *
58
+ * Unlike `limitShift()`, this only limits how far the overlay is shifted. An
59
+ * offset that already places the overlay away from its trigger is kept.
60
+ */
61
+ export declare function shiftOverlay(options?: ShiftOverlayOptions): Middleware;
@@ -0,0 +1,126 @@
1
+ import { arrow, autoPlacement, flip, limitShift, shift } from "@floating-ui/react-dom";
2
+ function placementMiddleware(position, flipOptions = {}) {
3
+ if ('auto' === position || 'auto-start' === position || 'auto-end' === position) {
4
+ const { mainAxis: _mainAxis, crossAxis: _crossAxis, fallbackPlacements: _fallbackPlacements, fallbackStrategy: _fallbackStrategy, fallbackAxisSideDirection: _fallbackAxisSideDirection, flipAlignment = true, ...detectOverflowOptions } = flipOptions;
5
+ const alignment = 'auto-start' === position ? 'start' : 'auto-end' === position ? 'end' : void 0;
6
+ return {
7
+ placement: alignment ? `top-${alignment}` : 'top',
8
+ middleware: autoPlacement({
9
+ ...detectOverflowOptions,
10
+ alignment,
11
+ autoAlignment: flipAlignment
12
+ })
13
+ };
14
+ }
15
+ return {
16
+ placement: position,
17
+ middleware: flipOverlay(flipOptions)
18
+ };
19
+ }
20
+ function flipOverlay(options = {}) {
21
+ return flip({
22
+ fallbackStrategy: 'initialPlacement',
23
+ ...options
24
+ });
25
+ }
26
+ const anchorOverlay = {
27
+ name: 'anchor',
28
+ async fn ({ x, y, placement, rects, elements, platform, strategy }) {
29
+ const [side, alignment] = placement.split('-');
30
+ const isVertical = 'top' === side || 'bottom' === side;
31
+ const anchorBottom = 'top' === side || !isVertical && 'end' === alignment;
32
+ const anchorRight = 'left' === side || isVertical && 'end' === alignment;
33
+ if (!anchorBottom && !anchorRight) return {};
34
+ const { floating } = elements;
35
+ const offsetParent = await platform.getOffsetParent?.(floating);
36
+ const container = offsetParent && await platform.isElement?.(offsetParent) ? {
37
+ width: offsetParent.clientWidth,
38
+ height: offsetParent.clientHeight
39
+ } : getRootContainingBlock(floating, strategy);
40
+ const dpr = floating.ownerDocument.defaultView?.devicePixelRatio || 1;
41
+ const round = (value)=>Math.round(value * dpr) / dpr;
42
+ const anchor = {};
43
+ if (anchorBottom) anchor.bottom = round(container.height - y - rects.floating.height);
44
+ if (anchorRight) anchor.right = round(container.width - x - rects.floating.width);
45
+ return {
46
+ data: anchor
47
+ };
48
+ }
49
+ };
50
+ function getRootContainingBlock(floating, strategy) {
51
+ const root = floating.ownerDocument.documentElement;
52
+ const isDocument = 'absolute' === strategy && floating.ownerDocument.defaultView?.getComputedStyle(root).position !== 'static';
53
+ return isDocument ? {
54
+ width: root.scrollWidth,
55
+ height: root.scrollHeight
56
+ } : {
57
+ width: root.clientWidth,
58
+ height: root.clientHeight
59
+ };
60
+ }
61
+ function anchoredStyles(floatingStyles, anchor) {
62
+ return {
63
+ ...floatingStyles,
64
+ ...anchor?.bottom === void 0 ? {} : {
65
+ top: 'auto',
66
+ bottom: anchor.bottom
67
+ },
68
+ ...anchor?.right === void 0 ? {} : {
69
+ left: 'auto',
70
+ right: anchor.right
71
+ }
72
+ };
73
+ }
74
+ function getArrow(floating) {
75
+ return floating.querySelector('[data-overlay-arrow]');
76
+ }
77
+ function arrowOverlay(options = {}) {
78
+ return {
79
+ name: 'arrow',
80
+ options,
81
+ fn (state) {
82
+ const element = getArrow(state.elements.floating);
83
+ return element ? arrow({
84
+ ...options,
85
+ element
86
+ }).fn(state) : {};
87
+ }
88
+ };
89
+ }
90
+ function shiftOverlay(options = {}) {
91
+ const { tether = true, ...shiftOptions } = options;
92
+ return {
93
+ name: 'shift',
94
+ options,
95
+ fn (state) {
96
+ const limiter = tether ? tetherLimiter(state, getArrow(state.elements.floating)) : void 0;
97
+ return shift({
98
+ limiter,
99
+ ...shiftOptions
100
+ }).fn(state);
101
+ }
102
+ };
103
+ }
104
+ function tetherLimiter(origin, arrowElement) {
105
+ const crossAxisLimiter = limitShift({
106
+ mainAxis: false
107
+ });
108
+ return {
109
+ fn (state) {
110
+ const coords = crossAxisLimiter.fn(state);
111
+ const isVertical = state.placement.startsWith('top') || state.placement.startsWith('bottom');
112
+ const axis = isVertical ? 'x' : 'y';
113
+ const length = isVertical ? 'width' : 'height';
114
+ const { reference, floating } = state.rects;
115
+ const arrowLength = Math.min((isVertical ? arrowElement?.offsetWidth : arrowElement?.offsetHeight) ?? 0, reference[length]);
116
+ const min = reference[axis] - floating[length] + arrowLength;
117
+ const max = reference[axis] + reference[length] - arrowLength;
118
+ const start = origin[axis];
119
+ const shifted = state[axis];
120
+ if (shifted > start) coords[axis] = Math.max(start, Math.min(shifted, max));
121
+ else if (shifted < start) coords[axis] = Math.min(start, Math.max(shifted, min));
122
+ return coords;
123
+ }
124
+ };
125
+ }
126
+ export { anchorOverlay, anchoredStyles, arrowOverlay, flipOverlay, placementMiddleware, shiftOverlay };
@@ -0,0 +1,8 @@
1
+ import type * as React from 'react';
2
+ /**
3
+ * Nested theme provider that automatically adjusts the styles of descendants
4
+ * of panel-like elements. See `panel.tsx` for usage example.
5
+ */
6
+ export declare function PanelProvider({ children }: {
7
+ children: React.ReactNode;
8
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { ThemeProvider, useTheme } from "@emotion/react";
4
+ const smallerBorderRadii = {
5
+ borderRadius: '4px'
6
+ };
7
+ function PanelProvider({ children }) {
8
+ const theme = useTheme();
9
+ const modifiedTheme = useMemo(()=>({
10
+ ...theme,
11
+ ...smallerBorderRadii
12
+ }), [
13
+ theme
14
+ ]);
15
+ return /*#__PURE__*/ jsx(ThemeProvider, {
16
+ theme: modifiedTheme,
17
+ children: children
18
+ });
19
+ }
20
+ export { PanelProvider };
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { Fragment } from "react";
3
3
  import styled from "@emotion/styled";
4
4
  import { Stack } from "../layout/index.js";
5
- import { Text } from "../text/index.js";
5
+ import { Text } from "../text/text.js";
6
6
  function Quote(props) {
7
7
  const { children, ...spreadProps } = props;
8
8
  return /*#__PURE__*/ jsxs(Stack, {
@@ -0,0 +1 @@
1
+ export { Radio } from './radio.js';
@@ -0,0 +1 @@
1
+ export { Radio } from "./radio.js";
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
3
+ ref?: React.Ref<HTMLInputElement>;
4
+ size?: 'xs' | 'sm' | 'md';
5
+ }
6
+ export declare const Radio: import("@emotion/styled").StyledComponent<RadioProps & {
7
+ theme?: import("@emotion/react").Theme;
8
+ }, {}, {}>;
9
+ export {};
@@ -0,0 +1,77 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import is_prop_valid from "@emotion/is-prop-valid";
3
+ import { keyframes } from "@emotion/react";
4
+ import styled from "@emotion/styled";
5
+ const growIn = keyframes`
6
+ 0% {
7
+ opacity: 0;
8
+ transform: scale(0.75);
9
+ }
10
+ 100% {
11
+ opacity: 1;
12
+ transform: scale(1);
13
+ }
14
+ `;
15
+ const radioConfig = {
16
+ xs: {
17
+ outerSize: '12px',
18
+ innerSize: '6px'
19
+ },
20
+ sm: {
21
+ outerSize: '20px',
22
+ innerSize: '10px'
23
+ },
24
+ md: {
25
+ outerSize: '24px',
26
+ innerSize: '12px'
27
+ }
28
+ };
29
+ const radioStyles = (props)=>({
30
+ width: radioConfig[props.size ?? 'md'].outerSize,
31
+ height: radioConfig[props.size ?? 'md'].outerSize,
32
+ flexShrink: 0,
33
+ borderRadius: props.theme.radius.full,
34
+ display: 'inline-flex',
35
+ alignItems: 'center',
36
+ justifyContent: 'center',
37
+ cursor: 'pointer',
38
+ appearance: 'none',
39
+ transition: `border ${props.theme.motion.smooth.fast}, box-shadow ${props.theme.motion.smooth.fast}`,
40
+ margin: '0 !important',
41
+ border: `1px solid ${props.theme.tokens.border.primary} !important`,
42
+ '&:after': {
43
+ content: '""',
44
+ display: 'block',
45
+ width: radioConfig[props.size ?? 'md'].innerSize,
46
+ height: radioConfig[props.size ?? 'md'].innerSize,
47
+ borderRadius: props.theme.radius.full,
48
+ backgroundColor: props.theme.tokens.content.onVibrant.light,
49
+ transition: `all ${props.theme.motion.smooth.moderate}`,
50
+ opacity: 0
51
+ },
52
+ '&:focus-visible': {
53
+ ...props.theme.focusRing()
54
+ },
55
+ '&:checked': {
56
+ backgroundColor: props.theme.tokens.interactive.chonky.debossed.accent.background,
57
+ border: `1px solid ${props.theme.tokens.interactive.chonky.debossed.accent.chonk}`,
58
+ '&:after': {
59
+ animation: `${growIn} ${props.theme.motion.smooth.moderate}`,
60
+ opacity: 1
61
+ }
62
+ },
63
+ '&:disabled': {
64
+ opacity: props.theme.tokens.interactive.disabled,
65
+ cursor: 'not-allowed'
66
+ }
67
+ });
68
+ const Radio = styled(({ ref, size: _size, ...props })=>/*#__PURE__*/ jsx("input", {
69
+ type: "radio",
70
+ ...props,
71
+ ref: ref
72
+ }), {
73
+ shouldForwardProp: (prop)=>'string' == typeof prop && is_prop_valid(prop)
74
+ })`
75
+ ${(p)=>radioStyles(p)}
76
+ `;
77
+ export { Radio };
@@ -0,0 +1,2 @@
1
+ import { type ReactNode } from 'react';
2
+ export declare const useRenderToString: () => (tree: ReactNode) => string;
@@ -0,0 +1,25 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { flushSync } from "react-dom";
4
+ import { createRoot } from "react-dom/client";
5
+ import { ThemeProvider, useTheme } from "@emotion/react";
6
+ const renderToString = (tree)=>{
7
+ const div = document.createElement('div');
8
+ const root = createRoot(div);
9
+ flushSync(()=>{
10
+ root.render(tree);
11
+ });
12
+ const html = div.innerHTML;
13
+ root.unmount();
14
+ return html;
15
+ };
16
+ const useRenderToString = ()=>{
17
+ const theme = useTheme();
18
+ return useCallback((tree)=>renderToString(/*#__PURE__*/ jsx(ThemeProvider, {
19
+ theme: theme,
20
+ children: tree
21
+ })), [
22
+ theme
23
+ ]);
24
+ };
25
+ export { useRenderToString };
@@ -0,0 +1 @@
1
+ export { RevealOnHover } from './revealOnHover.js';
@@ -0,0 +1 @@
1
+ export { RevealOnHover } from "./revealOnHover.js";
@@ -0,0 +1,20 @@
1
+ import type * as React from 'react';
2
+ import { type FlexProps } from '../layout/index.js';
3
+ interface RevealOnHoverRenderProps {
4
+ className: string;
5
+ }
6
+ type RevealOnHoverProps = (FlexProps & {
7
+ children: React.ReactNode;
8
+ }) | {
9
+ children: (props: RevealOnHoverRenderProps) => React.ReactNode;
10
+ };
11
+ declare function RevealOnHoverRoot(props: RevealOnHoverProps): import("@emotion/react/jsx-runtime").JSX.Element;
12
+ interface ActionProps {
13
+ children: React.ReactNode;
14
+ visible?: boolean;
15
+ }
16
+ declare function Action({ children, visible }: ActionProps): import("@emotion/react/jsx-runtime").JSX.Element;
17
+ export declare const RevealOnHover: typeof RevealOnHoverRoot & {
18
+ Action: typeof Action;
19
+ };
20
+ export {};
@@ -0,0 +1,62 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { Flex } from "../layout/index.js";
4
+ function RevealOnHoverRoot(props) {
5
+ const { children, ...rest } = props;
6
+ if ('function' == typeof children) return /*#__PURE__*/ jsx(RevealOnHoverStyles, {
7
+ children: ({ className })=>children({
8
+ className
9
+ })
10
+ });
11
+ return /*#__PURE__*/ jsx(RevealOnHoverFlex, {
12
+ align: "center",
13
+ gap: "xs",
14
+ ...rest,
15
+ children: children
16
+ });
17
+ }
18
+ const revealStyles = (p)=>`
19
+ [data-reveal-on-hover][data-reveal-on-hover-visible] {
20
+ opacity: 1;
21
+ pointer-events: auto;
22
+ }
23
+
24
+ @media (hover: hover) {
25
+ [data-reveal-on-hover] {
26
+ opacity: 0;
27
+ pointer-events: none;
28
+ transition: opacity ${p.theme.motion.exit.fast};
29
+ }
30
+
31
+ &:hover [data-reveal-on-hover],
32
+ &:has(:focus-visible) [data-reveal-on-hover] {
33
+ opacity: 1;
34
+ pointer-events: auto;
35
+ transition: opacity ${p.theme.motion.enter.moderate};
36
+ }
37
+ }
38
+ `;
39
+ function RevealOnHoverFlex(props) {
40
+ return /*#__PURE__*/ jsx(Flex, {
41
+ css: (theme)=>revealStyles({
42
+ theme
43
+ }),
44
+ ...props
45
+ });
46
+ }
47
+ const RevealOnHoverStyles = styled((props)=>props.children({
48
+ className: props.className ?? ''
49
+ }))`
50
+ ${revealStyles}
51
+ `;
52
+ function Action({ children, visible }) {
53
+ return /*#__PURE__*/ jsx("span", {
54
+ "data-reveal-on-hover": "",
55
+ "data-reveal-on-hover-visible": visible ? '' : void 0,
56
+ children: children
57
+ });
58
+ }
59
+ const RevealOnHover = Object.assign(RevealOnHoverRoot, {
60
+ Action: Action
61
+ });
62
+ export { RevealOnHover };
@@ -0,0 +1 @@
1
+ export { SegmentedControl } from './segmentedControl.js';
@@ -0,0 +1 @@
1
+ export { SegmentedControl } from "./segmentedControl.js";
@@ -0,0 +1,41 @@
1
+ import type * as React from 'react';
2
+ import type { CollectionChildren } from '@react-types/shared';
3
+ import type { FormSize } from '../theme/index.js';
4
+ import type { TooltipProps } from '../tooltip/index.js';
5
+ type Priority = 'default' | 'primary' | 'secondary';
6
+ interface SegmentedControlItemProps<Value extends string> {
7
+ key: Value;
8
+ children?: React.ReactNode;
9
+ disabled?: boolean;
10
+ /**
11
+ * Optional icon to be rendered to the left of the segment label. Use this prop to
12
+ * ensure proper vertical alignment.
13
+ *
14
+ * NOTE: if the segment contains only an icon and no text label (i.e. `children` is
15
+ * not defined), then an `aria-label` must be provided for screen reader support.
16
+ */
17
+ icon?: React.ReactNode;
18
+ /** A string representation of the item's contents */
19
+ textValue?: string;
20
+ /**
21
+ * Optional tooltip that appears when the use hovers over the segment. Avoid using
22
+ * tooltips if there are other, more visible ways to display the same information.
23
+ */
24
+ tooltip?: React.ReactNode;
25
+ /**
26
+ * Additional props to be passed into <Tooltip />.
27
+ */
28
+ tooltipOptions?: Omit<TooltipProps, 'children' | 'title' | 'className'>;
29
+ }
30
+ interface SegmentedControlProps<Value extends string> {
31
+ children: CollectionChildren<Value>;
32
+ onChange: (value: Value) => void;
33
+ value: Value;
34
+ priority?: Priority;
35
+ size?: FormSize;
36
+ }
37
+ export declare function SegmentedControl<Value extends string>({ value, onChange, size, priority, ...props }: SegmentedControlProps<Value>): import("@emotion/react/jsx-runtime").JSX.Element;
38
+ export declare namespace SegmentedControl {
39
+ var Item: <Value extends string>(props: SegmentedControlItemProps<Value>) => React.JSX.Element;
40
+ }
41
+ export {};