@sentry/scraps 0.1.0 → 0.3.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 (253) 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 +141 -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/dragHandle/dragHandle.d.ts +34 -0
  56. package/dist/dragHandle/dragHandle.js +115 -0
  57. package/dist/dragHandle/index.d.ts +4 -0
  58. package/dist/dragHandle/index.js +4 -0
  59. package/dist/dragHandle/setDocumentDragging.d.ts +9 -0
  60. package/dist/dragHandle/setDocumentDragging.js +6 -0
  61. package/dist/dragHandle/useDragMove.d.ts +244 -0
  62. package/dist/dragHandle/useDragMove.js +66 -0
  63. package/dist/dragHandle/useDragSeparator.d.ts +256 -0
  64. package/dist/dragHandle/useDragSeparator.js +36 -0
  65. package/dist/emptyState/emptyState.d.ts +10 -0
  66. package/dist/emptyState/emptyState.js +81 -0
  67. package/dist/emptyState/index.d.ts +1 -0
  68. package/dist/emptyState/index.js +1 -0
  69. package/dist/formPresentation/autoSaveContext.d.ts +23 -0
  70. package/dist/formPresentation/autoSaveContext.js +13 -0
  71. package/dist/formPresentation/base.d.ts +11 -0
  72. package/dist/formPresentation/base.js +37 -0
  73. package/dist/formPresentation/displayField.d.ts +17 -0
  74. package/dist/formPresentation/displayField.js +69 -0
  75. package/dist/formPresentation/fieldIds.d.ts +3 -0
  76. package/dist/formPresentation/fieldIds.js +14 -0
  77. package/dist/formPresentation/fieldLayout.d.ts +23 -0
  78. package/dist/formPresentation/fieldLayout.js +76 -0
  79. package/dist/formPresentation/formContext.d.ts +4 -0
  80. package/dist/formPresentation/formContext.js +6 -0
  81. package/dist/formPresentation/groupContext.d.ts +24 -0
  82. package/dist/formPresentation/groupContext.js +22 -0
  83. package/dist/formPresentation/icons.d.ts +11 -0
  84. package/dist/formPresentation/icons.js +61 -0
  85. package/dist/formPresentation/index.d.ts +8 -0
  86. package/dist/formPresentation/index.js +8 -0
  87. package/dist/formPresentation/meta.d.ts +18 -0
  88. package/dist/formPresentation/meta.js +88 -0
  89. package/dist/formPresentation/useStackedLayout.d.ts +1 -0
  90. package/dist/formPresentation/useStackedLayout.js +9 -0
  91. package/dist/hotkey/hotkey.d.ts +22 -0
  92. package/dist/hotkey/hotkey.js +41 -0
  93. package/dist/hotkey/index.d.ts +4 -0
  94. package/dist/hotkey/index.js +3 -0
  95. package/dist/hotkey/kbd.d.ts +1 -0
  96. package/dist/hotkey/keyMappings.d.ts +23 -0
  97. package/dist/hotkey/keyMappings.js +223 -0
  98. package/dist/hotkey/useHotkeys.d.ts +47 -0
  99. package/dist/hotkey/useHotkeys.js +44 -0
  100. package/dist/image/image.d.ts +21 -0
  101. package/dist/image/image.js +20 -0
  102. package/dist/image/index.d.ts +1 -0
  103. package/dist/image/index.js +1 -0
  104. package/dist/info/index.d.ts +2 -0
  105. package/dist/info/index.js +2 -0
  106. package/dist/info/infoText.d.ts +15 -0
  107. package/dist/info/infoText.js +43 -0
  108. package/dist/info/infoTip.d.ts +10 -0
  109. package/dist/info/infoTip.js +54 -0
  110. package/dist/input/index.d.ts +8 -0
  111. package/dist/input/index.js +6 -0
  112. package/dist/input/input.d.ts +19 -0
  113. package/dist/input/input.js +14 -0
  114. package/dist/input/inputGroup.d.ts +29 -0
  115. package/dist/input/inputGroup.js +167 -0
  116. package/dist/input/inputStyles.d.ts +13 -0
  117. package/dist/input/inputStyles.js +52 -0
  118. package/dist/input/numberDragInput.d.ts +20 -0
  119. package/dist/input/numberDragInput.js +97 -0
  120. package/dist/input/numberInput.d.ts +10 -0
  121. package/dist/input/numberInput.js +94 -0
  122. package/dist/input/otpInput.d.ts +28 -0
  123. package/dist/input/otpInput.js +81 -0
  124. package/dist/input/useAutosizeInput.d.ts +17 -0
  125. package/dist/input/useAutosizeInput.js +56 -0
  126. package/dist/interactionStateLayer/index.d.ts +1 -0
  127. package/dist/interactionStateLayer/index.js +1 -0
  128. package/dist/interactionStateLayer/interactionStateLayer.d.ts +23 -0
  129. package/dist/interactionStateLayer/interactionStateLayer.js +67 -0
  130. package/dist/layout/flex.d.ts +1 -0
  131. package/dist/layout/grid.d.ts +1 -0
  132. package/dist/layout/index.d.ts +1 -1
  133. package/dist/layout/index.js +1 -1
  134. package/dist/layout/stack.d.ts +1 -0
  135. package/dist/layout/styles.d.ts +1 -1
  136. package/dist/layout/surface.d.ts +1 -0
  137. package/dist/link/index.d.ts +2 -0
  138. package/dist/link/index.js +2 -0
  139. package/dist/link/link.d.ts +43 -0
  140. package/dist/link/link.js +71 -0
  141. package/dist/link/linkBehaviorContext.d.ts +14 -0
  142. package/dist/link/linkBehaviorContext.js +31 -0
  143. package/dist/loader/indeterminateLoader.d.ts +1 -0
  144. package/dist/overlay.d.ts +59 -0
  145. package/dist/overlay.js +113 -0
  146. package/dist/overlayArrow.d.ts +9 -0
  147. package/dist/overlayArrow.js +55 -0
  148. package/dist/overlayPositioning.d.ts +70 -0
  149. package/dist/overlayPositioning.js +139 -0
  150. package/dist/panelProvider.d.ts +8 -0
  151. package/dist/panelProvider.js +20 -0
  152. package/dist/quote/quote.js +1 -1
  153. package/dist/radio/index.d.ts +1 -0
  154. package/dist/radio/index.js +1 -0
  155. package/dist/radio/radio.d.ts +9 -0
  156. package/dist/radio/radio.js +77 -0
  157. package/dist/renderToString.d.ts +2 -0
  158. package/dist/renderToString.js +25 -0
  159. package/dist/revealOnHover/index.d.ts +1 -0
  160. package/dist/revealOnHover/index.js +1 -0
  161. package/dist/revealOnHover/revealOnHover.d.ts +20 -0
  162. package/dist/revealOnHover/revealOnHover.js +62 -0
  163. package/dist/segmentedControl/index.d.ts +1 -0
  164. package/dist/segmentedControl/index.js +1 -0
  165. package/dist/segmentedControl/segmentedControl.d.ts +41 -0
  166. package/dist/segmentedControl/segmentedControl.js +217 -0
  167. package/dist/separator/separator.d.ts +4 -3
  168. package/dist/separator/separator.js +1 -1
  169. package/dist/sizeContext.d.ts +9 -0
  170. package/dist/sizeContext.js +13 -0
  171. package/dist/slider/index.d.ts +1 -0
  172. package/dist/slider/index.js +1 -0
  173. package/dist/slider/slider.d.ts +41 -0
  174. package/dist/slider/slider.js +386 -0
  175. package/dist/slot/index.d.ts +1 -0
  176. package/dist/slot/index.js +1 -0
  177. package/dist/slot/knownContexts.d.ts +1 -0
  178. package/dist/slot/knownContexts.js +7 -0
  179. package/dist/slot/slot.d.ts +26 -0
  180. package/dist/slot/slot.js +274 -0
  181. package/dist/statusIndicator/index.d.ts +1 -0
  182. package/dist/statusIndicator/index.js +1 -0
  183. package/dist/statusIndicator/statusIndicator.d.ts +24 -0
  184. package/dist/statusIndicator/statusIndicator.js +130 -0
  185. package/dist/switch/index.d.ts +1 -0
  186. package/dist/switch/index.js +1 -0
  187. package/dist/switch/switch.d.ts +6 -0
  188. package/dist/switch/switch.js +172 -0
  189. package/dist/table/index.d.ts +3 -0
  190. package/dist/table/index.js +3 -0
  191. package/dist/table/sortableHeaderCell.d.ts +36 -0
  192. package/dist/table/sortableHeaderCell.js +99 -0
  193. package/dist/table/styles.d.ts +46 -0
  194. package/dist/table/styles.js +93 -0
  195. package/dist/table/table.d.ts +64 -0
  196. package/dist/table/table.js +228 -0
  197. package/dist/table/useColumnResize.d.ts +27 -0
  198. package/dist/table/useColumnResize.js +62 -0
  199. package/dist/table/useObservedColumnSize.d.ts +12 -0
  200. package/dist/table/useObservedColumnSize.js +74 -0
  201. package/dist/text/heading.d.ts +2 -1
  202. package/dist/text/index.d.ts +1 -0
  203. package/dist/text/index.js +1 -0
  204. package/dist/text/prose.d.ts +8 -0
  205. package/dist/text/prose.js +45 -0
  206. package/dist/text/text.d.ts +8 -0
  207. package/dist/text/text.js +1 -1
  208. package/dist/textarea/index.d.ts +1 -0
  209. package/dist/textarea/index.js +1 -0
  210. package/dist/textarea/textarea.d.ts +22 -0
  211. package/dist/textarea/textarea.js +77 -0
  212. package/dist/theme/dark.d.ts +129 -10
  213. package/dist/theme/dark.js +41 -13
  214. package/dist/theme/index.d.ts +3 -12
  215. package/dist/theme/index.js +2 -2
  216. package/dist/theme/light.d.ts +129 -10
  217. package/dist/theme/light.js +42 -14
  218. package/dist/theme/swatch.d.ts +27 -0
  219. package/dist/theme/swatch.js +37 -0
  220. package/dist/theme/theme.d.ts +648 -0
  221. package/dist/theme/theme.js +780 -0
  222. package/dist/theme/types.d.ts +1 -0
  223. package/dist/theme/useInvertedTheme.d.ts +1 -0
  224. package/dist/theme/useInvertedTheme.js +7 -0
  225. package/dist/tooltip/index.d.ts +2 -0
  226. package/dist/tooltip/index.js +2 -0
  227. package/dist/tooltip/tooltip.d.ts +166 -0
  228. package/dist/tooltip/tooltip.js +181 -0
  229. package/dist/tooltip/useDisabledTooltip.d.ts +22 -0
  230. package/dist/tooltip/useDisabledTooltip.js +24 -0
  231. package/dist/trackingContext.d.ts +34 -0
  232. package/dist/trackingContext.js +29 -0
  233. package/dist/translation/index.d.ts +4 -0
  234. package/dist/translation/index.js +4 -0
  235. package/dist/translation/translationContext.d.ts +6 -0
  236. package/dist/translation/translationContext.js +6 -0
  237. package/dist/translation/useTranslation.d.ts +1 -0
  238. package/dist/translation/useTranslation.js +6 -0
  239. package/dist/unreachable.d.ts +1 -0
  240. package/dist/unreachable.js +4 -0
  241. package/dist/useHoverOverlay.d.ts +113 -0
  242. package/dist/useHoverOverlay.js +370 -0
  243. package/dist/useIsInsideInteractiveElement.d.ts +6 -0
  244. package/dist/useIsInsideInteractiveElement.js +31 -0
  245. package/dist/useOverlay.d.ts +82 -0
  246. package/dist/useOverlay.js +217 -0
  247. package/dist/useScrollLock.d.ts +5 -0
  248. package/dist/useScrollLock.js +100 -0
  249. package/dist/useStableMergeRef.d.ts +9 -0
  250. package/dist/useStableMergeRef.js +18 -0
  251. package/package.json +219 -11
  252. package/dist/index.d.ts +0 -9
  253. package/dist/index.js +0 -9
