@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,217 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { createElement, css } from "@emotion/react";
3
+ import { useMemo, useRef } from "react";
4
+ import styled from "@emotion/styled";
5
+ import { useRadio, useRadioGroup } from "@react-aria/radio";
6
+ import { Item, useCollection } from "@react-stately/collections";
7
+ import { ListCollection } from "@react-stately/list";
8
+ import { useRadioGroupState } from "@react-stately/radio";
9
+ import { LayoutGroup } from "framer-motion";
10
+ import { DO_NOT_USE_getButtonStyles } from "../button/index.js";
11
+ import { Tooltip } from "../tooltip/index.js";
12
+ const getChildTransforms = (count)=>Array.from({
13
+ length: count
14
+ }, (_, index)=>css`
15
+ label:nth-of-type(${index + 1}) {
16
+ transform: translateX(-${index}px);
17
+ }
18
+ `);
19
+ function getTextColor({ isSelected, priority, theme }) {
20
+ if (isSelected) return 'default' === priority || 'secondary' === priority ? theme.tokens.interactive.chonky.embossed.neutral.content.accent : void 0;
21
+ return theme.tokens.content.secondary;
22
+ }
23
+ const segmentedWrapPadding = {
24
+ md: '10px 16px 10px 16px',
25
+ sm: '8px 12px 8px 12px',
26
+ xs: '6px 8px 6px 8px'
27
+ };
28
+ const collectionFactory = (nodes)=>new ListCollection(nodes);
29
+ function SegmentedControl({ value, onChange, size = 'md', priority = 'default', ...props }) {
30
+ const ref = useRef(null);
31
+ const collection = useCollection(props, collectionFactory);
32
+ const ariaProps = {
33
+ ...props,
34
+ value,
35
+ onChange: onChange,
36
+ orientation: 'horizontal'
37
+ };
38
+ const state = useRadioGroupState(ariaProps);
39
+ const { radioGroupProps } = useRadioGroup(ariaProps, state);
40
+ const collectionList = useMemo(()=>[
41
+ ...collection
42
+ ], [
43
+ collection
44
+ ]);
45
+ return /*#__PURE__*/ jsx(GroupWrap, {
46
+ ...radioGroupProps,
47
+ ...props,
48
+ size: size,
49
+ priority: priority,
50
+ ref: ref,
51
+ listSize: collectionList.length,
52
+ children: /*#__PURE__*/ jsx(LayoutGroup, {
53
+ id: radioGroupProps.id,
54
+ children: collectionList.map((option)=>/*#__PURE__*/ createElement(Segment, {
55
+ ...option.props,
56
+ key: option.key,
57
+ nextKey: option.nextKey,
58
+ prevKey: option.prevKey,
59
+ value: String(option.key),
60
+ isDisabled: option.props.disabled,
61
+ state: state,
62
+ size: size,
63
+ priority: priority,
64
+ layoutGroupId: radioGroupProps.id
65
+ }, option.rendered))
66
+ })
67
+ });
68
+ }
69
+ SegmentedControl.Item = Item;
70
+ function Segment({ state, size, priority, tooltip, tooltipOptions = {}, icon, ...props }) {
71
+ const ref = useRef(null);
72
+ const { inputProps } = useRadio(props, state, ref);
73
+ const isSelected = state.selectedValue === props.value;
74
+ const { isDisabled } = props;
75
+ const label = /*#__PURE__*/ jsx(VisibleLabel, {
76
+ children: props.children
77
+ });
78
+ const content = /*#__PURE__*/ jsxs(SegmentWrap, {
79
+ size: size,
80
+ shapeVariant: props.children ? 'rectangular' : 'square',
81
+ isSelected: isSelected,
82
+ isDisabled: isDisabled,
83
+ priority: priority,
84
+ "data-test-id": props.value,
85
+ "aria-checked": isSelected,
86
+ "aria-disabled": isDisabled,
87
+ children: [
88
+ /*#__PURE__*/ jsx(SegmentInput, {
89
+ ...inputProps,
90
+ ref: ref
91
+ }),
92
+ /*#__PURE__*/ jsxs(LabelWrap, {
93
+ size: size,
94
+ isSelected: isSelected,
95
+ priority: priority,
96
+ role: "presentation",
97
+ children: [
98
+ icon,
99
+ props.children && label
100
+ ]
101
+ })
102
+ ]
103
+ });
104
+ if (tooltip) return /*#__PURE__*/ jsx(Tooltip, {
105
+ skipWrapper: true,
106
+ title: tooltip,
107
+ delay: 500,
108
+ position: 'bottom',
109
+ ...tooltipOptions,
110
+ children: content
111
+ });
112
+ return content;
113
+ }
114
+ const GroupWrap = styled('div')`
115
+ position: relative;
116
+ display: inline-grid;
117
+ grid-auto-flow: column;
118
+ min-width: 0;
119
+
120
+ font-size: ${(p)=>p.theme.form[p.size].fontSize};
121
+ height: ${(p)=>p.theme.form[p.size].height};
122
+ line-height: ${(p)=>p.theme.form[p.size].lineHeight};
123
+ min-height: ${(p)=>p.theme.form[p.size].minHeight};
124
+
125
+ & > label:first-child {
126
+ border-top-right-radius: 0;
127
+ border-bottom-right-radius: 0;
128
+ }
129
+
130
+ & > label:not(:first-child):not(:last-child) {
131
+ border-radius: 0;
132
+ }
133
+
134
+ & > label:last-child {
135
+ border-top-left-radius: 0;
136
+ border-bottom-left-radius: 0;
137
+ }
138
+
139
+ ${(p)=>getChildTransforms(p.listSize)}
140
+ `;
141
+ const SegmentWrap = styled('label')`
142
+ position: relative;
143
+ display: flex;
144
+ align-items: center;
145
+ margin: 0;
146
+ cursor: ${(p)=>p.isDisabled ? 'default' : 'pointer'};
147
+ min-height: 0;
148
+ min-width: 0;
149
+ z-index: ${(p)=>p.isSelected ? 1 : void 0};
150
+
151
+ padding: ${(p)=>segmentedWrapPadding[p.size]};
152
+ font-weight: ${(p)=>p.theme.font.weight.sans.regular};
153
+
154
+ ${(p)=>({
155
+ ...DO_NOT_USE_getButtonStyles({
156
+ ...p,
157
+ disabled: p.isDisabled,
158
+ variant: p.isSelected && 'primary' === p.priority ? 'primary' : 'secondary',
159
+ shapeVariant: p.shapeVariant
160
+ })
161
+ })}
162
+
163
+ &:has(input:focus-visible) {
164
+ ${(p)=>p.theme.focusRing()};
165
+
166
+ /* Hide fallback ring when :has works */
167
+ span {
168
+ box-shadow: none !important;
169
+ }
170
+ }
171
+
172
+ /* Fallback ring (for Firefox, where :has doesn't work) */
173
+ input:focus-visible + span {
174
+ ${({ theme })=>theme.focusRing()};
175
+ }
176
+ `;
177
+ const SegmentInput = styled('input')`
178
+ appearance: none;
179
+ position: absolute;
180
+ top: 0;
181
+ left: 0;
182
+ bottom: 0;
183
+ right: 0;
184
+
185
+ border-radius: ${(p)=>p.theme.radius.md};
186
+ transition: box-shadow 0.125s ease-out;
187
+ z-index: -1;
188
+
189
+ /* Reset global styles */
190
+ && {
191
+ padding: 0;
192
+ margin: 0;
193
+ }
194
+
195
+ &:focus {
196
+ outline: none;
197
+ }
198
+ `;
199
+ const LabelWrap = styled('span')`
200
+ display: grid;
201
+ grid-auto-flow: column;
202
+ align-items: center;
203
+ gap: ${(p)=>'xs' === p.size ? p.theme.space.xs : p.theme.space.sm};
204
+ z-index: 1;
205
+ color: ${(p)=>getTextColor(p)};
206
+ `;
207
+ const VisibleLabel = styled('span')`
208
+ display: block;
209
+ width: 100%;
210
+ white-space: nowrap;
211
+ overflow: hidden;
212
+ text-overflow: ellipsis;
213
+ user-select: none;
214
+ font-weight: ${(p)=>p.theme.font.weight.sans.medium};
215
+ text-align: center;
216
+ `;
217
+ export { SegmentedControl };
@@ -1,4 +1,5 @@
1
- import type { ContainerProps } from '../layout/index.js';
1
+ import type * as React from 'react';
2
+ import type { ContainerProps } from '../layout/container.js';
2
3
  export type SeparatorProps = Pick<ContainerProps, 'border' | 'margin' | 'padding'> & {
3
4
  orientation: 'horizontal' | 'vertical';
4
5
  children?: never;
@@ -7,9 +8,9 @@ export type SeparatorProps = Pick<ContainerProps, 'border' | 'margin' | 'padding
7
8
  * We require a wrapper if we want to use the orientation context,
8
9
  * otherwise the styling won't work as override needs to come from the parent.
9
10
  */
10
- export declare const Separator: import("@emotion/styled").StyledComponent<Pick<ContainerProps, "border" | "padding" | "margin"> & {
11
+ export declare const Separator: import("@emotion/styled").StyledComponent<Pick<ContainerProps, "border" | "margin" | "padding"> & {
11
12
  orientation: "horizontal" | "vertical";
12
13
  children?: never;
13
- } & Omit<import("react").HTMLAttributes<HTMLHRElement>, "aria-orientation"> & {
14
+ } & Omit<React.HTMLAttributes<HTMLHRElement>, "aria-orientation"> & {
14
15
  theme?: import("@emotion/react").Theme;
15
16
  }, {}, {}>;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "@emotion/react/jsx-runtime";
2
2
  import is_prop_valid from "@emotion/is-prop-valid";
3
3
  import styled from "@emotion/styled";
4
- import { getBorder, getMargin, getSpacing, rc } from "../layout/index.js";
4
+ import { getBorder, getMargin, getSpacing, rc } from "../layout/styles.js";
5
5
  const omitSeparatorProps = new Set([
6
6
  'border'
7
7
  ]);
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ type SizeVariant = 'xs' | 'sm' | 'md';
3
+ export declare const SizeContext: React.Context<SizeVariant | undefined>;
4
+ export declare function SizeProvider({ size, children, }: {
5
+ children: React.ReactNode;
6
+ size: SizeVariant;
7
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export declare function useSizeContext(): SizeVariant | undefined;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ const SizeContext = /*#__PURE__*/ createContext(void 0);
4
+ function SizeProvider({ size, children }) {
5
+ return /*#__PURE__*/ jsx(SizeContext, {
6
+ value: size,
7
+ children: children
8
+ });
9
+ }
10
+ function useSizeContext() {
11
+ return useContext(SizeContext);
12
+ }
13
+ export { SizeContext, SizeProvider, useSizeContext };
@@ -0,0 +1 @@
1
+ export { Slider, type SliderProps } from './slider.js';
@@ -0,0 +1 @@
1
+ export { Slider } from "./slider.js";
@@ -0,0 +1,41 @@
1
+ import type * as React from 'react';
2
+ interface BaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'id'> {
3
+ defaultValue?: number;
4
+ disabled?: boolean;
5
+ /** Intl.NumberFormat options for automatic numeric formatting. Pass `'hidden'` to hide all labels. */
6
+ formatOptions?: Intl.NumberFormatOptions | 'hidden';
7
+ /** ID applied to the hidden input element (enables label `htmlFor` linking) */
8
+ id?: string;
9
+ max?: number;
10
+ min?: number;
11
+ /** Name for the hidden input element (for form submissions) */
12
+ name?: string;
13
+ /** Called when the user finishes adjusting the slider (on mouse/pointer/touch release or keyboard commit). */
14
+ onChangeEnd?: (value: number) => void;
15
+ ref?: React.Ref<HTMLInputElement>;
16
+ step?: number;
17
+ /** Tick mark configuration. Use `count` for evenly spaced ticks, `interval` for fixed spacing, or `values` for explicit positions. Set `labels` to show value labels below ticks. */
18
+ ticks?: {
19
+ count: number;
20
+ labels?: boolean;
21
+ } | {
22
+ interval: number;
23
+ labels?: boolean;
24
+ } | {
25
+ values: number[];
26
+ labels?: boolean;
27
+ };
28
+ }
29
+ interface ControlledProps extends BaseProps {
30
+ onChange: (value: number) => void;
31
+ /** Accepts `''` for backwards compatibility with legacy form fields. */
32
+ value: number | '';
33
+ }
34
+ interface UncontrolledProps extends BaseProps {
35
+ defaultValue?: number;
36
+ onChange?: never;
37
+ value?: never;
38
+ }
39
+ export type SliderProps = ControlledProps | UncontrolledProps;
40
+ export declare function Slider({ min, max, step, disabled, ticks, formatOptions, name, id, onChangeEnd, className, ref, ...props }: SliderProps): import("@emotion/react/jsx-runtime").JSX.Element;
41
+ export {};