@@ -0,0 +1,247 @@
1
+ const DO_NOT_USE_BUTTON_ICON_SIZES = {
2
+ zero: 'xs',
3
+ xs: 'xs',
4
+ sm: 'sm',
5
+ md: 'sm'
6
+ };
7
+ const elevation = {
8
+ md: '2px',
9
+ sm: '2px',
10
+ xs: '1px',
11
+ zero: '0px'
12
+ };
13
+ const hoverElevation = '1px';
14
+ function DO_NOT_USE_getButtonStyles(p) {
15
+ const variant = p.variant ?? 'secondary';
16
+ const ariaDisabled = p['aria-disabled'];
17
+ const disabled = p.disabled || true === ariaDisabled || 'true' === ariaDisabled;
18
+ const buttonSizes = {
19
+ ...p.theme.form,
20
+ zero: {
21
+ height: '24px',
22
+ minHeight: '24px',
23
+ fontSize: '0.75rem',
24
+ lineHeight: '1rem'
25
+ }
26
+ };
27
+ const buttonTheme = getButtonTheme(variant, p.theme);
28
+ const buttonElevation = elevation[p.size];
29
+ return {
30
+ '--button-lift': buttonElevation,
31
+ position: 'relative',
32
+ display: 'inline-flex',
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ whiteSpace: 'nowrap',
36
+ fontWeight: p.theme.font.weight.sans.medium,
37
+ opacity: disabled ? 0.6 : void 0,
38
+ cursor: 'pointer',
39
+ '&[disabled], &[aria-disabled="true"]': {
40
+ cursor: 'not-allowed'
41
+ },
42
+ padding: 'square' === p.shapeVariant ? '0' : getButtonSizeTheme(p.size, p.theme).padding,
43
+ borderRadius: getButtonSizeTheme(p.size, p.theme).borderRadius,
44
+ border: 'none',
45
+ color: buttonTheme.color,
46
+ background: 'none',
47
+ height: buttonSizes[p.size].height,
48
+ minWidth: 'square' === p.shapeVariant ? buttonSizes[p.size].height : void 0,
49
+ minHeight: buttonSizes[p.size].minHeight,
50
+ fontSize: buttonSizes[p.size].fontSize,
51
+ lineHeight: buttonSizes[p.size].lineHeight,
52
+ '&::before': {
53
+ content: '""',
54
+ display: 'block',
55
+ position: 'absolute',
56
+ inset: '0',
57
+ height: `calc(100% - ${buttonElevation})`,
58
+ top: buttonElevation,
59
+ transform: `translateY(-${buttonElevation})`,
60
+ boxShadow: `0 ${buttonElevation} 0 0px ${buttonTheme.background}`,
61
+ background: buttonTheme.background,
62
+ borderRadius: 'inherit'
63
+ },
64
+ '&::after': {
65
+ content: '""',
66
+ display: 'block',
67
+ position: 'absolute',
68
+ inset: '0',
69
+ background: buttonTheme.surface,
70
+ borderRadius: 'inherit',
71
+ border: `1px solid ${buttonTheme.background}`,
72
+ transform: 'translateY(calc(-1 * var(--button-lift)))',
73
+ transition: `transform ${p.theme.motion.snap.fast}`
74
+ },
75
+ '&:focus-visible': {
76
+ outline: 'none',
77
+ color: disabled || p.busy ? void 0 : buttonTheme.color,
78
+ '&::after': buttonTheme.focus ? {
79
+ border: `2px dotted ${buttonTheme.focus}`
80
+ } : {
81
+ boxShadow: `0 var(--button-lift) 0 0 ${buttonTheme.background}, 0 var(--button-lift) 0 2px ${p.theme.tokens.focus.default}, 0 0 0 2px ${p.theme.tokens.focus.default}`
82
+ }
83
+ },
84
+ '&[aria-busy="true"] > span:last-child': {
85
+ overflow: 'visible'
86
+ },
87
+ '> span:last-child': {
88
+ zIndex: 1,
89
+ position: 'relative',
90
+ display: 'inherit',
91
+ alignItems: 'inherit',
92
+ justifyContent: 'inherit',
93
+ flex: '1',
94
+ gap: 'inherit',
95
+ overflow: 'hidden',
96
+ whiteSpace: 'nowrap',
97
+ transform: 'translateY(calc(-1 * var(--button-lift)))',
98
+ transition: `transform ${p.theme.motion.snap.fast}`
99
+ },
100
+ '&:hover': {
101
+ '--button-lift': `calc(${buttonElevation} + ${hoverElevation})`,
102
+ color: disabled || p.busy ? void 0 : buttonTheme.color
103
+ },
104
+ '&:active, &[aria-expanded="true"], &[aria-checked="true"]': {
105
+ '--button-lift': '0px'
106
+ },
107
+ '&[aria-expanded="true"], &[aria-checked="true"]': {
108
+ '&::after': {
109
+ transition: 'none'
110
+ },
111
+ '> span:last-child': {
112
+ transition: 'none'
113
+ }
114
+ },
115
+ '&:disabled, &[aria-disabled="true"], &[aria-busy="true"]': {
116
+ '--button-lift': '0px'
117
+ },
118
+ '&[aria-busy="true"]': {
119
+ cursor: 'progress'
120
+ },
121
+ ...'link' === variant && {
122
+ transform: 'translateY(0px)',
123
+ '&::before': {
124
+ display: 'none'
125
+ },
126
+ '&::after': {
127
+ display: 'none'
128
+ }
129
+ },
130
+ ...('transparent' === variant || 'link' === variant) && {
131
+ border: 'none',
132
+ transform: 'translateY(0px)',
133
+ '&::before': {
134
+ display: 'none'
135
+ },
136
+ '&::after': {
137
+ display: 'none'
138
+ },
139
+ '&:focus-visible': {
140
+ ...p.theme.focusRing()
141
+ },
142
+ '> span:last-child': {
143
+ transform: 'translateY(0px)'
144
+ },
145
+ '&:hover': {
146
+ '> span:last-child': {
147
+ transform: 'translateY(0px)'
148
+ },
149
+ backgroundColor: p.busy || disabled || 'link' === variant ? 'inherit' : p.theme.colors.gray100
150
+ },
151
+ '&:active': {
152
+ '> span:last-child': {
153
+ transform: 'translateY(0px)'
154
+ },
155
+ backgroundColor: p.busy || disabled || 'link' === variant ? 'inherit' : p.theme.colors.gray200
156
+ }
157
+ },
158
+ ...'link' === variant && {
159
+ padding: '0',
160
+ height: 'auto',
161
+ minHeight: 'auto',
162
+ minWidth: 'auto',
163
+ border: 'none',
164
+ transform: 'translateY(0px)',
165
+ '> span:last-child': {
166
+ color: 'inherit'
167
+ },
168
+ '&:hover': {
169
+ '> span:last-child': {
170
+ transform: 'translateY(0px)'
171
+ }
172
+ }
173
+ }
174
+ };
175
+ }
176
+ function getButtonTheme(variant, theme) {
177
+ switch(variant){
178
+ case 'primary':
179
+ return {
180
+ surface: theme.tokens.interactive.chonky.embossed.accent.background,
181
+ background: theme.tokens.interactive.chonky.embossed.accent.chonk,
182
+ color: theme.tokens.interactive.chonky.embossed.accent.content,
183
+ focus: theme.tokens.focus.onVibrant.light
184
+ };
185
+ case 'secondary':
186
+ return {
187
+ surface: theme.tokens.interactive.chonky.embossed.neutral.background,
188
+ background: theme.tokens.interactive.chonky.embossed.neutral.chonk,
189
+ color: theme.tokens.interactive.chonky.embossed.neutral.content.primary
190
+ };
191
+ case 'warning':
192
+ return {
193
+ surface: theme.tokens.interactive.chonky.embossed.warning.background,
194
+ background: theme.tokens.interactive.chonky.embossed.warning.chonk,
195
+ color: theme.tokens.interactive.chonky.embossed.warning.content,
196
+ focus: theme.tokens.focus.onVibrant.dark
197
+ };
198
+ case 'danger':
199
+ return {
200
+ surface: theme.tokens.interactive.chonky.embossed.danger.background,
201
+ background: theme.tokens.interactive.chonky.embossed.danger.chonk,
202
+ color: theme.tokens.interactive.chonky.embossed.danger.content,
203
+ focus: theme.tokens.focus.onVibrant.light
204
+ };
205
+ case 'transparent':
206
+ return {
207
+ surface: theme.tokens.interactive.transparent.neutral.background.rest,
208
+ background: theme.tokens.interactive.transparent.neutral.background.rest,
209
+ color: theme.tokens.interactive.transparent.neutral.content.primary
210
+ };
211
+ case 'link':
212
+ return {
213
+ surface: 'transparent',
214
+ background: 'transparent',
215
+ color: theme.tokens.interactive.link.accent.rest
216
+ };
217
+ default:
218
+ return {};
219
+ }
220
+ }
221
+ function getButtonSizeTheme(size, theme) {
222
+ switch(size){
223
+ case 'md':
224
+ return {
225
+ borderRadius: theme.radius.lg,
226
+ padding: `${theme.space.md} ${theme.space.xl}`
227
+ };
228
+ case 'sm':
229
+ return {
230
+ borderRadius: theme.radius.md,
231
+ padding: `${theme.space.md} ${theme.space.lg}`
232
+ };
233
+ case 'xs':
234
+ return {
235
+ borderRadius: theme.radius.sm,
236
+ padding: `${theme.space.sm} ${theme.space.md}`
237
+ };
238
+ case 'zero':
239
+ return {
240
+ borderRadius: theme.radius.xs,
241
+ padding: `${theme.space.xs} ${theme.space.sm}`
242
+ };
243
+ default:
244
+ return {};
245
+ }
246
+ }
247
+ export { DO_NOT_USE_BUTTON_ICON_SIZES, DO_NOT_USE_getButtonStyles };
@@ -0,0 +1,77 @@
1
+ import type * as React from 'react';
2
+ import type { Responsive } from '../layout/index.js';
3
+ import type { LinkProps } from '../link/index.js';
4
+ import type { ButtonVariant } from '../theme/index.js';
5
+ import type { TooltipProps } from '../tooltip/index.js';
6
+ import type { AnalyticsProps } from '../trackingContext.js';
7
+ export type { ButtonVariant } from '../theme/index.js';
8
+ export type ButtonSize = 'zero' | 'xs' | 'sm' | 'md';
9
+ export interface DO_NOT_USE_CommonButtonProps extends AnalyticsProps {
10
+ /**
11
+ * Indicates that the button is "doing" something.
12
+ */
13
+ busy?: boolean;
14
+ /**
15
+ * The icon to render inside of the button. The size will be set
16
+ * appropriately based on the size of the button.
17
+ */
18
+ icon?: React.ReactNode;
19
+ /**
20
+ * The size of the button
21
+ */
22
+ size?: Responsive<ButtonSize>;
23
+ /**
24
+ * Button Tooltip Props
25
+ */
26
+ tooltipProps?: Omit<TooltipProps, 'children' | 'skipWrapper'>;
27
+ /**
28
+ * The semantic "variant" of the button. Use `primary` when the action is
29
+ * contextually the primary action, `danger` if the button will do something
30
+ * destructive, `link` for visual similarity to a link.
31
+ */
32
+ variant?: ButtonVariant;
33
+ }
34
+ type ButtonElementProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'label' | 'size' | 'title'>;
35
+ interface BaseButtonProps extends DO_NOT_USE_CommonButtonProps, ButtonElementProps {
36
+ ref?: React.Ref<HTMLButtonElement>;
37
+ }
38
+ interface ButtonPropsWithoutAriaLabel extends BaseButtonProps {
39
+ children: React.ReactNode;
40
+ }
41
+ interface ButtonPropsWithAriaLabel extends BaseButtonProps {
42
+ 'aria-label': string;
43
+ children?: never;
44
+ }
45
+ export type DO_NOT_USE_ButtonProps = ButtonPropsWithoutAriaLabel | ButtonPropsWithAriaLabel;
46
+ type LinkElementProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'label' | 'size' | 'title' | 'href' | 'target'>;
47
+ interface BaseLinkButtonProps extends DO_NOT_USE_CommonButtonProps, LinkElementProps {
48
+ /**
49
+ * Determines if the link is disabled.
50
+ */
51
+ disabled?: boolean;
52
+ }
53
+ interface LinkButtonPropsWithHref extends BaseLinkButtonProps {
54
+ href: string;
55
+ /**
56
+ * Determines if the link is external. External links always open in a new tab.
57
+ */
58
+ external?: boolean;
59
+ }
60
+ interface LinkButtonPropsWithTo extends BaseLinkButtonProps {
61
+ to: LinkProps['to'];
62
+ /**
63
+ * Opens the link in a new tab. Use sparingly — internal links typically
64
+ * should not open in a new tab. For external links, use `href` with
65
+ * `external` instead, which always opens in a new tab.
66
+ */
67
+ openInNewTab?: boolean;
68
+ /**
69
+ * If true, the link will not reset the scroll position of the page when clicked.
70
+ */
71
+ preventScrollReset?: boolean;
72
+ /**
73
+ * Determines if the link should replace the current history entry.
74
+ */
75
+ replace?: boolean;
76
+ }
77
+ export type DO_NOT_USE_LinkButtonProps = LinkButtonPropsWithHref | LinkButtonPropsWithTo;
File without changes
@@ -0,0 +1,5 @@
1
+ import type { DO_NOT_USE_ButtonProps as ButtonProps, DO_NOT_USE_LinkButtonProps as LinkButtonProps } from './types.js';
2
+ export declare function useButtonFunctionality(props: ButtonProps | LinkButtonProps): {
3
+ hasChildren: boolean;
4
+ accessibleLabel: string | undefined;
5
+ };
@@ -0,0 +1,9 @@
1
+ function useButtonFunctionality(props) {
2
+ const accessibleLabel = props['aria-label'] ?? ('string' == typeof props.children ? props.children : void 0);
3
+ const hasChildren = Array.isArray(props.children) ? props.children.some((child)=>!!child || '0' === String(child)) : !!props.children || '0' === String(props.children);
4
+ return {
5
+ hasChildren,
6
+ accessibleLabel
7
+ };
8
+ }
9
+ export { useButtonFunctionality };
@@ -0,0 +1,20 @@
1
+ import type * as React from 'react';
2
+ import type { FormSize } from '../theme/index.js';
3
+ import { type TooltipProps } from '../tooltip/index.js';
4
+ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size'> {
5
+ /**
6
+ * Is the checkbox active? Supports 'indeterminate'
7
+ */
8
+ checked?: React.InputHTMLAttributes<HTMLInputElement>['checked'] | 'indeterminate';
9
+ /**
10
+ * Ref to the native checkbox input element.
11
+ */
12
+ ref?: React.Ref<HTMLInputElement>;
13
+ /**
14
+ * The size of the checkbox. Defaults to 'sm'.
15
+ */
16
+ size?: FormSize;
17
+ /** Tooltip shown on hover or focus. Requires a title when provided. */
18
+ tooltipProps?: Omit<TooltipProps, 'children' | 'skipWrapper'>;
19
+ }
20
+ export declare function Checkbox({ checked, disabled, size, className, ref, tooltipProps, ...props }: CheckboxProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,193 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import is_prop_valid from "@emotion/is-prop-valid";
4
+ import styled from "@emotion/styled";
5
+ import { mergeRefs } from "@react-aria/utils";
6
+ import { Tooltip, useDisabledTooltip } from "../tooltip/index.js";
7
+ const NativeHiddenCheckbox = styled('input')`
8
+ position: absolute;
9
+ opacity: 0;
10
+ top: 0;
11
+ left: 0;
12
+ height: 100%;
13
+ width: 100%;
14
+ margin: 0;
15
+ padding: 0;
16
+ cursor: ${(p)=>p.disabled || p.readOnly ? 'initial' : 'pointer'};
17
+
18
+ &[aria-disabled='true'] {
19
+ cursor: initial;
20
+ }
21
+
22
+ & + * {
23
+ background-color: ${(p)=>p.theme.tokens.interactive.transparent.neutral.background.rest};
24
+ color: ${(p)=>p.theme.tokens.content.onVibrant.light};
25
+ border: 1px solid ${(p)=>p.theme.tokens.border.primary};
26
+
27
+ svg {
28
+ stroke: ${(p)=>p.theme.colors.white};
29
+ }
30
+ }
31
+
32
+ &:focus-visible + * {
33
+ ${(p)=>p.theme.focusRing()};
34
+ }
35
+
36
+ &:disabled + *,
37
+ &[aria-disabled='true'] + * {
38
+ opacity: ${(p)=>p.theme.tokens.interactive.disabled};
39
+ cursor: not-allowed;
40
+ }
41
+
42
+ &:checked + *,
43
+ &:indeterminate + * {
44
+ background-color: ${(p)=>p.theme.tokens.interactive.chonky.debossed.accent.background};
45
+ color: ${(p)=>p.theme.tokens.content.onVibrant.light};
46
+ }
47
+
48
+ &:disabled:checked + *,
49
+ &:disabled:indeterminate + *,
50
+ &[aria-disabled='true']:checked + *,
51
+ &[aria-disabled='true']:indeterminate + * {
52
+ background-color: ${(p)=>p.theme.tokens.interactive.chonky.debossed.accent.background};
53
+ border: 1px solid ${(p)=>p.theme.tokens.interactive.chonky.debossed.accent.chonk};
54
+ opacity: ${(p)=>p.theme.tokens.interactive.disabled};
55
+ }
56
+ `;
57
+ const checkboxSizeMap = {
58
+ xs: {
59
+ box: '12px',
60
+ borderRadius: '2px',
61
+ icon: '10px'
62
+ },
63
+ sm: {
64
+ box: '16px',
65
+ borderRadius: '4px',
66
+ icon: '12px'
67
+ },
68
+ md: {
69
+ box: '22px',
70
+ borderRadius: '6px',
71
+ icon: '18px'
72
+ }
73
+ };
74
+ function preventInteraction(event) {
75
+ event.preventDefault();
76
+ event.stopPropagation();
77
+ }
78
+ function Checkbox({ checked = false, disabled, size = 'sm', className, ref, tooltipProps, ...props }) {
79
+ const { isFocusableDisabled, disabledProps } = useDisabledTooltip({
80
+ disabled,
81
+ tooltipProps,
82
+ onKeyDown: props.onKeyDown,
83
+ 'aria-disabled': props['aria-disabled']
84
+ });
85
+ const nativeCheckBoxRef = useCallback((node)=>{
86
+ if (node) node.indeterminate = 'indeterminate' === checked;
87
+ }, [
88
+ checked
89
+ ]);
90
+ const wrapperProps = {
91
+ className,
92
+ style: props.style
93
+ };
94
+ return /*#__PURE__*/ jsxs(CheckboxWrapper, {
95
+ size: size,
96
+ disabled: disabled,
97
+ readOnly: props.readOnly,
98
+ ...wrapperProps,
99
+ children: [
100
+ /*#__PURE__*/ jsx(Tooltip, {
101
+ skipWrapper: true,
102
+ ...tooltipProps,
103
+ title: tooltipProps?.title,
104
+ children: /*#__PURE__*/ jsx(NativeHiddenCheckbox, {
105
+ ref: mergeRefs(nativeCheckBoxRef, ref),
106
+ checked: 'indeterminate' !== checked && checked,
107
+ type: "checkbox",
108
+ ...props,
109
+ ...disabledProps,
110
+ ...isFocusableDisabled && {
111
+ onClickCapture: preventInteraction,
112
+ onChange: preventInteraction,
113
+ name: void 0,
114
+ required: void 0
115
+ }
116
+ })
117
+ }),
118
+ /*#__PURE__*/ jsx(FakeCheckbox, {
119
+ "aria-hidden": true,
120
+ size: size,
121
+ children: (true === checked || 'indeterminate' === checked) && /*#__PURE__*/ jsx(CheckboxIcon, {
122
+ viewBox: "0 0 16 16",
123
+ size: checkboxSizeMap[size].icon,
124
+ children: 'indeterminate' === checked ? /*#__PURE__*/ jsx("path", {
125
+ d: "M3 8H13"
126
+ }) : /*#__PURE__*/ jsx("path", {
127
+ d: "M2.86 9.14C4.42 10.7 6.9 13.14 6.86 13.14L12.57 3.43"
128
+ })
129
+ })
130
+ })
131
+ ]
132
+ });
133
+ }
134
+ const CheckboxWrapper = styled('div', {
135
+ shouldForwardProp: (prop)=>'string' == typeof prop && is_prop_valid(prop) && ![
136
+ 'disabled',
137
+ 'readOnly'
138
+ ].includes(prop)
139
+ })`
140
+ position: relative;
141
+ cursor: ${(p)=>p.disabled || p.readOnly ? 'initial' : 'pointer'};
142
+ display: inline-flex;
143
+ justify-content: flex-start;
144
+ border-radius: ${(p)=>checkboxSizeMap[p.size].borderRadius};
145
+
146
+ &::after {
147
+ content: '';
148
+ display: ${(p)=>p.disabled || p.readOnly ? 'none' : 'block'};
149
+ position: absolute;
150
+ inset: 0;
151
+ border-radius: inherit;
152
+ background-color: currentcolor;
153
+ pointer-events: none;
154
+ opacity: 0;
155
+ }
156
+
157
+ &:hover::after {
158
+ opacity: 0.06;
159
+ }
160
+
161
+ &:has(input:checked, input:indeterminate):hover::after {
162
+ opacity: 0.085;
163
+ }
164
+
165
+ &:active::after {
166
+ opacity: 0.09;
167
+ }
168
+
169
+ &:has(input:checked, input:indeterminate):active::after {
170
+ opacity: 0.12;
171
+ }
172
+ `;
173
+ const FakeCheckbox = styled('div')`
174
+ position: relative;
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: center;
178
+ color: inherit;
179
+ width: ${(p)=>checkboxSizeMap[p.size].box};
180
+ height: ${(p)=>checkboxSizeMap[p.size].box};
181
+ border-radius: ${(p)=>checkboxSizeMap[p.size].borderRadius};
182
+ pointer-events: none;
183
+ `;
184
+ const CheckboxIcon = styled('svg')`
185
+ width: ${(p)=>p.size};
186
+ height: ${(p)=>p.size};
187
+
188
+ fill: none;
189
+ stroke-linecap: round;
190
+ stroke-linejoin: round;
191
+ stroke-width: calc(1.4px + ${(p)=>p.size} * 0.04);
192
+ `;
193
+ export { Checkbox };
@@ -0,0 +1 @@
1
+ export { Checkbox, type CheckboxProps } from './checkbox.js';
@@ -0,0 +1 @@
1
+ export { Checkbox } from "./checkbox.js";
@@ -0,0 +1,128 @@
1
+ import type * as React from 'react';
2
+ import { type TextProps } from '../text/index.js';
3
+ declare const SIZES: {
4
+ readonly xs: {
5
+ readonly height: "20px";
6
+ readonly radius: "2xs";
7
+ readonly pad: "xs";
8
+ readonly font: "sm";
9
+ readonly dismiss: "20px";
10
+ };
11
+ readonly sm: {
12
+ readonly height: "24px";
13
+ readonly radius: "xs";
14
+ readonly pad: "sm";
15
+ readonly font: "md";
16
+ readonly dismiss: "20px";
17
+ };
18
+ readonly md: {
19
+ readonly height: "28px";
20
+ readonly radius: "sm";
21
+ readonly pad: "md";
22
+ readonly font: "md";
23
+ readonly dismiss: "24px";
24
+ };
25
+ };
26
+ type ChipSize = keyof typeof SIZES;
27
+ interface ChipRootProps extends React.HTMLAttributes<HTMLDivElement> {
28
+ children: React.ReactNode;
29
+ /**
30
+ * Renders a non-interactive summary: interactive sections fall back to inert
31
+ * text and the dismiss affordance is suppressed.
32
+ */
33
+ readonly?: boolean;
34
+ size?: ChipSize;
35
+ }
36
+ /**
37
+ * The chonky-embossed container. Owns `size`, `readonly`, and focus management
38
+ * for the sections composed inside it.
39
+ */
40
+ declare function ChipRoot({ size, readonly, children, ...rest }: ChipRootProps): import("@emotion/react/jsx-runtime").JSX.Element;
41
+ interface ChipSectionProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
42
+ children: React.ReactNode;
43
+ /**
44
+ * Force interactive (button) rendering even without an `onClick`. Interactive
45
+ * is otherwise inferred from the presence of `onClick`.
46
+ */
47
+ interactive?: boolean;
48
+ ref?: React.Ref<HTMLButtonElement>;
49
+ /**
50
+ * Overrides the default text color for the section.
51
+ */
52
+ variant?: TextProps<'span'>['variant'];
53
+ }
54
+ /**
55
+ * The filter key, shown first. Becomes a button when given an `onClick`.
56
+ */
57
+ declare function ChipProperty(props: ChipSectionProps): import("@emotion/react/jsx-runtime").JSX.Element;
58
+ /**
59
+ * The comparison operator (e.g. `is`). Becomes a button when given an `onClick`.
60
+ */
61
+ declare function ChipOperator(props: ChipSectionProps): import("@emotion/react/jsx-runtime").JSX.Element;
62
+ /**
63
+ * The filter value. Becomes a button when given an `onClick`.
64
+ */
65
+ declare function ChipValue(props: ChipSectionProps): import("@emotion/react/jsx-runtime").JSX.Element;
66
+ interface ChipDismissProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
67
+ ref?: React.Ref<HTMLButtonElement>;
68
+ }
69
+ /**
70
+ * The trailing ✕ button. Suppressed when the chip is `readonly`. Clicks are kept
71
+ * from bubbling so removing a chip does not also trigger click handlers on the
72
+ * chip itself or an ancestor (e.g. click-to-edit).
73
+ */
74
+ declare function ChipDismiss({ onClick, ref, ...rest }: ChipDismissProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
75
+ interface BaseFlatChipProps extends React.HTMLAttributes<HTMLDivElement> {
76
+ value: string;
77
+ /**
78
+ * The comparison operator shown between property and value (e.g. `is`).
79
+ */
80
+ operator?: string;
81
+ /**
82
+ * The filter key, shown first.
83
+ */
84
+ property?: string;
85
+ size?: ChipSize;
86
+ }
87
+ interface DismissableFlatChipProps extends BaseFlatChipProps {
88
+ /**
89
+ * Called when the dismiss affordance is activated. Providing it renders a
90
+ * trailing ✕ button; omit it for a static chip.
91
+ */
92
+ onDismiss?: () => void;
93
+ readonly?: false;
94
+ }
95
+ interface ReadonlyFlatChipProps extends BaseFlatChipProps {
96
+ /**
97
+ * Renders a non-interactive summary: the value reads as secondary and the
98
+ * dismiss affordance is suppressed. Readonly chips cannot be dismissed.
99
+ */
100
+ readonly: true;
101
+ onDismiss?: never;
102
+ }
103
+ type FlatChipProps = DismissableFlatChipProps | ReadonlyFlatChipProps;
104
+ /**
105
+ * A compact, chonky-embossed token for search filters and standalone values.
106
+ *
107
+ * The flat form renders `property operator value` or a lone `value` from
108
+ * strings — presentation only, no interaction. For per-section interaction
109
+ * (click-to-edit, remove), compose the primitives directly:
110
+ *
111
+ * ```tsx
112
+ * <Chip.Root size="sm">
113
+ * <Chip.Property onClick={editKey}>{key}</Chip.Property>
114
+ * <Chip.Operator onClick={editOperator}>{operator}</Chip.Operator>
115
+ * <Chip.Value onClick={editValue}>{value}</Chip.Value>
116
+ * <Chip.Dismiss onClick={remove} />
117
+ * </Chip.Root>
118
+ * ```
119
+ */
120
+ export declare function Chip({ size, property, operator, readonly, value, onDismiss, ...rest }: FlatChipProps): import("@emotion/react/jsx-runtime").JSX.Element;
121
+ export declare namespace Chip {
122
+ var Root: typeof ChipRoot;
123
+ var Property: typeof ChipProperty;
124
+ var Operator: typeof ChipOperator;
125
+ var Value: typeof ChipValue;
126
+ var Dismiss: typeof ChipDismiss;
127
+ }
128
+ export {};